diff -u --recursive --new-file v2.3.30/linux/Documentation/Configure.help linux/Documentation/Configure.help --- v2.3.30/linux/Documentation/Configure.help Tue Dec 7 09:32:38 1999 +++ linux/Documentation/Configure.help Wed Dec 8 10:42:39 1999 @@ -1720,6 +1720,19 @@ kernel will try the direct access method and falls back to the BIOS if that doesn't work. If unsure, go with the default. +PCI device name database +CONFIG_PCI_NAMES + By default, the kernel contains a database of all known PCI device + names to make the information in /proc/pci, /proc/ioports and similar + files comprehensible to the user. This database increases size of + the kernel image by about 80KB, but it gets freed after the system + boots up, so it doesn't take up kernel memory. Anyway, if you are + building an installation floppy or kernel for an embedded system + where kernel image size really matters, you can disable this feature + and you'll get device ID numbers instead of names. + + When in doubt, say Y. + MCA support CONFIG_MCA MicroChannel Architecture is found in some IBM PS/2 machines and @@ -5513,6 +5526,83 @@ On some computers the card ends up in non-valid state after some time. Use a ping-reset script to clear it. +Aironet 4500/4800 series adapters +CONFIG_AIRONET4500 + www.aironet.com (recently bought by Cisco) makes these 802.11 DS + adapters. Driver by Elmer Joandi (elmer@ylenurme.ee). + Work sponsored by www.spectrumwireless.net and www.vendomar.ee + This configuration option enables common code for all devices (PCI, ISA, + PCMCIA) + module is aironet4500_core + quickconfig parameters: + SSID=tsunami - "The Password" + adhoc=1 there are no Access Points around + master=1 Adhoc master (the one who creates network sync) + slave=1 Adhoc slave(btw, it is still forming own net + sometimes) + channel=1..? meaningful in adhoc mode + all other parameters can be set via proc interface + These parameters belong to .._card module, but alas, they are here + +Aironet 4500/4800 ISA/PCI/PNP/365 support +CONFIG_AIRONET4500_NONCS + This is module aironet4500_card, which includes _possibility_ to + support for following + PCI device + ISA device in ISA mode(does not work currently) + ISA device in PNP mode + PCMCIA device _without_ cardservices, direct 365 chip INIT, + does not work currently + PCMCIA _with_ CardServices(normal way) is at another module + radio parameters are currently configurable at ..._core module + +Aironet 4500/4800 PNP support +CONFIG_AIRONET4500_PNP + This option should be enabled for ISA cards, remember to enable + PNP jumper on board. + module aironet4500_card + +Aironet 4500/4800 PCI support +CONFIG_AIRONET4500_PCI + This option should be enabled for PCI cards + module aironet4500_card + +Aironet 4500/4800 ISA broken support (EXPERIMENTAL) +CONFIG_AIRONET4500_ISA + This option enables support for ISA cards in non-PNP mode. + Does not operate correctly by now. + module aironet4500_card + +Aironet 4500/4800 I365 broken support (EXPERIMENTAL) +CONFIG_AIRONET4500_I365 + This option enables support for PCMCIA cards on i365 controller + _without_ cardservices. Doesnt have much sense and is not working + properly. Comes from times where there was no PCMCIA support in + kernel main source tree + +Aironet 4500/4800 PCMCIA support +CONFIG_AIRONET4500_CS + This option enables support for PCMCIA cards to be used with + CardServices. + This is not for ISA and PCI adapters. + module aironet4500_cs.o + The same option is both on: + 1. PCMCIA netdevices configuring panel + 2. Wireless netdevices configuring panel + Possibility to change this option depeds on options set in 2. + +Aironet 4500/4800 PROC interface +CONFIG_AIRONET4500_PROC + This option enables /proc/sys/aironet4500 interface for + configuring the device. + NOTE: it takes lot of memory. Compile it as module and remove + after configuration + module: aironet4500_proc + + + + + LAPB over Ethernet driver CONFIG_LAPBETHER This is a driver for a pseudo device (typically called /dev/lapb0) @@ -9960,6 +10050,10 @@ synchronization, security, and DMA transfers. Select the module that provides support for your graphics card. +tdfx Direct Rendering Manager (XFree86 DRI support) +CONFIG_DRM_TDFX + Choose M here if you have a 3dfx Banshee/Voodoo3 graphics card. + 3dlabs GMX 2000 Direct Rendering Driver (XFree86 DRI support) CONFIG_DRM_GAMMA Choose M here if you have a 3dlabs GMX 2000 graphics card. @@ -10352,83 +10446,117 @@ Joystick support CONFIG_JOYSTICK - If you have a joystick, you can say Y here to enable generic - joystick support. You will also need to say Y or M to at least one - of the hardware specific joystick drivers. This will make the - joysticks available as /dev/jsX devices. Please read the file - Documentation/joystick.txt which contains more information and the - location of the joystick package that you'll need. + If you have a joystick, 6dof controller, gamepad, steering wheel, + weapon control system or something like that you can say Y here to + enable generic support for these controllers. You will also need to + say Y or M to at least one of the hardware specific drivers. This + will make the controllers available as /dev/jsX devices. Please read + the file Documentation/joystick.txt which contains more information + and the location of the joystick package that you'll need. - This driver 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 joystick.o. If you want to compile it as a - module, say M here and read Documentation/modules.txt. - -Classic PC analog joysticks and gamepads +Classic PC analog CONFIG_JOY_ANALOG - Say Y here if you have an analog joystick or gamepad that connects - to the PC gameport. This supports many different types, including - joysticks with throttle control, with rudders, or with extensions - like additional hats and buttons compatible with CH Flightstick Pro, + Say Y here if you have a controller that connects to the PC + gameport. This supports many different types, including joysticks + with throttle control, with rudders, or with extensions like + additional hats and buttons compatible with CH Flightstick Pro, ThrustMaster FCS or 6 and 8 button gamepads. For more information on how to use the driver please read Documentation/joystick.txt -FPGaming and MadCatz A3D controllers -CONFIG_JOY_ASSASIN - Say Y here if you have an FPGaming Assasin 3D, MadCatz Panther or - MadCatz Panther XL. For more information on how to use the driver - please read Documentation/joystick.txt +FPGaming and MadCatz A3D +CONFIG_JOY_ASSASSIN + Say Y here if you have an FPGaming or MadCatz controller using the + A3D protocol over the PC gameport. For more information on how to + use the driver please read Documentation/joystick.txt -Gravis GrIP joysticks and gamepads +Gravis GrIP CONFIG_JOY_GRAVIS - Say Y here if you have a Gravis GamePad Pro, Gravis Xterminator or - Gravis Blackhawk Digital. For more information on how to use the - driver please read Documentation/joystick.txt + Say Y here if you have a Gravis controller using the GrIP protocol + over the PC gameport. For more information on how to use the driver + please read Documentation/joystick.txt -PDPI Lightning 4 gamecards +Logitech ADI +CONFIG_JOY_LOGITECH + Say Y here if you have a Logitech controller using the ADI + protocol over the PC gameport. For more information on how to use + the driver please read Documentation/joystick.txt + +Microsoft SideWinder +CONFIG_JOY_SIDEWINDER + Say Y here if you have a Microsoft controller using the Digital + Overdrive protocol over PC gameport. For more information on how to + use the driver please read Documentation/joystick.txt + +ThrustMaster DirectConnect +CONFIG_JOY_THRUSTMASTER + Say Y here if you have a ThrustMaster controller using the + DirectConnect (BSP) protocol over the PC gameport. For more + information on how to use the driver please read + Documentation/joystick.txt + +Creative Labs Blaster +CONFIG_JOY_CREATIVE + Say Y here if you have a Creative Labs controller using the + Blaster protocol over the PC gameport. For more information on how + to use the driver please read Documentation/joystick.txt + +PDPI Lightning 4 card CONFIG_JOY_LIGHTNING Say Y here if you have a PDPI Lightning 4 gamecard and an analog joystick or gamepad connected to it. For more information on how to use the driver please read Documentation/joystick.txt -Logitech Digital joysticks and gamepads -CONFIG_JOY_LOGITECH - Say Y here if you have a Logitech WingMan Extreme Digital, - Logitech ThunderPad Digital or Logitech CyberMan 2. For more +Trident 4DWave and Aureal Vortex gameport +CONFIG_JOY_PCI + Say Y here if you have a Trident 4DWave DX/NX or Aureal Vortex 1/2 + card and want to use its gameport in its enhanced digital mode + with and ordinary analog joystick. For more information on how to + use the driver please read Documentation/joystick.txt + +Magellan and Space Mouse +CONFIG_JOY_MAGELLAN + Say Y here if you have a Magellan or Space Mouse 6DOF controller + connected to your computer's serial port. For more information on + how to use the driver please read Documentation/joystick.txt + +SpaceTec SpaceOrb 360 and SpaceBall Avenger +CONFIG_JOY_SPACEORB + Say Y here if you have a SpaceOrb 360 or SpaceBall Avenger 6DOF + controller connected to your computer's serial port. For more information on how to use the driver please read Documentation/joystick.txt -Microsoft SideWinder, Genius Digital joysticks and gamepads -CONFIG_JOY_SIDEWINDER - Say Y here if you have a Microsoft SideWinder 3d Pro, Microsoft - SideWinder Precision Pro, Microsoft SideWinder Force Feedback Pro, - Microsoft Sidewinder GamePad or Genius Flight2000 F-23 Digital. For - more information on how to use the driver please read +SpaceTec SpaceBall 4000 FLX +CONFIG_JOY_SPACEBALL + Say Y here if you have a SpaceTec SpaceBall 4000 FLX + controller connected to your computer's serial port. For more + information on how to use the driver please read Documentation/joystick.txt -ThrustMaster DirectConnect joysticks and gamepads -CONFIG_JOY_THRUSTMASTER - Say Y here if you have a ThrustMaster Millenium 3D Inceptor or a - ThrustMaster 3D Rage Pad. For more information on how to use the - driver please read Documentation/joystick.txt +Logitech WingMan Warrior +CONFIG_JOY_WARRIOR + Say Y here if you have a Logitech WingMan Warrior controller + connected to your computer's serial port. For more information on + how to use the driver please read Documentation/joystick.txt -NES, SNES, PSX, Multisystem joysticks and gamepads +NES, SNES, N64, PSX, Multi CONFIG_JOY_CONSOLE Say Y here if you have a Nintendo Entertainment System gamepad, - Super Nintendo Entertainment System gamepad, Sony PlayStation - gamepad or a Multisystem -- Atari, Amiga, Commodore, Amstrad CPC - joystick. For more information on how to use the driver please read + Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad, + Sony PlayStation gamepad or a Multisystem -- Atari, Amiga, + Commodore, Amstrad CPC joystick connected to your parallel port. + For more information on how to use the driver please read Documentation/joystick.txt and Documentation/joystick-parport.txt -Sega, Multisystem joysticks and gamepads +Sega, Multi CONFIG_JOY_DB9 Say Y here if you have a Sega Master System gamepad, Sega Genesis gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga, - Commodore, Amstrad CPC joystick. For more information on how to use - the driver please read Documentation/joystick.txt and - Documentation/joystick-parport.txt + Commodore, Amstrad CPC joystick connected to your parallel port. For + more information on how to use the driver please read + Documentation/joystick.txt and Documentation/joystick-parport.txt -TurboGraFX Multisystem joystick interface +TurboGraFX interface CONFIG_JOY_TURBOGRAFX Say Y here if you have the TurboGraFX interface by Steffen Schwenke, and want to use it with Multiststem -- Atari, Amiga, Commodore, diff -u --recursive --new-file v2.3.30/linux/Documentation/joystick-api.txt linux/Documentation/joystick-api.txt --- v2.3.30/linux/Documentation/joystick-api.txt Wed Aug 4 21:08:36 1999 +++ linux/Documentation/joystick-api.txt Tue Dec 7 10:13:11 1999 @@ -74,10 +74,9 @@ 2nd Axis Y 3 ...and so on -Hats vary from one joystick type to another. Some can be moved in 8 -directions, some only in 4. The driver, however, always reports a hat -as two independent axis, even if the hardware doesn't allow independent -movement. +Hats vary from one joystick type to another. Some can be moved in 8 +directions, some only in 4, The driver, however, always reports a hat as two +independent axis, even if the hardware doesn't allow independent movement. 2.3 js_event.value @@ -300,7 +299,7 @@ center, and 255 maximum value. The v0.8.0.2 driver also had an interface for 'digital joysticks', (now -called Multisystem joystick in this driver), under /dev/djsX. This driver +called Multisystem joysticks in this driver), under /dev/djsX. This driver doesn't try to be compatible with that interface. diff -u --recursive --new-file v2.3.30/linux/Documentation/joystick-parport.txt linux/Documentation/joystick-parport.txt --- v2.3.30/linux/Documentation/joystick-parport.txt Sun Nov 7 16:37:33 1999 +++ linux/Documentation/joystick-parport.txt Tue Dec 7 10:13:11 1999 @@ -1,6 +1,7 @@ Linux Joystick parport drivers v1.2 BETA - (c) 1998 Vojtech Pavlik + (c) 1998-1999 Vojtech Pavlik (c) 1998 Andree Borrmann + Sponsored by SuSE ---------------------------------------------------------------------------- 0. Disclaimer @@ -44,7 +45,8 @@ The main problem with PC parallel ports is that they don't have +5V power source on any of their pins. So, if you want a reliable source of power for your pads, use either keyboard or joystick port, and make a pass-through -cable. +cable. You can also pull the power directly from the power supply (the red +wire is +5V). If you want to use the parallel port only, you can take the power is from some data pin. For most gamepad and parport implementations only one pin is @@ -298,27 +300,29 @@ The PSX controller is supported by the joy-console.c. -Pinout of the PSX controller: +Pinout of the PSX controller (compatible with DirectPadPro): +---------+---------+---------+ 9 | o o o | o o o | o o o | 1 parallel \________|_________|________/ port pins | | | | | | - | | | | | +--------> Clock --- (1) - | | | | +------------> Select --- (17) - | | | +---------------> Power --- (16) + | | | | | +--------> Clock --- (4) + | | | | +------------> Select --- (3) + | | | +---------------> Power --- (5-9) | | +------------------> Ground --- (18-25) - | +-------------------------> Command --- (14) + | +-------------------------> Command --- (2) +----------------------------> Data --- (10,11,12,13,15) one only... You may have to add pull up/down resistors. Maybe your pad also won't like the 5V (PSX uses 3.7V). - Currently the driver supports only ONE psx pad and only one type of -controller: The normal PSX controller. NEGCON support is planned for the -next release. ANALOG controller may be too (I do not recommend to connect -the "force feedback"/"rumble pack" version... it (may) use too much -power...) + Currently the driver supports only one psx pad per parallel port, and these +controllers: + + * Standard PSX Pad + * NegCon PSX Pad + * Analog PSX Pad (red mode) + * Analog PSX Pad (green mode) 2.4 Sega ~~~~~~~~ @@ -437,13 +441,15 @@ 4 | Multisystem 1-button joystick 5 | Multisystem 2-button joystick 6 | Sony PSX controller + 7 | N64 pad + 8 | N64 pad with direction pad as buttons (DirectPadPro style) The exact type of the PSX controller type is autoprobed, so you must have your controller plugged in before initializing. Should you want to use more than one of parallel ports at once, you can -use js_console_2 and js_db9_3 as additional command line parameters for two -more parallel ports. +use js_console_2 and js_console_3 as additional command line parameters for +two more parallel ports. Changes: v0.1 : First version (SNES only) @@ -463,6 +469,9 @@ v0.10 : Fixed PSX buttons 8 and 9 v0.11V: Switched to EXCL mode Removed wakeup + v0.12V: Added N64 support + v0.13V: Updated N64 support + v0.14V: Fixed N64 axis/button counts 3.2 joy-db9.c ~~~~~~~~~~~~~ @@ -475,6 +484,10 @@ is connected to (eg. 0x378), or, if you are using the parport driver of 2.1+ Linux kernels, the number of the parport interface (eg. 0 for parport0). + Caveat here: This driver only works on bidirectional parallel ports. If +your parallel port is recent enough, you should have no trouble with this. +Old parallel ports may not have this feature. + 'Type' is the type of joystick or pad attached: Type | Joystick/Pad @@ -484,9 +497,10 @@ 2 | Multisystem 2-button joystick 3 | Genesis pad (3+1 buttons) 5 | Genesis pad (5+1 buttons) - 6 | Genesis pad (6+1 buttons) - 7 | Saturn pad + 6 | Genesis pad (6+2 buttons) + 7 | Saturn pad (8 buttons) 8 | Multisystem 1-button joystick (v0.8.0.2 pin-out) + 9 | Two Multiststem 1-button joysticks (v0.8.0.2 pin-out) Should you want to use more than one of these joysticks/pads at once, you can use js_db9_2 and js_db9_3 as additional command line parameters for two @@ -501,6 +515,8 @@ v0.4V: Switched to EXCL mode Removed wakeup v0.5V: Added 0.8.0.2 HW compatibility for Multi sticks + v0.6V: Better timing for Genesis 6 + v0.7V: Added 0.8.0.2 second joystick support 3.3 joy-turbografx.c ~~~~~~~~~~~~~~~~~~~~ @@ -519,6 +535,27 @@ use js_tg_2 and js_tg_3 as additional command line parameters for two more interfaces. -3.4 End +3.4 PC parallel port pinout +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + .----------------------------------------. + At the PC: \ 13 12 11 10 9 8 7 6 5 4 3 2 1 / + \ 25 24 23 22 21 20 19 18 17 16 15 14 / + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Pin | Name | Description + ~~~~~~|~~~~~~~~~|~~~~~~~~~~ + 1 | /STROBE | Strobe + 2-9 | D0-D7 | Data Bit 0-7 + 10 | /ACK | Acknowledge + 11 | BUSY | Busy + 12 | PE | Paper End + 13 | SELIN | Select In + 14 | /AUTOFD | Autofeed + 15 | /ERROR | Error + 16 | /INIT | Initialize + 17 | /SEL | Select + 18-25 | GND | Signal Ground + +3.5 End ~~~~~~~ That's all, folks! Have fun! diff -u --recursive --new-file v2.3.30/linux/Documentation/joystick.txt linux/Documentation/joystick.txt --- v2.3.30/linux/Documentation/joystick.txt Sun Nov 7 16:37:33 1999 +++ linux/Documentation/joystick.txt Tue Dec 7 10:13:11 1999 @@ -1,5 +1,6 @@ - Linux Joystick driver v1.2.13 - (c) 1996-1998 Vojtech Pavlik + Linux Joystick driver v1.2.15 + (c) 1996-1999 Vojtech Pavlik + Sponsored by SuSE ---------------------------------------------------------------------------- 0. Disclaimer @@ -38,18 +39,18 @@ In addition to these it also supports some of the new PC joysticks that use proprietary digital protocols to communicate over the gameport, -currently by FPGaming, Genius, Gravis, Logitech, MadCatz, Microsoft and -ThrustMaster. Creative Labs protocol support is still to be done. +currently by FPGaming, Gravis, Logitech, MadCatz, Microsoft, Creative and +ThrustMaster. Saitek protocol support is still to be done. The driver also includes support for many gamepads and joysticks that were used by various non-PC computers and game consoles. These include Multi system joysticks (Atari, Amiga, Commodore, Amstrad), Sega gamepads (Master -System, Genesis, Saturn), Nintendo gamepads (NES, SNES), Sony gamepads (PSX). -Support for N64, Atari Jaguar, Atari 2600, NES FourScore, SNES MultiTap, -PSX NegCon and others might be added later. +System, Genesis, Saturn), Nintendo gamepads (NES, SNES, N64), Sony gamepads +(PSX). Support for Atari Jaguar, Atari 2600, NES FourScore, SNES MultiTap +and others might be added later. Last, but not least there is also native Amiga joystick support for the -Amiga linux port. +Amiga Linux port. Should you encounter any problems while using the driver, or joysticks this driver can't make complete use of, I'm very interested in hearing about @@ -57,18 +58,13 @@ The joystick package is available at the following FTP sites: + ftp://ftp.suse.cz/pub/development/joystick/ ftp://atrey.karlin.mff.cuni.cz/pub/linux/joystick/ - - The joystick driver is also included in the Linux 2.1+ kernels: - - ftp://linux.kernel.org/pub/linux/kernel/ + ftp://ftp.gts.cz/pub/linux/joystick/ And a homepage of the driver is at: http://www.suse.cz/development/joystick/ - - Mirrors of the homepage are at: - http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/ http://www.trylinux.com/projects/joystick/ http://www.linuxgames.com/joystick/ @@ -92,7 +88,21 @@ To compile the utilities in the joystick package, and the driver itself, as a standalone module, you first unpack the package, and then edit the Makefile to meet your needs (namely whether are you using versioned -modules). Then you compile it +modules). You will also need an unpacked and configured + + make config + +kernel in + + /usr/src/linux + +Furthermore, if you're using versioned modules, you'll also need + + make dep + +done on the kernel, to create some needed files. + +After that, you compile the joystick driver make @@ -163,6 +173,14 @@ where 'something' is the type of your joystick. See below for more precise explanation. + Alternately you can add the lines + + alias char-major-15 joy-something + options joy-something js_xx=x,x,x,x,... + + to the /etc/conf.modules file, so that the joystick module will be loaded +automatically when the /dev/js devices are accessed. + 2.5 Verifying that it works ~~~~~~~~~~~~~~~~~~~~~~~~~~~ For testing the joystick driver functionality, there is the jstest @@ -197,14 +215,14 @@ calibration using the jstest command, and if you do, you then can save the correction coefficients into a file - jscal -s /dev/js0 > /etc/joystick.cal + jscal -p /dev/js0 > /etc/joystick.cal And add a line to your rc script executing that file source /etc/joystick.cal This way, after the next reboot your joystick will remain calibrated. You -can also add the jscal -s line to your shutdown script. +can also add the jscal -p line to your shutdown script. 3. HW specific driver information @@ -222,7 +240,7 @@ * 2-axis, 4-button joystick * 3-axis, 4-button joystick -* Two 2-axis, 2-button joysticks on an Y-cable +* 4-axis, 4-button joystick For other joystick types (more/less axes, hats, and buttons) support you'll need to specify the types either on the kernel command line or on the @@ -261,6 +279,8 @@ Joystick | 'm' value ---------------------------------------------------- + Simple 2-button 2-axis joystick | 0x0033 + Second simple joystick on Y-cable | 0x00cc Genius Flight2000 F-12 | 0x00f3 Genius Flight2000 F-21 | 0x08f7 Genius Flight2000 F-22 | 0x02ff @@ -268,9 +288,11 @@ Genius MaxFire G-07 | 0xf0f3 Genius PowerStation | 0xf0f3 Laing #1 PC SuperPad | 0xf0f3 + Logitech Wingman | 0x003b Microsoft SideWinder Standard | 0x003b QuickShot QS-201 SuperWarrior | 0x00fb Saitek Megapad XII | 0x30f3 + PC Powerpad Pro | 0x30f3 In case you have one of the joystick in the table below, and it doesn't work with a specific driver in digital mode for some reason, you can use @@ -280,8 +302,7 @@ Joystick | 'm' value ---------------------------------------------------- Gravis GamePad Pro - analog mode | 0x00f3 - Genius Flight2000 F-23 - CHF mode | 0x02ff - Genius Flight2000 F-23 - FCS mode | 0x08f7 + Genius Flight2000 F-23 | 0x02ff Microsoft SideWinder 3D Pro - CHF mode | 0x02ff Microsoft SideWinder 3D Pro - FCS mode | 0x08f7 @@ -302,70 +323,85 @@ And it would do the same as the above explained command line. Use whichever way you like best. -3.2 Microsoft SideWinder and Genius Digital joysticks -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - SideWinder and Genius Digital joysticks are supported by the +3.2 Microsoft SideWinder joysticks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Microsoft 'Digital Overdrive' protocol is supported by the joy-sidewinder.c module. All currently supported joysticks: -* SideWinder 3d Pro -* SideWinder Precision Pro +* SideWinder 3D Pro * SideWinder Force Feedback Pro -* SideWinder Game Pad (up to four, chained together) -* Genius Flight2000 Digital F-23 +* SideWinder Force Feedback Wheel +* SideWinder FreeStyle Pro +* SideWinder GamePad (up to four, chained together) +* SideWinder Precision Pro are autodetected, and thus no module parameters are needed. + There is one caveat with the 3D Pro. There are 9 buttons reported, +although the joystick has only 8. The 9th button is the mode switch on the +rear side of the joystick. However, moving it, you'll reset the joystick, +and make it unresponsive for about a one third of a second. Furthermore, the +joystick will also re-center itself, taking the position it was in during +this time as a new center position. Use it if you want, but think first. + The SideWinder Standard is not a digital joystick, and thus is supported -by the analog driver described above. SideWinder FreeStyle Pro and -SideWinder Force Feedback Wheel are not supported yet. +by the analog driver described above. -3.3 Logitech Digital joysticks -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Logitech Digital joysticks are supported by the joy-logitech.c module. It -currently supports these devices: +3.3 Logitech ADI devices +~~~~~~~~~~~~~~~~~~~~~~~~ + Logitech ADI protocol is supported by the joy-logitech.c module. It should +support any Logitech device using this protocol. This includes, but is not +limited to: -* Logitech Wingman Extreme Digital * Logitech CyberMan 2 * Logitech ThunderPad Digital - - All three are autodetected, and thus no parameters to the module are -needed. - - Logitech Wingman is not a digital joystick and is handled by the analog -driver described above. Logitech Wingman Warrior communicates through a -serial port and is not supported yet. Logitech Wingman Force, Wingman -Formula, Wingman Formula Force, Wingman Gamepad, Wingman Interceptor are USB -joysticks, with optional serial port connection, and are not supported yet. +* Logitech WingMan Extreme Digital +* Logitech WingMan Formula +* Logitech WingMan Interceptor +* Logitech WingMan GamePad +* Logitech WingMan GamePad USB +* Logitech WingMan GamePad Extreme +* Logitech WingMan Extreme Digital 3D + + ADI devices are autodetected, and the driver supports up to two (any +combination of) devices on a single gameport, using an Y-cable or chained +together. + + Logitech WingMan Joystick, Logitech WingMan Attack, Logitech WingMan +Extreme and Logitech WingMan ThunderPad are not digital joysticks and are +handled by the analog driver described above. Logitech WingMan Warrior and +Logitech Magellan are supported by serial drivers described below. Logitech +CyberMan, Logitech WingMan Force and Logitech WingMan Formula Force are not +supported yet. 3.4 Gravis GrIP ~~~~~~~~~~~~~~~ - Gravis GrIP gamepads are supported by the joy-gravis.c module. It + Gravis GrIP protocol is supported by the joy-gravis.c module. It currently supports: * Gravis GamePad Pro * Gravis Xterminator -* Gravis Blackhawk Digital +* Gravis BlackHawk Digital - All these pads are autodetected, and you can even use any combination of -up to two of these pads either chained together or using an Y-cable on a single -gameport. - -GrIP MultiPort support is in the works. Gravis Xcalibur, ArcadeXtreme, -GamePad Pro/M are joysticks/pads that probably never reached mass -production. Gravis Stinger is a serial device and hopefully will be -supported in the future. + All these devices are autodetected, and you can even use any combination +of up to two of these pads either chained together or using an Y-cable on a +single gameport. + +GrIP MultiPort and Gravis Xterminator DualControl aren't supported yet. +Gravis Stinger is a serial device and hopefully will be supported in the +future. Other Gravis joysticks are supported by the joy-analog driver. 3.5 FPGaming A3D and MadCatz A3D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The Assasin 3D protocol created by FPGaming, is used both by FPGaming + The Assassin 3D protocol created by FPGaming, is used both by FPGaming themselves and is licensed to MadCatz. A3D devices are supported by the -joy-assasin.c module. It currently supports: +joy-assassin.c module. It currently supports: -* FPGaming Assasin 3D +* FPGaming Assassin 3D * MadCatz Panther * MadCatz Panther XL - All these devices are autodetected. Because the Assasin 3D and the Panther + All these devices are autodetected. Because the Assassin 3D and the Panther allow connecting analog joysticks to them, these are supported in this driver, too. The driver uses the js_as parameter for the analog joysticks, which has the same syntax as js_an for the analog driver. @@ -376,20 +412,33 @@ 3.6 ThrustMaster DirectConnect (BSP) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The TM DirectConnect (BSP) protocol is supported by the joy-thrustmaster.c -module. It currently supports: +module. This includes, but is not limited to: * ThrustMaster Millenium 3D Inceptor * ThrustMaster 3D Rage Pad +* ThrustMaster Fusion Digital Game Pad - Both these drvices are autodetected, and thus no parameters to the module + Devices not directly supported, but hopefully working are: + +* ThrustMaster FragMaster +* ThrustMaster Attack Throttle + + If you have one of these, contact me. + + BSP devices are autodetected, and thus no parameters to the module are needed. - The Millenium and Rage Pad should work fine now. TM WCS III won't work, -because important parts of code for that are missing. I'm not sure if it was -ever mass produced. +3.7 Creative Labs Blaster +~~~~~~~~~~~~~~~~~~~~~~~~~ + The Blaster protocol is supported by the joy-creative.c module. It +currently supports only the: + +* Creative Blaster GamePad Cobra + + Up to two of these can be used on a single gameport, using an Y-cable. -3.7 PDPI Lightning 4 gamecards -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +3.8 PDPI Lightning 4 gamecards +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PDPI Lightning 4 gamecards are supported by the joy-lightning.c module. This driver is only for analog joysticks connected to the card - if you want to use some of the digital devices, you need to use its specific driver. The @@ -420,8 +469,49 @@ See the description of analog joystick driver for explanations of m0 and n0 values. -3.8 Amiga -~~~~~~~~~ +3.9 Trident 4DWave / Aureal Vortex +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Soundcards with a Trident 4DWave DX/NX or Aureal Vortex chipset provide an +"Enhanced Game Port" mode where the soundcard handles polling the joystick. +This mode is supported by the joy-pci module. + + If no module parameters are given, the joy-pci module will set all the +soundcards it finds to "enhanced" mode, and will try to autodetect the type +of attached joystick. It can only detect the same types of joysticks that +the joy-analog module can. + + This module accepts parameters in the form: + + js_pci=t0,i0,m0,n0,t1,i1,m1,n1,.... + + The "t" value specifies the type of card, as follows: + + t | Card Type + ---------------------------- + 0 | Trident 4DWave DX + 1 | Trident 4DWave NX + 2 | Aureal Vortex1 (Au8820 chipset) + 3 | Aureal Vortex2 (Au8830 chipset) + + If you have more than one card of the same type, the "i" parameter lets +you choose which card to apply the "m" and "n" values to. It counts from +"0". (The driver detects cards in the order listed in the above table.) + + The "m" and "n" values have the same meaning as for the analog module, +with the exception that the value m=0, n=0 indicates that joy-pci should +completely ignore that port. This can be useful to reserve a certain port +for purely MIDI operation. + + For example, let's say you have 3 sound cards - a 4Dwave DX, a 4DWave NX, +and a Vortex 2. You have a three-axis, four-button, one-hat CHF- compatible +joystick on the DX. You use the NX to interface to an external MIDI device. +Finally, you have two two-axis, two-button joysticks on the Vortex. Your +command line might look like: + + js_pci=0,0,0x207,0,1,1,0,0,3,0,0x33,0xcc + +3.10 Amiga +~~~~~~~~~~ Amiga joysticks, connected to an Amiga, are supported by the joy-amiga.c driver. Since they can't be autodetected, the driver has a command line. @@ -438,10 +528,75 @@ No more joystick types are supported now, but that should change in the future if I get an Amiga in the reach of my fingers. -3.9 Game console and 8-bit pads and joysticks -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +3.11 Game console and 8-bit pads and joysticks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ See joystick-parport.txt for more info. +3.12 SpaceTec/LabTec devices +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + SpaceTec serial devices communicate using the SpaceWare protocol. It is +supported by the joy-spaceorb and joy-spaceball drivers. The devices currently +supported by joy-spaceorb are: + +* SpaceTec SpaceBall Avenger +* SpaceTec SpaceOrb 360 + +Devices currently supported by joy-spaceball are: + +* SpaceTec SpaceBall 4000 FLX + + In addition to having the joy-spaceorb/spaceball module in the kernel, you +also need to attach a serial port to it. to do that, run the jsattach +program: + + jsattach --spaceorb /dev/ttySx & +or + jsattach --sball4 /dev/ttySx & + +where /dev/ttySx is the serial port which the device is connected to. After +doing this, the device will be reported and will start working. + + There is one caveat with the SpaceOrb. The button #6, the on the bottom +side of the orb, although reported as an ordinary button, causes internal +recentering of the spaceorb, moving the zero point to the position in which +the ball is at the moment of pressing the button. So, think first before +you bind it to some other function. + +SpaceTec SpaceBall 2003 FLX and 3003 FLX are not supported yet. + +3.13 Logitech SWIFT devices +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + The SWIFT serial protocol is supported by the joy-warrior module. It +currently supports only the: + +* Logitech WingMan Warrior + +but in the future, Logitech CyberMan (the original one, not CM2) could be +supported as well. To use the module, you need to run jsattach after you +insert/compile the module into your kernel: + + jsattach --warrior /dev/ttySx & + +ttySx is the serial port your Warrior is attached to. + +3.14 Magellan / Space Mouse +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + The Magellan (or Space Mouse), manufactured by LogiCad3d (formerly Space +Systems), for many other companies (Logitech, HP, ...) is supported by the +joy-magellan module. It currently supports only the: + +* Magellan 3D +* Space Mouse + +models, the additional buttons on the 'Plus' versions are not supported yet. + + To use it, you need to attach the serial port to the driver using the + + jsattach --magellan /dev/ttySx & + +command. After that the Magellan will be detected, initialized, will beep, +and the /dev/jsX device should become useable. + 4. Troubleshooting ~~~~~~~~~~~~~~~~~~ There is quite a high probability that you run into some problems. For @@ -452,9 +607,10 @@ jstest --normal /dev/js0 jstest --old /dev/js0 - If your trouble stems from the fact the drivers can't detect the attached -joystick, and/or you decide you need my help (which I will gladly provide), -please use the joydump utility first. It's created just by typing + If your trouble stems from the fact the drivers can't detect the joystick +attached to your gameport, and you decide you need my help (which I will +gladly provide), please use the joydump utility first. It's created just by +typing make joydump.o @@ -465,64 +621,73 @@ in the same directory. It will return a 'device busy' or 'initialization failed' error. This is perfectly okay. It has already done it's job. The -results can be found in the system log. Please send me the results along -with your problem report. +results can be found in the system log or in the output of the + + dmesg + +command. Please send me the results along with your problem report. Oh, and read the FAQ! :) 5. FAQ ~~~~~~ - Q: The driver doesn't find any joysticks connected to my soundcard with the -message "joy-something: no joysticks found" and "joy-something.o: -init_module: Device or resource busy." or "Initialization of joy-something -failed" What could be the cause? - A: The most common cause is that the joystick port on your soundcard is -not enabled. If it is an ISA PnP card, you'll need isapnptools to configure -the gameport. Non-PnP cards usually use some option to the sound driver - -see the sound driver docs and source and enable the port. - - Q: Any access to the joystick devices gives me "Operation not supported by -device". What am I doing wrong? - A: You're running a 2.0 kernel and you forgot to insmod the hardware -specific module. You not only need the joystick.o, but also one of the other -joy-*.o files (most usually joy-analog.o), as described in this document, -section 2. If you are not using modules, then you didn't say 'Y' to any of -the hardware-specific questions. Again, see section 2. If you did select -the specific support, and you still get this message, check that you -selected the right one, and if it still doesn't work, go to the previous -FAQ. - - Q: Everything is fine, except I get "No such device" error when I try to -do anything with /dev/js0. What's the cause? - A: You're running a 2.1 kernel and you want to read the previous FAQ. - - Q: Upon 'insmod joystick.o' I get a LOT of unresolved symbols, including -printk and others. Why? - A: You either don't have your kernel compiled with module support. If -that's the cause, re-compile your kernel with module support switched on. -Or, you use versioned symbols, and don't have -DMODVERSIONS in the joystick -driver Makefile, or vice versa. Correct the situation by either removing or -adding -DMODVERSIONS to the Makefile. - - Q: Running 'jstest 1' or 'jscal 1' doesn't work, and returns with "File -not found" error. What is the problem? - A: The command line interface for these tools is different from what -version 0.8.0 used. You have to specify the whole device name, eg. 'jstest -/dev/js0'. - - Q: Running 'jstest /dev/js0' results in "File not found" error. What's the -cause? - A: The device files don't exist. Run 'make devs'. - - Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystick -or pad that uses a 9-pin D-type cannon connector to the serial port of my -PC? - A: Yes, it is possible, but it'll burn your serial port or the pad. It -won't work, of course. - - Q: My joystick doesnt work with Quake / Quake 2. What's the cause? - A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypresses -for them. +Q: The driver doesn't find any joysticks connected to my soundcard with the + message "joy-something: no joysticks found" and "joy-something.o: + init_module: Device or resource busy." or "Initialization of joy-something + failed" What could be the cause? +A: The most common cause is that the joystick port on your soundcard is + not enabled. If it is an ISA PnP card, you'll need isapnptools to configure + the gameport. Non-PnP cards usually use some option to the sound driver - + see the sound driver docs and source and enable the port. Note that in case + of a PnP card you have to load the joystick driver as a module after running + the isapnp command, it will not work in the opposite order. + +Q: Any access to the joystick devices gives me "Operation not supported by + device". What am I doing wrong? +A: You're running a 2.0 kernel and you forgot to insmod the hardware + specific module. You not only need the joystick.o, but also one of the other + joy-*.o files (most usually joy-analog.o), as described in this document, + section 2. If you are not using modules, then you didn't say 'Y' to any of + the hardware-specific questions. Again, see section 2. If you did select + the specific support, and you still get this message, check that you + selected the right one, and if it still doesn't work, go to the previous + FAQ. + +Q: Everything is fine, except I get "No such device" error when I try to + do anything with /dev/js0. What's the cause? +A: You're running a 2.1 or 2.2. kernel and you want to read the previous FAQ. + +Q: Upon 'insmod joystick.o' I get a LOT of unresolved symbols, including + 'printk' and others. Why? +A: You either don't have your kernel compiled with module support. If + that's the cause, re-compile your kernel with module support switched on. + Or, you use versioned symbols, and don't have -DMODVERSIONS in the joystick + driver Makefile, or vice versa. Correct the situation by either removing or + adding -DMODVERSIONS to the Makefile. + +Q: Upon 'insmod joy-something' I get a bunch of unresolved symbols, like + 'js_register_port, js_unregister device' and others. What's wrong? +A: You need to 'insmod joystick.o' first. + +Q: Running 'jstest 1' or 'jscal 1' doesn't work, and returns with "File + not found" error. What is the problem? +A: The command line interface for these tools is different from what + version 0.8.0 used. You have to specify the whole device name, eg. 'jstest + /dev/js0'. + +Q: Running 'jstest /dev/js0' results in "File not found" error. What's the + cause? +A: The device files don't exist. Run 'make devs'. + +Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystick + or pad that uses a 9-pin D-type cannon connector to the serial port of my + PC? +A: Yes, it is possible, but it'll burn your serial port or the pad. It + won't work, of course. + +Q: My joystick doesn't work with Quake / Quake 2. What's the cause? +A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypresses + for them. 6. Programming Interface ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -565,23 +730,31 @@ Brian Gerst Andree Borrmann Martin Giguere + David Thompson + Justin Wake + Benoit Triquet + John Dahlstrom + Dan Gohman + Joe Krahn + David Kuder + Raymond Ingles If you think you should be in this list and are not, it's possible that I forgot to include you - contact me and I'll correct the error. :) Thanks to KYE Systems Europe, who provided me with driver sources for the -Genius Flight2000 Digital F-23, which happens to be compatible with -Microsoft SideWinder 3d Pro. +Genius Flight2000 Digital F-23, which happens to be identical (in software) +to Microsoft SideWinder 3D Pro. Thanks to ThrustMaster Inc. who provided me with docs for their digital -protocol, and to Trystan A Larey-williams , who wrote an -attempt of a driver for them. +protocol specifications, and to Trystan A Larey-Williams , +who wrote an attempt of a driver for them. Thanks to Creative Labs Europe, and Ifor Powell , -who provided me with docs for their first generation gamepad. +who provided me with docs for their first generation Blaster GamePad. Special thanks go to FP-Gaming, Inc. and James C Barnes , -who provided me with help and detailed information about the Assasin 3D +who provided me with help and detailed information about the Assassin 3D protocol and devices, and even sent me a Panther and Panther XL for testing, along with cool T-shirts. @@ -590,10 +763,20 @@ code for their L4 gamecard, and sending me the card to test my driver with it. + Thanks to LogiCad3D for their support, for having the specifications +online and for the nice music on their telephone. + + Special thanks to Logitech, Jerry de Raad , +Thomas Burgel , Avinash Shinde + for providing me with a lot of documentation +for their devices, and also for a big box, containing a CyberMan2, Wingman +Extreme, Magellan, Wingman Warrior, two MouseMan mice, and a NewTouch +keyboard. + Thanks to everyone else who helped me develop this package of drivers! - No thanks to Microsoft, Logitech, and Gravis, who don't release a word -about their hardware .... :( + No thanks to Microsoft and Gravis, who don't release a word about their +hardware .... :( 8. ChangeLog ~~~~~~~~~~~~ @@ -602,50 +785,3 @@ 9. To do ~~~~~~~~ See the TODO file for the list of things planned. - -10. Current driver status -~~~~~~~~~~~~~~~~~~~~~~~~~ - OK means tested and not touched till this driver revision, unknown means -that the driver was changed since last test, broken means doesn't work, -incomplete means can't work, because vital parts of support are missing. - -joystick.c: 2.1.x kernel interface - OK -joy-amiga.c: Multi1 stick - unknown -joy-analog.c: standard joysticks - OK - FCS hats - OK - CHF hats & buttons - OK - XY buttons - OK - UV buttons - OK -joy-assasin.c: MadCatz Panther XL - OK - MadCatz PXL rudder - OK - MadCatz Panther - OK - FPG Assasin 3D - OK -joy-console.c: NES pad - OK - SNES pad - OK - Multi1 stick - OK - Multi2 stick - OK - PSX - SW OK, HW unreliable -joy-db9.c: Multi1 stick - OK - Multi2 stick - OK - Sega Genesis pad - OK - Sega Genesis 5 pad - OK - Sega Genesis 6 pad - OK - Sega Saturn pad - unknown -joy-gravis.c Gravis GamePad Pro - OK - Gravis Xterminator - OK - Gravis Blackhawk Digital- OK -joy-lightning.c PDPI Lightning 4 - OK -joy-logitech.c WingMan Extreme Digital - OK - CyberMan 2 - OK - Thunder Pad Digital - unknown -joy-sidewinder.c SW 3D Pro - OK - Genius F-23 - OK - SW GP - OK - SW PP - OK - SW FFP - OK -joy-thrustmaster.c Millenium 3D Inceptor - OK - 3D-Rage Pad - OK -joy-turbografx.c Multi1 stick - OK - -Please help me and send me success / failure reports for the drivers, -I need to know what works, and what needs to be debugged. Thank you. diff -u --recursive --new-file v2.3.30/linux/MAINTAINERS linux/MAINTAINERS --- v2.3.30/linux/MAINTAINERS Tue Dec 7 09:32:39 1999 +++ linux/MAINTAINERS Wed Dec 8 09:36:27 1999 @@ -928,6 +928,13 @@ W: http://www.kernel.dk S: Maintained +USB SUBSYSTEM +P: Randy Dunlap +M: randy.dunlap@intel.com +L: linux-usb@suse.com +W: http://www.linux-usb.org +S: Supported + USB HUB AND UHCI DRIVERS P: Johannes Erdfelt M: jerdfelt@sventech.com diff -u --recursive --new-file v2.3.30/linux/Makefile linux/Makefile --- v2.3.30/linux/Makefile Tue Dec 7 09:32:39 1999 +++ linux/Makefile Tue Dec 7 15:37:17 1999 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 3 -SUBLEVEL = 30 +SUBLEVEL = 31 EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) @@ -117,6 +117,10 @@ LIBS =$(TOPDIR)/lib/lib.a SUBDIRS =kernel drivers mm fs net ipc lib +ifdef CONFIG_DRM +DRIVERS += drivers/char/drm/drm.o +endif + ifdef CONFIG_NUBUS DRIVERS := $(DRIVERS) drivers/nubus/nubus.a endif @@ -396,7 +400,7 @@ rm -f .tmp* rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c rm -f drivers/char/conmakehash - rm -f drivers/pci/devlist.h drivers/pci/gen-devlist + rm -f drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist rm -f drivers/sound/bin2hex drivers/sound/hex2hex rm -f net/khttpd/make_times_h rm -f net/khttpd/times.h diff -u --recursive --new-file v2.3.30/linux/arch/alpha/config.in linux/arch/alpha/config.in --- v2.3.30/linux/arch/alpha/config.in Tue Dec 7 09:32:39 1999 +++ linux/arch/alpha/config.in Tue Dec 7 15:38:22 1999 @@ -178,6 +178,8 @@ bool 'Symmetric multi-processing support' CONFIG_SMP fi +source drivers/pci/Config.in + bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT diff -u --recursive --new-file v2.3.30/linux/arch/alpha/defconfig linux/arch/alpha/defconfig --- v2.3.30/linux/arch/alpha/defconfig Tue Dec 7 09:32:39 1999 +++ linux/arch/alpha/defconfig Tue Dec 7 15:38:22 1999 @@ -44,6 +44,7 @@ # CONFIG_ALPHA_SABLE is not set # CONFIG_ALPHA_TAKARA is not set CONFIG_PCI=y +CONFIG_PCI_NAMES=y # CONFIG_SMP is not set CONFIG_NET=y CONFIG_SYSVIPC=y diff -u --recursive --new-file v2.3.30/linux/arch/alpha/kernel/irq.c linux/arch/alpha/kernel/irq.c --- v2.3.30/linux/arch/alpha/kernel/irq.c Tue Dec 7 09:32:39 1999 +++ linux/arch/alpha/kernel/irq.c Wed Dec 8 09:36:52 1999 @@ -28,7 +28,6 @@ #include #include #include -#include #include "proto.h" diff -u --recursive --new-file v2.3.30/linux/arch/arm/config.in linux/arch/arm/config.in --- v2.3.30/linux/arch/arm/config.in Sun Nov 7 16:37:33 1999 +++ linux/arch/arm/config.in Tue Dec 7 15:38:22 1999 @@ -110,6 +110,7 @@ if [ "$CONFIG_ARCH_NEXUSPCI" = "y" -o \ "$CONFIG_HOST_FOOTBRIDGE" = "y" ]; then define_bool CONFIG_PCI y + source drivers/pci/Config.h fi # diff -u --recursive --new-file v2.3.30/linux/arch/arm/defconfig linux/arch/arm/defconfig --- v2.3.30/linux/arch/arm/defconfig Tue Nov 23 22:42:20 1999 +++ linux/arch/arm/defconfig Tue Dec 7 15:38:22 1999 @@ -18,6 +18,7 @@ CONFIG_ARCH_NETWINDER=y # CONFIG_ARCH_ACORN is not set CONFIG_PCI=y +CONFIG_PCI_NAMES=y CONFIG_ISA_DMA=y CONFIG_CPU_32=y # CONFIG_CPU_26 is not set diff -u --recursive --new-file v2.3.30/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c --- v2.3.30/linux/arch/arm/kernel/sys_arm.c Tue Nov 23 22:42:20 1999 +++ linux/arch/arm/kernel/sys_arm.c Tue Dec 7 14:34:37 1999 @@ -49,6 +49,36 @@ return error; } +/* common code for old and new mmaps */ +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file * file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down(¤t->mm->mmap_sem); + lock_kernel(); + + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + + unlock_kernel(); + up(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + /* * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. ARM Linux didn't use to be able to handle more than @@ -68,29 +98,19 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) { int error = -EFAULT; - struct file * file = NULL; struct mmap_arg_struct a; - down(¤t->mm->mmap_sem); - lock_kernel(); if (copy_from_user(&a, arg, sizeof(a))) + goto out;; + + error = -EINVAL; + if (a.offset & ~PAGE_MASK) goto out; - if (!(a.flags & MAP_ANONYMOUS)) { - error = -EBADF; - file = fget(a.fd); - if (!file) - goto out; - } - a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset); - if (file) - fput(file); + + error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); out: - unlock_kernel(); - up(¤t->mm->mmap_sem); return error; } - extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); diff -u --recursive --new-file v2.3.30/linux/arch/i386/config.in linux/arch/i386/config.in --- v2.3.30/linux/arch/i386/config.in Sun Nov 7 16:37:33 1999 +++ linux/arch/i386/config.in Tue Dec 7 15:38:22 1999 @@ -95,8 +95,12 @@ define_bool CONFIG_PCI_DIRECT y fi fi - bool 'MCA support' CONFIG_MCA +fi + +source drivers/pci/Config.in +if [ "$CONFIG_VISWS" != "y" ]; then + bool 'MCA support' CONFIG_MCA fi source drivers/pcmcia/Config.in diff -u --recursive --new-file v2.3.30/linux/arch/i386/defconfig linux/arch/i386/defconfig --- v2.3.30/linux/arch/i386/defconfig Tue Nov 23 22:42:20 1999 +++ linux/arch/i386/defconfig Tue Dec 7 15:38:22 1999 @@ -51,6 +51,7 @@ CONFIG_PCI_GOANY=y CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y +CONFIG_PCI_NAMES=y # CONFIG_MCA is not set # diff -u --recursive --new-file v2.3.30/linux/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S --- v2.3.30/linux/arch/i386/kernel/entry.S Mon Nov 1 13:56:26 1999 +++ linux/arch/i386/kernel/entry.S Tue Dec 7 15:32:51 1999 @@ -592,6 +592,10 @@ .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ .long SYMBOL_NAME(sys_vfork) /* 190 */ .long SYMBOL_NAME(sys_getrlimit) + .long SYMBOL_NAME(sys_mmap2) + .long SYMBOL_NAME(sys_truncate64) + .long SYMBOL_NAME(sys_ftruncate64) + /* 195 */ /* * NOTE!! This doesn't have to be exact - we just have @@ -599,6 +603,6 @@ * entries. Don't panic if you notice that this hasn't * been shrunk every time we add a new system call. */ - .rept NR_syscalls-191 + .rept NR_syscalls-194 .long SYMBOL_NAME(sys_ni_syscall) .endr diff -u --recursive --new-file v2.3.30/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c --- v2.3.30/linux/arch/i386/kernel/setup.c Tue Dec 7 09:32:40 1999 +++ linux/arch/i386/kernel/setup.c Tue Dec 7 23:01:40 1999 @@ -1371,9 +1371,9 @@ char *p = buffer; int sep_bug; static char *x86_cap_flags[] = { - "fpu", "vme", "de", "pse", "tsc", "msr", "6", "mce", - "cx8", "9", "10", "sep", "mtrr", "pge", "14", "cmov", - "16", "17", "psn", "19", "20", "21", "22", "mmx", + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", + "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov", + "pat", "17", "psn", "19", "20", "21", "22", "mmx", "24", "kni", "26", "27", "28", "29", "30", "31" }; struct cpuinfo_x86 *c = cpu_data; @@ -1419,15 +1419,14 @@ case X86_VENDOR_AMD: if (c->x86 == 5 && c->x86_model == 6) x86_cap_flags[10] = "sep"; - x86_cap_flags[16] = "fcmov"; + if (c->x86 < 6) + x86_cap_flags[16] = "fcmov"; + x86_cap_flags[22] = "mmxext"; + x86_cap_flags[30] = "3dnowext"; x86_cap_flags[31] = "3dnow"; break; case X86_VENDOR_INTEL: - x86_cap_flags[6] = "pae"; - x86_cap_flags[9] = "apic"; - x86_cap_flags[14] = "mca"; - x86_cap_flags[16] = "pat"; x86_cap_flags[17] = "pse36"; x86_cap_flags[18] = "psn"; x86_cap_flags[24] = "osfxsr"; diff -u --recursive --new-file v2.3.30/linux/arch/i386/kernel/smp.c linux/arch/i386/kernel/smp.c --- v2.3.30/linux/arch/i386/kernel/smp.c Tue Dec 7 09:32:40 1999 +++ linux/arch/i386/kernel/smp.c Tue Dec 7 09:34:27 1999 @@ -575,7 +575,7 @@ * This interrupt should never happen with our APIC/SMP architecture */ -static spinlock_t err_lock; +static spinlock_t err_lock = SPIN_LOCK_UNLOCKED; asmlinkage void smp_error_interrupt(void) { diff -u --recursive --new-file v2.3.30/linux/arch/i386/kernel/sys_i386.c linux/arch/i386/kernel/sys_i386.c --- v2.3.30/linux/arch/i386/kernel/sys_i386.c Sun Nov 7 16:37:34 1999 +++ linux/arch/i386/kernel/sys_i386.c Tue Dec 7 14:34:37 1999 @@ -41,6 +41,43 @@ return error; } +/* common code for old and new mmaps */ +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file * file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down(¤t->mm->mmap_sem); + lock_kernel(); + + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + + unlock_kernel(); + up(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + /* * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. Linux/i386 didn't use to be able to handle more than @@ -59,31 +96,21 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) { - int error = -EFAULT; - struct file * file = NULL; struct mmap_arg_struct a; + int err = -EFAULT; if (copy_from_user(&a, arg, sizeof(a))) - return -EFAULT; + goto out; - down(¤t->mm->mmap_sem); - lock_kernel(); - if (!(a.flags & MAP_ANONYMOUS)) { - error = -EBADF; - file = fget(a.fd); - if (!file) - goto out; - } - a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + err = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; - error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset); - if (file) - fput(file); + err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); out: - unlock_kernel(); - up(¤t->mm->mmap_sem); - return error; + return err; } + extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); diff -u --recursive --new-file v2.3.30/linux/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c --- v2.3.30/linux/arch/i386/kernel/time.c Sat Oct 9 11:47:50 1999 +++ linux/arch/i386/kernel/time.c Tue Dec 7 14:34:37 1999 @@ -80,8 +80,7 @@ static inline unsigned long do_fast_gettimeoffset(void) { - register unsigned long eax asm("ax"); - register unsigned long edx asm("dx"); + register unsigned long eax, edx; /* Read the Time Stamp Counter */ diff -u --recursive --new-file v2.3.30/linux/arch/i386/mm/ioremap.c linux/arch/i386/mm/ioremap.c --- v2.3.30/linux/arch/i386/mm/ioremap.c Tue Nov 23 22:42:20 1999 +++ linux/arch/i386/mm/ioremap.c Tue Dec 7 16:22:34 1999 @@ -119,8 +119,18 @@ /* * Don't allow anybody to remap normal RAM that we're using.. */ - if (phys_addr < virt_to_phys(high_memory)) - return NULL; + if (phys_addr < virt_to_phys(high_memory)) { + char *t_addr, *t_end; + int i; + + t_addr = __va(phys_addr); + t_end = t_addr + (size - 1); + + for(i = MAP_NR(t_addr); i < MAP_NR(t_end); i++) { + if(!PageReserved(mem_map + i)) + return NULL; + } + } /* * Mappings have to be page-aligned diff -u --recursive --new-file v2.3.30/linux/arch/m68k/config.in linux/arch/m68k/config.in --- v2.3.30/linux/arch/m68k/config.in Sun Nov 7 16:37:34 1999 +++ linux/arch/m68k/config.in Tue Dec 7 15:38:22 1999 @@ -124,6 +124,7 @@ fi fi +source drivers/pci/Config.in endmenu diff -u --recursive --new-file v2.3.30/linux/arch/m68k/kernel/sys_m68k.c linux/arch/m68k/kernel/sys_m68k.c --- v2.3.30/linux/arch/m68k/kernel/sys_m68k.c Tue Jan 19 10:58:34 1999 +++ linux/arch/m68k/kernel/sys_m68k.c Tue Dec 7 14:34:37 1999 @@ -44,6 +44,43 @@ return error; } +/* common code for old and new mmaps */ +static inline long do_mmap2( + unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + int error = -EBADF; + struct file * file = NULL; + + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + if (!(flags & MAP_ANONYMOUS)) { + file = fget(fd); + if (!file) + goto out; + } + + down(¤t->mm->mmap_sem); + lock_kernel(); + + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); + + unlock_kernel(); + up(¤t->mm->mmap_sem); + + if (file) + fput(file); +out: + return error; +} + +asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, + unsigned long prot, unsigned long flags, + unsigned long fd, unsigned long pgoff) +{ + return do_mmap2(addr, len, prot, flags, fd, pgoff); +} + /* * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to @@ -62,13 +99,49 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) { - int error; - struct file * file = NULL; struct mmap_arg_struct a; + int error = -EFAULT; + + if (copy_from_user(&a, arg, sizeof(a))) + goto out; + + error = -EINVAL; + if (a.offset & ~PAGE_MASK) + goto out; + + a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + + error = do_mmap2(file, a.addr, a.len, a.prot, a.flags, a.offset >> PAGE_SHIFT); +out: + return error; +} + +struct mmap_arg_struct64 { + __u32 addr; + __u32 len; + __u32 prot; + __u32 flags; + __u64 offset; /* 64 bits */ + __u32 fd; +}; + +asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) +{ + int error = -EFAULT; + struct file * file = NULL; + struct mmap_arg_struct64 a; + unsigned long pgoff; if (copy_from_user(&a, arg, sizeof(a))) return -EFAULT; + if ((long)a.offset & ~PAGE_MASK) + return -EINVAL; + + pgoff = a.offset >> PAGE_SHIFT; + if ((a.offset >> PAGE_SHIFT) != pgoff) + return -EINVAL; + down(¤t->mm->mmap_sem); lock_kernel(); if (!(a.flags & MAP_ANONYMOUS)) { @@ -79,7 +152,7 @@ } a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset); + error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff); if (file) fput(file); out: @@ -88,7 +161,6 @@ return error; } - extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); struct sel_arg_struct { @@ -103,7 +175,7 @@ if (copy_from_user(&a, arg, sizeof(a))) return -EFAULT; - /* sys_select() does the appropriate kernel locking */ + /* sys_select() does the appropriate kernel locking */ return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); } diff -u --recursive --new-file v2.3.30/linux/arch/mips/config.in linux/arch/mips/config.in --- v2.3.30/linux/arch/mips/config.in Sun Nov 7 16:37:34 1999 +++ linux/arch/mips/config.in Tue Dec 7 15:38:22 1999 @@ -100,6 +100,8 @@ bool ' Kernel module loader' CONFIG_KMOD fi +source drivers/pci/Config.in + endmenu if [ "$CONFIG_DECSTATION" = "y" ]; then diff -u --recursive --new-file v2.3.30/linux/arch/mips/defconfig linux/arch/mips/defconfig --- v2.3.30/linux/arch/mips/defconfig Sun Nov 7 16:37:34 1999 +++ linux/arch/mips/defconfig Tue Dec 7 15:38:22 1999 @@ -16,6 +16,7 @@ # CONFIG_SGI is not set CONFIG_SNI_RM200_PCI=y CONFIG_PCI=y +CONFIG_PCI_NAMES=y # # CPU selection diff -u --recursive --new-file v2.3.30/linux/arch/ppc/config.in linux/arch/ppc/config.in --- v2.3.30/linux/arch/ppc/config.in Tue Dec 7 09:32:41 1999 +++ linux/arch/ppc/config.in Tue Dec 7 15:38:22 1999 @@ -106,6 +106,8 @@ define_bool CONFIG_KERNEL_ELF y tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC +source drivers/pci/Config.in + source drivers/pcmcia/Config.in source drivers/parport/Config.in diff -u --recursive --new-file v2.3.30/linux/arch/ppc/defconfig linux/arch/ppc/defconfig --- v2.3.30/linux/arch/ppc/defconfig Tue Dec 7 09:32:41 1999 +++ linux/arch/ppc/defconfig Tue Dec 7 15:38:22 1999 @@ -35,8 +35,8 @@ # # General setup # -# CONFIG_PCI is not set CONFIG_PCI=y +CONFIG_PCI_NAMES=y CONFIG_NET=y CONFIG_SYSCTL=y CONFIG_SYSVIPC=y diff -u --recursive --new-file v2.3.30/linux/arch/sparc/config.in linux/arch/sparc/config.in --- v2.3.30/linux/arch/sparc/config.in Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc/config.in Tue Dec 7 15:38:22 1999 @@ -29,6 +29,7 @@ bool 'Support for SUN4 machines (disables SUN4[CDM] support)' CONFIG_SUN4 if [ "$CONFIG_SUN4" != "y" ]; then bool ' Support for PCI and PS/2 keyboard/mouse' CONFIG_PCI + source drivers/pci/Config.in fi mainmenu_option next_comment diff -u --recursive --new-file v2.3.30/linux/arch/sparc/defconfig linux/arch/sparc/defconfig --- v2.3.30/linux/arch/sparc/defconfig Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc/defconfig Tue Dec 7 15:38:22 1999 @@ -23,6 +23,7 @@ # CONFIG_SMP is not set # CONFIG_SUN4 is not set # CONFIG_PCI is not set +# CONFIG_PCI_NAMES is not set # # Console drivers diff -u --recursive --new-file v2.3.30/linux/arch/sparc64/config.in linux/arch/sparc64/config.in --- v2.3.30/linux/arch/sparc64/config.in Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc64/config.in Tue Dec 7 15:38:22 1999 @@ -37,6 +37,7 @@ define_bool CONFIG_SUN_AUXIO y define_bool CONFIG_SUN_IO y bool 'PCI support' CONFIG_PCI +source drivers/pci/Config.in source drivers/sbus/char/Config.in source drivers/sbus/audio/Config.in diff -u --recursive --new-file v2.3.30/linux/arch/sparc64/defconfig linux/arch/sparc64/defconfig --- v2.3.30/linux/arch/sparc64/defconfig Sun Nov 7 16:37:34 1999 +++ linux/arch/sparc64/defconfig Tue Dec 7 15:38:22 1999 @@ -60,6 +60,7 @@ CONFIG_SUN_AUXIO=y CONFIG_SUN_IO=y CONFIG_PCI=y +CONFIG_PCI_NAMES=y # # Misc Linux/SPARC drivers diff -u --recursive --new-file v2.3.30/linux/drivers/char/Config.in linux/drivers/char/Config.in --- v2.3.30/linux/drivers/char/Config.in Tue Dec 7 09:32:43 1999 +++ linux/drivers/char/Config.in Tue Dec 7 16:22:34 1999 @@ -82,6 +82,8 @@ fi endmenu +source drivers/char/joystick/Config.in + tristate 'QIC-02 tape support' CONFIG_QIC02_TAPE if [ "$CONFIG_QIC02_TAPE" != "n" ]; then bool ' Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF @@ -141,7 +143,6 @@ fi if [ "$CONFIG_PCI" != "n" ]; then dep_tristate ' BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV - dep_tristate 'Zoran ZR36120/36125 support' CONFIG_VIDEO_ZR36120 $CONFIG_VIDEO_DEV fi dep_tristate ' GemTek Radio Card support' CONFIG_RADIO_GEMTEK $CONFIG_VIDEO_DEV if [ "$CONFIG_RADIO_GEMTEK" = "y" ]; then @@ -200,15 +201,6 @@ endmenu -mainmenu_option next_comment -comment 'Joystick support' - -tristate 'Joystick support' CONFIG_JOYSTICK -if [ "$CONFIG_JOYSTICK" != "n" ]; then - source drivers/char/joystick/Config.in -fi -endmenu - tristate 'Double Talk PC internal speech card support' CONFIG_DTLK tristate 'Siemens R3964 line discipline' CONFIG_R3964 @@ -224,6 +216,7 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool 'Direct Rendering Manager (XFree86 DRI support) (EXPERIMENTAL)' CONFIG_DRM + dep_tristate ' 3dfx Banshee/Voodoo3' CONFIG_DRM_TDFX $CONFIG_DRM if [ "$CONFIG_DRM" = "y" ]; then dep_tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA m fi @@ -233,4 +226,15 @@ source drivers/char/pcmcia/Config.in fi +if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate '/dev/agpgart (AGP Support) (EXPERIMENTAL)' CONFIG_AGP m + if [ "$CONFIG_AGP" = "m" ]; then + bool ' Intel 440LX/BX/GX support' CONFIG_AGP_INTEL + bool ' Intel I810/I810 DC100/I810e support' CONFIG_AGP_I810 + bool ' VIA VP3/MVP3/Apollo Pro support' CONFIG_AGP_VIA + bool ' AMD Irongate support' CONFIG_AGP_AMD + bool ' Generic SiS support' CONFIG_AGP_SIS + bool ' ALI M1541 support' CONFIG_AGP_ALI + fi +fi endmenu diff -u --recursive --new-file v2.3.30/linux/drivers/char/Makefile linux/drivers/char/Makefile --- v2.3.30/linux/drivers/char/Makefile Tue Dec 7 09:32:43 1999 +++ linux/drivers/char/Makefile Tue Dec 7 16:22:34 1999 @@ -622,6 +622,7 @@ endif ifeq ($(CONFIG_DRM),y) + SUB_DIRS += drm ALL_SUB_DIRS += drm MOD_SUB_DIRS += drm endif @@ -633,6 +634,11 @@ ifeq ($(CONFIG_PCMCIA),m) MOD_IN_SUB_DIRS += pcmcia endif +endif + +ifeq ($(CONFIG_AGP), m) + ALL_SUB_DIRS += agp + MOD_SUB_DIRS += agp endif include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.3.30/linux/drivers/char/agp/Makefile linux/drivers/char/agp/Makefile --- v2.3.30/linux/drivers/char/agp/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/agp/Makefile Tue Dec 7 16:22:34 1999 @@ -0,0 +1,32 @@ +# +# Makefile for the agpgart device driver. This driver adds a user +# space ioctl interface to use agp memory. It also adds a kernel interface +# that other drivers could use to manipulate agp memory. + +M_OBJS := agpgart.o + +CFLAGS_agp_backend.o := + +ifdef CONFIG_AGP_I810 +CFLAGS_agp_backend.o += -DAGP_BUILD_INTEL_I810 +endif +ifdef CONFIG_AGP_INTEL +CFLAGS_agp_backend.o += -DAGP_BUILD_INTEL_GENERIC +endif +ifdef CONFIG_AGP_VIA +CFLAGS_agp_backend.o += -DAGP_BUILD_VIA_GENERIC +endif +ifdef CONFIG_AGP_AMD +CFLAGS_agp_backend.o += -DAGP_BUILD_AMD_IRONGATE +endif +ifdef CONFIG_AGP_SIS +CFLAGS_agp_backend.o += -DAGP_BUILD_SIS_GENERIC +endif +ifdef CONFIG_AGP_ALI +CFLAGS_agp_backend.o += -DAGP_BUILD_ALI_M1541 +endif + +include $(TOPDIR)/Rules.make + +agpgart.o: agp_backend.o agpgart_fe.o + $(LD) $(LD_RFLAG) -r -o $@ agp_backend.o agpgart_fe.o diff -u --recursive --new-file v2.3.30/linux/drivers/char/agp/agp_backend.c linux/drivers/char/agp/agp_backend.c --- v2.3.30/linux/drivers/char/agp/agp_backend.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/agp/agp_backend.c Tue Dec 7 16:22:34 1999 @@ -0,0 +1,1987 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight + * Copyright (C) 1999 Xi Graphics + * + * 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 + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS 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. + * + */ +#define EXPORT_SYMTAB +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "agp_backendP.h" + +static struct agp_bridge_data agp_bridge; + +#define CACHE_FLUSH agp_bridge.cache_flush + +MODULE_AUTHOR("Jeff Hartmann "); +MODULE_PARM(agp_try_unsupported, "1i"); +EXPORT_SYMBOL(agp_free_memory); +EXPORT_SYMBOL(agp_allocate_memory); +EXPORT_SYMBOL(agp_copy_info); +EXPORT_SYMBOL(agp_bind_memory); +EXPORT_SYMBOL(agp_unbind_memory); +EXPORT_SYMBOL(agp_enable); +EXPORT_SYMBOL(agp_backend_acquire); +EXPORT_SYMBOL(agp_backend_release); + +static int agp_try_unsupported __initdata = 0; + +#ifdef __SMP__ +static atomic_t cpus_waiting; +#endif + +int agp_backend_acquire(void) +{ + atomic_inc(&(agp_bridge.agp_in_use)); + + if (atomic_read(&(agp_bridge.agp_in_use)) != 1) { + atomic_dec(&(agp_bridge.agp_in_use)); + return -EBUSY; + } + MOD_INC_USE_COUNT; + return 0; +} + +void agp_backend_release(void) +{ + atomic_dec(&(agp_bridge.agp_in_use)); + MOD_DEC_USE_COUNT; +} + +static void flush_cache(void) +{ + asm volatile ("wbinvd":::"memory"); +} + +#ifdef __SMP__ +static void ipi_handler(void *null) +{ + flush_cache(); + atomic_dec(&cpus_waiting); + while (atomic_read(&cpus_waiting) > 0) + barrier(); +} + +static void smp_flush_cache(void) +{ + atomic_set(&cpus_waiting, smp_num_cpus - 1); + if (smp_call_function(ipi_handler, NULL, 1, 0) != 0) + panic("agpgart: timed out waiting for the other CPUs!\n"); + flush_cache(); + while (atomic_read(&cpus_waiting) > 0) + barrier(); +} +#endif + +/* + * Basic Page Allocation Routines - + * These routines handle page allocation + * and by default they reserve the allocated + * memory. They also handle incrementing the + * current_memory_agp value, Which is checked + * against a maximum value. + */ + +static void *agp_alloc_page(void) +{ + void *pt; + + pt = (void *) __get_free_page(GFP_KERNEL); + if (pt == NULL) { + return NULL; + } + atomic_inc(&(mem_map[MAP_NR(pt)].count)); + set_bit(PG_locked, &mem_map[MAP_NR(pt)].flags); + atomic_inc(&(agp_bridge.current_memory_agp)); + return pt; +} + +static void agp_destroy_page(void *pt) +{ + if (pt == NULL) + return; + + atomic_dec(&(mem_map[MAP_NR(pt)].count)); + clear_bit(PG_locked, &mem_map[MAP_NR(pt)].flags); + wake_up(&mem_map[MAP_NR(pt)].wait); + free_page((unsigned long) pt); + atomic_dec(&(agp_bridge.current_memory_agp)); +} + +/* End Basic Page Allocation Routines */ + +/* + * Generic routines for handling agp_memory structures - + * They use the basic page allocation routines to do the + * brunt of the work. + */ + +#define MAXKEY (4096 * 32) + +static void agp_free_key(int key) +{ + + if (key < 0) { + return; + } + if (key < MAXKEY) { + clear_bit(key, agp_bridge.key_list); + } +} + +static int agp_get_key(void) +{ + int bit; + + bit = find_first_zero_bit(agp_bridge.key_list, MAXKEY); + if (bit < MAXKEY) { + set_bit(bit, agp_bridge.key_list); + return bit; + } + return -1; +} + +static agp_memory *agp_create_memory(int scratch_pages) +{ + agp_memory *new; + + new = kmalloc(sizeof(agp_memory), GFP_KERNEL); + + if (new == NULL) { + return NULL; + } + memset(new, 0, sizeof(agp_memory)); + new->key = agp_get_key(); + + if (new->key < 0) { + kfree(new); + return NULL; + } + new->memory = vmalloc(PAGE_SIZE * scratch_pages); + + if (new->memory == NULL) { + agp_free_key(new->key); + kfree(new); + return NULL; + } + new->num_scratch_pages = scratch_pages; + return new; +} + +void agp_free_memory(agp_memory * curr) +{ + int i; + + if (curr == NULL) { + return; + } + if (curr->is_bound == TRUE) { + agp_unbind_memory(curr); + } + if (curr->type != 0) { + agp_bridge.free_by_type(curr); + MOD_DEC_USE_COUNT; + return; + } + if (curr->page_count != 0) { + for (i = 0; i < curr->page_count; i++) { + curr->memory[i] &= ~(0x00000fff); + agp_destroy_page((void *) phys_to_virt(curr->memory[i])); + } + } + agp_free_key(curr->key); + vfree(curr->memory); + kfree(curr); + MOD_DEC_USE_COUNT; +} + +#define ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(unsigned long)) + +agp_memory *agp_allocate_memory(size_t page_count, u32 type) +{ + int scratch_pages; + agp_memory *new; + int i; + + if ((atomic_read(&(agp_bridge.current_memory_agp)) + page_count) > + agp_bridge.max_memory_agp) { + return NULL; + } + if (type != 0) { + new = agp_bridge.alloc_by_type(page_count, type); + return new; + } + scratch_pages = (page_count + ENTRIES_PER_PAGE - 1) / ENTRIES_PER_PAGE; + + new = agp_create_memory(scratch_pages); + + if (new == NULL) { + return NULL; + } + for (i = 0; i < page_count; i++) { + new->memory[i] = (unsigned long) agp_alloc_page(); + + if ((void *) new->memory[i] == NULL) { + /* Free this structure */ + agp_free_memory(new); + return NULL; + } + new->memory[i] = + agp_bridge.mask_memory(virt_to_phys((void *) new->memory[i]), type); + new->page_count++; + } + + MOD_INC_USE_COUNT; + return new; +} + +/* End - Generic routines for handling agp_memory structures */ + +static int agp_return_size(void) +{ + int current_size; + void *temp; + + temp = agp_bridge.current_size; + + switch (agp_bridge.size_type) { + case U8_APER_SIZE: + current_size = ((aper_size_info_8 *) temp)->size; + break; + case U16_APER_SIZE: + current_size = ((aper_size_info_16 *) temp)->size; + break; + case U32_APER_SIZE: + current_size = ((aper_size_info_32 *) temp)->size; + break; + case FIXED_APER_SIZE: + current_size = ((aper_size_info_fixed *) temp)->size; + break; + default: + current_size = 0; + break; + } + + return current_size; +} + +/* Routine to copy over information structure */ + +void agp_copy_info(agp_kern_info * info) +{ + memset(info, 0, sizeof(agp_kern_info)); + info->version.major = agp_bridge.version->major; + info->version.minor = agp_bridge.version->minor; + info->device = agp_bridge.dev; + info->chipset = agp_bridge.type; + info->mode = agp_bridge.mode; + info->aper_base = agp_bridge.gart_bus_addr; + info->aper_size = agp_return_size(); + info->max_memory = agp_bridge.max_memory_agp; + info->current_memory = atomic_read(&agp_bridge.current_memory_agp); +} + +/* End - Routine to copy over information structure */ + +/* + * Routines for handling swapping of agp_memory into the GATT - + * These routines take agp_memory and insert them into the GATT. + * They call device specific routines to actually write to the GATT. + */ + +int agp_bind_memory(agp_memory * curr, off_t pg_start) +{ + int ret_val; + + if ((curr == NULL) || (curr->is_bound == TRUE)) { + return -EINVAL; + } + if (curr->is_flushed == FALSE) { + CACHE_FLUSH(); + curr->is_flushed = TRUE; + } + ret_val = agp_bridge.insert_memory(curr, pg_start, curr->type); + + if (ret_val != 0) { + return ret_val; + } + curr->is_bound = TRUE; + curr->pg_start = pg_start; + return 0; +} + +int agp_unbind_memory(agp_memory * curr) +{ + int ret_val; + + if (curr == NULL) { + return -EINVAL; + } + if (curr->is_bound != TRUE) { + return -EINVAL; + } + ret_val = agp_bridge.remove_memory(curr, curr->pg_start, curr->type); + + if (ret_val != 0) { + return ret_val; + } + curr->is_bound = FALSE; + curr->pg_start = 0; + return 0; +} + +/* End - Routines for handling swapping of agp_memory into the GATT */ + +/* + * Driver routines - start + * Currently this module supports the + * i810, 440lx, 440bx, 440gx, via vp3, via mvp3, + * amd irongate, ALi M1541 and generic support for the + * SiS chipsets. + */ + +/* Generic Agp routines - Start */ + +static void agp_generic_agp_enable(u32 mode) +{ + struct pci_dev *device = NULL; + u32 command, scratch, cap_id; + u8 cap_ptr; + + pci_read_config_dword(agp_bridge.dev, + agp_bridge.capndx + 4, + &command); + + /* + * PASS1: go throu all devices that claim to be + * AGP devices and collect their data. + */ + + while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, device)) != NULL) { + pci_read_config_dword(device, 0x04, &scratch); + + if (!(scratch & 0x00100000)) + continue; + + pci_read_config_byte(device, 0x34, &cap_ptr); + + if (cap_ptr != 0x00) { + do { + pci_read_config_dword(device, cap_ptr, &cap_id); + + if ((cap_id & 0xff) != 0x02) + cap_ptr = (cap_id >> 8) & 0xff; + } + while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00)); + } + if (cap_ptr != 0x00) { + /* + * Ok, here we have a AGP device. Disable impossible settings, + * and adjust the readqueue to the minimum. + */ + + pci_read_config_dword(device, cap_ptr + 4, &scratch); + + /* adjust RQ depth */ + command = + ((command & ~0xff000000) | + min((mode & 0xff000000), min((command & 0xff000000), (scratch & 0xff000000)))); + + /* disable SBA if it's not supported */ + if (!((command & 0x00000200) && (scratch & 0x00000200) && (mode & 0x00000200))) + command &= ~0x00000200; + + /* disable FW if it's not supported */ + if (!((command & 0x00000010) && (scratch & 0x00000010) && (mode & 0x00000010))) + command &= ~0x00000010; + + if (!((command & 4) && (scratch & 4) && (mode & 4))) + command &= ~0x00000004; + + if (!((command & 2) && (scratch & 2) && (mode & 2))) + command &= ~0x00000002; + + if (!((command & 1) && (scratch & 1) && (mode & 1))) + command &= ~0x00000001; + } + } + /* + * PASS2: Figure out the 4X/2X/1X setting and enable the + * target (our motherboard chipset). + */ + + if (command & 4) { + command &= ~3; /* 4X */ + } + if (command & 2) { + command &= ~5; /* 2X */ + } + if (command & 1) { + command &= ~6; /* 1X */ + } + command |= 0x00000100; + + pci_write_config_dword(agp_bridge.dev, + agp_bridge.capndx + 8, + command); + + /* + * PASS3: Go throu all AGP devices and update the + * command registers. + */ + + while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, device)) != NULL) { + pci_read_config_dword(device, 0x04, &scratch); + + if (!(scratch & 0x00100000)) + continue; + + pci_read_config_byte(device, 0x34, &cap_ptr); + + if (cap_ptr != 0x00) { + do { + pci_read_config_dword(device, cap_ptr, &cap_id); + + if ((cap_id & 0xff) != 0x02) + cap_ptr = (cap_id >> 8) & 0xff; + } + while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00)); + } + if (cap_ptr != 0x00) + pci_write_config_dword(device, cap_ptr + 8, command); + } +} + +static int agp_generic_create_gatt_table(void) +{ + char *table; + char *table_end; + int size; + int page_order; + int num_entries; + int i; + void *temp; + + table = NULL; + i = agp_bridge.aperture_size_idx; + temp = agp_bridge.current_size; + size = page_order = num_entries = 0; + + if (agp_bridge.size_type != FIXED_APER_SIZE) { + do { + switch (agp_bridge.size_type) { + case U8_APER_SIZE: + size = ((aper_size_info_8 *) temp)->size; + page_order = ((aper_size_info_8 *) temp)->page_order; + num_entries = ((aper_size_info_8 *) temp)->num_entries; + break; + case U16_APER_SIZE: + size = ((aper_size_info_16 *) temp)->size; + page_order = ((aper_size_info_16 *) temp)->page_order; + num_entries = ((aper_size_info_16 *) temp)->num_entries; + break; + case U32_APER_SIZE: + size = ((aper_size_info_32 *) temp)->size; + page_order = ((aper_size_info_32 *) temp)->page_order; + num_entries = ((aper_size_info_32 *) temp)->num_entries; + break; + /* This case will never really happen */ + case FIXED_APER_SIZE: + default: + size = page_order = num_entries = 0; + break; + } + + table = (char *) __get_free_pages(GFP_KERNEL, page_order); + + if (table == NULL) { + i++; + + switch (agp_bridge.size_type) { + case U8_APER_SIZE: + agp_bridge.current_size = (((aper_size_info_8 *) agp_bridge.aperture_sizes) + i); + break; + case U16_APER_SIZE: + agp_bridge.current_size = (((aper_size_info_16 *) agp_bridge.aperture_sizes) + i); + break; + case U32_APER_SIZE: + agp_bridge.current_size = (((aper_size_info_32 *) agp_bridge.aperture_sizes) + i); + break; + /* This case will never really happen */ + case FIXED_APER_SIZE: + default: + size = page_order = num_entries = 0; + break; + } + } else { + agp_bridge.aperture_size_idx = i; + } + } while ((table == NULL) && (i < agp_bridge.num_aperture_sizes)); + } else { + size = ((aper_size_info_fixed *) temp)->size; + page_order = ((aper_size_info_fixed *) temp)->page_order; + num_entries = ((aper_size_info_fixed *) temp)->num_entries; + table = (char *) __get_free_pages(GFP_KERNEL, page_order); + } + + if (table == NULL) { + return -ENOMEM; + } + table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); + + for (i = MAP_NR(table); i < MAP_NR(table_end); i++) { + set_bit(PG_reserved, &mem_map[i].flags); + } + + agp_bridge.gatt_table_real = (unsigned long *) table; + CACHE_FLUSH(); + agp_bridge.gatt_table = ioremap_nocache(virt_to_phys(table), + (PAGE_SIZE * (1 << page_order))); + CACHE_FLUSH(); + + if (agp_bridge.gatt_table == NULL) { + for (i = MAP_NR(table); i < MAP_NR(table_end); i++) { + clear_bit(PG_reserved, &mem_map[i].flags); + } + + free_pages((unsigned long) table, page_order); + + return -ENOMEM; + } + agp_bridge.gatt_bus_addr = virt_to_phys(agp_bridge.gatt_table_real); + + for (i = 0; i < num_entries; i++) { + agp_bridge.gatt_table[i] = (unsigned long) agp_bridge.scratch_page; + } + + return 0; +} + +static int agp_generic_free_gatt_table(void) +{ + int i; + int page_order; + char *table, *table_end; + void *temp; + + temp = agp_bridge.current_size; + + switch (agp_bridge.size_type) { + case U8_APER_SIZE: + page_order = ((aper_size_info_8 *) temp)->page_order; + break; + case U16_APER_SIZE: + page_order = ((aper_size_info_16 *) temp)->page_order; + break; + case U32_APER_SIZE: + page_order = ((aper_size_info_32 *) temp)->page_order; + break; + case FIXED_APER_SIZE: + page_order = ((aper_size_info_fixed *) temp)->page_order; + break; + default: + page_order = 0; + break; + } + + /* Do not worry about freeing memory, because if this is + * called, then all agp memory is deallocated and removed + * from the table. + */ + + iounmap(agp_bridge.gatt_table); + table = (char *) agp_bridge.gatt_table_real; + table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); + + for (i = MAP_NR(table); i < MAP_NR(table_end); i++) { + clear_bit(PG_reserved, &mem_map[i].flags); + } + + free_pages((unsigned long) agp_bridge.gatt_table_real, page_order); + return 0; +} + +static int agp_generic_insert_memory(agp_memory * mem, + off_t pg_start, int type) +{ + int i, j, num_entries; + void *temp; + + temp = agp_bridge.current_size; + + switch (agp_bridge.size_type) { + case U8_APER_SIZE: + num_entries = ((aper_size_info_8 *) temp)->num_entries; + break; + case U16_APER_SIZE: + num_entries = ((aper_size_info_16 *) temp)->num_entries; + break; + case U32_APER_SIZE: + num_entries = ((aper_size_info_32 *) temp)->num_entries; + break; + case FIXED_APER_SIZE: + num_entries = ((aper_size_info_fixed *) temp)->num_entries; + break; + default: + num_entries = 0; + break; + } + + if (type != 0 || mem->type != 0) { + /* The generic routines know nothing of memory types */ + return -EINVAL; + } + if ((pg_start + mem->page_count) > num_entries) { + return -EINVAL; + } + j = pg_start; + + while (j < (pg_start + mem->page_count)) { + if (!PGE_EMPTY(agp_bridge.gatt_table[j])) { + return -EBUSY; + } + j++; + } + + if (mem->is_flushed == FALSE) { + CACHE_FLUSH(); + mem->is_flushed = TRUE; + } + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { + agp_bridge.gatt_table[j] = mem->memory[i]; + } + + agp_bridge.tlb_flush(mem); + return 0; +} + +static int agp_generic_remove_memory(agp_memory * mem, off_t pg_start, + int type) +{ + int i; + + if (type != 0 || mem->type != 0) { + /* The generic routines know nothing of memory types */ + return -EINVAL; + } + for (i = pg_start; i < (mem->page_count + pg_start); i++) { + agp_bridge.gatt_table[i] = (unsigned long) agp_bridge.scratch_page; + } + + agp_bridge.tlb_flush(mem); + return 0; +} + +static agp_memory *agp_generic_alloc_by_type(size_t page_count, int type) +{ + return NULL; +} + +static void agp_generic_free_by_type(agp_memory * curr) +{ + if (curr->memory != NULL) { + vfree(curr->memory); + } + agp_free_key(curr->key); + kfree(curr); +} + +void agp_enable(u32 mode) +{ + agp_bridge.agp_enable(mode); +} + +/* End - Generic Agp routines */ + +#ifdef AGP_BUILD_INTEL_I810 + +static aper_size_info_fixed intel_i810_sizes[] = +{ + {64, 16384, 4}, + /* The 32M mode still requires a 64k gatt */ + {32, 8192, 4} +}; + +#define AGP_DCACHE_MEMORY 1 + +static gatt_mask intel_i810_masks[] = +{ + {I810_PTE_VALID, 0}, + {(I810_PTE_VALID | I810_PTE_LOCAL), AGP_DCACHE_MEMORY} +}; + +static struct _intel_i810_private { + struct pci_dev *i810_dev; /* device one */ + volatile unsigned char *registers; + int num_dcache_entries; +} intel_i810_private; + +static int intel_i810_fetch_size(void) +{ + u32 smram_miscc; + aper_size_info_fixed *values; + + pci_read_config_dword(agp_bridge.dev, I810_SMRAM_MISCC, &smram_miscc); + values = (aper_size_info_fixed *) agp_bridge.aperture_sizes; + + if ((smram_miscc & I810_GMS) == I810_GMS_DISABLE) { + printk("agpgart: i810 is disabled\n"); + return 0; + } + if ((smram_miscc & I810_GFX_MEM_WIN_SIZE) == I810_GFX_MEM_WIN_32M) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + 1); + agp_bridge.aperture_size_idx = 1; + return values[1].size; + } else { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values); + agp_bridge.aperture_size_idx = 0; + return values[0].size; + } + + return 0; +} + +static int intel_i810_configure(void) +{ + aper_size_info_fixed *current_size; + u32 temp; + int i; + + current_size = (aper_size_info_fixed *) agp_bridge.current_size; + + pci_read_config_dword(intel_i810_private.i810_dev, I810_MMADDR, &temp); + temp &= 0xfff80000; + + intel_i810_private.registers = + (volatile unsigned char *) ioremap(temp, 128 * 4096); + + if ((INREG32(intel_i810_private.registers, I810_DRAM_CTL) + & I810_DRAM_ROW_0) == I810_DRAM_ROW_0_SDRAM) { + /* This will need to be dynamically assigned */ + printk("agpgart: detected 4MB dedicated video ram.\n"); + intel_i810_private.num_dcache_entries = 1024; + } + pci_read_config_dword(intel_i810_private.i810_dev, I810_GMADDR, &temp); + agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); + OUTREG32(intel_i810_private.registers, I810_PGETBL_CTL, + agp_bridge.gatt_bus_addr | I810_PGETBL_ENABLED); + CACHE_FLUSH(); + + if (agp_bridge.needs_scratch_page == TRUE) { + for (i = 0; i < current_size->num_entries; i++) { + OUTREG32(intel_i810_private.registers, I810_PTE_BASE + (i * 4), + agp_bridge.scratch_page); + } + } + return 0; +} + +static void intel_i810_cleanup(void) +{ + OUTREG32(intel_i810_private.registers, I810_PGETBL_CTL, 0); + iounmap((void *) intel_i810_private.registers); +} + +static void intel_i810_tlbflush(agp_memory * mem) +{ + return; +} + +static void intel_i810_agp_enable(u32 mode) +{ + return; +} + +static int intel_i810_insert_entries(agp_memory * mem, off_t pg_start, + int type) +{ + int i, j, num_entries; + void *temp; + + temp = agp_bridge.current_size; + num_entries = ((aper_size_info_fixed *) temp)->num_entries; + + if ((pg_start + mem->page_count) > num_entries) { + return -EINVAL; + } + for (j = pg_start; j < (pg_start + mem->page_count); j++) { + if (!PGE_EMPTY(agp_bridge.gatt_table[j])) { + return -EBUSY; + } + } + + if (type != 0 || mem->type != 0) { + if ((type == AGP_DCACHE_MEMORY) && + (mem->type == AGP_DCACHE_MEMORY)) { + /* special insert */ + + for (i = pg_start; i < (pg_start + mem->page_count); i++) { + OUTREG32(intel_i810_private.registers, I810_PTE_BASE + (i * 4), + (i * 4096) | I810_PTE_LOCAL | I810_PTE_VALID); + } + + agp_bridge.tlb_flush(mem); + return 0; + } + return -EINVAL; + } + if (mem->is_flushed == FALSE) { + CACHE_FLUSH(); + mem->is_flushed = TRUE; + } + for (i = 0, j = pg_start; i < mem->page_count; i++, j++) { + OUTREG32(intel_i810_private.registers, + I810_PTE_BASE + (j * 4), mem->memory[i]); + } + + agp_bridge.tlb_flush(mem); + return 0; +} + +static int intel_i810_remove_entries(agp_memory * mem, off_t pg_start, + int type) +{ + int i; + + for (i = pg_start; i < (mem->page_count + pg_start); i++) { + OUTREG32(intel_i810_private.registers, I810_PTE_BASE + (i * 4), + agp_bridge.scratch_page); + } + + agp_bridge.tlb_flush(mem); + return 0; +} + +static agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type) +{ + agp_memory *new; + + if (type == AGP_DCACHE_MEMORY) { + if (pg_count != intel_i810_private.num_dcache_entries) { + return NULL; + } + new = agp_create_memory(1); + + if (new == NULL) { + return NULL; + } + new->type = AGP_DCACHE_MEMORY; + new->page_count = pg_count; + new->num_scratch_pages = 0; + vfree(new->memory); + return new; + } + return NULL; +} + +static void intel_i810_free_by_type(agp_memory * curr) +{ + agp_free_key(curr->key); + kfree(curr); +} + +static unsigned long intel_i810_mask_memory(unsigned long addr, int type) +{ + /* Type checking must be done elsewhere */ + return addr | agp_bridge.masks[type].mask; +} + +static void intel_i810_setup(struct pci_dev *i810_dev) +{ + intel_i810_private.i810_dev = i810_dev; + + agp_bridge.masks = intel_i810_masks; + agp_bridge.num_of_masks = 2; + agp_bridge.aperture_sizes = (void *) intel_i810_sizes; + agp_bridge.size_type = FIXED_APER_SIZE; + agp_bridge.num_aperture_sizes = 2; + agp_bridge.dev_private_data = (void *) &intel_i810_private; + agp_bridge.needs_scratch_page = TRUE; + agp_bridge.configure = intel_i810_configure; + agp_bridge.fetch_size = intel_i810_fetch_size; + agp_bridge.cleanup = intel_i810_cleanup; + agp_bridge.tlb_flush = intel_i810_tlbflush; + agp_bridge.mask_memory = intel_i810_mask_memory; + agp_bridge.agp_enable = intel_i810_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = intel_i810_insert_entries; + agp_bridge.remove_memory = intel_i810_remove_entries; + agp_bridge.alloc_by_type = intel_i810_alloc_by_type; + agp_bridge.free_by_type = intel_i810_free_by_type; +} + +#endif + +#ifdef AGP_BUILD_INTEL_GENERIC + +static int intel_fetch_size(void) +{ + int i; + u16 temp; + aper_size_info_16 *values; + + pci_read_config_word(agp_bridge.dev, INTEL_APSIZE, &temp); + (void *) values = agp_bridge.aperture_sizes; + + for (i = 0; i < agp_bridge.num_aperture_sizes; i++) { + if (temp == values[i].size_value) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + i); + agp_bridge.aperture_size_idx = i; + return values[i].size; + } + } + + return 0; +} + +static void intel_tlbflush(agp_memory * mem) +{ + pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x2200); + pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x2280); +} + +static void intel_cleanup(void) +{ + u16 temp; + aper_size_info_16 *previous_size; + + previous_size = (aper_size_info_16 *) agp_bridge.previous_size; + pci_read_config_word(agp_bridge.dev, INTEL_NBXCFG, &temp); + pci_write_config_word(agp_bridge.dev, INTEL_NBXCFG, temp & ~(1 << 9)); + pci_write_config_word(agp_bridge.dev, INTEL_APSIZE, previous_size->size_value); +} + +static int intel_configure(void) +{ + u32 temp; + u16 temp2; + aper_size_info_16 *current_size; + + current_size = (aper_size_info_16 *) agp_bridge.current_size; + + /* aperture size */ + pci_write_config_word(agp_bridge.dev, INTEL_APSIZE, current_size->size_value); + + /* address to map to */ + pci_read_config_dword(agp_bridge.dev, INTEL_APBASE, &temp); + agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); + + /* attbase - aperture base */ + pci_write_config_dword(agp_bridge.dev, INTEL_ATTBASE, agp_bridge.gatt_bus_addr); + + /* agpctrl */ + pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x2280); + + /* paccfg/nbxcfg */ + pci_read_config_word(agp_bridge.dev, INTEL_NBXCFG, &temp2); + pci_write_config_word(agp_bridge.dev, INTEL_NBXCFG, (temp2 & ~(1 << 10)) | (1 << 9)); + /* clear any possible error conditions */ + pci_write_config_byte(agp_bridge.dev, INTEL_ERRSTS + 1, 7); + return 0; +} + +static unsigned long intel_mask_memory(unsigned long addr, int type) +{ + /* Memory type is ignored */ + + return addr | agp_bridge.masks[0].mask; +} + + +/* Setup function */ +static gatt_mask intel_generic_masks[] = +{ + {0x00000017, 0} +}; + +static aper_size_info_16 intel_generic_sizes[7] = +{ + {256, 65536, 6, 0}, + {128, 32768, 5, 32}, + {64, 16384, 4, 48}, + {32, 8192, 3, 56}, + {16, 4096, 2, 60}, + {8, 2048, 1, 62}, + {4, 1024, 0, 63} +}; + +static void intel_generic_setup(void) +{ + agp_bridge.masks = intel_generic_masks; + agp_bridge.num_of_masks = 1; + agp_bridge.aperture_sizes = (void *) intel_generic_sizes; + agp_bridge.size_type = U16_APER_SIZE; + agp_bridge.num_aperture_sizes = 7; + agp_bridge.dev_private_data = NULL; + agp_bridge.needs_scratch_page = FALSE; + agp_bridge.configure = intel_configure; + agp_bridge.fetch_size = intel_fetch_size; + agp_bridge.cleanup = intel_cleanup; + agp_bridge.tlb_flush = intel_tlbflush; + agp_bridge.mask_memory = intel_mask_memory; + agp_bridge.agp_enable = agp_generic_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = agp_generic_insert_memory; + agp_bridge.remove_memory = agp_generic_remove_memory; + agp_bridge.alloc_by_type = agp_generic_alloc_by_type; + agp_bridge.free_by_type = agp_generic_free_by_type; +} + +#endif + +#ifdef AGP_BUILD_VIA_GENERIC + +static int via_fetch_size(void) +{ + int i; + u8 temp; + aper_size_info_8 *values; + + (void *) values = agp_bridge.aperture_sizes; + pci_read_config_byte(agp_bridge.dev, VIA_APSIZE, &temp); + for (i = 0; i < agp_bridge.num_aperture_sizes; i++) { + if (temp == values[i].size_value) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + i); + agp_bridge.aperture_size_idx = i; + return values[i].size; + } + } + + return 0; +} + +static int via_configure(void) +{ + u32 temp; + aper_size_info_8 *current_size; + + current_size = (aper_size_info_8 *) agp_bridge.current_size; + /* aperture size */ + pci_write_config_byte(agp_bridge.dev, VIA_APSIZE, current_size->size_value); + /* address to map too */ + pci_read_config_dword(agp_bridge.dev, VIA_APBASE, &temp); + agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); + + /* GART control register */ + pci_write_config_dword(agp_bridge.dev, VIA_GARTCTRL, 0x0000000f); + + /* attbase - aperture GATT base */ + pci_write_config_dword(agp_bridge.dev, VIA_ATTBASE, + (agp_bridge.gatt_bus_addr & 0xfffff000) | 3); + return 0; +} + +static void via_cleanup(void) +{ + aper_size_info_8 *previous_size; + + previous_size = (aper_size_info_8 *) agp_bridge.previous_size; + pci_write_config_dword(agp_bridge.dev, VIA_ATTBASE, 0); + pci_write_config_byte(agp_bridge.dev, VIA_APSIZE, previous_size->size_value); +} + +static void via_tlbflush(agp_memory * mem) +{ + pci_write_config_dword(agp_bridge.dev, VIA_GARTCTRL, 0x0000008f); + pci_write_config_dword(agp_bridge.dev, VIA_GARTCTRL, 0x0000000f); +} + +static unsigned long via_mask_memory(unsigned long addr, int type) +{ + /* Memory type is ignored */ + + return addr | agp_bridge.masks[0].mask; +} + +static aper_size_info_8 via_generic_sizes[7] = +{ + {256, 65536, 6, 0}, + {128, 32768, 5, 128}, + {64, 16384, 4, 192}, + {32, 8192, 3, 224}, + {16, 4096, 2, 240}, + {8, 2048, 1, 248}, + {4, 1024, 0, 252} +}; + +static gatt_mask via_generic_masks[] = +{ + {0x00000000, 0} +}; + +static void via_generic_setup(void) +{ + agp_bridge.masks = via_generic_masks; + agp_bridge.num_of_masks = 1; + agp_bridge.aperture_sizes = (void *) via_generic_sizes; + agp_bridge.size_type = U8_APER_SIZE; + agp_bridge.num_aperture_sizes = 7; + agp_bridge.dev_private_data = NULL; + agp_bridge.needs_scratch_page = FALSE; + agp_bridge.configure = via_configure; + agp_bridge.fetch_size = via_fetch_size; + agp_bridge.cleanup = via_cleanup; + agp_bridge.tlb_flush = via_tlbflush; + agp_bridge.mask_memory = via_mask_memory; + agp_bridge.agp_enable = agp_generic_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = agp_generic_insert_memory; + agp_bridge.remove_memory = agp_generic_remove_memory; + agp_bridge.alloc_by_type = agp_generic_alloc_by_type; + agp_bridge.free_by_type = agp_generic_free_by_type; +} + +#endif + +#ifdef AGP_BUILD_SIS_GENERIC + +static int sis_fetch_size(void) +{ + u8 temp_size; + int i; + aper_size_info_8 *values; + + pci_read_config_byte(agp_bridge.dev, SIS_APSIZE, &temp_size); + (void *) values = agp_bridge.aperture_sizes; + for (i = 0; i < agp_bridge.num_aperture_sizes; i++) { + if ((temp_size == values[i].size_value) || + ((temp_size & ~(0x03)) == (values[i].size_value & ~(0x03)))) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + i); + + agp_bridge.aperture_size_idx = i; + return values[i].size; + } + } + + return 0; +} + + +static void sis_tlbflush(agp_memory * mem) +{ + pci_write_config_byte(agp_bridge.dev, SIS_TLBFLUSH, 0x02); +} + +static int sis_configure(void) +{ + u32 temp; + aper_size_info_8 *current_size; + + current_size = (aper_size_info_8 *) agp_bridge.current_size; + pci_write_config_byte(agp_bridge.dev, SIS_TLBCNTRL, 0x05); + pci_read_config_dword(agp_bridge.dev, SIS_APBASE, &temp); + agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); + pci_write_config_dword(agp_bridge.dev, SIS_ATTBASE, agp_bridge.gatt_bus_addr); + pci_write_config_byte(agp_bridge.dev, SIS_APSIZE, current_size->size_value); + return 0; +} + +static void sis_cleanup(void) +{ + aper_size_info_8 *previous_size; + + previous_size = (aper_size_info_8 *) agp_bridge.previous_size; + pci_write_config_byte(agp_bridge.dev, SIS_APSIZE, (previous_size->size_value & ~(0x03))); +} + +static unsigned long sis_mask_memory(unsigned long addr, int type) +{ + /* Memory type is ignored */ + + return addr | agp_bridge.masks[0].mask; +} + +static aper_size_info_8 sis_generic_sizes[7] = +{ + {256, 65536, 6, 99}, + {128, 32768, 5, 83}, + {64, 16384, 4, 67}, + {32, 8192, 3, 51}, + {16, 4096, 2, 35}, + {8, 2048, 1, 19}, + {4, 1024, 0, 3} +}; + +static gatt_mask sis_generic_masks[] = +{ + {0x00000000, 0} +}; + +static void sis_generic_setup(void) +{ + agp_bridge.masks = sis_generic_masks; + agp_bridge.num_of_masks = 1; + agp_bridge.aperture_sizes = (void *) sis_generic_sizes; + agp_bridge.size_type = U8_APER_SIZE; + agp_bridge.num_aperture_sizes = 7; + agp_bridge.dev_private_data = NULL; + agp_bridge.needs_scratch_page = FALSE; + agp_bridge.configure = sis_configure; + agp_bridge.fetch_size = sis_fetch_size; + agp_bridge.cleanup = sis_cleanup; + agp_bridge.tlb_flush = sis_tlbflush; + agp_bridge.mask_memory = sis_mask_memory; + agp_bridge.agp_enable = agp_generic_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = agp_generic_insert_memory; + agp_bridge.remove_memory = agp_generic_remove_memory; + agp_bridge.alloc_by_type = agp_generic_alloc_by_type; + agp_bridge.free_by_type = agp_generic_free_by_type; +} + +#endif + +#ifdef AGP_BUILD_AMD_IRONGATE + +static struct _amd_irongate_private { + volatile unsigned char *registers; +} amd_irongate_private; + +static int amd_irongate_fetch_size(void) +{ + int i; + u32 temp; + aper_size_info_32 *values; + + pci_read_config_dword(agp_bridge.dev, AMD_APSIZE, &temp); + temp = (temp & 0x0000000e); + (void *) values = agp_bridge.aperture_sizes; + for (i = 0; i < agp_bridge.num_aperture_sizes; i++) { + if (temp == values[i].size_value) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + i); + + agp_bridge.aperture_size_idx = i; + return values[i].size; + } + } + + return 0; +} + +static int amd_irongate_configure(void) +{ + aper_size_info_32 *current_size; + u32 temp; + u16 enable_reg; + + current_size = (aper_size_info_32 *) agp_bridge.current_size; + + /* Get the memory mapped registers */ + pci_read_config_dword(agp_bridge.dev, AMD_MMBASE, &temp); + temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); + amd_irongate_private.registers = (volatile unsigned char *) ioremap(temp, 4096); + + /* Write out the address of the gatt table */ + OUTREG32(amd_irongate_private.registers, AMD_ATTBASE, agp_bridge.gatt_bus_addr); + + /* Write the Sync register */ + pci_write_config_byte(agp_bridge.dev, AMD_MODECNTL, 0x80); + + /* Write the enable register */ + enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE); + enable_reg = (enable_reg | 0x0004); + OUTREG16(amd_irongate_private.registers, AMD_GARTENABLE, enable_reg); + + /* Write out the size register */ + pci_read_config_dword(agp_bridge.dev, AMD_APSIZE, &temp); + temp = (((temp & ~(0x0000000e)) | current_size->size_value) | 0x00000001); + pci_write_config_dword(agp_bridge.dev, AMD_APSIZE, temp); + + /* Flush the tlb */ + OUTREG32(amd_irongate_private.registers, AMD_TLBFLUSH, 0x00000001); + + /* Get the address for the gart region */ + pci_read_config_dword(agp_bridge.dev, AMD_APBASE, &temp); + temp = (temp & PCI_BASE_ADDRESS_MEM_MASK); + agp_bridge.gart_bus_addr = temp; + return 0; +} + +static void amd_irongate_cleanup(void) +{ + aper_size_info_32 *previous_size; + u32 temp; + u16 enable_reg; + + previous_size = (aper_size_info_32 *) agp_bridge.previous_size; + + enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE); + enable_reg = (enable_reg & ~(0x0004)); + OUTREG16(amd_irongate_private.registers, AMD_GARTENABLE, enable_reg); + + /* Write back the previous size and disable gart translation */ + pci_read_config_dword(agp_bridge.dev, AMD_APSIZE, &temp); + temp = ((temp & ~(0x0000000f)) | previous_size->size_value); + pci_write_config_dword(agp_bridge.dev, AMD_APSIZE, temp); + iounmap((void *) amd_irongate_private.registers); +} + +/* + * This routine could be implemented by taking the addresses + * written to the GATT, and flushing them individually. However + * currently it just flushes the whole table. Which is probably + * more efficent, since agp_memory blocks can be a large number of + * entries. + */ + +static void amd_irongate_tlbflush(agp_memory * temp) +{ + OUTREG32(amd_irongate_private.registers, AMD_TLBFLUSH, 0x00000001); +} + +static unsigned long amd_irongate_mask_memory(unsigned long addr, int type) +{ + /* Only type 0 is supported by the irongate */ + + return addr | agp_bridge.masks[0].mask; +} + +static aper_size_info_32 amd_irongate_sizes[7] = +{ + {2048, 524288, 9, 0x0000000c}, + {1024, 262144, 8, 0x0000000a}, + {512, 131072, 7, 0x00000008}, + {256, 65536, 6, 0x00000006}, + {128, 32768, 5, 0x00000004}, + {64, 16384, 4, 0x00000002}, + {32, 8192, 3, 0x00000000} +}; + +static gatt_mask amd_irongate_masks[] = +{ + {0x00000001, 0} +}; + +static void amd_irongate_setup(void) +{ + agp_bridge.masks = amd_irongate_masks; + agp_bridge.num_of_masks = 1; + agp_bridge.aperture_sizes = (void *) amd_irongate_sizes; + agp_bridge.size_type = U32_APER_SIZE; + agp_bridge.num_aperture_sizes = 7; + agp_bridge.dev_private_data = (void *) &amd_irongate_private; + agp_bridge.needs_scratch_page = FALSE; + agp_bridge.configure = amd_irongate_configure; + agp_bridge.fetch_size = amd_irongate_fetch_size; + agp_bridge.cleanup = amd_irongate_cleanup; + agp_bridge.tlb_flush = amd_irongate_tlbflush; + agp_bridge.mask_memory = amd_irongate_mask_memory; + agp_bridge.agp_enable = agp_generic_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = agp_generic_insert_memory; + agp_bridge.remove_memory = agp_generic_remove_memory; + agp_bridge.alloc_by_type = agp_generic_alloc_by_type; + agp_bridge.free_by_type = agp_generic_free_by_type; +} + +#endif + +#ifdef AGP_BUILD_ALI_M1541 + +static int ali_fetch_size(void) +{ + int i; + u32 temp; + aper_size_info_32 *values; + + pci_read_config_dword(agp_bridge.dev, ALI_ATTBASE, &temp); + temp &= ~(0xfffffff0); + (void *) values = agp_bridge.aperture_sizes; + + for (i = 0; i < agp_bridge.num_aperture_sizes; i++) { + if (temp == values[i].size_value) { + agp_bridge.previous_size = + agp_bridge.current_size = (void *) (values + i); + agp_bridge.aperture_size_idx = i; + return values[i].size; + } + } + + return 0; +} + +static void ali_tlbflush(agp_memory * mem) +{ + u32 temp; + + pci_read_config_dword(agp_bridge.dev, ALI_TLBCTRL, &temp); + pci_write_config_dword(agp_bridge.dev, ALI_TLBCTRL, + ((temp & 0xffffff00) | 0x00000090)); + pci_write_config_dword(agp_bridge.dev, ALI_TLBCTRL, + ((temp & 0xffffff00) | 0x00000010)); +} + +static void ali_cleanup(void) +{ + aper_size_info_32 *previous_size; + u32 temp; + + previous_size = (aper_size_info_32 *) agp_bridge.previous_size; + + pci_read_config_dword(agp_bridge.dev, ALI_TLBCTRL, &temp); + pci_write_config_dword(agp_bridge.dev, ALI_TLBCTRL, + ((temp & 0xffffff00) | 0x00000090)); + pci_write_config_dword(agp_bridge.dev, ALI_ATTBASE, previous_size->size_value); +} + +static int ali_configure(void) +{ + u32 temp; + aper_size_info_32 *current_size; + + current_size = (aper_size_info_32 *) agp_bridge.current_size; + + /* aperture size and gatt addr */ + pci_write_config_dword(agp_bridge.dev, ALI_ATTBASE, + agp_bridge.gatt_bus_addr | current_size->size_value); + + /* tlb control */ + pci_read_config_dword(agp_bridge.dev, ALI_TLBCTRL, &temp); + pci_write_config_dword(agp_bridge.dev, ALI_TLBCTRL, + ((temp & 0xffffff00) | 0x00000010)); + + /* address to map to */ + pci_read_config_dword(agp_bridge.dev, ALI_APBASE, &temp); + agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); + return 0; +} + +static unsigned long ali_mask_memory(unsigned long addr, int type) +{ + /* Memory type is ignored */ + + return addr | agp_bridge.masks[0].mask; +} + + +/* Setup function */ +static gatt_mask ali_generic_masks[] = +{ + {0x00000000, 0} +}; + +static aper_size_info_32 ali_generic_sizes[7] = +{ + {256, 65536, 6, 10}, + {128, 32768, 5, 9}, + {64, 16384, 4, 8}, + {32, 8192, 3, 7}, + {16, 4096, 2, 6}, + {8, 2048, 1, 4}, + {4, 1024, 0, 3} +}; + +static void ali_generic_setup(void) +{ + agp_bridge.masks = ali_generic_masks; + agp_bridge.num_of_masks = 1; + agp_bridge.aperture_sizes = (void *) ali_generic_sizes; + agp_bridge.size_type = U32_APER_SIZE; + agp_bridge.num_aperture_sizes = 7; + agp_bridge.dev_private_data = NULL; + agp_bridge.needs_scratch_page = FALSE; + agp_bridge.configure = ali_configure; + agp_bridge.fetch_size = ali_fetch_size; + agp_bridge.cleanup = ali_cleanup; + agp_bridge.tlb_flush = ali_tlbflush; + agp_bridge.mask_memory = ali_mask_memory; + agp_bridge.agp_enable = agp_generic_agp_enable; +#ifdef __SMP__ + agp_bridge.cache_flush = smp_flush_cache; +#else + agp_bridge.cache_flush = flush_cache; +#endif + agp_bridge.create_gatt_table = agp_generic_create_gatt_table; + agp_bridge.free_gatt_table = agp_generic_free_gatt_table; + agp_bridge.insert_memory = agp_generic_insert_memory; + agp_bridge.remove_memory = agp_generic_remove_memory; + agp_bridge.alloc_by_type = agp_generic_alloc_by_type; + agp_bridge.free_by_type = agp_generic_free_by_type; +} + +#endif + + + +/* Supported Device Scanning routine */ + +static void agp_find_supported_device(void) +{ + struct pci_dev *dev = NULL; + u8 cap_ptr = 0x00; + u32 cap_id, scratch; + + if ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8, NULL)) == NULL) { + agp_bridge.type = NOT_SUPPORTED; + return; + } + agp_bridge.dev = dev; + + /* Need to test for I810 here */ +#ifdef AGP_BUILD_INTEL_I810 + if (dev->vendor == PCI_VENDOR_ID_INTEL) { + struct pci_dev *i810_dev; + + switch (dev->device) { + case PCI_DEVICE_ID_INTEL_810_0: + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_810_1, + NULL); + if (i810_dev == NULL) { + printk("agpgart: Detected an Intel i810, but could not find the secondary device.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + printk("agpgart: Detected an Intel i810 Chipset.\n"); + agp_bridge.type = INTEL_I810; + agp_bridge.intel_i810_setup(i810_dev); + return; + + case PCI_DEVICE_ID_INTEL_810_DC100_0: + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_810_DC100_1, + NULL); + if (i810_dev == NULL) { + printk("agpgart: Detected an Intel i810 DC100, but could not find the secondary device.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + printk("agpgart: Detected an Intel i810 DC100 Chipset.\n"); + agp_bridge.type = INTEL_I810; + agp_bridge.intel_i810_setup(i810_dev); + return; + + case PCI_DEVICE_ID_INTEL_810_E_0: + i810_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_810_E_1, + NULL); + if (i810_dev == NULL) { + printk("agpgart: Detected an Intel i810 E, but could not find the secondary device.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + printk("agpgart: Detected an Intel i810 E Chipset.\n"); + agp_bridge.type = INTEL_I810; + agp_bridge.intel_i810_setup(i810_dev); + return; + default: + break; + } + } +#endif + /* find capndx */ + pci_read_config_dword(dev, 0x04, &scratch); + + if (!(scratch & 0x00100000)) { + agp_bridge.type = NOT_SUPPORTED; + return; + } + pci_read_config_byte(dev, 0x34, &cap_ptr); + + if (cap_ptr != 0x00) { + do { + pci_read_config_dword(dev, cap_ptr, &cap_id); + + if ((cap_id & 0xff) != 0x02) + cap_ptr = (cap_id >> 8) & 0xff; + } + while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00)); + } + if (cap_ptr == 0x00) { + agp_bridge.type = NOT_SUPPORTED; + return; + } + agp_bridge.capndx = cap_ptr; + + /* Fill in the mode register */ + pci_read_config_dword(agp_bridge.dev, + agp_bridge.capndx + 4, + &agp_bridge.mode); + + switch (dev->vendor) { +#ifdef AGP_BUILD_INTEL_GENERIC + case PCI_VENDOR_ID_INTEL: + switch (dev->device) { + case PCI_DEVICE_ID_INTEL_82443LX_0: + agp_bridge.type = INTEL_LX; + printk("agpgart: Detected an Intel 440LX Chipset.\n"); + agp_bridge.intel_generic_setup(); + return; + + case PCI_DEVICE_ID_INTEL_82443BX_0: + agp_bridge.type = INTEL_BX; + printk("agpgart: Detected an Intel 440BX Chipset.\n"); + agp_bridge.intel_generic_setup(); + return; + + case PCI_DEVICE_ID_INTEL_82443GX_0: + agp_bridge.type = INTEL_GX; + printk("agpgart: Detected an Intel 440GX Chipset.\n"); + agp_bridge.intel_generic_setup(); + return; + + default: + if (agp_try_unsupported != 0) { + printk("agpgart: Trying generic intel routines for device id: %x\n", dev->device); + agp_bridge.type = INTEL_GENERIC; + agp_bridge.intel_generic_setup(); + return; + } else { + printk("agpgart: Unsupported intel chipset, you might want to try agp_try_unsupported=1.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + } + break; +#endif + +#ifdef AGP_BUILD_VIA_GENERIC + case PCI_VENDOR_ID_VIA: + switch (dev->device) { + case PCI_DEVICE_ID_VIA_82C597_0: + agp_bridge.type = VIA_VP3; + printk("agpgart: Detected a VIA VP3 Chipset.\n"); + agp_bridge.via_generic_setup(); + return; + + case PCI_DEVICE_ID_VIA_82C598_0: + agp_bridge.type = VIA_MVP3; + printk("agpgart: Detected a VIA MVP3 Chipset.\n"); + agp_bridge.via_generic_setup(); + return; + + case PCI_DEVICE_ID_VIA_82C691_0: + agp_bridge.type = VIA_APOLLO_PRO; + printk("agpgart: Detected a VIA Apollo Pro Chipset.\n"); + agp_bridge.via_generic_setup(); + return; + + default: + if (agp_try_unsupported != 0) { + printk("agpgart: Trying generic VIA routines for device id: %x\n", dev->device); + agp_bridge.type = VIA_GENERIC; + agp_bridge.via_generic_setup(); + return; + } else { + printk("agpgart: Unsupported VIA chipset, you might want to try agp_try_unsupported=1.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + } + break; +#endif + +#ifdef AGP_BUILD_SIS_GENERIC + case PCI_VENDOR_ID_SI: + switch (dev->device) { + /* ToDo need to find out the specific devices supported */ + default: + if (agp_try_unsupported != 0) { + printk("agpgart: Trying generic SiS routines for device id: %x\n", dev->device); + agp_bridge.type = SIS_GENERIC; + agp_bridge.sis_generic_setup(); + return; + } else { + printk("agpgart: Unsupported SiS chipset, you might want to try agp_try_unsupported=1.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + } + break; +#endif + +#ifdef AGP_BUILD_AMD_IRONGATE + case PCI_VENDOR_ID_AMD: + switch (dev->device) { + case PCI_DEVICE_ID_AMD_IRONGATE_0: + agp_bridge.type = AMD_IRONGATE; + printk("agpgart: Detected an AMD Irongate Chipset.\n"); + agp_bridge.amd_irongate_setup(); + return; + + default: + if (agp_try_unsupported != 0) { + printk("agpgart: Trying Amd irongate routines for device id: %x\n", dev->device); + agp_bridge.type = AMD_GENERIC; + agp_bridge.amd_irongate_setup(); + return; + } else { + printk("agpgart: Unsupported Amd chipset, you might want to try agp_try_unsupported=1.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + } + break; +#endif + +#ifdef AGP_BUILD_ALI_M1541 + case PCI_VENDOR_ID_AL: + switch (dev->device) { + case PCI_DEVICE_ID_AL_M1541_0: + agp_bridge.type = ALI_M1541; + printk("agpgart: Detected an ALi M1541 Chipset\n"); + agp_bridge.ali_generic_setup(); + return; + default: + if (agp_try_unsupported != 0) { + printk("agpgart: Trying ALi generic routines for device id: %x\n", dev->device); + agp_bridge.type = ALI_GENERIC; + agp_bridge.ali_generic_setup(); + return; + } else { + printk("agpgart: Unsupported ALi chipset, you might want to type agp_try_unsupported=1.\n"); + agp_bridge.type = NOT_SUPPORTED; + return; + } + } + break; +#endif + default: + agp_bridge.type = NOT_SUPPORTED; + return; + } +} + +struct agp_max_table { + int mem; + int agp; +}; + +static struct agp_max_table agp_maxes_table[9] = +{ + {0, 0}, + {32, 4}, + {64, 28}, + {128, 96}, + {256, 204}, + {512, 440}, + {1024, 942}, + {2048, 1920}, + {4096, 3932} +}; + +static int agp_find_max(void) +{ + int memory; + float t; + int index; + int result; + + memory = virt_to_phys(high_memory) / 0x100000; + index = 0; + + while ((memory > agp_maxes_table[index].mem) && + (index < 8)) { + index++; + } + + t = (memory - agp_maxes_table[index - 1].mem) / + (agp_maxes_table[index].mem - agp_maxes_table[index - 1].mem); + + result = agp_maxes_table[index - 1].agp + + (t * (agp_maxes_table[index].agp - agp_maxes_table[index - 1].agp)); + + printk("agpgart: Maximum main memory to use for agp memory: %dM\n", result); + result = (result * 0x100000) / 4096; + return result; +} + +#define AGPGART_VERSION_MAJOR 0 +#define AGPGART_VERSION_MINOR 99 + +static agp_version agp_current_version = +{ + AGPGART_VERSION_MAJOR, + AGPGART_VERSION_MINOR +}; + +static int agp_backend_initialize(void) +{ + int size_value; + + memset(&agp_bridge, 0, sizeof(struct agp_bridge_data)); + agp_bridge.type = NOT_SUPPORTED; +#ifdef AGP_BUILD_INTEL_GENERIC + agp_bridge.intel_generic_setup = intel_generic_setup; +#endif +#ifdef AGP_BUILD_INTEL_I810 + agp_bridge.intel_i810_setup = intel_i810_setup; +#endif +#ifdef AGP_BUILD_VIA_GENERIC + agp_bridge.via_generic_setup = via_generic_setup; +#endif +#ifdef AGP_BUILD_SIS_GENERIC + agp_bridge.sis_generic_setup = sis_generic_setup; +#endif +#ifdef AGP_BUILD_AMD_IRONGATE + agp_bridge.amd_irongate_setup = amd_irongate_setup; +#endif +#ifdef AGP_BUILD_ALI_M1541 + agp_bridge.ali_generic_setup = ali_generic_setup; +#endif + agp_bridge.max_memory_agp = agp_find_max(); + agp_bridge.version = &agp_current_version; + agp_find_supported_device(); + + if (agp_bridge.needs_scratch_page == TRUE) { + agp_bridge.scratch_page = (unsigned long) agp_alloc_page(); + + if ((void *) (agp_bridge.scratch_page) == NULL) { + printk("agpgart: unable to get memory for scratch page.\n"); + return -ENOMEM; + } + agp_bridge.scratch_page = virt_to_phys((void *) agp_bridge.scratch_page); + agp_bridge.scratch_page = agp_bridge.mask_memory(agp_bridge.scratch_page, 0); + } + if (agp_bridge.type == NOT_SUPPORTED) { + printk("agpgart: no supported devices found.\n"); + return -EINVAL; + } + size_value = agp_bridge.fetch_size(); + + if (size_value == 0) { + printk("agpgart: unable to detrimine aperture size.\n"); + return -EINVAL; + } + if (agp_bridge.create_gatt_table()) { + printk("agpgart: unable to get memory for graphics translation table.\n"); + return -ENOMEM; + } + agp_bridge.key_list = vmalloc(PAGE_SIZE * 4); + + if (agp_bridge.key_list == NULL) { + printk("agpgart: error allocating memory for key lists.\n"); + agp_bridge.free_gatt_table(); + return -ENOMEM; + } + memset(agp_bridge.key_list, 0, PAGE_SIZE * 4); + + if (agp_bridge.configure()) { + printk("agpgart: error configuring host chipset.\n"); + agp_bridge.free_gatt_table(); + vfree(agp_bridge.key_list); + return -EINVAL; + } + printk("agpgart: Physical address of the agp aperture: 0x%lx\n", agp_bridge.gart_bus_addr); + printk("agpgart: Agp aperture is %dM in size.\n", size_value); + return 0; +} + +static void agp_backend_cleanup(void) +{ + agp_bridge.cleanup(); + agp_bridge.free_gatt_table(); + vfree(agp_bridge.key_list); + + if (agp_bridge.needs_scratch_page == TRUE) { + agp_bridge.scratch_page &= ~(0x00000fff); + agp_destroy_page((void *) phys_to_virt(agp_bridge.scratch_page)); + } +} + +extern int agp_frontend_initialize(void); +extern void agp_frontend_cleanup(void); + +#ifdef MODULE +int init_module(void) +{ + int ret_val; + + printk("Linux agpgart interface v%d.%d (c) Jeff Hartmann\n", + AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR); + ret_val = agp_backend_initialize(); + + if (ret_val != 0) { + return ret_val; + } + ret_val = agp_frontend_initialize(); + + if (ret_val != 0) { + agp_backend_cleanup(); + return ret_val; + } + return 0; +} + +void cleanup_module(void) +{ + agp_frontend_cleanup(); + agp_backend_cleanup(); +} + +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/agp/agp_backendP.h linux/drivers/char/agp/agp_backendP.h --- v2.3.30/linux/drivers/char/agp/agp_backendP.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/agp/agp_backendP.h Tue Dec 7 16:22:34 1999 @@ -0,0 +1,244 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight + * Copyright (C) 1999 Xi Graphics + * + * 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 + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +#ifndef _AGP_BACKEND_PRIV_H +#define _AGP_BACKEND_PRIV_H 1 + +enum aper_size_type { + U8_APER_SIZE, + U16_APER_SIZE, + U32_APER_SIZE, + FIXED_APER_SIZE +}; + +typedef struct _gatt_mask { + unsigned long mask; + u32 type; + /* totally device specific, for integrated chipsets that + * might have different types of memory masks. For other + * devices this will probably be ignored */ +} gatt_mask; + +typedef struct _aper_size_info_8 { + int size; + int num_entries; + int page_order; + u8 size_value; +} aper_size_info_8; + +typedef struct _aper_size_info_16 { + int size; + int num_entries; + int page_order; + u16 size_value; +} aper_size_info_16; + +typedef struct _aper_size_info_32 { + int size; + int num_entries; + int page_order; + u32 size_value; +} aper_size_info_32; + +typedef struct _aper_size_info_fixed { + int size; + int num_entries; + int page_order; +} aper_size_info_fixed; + +struct agp_bridge_data { + agp_version *version; + void *aperture_sizes; + void *previous_size; + void *current_size; + void *dev_private_data; + struct pci_dev *dev; + gatt_mask *masks; + unsigned long *gatt_table; + unsigned long *gatt_table_real; + unsigned long scratch_page; + unsigned long gart_bus_addr; + unsigned long gatt_bus_addr; + u32 mode; + enum chipset_type type; + enum aper_size_type size_type; + u32 *key_list; + atomic_t current_memory_agp; + atomic_t agp_in_use; + int max_memory_agp; /* in number of pages */ + int needs_scratch_page; + int aperture_size_idx; + int num_aperture_sizes; + int num_of_masks; + int capndx; + + /* Links to driver specific functions */ + + int (*fetch_size) (void); /* returns the index into the size table */ + int (*configure) (void); + void (*agp_enable) (u32); + void (*cleanup) (void); + void (*tlb_flush) (agp_memory *); + unsigned long (*mask_memory) (unsigned long, int); + void (*cache_flush) (void); + int (*create_gatt_table) (void); + int (*free_gatt_table) (void); + int (*insert_memory) (agp_memory *, off_t, int); + int (*remove_memory) (agp_memory *, off_t, int); + agp_memory *(*alloc_by_type) (size_t, int); + void (*free_by_type) (agp_memory *); + + /* Links to vendor/device specific setup functions */ +#ifdef AGP_BUILD_INTEL_GENERIC + void (*intel_generic_setup) (void); +#endif +#ifdef AGP_BUILD_INTEL_I810 + void (*intel_i810_setup) (struct pci_dev *); +#endif +#ifdef AGP_BUILD_VIA_GENERIC + void (*via_generic_setup) (void); +#endif +#ifdef AGP_BUILD_SIS_GENERIC + void (*sis_generic_setup) (void); +#endif +#ifdef AGP_BUILD_AMD_IRONGATE + void (*amd_irongate_setup) (void); +#endif +#ifdef AGP_BUILD_ALI_M1541 + void (*ali_generic_setup) (void); +#endif +}; + +#define OUTREG32(mmap, addr, val) *(volatile u32 *)(mmap + (addr)) = (val) +#define OUTREG16(mmap, addr, val) *(volatile u16 *)(mmap + (addr)) = (val) +#define OUTREG8 (mmap, addr, val) *(volatile u8 *) (mmap + (addr)) = (val) + +#define INREG32(mmap, addr) *(volatile u32 *)(mmap + (addr)) +#define INREG16(mmap, addr) *(volatile u16 *)(mmap + (addr)) +#define INREG8 (mmap, addr) *(volatile u8 *) (mmap + (addr)) + +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#endif + +#define PGE_EMPTY(p) (!(p) || (p) == (unsigned long) agp_bridge.scratch_page) + +#ifndef PCI_DEVICE_ID_VIA_82C691_0 +#define PCI_DEVICE_ID_VIA_82C691_0 0x0691 +#endif +#ifndef PCI_DEVICE_ID_VIA_82C691_1 +#define PCI_DEVICE_ID_VIA_82C691_1 0x8691 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_0 +#define PCI_DEVICE_ID_INTEL_810_0 0x7120 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_DC100_0 +#define PCI_DEVICE_ID_INTEL_810_DC100_0 0x7122 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_E_0 +#define PCI_DEVICE_ID_INTEL_810_E_0 0x7124 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82443GX_0 +#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_1 +#define PCI_DEVICE_ID_INTEL_810_1 0x7121 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_DC100_1 +#define PCI_DEVICE_ID_INTEL_810_DC100_1 0x7123 +#endif +#ifndef PCI_DEVICE_ID_INTEL_810_E_1 +#define PCI_DEVICE_ID_INTEL_810_E_1 0x7125 +#endif +#ifndef PCI_DEVICE_ID_INTEL_82443GX_1 +#define PCI_DEVICE_ID_INTEL_82443GX_1 0x71a1 +#endif +#ifndef PCI_DEVICE_ID_AMD_IRONGATE_0 +#define PCI_DEVICE_ID_AMD_IRONGATE_0 0x7006 +#endif +#ifndef PCI_VENDOR_ID_AL +#define PCI_VENDOR_ID_AL 0x10b9 +#endif +#ifndef PCI_DEVICE_ID_AL_M1541_0 +#define PCI_DEVICE_ID_AL_M1541_0 0x1541 +#endif + +/* intel register */ +#define INTEL_APBASE 0x10 +#define INTEL_APSIZE 0xb4 +#define INTEL_ATTBASE 0xb8 +#define INTEL_AGPCTRL 0xb0 +#define INTEL_NBXCFG 0x50 +#define INTEL_ERRSTS 0x91 + +/* intel i810 registers */ +#define I810_GMADDR 0x10 +#define I810_MMADDR 0x14 +#define I810_PTE_BASE 0x10000 +#define I810_PTE_MAIN_UNCACHED 0x00000000 +#define I810_PTE_LOCAL 0x00000002 +#define I810_PTE_VALID 0x00000001 +#define I810_SMRAM_MISCC 0x70 +#define I810_GFX_MEM_WIN_SIZE 0x00010000 +#define I810_GFX_MEM_WIN_32M 0x00010000 +#define I810_GMS 0x000000c0 +#define I810_GMS_DISABLE 0x00000000 +#define I810_PGETBL_CTL 0x2020 +#define I810_PGETBL_ENABLED 0x00000001 +#define I810_DRAM_CTL 0x3000 +#define I810_DRAM_ROW_0 0x00000001 +#define I810_DRAM_ROW_0_SDRAM 0x00000001 + +/* VIA register */ +#define VIA_APBASE 0x10 +#define VIA_GARTCTRL 0x80 +#define VIA_APSIZE 0x84 +#define VIA_ATTBASE 0x88 + +/* SiS registers */ +#define SIS_APBASE 0x10 +#define SIS_ATTBASE 0x90 +#define SIS_APSIZE 0x94 +#define SIS_TLBCNTRL 0x97 +#define SIS_TLBFLUSH 0x98 + +/* AMD registers */ +#define AMD_APBASE 0x10 +#define AMD_MMBASE 0x14 +#define AMD_APSIZE 0xac +#define AMD_MODECNTL 0xb0 +#define AMD_GARTENABLE 0x02 /* In mmio region (16-bit register) */ +#define AMD_ATTBASE 0x04 /* In mmio region (32-bit register) */ +#define AMD_TLBFLUSH 0x0c /* In mmio region (32-bit register) */ +#define AMD_CACHEENTRY 0x10 /* In mmio region (32-bit register) */ + +/* ALi registers */ +#define ALI_APBASE 0x10 +#define ALI_AGPCTRL 0xb8 +#define ALI_ATTBASE 0xbc +#define ALI_TLBCTRL 0xc0 + +#endif /* _AGP_BACKEND_PRIV_H */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/agp/agpgart_fe.c linux/drivers/char/agp/agpgart_fe.c --- v2.3.30/linux/drivers/char/agp/agpgart_fe.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/agp/agpgart_fe.c Tue Dec 7 16:22:34 1999 @@ -0,0 +1,1087 @@ +/* + * AGPGART module frontend version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight + * Copyright (C) 1999 Xi Graphics + * + * 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 + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +#define __NO_VERSION__ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct agp_front_data agp_fe; + +static agp_memory *agp_find_mem_by_key(int key) +{ + agp_memory *curr; + + if (agp_fe.current_controller == NULL) { + return NULL; + } + curr = agp_fe.current_controller->pool; + + while (curr != NULL) { + if (curr->key == key) { + return curr; + } + curr = curr->next; + } + + return NULL; +} + +static void agp_remove_from_pool(agp_memory * temp) +{ + agp_memory *prev; + agp_memory *next; + + /* Check to see if this is even in the memory pool */ + + if (agp_find_mem_by_key(temp->key) != NULL) { + next = temp->next; + prev = temp->prev; + + if (prev != NULL) { + prev->next = next; + if (next != NULL) { + next->prev = prev; + } + } else { + /* This is the first item on the list */ + if (next != NULL) { + next->prev = NULL; + } + agp_fe.current_controller->pool = next; + } + } +} + +/* + * Routines for managing each client's segment list - + * These routines handle adding and removing segments + * to each auth'ed client. + */ + +static agp_segment_priv *agp_find_seg_in_client(const agp_client * client, + unsigned long offset, + int size, pgprot_t page_prot) +{ + agp_segment_priv *seg; + int num_segments, pg_start, pg_count, i; + + pg_start = offset / 4096; + pg_count = size / 4096; + seg = *(client->segments); + num_segments = client->num_segments; + + for (i = 0; i < client->num_segments; i++) { + if ((seg[i].pg_start == pg_start) && + (seg[i].pg_count == pg_count) && + (pgprot_val(seg[i].prot) == pgprot_val(page_prot))) { + return seg + i; + } + } + + return NULL; +} + +static void agp_remove_seg_from_client(agp_client * client) +{ + if (client->segments != NULL) { + if (*(client->segments) != NULL) { + kfree(*(client->segments)); + } + kfree(client->segments); + } +} + +static void agp_add_seg_to_client(agp_client * client, + agp_segment_priv ** seg, int num_segments) +{ + agp_segment_priv **prev_seg; + + prev_seg = client->segments; + + if (prev_seg != NULL) { + agp_remove_seg_from_client(client); + } + client->num_segments = num_segments; + client->segments = seg; +} + +/* Originally taken from linux/mm/mmap.c from the array + * protection_map. + * The original really should be exported to modules, or + * some routine which does the conversion for you + */ + +static const pgprot_t my_protect_map[16] = +{ + __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, + __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 +}; + +static pgprot_t agp_convert_mmap_flags(int prot) +{ +#define _trans(x,bit1,bit2) \ +((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0) + + unsigned long prot_bits; + pgprot_t temp; + + prot_bits = _trans(prot, PROT_READ, VM_READ) | + _trans(prot, PROT_WRITE, VM_WRITE) | + _trans(prot, PROT_EXEC, VM_EXEC); + + prot_bits |= VM_SHARED; + + temp = my_protect_map[prot_bits & 0x0000000f]; + + return temp; +} + +static int agp_create_segment(agp_client * client, agp_region * region) +{ + agp_segment_priv **ret_seg; + agp_segment_priv *seg; + agp_segment *user_seg; + int i; + + seg = kmalloc((sizeof(agp_segment_priv) * region->seg_count), GFP_KERNEL); + if (seg == NULL) { + kfree(region->seg_list); + return -ENOMEM; + } + memset(seg, 0, (sizeof(agp_segment_priv) * region->seg_count)); + user_seg = region->seg_list; + + for (i = 0; i < region->seg_count; i++) { + seg[i].pg_start = user_seg[i].pg_start; + seg[i].pg_count = user_seg[i].pg_count; + seg[i].prot = agp_convert_mmap_flags(user_seg[i].prot); + } + ret_seg = kmalloc(sizeof(void *), GFP_KERNEL); + if (ret_seg == NULL) { + kfree(region->seg_list); + kfree(seg); + return -ENOMEM; + } + *ret_seg = seg; + kfree(region->seg_list); + agp_add_seg_to_client(client, ret_seg, region->seg_count); + return 0; +} + +/* End - Routines for managing each client's segment list */ + +/* This function must only be called when current_controller != NULL */ +static void agp_insert_into_pool(agp_memory * temp) +{ + agp_memory *prev; + + prev = agp_fe.current_controller->pool; + + if (prev != NULL) { + prev->prev = temp; + temp->next = prev; + } + agp_fe.current_controller->pool = temp; +} + + +/* File private list routines */ + +agp_file_private *agp_find_private(pid_t pid) +{ + agp_file_private *curr; + + curr = agp_fe.file_priv_list; + + while (curr != NULL) { + if (curr->my_pid == pid) { + return curr; + } + curr = curr->next; + } + + return NULL; +} + +void agp_insert_file_private(agp_file_private * priv) +{ + agp_file_private *prev; + + prev = agp_fe.file_priv_list; + + if (prev != NULL) { + prev->prev = priv; + } + priv->next = prev; + agp_fe.file_priv_list = priv; +} + +void agp_remove_file_private(agp_file_private * priv) +{ + agp_file_private *next; + agp_file_private *prev; + + next = priv->next; + prev = priv->prev; + + if (prev != NULL) { + prev->next = next; + + if (next != NULL) { + next->prev = prev; + } + } else { + if (next != NULL) { + next->prev = NULL; + } + agp_fe.file_priv_list = next; + } +} + +/* End - File flag list routines */ + +/* + * Wrappers for agp_free_memory & agp_allocate_memory + * These make sure that internal lists are kept updated. + */ +static void agp_free_memory_wrap(agp_memory * memory) +{ + agp_remove_from_pool(memory); + agp_free_memory(memory); +} + +static agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type) +{ + agp_memory *memory; + + memory = agp_allocate_memory(pg_count, type); + + if (memory == NULL) { + return NULL; + } + agp_insert_into_pool(memory); + return memory; +} + +/* Routines for managing the list of controllers - + * These routines manage the current controller, and the list of + * controllers + */ + +static agp_controller *agp_find_controller_by_pid(pid_t id) +{ + agp_controller *controller; + + controller = agp_fe.controllers; + + while (controller != NULL) { + if (controller->pid == id) { + return controller; + } + controller = controller->next; + } + + return NULL; +} + +static agp_controller *agp_create_controller(pid_t id) +{ + agp_controller *controller; + + controller = kmalloc(sizeof(agp_controller), GFP_KERNEL); + + if (controller == NULL) { + return NULL; + } + memset(controller, 0, sizeof(agp_controller)); + controller->pid = id; + + return controller; +} + +static int agp_insert_controller(agp_controller * controller) +{ + agp_controller *prev_controller; + + prev_controller = agp_fe.controllers; + controller->next = prev_controller; + + if (prev_controller != NULL) { + prev_controller->prev = controller; + } + agp_fe.controllers = controller; + + return 0; +} + +static void agp_remove_all_clients(agp_controller * controller) +{ + agp_client *client; + agp_client *temp; + + client = controller->clients; + + while (client) { + agp_file_private *priv; + + temp = client; + agp_remove_seg_from_client(temp); + priv = agp_find_private(temp->pid); + + if (priv != NULL) { + clear_bit(AGP_FF_IS_VALID, &(priv->access_flags)); + clear_bit(AGP_FF_IS_CLIENT, &(priv->access_flags)); + } + client = client->next; + kfree(temp); + } +} + +static void agp_remove_all_memory(agp_controller * controller) +{ + agp_memory *memory; + agp_memory *temp; + + memory = controller->pool; + + while (memory) { + temp = memory; + memory = memory->next; + agp_free_memory_wrap(temp); + } +} + +static int agp_remove_controller(agp_controller * controller) +{ + agp_controller *prev_controller; + agp_controller *next_controller; + + prev_controller = controller->prev; + next_controller = controller->next; + + if (prev_controller != NULL) { + prev_controller->next = next_controller; + if (next_controller != NULL) { + next_controller->prev = prev_controller; + } + } else { + if (next_controller != NULL) { + next_controller->prev = NULL; + } + agp_fe.controllers = next_controller; + } + + agp_remove_all_memory(controller); + agp_remove_all_clients(controller); + + if (agp_fe.current_controller == controller) { + agp_fe.current_controller = NULL; + agp_fe.backend_acquired = FALSE; + agp_backend_release(); + } + kfree(controller); + return 0; +} + +static void agp_controller_make_current(agp_controller * controller) +{ + agp_client *clients; + + clients = controller->clients; + + while (clients != NULL) { + agp_file_private *priv; + + priv = agp_find_private(clients->pid); + + if (priv != NULL) { + set_bit(AGP_FF_IS_VALID, &(priv->access_flags)); + set_bit(AGP_FF_IS_CLIENT, &(priv->access_flags)); + } + clients = clients->next; + } + + agp_fe.current_controller = controller; +} + +static void agp_controller_release_current(agp_controller * controller, + agp_file_private * controller_priv) +{ + agp_client *clients; + + clear_bit(AGP_FF_IS_VALID, &(controller_priv->access_flags)); + clients = controller->clients; + + while (clients != NULL) { + agp_file_private *priv; + + priv = agp_find_private(clients->pid); + + if (priv != NULL) { + clear_bit(AGP_FF_IS_VALID, &(priv->access_flags)); + } + clients = clients->next; + } + + agp_fe.current_controller = NULL; + agp_fe.used_by_controller = FALSE; + agp_backend_release(); +} + +/* + * Routines for managing client lists - + * These routines are for managing the list of auth'ed clients. + */ + +static agp_client *agp_find_client_in_controller(agp_controller * controller, + pid_t id) +{ + agp_client *client; + + if (controller == NULL) { + return NULL; + } + client = controller->clients; + + while (client != NULL) { + if (client->pid == id) { + return client; + } + client = client->next; + } + + return NULL; +} + +static agp_controller *agp_find_controller_for_client(pid_t id) +{ + agp_controller *controller; + + controller = agp_fe.controllers; + + while (controller != NULL) { + if ((agp_find_client_in_controller(controller, id)) != NULL) { + return controller; + } + controller = controller->next; + } + + return NULL; +} + +static agp_client *agp_find_client_by_pid(pid_t id) +{ + agp_client *temp; + + if (agp_fe.current_controller == NULL) { + return NULL; + } + temp = agp_find_client_in_controller(agp_fe.current_controller, id); + return temp; +} + +static void agp_insert_client(agp_client * client) +{ + agp_client *prev_client; + + prev_client = agp_fe.current_controller->clients; + client->next = prev_client; + + if (prev_client != NULL) { + prev_client->prev = client; + } + agp_fe.current_controller->clients = client; + agp_fe.current_controller->num_clients++; +} + +static agp_client *agp_create_client(pid_t id) +{ + agp_client *new_client; + + new_client = kmalloc(sizeof(agp_client), GFP_KERNEL); + + if (new_client == NULL) { + return NULL; + } + memset(new_client, 0, sizeof(agp_client)); + new_client->pid = id; + agp_insert_client(new_client); + return new_client; +} + +static int agp_remove_client(pid_t id) +{ + agp_client *client; + agp_client *prev_client; + agp_client *next_client; + agp_controller *controller; + + controller = agp_find_controller_for_client(id); + + if (controller == NULL) { + return -EINVAL; + } + client = agp_find_client_in_controller(controller, id); + + if (client == NULL) { + return -EINVAL; + } + prev_client = client->prev; + next_client = client->next; + + if (prev_client != NULL) { + prev_client->next = next_client; + if (next_client != NULL) { + next_client->prev = prev_client; + } + } else { + if (next_client != NULL) { + next_client->prev = NULL; + } + controller->clients = next_client; + } + + controller->num_clients--; + agp_remove_seg_from_client(client); + kfree(client); + return 0; +} + +/* End - Routines for managing client lists */ + +/* File Operations */ + +static int agp_mmap(struct file *file, struct vm_area_struct *vma) +{ + int size; + int current_size; + unsigned long offset; + agp_client *client; + agp_file_private *priv = (agp_file_private *) file->private_data; + agp_kern_info kerninfo; + + AGP_LOCK(); + + if (agp_fe.backend_acquired != TRUE) { + AGP_UNLOCK(); + return -EPERM; + } + if (!(test_bit(AGP_FF_IS_VALID, &(priv->access_flags)))) { + AGP_UNLOCK(); + return -EPERM; + } + agp_copy_info(&kerninfo); + size = vma->vm_end - vma->vm_start; + current_size = kerninfo.aper_size; + current_size = current_size * 0x100000; + offset = vma->vm_pgoff << PAGE_SHIFT; + + if (test_bit(AGP_FF_IS_CLIENT, &(priv->access_flags))) { + if ((size + offset) > current_size) { + AGP_UNLOCK(); + return -EINVAL; + } + client = agp_find_client_by_pid(current->pid); + + if (client == NULL) { + AGP_UNLOCK(); + return -EPERM; + } + if (!agp_find_seg_in_client(client, offset, size, vma->vm_page_prot)) { + AGP_UNLOCK(); + return -EINVAL; + } + if (remap_page_range(vma->vm_start, (kerninfo.aper_base + offset), + size, vma->vm_page_prot)) { + AGP_UNLOCK(); + return -EAGAIN; + } + AGP_UNLOCK(); + return 0; + } + if (test_bit(AGP_FF_IS_CONTROLLER, &(priv->access_flags))) { + if (size != current_size) { + AGP_UNLOCK(); + return -EINVAL; + } + if (remap_page_range(vma->vm_start, kerninfo.aper_base, + size, vma->vm_page_prot)) { + AGP_UNLOCK(); + return -EAGAIN; + } + AGP_UNLOCK(); + return 0; + } + AGP_UNLOCK(); + return -EPERM; +} + +static int agp_release(struct inode *inode, struct file *file) +{ + agp_file_private *priv = (agp_file_private *) file->private_data; + + AGP_LOCK(); + + if (test_bit(AGP_FF_IS_CONTROLLER, &(priv->access_flags))) { + agp_controller *controller; + + controller = agp_find_controller_by_pid(priv->my_pid); + + if (controller != NULL) { + if (controller == agp_fe.current_controller) { + agp_controller_release_current(controller, priv); + } + agp_remove_controller(controller); + } + } + if (test_bit(AGP_FF_IS_CLIENT, &(priv->access_flags))) { + agp_remove_client(priv->my_pid); + } + agp_remove_file_private(priv); + kfree(priv); + MOD_DEC_USE_COUNT; + AGP_UNLOCK(); + return 0; +} + +static int agp_open(struct inode *inode, struct file *file) +{ + int minor = MINOR(inode->i_rdev); + agp_file_private *priv; + agp_client *client; + + AGP_LOCK(); + + if (minor != AGPGART_MINOR) { + AGP_UNLOCK(); + return -ENXIO; + } + priv = kmalloc(sizeof(agp_file_private), GFP_KERNEL); + + if (priv == NULL) { + AGP_UNLOCK(); + return -ENOMEM; + } + memset(priv, 0, sizeof(agp_file_private)); + set_bit(AGP_FF_ALLOW_CLIENT, &(priv->access_flags)); + priv->my_pid = current->pid; + + if ((current->uid == 0) || (current->suid == 0)) { + /* Root priv, can be controller */ + set_bit(AGP_FF_ALLOW_CONTROLLER, &(priv->access_flags)); + } + client = agp_find_client_by_pid(current->pid); + + if (client != NULL) { + set_bit(AGP_FF_IS_CLIENT, &(priv->access_flags)); + set_bit(AGP_FF_IS_VALID, &(priv->access_flags)); + } + file->private_data = (void *) priv; + agp_insert_file_private(priv); + MOD_INC_USE_COUNT; + AGP_UNLOCK(); + return 0; +} + + +static long long agp_lseek(struct file *file, long long offset, int origin) +{ + return -ESPIPE; +} + +static ssize_t agp_read(struct file *file, char *buf, + size_t count, loff_t * ppos) +{ + return -EINVAL; +} + +static ssize_t agp_write(struct file *file, const char *buf, + size_t count, loff_t * ppos) +{ + return -EINVAL; +} + +static int agpioc_info_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_info userinfo; + agp_kern_info kerninfo; + + agp_copy_info(&kerninfo); + + userinfo.version.major = kerninfo.version.major; + userinfo.version.minor = kerninfo.version.minor; + userinfo.bridge_id = kerninfo.device->vendor | (kerninfo.device->device << 16); + userinfo.agp_mode = kerninfo.mode; + userinfo.aper_base = kerninfo.aper_base; + userinfo.aper_size = kerninfo.aper_size; + userinfo.pg_total = userinfo.pg_system = kerninfo.max_memory; + userinfo.pg_used = kerninfo.current_memory; + + if (copy_to_user((void *) arg, &userinfo, sizeof(agp_info))) { + return -EFAULT; + } + return 0; +} + +static int agpioc_acquire_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_controller *controller; + if (!(test_bit(AGP_FF_ALLOW_CONTROLLER, &(priv->access_flags)))) { + return -EPERM; + } + if (agp_fe.current_controller != NULL) { + return -EBUSY; + } + if ((agp_backend_acquire()) == 0) { + agp_fe.backend_acquired = TRUE; + } else { + return -EBUSY; + } + + controller = agp_find_controller_by_pid(priv->my_pid); + + if (controller != NULL) { + agp_controller_make_current(controller); + } else { + controller = agp_create_controller(priv->my_pid); + + if (controller == NULL) { + agp_fe.backend_acquired = FALSE; + agp_backend_release(); + return -ENOMEM; + } + agp_insert_controller(controller); + agp_controller_make_current(controller); + } + + set_bit(AGP_FF_IS_CONTROLLER, &(priv->access_flags)); + set_bit(AGP_FF_IS_VALID, &(priv->access_flags)); + return 0; +} + +static int agpioc_release_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_controller_release_current(agp_fe.current_controller, priv); + return 0; +} + +static int agpioc_setup_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_setup mode; + + if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup))) { + return -EFAULT; + } + agp_enable(mode.agp_mode); + return 0; +} + +static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_region reserve; + agp_client *client; + agp_file_private *client_priv; + + + if (copy_from_user(&reserve, (void *) arg, sizeof(agp_region))) { + return -EFAULT; + } + client = agp_find_client_by_pid(reserve.pid); + + if (reserve.seg_count == 0) { + /* remove a client */ + client_priv = agp_find_private(reserve.pid); + + if (client_priv != NULL) { + set_bit(AGP_FF_IS_CLIENT, &(client_priv->access_flags)); + set_bit(AGP_FF_IS_VALID, &(client_priv->access_flags)); + } + if (client == NULL) { + /* client is already removed */ + return 0; + } + return agp_remove_client(reserve.pid); + } else { + agp_segment *segment; + + segment = kmalloc((sizeof(agp_segment) * reserve.seg_count), GFP_KERNEL); + + if (segment == NULL) { + return -ENOMEM; + } + if (copy_from_user(segment, (void *) reserve.seg_list, GFP_KERNEL)) { + kfree(segment); + return -EFAULT; + } + reserve.seg_list = segment; + + if (client == NULL) { + /* Create the client and add the segment */ + client = agp_create_client(reserve.pid); + + if (client == NULL) { + kfree(segment); + return -ENOMEM; + } + client_priv = agp_find_private(reserve.pid); + + if (client_priv != NULL) { + set_bit(AGP_FF_IS_CLIENT, &(client_priv->access_flags)); + set_bit(AGP_FF_IS_VALID, &(client_priv->access_flags)); + } + return agp_create_segment(client, &reserve); + } else { + return agp_create_segment(client, &reserve); + } + } + /* Will never really happen */ + return -EINVAL; +} + +static int agpioc_protect_wrap(agp_file_private * priv, unsigned long arg) +{ + /* This function is not currently implemented */ + return -EINVAL; +} + +static int agpioc_allocate_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_memory *memory; + agp_allocate alloc; + + if (copy_from_user(&alloc, (void *) arg, sizeof(agp_allocate))) { + return -EFAULT; + } + memory = agp_allocate_memory_wrap(alloc.pg_count, alloc.type); + + if (memory == NULL) { + return -ENOMEM; + } + alloc.key = memory->key; + + if (copy_to_user((void *) arg, &alloc, sizeof(agp_allocate))) { + agp_free_memory_wrap(memory); + return -EFAULT; + } + return 0; +} + +static int agpioc_deallocate_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_memory *memory; + + memory = agp_find_mem_by_key((int) arg); + + if (memory == NULL) { + return -EINVAL; + } + agp_free_memory_wrap(memory); + return 0; +} + +static int agpioc_bind_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_bind bind_info; + agp_memory *memory; + + if (copy_from_user(&bind_info, (void *) arg, sizeof(agp_bind))) { + return -EFAULT; + } + memory = agp_find_mem_by_key(bind_info.key); + + if (memory == NULL) { + return -EINVAL; + } + return agp_bind_memory(memory, bind_info.pg_start); +} + +static int agpioc_unbind_wrap(agp_file_private * priv, unsigned long arg) +{ + agp_memory *memory; + agp_unbind unbind; + + if (copy_from_user(&unbind, (void *) arg, sizeof(agp_unbind))) { + return -EFAULT; + } + memory = agp_find_mem_by_key(unbind.key); + + if (memory == NULL) { + return -EINVAL; + } + return agp_unbind_memory(memory); +} + +static int agp_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + agp_file_private *curr_priv = (agp_file_private *) file->private_data; + int ret_val; + + AGP_LOCK(); + + if ((agp_fe.current_controller == NULL) && + (cmd != AGPIOC_ACQUIRE)) { + return -EINVAL; + } + if ((agp_fe.backend_acquired != TRUE) && + (cmd != AGPIOC_ACQUIRE)) { + return -EBUSY; + } + if (cmd != AGPIOC_ACQUIRE) { + if (!(test_bit(AGP_FF_IS_CONTROLLER, &(curr_priv->access_flags)))) { + return -EPERM; + } + /* Use the original pid of the controller, in case it's threaded */ + + if (agp_fe.current_controller->pid != curr_priv->my_pid) { + return -EBUSY; + } + } + switch (cmd) { + case AGPIOC_INFO: + { + ret_val = agpioc_info_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_ACQUIRE: + { + ret_val = agpioc_acquire_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_RELEASE: + { + ret_val = agpioc_release_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_SETUP: + { + ret_val = agpioc_setup_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_RESERVE: + { + ret_val = agpioc_reserve_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_PROTECT: + { + ret_val = agpioc_protect_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_ALLOCATE: + { + ret_val = agpioc_allocate_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_DEALLOCATE: + { + ret_val = agpioc_deallocate_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_BIND: + { + ret_val = agpioc_bind_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + case AGPIOC_UNBIND: + { + ret_val = agpioc_unbind_wrap(curr_priv, arg); + AGP_UNLOCK(); + return ret_val; + } + } + + AGP_UNLOCK(); + return -ENOTTY; +} + +static struct file_operations agp_fops = +{ + agp_lseek, + agp_read, + agp_write, + NULL, + NULL, + agp_ioctl, + agp_mmap, + agp_open, + NULL, + agp_release +}; + +static struct miscdevice agp_miscdev = +{ + AGPGART_MINOR, + "agpgart", + &agp_fops +}; + +int agp_frontend_initialize(void) +{ + memset(&agp_fe, 0, sizeof(struct agp_front_data)); + AGP_LOCK_INIT(); + + if (misc_register(&agp_miscdev)) { + printk("agpgart: unable to get minor: %d\n", AGPGART_MINOR); + return -EIO; + } + return 0; +} + +void agp_frontend_cleanup(void) +{ + return; +} diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/Makefile linux/drivers/char/drm/Makefile --- v2.3.30/linux/drivers/char/drm/Makefile Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/Makefile Tue Dec 7 14:25:35 1999 @@ -11,17 +11,33 @@ # L_TARGET := libdrm.a +O_TARGET := drm.o L_OBJS := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ lists.o lock.o ioctl.o fops.o vm.o dma.o M_OBJS := -ifdef CONFIG_DRM_GAMMA -M_OBJS += gamma.o +ifeq ($(CONFIG_DRM_GAMMA),y) + O_OBJS += gamma.o +else + ifeq ($(CONFIG_DRM_GAMMA),m) + M_OBJS += gamma.o + endif +endif + +ifeq ($(CONFIG_DRM_TDFX),y) + O_OBJS += tdfx.o +else + ifeq ($(CONFIG_DRM_TDFX),m) + M_OBJS += tdfx.o + endif endif include $(TOPDIR)/Rules.make gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET) $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o -L. -ldrm + +tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET) + $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/README.drm linux/drivers/char/drm/README.drm --- v2.3.30/linux/drivers/char/drm/README.drm Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/README.drm Tue Dec 7 13:59:01 1999 @@ -37,3 +37,5 @@ http://precisioninsight.com/dr/security.html + +$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/auth.c linux/drivers/char/drm/auth.c --- v2.3.30/linux/drivers/char/drm/auth.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/auth.c Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/auth.c,v 1.4 1999/08/30 13:05:00 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gen_ioctl.c,v 1.2 1999/06/27 14:08:27 dawes Exp $ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.4 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.1 1999/09/25 14:37:57 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/bufs.c linux/drivers/char/drm/bufs.c --- v2.3.30/linux/drivers/char/drm/bufs.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/char/drm/bufs.c Tue Dec 7 23:58:21 1999 @@ -1,6 +1,6 @@ /* bufs.c -- IOCTLs to manage buffers -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 22:48:10 1999 by faith@precisioninsight.com + * Revised: Fri Dec 3 12:11:11 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.1 1999/09/25 14:37:57 dawes Exp $ * */ @@ -90,10 +90,11 @@ case _DRM_SHM: - DRM_DEBUG("%ld %d\n", map->size, drm_order(map->size)); map->handle = (void *)drm_alloc_pages(drm_order(map->size) - PAGE_SHIFT, DRM_MEM_SAREA); + DRM_DEBUG("%ld %d %p\n", map->size, drm_order(map->size), + map->handle); if (!map->handle) { drm_free(map, sizeof(*map), DRM_MEM_MAPS); return -ENOMEM; diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/context.c linux/drivers/char/drm/context.c --- v2.3.30/linux/drivers/char/drm/context.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/context.c Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/context.c,v 1.5 1999/08/30 13:05:00 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gen_ioctl.c,v 1.2 1999/06/27 14:08:27 dawes Exp $ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.5 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.1 1999/09/25 14:37:58 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/dma.c linux/drivers/char/drm/dma.c --- v2.3.30/linux/drivers/char/drm/dma.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/dma.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* dma.c -- DMA IOCTL and function support -*- linux-c -*- * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 13:06:51 1999 by faith@precisioninsight.com + * Revised: Thu Sep 16 12:55:39 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/dma.c,v 1.6 1999/08/20 20:00:53 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.7 1999/09/16 16:56:18 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.1 1999/09/25 14:37:58 dawes Exp $ * */ @@ -176,6 +176,7 @@ drm_device_dma_t *dma = dev->dma; int i; + if (!dma) return; for (i = 0; i < dma->buf_count; i++) { if (dma->buflist[i]->pid == pid) { switch (dma->buflist[i]->list) { diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/drawable.c linux/drivers/char/drm/drawable.c --- v2.3.30/linux/drivers/char/drm/drawable.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/drawable.c Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drawable.c,v 1.3 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.3 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.1 1999/09/25 14:37:58 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/drm.h linux/drivers/char/drm/drm.h --- v2.3.30/linux/drivers/char/drm/drm.h Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/drm.h Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 13:08:18 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -24,9 +24,12 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drm.h,v 1.2 1999/06/27 14:08:21 dawes Exp $ - * + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $ + * + * Acknowledgements: + * Dec 1999, Richard Henderson , move to generic cmpxchg. + * */ #ifndef _DRM_H_ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/drmP.h linux/drivers/char/drm/drmP.h --- v2.3.30/linux/drivers/char/drm/drmP.h Thu Nov 18 20:25:37 1999 +++ linux/drivers/char/drm/drmP.h Tue Dec 7 23:58:21 1999 @@ -1,6 +1,6 @@ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 16:06:49 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.2 1999/06/27 14:08:24 dawes Exp $ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.1 1999/09/25 14:37:59 dawes Exp $ * */ @@ -84,33 +84,77 @@ #define DRM_MEM_BUFLISTS 14 /* Backward compatibility section */ + /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */ #ifndef _PAGE_PWT - /* The name of _PAGE_WT was changed to - _PAGE_PWT in Linux 2.2.6 */ #define _PAGE_PWT _PAGE_WT #endif - /* Wait queue declarations changes in 2.3.1 */ + /* Wait queue declarations changed in 2.3.1 */ #ifndef DECLARE_WAITQUEUE #define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL } typedef struct wait_queue *wait_queue_head_t; #define init_waitqueue_head(q) *q = NULL; #endif -#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) -#define _DRM_CAS(lock,old,new,__ret) \ - do { \ - int __dummy; /* Can't mark eax as clobbered */ \ - __asm__ __volatile__( \ - "lock ; cmpxchg %4,%1\n\t" \ - "setnz %0" \ - : "=d" (__ret), \ - "=m" (__drm_dummy_lock(lock)), \ - "=a" (__dummy) \ - : "2" (old), \ - "r" (new)); \ - } while (0) + /* _PAGE_4M changed to _PAGE_PSE in 2.3.23 */ +#ifndef _PAGE_PSE +#define _PAGE_PSE _PAGE_4M +#endif + + /* vm_offset changed to vm_pgoff in 2.3.25 */ +#if LINUX_VERSION_CODE < 0x020319 +#define VM_OFFSET(vma) ((vma)->vm_offset) +#else +#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) +#endif + /* *_nopage return values defined in 2.3.26 */ +#ifndef NOPAGE_SIGBUS +#define NOPAGE_SIGBUS 0 +#endif +#ifndef NOPAGE_OOM +#define NOPAGE_OOM 0 +#endif + /* Generic cmpxchg added in 2.3.x */ +#if CPU != 386 +#ifndef __HAVE_ARCH_CMPXCHG + /* Include this here so that driver can be + used with older kernels. */ +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long prev; + switch (size) { + case 1: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + } + return old; +} + +#define cmpxchg(ptr,o,n) \ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \ + (unsigned long)(n),sizeof(*(ptr)))) +#endif +#else + /* Compiling for a 386 proper... */ +#error DRI not supported on Intel 80386 +#endif /* Macros to make printk easier */ #define DRM_ERROR(fmt, arg...) \ @@ -437,6 +481,7 @@ extern int drm_write_string(drm_device_t *dev, const char *s); /* Mapping support (vm.c) */ +#if LINUX_VERSION_CODE < 0x020317 extern unsigned long drm_vm_nopage(struct vm_area_struct *vma, unsigned long address, int write_access); @@ -446,6 +491,18 @@ extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access); +#else + /* Return type changed in 2.3.23 */ +extern struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access); +#endif extern void drm_vm_open(struct vm_area_struct *vma); extern void drm_vm_close(struct vm_area_struct *vma); extern int drm_mmap_dma(struct file *filp, @@ -570,7 +627,8 @@ unsigned int cmd, unsigned long arg); extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); -extern int drm_lock_transfer(__volatile__ unsigned int *lock, +extern int drm_lock_transfer(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context); extern int drm_lock_free(drm_device_t *dev, __volatile__ unsigned int *lock, diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/fops.c linux/drivers/char/drm/fops.c --- v2.3.30/linux/drivers/char/drm/fops.c Mon Oct 11 15:38:14 1999 +++ linux/drivers/char/drm/fops.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* fops.c -- File operations for DRM -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:46 1999 by faith@precisioninsight.com + * Revised: Fri Dec 3 10:26:26 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.1 1999/09/25 14:37:59 dawes Exp $ * */ @@ -75,8 +75,8 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d, f_count = %d\n", - current->pid, dev->device, dev->open_count, atomic_read(&filp->f_count)); + DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", + current->pid, dev->device, dev->open_count); return 0; } @@ -91,6 +91,20 @@ DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", current->pid, dev->device, dev->open_count); + if (_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) + && dev->lock.pid == current->pid) { + DRM_ERROR("Process %d dead, freeing lock for context %d\n", + current->pid, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); + drm_lock_free(dev, + &dev->lock.hw_lock->lock, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); + + /* FIXME: may require heavy-handed reset of + hardware at this point, possibly + processed via a callback to the X + server. */ + } drm_reclaim_buffers(dev, priv->pid); drm_fasync(-1, filp, 0); @@ -197,7 +211,12 @@ send -= count; } - if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_OUT); +#if LINUX_VERSION_CODE < 0x020315 + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO); +#else + /* Parameter added in 2.3.21 */ + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN); +#endif DRM_DEBUG("waking\n"); wake_up_interruptible(&dev->buf_readers); return 0; diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/gamma_dma.c linux/drivers/char/drm/gamma_dma.c --- v2.3.30/linux/drivers/char/drm/gamma_dma.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/gamma_dma.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*- * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:45 1999 by faith@precisioninsight.com + * Revised: Thu Sep 16 12:55:37 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_dma.c,v 1.8 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.9 1999/09/16 16:56:18 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.1 1999/09/25 14:38:00 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/gamma_drv.c linux/drivers/char/drm/gamma_drv.c --- v2.3.30/linux/drivers/char/drm/gamma_drv.c Thu Nov 18 20:25:37 1999 +++ linux/drivers/char/drm/gamma_drv.c Tue Dec 7 23:58:21 1999 @@ -1,6 +1,6 @@ /* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 22:48:11 1999 by faith@precisioninsight.com + * Revised: Tue Oct 12 08:51:36 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.1 1999/09/25 14:38:00 dawes Exp $ * */ @@ -509,7 +509,7 @@ atomic_inc(&dev->total_unlocks); if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) atomic_inc(&dev->total_contends); - drm_lock_transfer(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); + drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); gamma_dma_schedule(dev, 1); if (!dev->context_flag) { if (drm_lock_free(dev, &dev->lock.hw_lock->lock, diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/gamma_drv.h linux/drivers/char/drm/gamma_drv.h --- v2.3.30/linux/drivers/char/drm/gamma_drv.h Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/gamma_drv.h Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.1 1999/09/25 14:38:00 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/init.c linux/drivers/char/drm/init.c --- v2.3.30/linux/drivers/char/drm/init.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/init.c Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/init.c,v 1.3 1999/08/20 15:07:01 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.3 1999/08/20 15:07:01 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.1 1999/09/25 14:38:01 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/ioctl.c linux/drivers/char/drm/ioctl.c --- v2.3.30/linux/drivers/char/drm/ioctl.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/ioctl.c Tue Dec 7 13:59:01 1999 @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/ioctl.c,v 1.3 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.3 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.1 1999/09/25 14:38:01 dawes Exp $ * */ diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/lists.c linux/drivers/char/drm/lists.c --- v2.3.30/linux/drivers/char/drm/lists.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/lists.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* lists.c -- Buffer list handling routines -*- linux-c -*- * Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:27:01 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.1 1999/09/25 14:38:01 dawes Exp $ * */ @@ -130,11 +130,9 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) { - unsigned int old; - unsigned int new; - char failed; + drm_buf_t *old, *prev; int count = 0; - drm_device_dma_t *dma = dev->dma; + drm_device_dma_t *dma = dev->dma; if (!dma) { DRM_ERROR("No DMA support\n"); @@ -155,15 +153,14 @@ #endif buf->list = DRM_LIST_FREE; do { - old = (unsigned long)bl->next; - buf->next = (void *)old; - new = (unsigned long)buf; - _DRM_CAS(&bl->next, old, new, failed); + old = bl->next; + bl->next = old; + prev = cmpxchg(&bl->next, old, buf); if (++count > DRM_LOOPING_LIMIT) { DRM_ERROR("Looping\n"); return 1; } - } while (failed); + } while (prev != old); atomic_inc(&bl->count); if (atomic_read(&bl->count) > dma->buf_count) { DRM_ERROR("%d of %d buffers free after addition of %d\n", @@ -180,9 +177,7 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl) { - unsigned int old; - unsigned int new; - char failed; + drm_buf_t *old, *new, *prev; drm_buf_t *buf; int count = 0; @@ -190,20 +185,18 @@ /* Get buffer */ do { - old = (unsigned int)bl->next; - if (!old) { - return NULL; - } - new = (unsigned long)bl->next->next; - _DRM_CAS(&bl->next, old, new, failed); + old = bl->next; + if (!old) return NULL; + new = bl->next->next; + prev = cmpxchg(&bl->next, old, new); if (++count > DRM_LOOPING_LIMIT) { DRM_ERROR("Looping\n"); return NULL; } - } while (failed); + } while (prev != old); atomic_dec(&bl->count); - buf = (drm_buf_t *)old; + buf = old; buf->next = NULL; buf->list = DRM_LIST_NONE; DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n", diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/lock.c linux/drivers/char/drm/lock.c --- v2.3.30/linux/drivers/char/drm/lock.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/lock.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* lock.c -- IOCTLs for locking -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:27:01 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 16:04:44 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.1 1999/09/25 14:38:01 dawes Exp $ * */ @@ -48,17 +48,15 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) { - unsigned int old; - unsigned int new; - char failed; + unsigned int old, new, prev; DRM_DEBUG("%d attempts\n", context); do { old = *lock; if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; else new = context | _DRM_LOCK_HELD; - _DRM_CAS(lock, old, new, failed); - } while (failed); + prev = cmpxchg(lock, old, new); + } while (prev != old); if (_DRM_LOCKING_CONTEXT(old) == context) { if (old & _DRM_LOCK_HELD) { if (context != DRM_KERNEL_CONTEXT) { @@ -80,17 +78,17 @@ /* This takes a lock forcibly and hands it to context. Should ONLY be used inside *_unlock to give lock to kernel before calling *_dma_schedule. */ -int drm_lock_transfer(__volatile__ unsigned int *lock, unsigned int context) +int drm_lock_transfer(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) { - unsigned int old; - unsigned int new; - char failed; + unsigned int old, new, prev; + dev->lock.pid = 0; do { - old = *lock; - new = context | _DRM_LOCK_HELD; - _DRM_CAS(lock, old, new, failed); - } while (failed); + old = *lock; + new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); DRM_DEBUG("%d => %d\n", _DRM_LOCKING_CONTEXT(old), context); return 1; } @@ -98,23 +96,23 @@ int drm_lock_free(drm_device_t *dev, __volatile__ unsigned int *lock, unsigned int context) { - unsigned int old; - unsigned int new; - char failed; + unsigned int old, new, prev; + pid_t pid = dev->lock.pid; DRM_DEBUG("%d\n", context); + dev->lock.pid = 0; do { - old = *lock; - new = 0; - _DRM_CAS(lock, old, new, failed); - } while (failed); + old = *lock; + new = 0; + prev = cmpxchg(lock, old, new); + } while (prev != old); if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { - DRM_ERROR("%d freed heavyweight lock held by %d\n", + DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n", context, - _DRM_LOCKING_CONTEXT(old)); + _DRM_LOCKING_CONTEXT(old), + pid); return 1; } - dev->lock.pid = 0; wake_up_interruptible(&dev->lock.lock_queue); return 0; } diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/memory.c linux/drivers/char/drm/memory.c --- v2.3.30/linux/drivers/char/drm/memory.c Fri Sep 10 23:57:29 1999 +++ linux/drivers/char/drm/memory.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* memory.c -- Memory management wrappers for DRM -*- linux-c -*- * Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 10:28:18 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.1 1999/09/25 14:38:02 dawes Exp $ * */ @@ -42,7 +42,7 @@ } drm_mem_stats_t; static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; -static unsigned long drm_ram_available = 0; +static unsigned long drm_ram_available = 0; /* In pages */ static unsigned long drm_ram_used = 0; static drm_mem_stats_t drm_mem_stats[] = { [DRM_MEM_DMA] = { "dmabufs" }, @@ -77,7 +77,12 @@ } si_meminfo(&si); +#if LINUX_VERSION_CODE < 0x020317 + /* Changed to page count in 2.3.23 */ + drm_ram_available = si.totalram >> PAGE_SHIFT; +#else drm_ram_available = si.totalram; +#endif drm_ram_used = 0; } @@ -95,10 +100,11 @@ " | outstanding \n"); DRM_PROC_PRINT("type alloc freed fail bytes freed" " | allocs bytes\n\n"); - DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu |\n", - "system", 0, 0, 0, drm_ram_available); - DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu |\n", - "locked", 0, 0, 0, drm_ram_used); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "system", 0, 0, 0, + drm_ram_available << (PAGE_SHIFT - 10)); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "locked", 0, 0, 0, drm_ram_used >> 10); DRM_PROC_PRINT("\n"); for (pt = drm_mem_stats; pt->name; pt++) { DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", @@ -207,7 +213,8 @@ unsigned int sz; spin_lock(&drm_mem_lock); - if (drm_ram_used > +(DRM_RAM_PERCENT * drm_ram_available) / 100) { + if ((drm_ram_used >> PAGE_SHIFT) + > (DRM_RAM_PERCENT * drm_ram_available) / 100) { spin_unlock(&drm_mem_lock); return 0; } diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/proc.c linux/drivers/char/drm/proc.c --- v2.3.30/linux/drivers/char/drm/proc.c Tue Dec 7 09:32:43 1999 +++ linux/drivers/char/drm/proc.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* proc.c -- /proc support for DRM -*- linux-c -*- * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:48 1999 by faith@precisioninsight.com + * Revised: Fri Dec 3 09:44:16 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.1 1999/09/25 14:38:02 dawes Exp $ * */ @@ -79,41 +79,44 @@ struct proc_dir_entry *ent; int i, j; - drm_root = proc_mkdir("video", NULL); + drm_root = create_proc_entry("graphics", S_IFDIR, NULL); if (!drm_root) { - DRM_ERROR("Cannot create /proc/video\n"); + DRM_ERROR("Cannot create /proc/graphics\n"); return -1; } /* Instead of doing this search, we should - add some global support for /proc/video. */ + add some global support for /proc/graphics. */ for (i = 0; i < 8; i++) { - sprintf(drm_slot_name, "video/%d", i); - drm_dev_root = proc_mkdir(drm_slot_name, NULL); + sprintf(drm_slot_name, "graphics/%d", i); + drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR, NULL); if (!drm_dev_root) { DRM_ERROR("Cannot create /proc/%s\n", drm_slot_name); - remove_proc_entry("video", NULL); + remove_proc_entry("graphics", NULL); } if (drm_dev_root->nlink == 2) break; drm_dev_root = NULL; } if (!drm_dev_root) { - DRM_ERROR("Cannot find slot in /proc/video\n"); + DRM_ERROR("Cannot find slot in /proc/graphics\n"); return -1; } for (i = 0; i < DRM_PROC_ENTRIES; i++) { - if (create_proc_read_entry(drm_proc_list[i].name,0,drm_dev_root, - drm_proc_list[i].f, dev)) - continue; - - DRM_ERROR("Cannot create /proc/%s/%s\n", - drm_slot_name, drm_proc_list[i].name); - for (j = 0; j < i; j++) - remove_proc_entry(drm_proc_list[i].name, drm_dev_root); - remove_proc_entry(drm_slot_name, NULL); - remove_proc_entry("video", NULL); - return -1; + ent = create_proc_entry(drm_proc_list[i].name, + S_IFREG|S_IRUGO, drm_dev_root); + if (!ent) { + DRM_ERROR("Cannot create /proc/%s/%s\n", + drm_slot_name, drm_proc_list[i].name); + for (j = 0; j < i; j++) + remove_proc_entry(drm_proc_list[i].name, + drm_dev_root); + remove_proc_entry(drm_slot_name, NULL); + remove_proc_entry("graphics", NULL); + return -1; + } + ent->read_proc = drm_proc_list[i].f; + ent->data = dev; } return 0; @@ -132,7 +135,7 @@ } remove_proc_entry(drm_slot_name, NULL); } - remove_proc_entry("video", NULL); + remove_proc_entry("graphics", NULL); remove_proc_entry(DRM_NAME, NULL); } drm_root = drm_dev_root = NULL; @@ -379,7 +382,8 @@ vma->vm_flags & VM_MAYSHARE ? 's' : 'p', vma->vm_flags & VM_LOCKED ? 'l' : '-', vma->vm_flags & VM_IO ? 'i' : '-', - vma->vm_pgoff << PAGE_SHIFT ); + VM_OFFSET(vma)); + #if defined(__i386__) pgprot = pgprot_val(vma->vm_page_prot); DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/sigio.c linux/drivers/char/drm/sigio.c --- v2.3.30/linux/drivers/char/drm/sigio.c Thu Nov 11 20:11:33 1999 +++ linux/drivers/char/drm/sigio.c Wed Dec 31 16:00:00 1969 @@ -1,81 +0,0 @@ -/* sigio.c -- Support for SIGIO handler -*- linux-c -*- - * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com - * Revised: Thu Jun 3 16:16:35 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * 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 (including the next - * paragraph) 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 - * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.2 1999/06/14 21:11:29 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.2 1999/06/14 12:02:11 dawes Exp $ - * - */ - - -#ifdef XFree86Server -# include "X.h" -# include "xf86.h" -# include "xf86drm.h" -# include "xf86_OSlib.h" -#else -# include -# include -# include -#endif - -/* - * Linux libc5 defines FASYNC, but not O_ASYNC. Don't know if it is - * functional or not. - */ -#if defined(FASYNC) && !defined(O_ASYNC) -# define O_ASYNC FASYNC -#endif - -int -xf86InstallSIGIOHandler(int fd, void (*f)(int)) -{ - struct sigaction sa; - struct sigaction osa; - - sigemptyset(&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGIO); - sa.sa_flags = 0; - sa.sa_handler = f; - sigaction(SIGIO, &sa, &osa); - fcntl(fd, F_SETOWN, getpid()); - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC); - return 0; -} - -int -xf86RemoveSIGIOHandler(int fd) -{ - struct sigaction sa; - struct sigaction osa; - - sigemptyset(&sa.sa_mask); - sigaddset(&sa.sa_mask, SIGIO); - sa.sa_flags = 0; - sa.sa_handler = SIG_DFL; - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC); - sigaction(SIGIO, &sa, &osa); - return 0; -} diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/tdfx_context.c linux/drivers/char/drm/tdfx_context.c --- v2.3.30/linux/drivers/char/drm/tdfx_context.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/drm/tdfx_context.c Tue Dec 7 13:59:01 1999 @@ -0,0 +1,206 @@ +/* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*- + * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com + * Revised: Sat Oct 9 23:39:56 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * $PI$ + * $XFree86$ + * + */ + +#include + +#define __NO_VERSION__ +#include "drmP.h" +#include "tdfx_drv.h" + +extern drm_ctx_t tdfx_res_ctx; + +static int tdfx_alloc_queue(drm_device_t *dev) +{ + static int context = 0; + + return ++context; /* Should this reuse contexts in the future? */ +} + +int tdfx_context_switch(drm_device_t *dev, int old, int new) +{ + char buf[64]; + + atomic_inc(&dev->total_ctx); + + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return -EBUSY; + } + +#if DRM_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG("Context switch from %d to %d\n", old, new); + + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } + + if (drm_flags & DRM_FLAG_NOCTX) { + tdfx_context_switch_complete(dev, new); + } else { + sprintf(buf, "C %d %d\n", old, new); + drm_write_string(dev, buf); + } + + return 0; +} + +int tdfx_context_switch_complete(drm_device_t *dev, int new) +{ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("Lock isn't held after context switch\n"); + } + + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ +#if DRM_DMA_HISTOGRAM + atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() + - dev->ctx_start)]); + +#endif + clear_bit(0, &dev->context_flag); + wake_up(&dev->context_wait); + + return 0; +} + + +int tdfx_resctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); + copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT); + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + copy_to_user_ret(&res.contexts[i], + &i, + sizeof(i), + -EFAULT); + } + } + res.count = DRM_RESERVED_CONTEXTS; + copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT); + return 0; +} + + +int tdfx_addctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if ((ctx.handle = tdfx_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { + /* Skip kernel's context and get a new one. */ + ctx.handle = tdfx_alloc_queue(dev); + } + DRM_DEBUG("%d\n", ctx.handle); + copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int tdfx_modctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + if (ctx.flags==_DRM_CONTEXT_PRESERVED) + tdfx_res_ctx.handle=ctx.handle; + return 0; +} + +int tdfx_getctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + /* This is 0, because we don't hanlde any context flags */ + ctx.flags = 0; + copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int tdfx_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + return tdfx_context_switch(dev, dev->last_context, ctx.handle); +} + +int tdfx_newctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + tdfx_context_switch_complete(dev, ctx.handle); + + return 0; +} + +int tdfx_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + /* This is currently a noop because we + don't reuse context values. Perhaps we + should? */ + + return 0; +} diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/tdfx_drv.c linux/drivers/char/drm/tdfx_drv.c --- v2.3.30/linux/drivers/char/drm/tdfx_drv.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/drm/tdfx_drv.c Tue Dec 7 23:58:21 1999 @@ -0,0 +1,601 @@ +/* tdfx.c -- tdfx driver -*- linux-c -*- + * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com + * Revised: Tue Oct 12 08:51:35 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * $PI$ + * $XFree86$ + * + */ + +#define EXPORT_SYMTAB +#include +#include "drmP.h" +#include "tdfx_drv.h" +EXPORT_SYMBOL(tdfx_init); +EXPORT_SYMBOL(tdfx_cleanup); + +#define TDFX_NAME "tdfx" +#define TDFX_DESC "tdfx" +#define TDFX_DATE "19991009" +#define TDFX_MAJOR 0 +#define TDFX_MINOR 0 +#define TDFX_PATCHLEVEL 1 + +static drm_device_t tdfx_device; +drm_ctx_t tdfx_res_ctx; + +static struct file_operations tdfx_fops = { + open: tdfx_open, + flush: drm_flush, + release: tdfx_release, + ioctl: tdfx_ioctl, + mmap: drm_mmap, + read: drm_read, + fasync: drm_fasync, +}; + +static struct miscdevice tdfx_misc = { + minor: MISC_DYNAMIC_MINOR, + name: TDFX_NAME, + fops: &tdfx_fops, +}; + +static drm_ioctl_desc_t tdfx_ioctls[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { tdfx_version, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { tdfx_addctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { tdfx_getctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { tdfx_switchctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { tdfx_newctx, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { tdfx_resctx, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, +}; +#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) + +static char *tdfx = NULL; + +MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas."); +MODULE_DESCRIPTION("tdfx"); +MODULE_PARM(tdfx, "s"); + +static int tdfx_setup(drm_device_t *dev) +{ + int i; + + atomic_set(&dev->ioctl_count, 0); + atomic_set(&dev->vma_count, 0); + dev->buf_use = 0; + atomic_set(&dev->buf_alloc, 0); + + atomic_set(&dev->total_open, 0); + atomic_set(&dev->total_close, 0); + atomic_set(&dev->total_ioctl, 0); + atomic_set(&dev->total_irq, 0); + atomic_set(&dev->total_ctx, 0); + atomic_set(&dev->total_locks, 0); + atomic_set(&dev->total_unlocks, 0); + atomic_set(&dev->total_contends, 0); + atomic_set(&dev->total_sleeps, 0); + + for (i = 0; i < DRM_HASH_SIZE; i++) { + dev->magiclist[i].head = NULL; + dev->magiclist[i].tail = NULL; + } + dev->maplist = NULL; + dev->map_count = 0; + dev->vmalist = NULL; + dev->lock.hw_lock = NULL; + init_waitqueue_head(&dev->lock.lock_queue); + dev->queue_count = 0; + dev->queue_reserved = 0; + dev->queue_slots = 0; + dev->queuelist = NULL; + dev->irq = 0; + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma = 0; + dev->dma_flag = 0; + dev->last_context = 0; + dev->last_switch = 0; + dev->last_checked = 0; + init_timer(&dev->timer); + init_waitqueue_head(&dev->context_wait); + + dev->ctx_start = 0; + dev->lck_start = 0; + + dev->buf_rp = dev->buf; + dev->buf_wp = dev->buf; + dev->buf_end = dev->buf + DRM_BSZ; + dev->buf_async = NULL; + init_waitqueue_head(&dev->buf_readers); + init_waitqueue_head(&dev->buf_writers); + + tdfx_res_ctx.handle=-1; + + DRM_DEBUG("\n"); + + /* The kernel's context could be created here, but is now created + in drm_dma_enqueue. This is more resource-efficient for + hardware that does not do DMA, but may mean that + drm_select_queue fails between the time the interrupt is + initialized and the time the queues are initialized. */ + + return 0; +} + + +static int tdfx_takedown(drm_device_t *dev) +{ + int i; + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_vma_entry_t *vma, *vma_next; + + DRM_DEBUG("\n"); + + down(&dev->struct_sem); + del_timer(&dev->timer); + + if (dev->devname) { + drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); + dev->devname = NULL; + } + + if (dev->unique) { + drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); + dev->unique = NULL; + dev->unique_len = 0; + } + /* Clear pid list */ + for (i = 0; i < DRM_HASH_SIZE; i++) { + for (pt = dev->magiclist[i].head; pt; pt = next) { + next = pt->next; + drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); + } + dev->magiclist[i].head = dev->magiclist[i].tail = NULL; + } + + /* Clear vma list (only built for debugging) */ + if (dev->vmalist) { + for (vma = dev->vmalist; vma; vma = vma_next) { + vma_next = vma->next; + drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); + } + dev->vmalist = NULL; + } + + /* Clear map area and mtrr information */ + if (dev->maplist) { + for (i = 0; i < dev->map_count; i++) { + map = dev->maplist[i]; + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#ifdef CONFIG_MTRR + if (map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } +#endif + drm_ioremapfree(map->handle, map->size); + break; + case _DRM_SHM: + drm_free_pages((unsigned long)map->handle, + drm_order(map->size) + - PAGE_SHIFT, + DRM_MEM_SAREA); + break; + } + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + } + drm_free(dev->maplist, + dev->map_count * sizeof(*dev->maplist), + DRM_MEM_MAPS); + dev->maplist = NULL; + dev->map_count = 0; + } + + if (dev->lock.hw_lock) { + dev->lock.hw_lock = NULL; /* SHM removed */ + dev->lock.pid = 0; + wake_up_interruptible(&dev->lock.lock_queue); + } + up(&dev->struct_sem); + + return 0; +} + +/* tdfx_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). */ + +int tdfx_init(void) +{ + int retcode; + drm_device_t *dev = &tdfx_device; + + DRM_DEBUG("\n"); + + memset((void *)dev, 0, sizeof(*dev)); + dev->count_lock = SPIN_LOCK_UNLOCKED; + sema_init(&dev->struct_sem, 1); + +#ifdef MODULE + drm_parse_options(tdfx); +#endif + + if ((retcode = misc_register(&tdfx_misc))) { + DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME); + return retcode; + } + dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor); + dev->name = TDFX_NAME; + + drm_mem_init(); + drm_proc_init(dev); + + DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", + TDFX_NAME, + TDFX_MAJOR, + TDFX_MINOR, + TDFX_PATCHLEVEL, + TDFX_DATE, + tdfx_misc.minor); + + return 0; +} + +/* tdfx_cleanup is called via cleanup_module at module unload time. */ + +void tdfx_cleanup(void) +{ + drm_device_t *dev = &tdfx_device; + + DRM_DEBUG("\n"); + + drm_proc_cleanup(); + if (misc_deregister(&tdfx_misc)) { + DRM_ERROR("Cannot unload module\n"); + } else { + DRM_INFO("Module unloaded\n"); + } + tdfx_takedown(dev); +} + +int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_version_t version; + int len; + + copy_from_user_ret(&version, + (drm_version_t *)arg, + sizeof(version), + -EFAULT); + +#define DRM_COPY(name,value) \ + len = strlen(value); \ + if (len > name##_len) len = name##_len; \ + name##_len = strlen(value); \ + if (len && name) { \ + copy_to_user_ret(name, value, len, -EFAULT); \ + } + + version.version_major = TDFX_MAJOR; + version.version_minor = TDFX_MINOR; + version.version_patchlevel = TDFX_PATCHLEVEL; + + DRM_COPY(version.name, TDFX_NAME); + DRM_COPY(version.date, TDFX_DATE); + DRM_COPY(version.desc, TDFX_DESC); + + copy_to_user_ret((drm_version_t *)arg, + &version, + sizeof(version), + -EFAULT); + return 0; +} + +int tdfx_open(struct inode *inode, struct file *filp) +{ + drm_device_t *dev = &tdfx_device; + int retcode = 0; + + DRM_DEBUG("open_count = %d\n", dev->open_count); + if (!(retcode = drm_open_helper(inode, filp, dev))) { + MOD_INC_USE_COUNT; + atomic_inc(&dev->total_open); + spin_lock(&dev->count_lock); + if (!dev->open_count++) { + spin_unlock(&dev->count_lock); + return tdfx_setup(dev); + } + spin_unlock(&dev->count_lock); + } + return retcode; +} + +int tdfx_release(struct inode *inode, struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode = 0; + + DRM_DEBUG("open_count = %d\n", dev->open_count); + if (!(retcode = drm_release(inode, filp))) { + MOD_DEC_USE_COUNT; + atomic_inc(&dev->total_close); + spin_lock(&dev->count_lock); + if (!--dev->open_count) { + if (atomic_read(&dev->ioctl_count) || dev->blocked) { + DRM_ERROR("Device busy: %d %d\n", + atomic_read(&dev->ioctl_count), + dev->blocked); + spin_unlock(&dev->count_lock); + return -EBUSY; + } + spin_unlock(&dev->count_lock); + return tdfx_takedown(dev); + } + spin_unlock(&dev->count_lock); + } + return retcode; +} + +/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */ + +int tdfx_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + int nr = DRM_IOCTL_NR(cmd); + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode = 0; + drm_ioctl_desc_t *ioctl; + drm_ioctl_t *func; + + atomic_inc(&dev->ioctl_count); + atomic_inc(&dev->total_ioctl); + ++priv->ioctl_count; + + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", + current->pid, cmd, nr, dev->device, priv->authenticated); + + if (nr >= TDFX_IOCTL_COUNT) { + retcode = -EINVAL; + } else { + ioctl = &tdfx_ioctls[nr]; + func = ioctl->func; + + if (!func) { + DRM_DEBUG("no function\n"); + retcode = -EINVAL; + } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) + || (ioctl->auth_needed && !priv->authenticated)) { + retcode = -EACCES; + } else { + retcode = (func)(inode, filp, cmd, arg); + } + } + + atomic_dec(&dev->ioctl_count); + return retcode; +} + +int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DECLARE_WAITQUEUE(entry, current); + int ret = 0; + drm_lock_t lock; +#if DRM_DMA_HISTOGRAM + cycles_t start; + + dev->lck_start = start = get_cycles(); +#endif + + copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + + if (lock.context == DRM_KERNEL_CONTEXT) { + DRM_ERROR("Process %d using kernel context %d\n", + current->pid, lock.context); + return -EINVAL; + } + + DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", + lock.context, current->pid, dev->lock.hw_lock->lock, + lock.flags); + +#if 0 + /* dev->queue_count == 0 right now for + tdfx. FIXME? */ + if (lock.context < 0 || lock.context >= dev->queue_count) + return -EINVAL; +#endif + + if (!ret) { +#if 0 + if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) + != lock.context) { + long j = jiffies - dev->lock.lock_time; + + if (lock.context == tdfx_res_ctx.handle && + j >= 0 && j < DRM_LOCK_SLICE) { + /* Can't take lock if we just had it and + there is contention. */ + DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", + lock.context, current->pid, j, + dev->lock.lock_time, jiffies); + current->state = TASK_INTERRUPTIBLE; + current->policy |= SCHED_YIELD; + schedule_timeout(DRM_LOCK_SLICE-j); + DRM_DEBUG("jiffies=%d\n", jiffies); + } + } +#endif + add_wait_queue(&dev->lock.lock_queue, &entry); + for (;;) { + if (!dev->lock.hw_lock) { + /* Device has been unregistered */ + ret = -EINTR; + break; + } + if (drm_lock_take(&dev->lock.hw_lock->lock, + lock.context)) { + dev->lock.pid = current->pid; + dev->lock.lock_time = jiffies; + atomic_inc(&dev->total_locks); + break; /* Got lock */ + } + + /* Contention */ + atomic_inc(&dev->total_sleeps); + current->state = TASK_INTERRUPTIBLE; + current->policy |= SCHED_YIELD; + schedule(); + if (signal_pending(current)) { + ret = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue(&dev->lock.lock_queue, &entry); + } + +#if 0 + if (!ret && dev->last_context != lock.context && + lock.context != tdfx_res_ctx.handle && + dev->last_context != tdfx_res_ctx.handle) { + add_wait_queue(&dev->context_wait, &entry); + current->state = TASK_INTERRUPTIBLE; + /* PRE: dev->last_context != lock.context */ + tdfx_context_switch(dev, dev->last_context, lock.context); + /* POST: we will wait for the context + switch and will dispatch on a later call + when dev->last_context == lock.context + NOTE WE HOLD THE LOCK THROUGHOUT THIS + TIME! */ + current->policy |= SCHED_YIELD; + schedule(); + current->state = TASK_RUNNING; + remove_wait_queue(&dev->context_wait, &entry); + if (signal_pending(current)) { + ret = -EINTR; + } else if (dev->last_context != lock.context) { + DRM_ERROR("Context mismatch: %d %d\n", + dev->last_context, lock.context); + } + } +#endif + + if (!ret) { + if (lock.flags & _DRM_LOCK_READY) { + /* Wait for space in DMA/FIFO */ + } + if (lock.flags & _DRM_LOCK_QUIESCENT) { + /* Make hardware quiescent */ +#if 0 + tdfx_quiescent(dev); +#endif + } + } + DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); + +#if DRM_DMA_HISTOGRAM + atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); +#endif + + return ret; +} + + +int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_lock_t lock; + + copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT); + + if (lock.context == DRM_KERNEL_CONTEXT) { + DRM_ERROR("Process %d using kernel context %d\n", + current->pid, lock.context); + return -EINVAL; + } + + DRM_DEBUG("%d frees lock (%d holds)\n", + lock.context, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); + atomic_inc(&dev->total_unlocks); + if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) + atomic_inc(&dev->total_contends); + drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); + /* FIXME: Try to send data to card here */ + if (!dev->context_flag) { + if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT)) { + DRM_ERROR("\n"); + } + } + + return 0; +} + +module_init(tdfx_init); +module_exit(tdfx_cleanup); + +/* + * tdfx_setup is called by the kernel to parse command-line options passed + * via the boot-loader (e.g., LILO). It calls the insmod option routine, + * drm_parse_drm. + */ +static int __init tdfx_options(char *str) +{ + drm_parse_options(str); + return 1; +} + +__setup("tdfx=", tdfx_options); diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/tdfx_drv.h linux/drivers/char/drm/tdfx_drv.h --- v2.3.30/linux/drivers/char/drm/tdfx_drv.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/drm/tdfx_drv.h Tue Dec 7 13:59:01 1999 @@ -0,0 +1,68 @@ +/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*- + * Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com + * Revised: Sat Oct 9 23:38:19 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * All rights reserved. + * + * 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 (including the next + * paragraph) 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * $PI$ + * $XFree86$ + * + */ + +#ifndef _TDFX_DRV_H_ +#define _TDFX_DRV_H_ + + /* tdfx_drv.c */ +extern int tdfx_init(void); +extern void tdfx_cleanup(void); +extern int tdfx_version(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_open(struct inode *inode, struct file *filp); +extern int tdfx_release(struct inode *inode, struct file *filp); +extern int tdfx_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_lock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_unlock(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + + /* tdfx_context.c */ + +extern int tdfx_resctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_addctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_modctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_getctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_switchctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_newctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int tdfx_rmctx(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +extern int tdfx_context_switch(drm_device_t *dev, int old, int new); +extern int tdfx_context_switch_complete(drm_device_t *dev, int new); +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/drm/vm.c linux/drivers/char/drm/vm.c --- v2.3.30/linux/drivers/char/drm/vm.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/drm/vm.c Tue Dec 7 13:59:01 1999 @@ -1,6 +1,6 @@ /* vm.c -- Memory mapping for DRM -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 22:48:11 1999 by faith@precisioninsight.com + * Revised: Mon Dec 6 16:54:35 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -24,8 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $ - * $XFree86$ + * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.1 1999/09/25 14:38:02 dawes Exp $ * */ @@ -50,18 +50,32 @@ close: drm_vm_close, }; +#if LINUX_VERSION_CODE < 0x020317 unsigned long drm_vm_nopage(struct vm_area_struct *vma, unsigned long address, int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *drm_vm_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif { DRM_DEBUG("0x%08lx, %d\n", address, write_access); - return 0; /* Disallow mremap */ + return NOPAGE_SIGBUS; /* Disallow mremap */ } +#if LINUX_VERSION_CODE < 0x020317 unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma, unsigned long address, int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif { drm_file_t *priv = vma->vm_file->private_data; drm_device_t *dev = priv->dev; @@ -69,8 +83,8 @@ unsigned long offset; unsigned long page; - if (address > vma->vm_end) return 0; /* Disallow mremap */ - if (!dev->lock.hw_lock) return 0; /* Nothing allocated */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dev->lock.hw_lock) return NOPAGE_OOM; /* Nothing allocated */ offset = address - vma->vm_start; page = offset >> PAGE_SHIFT; @@ -78,12 +92,23 @@ atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */ DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); +#if LINUX_VERSION_CODE < 0x020317 return physical; +#else + return mem_map + MAP_NR(physical); +#endif } +#if LINUX_VERSION_CODE < 0x020317 unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma, unsigned long address, int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif { drm_file_t *priv = vma->vm_file->private_data; drm_device_t *dev = priv->dev; @@ -92,17 +117,21 @@ unsigned long offset; unsigned long page; - if (!dma) return 0; /* Error */ - if (address > vma->vm_end) return 0; /* Disallow mremap */ - if (!dma->pagelist) return 0; /* Nothing allocated */ + if (!dma) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ - offset = address - vma->vm_start; /* vm_pgoff should be 0 */ + offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ page = offset >> PAGE_SHIFT; physical = dma->pagelist[page] + (offset & (~PAGE_MASK)); atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */ DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); +#if LINUX_VERSION_CODE < 0x020317 return physical; +#else + return mem_map + MAP_NR(physical); +#endif } void drm_vm_open(struct vm_area_struct *vma) @@ -168,8 +197,8 @@ drm_device_dma_t *dma = dev->dma; unsigned long length = vma->vm_end - vma->vm_start; - DRM_DEBUG("start = 0x%lx, end = 0x%lx, pgoff = 0x%lx\n", - vma->vm_start, vma->vm_end, vma->vm_pgoff); + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); /* Length must match exact page count */ if ((length >> PAGE_SHIFT) != dma->page_count) return -EINVAL; @@ -192,17 +221,13 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_map_t *map = NULL; - unsigned long off; int i; DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, vma->vm_pgoff); + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - if (!vma->vm_pgoff) return drm_mmap_dma(filp, vma); - if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) /* overflow? */ - return -EINVAL; + if (!VM_OFFSET(vma)) return drm_mmap_dma(filp, vma); - off = vma->vm_pgoff << PAGE_SHIFT; /* A sequential search of a linked list is fine here because: 1) there will only be about 5-10 entries in the list and, 2) a @@ -212,7 +237,7 @@ bit longer. */ for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->offset == off) break; + if (map->offset == VM_OFFSET(vma)) break; } if (i >= dev->map_count) return -EINVAL; @@ -226,7 +251,7 @@ switch (map->type) { case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: - if (off >= __pa(high_memory)) { + if (VM_OFFSET(vma) >= __pa(high_memory)) { #if defined(__i386__) if (boot_cpu_data.x86 > 3) { pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; @@ -236,7 +261,7 @@ vma->vm_flags |= VM_IO; /* not in core dump */ } if (remap_page_range(vma->vm_start, - off, + VM_OFFSET(vma), vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; @@ -253,7 +278,15 @@ } vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ if (map->flags & _DRM_READ_ONLY) { +#if defined(__i386__) pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; +#else + /* Ye gads this is ugly. With more thought + we could move this up higher and use + `protection_map' instead. */ + vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( + __pte(pgprot_val(vma->vm_page_prot))))); +#endif } diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/Config.in linux/drivers/char/joystick/Config.in --- v2.3.30/linux/drivers/char/joystick/Config.in Mon Oct 11 15:38:14 1999 +++ linux/drivers/char/joystick/Config.in Tue Dec 7 10:13:11 1999 @@ -1,19 +1,34 @@ # -# Joystick lowlevel driver configuration +# Joystick driver # -dep_tristate ' Classic PC analog joysticks and gamepads' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK -dep_tristate ' FPGaming and MadCatz A3D controllers' CONFIG_JOY_ASSASIN $CONFIG_JOYSTICK -dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK -dep_tristate ' Logitech Digital joysticks and gamepads' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK -dep_tristate ' Microsoft SideWinder, Genius Digital joysticks and gamepads' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK -dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK -dep_tristate ' PDPI Lightning 4 gamecards' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK -if [ "$CONFIG_PARPORT" != "n" ]; then - dep_tristate ' NES, SNES, PSX, Multisystem joysticks and gamepads' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT - dep_tristate ' Sega, Multisystem joysticks and gamepads' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT - dep_tristate ' TurboGraFX Multisystem joystick interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT -fi -if [ "$CONFIG_AMIGA" = "y" ]; then - dep_tristate ' Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK +mainmenu_option next_comment +comment 'Joysticks' + +tristate 'Joystick support' CONFIG_JOYSTICK + +if [ "$CONFIG_JOYSTICK" != "n" ]; then + dep_tristate ' Classic PC analog' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK + dep_tristate ' FPGaming and MadCatz A3D' CONFIG_JOY_ASSASSIN $CONFIG_JOYSTICK + dep_tristate ' Gravis GrIP' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK + dep_tristate ' Logitech ADI' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK + dep_tristate ' Microsoft SideWinder' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK + dep_tristate ' ThrustMaster DirectConnect' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK + dep_tristate ' Creative Labs Blaster' CONFIG_JOY_CREATIVE $CONFIG_JOYSTICK + dep_tristate ' PDPI Lightning 4 card' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK + dep_tristate ' Trident 4DWave and Aureal Vortex gameport' CONFIG_JOY_PCI $CONFIG_JOYSTICK + dep_tristate ' Magellan and Space Mouse' CONFIG_JOY_MAGELLAN $CONFIG_JOYSTICK + dep_tristate ' SpaceTec SpaceOrb 360 and SpaceBall Avenger' CONFIG_JOY_SPACEORB $CONFIG_JOYSTICK + dep_tristate ' SpaceTec SpaceBall 4000 FLX' CONFIG_JOY_SPACEBALL $CONFIG_JOYSTICK + dep_tristate ' Logitech WingMan Warrior' CONFIG_JOY_WARRIOR $CONFIG_JOYSTICK + if [ "$CONFIG_PARPORT" != "n" ]; then + dep_tristate ' NES, SNES, PSX, N64, Multi' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT + dep_tristate ' Sega, Multi' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT + dep_tristate ' TurboGraFX interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + dep_tristate ' Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK + fi fi + +endmenu diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/Makefile linux/drivers/char/joystick/Makefile --- v2.3.30/linux/drivers/char/joystick/Makefile Thu Oct 8 17:25:16 1998 +++ linux/drivers/char/joystick/Makefile Tue Dec 7 10:13:11 1999 @@ -1,23 +1,18 @@ # # Makefile for the joystick drivers. # -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definitions are now inherited from the -# parent makes.. -# O_TARGET := js.o +OX_OBJS := O_OBJS := +MX_OBJS := M_OBJS := ifeq ($(CONFIG_JOYSTICK),y) -O_OBJS += joystick.o +OX_OBJS += joystick.o else ifeq ($(CONFIG_JOYSTICK),m) - M_OBJS += joystick.o + MX_OBJS += joystick.o endif endif @@ -37,11 +32,11 @@ endif endif -ifeq ($(CONFIG_JOY_ASSASIN),y) -O_OBJS += joy-assasin.o +ifeq ($(CONFIG_JOY_ASSASSIN),y) +O_OBJS += joy-assassin.o else - ifeq ($(CONFIG_JOY_ASSASIN),m) - M_OBJS += joy-assasin.o + ifeq ($(CONFIG_JOY_ASSASSIN),m) + M_OBJS += joy-assassin.o endif endif @@ -53,6 +48,14 @@ endif endif +ifeq ($(CONFIG_JOY_CREATIVE),y) +O_OBJS += joy-creative.o +else + ifeq ($(CONFIG_JOY_CREATIVE),m) + M_OBJS += joy-creative.o + endif +endif + ifeq ($(CONFIG_JOY_DB9),y) O_OBJS += joy-db9.o else @@ -85,6 +88,22 @@ endif endif +ifeq ($(CONFIG_JOY_MAGELLAN),y) +O_OBJS += joy-magellan.o +else + ifeq ($(CONFIG_JOY_MAGELLAN),m) + M_OBJS += joy-magellan.o + endif +endif + +ifeq ($(CONFIG_JOY_PCI),y) +O_OBJS += joy-pci.o +else + ifeq ($(CONFIG_JOY_PCI),m) + M_OBJS += joy-pci.o + endif +endif + ifeq ($(CONFIG_JOY_SIDEWINDER),y) O_OBJS += joy-sidewinder.o else @@ -93,6 +112,22 @@ endif endif +ifeq ($(CONFIG_JOY_SPACEORB),y) +O_OBJS += joy-spaceorb.o +else + ifeq ($(CONFIG_JOY_SPACEORB),m) + M_OBJS += joy-spaceorb.o + endif +endif + +ifeq ($(CONFIG_JOY_SPACEBALL),y) +O_OBJS += joy-spaceball.o +else + ifeq ($(CONFIG_JOY_SPACEBALL),m) + M_OBJS += joy-spaceball.o + endif +endif + ifeq ($(CONFIG_JOY_THRUSTMASTER),y) O_OBJS += joy-thrustmaster.o else @@ -106,6 +141,14 @@ else ifeq ($(CONFIG_JOY_TURBOGRAFX),m) M_OBJS += joy-turbografx.o + endif +endif + +ifeq ($(CONFIG_JOY_WARRIOR),y) +O_OBJS += joy-warrior.o +else + ifeq ($(CONFIG_JOY_WARRIOR),m) + M_OBJS += joy-warrior.o endif endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-amiga.c linux/drivers/char/joystick/joy-amiga.c --- v2.3.30/linux/drivers/char/joystick/joy-amiga.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-amiga.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-amiga.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -36,13 +38,14 @@ #include #include #include +#include static struct js_port* js_am_port __initdata = NULL; MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_am, "1-2i"); -static int js_am[]={0,0}; +static int __initdata js_am[] = { 0, 0 }; /* * js_am_read() reads and Amiga joystick data. @@ -69,7 +72,7 @@ axes[0][0] = ((data >> 1) & 1) - ((data >> 9) & 1); data = ~(data ^ (data << 1)); - axes[0][0] = ((data >> 1) & 1) - ((data >> 9) & 1); + axes[0][1] = ((data >> 1) & 1) - ((data >> 9) & 1); return 0; } @@ -114,11 +117,14 @@ } #ifndef MODULE -void __init js_am_setup(char *str, int *ints) +int __init js_am_setup(SETUP_PARAM) { int i; + SETUP_PARSE(2); for (i = 0; i <= ints[0] && i < 2; i++) js_am[i] = ints[i+1]; + return 1; } +__setup("js_am=", js_am_setup); #endif #ifdef MODULE @@ -148,8 +154,8 @@ #ifdef MODULE void cleanup_module(void) { - while (js_am_port != NULL) { - if (js_am_port->devs[0] != NULL) + while (js_am_port) { + if (js_am_port->devs[0]) js_unregister_device(js_am_port->devs[0]); js_am_port = js_unregister_port(js_am_port); } diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-analog.c linux/drivers/char/joystick/joy-analog.c --- v2.3.30/linux/drivers/char/joystick/joy-analog.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-analog.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-analog.c Version 1.2 * - * Copyright (c) 1996-1998 Vojtech Pavlik + * Copyright (c) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -30,15 +32,21 @@ */ #include +#include +#include +#include #include #include #include #include #include #include +#include #include +#include -#define JS_AN_MAX_TIME 3000 +#define JS_AN_MAX_TIME 3000 /* 3 ms */ +#define JS_AN_LOOP_TIME 2000 /* 2 t */ static int js_an_port_list[] __initdata = {0x201, 0}; static struct js_port* js_an_port __initdata = NULL; @@ -46,53 +54,102 @@ MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_an, "2-24i"); -static int js_an[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; +static int __initdata js_an[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 }; #include "joy-analog.h" +struct js_ax_info { + int io; + int speed; + int loop; + int timeout; + struct js_an_info an; +}; + +/* + * Time macros. + */ + +#ifdef __i386__ +#ifdef CONFIG_X86_TSC +#define GET_TIME(x) __asm__ __volatile__ ( "rdtsc" : "=a" (x) : : "dx" ) +#define DELTA(x,y) ((x)-(y)) +#define TIME_NAME "TSC" +#else +#define GET_TIME(x) do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0) +#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193180L/HZ:0)) +#define TIME_NAME "PIT" +#endif +#elif __alpha__ +#define GET_TIME(x) __asm__ __volatile__ ( "rpcc %0" : "=r" (x) ) +#define DELTA(x,y) ((x)-(y)) +#define TIME_NAME "PCC" +#endif + +#ifndef GET_TIME +#define FAKE_TIME +static unsigned long js_an_faketime = 0; +#define GET_TIME(x) do { x = js_an_faketime++; } while(0) +#define DELTA(x,y) ((x)-(y)) +#define TIME_NAME "Unreliable" +#endif + /* * js_an_read() reads analog joystick data. */ static int js_an_read(void *xinfo, int **axes, int **buttons) { - struct js_an_info *info = xinfo; + struct js_ax_info *info = xinfo; + struct js_an_info *an = &info->an; + int io = info->io; + unsigned long flags; unsigned char buf[4]; - int time[4]; - unsigned char u, v, a; - unsigned int t, t1; + unsigned int time[4]; + unsigned char u, v, w; + unsigned int p, q, r, s, t; int i, j; - int timeout; - int io = info->io; - timeout = (JS_AN_MAX_TIME * js_time_speed_a) >> 10; - - info->buttons = (~inb(io) & JS_AN_BUTTONS_STD) >> 4; + an->buttons = ~inb(io) >> 4; i = 0; - u = a = ((info->mask[0] | info->mask[1]) & JS_AN_AXES_STD) | (info->extensions & JS_AN_HAT_FCS) - | ((info->extensions & JS_AN_BUTTONS_PXY_XY) >> 2) | ((info->extensions & JS_AN_BUTTONS_PXY_UV) >> 4); - + w = ((an->mask[0] | an->mask[1]) & JS_AN_AXES_STD) | (an->extensions & JS_AN_HAT_FCS) + | ((an->extensions & JS_AN_BUTTONS_PXY_XY) >> 2) | ((an->extensions & JS_AN_BUTTONS_PXY_UV) >> 4); + p = info->loop; + q = info->timeout; + + __save_flags(flags); + __cli(); outb(0xff,io); - t = js_get_time_a(); + GET_TIME(r); + __restore_flags(flags); + t = r; + v = w; do { - v = inb(io) & a; - t1 = js_get_time_a(); - if (u ^ v) { - time[i] = js_delta_a(t1,t); + s = t; + u = v; + __cli(); + v = inb(io) & w; + GET_TIME(t); + __restore_flags(flags); + if ((u ^ v) && (DELTA(t,s) < p)) { + time[i] = t; buf[i] = u ^ v; - u = v; i++; } - } while (v && js_delta_a(t1,t) < timeout); + } while (v && (i < 4) && (DELTA(t,r) < q)); - for (--i; i >= 0; i--) + v <<= 4; + + for (--i; i >= 0; i--) { + v |= buf[i]; for (j = 0; j < 4; j++) - if (buf[i] & (1 << j)) info->axes[j] = (time[i] << 10) / js_time_speed_a; + if (buf[i] & (1 << j)) an->axes[j] = (DELTA(time[i],r) << 10) / info->speed; + } - js_an_decode(info, axes, buttons); + js_an_decode(an, axes, buttons); - return 0; + return -(v != w); } /* @@ -116,12 +173,53 @@ } /* + * js_an_calibrate_timer() calibrates the timer and computes loop + * and timeout values for a joystick port. + */ + +static void __init js_an_calibrate_timer(struct js_ax_info *info) +{ + unsigned int i, t, tx, t1, t2, t3; + unsigned long flags; + int io = info->io; + + save_flags(flags); + cli(); + GET_TIME(t1); +#ifdef FAKE_TIME + js_an_faketime += 830; +#endif + udelay(1000); + GET_TIME(t2); + GET_TIME(t3); + restore_flags(flags); + + info->speed = DELTA(t2, t1) - DELTA(t3, t2); + + tx = 1 << 30; + + for(i = 0; i < 50; i++) { + save_flags(flags); + cli(); + GET_TIME(t1); + for(t = 0; t < 50; t++) { inb(io); GET_TIME(t2); } + GET_TIME(t3); + restore_flags(flags); + udelay(i); + if ((t = DELTA(t2,t1) - DELTA(t3,t2)) < tx) tx = t; + } + + info->loop = (JS_AN_LOOP_TIME * t) / 50000; + info->timeout = (JS_AN_MAX_TIME * info->speed) / 1000; +} + +/* * js_an_probe() probes for analog joysticks. */ static struct js_port __init *js_an_probe(int io, int mask0, int mask1, struct js_port *port) { - struct js_an_info info; + struct js_ax_info info, *ax; int i, numdev; unsigned char u; @@ -129,7 +227,6 @@ if (check_region(io, 1)) return port; - if (((u = inb(io)) & 3) == 3) return port; outb(0xff,io); u = inb(io); udelay(JS_AN_MAX_TIME); @@ -138,31 +235,41 @@ if (!u) return port; if (u & 0xf0) return port; - if ((numdev = js_an_probe_devs(&info, u, mask0, mask1, port)) <= 0) + if ((numdev = js_an_probe_devs(&info.an, u, mask0, mask1, port)) <= 0) return port; info.io = io; + js_an_calibrate_timer(&info); + request_region(info.io, 1, "joystick (analog)"); - port = js_register_port(port, &info, numdev, sizeof(struct js_an_info), js_an_read); + port = js_register_port(port, &info, numdev, sizeof(struct js_ax_info), js_an_read); + ax = port->info; for (i = 0; i < numdev; i++) - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, i, js_an_axes(i, &info), js_an_buttons(i, &info), - js_an_name(i, &info), js_an_open, js_an_close), - js_an_name(i, &info), info.io); + printk(KERN_INFO "js%d: %s at %#x ["TIME_NAME" timer, %d %sHz clock, %d ns res]\n", + js_register_device(port, i, js_an_axes(i, &ax->an), js_an_buttons(i, &ax->an), + js_an_name(i, &ax->an), js_an_open, js_an_close), + js_an_name(i, &ax->an), + ax->io, + ax->speed > 10000 ? (ax->speed + 800) / 1000 : ax->speed, + ax->speed > 10000 ? "M" : "k", + ax->loop * 1000000000 / JS_AN_LOOP_TIME / ax->speed); - js_an_read(port->info, port->axes, port->buttons); - js_an_init_corr(port->info, port->axes, port->corr, 8); + js_an_read(ax, port->axes, port->buttons); + js_an_init_corr(&ax->an, port->axes, port->corr, 8); return port; } #ifndef MODULE -void __init js_an_setup(char *str, int *ints) +int __init js_an_setup(SETUP_PARAM) { int i; + SETUP_PARSE(24); for (i = 0; i <= ints[0] && i < 24; i++) js_an[i] = ints[i+1]; + return 1; } +__setup("js_an=", js_an_setup); #endif #ifdef MODULE @@ -193,11 +300,11 @@ void cleanup_module(void) { int i; - struct js_an_info *info; + struct js_ax_info *info; - while (js_an_port != NULL) { + while (js_an_port) { for (i = 0; i < js_an_port->ndevs; i++) - if (js_an_port->devs[i] != NULL) + if (js_an_port->devs[i]) js_unregister_device(js_an_port->devs[i]); info = js_an_port->info; release_region(info->io, 1); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-analog.h linux/drivers/char/joystick/joy-analog.h --- v2.3.30/linux/drivers/char/joystick/joy-analog.h Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-analog.h Tue Dec 7 10:13:11 1999 @@ -1,13 +1,15 @@ /* * joy-analog.h Version 1.2 * - * Copyright (c) 1996-1998 Vojtech Pavlik + * Copyright (c) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* * This file is designed to be included in any joystick driver * that communicates with standard analog joysticks. This currently - * is: joy-analog.c, joy-assasin.c, and joy-lightning.c + * is: joy-analog.c, joy-assassin.c, and joy-lightning.c */ /* @@ -30,6 +32,8 @@ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ +#include + #define JS_AN_AXES_STD 0x0f #define JS_AN_BUTTONS_STD 0xf0 @@ -53,7 +57,6 @@ } js_an_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1, 0}, { 0, 1}, {-1, 0}}; struct js_an_info { - int io; unsigned char mask[2]; unsigned int extensions; int axes[4]; @@ -75,7 +78,7 @@ if (info->mask[1] & JS_AN_BUTTONS_STD) buttons[1][0] = 0; if (info->extensions & JS_AN_ANY_CHF) { - switch (info->buttons) { + switch (info->buttons & 0xf) { case 0x1: buttons[0][0] = 0x01; break; case 0x2: buttons[0][0] = 0x02; break; case 0x4: buttons[0][0] = 0x04; break; @@ -134,19 +137,6 @@ } } -/* - * js_an_count_bits() counts set bits in a byte. - */ - -static inline int js_an_count_bits(unsigned long c) -{ - int i = 0; - while (c) { - i += c & 1; - c >>= 1; - } - return i; -} /* * js_an_init_corr() initializes the correction values for @@ -158,7 +148,7 @@ int i, j, t; for (i = 0; i < 2; i++) - for (j = 0; j < js_an_count_bits(info->mask[i] & 0xf); j++) { + for (j = 0; j < hweight8(info->mask[i] & 0xf); j++) { if ((j == 2 && (info->mask[i] & 0xb) == 0xb) || (j == 3 && (info->mask[i] & 0xf) == 0xf)) { @@ -175,9 +165,9 @@ corr[i][j].coef[3] = (1 << 29) / (t - (t >> 2) + 1); } - i = js_an_count_bits(info->mask[0] & 0xf); + i = hweight8(info->mask[0] & 0xf); - for (j = i; j < i + (js_an_count_bits(info->extensions & JS_AN_HATS_ALL) << 1); j++) { + for (j = i; j < i + (hweight8(info->extensions & JS_AN_HATS_ALL) << 1); j++) { corr[0][j].type = JS_CORR_BROKEN; corr[0][j].prec = 0; corr[0][j].coef[0] = 0; @@ -204,6 +194,7 @@ info->mask[1] = mask1 & (exist | 0xf0) & ~info->mask[0]; info->extensions = (mask0 >> 8) & ((exist & JS_AN_HAT_FCS) | ((exist << 2) & JS_AN_BUTTONS_PXY_XY) | ((exist << 4) & JS_AN_BUTTONS_PXY_UV) | JS_AN_ANY_CHF); + if (info->extensions & JS_AN_BUTTONS_PXY) { info->mask[0] &= ~((info->extensions & JS_AN_BUTTONS_PXY_XY) >> 2); info->mask[0] &= ~((info->extensions & JS_AN_BUTTONS_PXY_UV) >> 4); @@ -212,7 +203,7 @@ if (info->extensions & JS_AN_HAT_FCS) { info->mask[0] &= ~JS_AN_HAT_FCS; info->mask[1] = 0; - info->extensions &= ~(JS_AN_BUTTON_PXY_Y | JS_AN_BUTTON_PXY_U); + info->extensions &= ~(JS_AN_BUTTON_PXY_Y | JS_AN_BUTTON_PXY_V); } if (info->extensions & JS_AN_ANY_CHF) { info->mask[0] |= 0xf0; @@ -233,8 +224,7 @@ info->mask[0] = 0xcc; /* joystick 1 */ break; case 0xf: - info->mask[0] = 0x33; /* joysticks 0 and 1 */ - info->mask[1] = 0xcc; + info->mask[0] = 0xff; /* 4-axis 4-button joystick */ break; default: printk(KERN_WARNING "joy-analog: Unknown joystick device detected " @@ -252,7 +242,7 @@ static inline int js_an_axes(int i, struct js_an_info *info) { - return js_an_count_bits(info->mask[i] & 0x0f) + js_an_count_bits(info->extensions & JS_AN_HATS_ALL) * 2; + return hweight8(info->mask[i] & 0x0f) + hweight8(info->extensions & JS_AN_HATS_ALL) * 2; } /* @@ -261,9 +251,9 @@ static inline int js_an_buttons(int i, struct js_an_info *info) { - return js_an_count_bits(info->mask[i] & 0xf0) + + return hweight8(info->mask[i] & 0xf0) + (info->extensions & JS_AN_BUTTONS_CHF) * 2 + - js_an_count_bits(info->extensions & JS_AN_BUTTONS_PXY); + hweight8(info->extensions & JS_AN_BUTTONS_PXY); } /* @@ -276,13 +266,13 @@ { sprintf(js_an_name_buf, "Analog %d-axis %d-button", - js_an_count_bits(info->mask[i] & 0x0f), + hweight8(info->mask[i] & 0x0f), js_an_buttons(i, info)); if (info->extensions & JS_AN_HATS_ALL) sprintf(js_an_name_buf, "%s %d-hat", js_an_name_buf, - js_an_count_bits(info->extensions & JS_AN_HATS_ALL)); + hweight8(info->extensions & JS_AN_HATS_ALL)); strcat(js_an_name_buf, " joystick"); @@ -291,7 +281,7 @@ js_an_name_buf, info->extensions & JS_AN_ANY_CHF ? " CHF" : "", info->extensions & JS_AN_HAT_FCS ? " FCS" : "", - info->extensions & JS_AN_BUTTONS_PXY ? " XY-button" : ""); + info->extensions & JS_AN_BUTTONS_PXY ? " XY/UV" : ""); return js_an_name_buf; } diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-assasin.c linux/drivers/char/joystick/joy-assasin.c --- v2.3.30/linux/drivers/char/joystick/joy-assasin.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-assasin.c Wed Dec 31 16:00:00 1969 @@ -1,423 +0,0 @@ -/* - * joy-assasin.c Version 1.2 - * - * Copyright (c) 1998 Vojtech Pavlik - */ - -/* - * This is a module for the Linux joystick driver, supporting - * joysticks using FP-Gaming's Assasin 3D protocol. - */ - -/* - * 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 , or by paper mail: - * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define JS_AS_MAX_START 250 -#define JS_AS_MAX_STROBE 50 -#define JS_AS_MAX_TIME 2400 -#define JS_AS_MAX_LENGTH 40 - -#define JS_AS_MODE_A3D 1 /* Assasin 3D */ -#define JS_AS_MODE_PAN 2 /* Panther */ -#define JS_AS_MODE_OEM 3 /* Panther OEM version */ -#define JS_AS_MODE_PXL 4 /* Panther XL */ - -MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_PARM(js_as, "2-24i"); - -static int js_as[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; - -static int js_as_port_list[] __initdata = {0x201, 0}; -static struct js_port* js_as_port __initdata = NULL; - -#include "joy-analog.h" - -struct js_as_info { - int io; - char mode; - char rudder; - struct js_an_info an; -}; - -/* - * js_as_read_packet() reads an Assasin 3D packet. - */ - -static int js_as_read_packet(int io, int length, char *data) -{ - unsigned char u, v; - int i; - unsigned int t, t1; - unsigned long flags; - - int start = (js_time_speed * JS_AS_MAX_START) >> 10; - int strobe = (js_time_speed * JS_AS_MAX_STROBE) >> 10; - - i = 0; - - __save_flags(flags); - __cli(); - outb(0xff,io); - - u = inb(io); - t = js_get_time(); - - do { - v = inb(io); - t1 = js_get_time(); - } while (u == v && js_delta(t1, t) < start); - - t = t1; - - do { - v = inb(io); - t1 = js_get_time(); - if ((u ^ v) & u & 0x10) { - data[i++] = v >> 5; - t = t1; - } - u = v; - } while (i < length && js_delta(t1,t) < strobe); - - __restore_flags(flags); - - return i; -} - -/* - * js_as_csum() computes checksum of triplet packet - */ - -static int js_as_csum(char *data, int count) -{ - int i, csum = 0; - for (i = 0; i < count - 2; i++) csum += data[i]; - return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]); -} - -/* - * js_as_read() reads and analyzes A3D joystick data. - */ - -static int js_as_read(void *xinfo, int **axes, int **buttons) -{ - struct js_as_info *info = xinfo; - char data[JS_AS_MAX_LENGTH]; - - switch (info->mode) { - - case JS_AS_MODE_A3D: - case JS_AS_MODE_OEM: - case JS_AS_MODE_PAN: - - if (js_as_read_packet(info->io, 29, data) != 29) return -1; - if (data[0] != info->mode) return -1; - if (js_as_csum(data, 29)) return -1; - - axes[0][0] = ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7); - axes[0][1] = ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7); - - buttons[0][0] = (data[2] << 2) | (data[3] >> 1); - - info->an.axes[0] = ((char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128; - info->an.axes[1] = ((char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128; - info->an.axes[2] = ((char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128; - info->an.axes[3] = ((char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128; - - info->an.buttons = ((data[3] << 3) | data[4]) & 0xf; - - js_an_decode(&info->an, axes + 1, buttons + 1); - - return 0; - - case JS_AS_MODE_PXL: - - if (js_as_read_packet(info->io, 33, data) != 33) return -1; - if (data[0] != info->mode) return -1; - if (js_as_csum(data, 33)) return -1; - - axes[0][0] = ((char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128; - axes[0][1] = ((char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128; - info->an.axes[0] = ((char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128; - axes[0][2] = ((char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128; - - axes[0][3] = ( data[5] & 1) - ((data[5] >> 2) & 1); - axes[0][4] = ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1); - axes[0][5] = ((data[4] >> 1) & 1) - ( data[3] & 1); - axes[0][6] = ((data[4] >> 2) & 1) - ( data[4] & 1); - - axes[0][7] = ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7); - axes[0][8] = ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7); - - buttons[0][0] = (data[2] << 8) | ((data[3] & 6) << 5) | (data[7] << 3) | data[8]; - - if (info->rudder) axes[1][0] = info->an.axes[0]; - - return 0; - - default: - printk("Error.\n"); - return -1; - } -} - -/* - * js_as_open() is a callback from the file open routine. - */ - -static int js_as_open(struct js_dev *jd) -{ - MOD_INC_USE_COUNT; - return 0; -} - -/* - * js_as_close() is a callback from the file release routine. - */ - -static int js_as_close(struct js_dev *jd) -{ - MOD_DEC_USE_COUNT; - return 0; -} - -/* - * js_as_pxl_init_corr() initializes the correction values for - * the Panther XL. - */ - -static void __init js_as_pxl_init_corr(struct js_corr **corr, int **axes) -{ - int i; - - for (i = 0; i < 2; i++) { - corr[0][i].type = JS_CORR_BROKEN; - corr[0][i].prec = 0; - corr[0][i].coef[0] = axes[0][i] - 4; - corr[0][i].coef[1] = axes[0][i] + 4; - corr[0][i].coef[2] = (1 << 29) / (127 - 32); - corr[0][i].coef[3] = (1 << 29) / (127 - 32); - } - - corr[0][2].type = JS_CORR_BROKEN; - corr[0][2].prec = 0; - corr[0][2].coef[0] = 127 - 4; - corr[0][2].coef[1] = 128 + 4; - corr[0][2].coef[2] = (1 << 29) / (127 - 6); - corr[0][2].coef[3] = (1 << 29) / (127 - 6); - - for (i = 3; i < 7; i++) { - corr[0][i].type = JS_CORR_BROKEN; - corr[0][i].prec = 0; - corr[0][i].coef[0] = 0; - corr[0][i].coef[1] = 0; - corr[0][i].coef[2] = (1 << 29); - corr[0][i].coef[3] = (1 << 29); - } - - for (i = 7; i < 9; i++) { - corr[0][i].type = JS_CORR_BROKEN; - corr[0][i].prec = -1; - corr[0][i].coef[0] = 0; - corr[0][i].coef[1] = 0; - corr[0][i].coef[2] = (104 << 14); - corr[0][i].coef[3] = (104 << 14); - } -} - -/* - * js_as_as_init_corr() initializes the correction values for - * the Panther and Assasin. - */ - -static void __init js_as_as_init_corr(struct js_corr **corr) -{ - int i; - - for (i = 0; i < 2; i++) { - corr[0][i].type = JS_CORR_BROKEN; - corr[0][i].prec = -1; - corr[0][i].coef[0] = 0; - corr[0][i].coef[1] = 0; - corr[0][i].coef[2] = (104 << 14); - corr[0][i].coef[3] = (104 << 14); - } -} - -/* - * js_as_rudder_init_corr() initializes the correction values for - * the Panther XL connected rudder. - */ - -static void __init js_as_rudder_init_corr(struct js_corr **corr, int **axes) -{ - corr[1][0].type = JS_CORR_BROKEN; - corr[1][0].prec = 0; - corr[1][0].coef[0] = axes[1][0] - (axes[1][0] >> 3); - corr[1][0].coef[1] = axes[1][0] + (axes[1][0] >> 3); - corr[1][0].coef[2] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1); - corr[1][0].coef[3] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1); -} - -/* - * js_as_probe() probes for A3D joysticks. - */ - -static struct js_port __init *js_as_probe(int io, int mask0, int mask1, struct js_port *port) -{ - struct js_as_info iniinfo; - struct js_as_info *info = &iniinfo; - char *name; - char data[JS_AS_MAX_LENGTH]; - unsigned char u; - int i; - int numdev; - - memset(info, 0, sizeof(struct js_as_info)); - - if (io < 0) return port; - - if (check_region(io, 1)) return port; - if (((u = inb(io)) & 3) == 3) return port; - outb(0xff,io); - if (!((inb(io) ^ u) & ~u & 0xf)) return port; - - if (js_as_read_packet(io, 1, data) != 1) return port; - - if (data[0] && data[0] <= 4) { - info->mode = data[0]; - info->io = io; - request_region(io, 1, "joystick (assasin)"); - port = js_register_port(port, info, 3, sizeof(struct js_as_info), js_as_read); - info = port->info; - } else { - printk(KERN_WARNING "joy-assasin: unknown joystick device detected " - "(io=%#x, id=%d), contact \n", io, data[0]); - return port; - } - - udelay(JS_AS_MAX_TIME); - - if (info->mode == JS_AS_MODE_PXL) { - printk(KERN_INFO "js%d: MadCatz Panther XL at %#x\n", - js_register_device(port, 0, 9, 9, "MadCatz Panther XL", js_as_open, js_as_close), - info->io); - js_as_read(port->info, port->axes, port->buttons); - js_as_pxl_init_corr(port->corr, port->axes); - if (info->an.axes[0] < 254) { - printk(KERN_INFO "js%d: Analog rudder on MadCatz Panther XL\n", - js_register_device(port, 1, 1, 0, "Analog rudder", js_as_open, js_as_close)); - info->rudder = 1; - port->axes[1][0] = info->an.axes[0]; - js_as_rudder_init_corr(port->corr, port->axes); - } - return port; - } - - switch (info->mode) { - case JS_AS_MODE_A3D: name = "FP-Gaming Assasin 3D"; break; - case JS_AS_MODE_PAN: name = "MadCatz Panther"; break; - case JS_AS_MODE_OEM: name = "OEM Assasin 3D"; break; - default: name = "This cannot happen"; break; - } - - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, 0, 2, 3, name, js_as_open, js_as_close), - name, info->io); - - js_as_as_init_corr(port->corr); - - js_as_read(port->info, port->axes, port->buttons); - - for (i = u = 0; i < 4; i++) if (info->an.axes[i] < 254) u |= 1 << i; - - if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0) - return port; - - for (i = 0; i < numdev; i++) - printk(KERN_INFO "js%d: %s on %s\n", - js_register_device(port, i + 1, js_an_axes(i, &info->an), js_an_buttons(i, &info->an), - js_an_name(i, &info->an), js_as_open, js_as_close), - js_an_name(i, &info->an), name); - - js_an_decode(&info->an, port->axes + 1, port->buttons + 1); - js_an_init_corr(&info->an, port->axes + 1, port->corr + 1, 0); - - return port; -} - -#ifndef MODULE -void __init js_as_setup(char *str, int *ints) -{ - int i; - for (i = 0; i <= ints[0] && i < 24; i++) js_as[i] = ints[i+1]; -} -#endif - -#ifdef MODULE -int init_module(void) -#else -int __init js_as_init(void) -#endif -{ - int i; - - if (js_as[0] >= 0) { - for (i = 0; (js_as[i*3] >= 0) && i < 8; i++) - js_as_port = js_as_probe(js_as[i*3], js_as[i*3+1], js_as[i*3+2], js_as_port); - } else { - for (i = 0; js_as_port_list[i]; i++) js_as_port = js_as_probe(js_as_port_list[i], 0, 0, js_as_port); - } - if (js_as_port) return 0; - -#ifdef MODULE - printk(KERN_WARNING "joy-assasin: no joysticks found\n"); -#endif - - return -ENODEV; -} - -#ifdef MODULE -void cleanup_module(void) -{ - int i; - struct js_as_info *info; - - while (js_as_port != NULL) { - for (i = 0; i < js_as_port->ndevs; i++) - if (js_as_port->devs[i] != NULL) - js_unregister_device(js_as_port->devs[i]); - info = js_as_port->info; - release_region(info->io, 1); - js_as_port = js_unregister_port(js_as_port); - } - -} -#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-assassin.c linux/drivers/char/joystick/joy-assassin.c --- v2.3.30/linux/drivers/char/joystick/joy-assassin.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-assassin.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,416 @@ +/* + * joy-assassin.c Version 1.2 + * + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * joysticks using FP-Gaming's Assassin 3D protocol. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define JS_AS_MAX_START 1000 +#define JS_AS_DELAY_READ 3000 +#define JS_AS_MAX_LENGTH 40 + +#define JS_AS_MODE_A3D 1 /* Assassin 3D */ +#define JS_AS_MODE_PAN 2 /* Panther */ +#define JS_AS_MODE_OEM 3 /* Panther OEM version */ +#define JS_AS_MODE_PXL 4 /* Panther XL */ + +MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_PARM(js_as, "2-24i"); + +static int __initdata js_as[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 }; + +static int js_as_port_list[] __initdata = {0x201, 0}; +static struct js_port* js_as_port __initdata = NULL; + +#include "joy-analog.h" + +struct js_as_info { + int io; + char mode; + char rudder; + struct js_an_info an; +}; + +/* + * js_as_read_packet() reads an Assassin 3D packet. + */ + +static int js_as_read_packet(int io, int length, char *data) +{ + unsigned char u, v; + int i; + unsigned int t, p; + unsigned long flags; + + i = 0; + + __save_flags(flags); + __cli(); + + outb(0xff,io); + v = inb(io); + t = p = JS_AS_MAX_START; + + while (t > 0 && i < length) { + t--; + u = v; v = inb(io); + if (~v & u & 0x10) { + data[i++] = v >> 5; + p = t = (p - t) << 3; + } + } + + __restore_flags(flags); + + return i; +} + +/* + * js_as_csum() computes checksum of triplet packet + */ + +static int js_as_csum(char *data, int count) +{ + int i, csum = 0; + for (i = 0; i < count - 2; i++) csum += data[i]; + return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]); +} + +/* + * js_as_read() reads and analyzes A3D joystick data. + */ + +static int js_as_read(void *xinfo, int **axes, int **buttons) +{ + struct js_as_info *info = xinfo; + char data[JS_AS_MAX_LENGTH]; + + switch (info->mode) { + + case JS_AS_MODE_A3D: + case JS_AS_MODE_OEM: + case JS_AS_MODE_PAN: + + if (js_as_read_packet(info->io, 29, data) != 29) return -1; + if (data[0] != info->mode) return -1; + if (js_as_csum(data, 29)) return -1; + + axes[0][0] = ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7); + axes[0][1] = ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7); + + buttons[0][0] = (data[2] << 2) | (data[3] >> 1); + + info->an.axes[0] = ((char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128; + info->an.axes[1] = ((char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128; + info->an.axes[2] = ((char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128; + info->an.axes[3] = ((char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128; + + info->an.buttons = ((data[3] << 3) | data[4]) & 0xf; + + js_an_decode(&info->an, axes + 1, buttons + 1); + + return 0; + + case JS_AS_MODE_PXL: + + if (js_as_read_packet(info->io, 33, data) != 33) return -1; + if (data[0] != info->mode) return -1; + if (js_as_csum(data, 33)) return -1; + + axes[0][0] = ((char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128; + axes[0][1] = ((char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128; + info->an.axes[0] = ((char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128; + axes[0][2] = ((char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128; + + axes[0][3] = ( data[5] & 1) - ((data[5] >> 2) & 1); + axes[0][4] = ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1); + axes[0][5] = ((data[4] >> 1) & 1) - ( data[3] & 1); + axes[0][6] = ((data[4] >> 2) & 1) - ( data[4] & 1); + + axes[0][7] = ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7); + axes[0][8] = ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7); + + buttons[0][0] = (data[2] << 8) | ((data[3] & 6) << 5) | (data[7] << 3) | data[8]; + + if (info->rudder) axes[1][0] = info->an.axes[0]; + + return 0; + } + return -1; +} + +/* + * js_as_open() is a callback from the file open routine. + */ + +static int js_as_open(struct js_dev *jd) +{ + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_as_close() is a callback from the file release routine. + */ + +static int js_as_close(struct js_dev *jd) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_as_pxl_init_corr() initializes the correction values for + * the Panther XL. + */ + +static void __init js_as_pxl_init_corr(struct js_corr **corr, int **axes) +{ + int i; + + for (i = 0; i < 2; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = 0; + corr[0][i].coef[0] = axes[0][i] - 4; + corr[0][i].coef[1] = axes[0][i] + 4; + corr[0][i].coef[2] = (1 << 29) / (127 - 32); + corr[0][i].coef[3] = (1 << 29) / (127 - 32); + } + + corr[0][2].type = JS_CORR_BROKEN; + corr[0][2].prec = 0; + corr[0][2].coef[0] = 127 - 4; + corr[0][2].coef[1] = 128 + 4; + corr[0][2].coef[2] = (1 << 29) / (127 - 6); + corr[0][2].coef[3] = (1 << 29) / (127 - 6); + + for (i = 3; i < 7; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = 0; + corr[0][i].coef[0] = 0; + corr[0][i].coef[1] = 0; + corr[0][i].coef[2] = (1 << 29); + corr[0][i].coef[3] = (1 << 29); + } + + for (i = 7; i < 9; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = -1; + corr[0][i].coef[0] = 0; + corr[0][i].coef[1] = 0; + corr[0][i].coef[2] = (104 << 14); + corr[0][i].coef[3] = (104 << 14); + } +} + +/* + * js_as_as_init_corr() initializes the correction values for + * the Panther and Assassin. + */ + +static void __init js_as_as_init_corr(struct js_corr **corr) +{ + int i; + + for (i = 0; i < 2; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = -1; + corr[0][i].coef[0] = 0; + corr[0][i].coef[1] = 0; + corr[0][i].coef[2] = (104 << 14); + corr[0][i].coef[3] = (104 << 14); + } +} + +/* + * js_as_rudder_init_corr() initializes the correction values for + * the Panther XL connected rudder. + */ + +static void __init js_as_rudder_init_corr(struct js_corr **corr, int **axes) +{ + corr[1][0].type = JS_CORR_BROKEN; + corr[1][0].prec = 0; + corr[1][0].coef[0] = axes[1][0] - (axes[1][0] >> 3); + corr[1][0].coef[1] = axes[1][0] + (axes[1][0] >> 3); + corr[1][0].coef[2] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1); + corr[1][0].coef[3] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1); +} + +/* + * js_as_probe() probes for A3D joysticks. + */ + +static struct js_port __init *js_as_probe(int io, int mask0, int mask1, struct js_port *port) +{ + struct js_as_info iniinfo; + struct js_as_info *info = &iniinfo; + char *name; + char data[JS_AS_MAX_LENGTH]; + unsigned char u; + int i; + int numdev; + + memset(info, 0, sizeof(struct js_as_info)); + + if (io < 0) return port; + + if (check_region(io, 1)) return port; + + i = js_as_read_packet(io, JS_AS_MAX_LENGTH, data); + + printk("%d\n", i); + + if (!i) return port; + if (js_as_csum(data, i)) return port; + + if (data[0] && data[0] <= 4) { + info->mode = data[0]; + info->io = io; + request_region(io, 1, "joystick (assassin)"); + port = js_register_port(port, info, 3, sizeof(struct js_as_info), js_as_read); + info = port->info; + } else { + printk(KERN_WARNING "joy-assassin: unknown joystick device detected " + "(io=%#x, id=%d), contact \n", io, data[0]); + return port; + } + + udelay(JS_AS_DELAY_READ); + + if (info->mode == JS_AS_MODE_PXL) { + printk(KERN_INFO "js%d: MadCatz Panther XL at %#x\n", + js_register_device(port, 0, 9, 9, "MadCatz Panther XL", js_as_open, js_as_close), + info->io); + js_as_read(port->info, port->axes, port->buttons); + js_as_pxl_init_corr(port->corr, port->axes); + if (info->an.axes[0] < 254) { + printk(KERN_INFO "js%d: Analog rudder on MadCatz Panther XL\n", + js_register_device(port, 1, 1, 0, "Analog rudder", js_as_open, js_as_close)); + info->rudder = 1; + port->axes[1][0] = info->an.axes[0]; + js_as_rudder_init_corr(port->corr, port->axes); + } + return port; + } + + switch (info->mode) { + case JS_AS_MODE_A3D: name = "FP-Gaming Assassin 3D"; break; + case JS_AS_MODE_PAN: name = "MadCatz Panther"; break; + case JS_AS_MODE_OEM: name = "OEM Assassin 3D"; break; + default: name = "This cannot happen"; break; + } + + printk(KERN_INFO "js%d: %s at %#x\n", + js_register_device(port, 0, 2, 3, name, js_as_open, js_as_close), + name, info->io); + + js_as_as_init_corr(port->corr); + + js_as_read(port->info, port->axes, port->buttons); + + for (i = u = 0; i < 4; i++) if (info->an.axes[i] < 254) u |= 1 << i; + + if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0) + return port; + + for (i = 0; i < numdev; i++) + printk(KERN_INFO "js%d: %s on %s\n", + js_register_device(port, i + 1, js_an_axes(i, &info->an), js_an_buttons(i, &info->an), + js_an_name(i, &info->an), js_as_open, js_as_close), + js_an_name(i, &info->an), name); + + js_an_decode(&info->an, port->axes + 1, port->buttons + 1); + js_an_init_corr(&info->an, port->axes + 1, port->corr + 1, 0); + + return port; +} + +#ifndef MODULE +int __init js_as_setup(SETUP_PARAM) +{ + int i; + SETUP_PARSE(24); + for (i = 0; i <= ints[0] && i < 24; i++) js_as[i] = ints[i+1]; + return 1; +} +__setup("js_as=", js_as_setup); +#endif + +#ifdef MODULE +int init_module(void) +#else +int __init js_as_init(void) +#endif +{ + int i; + + if (js_as[0] >= 0) { + for (i = 0; (js_as[i*3] >= 0) && i < 8; i++) + js_as_port = js_as_probe(js_as[i*3], js_as[i*3+1], js_as[i*3+2], js_as_port); + } else { + for (i = 0; js_as_port_list[i]; i++) js_as_port = js_as_probe(js_as_port_list[i], 0, 0, js_as_port); + } + if (js_as_port) return 0; + +#ifdef MODULE + printk(KERN_WARNING "joy-assassin: no joysticks found\n"); +#endif + + return -ENODEV; +} + +#ifdef MODULE +void cleanup_module(void) +{ + int i; + struct js_as_info *info; + + while (js_as_port) { + for (i = 0; i < js_as_port->ndevs; i++) + if (js_as_port->devs[i]) + js_unregister_device(js_as_port->devs[i]); + info = js_as_port->info; + release_region(info->io, 1); + js_as_port = js_unregister_port(js_as_port); + } + +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-console.c linux/drivers/char/joystick/joy-console.c --- v2.3.30/linux/drivers/char/joystick/joy-console.c Tue Dec 1 19:05:05 1998 +++ linux/drivers/char/joystick/joy-console.c Tue Dec 7 10:13:11 1999 @@ -1,14 +1,19 @@ /* - * joy-console.c Version 0.11V + * joy-console.c Version 0.14V * - * Copyright (c) 1998 Andree Borrmann + * Copyright (c) 1998 Andree Borrmann + * Copyright (c) 1999 John Dahlstrom + * Copyright (c) 1999 David Kuder + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* * This is a module for the Linux joystick driver, supporting - * console (NES, SNES, Multi1, Multi2, PSX) gamepads connected - * via parallel port. Up to five such controllers can be - * connected to one parallel port. + * console (NES, SNES, N64, Multi1, Multi2, PSX) gamepads + * connected via parallel port. Up to five such controllers + * can be connected to one parallel port. */ /* @@ -25,6 +30,10 @@ * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ #include @@ -36,12 +45,13 @@ #include #include #include +#include -MODULE_AUTHOR("Andree Borrmann "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_console, "2-6i"); -MODULE_PARM(js_console2,"2-6i"); -MODULE_PARM(js_console3,"2-6i"); +MODULE_PARM(js_console_2,"2-6i"); +MODULE_PARM(js_console_3,"2-6i"); #define JS_NO_PAD 0 @@ -51,29 +61,29 @@ #define JS_MULTI_STICK 4 #define JS_MULTI2_STICK 5 #define JS_PSX_PAD 6 - -#define JS_MAX_PAD JS_PSX_PAD +#define JS_N64_PAD 7 +#define JS_N64_PAD_DPP 8 /* DirectPad Pro compatible layout */ + +#define JS_MAX_PAD JS_N64_PAD_DPP struct js_console_info { -#ifdef USE_PARPORT struct pardevice *port; /* parport device */ -#else - int port; /* hw port */ -#endif int pads; /* total number of pads */ + int pad_to_device[5]; /* pad to js device mapping (js0, js1, etc.) */ int snes; /* SNES pads */ int nes; /* NES pads */ + int n64; /* N64 pads */ + int n64_dpp; /* bits indicate N64 pads treated 14 button, 2 axis */ int multi; /* Multi joysticks */ int multi2; /* Multi joysticks with 2 buttons */ - int psx; /* Normal PSX controllers */ - int negcon; /* PSX NEGCON controllers */ + int psx; /* PSX controllers */ }; static struct js_port* js_console_port = NULL; static int js_console[] __initdata = { -1, 0, 0, 0, 0, 0 }; -static int js_console2[] __initdata = { -1, 0, 0, 0, 0, 0 }; -static int js_console3[] __initdata = { -1, 0, 0, 0, 0, 0 }; +static int js_console_2[] __initdata = { -1, 0, 0, 0, 0, 0 }; +static int js_console_3[] __initdata = { -1, 0, 0, 0, 0, 0 }; static int status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 }; @@ -109,7 +119,7 @@ #define JS_SNES_L 10 #define JS_SNES_R 11 -#define JS_NES_POWER 0xf8 +#define JS_NES_POWER 0xfc #define JS_NES_CLOCK 0x01 #define JS_NES_LATCH 0x02 @@ -123,17 +133,99 @@ { int i; - JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK + JS_NES_LATCH, info->port); + JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK | JS_NES_LATCH, info->port); udelay(JS_NES_DELAY * 2); - JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK, info->port); + JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK, info->port); for (i = 0; i < length; i++) { udelay(JS_NES_DELAY); JS_PAR_DATA_OUT(JS_NES_POWER, info->port); data[i] = JS_PAR_STATUS(info->port) ^ ~JS_PAR_STATUS_INVERT; udelay(JS_NES_DELAY); - JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK, info->port); + JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK, info->port); + } +} + +/* + * N64 support. + */ + +#define JS_N64_A 0 +#define JS_N64_B 1 +#define JS_N64_Z 2 +#define JS_N64_START 3 +#define JS_N64_UP 4 +#define JS_N64_DOWN 5 +#define JS_N64_LEFT 6 +#define JS_N64_RIGHT 7 +#define JS_N64_UNUSED1 8 +#define JS_N64_UNUSED2 9 +#define JS_N64_L 10 +#define JS_N64_R 11 +#define JS_N64_CU 12 +#define JS_N64_CD 13 +#define JS_N64_CL 14 +#define JS_N64_CR 15 +#define JS_N64_X 23 /* 16 - 23, signed 8-bit int */ +#define JS_N64_Y 31 /* 24 - 31, signed 8-bit int */ + +#define JS_N64_LENGTH 32 /* N64 bit length, not including stop bit */ +#define JS_N64_REQUEST_LENGTH 37 /* transmit request sequence is 9 bits long */ +#define JS_N64_DELAY 133 /* delay between transmit request, and response ready (us) */ +#define JS_N64_REQUEST 0x1dd1111111ULL /* the request data command (encoded for 000000011) */ +#define JS_N64_DWS 3 /* delay between write segments (required for sound playback because of ISA DMA) */ + /* JS_N64_DWS > 24 is known to fail */ +#define JS_N64_POWER_W 0xe2 /* power during write (transmit request) */ +#define JS_N64_POWER_R 0xfd /* power during read */ +#define JS_N64_OUT 0x1d /* output bits to the 4 pads */ + /* Reading the main axes of any N64 pad is known to fail if the corresponding bit */ + /* in JS_N64_OUT is pulled low on the output port (by any routine) for more */ + /* than 0.123 consecutive ms */ +#define JS_N64_CLOCK 0x02 /* clock bits for read */ + +/* + * js_n64_read_packet() reads an N64 packet. + * Each pad uses one bit per byte. So all pads connected to this port are read in parallel. + */ + +static void js_n64_read_packet(struct js_console_info *info, unsigned char *data) +{ + int i; + unsigned long flags; + +/* + * Request the pad to transmit data + */ + + save_flags(flags); + cli(); + for (i = 0; i < JS_N64_REQUEST_LENGTH; i++) { + JS_PAR_DATA_OUT(JS_N64_POWER_W | ((JS_N64_REQUEST >> i) & 1 ? JS_N64_OUT : 0), info->port); + udelay(JS_N64_DWS); } + restore_flags(flags); + +/* + * Wait for the pad response to be loaded into the 33-bit register of the adapter + */ + + udelay(JS_N64_DELAY); + +/* + * Grab data (ignoring the last bit, which is a stop bit) + */ + + for (i = 0; i < JS_N64_LENGTH; i++) { + JS_PAR_DATA_OUT(JS_N64_POWER_R, info->port); + data[i] = JS_PAR_STATUS(info->port); + JS_PAR_DATA_OUT(JS_N64_POWER_R | JS_N64_CLOCK, info->port); + } + +/* + * We must wait ~0.2 ms here for the controller to reinitialize before the next read request. + * No worries as long as js_console_read is polled less frequently than this. + */ + } /* @@ -161,7 +253,9 @@ for (i = 0; i < length; i++) { JS_PAR_DATA_OUT(~(1 << i), info->port); data[i] = JS_PAR_STATUS(info->port) ^ ~JS_PAR_STATUS_INVERT; + printk(" %d", data[i]); } + printk("\n"); } /* @@ -169,27 +263,28 @@ */ #define JS_PSX_DELAY 10 +#define JS_PSX_LENGTH 8 /* talk to the controller in bytes */ -#define JS_PSX_LENGTH 8 - -#define JS_PSX_NORMAL 0x41 -#define JS_PSX_NEGCON 0x23 -#define JS_PSX_MOUSE 0x12 - -#define JS_PSX_SELBUT 0x01 +#define JS_PSX_NORMAL 0x41 /* Standard Digital controller */ +#define JS_PSX_NEGCON 0x23 /* NegCon pad */ +#define JS_PSX_MOUSE 0x12 /* PSX Mouse */ +#define JS_PSX_ANALOGR 0x73 /* Analog controller in Red mode */ +#define JS_PSX_ANALOGG 0x53 /* Analog controller in Green mode */ + +#define JS_PSX_JOYR 0x02 /* These are for the Analog/Dual Shock controller in RED mode */ +#define JS_PSX_JOYL 0x04 /* I'm not sure the exact purpose of these but its in the docs */ +#define JS_PSX_SELBUT 0x01 /* Standard buttons on almost all PSX controllers. */ #define JS_PSX_START 0x08 -#define JS_PSX_UP 0x10 +#define JS_PSX_UP 0x10 /* Digital direction pad */ #define JS_PSX_RIGHT 0x20 #define JS_PSX_DOWN 0x40 #define JS_PSX_LEFT 0x80 -#define JS_PSX_CLOCK 0x01 -#define JS_PSX_COMMAND 0x02 -#define JS_PSX_POWER 0xf8 -#define JS_PSX_NOPOWER 0x04 -#define JS_PSX_SELECT 0x08 - -#define JS_PSX_CTRL_OUT(X,Y) JS_PAR_CTRL_OUT((X)^0x0f, Y) +#define JS_PSX_CLOCK 0x04 /* Pin 3 */ +#define JS_PSX_COMMAND 0x01 /* Pin 1 */ +#define JS_PSX_POWER 0xf8 /* Pins 5-9 */ +#define JS_PSX_SELECT 0x02 /* Pin 2 */ +#define JS_PSX_NOPOWER 0x04 /* * js_psx_command() writes 8bit command and reads 8bit data from @@ -202,11 +297,11 @@ cmd = (b&1)?JS_PSX_COMMAND:0; for (i=0; i<8; i++) { - JS_PSX_CTRL_OUT(cmd, info->port); + JS_PAR_DATA_OUT(cmd | JS_PSX_POWER, info->port); udelay(JS_PSX_DELAY); ret |= ((JS_PAR_STATUS(info->port) ^ JS_PAR_STATUS_INVERT ) & info->psx) ? (1<port); + JS_PAR_DATA_OUT(cmd | JS_PSX_CLOCK | JS_PSX_POWER, info->port); udelay(JS_PSX_DELAY); b >>= 1; } @@ -228,7 +323,7 @@ JS_PAR_DATA_OUT(JS_PSX_POWER, info->port); - JS_PSX_CTRL_OUT(JS_PSX_CLOCK | JS_PSX_SELECT, info->port); /* Select pad */ + JS_PAR_DATA_OUT(JS_PSX_CLOCK | JS_PSX_SELECT | JS_PSX_POWER, info->port); /* Select pad */ udelay(JS_PSX_DELAY*2); js_psx_command(info, 0x01); /* Access pad */ ret = js_psx_command(info, 0x42); /* Get device id */ @@ -237,7 +332,7 @@ data[i]=js_psx_command(info, 0); else ret = -1; - JS_PSX_CTRL_OUT(JS_PSX_SELECT | JS_PSX_CLOCK, info->port); + JS_PAR_DATA_OUT(JS_PSX_SELECT | JS_PSX_CLOCK | JS_PSX_POWER, info->port); __restore_flags(flags); return ret; @@ -248,14 +343,14 @@ * js_console_read() reads and analyzes console pads data. */ -#define JS_MAX_LENGTH JS_SNES_LENGTH +#define JS_MAX_LENGTH JS_N64_LENGTH static int js_console_read(void *xinfo, int **axes, int **buttons) { struct js_console_info *info = xinfo; unsigned char data[JS_MAX_LENGTH]; - int i, s; + int i, j, s; int n = 0; /* @@ -268,24 +363,68 @@ for (i = 0; i < 5; i++) { s = status_bit[i]; + n = info->pad_to_device[i]; if (info->nes & s) { axes[n][0] = (data[JS_SNES_RIGHT]&s?1:0) - (data[JS_SNES_LEFT]&s?1:0); axes[n][1] = (data[JS_SNES_DOWN] &s?1:0) - (data[JS_SNES_UP] &s?1:0); - buttons[n][0] = ((data[JS_NES_A] &s)?1:0) | ((data[JS_NES_B] &s)?2:0) - | ((data[JS_NES_START]&s)?4:0) | ((data[JS_NES_SELECT]&s)?8:0); - - n++; + buttons[n][0] = (data[JS_NES_A] &s?1:0) | (data[JS_NES_B] &s?2:0) + | (data[JS_NES_START]&s?4:0) | (data[JS_NES_SELECT]&s?8:0); } else if (info->snes & s) { axes[n][0] = (data[JS_SNES_RIGHT]&s?1:0) - (data[JS_SNES_LEFT]&s?1:0); axes[n][1] = (data[JS_SNES_DOWN] &s?1:0) - (data[JS_SNES_UP] &s?1:0); - buttons[n][0] = ((data[JS_SNES_A] &s)?0x01:0) | ((data[JS_SNES_B] &s)?0x02:0) - | ((data[JS_SNES_X] &s)?0x04:0) | ((data[JS_SNES_Y] &s)?0x08:0) - | ((data[JS_SNES_L] &s)?0x10:0) | ((data[JS_SNES_R] &s)?0x20:0) - | ((data[JS_SNES_START]&s)?0x40:0) | ((data[JS_SNES_SELECT]&s)?0x80:0); - n++; + buttons[n][0] = (data[JS_SNES_A] &s?0x01:0) | (data[JS_SNES_B] &s?0x02:0) + | (data[JS_SNES_X] &s?0x04:0) | (data[JS_SNES_Y] &s?0x08:0) + | (data[JS_SNES_L] &s?0x10:0) | (data[JS_SNES_R] &s?0x20:0) + | (data[JS_SNES_START]&s?0x40:0) | (data[JS_SNES_SELECT]&s?0x80:0); + } + } + } + +/* + * N64 pads + */ + + if (info->n64) { + if ( (info->nes || info->snes) && (info->n64 & status_bit[0]) ) { + /* SNES/NES compatibility */ + udelay(240); /* 200 us delay + 20% tolerance */ + } + + js_n64_read_packet(info, data); + + for (i = 0; i < 5; i++) { + s = status_bit[i]; + n = info->pad_to_device[i]; + if (info->n64 & s & ~(data[JS_N64_UNUSED1] | data[JS_N64_UNUSED2])) { + + buttons[n][0] = ( ((data[JS_N64_A]&s) ? 0x01:0) | ((data[JS_N64_B] & s ) ? 0x02:0) + | ((data[JS_N64_Z]&s) ? 0x04:0) | ((data[JS_N64_L] & s ) ? 0x08:0) + | ((data[JS_N64_R]&s) ? 0x10:0) | ((data[JS_N64_START]&s)? 0x20:0) + | ((data[JS_N64_CU]&s)? 0x40:0) | ((data[JS_N64_CR]&s) ? 0x80:0) + | ((data[JS_N64_CD]&s)?0x100:0) | ((data[JS_N64_CL]&s) ?0x200:0) ); + + if (info->n64_dpp & s) { + buttons[n][0] |= ((data[JS_N64_LEFT]&s) ? 0x400:0) | ((data[JS_N64_UP] & s)? 0x800:0) + |((data[JS_N64_RIGHT]&s)?0x1000:0) | ((data[JS_N64_DOWN]&s)?0x2000:0); + } else { + axes[n][2] = (data[JS_N64_RIGHT]&s?1:0) - (data[JS_N64_LEFT]&s?1:0); + axes[n][3] = (data[JS_N64_DOWN] &s?1:0) - (data[JS_N64_UP] &s?1:0); + } + + /* build int from bits of signed 8-bit int's */ + j = 7; + axes[n][0] = (data[JS_N64_X - j] & s) ? ~0x7f : 0; + axes[n][1] = (data[JS_N64_Y - j] & s) ? ~0x7f : 0; + while ( j-- > 0 ) { + axes[n][0] |= (data[JS_N64_X - j] & s) ? (1 << j) : 0; + axes[n][1] |= (data[JS_N64_Y - j] & s) ? (1 << j) : 0; + } + /* flip Y-axis for conformity */ + axes[n][1] = -axes[n][1]; + } } } @@ -300,21 +439,18 @@ for (i = 0; i < 5; i++) { s = status_bit[i]; + n = info->pad_to_device[i]; if (info->multi & s) { axes[n][0] = (data[JS_MULTI_RIGHT]&s?1:0) - (data[JS_MULTI_LEFT]&s?1:0); axes[n][1] = (data[JS_MULTI_DOWN] &s?1:0) - (data[JS_MULTI_UP] &s?1:0); buttons[n][0] = (data[JS_MULTI_BUTTON]&s)?1:0; - - n++; } else if (info->multi2 & s) { axes[n][0] = (data[JS_MULTI_RIGHT]&s?1:0) - (data[JS_MULTI_LEFT]&s?1:0); axes[n][1] = (data[JS_MULTI_DOWN] &s?1:0) - (data[JS_MULTI_UP] &s?1:0); buttons[n][0] = (data[JS_MULTI_BUTTON]&s)?1:0 | (data[JS_MULTI_BUTTON2]&s)?2:0; - - n++; } } } @@ -323,18 +459,44 @@ * PSX controllers */ - if (info->psx && (js_psx_read_packet(info, 2, data) == JS_PSX_NORMAL)) { /* FIXME? >1 PSX pads? */ + if (info->psx) { + + for ( i = 0; i < 5; i++ ) + if ( info->psx & status_bit[i] ) { + n = info->pad_to_device[i]; + break; + } + + buttons[n][0] = 0; + + switch (js_psx_read_packet(info, 6, data)) { - axes[n][0] = (data[0]&JS_PSX_RIGHT?0:1) - (data[0]&JS_PSX_LEFT?0:1); - axes[n][1] = (data[0]&JS_PSX_DOWN ?0:1) - (data[0]&JS_PSX_UP ?0:1); + case JS_PSX_ANALOGR: - buttons[n][0] = ((~data[1]&0xf)<<4) | ((~data[1]&0xf0)>>4) | - (data[0]&JS_PSX_START?0:0x200) | (data[0]&JS_PSX_SELBUT?0:0x100); + buttons[n][0] |= (data[0]&JS_PSX_JOYL?0:0x800) | (data[0]&JS_PSX_JOYR?0:0x400); - n++; + case JS_PSX_ANALOGG: + + axes[n][2] = data[2]; + axes[n][3] = data[3]; + axes[n][4] = data[4]; + axes[n][5] = data[5]; + + case JS_PSX_NORMAL: + case JS_PSX_NEGCON: + + axes[n][0] = (data[0]&JS_PSX_RIGHT?0:1) - (data[0]&JS_PSX_LEFT?0:1); + axes[n][1] = (data[0]&JS_PSX_DOWN ?0:1) - (data[0]&JS_PSX_UP ?0:1); + + buttons[n][0] |= ((~data[1]&0xf)<<4) | ((~data[1]&0xf0)>>4) | + (data[0]&JS_PSX_START?0:0x200) | (data[0]&JS_PSX_SELBUT?0:0x100); + + break; + + } } - return -(n != info->pads); + return 0; } /* @@ -343,10 +505,8 @@ int js_console_open(struct js_dev *dev) { -#ifdef USE_PARPORT struct js_console_info *info = dev->port->info; if (!MOD_IN_USE && parport_claim(info->port)) return -EBUSY; -#endif MOD_INC_USE_COUNT; return 0; } @@ -357,13 +517,9 @@ int js_console_close(struct js_dev *dev) { -#ifdef USE_PARPORT struct js_console_info *info = dev->port->info; -#endif MOD_DEC_USE_COUNT; -#ifdef USE_PARPORT if (!MOD_IN_USE) parport_release(info->port); -#endif return 0; } @@ -373,16 +529,12 @@ struct js_console_info *info; int i; - while (js_console_port != NULL) { + while (js_console_port) { for (i = 0; i < js_console_port->ndevs; i++) - if (js_console_port->devs[i] != NULL) + if (js_console_port->devs[i]) js_unregister_device(js_console_port->devs[i]); info = js_console_port->info; -#ifdef USE_PARPORT parport_unregister_device(info->port); -#else - release_region(info->port, 3); -#endif js_console_port = js_unregister_port(js_console_port); } } @@ -393,7 +545,7 @@ * console gamepads. */ -static void __init js_console_init_corr(int num_axes, struct js_corr *corr) +static void __init js_console_init_corr(int num_axes, int type, struct js_corr *corr) { int i; @@ -405,6 +557,28 @@ corr[i].coef[2] = (1 << 29); corr[i].coef[3] = (1 << 29); } + + if (type == JS_N64_PAD || type == JS_N64_PAD_DPP) { + for (i = 0; i < 2; i++) { + corr[i].type = JS_CORR_BROKEN; + corr[i].prec = 0; + corr[i].coef[0] = 0; + corr[i].coef[1] = 0; + corr[i].coef[2] = (1 << 22); + corr[i].coef[3] = (1 << 22); + } + } + + if (type == JS_PSX_ANALOGG || type == JS_PSX_ANALOGR) { + for (i = 2; i < 6; i++) { + corr[i].type = JS_CORR_BROKEN; + corr[i].prec = 0; + corr[i].coef[0] = 127 - 2; + corr[i].coef[1] = 128 + 2; + corr[i].coef[2] = (1 << 29) / (127 - 4); + corr[i].coef[3] = (1 << 29) / (127 - 4); + } + } } /* @@ -415,45 +589,40 @@ static struct js_port __init *js_console_probe(int *config, struct js_port *port) { char *name[5]; - int i, psx, axes[5], buttons[5]; + int i, psx, axes[5], buttons[5], type[5]; unsigned char data[2]; /* used for PSX probe */ struct js_console_info info; + struct parport *pp; memset(&info, 0, sizeof(struct js_console_info)); if (config[0] < 0) return port; -#ifdef USE_PARPORT - { - struct parport *pp; - - if (config[0] > 0x10) - for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next); - else - for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--; - - if (pp == NULL) { - printk(KERN_ERR "joy-console: no such parport\n"); - return port; - } + if (config[0] > 0x10) + for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next); + else + for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--; - info.port = parport_register_device(pp, "joystick (console)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); - if (!info.port) - return port; + if (!pp) { + printk(KERN_ERR "joy-console: no such parport\n"); + return port; } + info.port = parport_register_device(pp, "joystick (console)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); + if (!info.port) + return port; + if (parport_claim(info.port)) { parport_unregister_device(info.port); /* port currently not available ... */ return port; } -#else - info.port = config[0]; - if (check_region(info.port, 3)) return port; - request_region(info.port, 3, "joystick (console pad)"); -#endif - for (i = 0; i < 5; i++) + for (i = 0; i < 5; i++) { + + type[info.pads] = config[i+1]; + info.pad_to_device[i] = info.pads; + switch(config[i+1]) { case JS_NO_PAD: @@ -478,6 +647,23 @@ info.pads++; break; + case JS_N64_PAD: + axes[info.pads] = 4; + buttons[info.pads] = 10; + name[info.pads] = "N64 pad"; + info.n64 |= status_bit[i]; + info.pads++; + break; + + case JS_N64_PAD_DPP: + axes[info.pads] = 2; + buttons[info.pads] = 14; + name[info.pads] = "N64 pad (DPP mode)"; + info.n64 |= status_bit[i]; + info.n64_dpp |= status_bit[i]; + info.pads++; + break; + case JS_MULTI_STICK: axes[info.pads] = 2; @@ -497,31 +683,58 @@ break; case JS_PSX_PAD: - + info.psx |= status_bit[i]; psx = js_psx_read_packet(&info, 2, data); psx = js_psx_read_packet(&info, 2, data); info.psx &= ~status_bit[i]; + type[i] = psx; + switch(psx) { case JS_PSX_NORMAL: axes[info.pads] = 2; buttons[info.pads] = 10; - name[info.pads] = "PSX controller"; + name[info.pads] = "PSX pad"; info.psx |= status_bit[i]; info.pads++; break; + + case JS_PSX_ANALOGR: + axes[info.pads] = 6; + buttons[info.pads] = 12; + name[info.pads] = "Analog Red PSX pad"; + info.psx |= status_bit[i]; + info.pads++; + break; + + case JS_PSX_ANALOGG: + axes[info.pads] = 6; + buttons[info.pads] = 10; + name[info.pads] = "Analog Green PSX pad"; + info.psx |= status_bit[i]; + info.pads++; + break; + case JS_PSX_NEGCON: - printk(KERN_WARNING "joy-console: NegCon not yet supported...\n"); + axes[info.pads] = 2; + buttons[info.pads] = 10; + name[info.pads] = "NegCon PSX pad"; + info.psx |= status_bit[i]; + info.pads++; break; + case JS_PSX_MOUSE: - printk(KERN_WARNING "joy-console: PSX mouse not supported...\n"); + printk(KERN_WARNING "joy-psx: PSX mouse not supported...\n"); break; + case -1: - printk(KERN_ERR "joy-console: no PSX controller found...\n"); + printk(KERN_ERR "joy-psx: no PSX controller found...\n"); break; + default: - printk(KERN_WARNING "joy-console: unknown PSX controller 0x%x\n", psx); + printk(KERN_WARNING "joy-psx: PSX controller unknown: 0x%x," + " please report to .\n", psx); } break; @@ -529,52 +742,53 @@ printk(KERN_WARNING "joy-console: pad type %d unknown\n", config[i+1]); } + } if (!info.pads) { -#ifdef USE_PARPORT parport_release(info.port); parport_unregister_device(info.port); -#else - release_region(info.port, 3); -#endif return port; } port = js_register_port(port, &info, info.pads, sizeof(struct js_console_info), js_console_read); for (i = 0; i < info.pads; i++) { -#ifdef USE_PARPORT printk(KERN_INFO "js%d: %s on %s\n", js_register_device(port, i, axes[i], buttons[i], name[i], js_console_open, js_console_close), name[i], info.port->port->name); -#else - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, i, axes[i], buttons[i], name[i], js_console_open, js_console_close), - name[i], info.port); -#endif - js_console_init_corr(axes[i], port->corr[i]); + js_console_init_corr(axes[i], type[i], port->corr[i]); } -#ifdef USE_PARPORT parport_release(info.port); -#endif return port; } #ifndef MODULE -void __init js_console_setup(char *str, int *ints) +int __init js_console_setup(SETUP_PARAM) { int i; - - if (!strcmp(str,"js_console")) - for (i = 0; i <= ints[0] && i < 6; i++) js_console[i] = ints[i+1]; - if (!strcmp(str,"js_console2")) - for (i = 0; i <= ints[0] && i < 6; i++) js_console2[i] = ints[i+1]; - if (!strcmp(str,"js_console3")) - for (i = 0; i <= ints[0] && i < 6; i++) js_console3[i] = ints[i+1]; - + SETUP_PARSE(6); + for (i = 0; i <= ints[0] && i < 6; i++) js_console[i] = ints[i+1]; + return 1; } +int __init js_console_setup_2(SETUP_PARAM) +{ + int i; + SETUP_PARSE(6); + for (i = 0; i <= ints[0] && i < 6; i++) js_console_2[i] = ints[i+1]; + return 1; +} +int __init js_console_setup_3(SETUP_PARAM) +{ + int i; + SETUP_PARSE(6); + for (i = 0; i <= ints[0] && i < 6; i++) js_console_3[i] = ints[i+1]; + return 1; +} +__setup("js_console=", js_console_setup); +__setup("js_console_2=", js_console_setup_2); +__setup("js_console_3=", js_console_setup_3); #endif #ifdef MODULE @@ -584,8 +798,8 @@ #endif { js_console_port = js_console_probe(js_console, js_console_port); - js_console_port = js_console_probe(js_console2, js_console_port); - js_console_port = js_console_probe(js_console3, js_console_port); + js_console_port = js_console_probe(js_console_2, js_console_port); + js_console_port = js_console_probe(js_console_3, js_console_port); if (js_console_port) return 0; diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-creative.c linux/drivers/char/joystick/joy-creative.c --- v2.3.30/linux/drivers/char/joystick/joy-creative.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-creative.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,287 @@ +/* + * joy-creative.c Version 1.2 + * + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * Creative Labs Blaster gamepad family. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define JS_CR_MAX_STROBE 100 /* 100 us max wait for first strobe */ +#define JS_CR_LENGTH 36 + +#define JS_CR_MODE_BGPC 8 + +static int js_cr_port_list[] __initdata = {0x201, 0}; +static struct js_port* js_cr_port __initdata = NULL; + +struct js_cr_info { + int io; + unsigned char mode[2]; +}; + +/* + * js_cr_read_packet() reads a Blaster gamepad packet. + */ + +static int js_cr_read_packet(int io, unsigned int *data) +{ + unsigned long flags; + unsigned char u, v, w; + __u64 buf[2]; + int r[2], t[2], p[2]; + int i, j, ret; + + for (i = 0; i < 2; i++); { + r[i] = buf[i] = 0; + p[i] = t[i] = JS_CR_MAX_STROBE; + p[i] += JS_CR_MAX_STROBE; + } + + __save_flags(flags); + __cli(); + + u = inb(io); + + do { + t[0]--; t[1]--; + v = inb(io); + for (i = 0, w = u ^ v; i < 2 && w; i++, w >>= 2) + if (w & 0x30) { + if ((w & 0x30) < 0x30 && r[i] < JS_CR_LENGTH && t[i] > 0) { + buf[i] |= (__u64)((w >> 5) & 1) << r[i]++; + p[i] = t[i] = (p[i] - t[i]) << 1; + u = v; + } else t[i] = 0; + } + } while (t[0] > 0 || t[1] > 0); + + __restore_flags(flags); + + + ret = 0; + + for (i = 0; i < 2; i++) { + + if (r[i] != JS_CR_LENGTH) continue; + + for (j = 0; j < JS_CR_LENGTH && (buf[i] & 0x04104107f) ^ 0x041041040; j++) + buf[i] = (buf[i] >> 1) | ((__u64)(buf[i] & 1) << (JS_CR_LENGTH - 1)); + + if (j < JS_CR_LENGTH) ret |= (1 << i); + + data[i] = ((buf[i] >> 7) & 0x000001f) | ((buf[i] >> 8) & 0x00003e0) + | ((buf[i] >> 9) & 0x0007c00) | ((buf[i] >> 10) & 0x00f8000) + | ((buf[i] >> 11) & 0x1f00000); + + } + + return ret; +} + +/* + * js_cr_read() reads and analyzes Blaster gamepad data. + */ + +static int js_cr_read(void *xinfo, int **axes, int **buttons) +{ + struct js_cr_info *info = xinfo; + unsigned int data[2]; + int i, r; + + if (!(r = js_cr_read_packet(info->io, data))) + return -1; + + for (i = 0; i < 2; i++) + if (r & (1 << i)) { + switch (info->mode[i]) { + + case JS_CR_MODE_BGPC: + + axes[i][0] = ((data[i] >> 4) & 1) - ((data[i] >> 3) & 1); + axes[i][1] = ((data[i] >> 2) & 1) - ((data[i] >> 1) & 1); + + buttons[i][0] = ((data[i] >> 12) & 0x007) | ((data[i] >> 6) & 0x038) + | ((data[i] >> 1) & 0x0c0) | ((data[i] >> 7) & 0x300) + | ((data[i] << 5) & 0xc00); + + break; + + default: + break; + + } + } + + return 0; +} + +/* + * js_cr_open() is a callback from the file open routine. + */ + +static int js_cr_open(struct js_dev *jd) +{ + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_cr_close() is a callback from the file release routine. + */ + +static int js_cr_close(struct js_dev *jd) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_cr_init_corr() initializes correction values of + * Blaster gamepads. + */ + +static void __init js_cr_init_corr(int mode, struct js_corr *corr) +{ + int i; + + switch (mode) { + + case JS_CR_MODE_BGPC: + + for (i = 0; i < 2; i++) { + corr[i].type = JS_CORR_BROKEN; + corr[i].prec = 0; + corr[i].coef[0] = 0; + corr[i].coef[1] = 0; + corr[i].coef[2] = (1 << 29); + corr[i].coef[3] = (1 << 29); + } + + break; + + } +} + +/* + * js_cr_probe() probes for Blaster gamepads. + */ + +static struct js_port __init *js_cr_probe(int io, struct js_port *port) +{ + struct js_cr_info info; + char *names[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Blaster GamePad Cobra" }; + char axes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2 }; + char buttons[] = { 0, 0, 0, 0, 0, 0, 0, 0, 12 }; + unsigned int data[2]; + int i, r; + + if (check_region(io, 1)) return port; + + info.mode[0] = info.mode[1] = 0; + + if (!(r = js_cr_read_packet(io, data))) + return port; + + for (i = 0; i < 2; i++) { + if (r & (1 << i)) { + if (~data[i] & 1) { + info.mode[i] = JS_CR_MODE_BGPC; + } else { + info.mode[i] = (data[i] >> 2) & 7; + } + if (!names[info.mode[i]]) { + printk(KERN_WARNING "joy-creative: Unknown Creative device %d at %#x\n", + info.mode[i], io); + info.mode[i] = 0; + } + } + } + + if (!info.mode[0] && !info.mode[1]) return port; + + info.io = io; + + request_region(io, 1, "joystick (creative)"); + port = js_register_port(port, &info, 2, sizeof(struct js_cr_info), js_cr_read); + + for (i = 0; i < 2; i++) + if (info.mode[i]) { + printk(KERN_INFO "js%d: %s at %#x\n", + js_register_device(port, i, axes[info.mode[i]], buttons[info.mode[i]], + names[info.mode[i]], js_cr_open, js_cr_close), + names[info.mode[i]], io); + js_cr_init_corr(info.mode[i], port->corr[i]); + } + + return port; +} + +#ifdef MODULE +int init_module(void) +#else +int __init js_cr_init(void) +#endif +{ + int *p; + + for (p = js_cr_port_list; *p; p++) js_cr_port = js_cr_probe(*p, js_cr_port); + if (js_cr_port) return 0; + +#ifdef MODULE + printk(KERN_WARNING "joy-creative: no joysticks found\n"); +#endif + + return -ENODEV; +} + +#ifdef MODULE +void cleanup_module(void) +{ + int i; + struct js_cr_info *info; + + while (js_cr_port) { + for (i = 0; i < js_cr_port->ndevs; i++) + if (js_cr_port->devs[i]) + js_unregister_device(js_cr_port->devs[i]); + info = js_cr_port->info; + release_region(info->io, 1); + js_cr_port = js_unregister_port(js_cr_port); + } +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-db9.c linux/drivers/char/joystick/joy-db9.c --- v2.3.30/linux/drivers/char/joystick/joy-db9.c Thu Jul 1 14:22:57 1999 +++ linux/drivers/char/joystick/joy-db9.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,10 @@ /* - * joy-db9.c Version 0.5V + * joy-db9.c Version 0.6V * - * Copyright (c) 1998 Andree Borrmann + * Copyright (c) 1998 Andree Borrmann + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -24,6 +27,10 @@ * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ #include @@ -35,8 +42,9 @@ #include #include #include +#include -MODULE_AUTHOR("Andree Borrmann "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_db9, "2i"); MODULE_PARM(js_db9_2, "2i"); MODULE_PARM(js_db9_3, "2i"); @@ -48,7 +56,8 @@ #define JS_GENESIS6_PAD 0x06 #define JS_SATURN_PAD 0x07 #define JS_MULTI_0802 0x08 -#define JS_MAX_PAD 0x09 +#define JS_MULTI_0802_2 0x09 +#define JS_MAX_PAD 0x0A #define JS_DB9_UP 0x01 #define JS_DB9_DOWN 0x02 @@ -59,8 +68,8 @@ #define JS_DB9_FIRE3 0x40 #define JS_DB9_FIRE4 0x80 -#define JS_DB9_NORMAL 0x22 -#define JS_DB9_NOSELECT 0x20 +#define JS_DB9_NORMAL 0x2a +#define JS_DB9_NOSELECT 0x28 #define JS_DB9_SATURN0 0x20 #define JS_DB9_SATURN1 0x22 @@ -76,11 +85,7 @@ static int js_db9_3[] __initdata = { -1, 0 }; struct js_db9_info { -#ifdef USE_PARPORT struct pardevice *port; /* parport device */ -#else - int port; /* hw port */ -#endif int mode; /* pad mode */ }; @@ -95,6 +100,15 @@ switch(info->mode) { + case JS_MULTI_0802_2: + + data = JS_PAR_DATA_IN(info->port) >> 3; + + axes[1][1] = (data&JS_DB9_DOWN ?0:1) - (data&JS_DB9_UP ?0:1); + axes[1][0] = (data&JS_DB9_RIGHT?0:1) - (data&JS_DB9_LEFT?0:1); + + buttons[1][0] = (data&JS_DB9_FIRE1?0:1); + case JS_MULTI_0802: data = JS_PAR_STATUS(info->port) >> 3; @@ -185,11 +199,12 @@ udelay(JS_GENESIS6_DELAY); JS_PAR_CTRL_OUT(JS_DB9_NOSELECT, info->port); /* 3 */ udelay(JS_GENESIS6_DELAY); - JS_PAR_CTRL_OUT(JS_DB9_NORMAL, info->port); data=JS_PAR_DATA_IN(info->port); - buttons[0][0] |= (data&JS_DB9_LEFT?0:0x10) | (data&JS_DB9_DOWN?0:0x20) | (data&JS_DB9_UP?0:0x40); + buttons[0][0] |= (data&JS_DB9_LEFT?0:0x10) | (data&JS_DB9_DOWN ?0:0x20) | + (data&JS_DB9_UP ?0:0x40) | (data&JS_DB9_RIGHT?0:0x80); + JS_PAR_CTRL_OUT(JS_DB9_NORMAL, info->port); udelay(JS_GENESIS6_DELAY); JS_PAR_CTRL_OUT(JS_DB9_NOSELECT, info->port); /* 4 */ udelay(JS_GENESIS6_DELAY); @@ -236,11 +251,11 @@ struct js_db9_info *info = dev->port->info; if (!MOD_IN_USE) { -#ifdef USE_PARPORT if (parport_claim(info->port)) return -EBUSY; -#endif - JS_PAR_ECTRL_OUT(0x35,info->port); /* enable PS/2 mode: */ + JS_PAR_DATA_OUT(0xff, info->port); + if (info->mode != JS_MULTI_0802) + JS_PAR_ECTRL_OUT(0x35,info->port); /* enable PS/2 mode: */ JS_PAR_CTRL_OUT(JS_DB9_NORMAL,info->port); /* reverse direction, enable Select signal */ } @@ -260,12 +275,11 @@ if (!MOD_IN_USE) { - JS_PAR_CTRL_OUT(0x00,info->port); /* normal direction */ - JS_PAR_ECTRL_OUT(0x15,info->port); /* enable normal mode */ + JS_PAR_CTRL_OUT(0x00,info->port); /* normal direction */ + if (info->mode != JS_MULTI_0802) + JS_PAR_ECTRL_OUT(0x15,info->port); /* enable normal mode */ -#ifdef USE_PARPORT parport_release(info->port); -#endif } return 0; } @@ -274,16 +288,15 @@ void cleanup_module(void) { struct js_db9_info *info; + int i; - while (js_db9_port != NULL) { - js_unregister_device(js_db9_port->devs[0]); + while (js_db9_port) { info = js_db9_port->info; -#ifdef USE_PARPORT + + for (i = 0; i < js_db9_port->ndevs; i++) + if (js_db9_port->devs[i]) + js_unregister_device(js_db9_port->devs[i]); parport_unregister_device(info->port); -#else - release_region(info->port, 3); - release_region(info->port+0x402, 1); -#endif js_db9_port = js_unregister_port(js_db9_port); } @@ -295,17 +308,17 @@ * db9 gamepads. */ -static void __init js_db9_init_corr(struct js_corr **corr) +static void __init js_db9_init_corr(struct js_corr *corr) { int i; for (i = 0; i < 2; i++) { - corr[0][i].type = JS_CORR_BROKEN; - corr[0][i].prec = 0; - corr[0][i].coef[0] = 0; - corr[0][i].coef[1] = 0; - corr[0][i].coef[2] = (1 << 29); - corr[0][i].coef[3] = (1 << 29); + corr[i].type = JS_CORR_BROKEN; + corr[i].prec = 0; + corr[i].coef[0] = 0; + corr[i].coef[1] = 0; + corr[i].coef[2] = (1 << 29); + corr[i].coef[3] = (1 << 29); } } @@ -316,75 +329,76 @@ static struct js_port __init *js_db9_probe(int *config, struct js_port *port) { struct js_db9_info info; - char buttons[JS_MAX_PAD] = {0,1,2,4,0,6,7,8,1}; + struct parport *pp; + int i; + char buttons[JS_MAX_PAD] = {0,1,2,4,0,6,8,8,1,1}; char *name[JS_MAX_PAD] = {NULL, "Multisystem joystick", "Multisystem joystick (2 fire)", "Genesis pad", - NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick"}; + NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick", + "Multisystem (0.8.0.2-dual) joystick"}; if (config[0] < 0) return port; if (config[1] < 0 || config[1] >= JS_MAX_PAD || !name[config[1]]) return port; -#ifdef USE_PARPORT - { - struct parport *pp; + info.mode = config[1]; - if (config[0] > 0x10) - for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next); - else - for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--; - - if (pp == NULL) { - printk(KERN_ERR "joy-db9: no such parport\n"); - return port; - } - - if (!(pp->modes & PARPORT_MODE_TRISTATE)) { - printk(KERN_ERR "js-db9: specified parport is not bidirectional\n"); - return port; - } - - info.port = parport_register_device(pp, "joystick (db9)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); - if (!info.port) - return port; + if (config[0] > 0x10) + for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next); + else + for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--; + + if (!pp) { + printk(KERN_ERR "joy-db9: no such parport\n"); + return port; } -#else - info.port = config[0]; - if (check_region(info.port, 3) || check_region(info.port+0x402,1)) return port; - request_region(info.port, 3, "joystick (db9)"); - request_region(info.port+0x402, 1, "joystick (db9)"); -#endif - info.mode = config[1]; + if (!(pp->modes & (PARPORT_MODE_PCPS2 | PARPORT_MODE_PCECPPS2)) && info.mode != JS_MULTI_0802) { + printk(KERN_ERR "js-db9: specified parport is not bidirectional\n"); + return port; + } - port = js_register_port(port, &info, 1, sizeof(struct js_db9_info), js_db9_read); + info.port = parport_register_device(pp, "joystick (db9)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); + if (!info.port) + return port; + + port = js_register_port(port, &info, 1 + (info.mode == JS_MULTI_0802_2), sizeof(struct js_db9_info), js_db9_read); + + for (i = 0; i < 1 + (info.mode == JS_MULTI_0802_2); i++) { + printk(KERN_INFO "js%d: %s on %s\n", + js_register_device(port, i, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close), + name[info.mode], info.port->port->name); -#ifdef USE_PARPORT - printk(KERN_INFO "js%d: %s on %s\n", - js_register_device(port, 0, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close), - name[info.mode], info.port->port->name); -#else - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, 0, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close), - name[info.mode], info.port); -#endif + js_db9_init_corr(port->corr[i]); + } - js_db9_init_corr(port->corr); return port; } #ifndef MODULE -void __init js_db9_setup(char *str, int *ints) +int __init js_db9_setup(SETUP_PARAM) { int i; - - if (!strcmp(str,"js_db9")) - for (i = 0; i <= ints[0] && i < 2; i++) js_db9[i] = ints[i+1]; - if (!strcmp(str,"js_db9_2")) - for (i = 0; i <= ints[0] && i < 2; i++) js_db9_2[i] = ints[i+1]; - if (!strcmp(str,"js_db9_3")) - for (i = 0; i <= ints[0] && i < 2; i++) js_db9_3[i] = ints[i+1]; - + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_db9[i] = ints[i+1]; + return 1; +} +int __init js_db9_setup_2(SETUP_PARAM) +{ + int i; + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_db9_2[i] = ints[i+1]; + return 1; +} +int __init js_db9_setup_3(SETUP_PARAM) +{ + int i; + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_db9_3[i] = ints[i+1]; + return 1; } +__setup("js_db9=", js_db9_setup); +__setup("js_db9_2=", js_db9_setup_2); +__setup("js_db9_3=", js_db9_setup_3); #endif #ifdef MODULE diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-gravis.c linux/drivers/char/joystick/joy-gravis.c --- v2.3.30/linux/drivers/char/joystick/joy-gravis.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-gravis.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-gravis.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -37,15 +39,16 @@ #include #include #include +#include #define JS_GR_MODE_GPP 1 #define JS_GR_LENGTH_GPP 24 -#define JS_GR_STROBE_GPP 75 +#define JS_GR_STROBE_GPP 400 #define JS_GR_MODE_XT 2 #define JS_GR_MODE_BD 3 #define JS_GR_LENGTH_XT 4 -#define JS_GR_STROBE_XT 30 +#define JS_GR_STROBE_XT 200 #define JS_GR_MAX_CHUNKS_XT 10 #define JS_GR_MAX_BITS_XT 30 @@ -63,37 +66,36 @@ static int js_gr_gpp_read_packet(int io, int shift, unsigned int *data) { - unsigned int t, t1; + unsigned long flags; unsigned char u, v; + unsigned int t, p; int i; - unsigned long flags; - - int strobe = (js_time_speed * JS_GR_STROBE_GPP) >> 10; i = 0; data[0] = 0; + p = t = JS_GR_STROBE_GPP; + p += JS_GR_STROBE_GPP; __save_flags(flags); __cli(); - u = inb(io) >> shift; - t = js_get_time(); + + v = inb(io) >> shift; do { - v = (inb(io) >> shift) & 3; - t1 = js_get_time(); - if ((u ^ v) & u & 1) { + t--; + u = v; v = (inb(io) >> shift) & 3; + if (~v & u & 1) { data[0] |= (v >> 1) << i++; - t = t1; + p = t = (p - t) << 1; } - u = v; - } while (i < JS_GR_LENGTH_GPP && js_delta(t1,t) < strobe); + } while (i < JS_GR_LENGTH_GPP && t > 0); __restore_flags(flags); if (i < JS_GR_LENGTH_GPP) return -1; for (i = 0; i < JS_GR_LENGTH_GPP && (data[0] & 0xfe4210) ^ 0x7c0000; i++) - data[0] = data[0] >> 1 | (data[0] & 1) << 23; + data[0] = data[0] >> 1 | (data[0] & 1) << (JS_GR_LENGTH_GPP - 1); return -(i == JS_GR_LENGTH_GPP); } @@ -104,35 +106,36 @@ static int js_gr_xt_read_packet(int io, int shift, unsigned int *data) { - unsigned int t, t1; - unsigned char u, v, w; unsigned int i, j, buf, crc; + unsigned char u, v, w; unsigned long flags; + unsigned int t, p; char status; - int strobe = (js_time_speed * JS_GR_STROBE_XT) >> 10; - data[0] = data[1] = data[2] = data[3] = 0; status = buf = i = j = 0; + p = t = JS_GR_STROBE_XT; + p += JS_GR_STROBE_XT; __save_flags(flags); __cli(); v = w = (inb(io) >> shift) & 3; - t = js_get_time(); do { + t--; u = (inb(io) >> shift) & 3; - t1 = js_get_time(); if (u ^ v) { if ((u ^ v) & 1) { + p = t = (p - t) << 2; buf = (buf << 1) | (u >> 1); i++; } else if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) { + p = t = (p - t) << 2; if (i == 20) { crc = buf ^ (buf >> 7) ^ (buf >> 14); if (!((crc ^ (0x25cb9e70 >> ((crc >> 2) & 0x1c))) & 0xf)) { @@ -145,12 +148,11 @@ i = 0; } - t = t1; w = v; v = u; } - } while (status != 0xf && i < JS_GR_MAX_BITS_XT && j < JS_GR_MAX_CHUNKS_XT && js_delta(t1,t) < strobe); + } while (status != 0xf && i < JS_GR_MAX_BITS_XT && j < JS_GR_MAX_CHUNKS_XT && t > 0); __restore_flags(flags); @@ -320,7 +322,7 @@ } /* - * js_gr_probe() probes fro GrIP joysticks. + * js_gr_probe() probes for GrIP joysticks. */ static struct js_port __init *js_gr_probe(int io, struct js_port *port) @@ -389,9 +391,9 @@ int i; struct js_gr_info *info; - while (js_gr_port != NULL) { + while (js_gr_port) { for (i = 0; i < js_gr_port->ndevs; i++) - if (js_gr_port->devs[i] != NULL) + if (js_gr_port->devs[i]) js_unregister_device(js_gr_port->devs[i]); info = js_gr_port->info; release_region(info->io, 1); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-lightning.c linux/drivers/char/joystick/joy-lightning.c --- v2.3.30/linux/drivers/char/joystick/joy-lightning.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-lightning.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-lightning.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -38,6 +40,7 @@ #include #include #include +#include #define JS_L4_PORT 0x201 #define JS_L4_SELECT_ANALOG 0xa4 @@ -55,7 +58,7 @@ MODULE_AUTHOR("Vojtech Pavlik "); MODULE_PARM(js_l4, "2-24i"); -static int js_l4[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0}; +static int __initdata js_l4[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 }; #include "joy-analog.h" @@ -70,11 +73,10 @@ static int js_l4_wait_ready(void) { - unsigned int t, t1, timeout; - timeout = (JS_L4_TIMEOUT * js_time_speed) >> 10; - t = t1 = js_get_time(); - while ((inb(JS_L4_PORT) & JS_L4_BUSY) && (js_delta(t1 = js_get_time(), t) < timeout)); - return -(js_delta(t1, t) >= timeout); + unsigned int t; + t = JS_L4_TIMEOUT; + while ((inb(JS_L4_PORT) & JS_L4_BUSY) && t > 0) t--; + return -(t<=0); } /* @@ -255,14 +257,14 @@ port = js_register_port(port, info, numdev, sizeof(struct js_l4_info), js_l4_read); + info = port->info; + for (i = 0; i < numdev; i++) printk(KERN_INFO "js%d: %s on L4 port %d\n", js_register_device(port, i, js_an_axes(i, &info->an), js_an_buttons(i, &info->an), js_an_name(i, &info->an), js_l4_open, js_l4_close), js_an_name(i, &info->an), info->port); - info = port->info; - js_l4_calibrate(info); js_l4_read(info, port->axes, port->buttons); js_an_init_corr(&info->an, port->axes, port->corr, 0); @@ -300,18 +302,21 @@ cards[i] = rev; - printk(KERN_INFO "js: PDPI Lightning 4 %s card (ports %d-%d) firmware v%d.%d found at %#x\n", + printk(KERN_INFO "js: PDPI Lightning 4 %s card (ports %d-%d) firmware v%d.%d at %#x\n", i ? "secondary" : "primary", (i << 2), (i << 2) + 3, rev >> 4, rev & 0xf, JS_L4_PORT); } } #ifndef MODULE -void __init js_l4_setup(char *str, int *ints) +int __init js_l4_setup(SETUP_PARAM) { int i; + SETUP_PARSE(24); for (i = 0; i <= ints[0] && i < 24; i++) js_l4[i] = ints[i+1]; + return 1; } +__setup("js_l4=", js_l4_setup); #endif #ifdef MODULE @@ -333,7 +338,7 @@ js_l4_port = js_l4_probe(cards, i, 0, 0, js_l4_port); } - if (js_l4_port == NULL) { + if (!js_l4_port) { #ifdef MODULE printk(KERN_WARNING "joy-lightning: no joysticks found\n"); #endif @@ -352,9 +357,9 @@ int cal[4] = {59, 59, 59, 59}; struct js_l4_info *info; - while (js_l4_port != NULL) { + while (js_l4_port) { for (i = 0; i < js_l4_port->ndevs; i++) - if (js_l4_port->devs[i] != NULL) + if (js_l4_port->devs[i]) js_unregister_device(js_l4_port->devs[i]); info = js_l4_port->info; js_l4_setcal(info->port, cal); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-logitech.c linux/drivers/char/joystick/joy-logitech.c --- v2.3.30/linux/drivers/char/joystick/joy-logitech.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-logitech.c Tue Dec 7 10:13:11 1999 @@ -1,12 +1,14 @@ /* * joy-logitech.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* * This is a module for the Linux joystick driver, supporting - * Logitech Digital joystick family. + * Logitech ADI joystick family. */ /* @@ -38,113 +40,175 @@ #include #include #include +#include +#include -#define JS_LT_MAX_START 250 -#define JS_LT_MAX_STROBE 25 -#define JS_LT_MAX_LENGTH 72 +/* + * Times array sizes, flags, ids. + */ + +#undef JS_LT_DEBUG + +#define JS_LT_MAX_START 400 /* Trigger to packet timeout [400us] */ -#define JS_LT_MAX_DELAY 12000 +#define JS_LT_MAX_LENGTH 256 +#define JS_LT_MIN_LENGTH 8 +#define JS_LT_MIN_LEN_LENGTH 10 +#define JS_LT_MIN_ID_LENGTH 66 +#define JS_LT_MAX_NAME_LENGTH 16 -#define JS_LT_MODE_WMED 1 -#define JS_LT_MODE_CM2 2 -#define JS_LT_MODE_TPD 3 +#define JS_LT_INIT_DELAY 10 /* Delay after init packet [10ms] */ +#define JS_LT_DATA_DELAY 4 /* Delay after data packet [4ms] */ -static int js_lt_seq_init[] __initdata = { 6000, 11000, 7000, 9000, 6000, 11000, 7000, 9000, 0 }; -static int js_lt_seq_reset[] __initdata = { 2000, 3000, 2000, 3000, 0 }; +#define JS_LT_FLAG_HAT 0x04 +#define JS_LT_FLAG_10BIT 0x08 -static int js_lt_port_list[] __initdata = {0x201, 0}; +#define JS_LT_ID_WMED 0x00 +#define JS_LT_ID_TPD 0x01 +#define JS_LT_ID_WMI 0x04 +#define JS_LT_ID_WGP 0x06 +#define JS_LT_ID_WM3D 0x07 +#define JS_LT_ID_WGPE 0x08 + +#define JS_LT_BUG_BUTTONS 0x01 +#define JS_LT_BUG_LONGID 0x02 +#define JS_LT_BUG_LONGDATA 0x04 +#define JS_LT_BUG_IGNTRIG 0x08 + +/* + * Port probing variables. + */ + +static int js_lt_port_list[] __initdata = { 0x201, 0 }; static struct js_port* js_lt_port __initdata = NULL; +/* + * Device names. + */ + +#define JS_LT_MAX_ID 10 + +static char *js_lt_names[] = { "WingMan Extreme Digital", "ThunderPad Digital", "SideCar", "CyberMan 2", + "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", + "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", + "WingMan GamePad USB", "Unknown Device %#x"}; + +/* + * Hat to axis conversion arrays. + */ + static struct { int x; int y; } js_lt_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; +/* + * Per-port information. + */ + struct js_lt_info { - int io; - unsigned char mode; + int io; + int length[2]; + int ret[2]; + int idx[2]; + unsigned char id[2]; + char buttons[2]; + char axes10[2]; + char axes8[2]; + char pad[2]; + char hats[2]; + char name[2][JS_LT_MAX_NAME_LENGTH]; + unsigned char data[2][JS_LT_MAX_LENGTH]; + char bugs[2]; }; /* - * js_lt_read_packet() reads a Logitech packet. + * js_lt_read_packet() reads a Logitech ADI packet. */ -static int js_lt_read_packet(int io, __u64 *data) +static void js_lt_read_packet(struct js_lt_info *info) { - - static unsigned char buf[JS_LT_MAX_LENGTH]; - unsigned char u, v, w, mask = 0; - int i; + unsigned char u, v, w, x, z; + int t[2], s[2], p[2], i; unsigned long flags; - unsigned int t, t1; - - int start = (js_time_speed * JS_LT_MAX_START) >> 10; - int strobe = (js_time_speed * JS_LT_MAX_STROBE) >> 10; - u = inb(io) >> 4; - - if (u == 0xc) mask = 0x10; - if (u == 0x0) mask = 0x50; - if (!mask) return 0; - - i = 0; + for (i = 0; i < 2; i++) { + info->ret[i] = -1; + p[i] = t[i] = JS_LT_MAX_START; + s[i] = 0; + } __save_flags(flags); __cli(); - outb(0xff,io); + outb(0xff, info->io); + v = z = inb(info->io); - u = inb(io); - t = js_get_time(); + do { + u = v; + w = u ^ (v = x = inb(info->io)); + for (i = 0; i < 2; i++, w >>= 2, x >>= 2) { + t[i]--; + if ((w & 0x30) && s[i]) { + if ((w & 0x30) < 0x30 && info->ret[i] < JS_LT_MAX_LENGTH && t[i] > 0) { + info->data[i][++info->ret[i]] = w; + p[i] = t[i] = (p[i] - t[i]) << 1; + } else t[i] = 0; + } else if (!(x & 0x30)) s[i] = 1; + } + } while (t[0] > 0 || t[1] > 0); - if ((u & 0xc) != 0xc) mask = 0x10; + __restore_flags(flags); - do { - u = inb(io); - t1 = js_get_time(); - } while ((((u >> 1) ^ u) & mask) != mask && js_delta(t1,t) < start); + for (i = 0; i < 2; i++, z >>= 2) + if ((z & 0x30) && info->ret[i] > 0) + info->bugs[i] |= JS_LT_BUG_BUTTONS; + +#ifdef JS_LT_DEBUG + printk(KERN_DEBUG "joy-logitech: read %d %d bits\n", info->ret[0], info->ret[1]); + printk(KERN_DEBUG "joy-logitech: stream0:"); + for (i = 0; i <= info->ret[0]; i++) printk("%d", (info->data[0][i] >> 5) & 1); + printk("\n"); + printk(KERN_DEBUG "joy-logitech: stream1:"); + for (i = 0; i <= info->ret[1]; i++) printk("%d", (info->data[1][i] >> 5) & 1); + printk("\n"); +#endif - t = t1; + return; +} - do { - v = inb(io); - t1 = js_get_time(); - w = u ^ v; - if ((((w >> 1) ^ w) & mask) == mask) { - buf[i++] = w; - t = t1; - u = v; - } - } while (i < JS_LT_MAX_LENGTH && js_delta(t1,t) < strobe); +/* + * js_lt_move_bits() detects a possible 2-stream mode, and moves + * the bits accordingly. + */ - __restore_flags(flags); +static void js_lt_move_bits(struct js_lt_info *info, int length) +{ + int i; - t = i; - *data = 0; + info->idx[0] = info->idx[1] = 0; - if (mask == 0x10) { - for (i = 0; i < t; i++) - *data = ((buf[i] >> 5) & 1) | (*data << 1); - return t; - } - if (mask == 0x50) { - for (i = 0; i < t; i++) - *data = ((__u64)(buf[i] & 0x20) << (t - 5)) | (buf[i] >> 7) | (*data << 1); - return t << 1; - } - return 0; + if (info->ret[0] <= 0 || info->ret[1] <= 0) return; + if (info->data[0][0] & 0x20 || ~info->data[1][0] & 0x20) return; + + for (i = 1; i <= info->ret[1]; i++) + info->data[0][((length - 1) >> 1) + i + 1] = info->data[1][i]; + + info->ret[0] += info->ret[1]; + info->ret[1] = -1; } /* - * js_lt_reverse() reverses the order of bits in a byte. + * js_lt_get_bits() gathers bits from the data packet. */ -static unsigned char js_lt_reverse(unsigned char u) +static inline int js_lt_get_bits(struct js_lt_info *info, int device, int count) { - u = ((u & 0x0f) << 4) | ((u >> 4) & 0x0f); - u = ((u & 0x33) << 2) | ((u >> 2) & 0x33); - u = ((u & 0x55) << 1) | ((u >> 1) & 0x55); - return u; + int bits = 0; + int i; + if ((info->idx[device] += count) > info->ret[device]) return 0; + for (i = 0; i < count; i++) bits |= ((info->data[device][info->idx[device] - i] >> 5) & 1) << i; + return bits; } /* @@ -154,54 +218,61 @@ static int js_lt_read(void *xinfo, int **axes, int **buttons) { struct js_lt_info *info = xinfo; - __u64 data; - int hat; - - switch (info->mode) { - - case JS_LT_MODE_TPD: - - if (js_lt_read_packet(info->io, &data) != 20) return -1; - - axes[0][0] = ((data >> 6) & 1) - ((data >> 4) & 1); - axes[0][1] = ((data >> 5) & 1) - ((data >> 7) & 1); - - buttons[0][0] = js_lt_reverse((data & 0x0f) | ((data >> 4) & 0xf0)); - - return 0; + int i, j, k, l, t; + int ret = 0; - case JS_LT_MODE_WMED: + js_lt_read_packet(info); + js_lt_move_bits(info, info->length[0]); - if (js_lt_read_packet(info->io, &data) != 42) return -1; - if ((hat = data & 0xf) > 8) return -1; + for (i = 0; i < 2; i++) { - axes[0][0] = (data >> 26) & 0xff; - axes[0][1] = (data >> 18) & 0xff; - axes[0][2] = (data >> 10) & 0xff; - axes[0][3] = js_lt_hat_to_axis[hat].x; - axes[0][4] = js_lt_hat_to_axis[hat].y; - - buttons[0][0] = js_lt_reverse((data >> 2) & 0xfc); - - return 0; - - case JS_LT_MODE_CM2: - - if (js_lt_read_packet(info->io, &data) != 64) return -1; + if (!info->length[i]) continue; + + if (info->length[i] > info->ret[i] || + info->id[i] != (js_lt_get_bits(info, i, 4) | (js_lt_get_bits(info, i, 4) << 4))) { + ret = -1; + continue; + } - axes[0][0] = (data >> 48) & 0xff; - axes[0][1] = (data >> 40) & 0xff; - axes[0][2] = (data >> 32) & 0xff; - axes[0][3] = (data >> 24) & 0xff; - axes[0][4] = (data >> 16) & 0xff; - axes[0][5] = (data >> 8) & 0xff; + if (info->length[i] < info->ret[i]) + info->bugs[i] |= JS_LT_BUG_LONGDATA; + + k = l = 0; + + for (j = 0; j < info->axes10[i]; j++) + axes[i][k++] = js_lt_get_bits(info, i, 10); + + for (j = 0; j < info->axes8[i]; j++) + axes[i][k++] = js_lt_get_bits(info, i, 8); + + for (j = 0; j <= (info->buttons[i] - 1) >> 5; j++) buttons[i][j] = 0; + + for (j = 0; j < info->buttons[i] && j < 63; j++) { + if (j == info->pad[i]) { + t = js_lt_get_bits(info, i, 4); + axes[i][k++] = ((t >> 2) & 1) - ( t & 1); + axes[i][k++] = ((t >> 1) & 1) - ((t >> 3) & 1); + } + buttons[i][l >> 5] |= js_lt_get_bits(info, i, 1) << (l & 0x1f); + l++; + } - buttons[0][0] = js_lt_reverse(data & 0xff); + for (j = 0; j < info->hats[i]; j++) { + if((t = js_lt_get_bits(info, i, 4)) > 8) { + if (t != 15) ret = -1; /* Hat press */ + t = 0; + } + axes[i][k++] = js_lt_hat_to_axis[t].x; + axes[i][k++] = js_lt_hat_to_axis[t].y; + } - return 0; + for (j = 63; j < info->buttons[i]; j++) { + buttons[i][l >> 5] |= js_lt_get_bits(info, i, 1) << (l & 0x1f); + l++; + } } - return -1; + return ret; } /* @@ -225,15 +296,18 @@ } /* - * js_lt_trigger_sequence() sends a trigger & delay sequence - * to reset/initialize a Logitech joystick. + * js_lt_init_digital() sends a trigger & delay sequence + * to reset and initialize a Logitech joystick into digital mode. */ -static void __init js_lt_trigger_sequence(int io, int *seq) +static void __init js_lt_init_digital(int io) { - while (*seq) { + int seq[] = { 3, 2, 3, 10, 6, 11, 7, 9, 11, 0 }; + int i; + + for (i = 0; seq[i]; i++) { outb(0xff,io); - udelay(*seq++); + mdelay(seq[i]); } } @@ -242,35 +316,45 @@ * Logitech joysticks. */ -static void __init js_lt_init_corr(int num_axes, int mode, int **axes, struct js_corr **corr) +static void __init js_lt_init_corr(int id, int naxes10, int naxes8, int naxes1, int *axes, struct js_corr *corr) { int j; - - for (j = 0; j < num_axes; j++) { - corr[0][j].type = JS_CORR_BROKEN; - corr[0][j].prec = 2; - corr[0][j].coef[0] = axes[0][j] - 8; - corr[0][j].coef[1] = axes[0][j] + 8; - corr[0][j].coef[2] = (1 << 29) / (127 - 32); - corr[0][j].coef[3] = (1 << 29) / (127 - 32); + + if (id == JS_LT_ID_WMED) axes[2] = 128; /* Throttle fixup */ + if (id == JS_LT_ID_WMI) axes[2] = 512; + if (id == JS_LT_ID_WM3D) axes[3] = 128; + + if (id == JS_LT_ID_WGPE) { /* Tilt fixup */ + axes[0] = 512; + axes[1] = 512; } - switch (mode) { - case JS_LT_MODE_TPD: j = 0; break; - case JS_LT_MODE_WMED: j = 3; break; - case JS_LT_MODE_CM2: j = 6; break; - default: j = 0; break; + for (j = 0; j < naxes10; j++) { + corr[j].type = JS_CORR_BROKEN; + corr[j].prec = 2; + corr[j].coef[0] = axes[j] - 16; + corr[j].coef[1] = axes[j] + 16; + corr[j].coef[2] = (1 << 29) / (256 - 32); + corr[j].coef[3] = (1 << 29) / (256 - 32); } - for (; j < num_axes; j++) { - corr[0][j].type = JS_CORR_BROKEN; - corr[0][j].prec = 0; - corr[0][j].coef[0] = 0; - corr[0][j].coef[1] = 0; - corr[0][j].coef[2] = (1 << 29); - corr[0][j].coef[3] = (1 << 29); + for (; j < naxes8 + naxes10; j++) { + corr[j].type = JS_CORR_BROKEN; + corr[j].prec = 1; + corr[j].coef[0] = axes[j] - 2; + corr[j].coef[1] = axes[j] + 2; + corr[j].coef[2] = (1 << 29) / (64 - 16); + corr[j].coef[3] = (1 << 29) / (64 - 16); } + for (; j < naxes1 + naxes8 + naxes10; j++) { + corr[j].type = JS_CORR_BROKEN; + corr[j].prec = 0; + corr[j].coef[0] = 0; + corr[j].coef[1] = 0; + corr[j].coef[2] = (1 << 29); + corr[j].coef[3] = (1 << 29); + } } /* @@ -279,61 +363,157 @@ static struct js_port __init *js_lt_probe(int io, struct js_port *port) { - struct js_lt_info info; - char *name; - int axes, buttons, i; - __u64 data; - unsigned char u; + struct js_lt_info iniinfo; + struct js_lt_info *info = &iniinfo; + char name[32]; + int i, j, t; if (check_region(io, 1)) return port; - if (((u = inb(io)) & 3) == 3) return port; - outb(0xff,io); - if (!((inb(io) ^ u) & ~u & 0xf)) return port; - - if (!(i = js_lt_read_packet(io, &data))) { - udelay(JS_LT_MAX_DELAY); - js_lt_trigger_sequence(io, js_lt_seq_reset); - js_lt_trigger_sequence(io, js_lt_seq_init); - i = js_lt_read_packet(io, &data); - } + js_lt_init_digital(io); + + memset(info, 0, sizeof(struct js_lt_info)); + + info->length[0] = info->length[1] = JS_LT_MAX_LENGTH; + + info->io = io; + js_lt_read_packet(info); + + if (info->ret[0] >= JS_LT_MIN_LEN_LENGTH) + js_lt_move_bits(info, js_lt_get_bits(info, 0, 10)); + + info->length[0] = info->length[1] = 0; + + for (i = 0; i < 2; i++) { + + if (info->ret[i] < JS_LT_MIN_ID_LENGTH) continue; /* Minimum ID packet length */ + + if (info->ret[i] < (t = js_lt_get_bits(info, i, 10))) { + printk(KERN_WARNING "joy-logitech: Short ID packet: reported: %d != read: %d\n", + t, info->ret[i]); + continue; + } + + if (info->ret[i] > t) + info->bugs[i] |= JS_LT_BUG_LONGID; + +#ifdef JS_LT_DEBUG + printk(KERN_DEBUG "joy-logitech: id %d length %d", i, t); +#endif + + info->id[i] = js_lt_get_bits(info, i, 4) | (js_lt_get_bits(info, i, 4) << 4); + + if ((t = js_lt_get_bits(info, i, 4)) & JS_LT_FLAG_HAT) info->hats[i]++; + +#ifdef JS_LT_DEBUG + printk(KERN_DEBUG "joy-logitech: id %d flags %d", i, t); +#endif + + if ((info->length[i] = js_lt_get_bits(info, i, 10)) >= JS_LT_MAX_LENGTH) { + printk(KERN_WARNING "joy-logitech: Expected packet length too long (%d).\n", + info->length[i]); + continue; + } + + if (info->length[i] < JS_LT_MIN_LENGTH) { + printk(KERN_WARNING "joy-logitech: Expected packet length too short (%d).\n", + info->length[i]); + continue; + } + + info->axes8[i] = js_lt_get_bits(info, i, 4); + info->buttons[i] = js_lt_get_bits(info, i, 6); + + if (js_lt_get_bits(info, i, 6) != 8 && info->hats[i]) { + printk(KERN_WARNING "joy-logitech: Other than 8-dir POVs not supported yet.\n"); + continue; + } + + info->buttons[i] += js_lt_get_bits(info, i, 6); + info->hats[i] += js_lt_get_bits(info, i, 4); + + j = js_lt_get_bits(info, i, 4); + + if (t & JS_LT_FLAG_10BIT) { + info->axes10[i] = info->axes8[i] - j; + info->axes8[i] = j; + } + + t = js_lt_get_bits(info, i, 4); + + for (j = 0; j < t; j++) + info->name[i][j] = js_lt_get_bits(info, i, 8); + info->name[i][j] = 0; + + switch (info->id[i]) { + case JS_LT_ID_TPD: + info->pad[i] = 4; + info->buttons[i] -= 4; + break; + case JS_LT_ID_WGP: + info->pad[i] = 0; + info->buttons[i] -= 4; + break; + default: + info->pad[i] = -1; + break; + } + + if (info->length[i] != + (t = 8 + info->buttons[i] + info->axes10[i] * 10 + info->axes8[i] * 8 + + info->hats[i] * 4 + (info->pad[i] != -1) * 4)) { + printk(KERN_WARNING "js%d: Expected lenght %d != data length %d\n", i, t, info->length[i]); + } - switch (i) { - case 0: - return port; - case 20: - info.mode = JS_LT_MODE_TPD; - axes = 2; buttons = 8; name = "Logitech ThunderPad Digital"; - break; - case 42: - info.mode = JS_LT_MODE_WMED; - axes = 5; buttons = 6; name = "Logitech WingMan Extreme Digital"; - break; - case 64: - info.mode = JS_LT_MODE_CM2; - axes = 6; buttons = 8; name = "Logitech CyberMan 2"; - break; - case 72: - case 144: - return port; - default: - printk(KERN_WARNING "joy-logitech: unknown joystick device detected " - "(io=%#x, count=%d, data=0x%08x%08x), contact \n", - io, i, (int)(data >> 32), (int)(data & 0xffffffff)); - return port; } - info.io = io; + if (!info->length[0] && !info->length[1]) + return port; request_region(io, 1, "joystick (logitech)"); - port = js_register_port(port, &info, 1, sizeof(struct js_lt_info), js_lt_read); - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, 0, axes, buttons, name, js_lt_open, js_lt_close), name, io); - udelay(JS_LT_MAX_DELAY); + port = js_register_port(port, info, 2, sizeof(struct js_lt_info), js_lt_read); + info = port->info; + + for (i = 0; i < 2; i++) + if (info->length[i] > 0) { + sprintf(name, info->id[i] < JS_LT_MAX_ID ? + js_lt_names[info->id[i]] : js_lt_names[JS_LT_MAX_ID], info->id[i]); + printk(KERN_INFO "js%d: %s [%s] at %#x\n", + js_register_device(port, i, + info->axes10[i] + info->axes8[i] + ((info->hats[i] + (info->pad[i] >= 0)) << 1), + info->buttons[i], name, js_lt_open, js_lt_close), name, info->name[i], io); + } + + mdelay(JS_LT_INIT_DELAY); + if (js_lt_read(info, port->axes, port->buttons)) { + if (info->ret[0] < 1) info->bugs[0] |= JS_LT_BUG_IGNTRIG; + if (info->ret[1] < 1) info->bugs[1] |= JS_LT_BUG_IGNTRIG; + mdelay(JS_LT_DATA_DELAY); + js_lt_read(info, port->axes, port->buttons); + } - js_lt_read(port->info, port->axes, port->buttons); - js_lt_init_corr(axes, info.mode, port->axes, port->corr); + for (i = 0; i < 2; i++) + if (info->length[i] > 0) { +#ifdef JS_LT_DEBUG + printk(KERN_DEBUG "js%d: length %d ret %d id %d buttons %d axes10 %d axes8 %d " + "pad %d hats %d name %s explen %d\n", + i, info->length[i], info->ret[i], info->id[i], + info->buttons[i], info->axes10[i], info->axes8[i], + info->pad[i], info->hats[i], info->name[i], + 8 + info->buttons[i] + info->axes10[i] * 10 + info->axes8[i] * 8 + + info->hats[i] * 4 + (info->pad[i] != -1) * 4); +#endif + if (info->bugs[i]) { + printk(KERN_WARNING "js%d: Firmware bugs detected:%s%s%s%s\n", i, + info->bugs[i] & JS_LT_BUG_BUTTONS ? " init_buttons" : "", + info->bugs[i] & JS_LT_BUG_LONGID ? " long_id" : "", + info->bugs[i] & JS_LT_BUG_LONGDATA ? " long_data" : "", + info->bugs[i] & JS_LT_BUG_IGNTRIG ? " ignore_trigger" : ""); + } + js_lt_init_corr(info->id[i], info->axes10[i], info->axes8[i], + ((info->pad[i] >= 0) + info->hats[i]) << 1, port->axes[i], port->corr[i]); + } return port; } @@ -359,10 +539,13 @@ #ifdef MODULE void cleanup_module(void) { + int i; struct js_lt_info *info; - while (js_lt_port != NULL) { - js_unregister_device(js_lt_port->devs[0]); + while (js_lt_port) { + for (i = 0; i < js_lt_port->ndevs; i++) + if (js_lt_port->devs[i]) + js_unregister_device(js_lt_port->devs[i]); info = js_lt_port->info; release_region(info->io, 1); js_lt_port = js_unregister_port(js_lt_port); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-magellan.c linux/drivers/char/joystick/joy-magellan.c --- v2.3.30/linux/drivers/char/joystick/joy-magellan.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-magellan.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,397 @@ +/* + * joy-magellan.c Version 0.1 + * + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * the Magellan and Space Mouse 6dof controllers. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constants. + */ + +#define N_JOYSTICK_MAG 14 +#define JS_MAG_MAX_LENGTH 64 + +/* + * List of Magellans. + */ + +static struct js_port* js_mag_port = NULL; + +/* + * Per-Magellan data. + */ + +struct js_mag_info { + struct tty_struct* tty; + struct js_port* port; + int idx; + unsigned char data[JS_MAG_MAX_LENGTH]; + unsigned char name[JS_MAG_MAX_LENGTH]; + char ack; + char used; +}; + +/* + * js_mag_crunch_nibbles() verifies that the bytes sent from the Magellan + * have correct upper nibbles for the lower ones, if not, the packet will + * be thrown away. It also strips these upper halves to simplify further + * processing. + */ + +static int js_mag_crunch_nibbles(unsigned char *data, int count) +{ + static unsigned char nibbles[16] = "0AB3D56GH9:Kidx) return; + + switch (info->data[0]) { + + case 'd': /* Axis data */ + if (info->idx != 25) return; + if (js_mag_crunch_nibbles(info->data, 24)) return; + if (!info->port->devs[0]) return; + for (i = 0; i < 6; i++) { + info->port->axes[0][i] = + ( info->data[(i << 2) + 1] << 12 | info->data[(i << 2) + 2] << 8 | + info->data[(i << 2) + 3] << 4 | info->data[(i << 2) + 4] ) + - 32768; + } + break; + + case 'e': /* Error packet */ + if (info->idx != 4) return; + if (js_mag_crunch_nibbles(info->data, 3)) return; + switch (info->data[1]) { + case 1: + printk(KERN_ERR "joy-magellan: Received command error packet. Failing command byte: %c\n", + info->data[2] | (info->data[3] << 4)); + break; + case 2: + printk(KERN_ERR "joy-magellan: Received framing error packet.\n"); + break; + default: + printk(KERN_ERR "joy-magellan: Received unknown error packet.\n"); + } + break; + + case 'k': /* Button data */ + if (info->idx != 4) return; + if (js_mag_crunch_nibbles(info->data, 3)) return; + if (!info->port->devs[0]) return; + info->port->buttons[0][0] = (info->data[1] << 1) | (info->data[2] << 5) | info->data[3]; + break; + + case 'm': /* Mode */ + if (info->idx != 2) return; + if (js_mag_crunch_nibbles(info->data, 1)) return; + break; + + case 'n': /* Null radius */ + if (info->idx != 2) return; + if (js_mag_crunch_nibbles(info->data, 1)) return; + break; + + case 'p': /* Data rate */ + if (info->idx != 3) return; + if (js_mag_crunch_nibbles(info->data, 2)) return; + break; + + case 'q': /* Sensitivity */ + if (info->idx != 3) return; + if (js_mag_crunch_nibbles(info->data, 2)) return; + break; + + case 'v': /* Version string */ + info->data[info->idx] = 0; + for (i = 1; i < info->idx && info->data[i] == ' '; i++); + memcpy(info->name, info->data + i, info->idx - i); + break; + + case 'z': /* Zero position */ + break; + + default: + printk("joy-magellan: Unknown packet %d length %d:", info->data[0], info->idx); + for (i = 0; i < info->idx; i++) printk(" %02x", info->data[i]); + printk("\n"); + return; + } + + info->ack = info->data[0]; +} + +/* + * js_mag_command() sends a command to the Magellan, and waits for + * acknowledge. + */ + +static int js_mag_command(struct js_mag_info *info, char *command, int timeout) +{ + info->ack = 0; + if (info->tty->driver.write(info->tty, 0, command, strlen(command)) != strlen(command)) return -1; + while (!info->ack && timeout--) mdelay(1); + return -(info->ack != command[0]); +} + +/* + * js_mag_setup() initializes the Magellan to sane state. Also works as + * a probe for Magellan existence. + */ + +static int js_mag_setup(struct js_mag_info *info) +{ + + if (js_mag_command(info, "vQ\r", 800)) /* Read version */ + return -1; + if (js_mag_command(info, "m3\r", 50)) /* Set full 3d mode */ + return -1; + if (js_mag_command(info, "pBB\r", 50)) /* Set 16 reports/second (max) */ + return -1; + if (js_mag_command(info, "z\r", 50)) /* Set zero position */ + return -1; + + return 0; +} + +/* + * js_mag_read() updates the axis and button data upon startup. + */ + +static int js_mag_read(struct js_mag_info *info) +{ + memset(info->port->axes[0],0, sizeof(int) * 6); /* Axes are 0 after zero postition cmd */ + + if (js_mag_command(info, "kQ\r", 50)) /* Read buttons */ + return -1; + + return 0; +} + +/* + * js_mag_open() is a callback from the joystick device open routine. + */ + +static int js_mag_open(struct js_dev *jd) +{ + struct js_mag_info *info = jd->port->info; + info->used++; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_mag_close() is a callback from the joystick device release routine. + */ + +static int js_mag_close(struct js_dev *jd) +{ + struct js_mag_info *info = jd->port->info; + if (!--info->used) { + js_unregister_device(jd->port->devs[0]); + js_mag_port = js_unregister_port(jd->port); + } + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_mag_init_corr() initializes the correction values for the Magellan. + * It asumes gain setting of 0, question is, what we should do for higher + * gain settings ... + */ + +static void js_mag_init_corr(struct js_corr **corr) +{ + int i; + + for (i = 0; i < 6; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = 0; + corr[0][i].coef[0] = 0; + corr[0][i].coef[1] = 0; + corr[0][i].coef[2] = (1 << 29) / 256; + corr[0][i].coef[3] = (1 << 29) / 256; + } +} + +/* + * js_mag_ldisc_open() is the routine that is called upon setting our line + * discipline on a tty. It looks for the Magellan, and if found, registers + * it as a joystick device. + */ + +static int js_mag_ldisc_open(struct tty_struct *tty) +{ + struct js_mag_info iniinfo; + struct js_mag_info *info = &iniinfo; + + info->tty = tty; + info->idx = 0; + info->used = 1; + + js_mag_port = js_register_port(js_mag_port, info, 1, sizeof(struct js_mag_info), NULL); + + info = js_mag_port->info; + info->port = js_mag_port; + tty->disc_data = info; + + if (js_mag_setup(info)) { + js_mag_port = js_unregister_port(info->port); + return -ENODEV; + } + + printk(KERN_INFO "js%d: Magellan [%s] on %s%d\n", + js_register_device(js_mag_port, 0, 6, 9, "Magellan", js_mag_open, js_mag_close), + info->name, tty->driver.name, MINOR(tty->device) - tty->driver.minor_start); + + + js_mag_read(info); + js_mag_init_corr(js_mag_port->corr); + + MOD_INC_USE_COUNT; + + return 0; +} + +/* + * js_mag_ldisc_close() is the opposite of js_mag_ldisc_open() + */ + +static void js_mag_ldisc_close(struct tty_struct *tty) +{ + struct js_mag_info* info = (struct js_mag_info*) tty->disc_data; + if (!--info->used) { + js_unregister_device(info->port->devs[0]); + js_mag_port = js_unregister_port(info->port); + } + MOD_DEC_USE_COUNT; +} + +/* + * js_mag_ldisc_receive() is called by the low level driver when characters + * are ready for us. We then buffer them for further processing, or call the + * packet processing routine. + */ + +static void js_mag_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) +{ + struct js_mag_info* info = (struct js_mag_info*) tty->disc_data; + int i; + + for (i = 0; i < count; i++) + if (cp[i] == '\r') { + js_mag_process_packet(info); + info->idx = 0; + } else { + if (info->idx < JS_MAG_MAX_LENGTH) + info->data[info->idx++] = cp[i]; + } +} + +/* + * js_mag_ldisc_room() reports how much room we do have for receiving data. + * Although we in fact have infinite room, we need to specify some value + * here, so why not the size of our packet buffer. It's big anyway. + */ + +static int js_mag_ldisc_room(struct tty_struct *tty) +{ + return JS_MAG_MAX_LENGTH; +} + +/* + * The line discipline structure. + */ + +static struct tty_ldisc js_mag_ldisc = { + magic: TTY_LDISC_MAGIC, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) + name: "magellan", +#endif + open: js_mag_ldisc_open, + close: js_mag_ldisc_close, + receive_buf: js_mag_ldisc_receive, + receive_room: js_mag_ldisc_room, +}; + +/* + * The functions for inserting/removing us as a module. + */ + +#ifdef MODULE +int init_module(void) +#else +int __init js_mag_init(void) +#endif +{ + if (tty_register_ldisc(N_JOYSTICK_MAG, &js_mag_ldisc)) { + printk(KERN_ERR "joy-magellan: Error registering line discipline.\n"); + return -ENODEV; + } + + return 0; +} + +#ifdef MODULE +void cleanup_module(void) +{ + tty_register_ldisc(N_JOYSTICK_MAG, NULL); +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-pci.c linux/drivers/char/joystick/joy-pci.c --- v2.3.30/linux/drivers/char/joystick/joy-pci.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-pci.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,273 @@ +/* + * joy-pci.c Version 0.4.0 + * + * Copyright (c) 1999 Raymond Ingles + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting the + * gameports on Trident 4DWave and Aureal Vortex soundcards, and + * analog joysticks connected to them. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +MODULE_AUTHOR("Raymond Ingles "); +MODULE_PARM(js_pci, "3-32i"); + +#define NUM_CARDS 8 +static int js_pci[NUM_CARDS * 4] __initdata = { -1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0, + -1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0 }; + +static struct js_port * js_pci_port __initdata = NULL; + +#include "joy-analog.h" + +struct js_pci_info; +typedef void (*js_pci_func)(struct js_pci_info *); + +struct js_pci_data { + int vendor; /* PCI Vendor ID */ + int model; /* PCI Model ID */ + int size; /* Memory / IO region size */ + int lcr; /* Aureal Legacy Control Register */ + int gcr; /* Gameport control register */ + int buttons; /* Buttons location */ + int axes; /* Axes start */ + int axsize; /* Axis field size */ + int axmax; /* Axis field max value */ + js_pci_func init; + js_pci_func cleanup; + char *name; +}; + +struct js_pci_info { + unsigned char *base; + struct pci_dev *pci_p; + __u32 lcr; + struct js_pci_data *data; + struct js_an_info an; +}; + +/* + * js_pci_*_init() sets the info->base field, disables legacy gameports, + * and enables the enhanced ones. + */ + +static void js_pci_4dwave_init(struct js_pci_info *info) +{ + info->base = ioremap(BASE_ADDRESS(info->pci_p, 1), info->data->size); + pci_read_config_word(info->pci_p, info->data->lcr, (unsigned short *)&info->lcr); + pci_write_config_word(info->pci_p, info->data->lcr, info->lcr & ~0x20); + writeb(0x80, info->base + info->data->gcr); +} + +static void js_pci_vortex_init(struct js_pci_info *info) +{ + info->base = ioremap(BASE_ADDRESS(info->pci_p, 0), info->data->size); + info->lcr = readl(info->base + info->data->lcr); + writel(info->lcr & ~0x8, info->base + info->data->lcr); + writel(0x40, info->base + info->data->gcr); +} + +/* + * js_pci_*_cleanup does the opposite of the above functions. + */ + +static void js_pci_4dwave_cleanup(struct js_pci_info *info) +{ + pci_write_config_word(info->pci_p, info->data->lcr, info->lcr); + writeb(0x00, info->base + info->data->gcr); + iounmap(info->base); +} + +static void js_pci_vortex_cleanup(struct js_pci_info *info) +{ + writel(info->lcr, info->base + info->data->lcr); + writel(0x00, info->base + info->data->gcr); + iounmap(info->base); +} + +static struct js_pci_data js_pci_data[] = +{{ PCI_VENDOR_ID_TRIDENT, 0x2000, 0x10000, 0x00044 ,0x00030, 0x00031, 0x00034, 2, 0xffff, + js_pci_4dwave_init, js_pci_4dwave_cleanup, "Trident 4DWave DX" }, + { PCI_VENDOR_ID_TRIDENT, 0x2001, 0x10000, 0x00044, 0x00030, 0x00031, 0x00034, 2, 0xffff, + js_pci_4dwave_init, js_pci_4dwave_cleanup, "Trident 4DWave NX" }, + { PCI_VENDOR_ID_AUREAL, 0x0001, 0x40000, 0x1280c, 0x1100c, 0x11008, 0x11010, 4, 0x1fff, + js_pci_vortex_init, js_pci_vortex_cleanup, "Aureal Vortex1" }, + { PCI_VENDOR_ID_AUREAL, 0x0002, 0x40000, 0x2a00c, 0x2880c, 0x28808, 0x28810, 4, 0x1fff, + js_pci_vortex_init, js_pci_vortex_cleanup, "Aureal Vortex2" }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL }}; + +/* + * js_pci_read() reads data from a PCI gameport. + */ + +static int js_pci_read(void *xinfo, int **axes, int **buttons) +{ + struct js_pci_info *info = xinfo; + int i; + + info->an.buttons = ~readb(info->base + info->data->buttons) >> 4; + + for (i = 0; i < 4; i++) + info->an.axes[i] = readw(info->base + info->data->axes + i * info->data->axsize); + + js_an_decode(&info->an, axes, buttons); + + return 0; +} + +/* + * js_pci_open() is a callback from the file open routine. + */ + +static int js_pci_open(struct js_dev *jd) +{ + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_pci_close() is a callback from the file release routine. + */ + +static int js_pci_close(struct js_dev *jd) +{ + MOD_DEC_USE_COUNT; + return 0; +} + +static struct js_port * __init js_pci_probe(struct js_port *port, int type, int number, + struct pci_dev *pci_p, struct js_pci_data *data) +{ + int i; + unsigned char u; + int mask0, mask1, numdev; + struct js_pci_info iniinfo; + struct js_pci_info *info = &iniinfo; + + mask0 = mask1 = 0; + + for (i = 0; i < NUM_CARDS; i++) + if (js_pci[i * 4] == type && js_pci[i * 4 + 1] == number) { + mask0 = js_pci[i * 4 + 2]; + mask1 = js_pci[i * 4 + 3]; + if (!mask0 && !mask1) return port; + break; + } + + memset(info, 0, sizeof(struct js_pci_info)); + + info->data = data; + info->pci_p = pci_p; + data->init(info); + + mdelay(10); + js_pci_read(info, NULL, NULL); + + for (i = u = 0; i < 4; i++) + if (info->an.axes[i] < info->data->axmax) u |= 1 << i; + + if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0) + return port; + + port = js_register_port(port, info, numdev, sizeof(struct js_pci_info), js_pci_read); + + info = port->info; + + for (i = 0; i < numdev; i++) + printk(KERN_WARNING "js%d: %s on %s #%d\n", + js_register_device(port, i, js_an_axes(i, &info->an), js_an_buttons(i, &info->an), + js_an_name(i, &info->an), js_pci_open, js_pci_close), js_an_name(i, &info->an), data->name, number); + + js_pci_read(info, port->axes, port->buttons); + js_an_init_corr(&info->an, port->axes, port->corr, 32); + + return port; +} + +#ifndef MODULE +int __init js_pci_setup(SETUP_PARAM) +{ + int i; + SETUP_PARSE(NUM_CARDS*4); + for (i = 0; i <= ints[0] && i < NUM_CARDS*4; i++) + js_pci[i] = ints[i+1]; + return 1; +} +__setup("js_pci=", js_pci_setup); +#endif + +#ifdef MODULE +int init_module(void) +#else +int __init js_pci_init(void) +#endif +{ + struct pci_dev *pci_p = NULL; + int i, j; + + for (i = 0; js_pci_data[i].vendor; i++) + for (j = 0; (pci_p = pci_find_device(js_pci_data[i].vendor, js_pci_data[i].model, pci_p)); j++) + js_pci_port = js_pci_probe(js_pci_port, i, j, pci_p, js_pci_data + i); + + if (!js_pci_port) { +#ifdef MODULE + printk(KERN_WARNING "joy-pci: no joysticks found\n"); +#endif + return -ENODEV; + } + + return 0; +} + +#ifdef MODULE +void cleanup_module(void) +{ + int i; + struct js_pci_info *info; + + while (js_pci_port) { + for (i = 0; i < js_pci_port->ndevs; i++) + if (js_pci_port->devs[i]) + js_unregister_device(js_pci_port->devs[i]); + info = js_pci_port->info; + info->data->cleanup(info); + js_pci_port = js_unregister_port(js_pci_port); + } +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-sidewinder.c linux/drivers/char/joystick/joy-sidewinder.c --- v2.3.30/linux/drivers/char/joystick/joy-sidewinder.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-sidewinder.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-sidewinder.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -38,18 +40,36 @@ #include #include #include +#include -#define JS_SW_MAX_START 250 -#define JS_SW_MIN_STROBE 25 -#define JS_SW_EXT_STROBE 45 -#define JS_SW_MIN_TIME 1500 -#define JS_SW_MAX_TIME 4000 - -#define JS_SW_MAX_LENGTH 72 - -#define JS_SW_MODE_3DP 1 -#define JS_SW_MODE_PP 2 -#define JS_SW_MODE_GP 3 +/* + * These are really magic values. Changing them can make a problem go away, + * as well as break everything. + */ + +#undef JS_SW_DEBUG + +#define JS_SW_START 400 /* The time we wait for the first bit [400 us] */ +#define JS_SW_STROBE 45 /* Max time per bit [45 us] */ +#define JS_SW_TIMEOUT 4000 /* Wait for everything to settle [4 ms] */ +#define JS_SW_KICK 45 /* Wait after A0 fall till kick [45 us] */ +#define JS_SW_END 8 /* Number of bits before end of packet to kick */ +#define JS_SW_FAIL 16 /* Number of packet read errors to fail and reinitialize */ +#define JS_SW_BAD 2 /* Number of packet read errors to switch off 3d Pro optimization */ +#define JS_SW_OK 64 /* Number of packet read successes to switch optimization back on */ +#define JS_SW_LENGTH 512 /* Max number of bits in a packet */ + +/* + * SideWinder joystick types ... + */ + +#define JS_SW_TYPE_3DP 1 +#define JS_SW_TYPE_F23 2 +#define JS_SW_TYPE_GP 3 +#define JS_SW_TYPE_PP 4 +#define JS_SW_TYPE_FFP 5 +#define JS_SW_TYPE_FSP 6 +#define JS_SW_TYPE_FFW 7 static int js_sw_port_list[] __initdata = {0x201, 0}; static struct js_port* js_sw_port __initdata = NULL; @@ -61,208 +81,398 @@ struct js_sw_info { int io; - unsigned char mode; + int length; + int speed; + unsigned char type; + unsigned char bits; unsigned char number; - unsigned char optimize; + unsigned char fail; + unsigned char ok; }; /* - * js_sw_init_digital() switches a SideWinder into digital mode. + * Gameport speed. + */ + +unsigned int js_sw_io_speed = 0; + +/* + * js_sw_measure_speed() measures the gameport i/o speed. */ -static void __init js_sw_init_digital(int io) +static int __init js_sw_measure_speed(int io) { - unsigned int t; - unsigned int timeout = (js_time_speed * JS_SW_MAX_TIME) >> 10; - int delays[] = {140, 140+726, 140+300, 0}; - int i = 0; +#ifdef __i386__ + +#define GET_TIME(x) do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0) +#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193180L/HZ:0)) + + unsigned int i, t, t1, t2, t3, tx; unsigned long flags; - __save_flags(flags); - __cli(); - do { - outb(0xff,io); - t = js_get_time(); - while ((inb(io) & 1) && (js_delta(js_get_time(),t) < timeout)); - udelay(delays[i]); - } while (delays[i++]); - __restore_flags(flags); + tx = 1 << 30; - for (i = 0; i < 4; i++) { - udelay(300); - outb(0xff, io); + for(i = 0; i < 50; i++) { + save_flags(flags); /* Yes, all CPUs */ + cli(); + GET_TIME(t1); + for(t = 0; t < 50; t++) inb(io); + GET_TIME(t2); + GET_TIME(t3); + restore_flags(flags); + udelay(i * 10); + if ((t = DELTA(t2,t1) - DELTA(t3,t2)) < tx) tx = t; } - return; + return 59659 / t; + +#else + + unsigned int j, t = 0; + + j = jiffies; while (j == jiffies); + j = jiffies; while (j == jiffies) { t++; inb(0x201); } + + return t * HZ / 1000; + +#endif } /* - * js_sw_read_packet() reads a SideWinder packet. + * js_sw_read_packet() is a function which reads either a data packet, or an + * identification packet from a SideWinder joystick. Better don't try to + * understand this, since all the ugliness of the Microsoft Digital + * Overdrive protocol is concentrated in this function. If you really want + * to know how this works, first go watch a couple horror movies, so that + * you are well prepared, read US patent #5628686 and then e-mail me, + * and I'll send you an explanation. + * Vojtech */ -static int js_sw_read_packet(int io, int l1, int l2, int strobe, __u64 *data) +static int js_sw_read_packet(int io, int speed, unsigned char *buf, int length, int id) { - static unsigned char buf[JS_SW_MAX_LENGTH]; - unsigned char u, v; - int i; unsigned long flags; - unsigned int t, t1; - - int length = l1 < l2 ? l2 : l1; - int start = (js_time_speed * JS_SW_MAX_START) >> 10; - strobe = (js_time_speed * strobe) >> 10; + int timeout, bitout, sched, i, kick, start, strobe; + unsigned char pending, u, v; - i = 0; + i = -id; /* Don't care about data, only want ID */ + timeout = id ? (JS_SW_TIMEOUT * speed) >> 10 : 0; /* Set up global timeout for ID packet */ + kick = id ? (JS_SW_KICK * speed) >> 10 : 0; /* Set up kick timeout for ID packet */ + start = (JS_SW_START * speed) >> 10; + strobe = (JS_SW_STROBE * speed) >> 10; + bitout = start; + pending = 0; + sched = 0; - __save_flags(flags); - __cli(); - outb(0xff,io); + __save_flags(flags); /* Quiet, please */ + __cli(); + outb(0xff, io); /* Trigger */ v = inb(io); - t = js_get_time(); do { + bitout--; u = v; v = inb(io); - t1 = js_get_time(); - } while (!((u ^ v) & u & 0x10) && js_delta(t1, t) < start); + } while (!(~v & u & 0x10) && (bitout > 0)); /* Wait for first falling edge on clock */ - t = t1; + if (bitout > 0) bitout = strobe; /* Extend time if not timed out */ + + while ((timeout > 0 || bitout > 0) && (i < length)) { + + timeout--; + bitout--; /* Decrement timers */ + sched--; - do { - v = inb(io); - t1 = js_get_time(); - if ((u ^ v) & v & 0x10) { - buf[i++] = v >> 5; - t = t1; - } u = v; - } while (i < length && js_delta(t1,t) < strobe); + v = inb(io); - __restore_flags(flags); + if ((~u & v & 0x10) && (bitout > 0)) { /* Rising edge on clock - data bit */ + if (i >= 0) /* Want this data */ + buf[i] = v >> 5; /* Store it */ + i++; /* Advance index */ + bitout = strobe; /* Extend timeout for next bit */ + } + + if (kick && (~v & u & 0x01)) { /* Falling edge on axis 0 */ + sched = kick; /* Schedule second trigger */ + kick = 0; /* Don't schedule next time on falling edge */ + pending = 1; /* Mark schedule */ + } + + if (pending && sched < 0 && (i > -JS_SW_END)) { /* Second trigger time */ + outb(0xff, io); /* Trigger */ + bitout = start; /* Long bit timeout */ + pending = 0; /* Unmark schedule */ + timeout = 0; /* Switch from global to bit timeouts */ + } + } - *data = 0; + __restore_flags(flags); /* Done - relax */ - if (i == l1) { - t = i > 64 ? 64 : i; - for (i = 0; i < t; i++) - *data |= (__u64) (buf[i] & 1) << i; - return t; - } - if (i == l2) { - t = i > 22 ? 22 : i; - for (i = 0; i < t; i++) - *data |= (__u64) buf[i] << (3 * i); - return t * 3; +#ifdef JS_SW_DEBUG + { + int j; + printk(KERN_DEBUG "joy-sidewinder: Read %d triplets. [", i); + for (j = 0; j < i; j++) printk("%d", buf[j]); + printk("]\n"); } +#endif return i; } /* - * js_sw_parity computes parity of __u64 + * js_sw_get_bits() and GB() compose bits from the triplet buffer into a __u64. + * Parameter 'pos' is bit number inside packet where to start at, 'num' is number + * of bits to be read, 'shift' is offset in the resulting __u64 to start at, bits + * is number of bits per triplet. + */ + +#define GB(pos,num,shift) js_sw_get_bits(buf, pos, num, shift, info->bits) + +static __u64 js_sw_get_bits(unsigned char *buf, int pos, int num, char shift, char bits) +{ + __u64 data = 0; + int tri = pos % bits; /* Start position */ + int i = pos / bits; + int bit = shift; + + while (num--) { + data |= (__u64)((buf[i] >> tri++) & 1) << bit++; /* Transfer bit */ + if (tri == bits) { + i++; /* Next triplet */ + tri = 0; + } + } + + return data; +} + +/* + * js_sw_init_digital() initializes a SideWinder 3D Pro joystick + * into digital mode. + */ + +static void js_sw_init_digital(int io, int speed) +{ + int seq[] = { 140, 140+725, 140+300, 0 }; + unsigned long flags; + int i, t; + + __save_flags(flags); + __cli(); + + i = 0; + do { + outb(0xff, io); /* Trigger */ + t = (JS_SW_TIMEOUT * speed) >> 10; + while ((inb(io) & 1) && t) t--; /* Wait for axis to fall back to 0 */ + udelay(seq[i]); /* Delay magic time */ + } while (seq[++i]); + + outb(0xff, io); /* Last trigger */ + + __restore_flags(flags); +} + +/* + * js_sw_parity() computes parity of __u64 */ static int js_sw_parity(__u64 t) { - t ^= t >> 32; - t ^= t >> 16; - t ^= t >> 8; - t ^= t >> 4; - t ^= t >> 2; - t ^= t >> 1; - return t & 1; + int x = t ^ (t >> 32); + x ^= x >> 16; + x ^= x >> 8; + x ^= x >> 4; + x ^= x >> 2; + x ^= x >> 1; + return x & 1; } /* - * js_sw_csum() computes checksum of nibbles in __u64 + * js_sw_ccheck() checks synchronization bits and computes checksum of nibbles. */ -static int js_sw_csum(__u64 t) +static int js_sw_check(__u64 t) { char sum = 0; - while (t) { + + if ((t & 0x8080808080808080ULL) ^ 0x80) /* Sync */ + return -1; + + while (t) { /* Sum */ sum += t & 0xf; t >>= 4; } + return sum & 0xf; } /* - * js_sw_read() reads and analyzes SideWinder joystick data. + * js_sw_parse() analyzes SideWinder joystick data, and writes the results into + * the axes and buttons arrays. */ -static int js_sw_read(void *xinfo, int **axes, int **buttons) +static int js_sw_parse(unsigned char *buf, struct js_sw_info *info, int **axes, int **buttons) { - struct js_sw_info *info = xinfo; - __u64 data; int hat, i; - switch (info->mode) { - - case JS_SW_MODE_3DP: + switch (info->type) { - if (info->optimize) { - i = js_sw_read_packet(info->io, -1, 22, JS_SW_EXT_STROBE, &data); - } else { - i = js_sw_read_packet(info->io, 64, 66, JS_SW_EXT_STROBE, &data); - if (i == 198) info->optimize = 1; - } + case JS_SW_TYPE_3DP: + case JS_SW_TYPE_F23: - if (i < 60) { - js_sw_init_digital(info->io); - info->optimize = 0; - return -1; - } + if (js_sw_check(GB(0,64,0)) || (hat = GB(6,1,3) | GB(60,3,0)) > 8) return -1; - if (((data & 0x8080808080808080ULL) ^ 0x80) || js_sw_csum(data) || - (hat = ((data >> 3) & 0x08) | ((data >> 60) & 0x07)) > 8) { - info->optimize = 0; - return -1; - } - axes[0][0] = ((data << 4) & 0x380) | ((data >> 16) & 0x07f); - axes[0][1] = ((data << 7) & 0x380) | ((data >> 24) & 0x07f); - axes[0][2] = ((data >> 28) & 0x180) | ((data >> 40) & 0x07f); - axes[0][3] = ((data >> 25) & 0x380) | ((data >> 48) & 0x07f); + axes[0][0] = GB( 3,3,7) | GB(16,7,0); + axes[0][1] = GB( 0,3,7) | GB(24,7,0); + axes[0][2] = GB(35,2,7) | GB(40,7,0); + axes[0][3] = GB(32,3,7) | GB(48,7,0); axes[0][4] = js_sw_hat_to_axis[hat].x; axes[0][5] = js_sw_hat_to_axis[hat].y; - buttons[0][0] = ((~data >> 31) & 0x80) | ((~data >> 8) & 0x7f); + buttons[0][0] = ~(GB(37,1,8) | GB(38,1,7) | GB(8,7,0)); + + return 0; + + case JS_SW_TYPE_GP: + + for (i = 0; i < info->number * 15; i += 15) { + + if (js_sw_parity(GB(i,15,0))) return -1; + + axes[i][0] = GB(i+3,1,0) - GB(i+2,1,0); + axes[i][1] = GB(i+0,1,0) - GB(i+1,1,0); + buttons[i][0] = ~GB(i+4,10,0); + + } return 0; - case JS_SW_MODE_PP: + case JS_SW_TYPE_PP: + case JS_SW_TYPE_FFP: - if (js_sw_read_packet(info->io, 48, 16, JS_SW_EXT_STROBE, &data) != 48) return -1; - if (!js_sw_parity(data) || (hat = (data >> 42) & 0xf) > 8) return -1; + if (!js_sw_parity(GB(0,48,0)) || (hat = GB(42,4,0)) > 8) return -1; - axes[0][0] = (data >> 9) & 0x3ff; - axes[0][1] = (data >> 19) & 0x3ff; - axes[0][2] = (data >> 29) & 0x07f; - axes[0][3] = (data >> 36) & 0x03f; + axes[0][0] = GB( 9,10,0); + axes[0][1] = GB(19,10,0); + axes[0][2] = GB(36, 6,0); + axes[0][3] = GB(29, 7,0); axes[0][4] = js_sw_hat_to_axis[hat].x; axes[0][5] = js_sw_hat_to_axis[hat].y; - buttons[0][0] = ~data & 0x1ff; + buttons[0][0] = ~GB(0,9,0); return 0; - case JS_SW_MODE_GP: + case JS_SW_TYPE_FSP: - if (js_sw_read_packet(info->io, 15 * info->number, 5 * info->number, - JS_SW_EXT_STROBE, &data) != 15 * info->number) return -1; - if (js_sw_parity(data)) return -1; - - for (i = 0; i < info->number; i++) { - axes[i][0] = ((data >> 3) & 1) - ((data >> 2) & 1); - axes[i][1] = ( data & 1) - ((data >> 1) & 1); - buttons[i][0] = (~data >> 4) & 0x3ff; - data >>= 15; - } + if (!js_sw_parity(GB(0,43,0)) || (hat = GB(28,4,0)) > 8) return -1; + + axes[0][0] = GB( 0,10,0); + axes[0][1] = GB(16,10,0); + axes[0][2] = GB(32, 6,0); + axes[0][3] = js_sw_hat_to_axis[hat].x; + axes[0][4] = js_sw_hat_to_axis[hat].y; + buttons[0][0] = ~(GB(10,6,0) | GB(26,2,6) | GB(38,2,8)); + + return 0; + + case JS_SW_TYPE_FFW: + + if (!js_sw_parity(GB(0,33,0))) return -1; + + axes[0][0] = GB( 0,10,0); + axes[0][1] = GB(10, 6,0); + axes[0][2] = GB(16, 6,0); + buttons[0][0] = ~GB(22,8,0); return 0; + } + + return -1; +} + +/* + * js_sw_read() reads SideWinder joystick data, and reinitializes + * the joystick in case of persistent problems. This is the function that is + * called from the generic code to poll the joystick. + */ + +static int js_sw_read(void *xinfo, int **axes, int **buttons) +{ + struct js_sw_info *info = xinfo; + unsigned char buf[JS_SW_LENGTH]; + int i; + + i = js_sw_read_packet(info->io, info->speed, buf, info->length, 0); + + if (info->type <= JS_SW_TYPE_F23 && info->length == 66 && i != 66) { /* Broken packet, try to fix */ - default: - return -1; + if (i == 64 && !js_sw_check(js_sw_get_bits(buf,0,64,0,1))) { /* Last init failed, 1 bit mode */ + printk(KERN_WARNING "joy-sidewinder: Joystick in wrong mode on %#x" + " - going to reinitialize.\n", info->io); + info->fail = JS_SW_FAIL; /* Reinitialize */ + i = 128; /* Bogus value */ + } + + if (i < 66 && GB(0,64,0) == GB(i*3-66,64,0)) /* 1 == 3 */ + i = 66; /* Everything is fine */ + + if (i < 66 && GB(0,64,0) == GB(66,64,0)) /* 1 == 2 */ + i = 66; /* Everything is fine */ + + if (i < 66 && GB(i*3-132,64,0) == GB(i*3-66,64,0)) { /* 2 == 3 */ + memmove(buf, buf + i - 22, 22); /* Move data */ + i = 66; /* Carry on */ + } + } + + if (i == info->length && !js_sw_parse(buf, info, axes, buttons)) { /* Parse data */ + + info->fail = 0; + info->ok++; + + if (info->type <= JS_SW_TYPE_F23 && info->length == 66 /* Many packets OK */ + && info->ok > JS_SW_OK) { + + printk(KERN_INFO "joy-sidewinder: No more trouble on %#x" + " - enabling optimization again.\n", info->io); + info->length = 22; + } + + return 0; } + + info->ok = 0; + info->fail++; + + if (info->type <= JS_SW_TYPE_F23 && info->length == 22 /* Consecutive bad packets */ + && info->fail > JS_SW_BAD) { + + printk(KERN_INFO "joy-sidewinder: Many bit errors on %#x" + " - disabling optimization.\n", info->io); + info->length = 66; + } + + if (info->fail < JS_SW_FAIL) return -1; /* Not enough, don't reinitialize yet */ + + printk(KERN_WARNING "joy-sidewinder: Too many bit errors on %#x" + " - reinitializing joystick.\n", info->io); + + if (!i && info->type <= JS_SW_TYPE_F23) { /* 3D Pro can be in analog mode */ + udelay(3 * JS_SW_TIMEOUT); + js_sw_init_digital(info->io, info->speed); + } + + udelay(JS_SW_TIMEOUT); + i = js_sw_read_packet(info->io, info->speed, buf, JS_SW_LENGTH, 0); /* Read normal data packet */ + udelay(JS_SW_TIMEOUT); + js_sw_read_packet(info->io, info->speed, buf, JS_SW_LENGTH, i); /* Read ID packet, this initializes the stick */ + + info->fail = JS_SW_FAIL; + + return -1; } /* @@ -290,7 +500,7 @@ * SideWinders. */ -static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js_corr **corr) +static void __init js_sw_init_corr(int num_axes, int type, int number, struct js_corr **corr) { int i, j; @@ -305,9 +515,10 @@ corr[i][j].coef[3] = (1 << 29) / (511 - 32); } - switch (mode) { + switch (type) { - case JS_SW_MODE_3DP: + case JS_SW_TYPE_3DP: + case JS_SW_TYPE_F23: corr[i][2].type = JS_CORR_BROKEN; corr[i][2].prec = 4; @@ -320,33 +531,73 @@ break; - case JS_SW_MODE_PP: + case JS_SW_TYPE_PP: + case JS_SW_TYPE_FFP: corr[i][2].type = JS_CORR_BROKEN; - corr[i][2].prec = 1; - corr[i][2].coef[0] = 63 - 4; - corr[i][2].coef[1] = 64 + 4; - corr[i][2].coef[2] = (1 << 29) / (63 - 4); - corr[i][2].coef[3] = (1 << 29) / (63 - 4); + corr[i][2].prec = 0; + corr[i][2].coef[0] = 31 - 2; + corr[i][2].coef[1] = 32 + 2; + corr[i][2].coef[2] = (1 << 29) / (31 - 2); + corr[i][2].coef[3] = (1 << 29) / (31 - 2); corr[i][3].type = JS_CORR_BROKEN; - corr[i][3].prec = 0; - corr[i][3].coef[0] = 31 - 2; - corr[i][3].coef[1] = 32 + 2; - corr[i][3].coef[2] = (1 << 29) / (31 - 2); - corr[i][3].coef[3] = (1 << 29) / (31 - 2); + corr[i][3].prec = 1; + corr[i][3].coef[0] = 63 - 4; + corr[i][3].coef[1] = 64 + 4; + corr[i][3].coef[2] = (1 << 29) / (63 - 4); + corr[i][3].coef[3] = (1 << 29) / (63 - 4); j = 4; break; + case JS_SW_TYPE_FFW: + + corr[i][0].type = JS_CORR_BROKEN; + corr[i][0].prec = 2; + corr[i][0].coef[0] = 511 - 8; + corr[i][0].coef[1] = 512 + 8; + corr[i][0].coef[2] = (1 << 29) / (511 - 8); + corr[i][0].coef[3] = (1 << 29) / (511 - 8); + + corr[i][1].type = JS_CORR_BROKEN; + corr[i][1].prec = 1; + corr[i][1].coef[0] = 63; + corr[i][1].coef[1] = 63; + corr[i][1].coef[2] = (1 << 29) / -63; + corr[i][1].coef[3] = (1 << 29) / -63; + + corr[i][2].type = JS_CORR_BROKEN; + corr[i][2].prec = 1; + corr[i][2].coef[0] = 63; + corr[i][2].coef[1] = 63; + corr[i][2].coef[2] = (1 << 29) / -63; + corr[i][2].coef[3] = (1 << 29) / -63; + + j = 3; + + break; + + case JS_SW_TYPE_FSP: + + corr[i][2].type = JS_CORR_BROKEN; + corr[i][2].prec = 0; + corr[i][2].coef[0] = 31 - 2; + corr[i][2].coef[1] = 32 + 2; + corr[i][2].coef[2] = (1 << 29) / (31 - 2); + corr[i][2].coef[3] = (1 << 29) / (31 - 2); + + j = 3; + + break; + default: j = 0; - } - for (; j < num_axes; j++) { + for (; j < num_axes; j++) { /* Hats & other binary axes */ corr[i][j].type = JS_CORR_BROKEN; corr[i][j].prec = 0; corr[i][j].coef[0] = 0; @@ -358,83 +609,211 @@ } /* + * js_sw_print_packet() prints the contents of a SideWinder packet. + */ + +static void js_sw_print_packet(char *name, int length, unsigned char *buf, char bits) +{ + int i; + + printk("joy-sidewinder: %s packet, %d bits. [", name, length); + for (i = (((length + 3) >> 2) - 1); i >= 0; i--) + printk("%x", (int)js_sw_get_bits(buf, i << 2, 4, 0, bits)); + printk("]\n"); +} + +/* + * js_sw_3dp_id() translates the 3DP id into a human legible string. + * Unfortunately I don't know how to do this for the other SW types. + */ + +static void js_sw_3dp_id(unsigned char *buf, char *comment) +{ + int i; + char pnp[8], rev[9]; + + for (i = 0; i < 7; i++) /* ASCII PnP ID */ + pnp[i] = js_sw_get_bits(buf, 24+8*i, 8, 0, 1); + + for (i = 0; i < 8; i++) /* ASCII firmware revision */ + rev[i] = js_sw_get_bits(buf, 88+8*i, 8, 0, 1); + + pnp[7] = rev[8] = 0; + + sprintf(comment, " [PnP %d.%02d id %s rev %s]", + (int) (js_sw_get_bits(buf, 8, 6, 6, 1) | /* Two 6-bit values */ + js_sw_get_bits(buf, 16, 6, 0, 1)) / 100, + (int) (js_sw_get_bits(buf, 8, 6, 6, 1) | + js_sw_get_bits(buf, 16, 6, 0, 1)) % 100, + pnp, rev); +} + +/* + * js_sw_guess_mode() checks the upper two button bits for toggling - + * indication of that the joystick is in 3-bit mode. This is documented + * behavior for 3DP ID packet, and for example the FSP does this in + * normal packets instead. Fun ... + */ + +static int js_sw_guess_mode(unsigned char *buf, int len) +{ + int i; + unsigned char xor = 0; + for (i = 1; i < len; i++) xor |= (buf[i - 1] ^ buf[i]) & 6; + return !!xor * 2 + 1; +} + +/* * js_sw_probe() probes for SideWinder type joysticks. */ static struct js_port __init *js_sw_probe(int io, struct js_port *port) { struct js_sw_info info; - char *name; - int i, j, axes, buttons; - __u64 data; - unsigned char u; + char *names[] = {NULL, "SideWinder 3D Pro", "Flight2000 F-23", "SideWinder GamePad", "SideWinder Precision Pro", + "SideWinder Force Feedback Pro", "SideWinder FreeStyle Pro", "SideWinder Force Feedback Wheel" }; + char axes[] = { 0, 6, 6, 2, 6, 6, 5, 3 }; + char buttons[] = { 0, 9, 9, 10, 9, 9, 10, 8 }; + int i, j, k, l, speed; + unsigned char buf[JS_SW_LENGTH]; + unsigned char idbuf[JS_SW_LENGTH]; + unsigned char m = 1; + char comment[40]; + comment[0] = 0; if (check_region(io, 1)) return port; - if (((u = inb(io)) & 3) == 3) return port; - outb(0xff,io); - if (!((inb(io) ^ u) & ~u & 0xf)) return port; - - i = js_sw_read_packet(io, JS_SW_MAX_LENGTH, -1, JS_SW_EXT_STROBE, &data); - - if (!i) { - udelay(JS_SW_MIN_TIME); - js_sw_init_digital(io); - udelay(JS_SW_MAX_TIME); - i = js_sw_read_packet(io, JS_SW_MAX_LENGTH, -1, JS_SW_EXT_STROBE, &data); - } - - switch (i) { - case 0: - return port; - case 5: - case 10: - case 15: - case 20: - case 30: - case 45: - case 60: - info.mode = JS_SW_MODE_GP; - outb(0xff,io); /* Kick into 3-bit mode */ - udelay(JS_SW_MAX_TIME); - i = js_sw_read_packet(io, 60, -1, JS_SW_EXT_STROBE, &data); /* Get total length */ - udelay(JS_SW_MIN_TIME); - j = js_sw_read_packet(io, 15, -1, JS_SW_MIN_STROBE, &data); /* Get subpacket length */ - if (!i || !j) { - printk(KERN_WARNING "joy-sidewinder: SideWinder GamePad detected (%d,%d)," - " but not idenfitied.\n", i, j); - return port; + + speed = js_sw_measure_speed(io); + + i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Read normal packet */ + m |= js_sw_guess_mode(buf, i); /* Data packet (1-bit) can carry mode info [FSP] */ + udelay(JS_SW_TIMEOUT); + +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 1: Mode %d. Length %d.\n", m , i); +#endif + + if (!i) { /* No data. 3d Pro analog mode? */ + js_sw_init_digital(io, speed); /* Switch to digital */ + udelay(JS_SW_TIMEOUT); + i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Retry reading packet */ + udelay(JS_SW_TIMEOUT); +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 1b: Length %d.\n", i); +#endif + if (!i) return port; /* No data -> FAIL */ + } + + j = js_sw_read_packet(io, speed, idbuf, JS_SW_LENGTH, i); /* Read ID. This initializes the stick */ + m |= js_sw_guess_mode(idbuf, j); /* ID packet should carry mode info [3DP] */ + +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 2: Mode %d. ID Length %d.\n", m , j); +#endif + + if (!j) { /* Read ID failed. Happens in 1-bit mode on PP */ + udelay(JS_SW_TIMEOUT); + i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Retry reading packet */ +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 2b: Mode %d. Length %d.\n", m , i); +#endif + if (!i) return port; + udelay(JS_SW_TIMEOUT); + j = js_sw_read_packet(io, speed, idbuf, JS_SW_LENGTH, i);/* Retry reading ID */ +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 2c: ID Length %d.\n", j); +#endif + + } + + k = JS_SW_FAIL; /* Try JS_SW_FAIL times */ + l = 0; + + do { + k--; + udelay(JS_SW_TIMEOUT); + i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Read data packet */ +#ifdef JS_SW_DEBUG + printk(KERN_DEBUG "joy-sidewinder: Init 3: Length %d.\n", i); +#endif + + if (i > l) { /* Longer? As we can only lose bits, it makes */ + /* no sense to try detection for a packet shorter */ + l = i; /* than the previous one */ + + info.number = 1; + info.io = io; + info.speed = speed; + info.length = i; + info.bits = m; + info.fail = 0; + info.ok = 0; + info.type = 0; + + switch (i * m) { + case 60: + info.number++; + case 45: /* Ambiguous packet length */ + if (j <= 40) { /* ID length less or eq 40 -> FSP */ + case 43: + info.type = JS_SW_TYPE_FSP; + break; + } + info.number++; + case 30: + info.number++; + case 15: + info.type = JS_SW_TYPE_GP; + break; + case 33: + case 31: + info.type = JS_SW_TYPE_FFW; + break; + case 48: /* Ambiguous */ + if (j == 14) { /* ID lenght 14*3 -> FFP */ + info.type = JS_SW_TYPE_FFP; + sprintf(comment, " [AC %s]", js_sw_get_bits(idbuf,38,1,0,3) ? "off" : "on"); + } else + info.type = JS_SW_TYPE_PP; + break; + case 198: + info.length = 22; + case 64: + info.type = JS_SW_TYPE_3DP; + if (j == 160) js_sw_3dp_id(idbuf, comment); + break; } - info.number = i / j; - axes = 2; buttons = 10; name = "SideWinder GamePad"; - break; - case 16: - case 48: - info.mode = JS_SW_MODE_PP; info.number = 1; - axes = 6; buttons = 9; name = "SideWinder Precision Pro"; - break; - case 64: - case 66: - info.mode = JS_SW_MODE_3DP; info.number = 1; info.optimize = 0; - axes = 6; buttons = 8; name = "SideWinder 3D Pro"; - break; - case 72: - return port; - default: - printk(KERN_WARNING "joy-sidewinder: unknown joystick device detected " - "(io=%#x, count=%d, data=0x%08x%08x), contact \n", - io, i, (int)(data >> 32), (int)(data & 0xffffffff)); - return port; + } + + } while (k && !info.type); + + if (!info.type) { + printk(KERN_WARNING "joy-sidewinder: unknown joystick device detected " + "(io=%#x), contact \n", io); + js_sw_print_packet("ID", j * 3, idbuf, 3); + js_sw_print_packet("Data", i * m, buf, m); + return port; } - info.io = io; +#ifdef JS_SW_DEBUG + js_sw_print_packet("ID", j * 3, idbuf, 3); + js_sw_print_packet("Data", i * m, buf, m); +#endif + + k = i; request_region(io, 1, "joystick (sidewinder)"); + port = js_register_port(port, &info, info.number, sizeof(struct js_sw_info), js_sw_read); + for (i = 0; i < info.number; i++) - printk(KERN_INFO "js%d: %s at %#x\n", - js_register_device(port, i, axes, buttons, name, js_sw_open, js_sw_close), name, io); - js_sw_init_corr(axes, info.mode, info.number, port->corr); + printk(KERN_INFO "js%d: %s%s at %#x [%d ns res %d-bit id %d data %d]\n", + js_register_device(port, i, axes[info.type], buttons[info.type], + names[info.type], js_sw_open, js_sw_close), names[info.type], comment, io, + 1000000 / speed, m, j, k); + + js_sw_init_corr(axes[info.type], info.type, info.number, port->corr); return port; } @@ -463,9 +842,9 @@ int i; struct js_sw_info *info; - while (js_sw_port != NULL) { + while (js_sw_port) { for (i = 0; i < js_sw_port->ndevs; i++) - if (js_sw_port->devs[i] != NULL) + if (js_sw_port->devs[i]) js_unregister_device(js_sw_port->devs[i]); info = js_sw_port->info; release_region(info->io, 1); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-spaceball.c linux/drivers/char/joystick/joy-spaceball.c --- v2.3.30/linux/drivers/char/joystick/joy-spaceball.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-spaceball.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,347 @@ +/* + * joy-spaceball.c Version 0.1 + * + * Copyright (c) 1998 David Thompson + * Copyright (c) 1999 Vojtech Pavlik + * Copyright (c) 1999 Joseph Krahn + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * the SpaceTec SpaceBall 4000 FLX. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constants. + */ + +#define N_JOYSTICK_SBALL 12 +#define JS_SBALL_MAX_LENGTH 128 + +/* + * List of SpaceBalls. + */ + +static struct js_port* js_sball_port = NULL; + +/* + * Per-Ball data. + */ + +struct js_sball_info { + struct tty_struct* tty; + struct js_port* port; + int idx; + unsigned char data[JS_SBALL_MAX_LENGTH]; + int js; + char used; +}; + +/* + * js_sball_process_packet() decodes packets the driver receives from the + * SpaceBall. + */ + +static void js_sball_process_packet(struct js_sball_info* info) +{ + int i,b; + int **axes = info->port->axes; + int **buttons = info->port->buttons; + unsigned char *data = info->data; + + if (info->idx < 2) return; + + switch (info->data[0]) { + + case '@': /* Reset packet */ + info->data[info->idx - 1] = 0; + for (i = 1; i < info->idx && info->data[i] == ' '; i++); + + printk(KERN_INFO "js%d: SpaceBall 4000FLX [%s] on %s%d\n", + info->js, info->data + i, info->tty->driver.name, + MINOR(info->tty->device) - info->tty->driver.minor_start); + + memset(axes[0], 0, sizeof(int) * 6); /* All axes, buttons should be zero */ + buttons[0][0] = 0; + break; + + case 'D': /* Ball data */ + if (info->idx != 16) return; + if (!info->port->devs[0]) return; + axes[0][0] = ((data[3] << 8) | data[4] ); + axes[0][1] = ((data[5] << 8) | data[6] ); + axes[0][2] = ((data[7] << 8) | data[8] ); + axes[0][3] = ((data[9] << 8) | data[10]); + axes[0][4] = ((data[11]<< 8) | data[12]); + axes[0][5] = ((data[13]<< 8) | data[14]); + for(i = 0; i < 6; i ++) if (axes[0][i] & 0x8000) axes[0][i] -= 0x10000; + break; + + case 'K': /* Button data, part1 */ + /* We can ignore this packet for the SB 4000FLX. */ + break; + + case '.': /* Button data, part2 */ + if (info->idx != 4) return; + if (!info->port->devs[0]) return; + b = (data[1] & 0xbf) << 8 | (data[2] & 0xbf); + buttons[0][0] = ((b & 0x1f80) >> 1 | (b & 0x3f)); + break; + + case '?': /* Error packet */ + info->data[info->idx - 1] = 0; + printk(KERN_ERR "joy-spaceball: Device error. [%s]\n",info->data+1); + break; + + case 'A': /* reply to A command (ID# report) */ + case 'B': /* reply to B command (beep) */ + case 'H': /* reply to H command (firmware report) */ + case 'S': /* reply to S command (single beep) */ + case 'Y': /* reply to Y command (scale flag) */ + case '"': /* reply to "n command (report info, part n) */ + break; + + case 'P': /* Pulse (update) speed */ + if (info->idx != 3) return; /* data[2],data[3] = hex digits for speed 00-FF */ + break; + + default: + printk("joy-spaceball: Unknown packet %d length %d:", data[0], info->idx); + for (i = 0; i < info->idx; i++) printk(" %02x", data[i]); + printk("\n"); + return; + } +} + +/* + * js_sball_open() is a callback from the joystick device open routine. + */ + +static int js_sball_open(struct js_dev *jd) +{ + struct js_sball_info *info = jd->port->info; + info->used++; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_sball_close() is a callback from the joystick device release routine. + */ + +static int js_sball_close(struct js_dev *jd) +{ + struct js_sball_info *info = jd->port->info; + if (!--info->used) { + js_unregister_device(jd->port->devs[0]); + js_sball_port = js_unregister_port(jd->port); + } + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_sball_init_corr() initializes the correction values for the SpaceBall. + */ + +static void __init js_sball_init_corr(struct js_corr **corr) +{ + int j; + + for (j = 0; j < 3; j++) { + corr[0][j].type = JS_CORR_BROKEN; + corr[0][j].prec = 0; + corr[0][j].coef[0] = 0; + corr[0][j].coef[1] = 0; + corr[0][j].coef[2] = 50000; + corr[0][j].coef[3] = 50000; + } + for (j = 3; j < 6; j++) { + corr[0][j].type = JS_CORR_BROKEN; + corr[0][j].prec = 0; + corr[0][j].coef[0] = 0; + corr[0][j].coef[1] = 0; + corr[0][j].coef[2] = 300000; + corr[0][j].coef[3] = 300000; + } +} + +/* + * js_sball_ldisc_open() is the routine that is called upon setting our line + * discipline on a tty. + */ + +static int js_sball_ldisc_open(struct tty_struct *tty) +{ + struct js_sball_info iniinfo; + struct js_sball_info *info = &iniinfo; + + info->tty = tty; + info->idx = 0; + info->used = 1; + + js_sball_port = js_register_port(js_sball_port, info, 1, sizeof(struct js_sball_info), NULL); + + info = js_sball_port->info; + info->port = js_sball_port; + tty->disc_data = info; + + info->js = js_register_device(js_sball_port, 0, 6, 12, "SpaceBall 4000 FLX", js_sball_open, js_sball_close); + + js_sball_init_corr(js_sball_port->corr); + + MOD_INC_USE_COUNT; + + return 0; +} + +/* + * js_sball_ldisc_close() is the opposite of js_sball_ldisc_open() + */ + +static void js_sball_ldisc_close(struct tty_struct *tty) +{ + struct js_sball_info* info = (struct js_sball_info*) tty->disc_data; + if (!--info->used) { + js_unregister_device(info->port->devs[0]); + js_sball_port = js_unregister_port(info->port); + } + MOD_DEC_USE_COUNT; +} + +/* + * js_sball_ldisc_receive() is called by the low level driver when characters + * are ready for us. We then buffer them for further processing, or call the + * packet processing routine. + */ + +static void js_sball_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) +{ + struct js_sball_info* info = (struct js_sball_info*) tty->disc_data; + int i; + int esc_flag = 0; + +/* + * Spaceball 4000 FLX packets all start with a one letter packet-type decriptor, + * and end in 0x0d. It uses '^' as an escape for 0x0d characters which can + * occur in the axis values. ^M, ^Q and ^S all mean 0x0d, depending (I think) + * on whether the axis value is increasing, decreasing, or same as before. + * (I don't see why this is useful). + * + * There may be a nicer whay to handle the escapes, but I wanted to be sure to + * allow for an escape at the end of the buffer. + */ + for (i = 0; i < count; i++) { + if (esc_flag) { /* If the last char was an escape, overwrite it with the escaped value */ + + switch (cp[i]){ + case 'M': + case 'Q': + case 'S': + info->data[info->idx]=0x0d; + break; + case '^': /* escaped escape; leave as is */ + break; + default: + printk("joy-spaceball: Unknown escape character: %02x\n", cp[i]); + } + + esc_flag = 0; + + } else { + + if (info->idx < JS_SBALL_MAX_LENGTH) + info->data[info->idx++] = cp[i]; + + if (cp[i] == 0x0D) { + if (info->idx) + js_sball_process_packet(info); + info->idx = 0; + } else + if (cp[i] == '^') esc_flag = 1; + + } + } +} + +/* + * js_sball_ldisc_room() reports how much room we do have for receiving data. + * Although we in fact have infinite room, we need to specify some value + * here, so why not the size of our packet buffer. It's big anyway. + */ + +static int js_sball_ldisc_room(struct tty_struct *tty) +{ + return JS_SBALL_MAX_LENGTH; +} + +/* + * The line discipline structure. + */ + +static struct tty_ldisc js_sball_ldisc = { + magic: TTY_LDISC_MAGIC, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) + name: "spaceball", +#endif + open: js_sball_ldisc_open, + close: js_sball_ldisc_close, + receive_buf: js_sball_ldisc_receive, + receive_room: js_sball_ldisc_room, +}; + +/* + * The functions for inserting/removing us as a module. + */ + +#ifdef MODULE +int init_module(void) +#else +int __init js_sball_init(void) +#endif +{ + if (tty_register_ldisc(N_JOYSTICK_SBALL, &js_sball_ldisc)) { + printk(KERN_ERR "joy-spaceball: Error registering line discipline.\n"); + return -ENODEV; + } + + return 0; +} + +#ifdef MODULE +void cleanup_module(void) +{ + tty_register_ldisc(N_JOYSTICK_SBALL, NULL); +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-spaceorb.c linux/drivers/char/joystick/joy-spaceorb.c --- v2.3.30/linux/drivers/char/joystick/joy-spaceorb.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-spaceorb.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,305 @@ +/* + * joy-spaceorb.c Version 0.1 + * + * Copyright (c) 1998 David Thompson + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * the SpaceTec SpaceOrb 360 and SpaceBall Avenger 6dof controllers. + */ + +/* + * 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constants. + */ + +#define N_JOYSTICK_ORB 15 +#define JS_ORB_MAX_LENGTH 64 + +/* + * List of SpaceOrbs. + */ + +static struct js_port* js_orb_port = NULL; + +/* + * Per-Orb data. + */ + +struct js_orb_info { + struct tty_struct* tty; + struct js_port* port; + int idx; + unsigned char data[JS_ORB_MAX_LENGTH]; + int js; + char used; +}; + +static unsigned char js_orb_xor[] = "SpaceWare"; + +static unsigned char *js_orb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout", + "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; + +/* + * js_orb_process_packet() decodes packets the driver receives from the + * SpaceOrb. + */ + +static void js_orb_process_packet(struct js_orb_info* info) +{ + int i; + int **axes = info->port->axes; + int **buttons = info->port->buttons; + unsigned char *data = info->data; + unsigned char c = 0; + + if (info->idx < 2) return; + for (i = 0; i < info->idx; i++) c ^= data[i]; + if (c) return; + + switch (info->data[0]) { + + case 'R': /* Reset packet */ + info->data[info->idx - 1] = 0; + for (i = 1; i < info->idx && info->data[i] == ' '; i++); + printk(KERN_INFO "js%d: SpaceOrb 360 [%s] on %s%d\n", + info->js, info->data + i, info->tty->driver.name, + MINOR(info->tty->device) - info->tty->driver.minor_start); + break; + + case 'D': /* Ball + button data */ + if (info->idx != 12) return; + if (!info->port->devs[0]) return; + for (i = 0; i < 9; i++) info->data[i+2] ^= js_orb_xor[i]; + axes[0][0] = ( data[2] << 3) | (data[ 3] >> 4); + axes[0][1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1); + axes[0][2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5); + axes[0][3] = ((data[6] & 0x1f) << 5) | (data[ 7] >> 2); + axes[0][4] = ((data[7] & 0x03) << 8) | (data[ 8] << 1) | (data[7] >> 6); + axes[0][5] = ((data[9] & 0x3f) << 4) | (data[10] >> 3); + for(i = 0; i < 6; i ++) if (axes[0][i] & 0x200) axes[0][i] -= 1024; + buttons[0][0] = data[1]; + break; + + case 'K': /* Button data */ + if (info->idx != 5) return; + if (!info->port->devs[0]) return; + buttons[0][0] = data[2]; + break; + + case 'E': /* Error packet */ + if (info->idx != 4) return; + printk(KERN_ERR "joy-spaceorb: Device error. [ "); + for (i = 0; i < 7; i++) + if (data[1] & (1 << i)) + printk("%s ", js_orb_errors[i]); + printk("]\n"); + break; + + case 'N': /* Null region */ + if (info->idx != 3) return; + break; + + case 'P': /* Pulse (update) speed */ + if (info->idx != 4) return; + break; + + default: + printk("joy-spaceorb: Unknown packet %d length %d:", data[0], info->idx); + for (i = 0; i < info->idx; i++) printk(" %02x", data[i]); + printk("\n"); + return; + } +} + +/* + * js_orb_open() is a callback from the joystick device open routine. + */ + +static int js_orb_open(struct js_dev *jd) +{ + struct js_orb_info *info = jd->port->info; + info->used++; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_orb_close() is a callback from the joystick device release routine. + */ + +static int js_orb_close(struct js_dev *jd) +{ + struct js_orb_info *info = jd->port->info; + if (!--info->used) { + js_unregister_device(jd->port->devs[0]); + js_orb_port = js_unregister_port(jd->port); + } + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_orb_init_corr() initializes the correction values for the SpaceOrb. + */ + +static void __init js_orb_init_corr(struct js_corr **corr) +{ + int j; + + for (j = 0; j < 6; j++) { + corr[0][j].type = JS_CORR_BROKEN; + corr[0][j].prec = 0; + corr[0][j].coef[0] = 0 ; + corr[0][j].coef[1] = 0 ; + corr[0][j].coef[2] = (1 << 29) / 511; + corr[0][j].coef[3] = (1 << 29) / 511; + } +} + +/* + * js_orb_ldisc_open() is the routine that is called upon setting our line + * discipline on a tty. + */ + +static int js_orb_ldisc_open(struct tty_struct *tty) +{ + struct js_orb_info iniinfo; + struct js_orb_info *info = &iniinfo; + + info->tty = tty; + info->idx = 0; + info->used = 1; + + js_orb_port = js_register_port(js_orb_port, info, 1, sizeof(struct js_orb_info), NULL); + + info = js_orb_port->info; + info->port = js_orb_port; + tty->disc_data = info; + + info->js = js_register_device(js_orb_port, 0, 6, 7, "SpaceOrb 360", js_orb_open, js_orb_close); + + js_orb_init_corr(js_orb_port->corr); + + MOD_INC_USE_COUNT; + + return 0; +} + +/* + * js_orb_ldisc_close() is the opposite of js_orb_ldisc_open() + */ + +static void js_orb_ldisc_close(struct tty_struct *tty) +{ + struct js_orb_info* info = (struct js_orb_info*) tty->disc_data; + if (!--info->used) { + js_unregister_device(info->port->devs[0]); + js_orb_port = js_unregister_port(info->port); + } + MOD_DEC_USE_COUNT; +} + +/* + * js_orb_ldisc_receive() is called by the low level driver when characters + * are ready for us. We then buffer them for further processing, or call the + * packet processing routine. + */ + +static void js_orb_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) +{ + struct js_orb_info* info = (struct js_orb_info*) tty->disc_data; + int i; + + for (i = 0; i < count; i++) { + if (~cp[i] & 0x80) { + if (info->idx) js_orb_process_packet(info); + info->idx = 0; + } + if (info->idx < JS_ORB_MAX_LENGTH) + info->data[info->idx++] = cp[i] & 0x7f; + } +} + +/* + * js_orb_ldisc_room() reports how much room we do have for receiving data. + * Although we in fact have infinite room, we need to specify some value + * here, so why not the size of our packet buffer. It's big anyway. + */ + +static int js_orb_ldisc_room(struct tty_struct *tty) +{ + return JS_ORB_MAX_LENGTH; +} + +/* + * The line discipline structure. + */ + +static struct tty_ldisc js_orb_ldisc = { + magic: TTY_LDISC_MAGIC, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) + name: "spaceorb", +#endif + open: js_orb_ldisc_open, + close: js_orb_ldisc_close, + receive_buf: js_orb_ldisc_receive, + receive_room: js_orb_ldisc_room, +}; + +/* + * The functions for inserting/removing us as a module. + */ + +#ifdef MODULE +int init_module(void) +#else +int __init js_orb_init(void) +#endif +{ + if (tty_register_ldisc(N_JOYSTICK_ORB, &js_orb_ldisc)) { + printk(KERN_ERR "joy-spaceorb: Error registering line discipline.\n"); + return -ENODEV; + } + + return 0; +} + +#ifdef MODULE +void cleanup_module(void) +{ + tty_register_ldisc(N_JOYSTICK_ORB, NULL); +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-thrustmaster.c linux/drivers/char/joystick/joy-thrustmaster.c --- v2.3.30/linux/drivers/char/joystick/joy-thrustmaster.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-thrustmaster.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-thrustmaster.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -38,28 +40,15 @@ #include #include #include +#include #define JS_TM_MAX_START 400 -#define JS_TM_MAX_STROBE 25 +#define JS_TM_MAX_STROBE 45 #define JS_TM_MAX_LENGTH 13 #define JS_TM_MODE_M3DI 1 #define JS_TM_MODE_3DRP 3 -#define JS_TM_MODE_WCS3 4 - -#define JS_TM_MODE_MAX 5 /* Last mode + 1 */ - -#define JS_TM_BYTE_A0 0 -#define JS_TM_BYTE_A1 1 -#define JS_TM_BYTE_A2 3 -#define JS_TM_BYTE_A3 4 -#define JS_TM_BYTE_A4 6 -#define JS_TM_BYTE_A5 7 - -#define JS_TM_BYTE_D0 2 -#define JS_TM_BYTE_D1 5 -#define JS_TM_BYTE_D2 8 -#define JS_TM_BYTE_D3 9 +#define JS_TM_MODE_FGP 163 #define JS_TM_BYTE_ID 10 #define JS_TM_BYTE_REV 11 @@ -68,48 +57,39 @@ static int js_tm_port_list[] __initdata = {0x201, 0}; static struct js_port* js_tm_port __initdata = NULL; +static unsigned char js_tm_byte_a[16] = { 0, 1, 3, 4, 6, 7 }; +static unsigned char js_tm_byte_d[16] = { 2, 5, 8, 9 }; + struct js_tm_info { int io; unsigned char mode; }; -static int js_tm_id_to_def[JS_TM_MODE_MAX] = {0x00, 0x42, 0x00, 0x22, 0x00}; - /* * js_tm_read_packet() reads a ThrustMaster packet. */ static int js_tm_read_packet(int io, unsigned char *data) { - unsigned int t, t1; + unsigned int t, p; unsigned char u, v, error; int i, j; unsigned long flags; - int start = (js_time_speed * JS_TM_MAX_START) >> 10; - int strobe = (js_time_speed * JS_TM_MAX_STROBE) >> 10; - error = 0; i = j = 0; + p = t = JS_TM_MAX_START; __save_flags(flags); __cli(); outb(0xff,io); - - t = js_get_time(); + + v = inb(io) >> 4; do { - u = inb(io); - t1 = js_get_time(); - } while ((u & 1) && js_delta(t1, t) < start); - - t = t1; - u >>= 4; - - do { - v = inb(io) >> 4; - t1 = js_get_time(); - if ((u ^ v) & u & 2) { + t--; + u = v; v = inb(io) >> 4; + if (~v & u & 2) { if (j) { if (j < 9) { /* Data bit */ data[i] |= (~v & 1) << (j - 1); @@ -124,10 +104,9 @@ error |= ~v & 1; j++; } - t = t1; + p = t = (p - t) << 1; } - u = v; - } while (!error && i < JS_TM_MAX_LENGTH && js_delta(t1,t) < strobe); + } while (!error && i < JS_TM_MAX_LENGTH && t > 0); __restore_flags(flags); @@ -142,46 +121,39 @@ { struct js_tm_info *info = xinfo; unsigned char data[JS_TM_MAX_LENGTH]; + int i; - if (js_tm_read_packet(info->io, data)) { - printk(KERN_WARNING "joy-thrustmaster: failed to read data packet\n"); - return -1; - } - if (data[JS_TM_BYTE_ID] != info->mode) { - printk(KERN_WARNING "joy-thrustmaster: ID (%d) != mode (%d)\n", - data[JS_TM_BYTE_ID], info->mode); - return -1; - } - if (data[JS_TM_BYTE_DEF] != js_tm_id_to_def[info->mode]) { - printk(KERN_WARNING "joy-thrustmaster: DEF (%d) != def(mode) (%d)\n", - data[JS_TM_BYTE_DEF], js_tm_id_to_def[info->mode]); - return -1; - } + if (js_tm_read_packet(info->io, data)) return -1; + if (data[JS_TM_BYTE_ID] != info->mode) return -1; + + for (i = 0; i < data[JS_TM_BYTE_DEF] >> 4; i++) axes[0][i] = data[js_tm_byte_a[i]]; switch (info->mode) { case JS_TM_MODE_M3DI: - axes[0][0] = data[JS_TM_BYTE_A0]; - axes[0][1] = data[JS_TM_BYTE_A1]; - axes[0][2] = data[JS_TM_BYTE_A2]; - axes[0][3] = data[JS_TM_BYTE_A3]; - - axes[0][4] = ((data[JS_TM_BYTE_D0] >> 3) & 1) - ((data[JS_TM_BYTE_D0] >> 1) & 1); - axes[0][5] = ((data[JS_TM_BYTE_D0] >> 2) & 1) - ( data[JS_TM_BYTE_D0] & 1); + axes[0][4] = ((data[js_tm_byte_d[0]] >> 3) & 1) - ((data[js_tm_byte_d[0]] >> 1) & 1); + axes[0][5] = ((data[js_tm_byte_d[0]] >> 2) & 1) - ( data[js_tm_byte_d[0]] & 1); - buttons[0][0] = ((data[JS_TM_BYTE_D0] >> 6) & 0x01) | ((data[JS_TM_BYTE_D0] >> 3) & 0x06) - | ((data[JS_TM_BYTE_D0] >> 4) & 0x08) | ((data[JS_TM_BYTE_D1] >> 2) & 0x30); + buttons[0][0] = ((data[js_tm_byte_d[0]] >> 6) & 0x01) | ((data[js_tm_byte_d[0]] >> 3) & 0x06) + | ((data[js_tm_byte_d[0]] >> 4) & 0x08) | ((data[js_tm_byte_d[1]] >> 2) & 0x30); return 0; case JS_TM_MODE_3DRP: + case JS_TM_MODE_FGP: + + buttons[0][0] = (data[js_tm_byte_d[0]] & 0x3f) | ((data[js_tm_byte_d[1]] << 6) & 0xc0) + | (( ((int) data[js_tm_byte_d[0]]) << 2) & 0x300); + + return 0; + + default: - axes[0][0] = data[JS_TM_BYTE_A0]; - axes[0][1] = data[JS_TM_BYTE_A1]; + buttons[0][0] = 0; - buttons[0][0] = ( data[JS_TM_BYTE_D0] & 0x3f) | ((data[JS_TM_BYTE_D1] << 6) & 0xc0) - | (( ((int) data[JS_TM_BYTE_D0]) << 2) & 0x300); + for (i = 0; i < (data[JS_TM_BYTE_DEF] & 0xf); i++) + buttons[0][0] |= ((int) data[js_tm_byte_d[i]]) << (i << 3); return 0; @@ -217,9 +189,9 @@ static void __init js_tm_init_corr(int num_axes, int mode, int **axes, struct js_corr **corr) { - int j; + int j = 0; - for (j = 0; j < num_axes; j++) { + for (; j < num_axes; j++) { corr[0][j].type = JS_CORR_BROKEN; corr[0][j].prec = 0; corr[0][j].coef[0] = 127 - 2; @@ -230,8 +202,7 @@ switch (mode) { case JS_TM_MODE_M3DI: j = 4; break; - case JS_TM_MODE_3DRP: j = 2; break; - default: j = 0; break; + default: break; } for (; j < num_axes; j++) { @@ -252,48 +223,46 @@ static struct js_port __init *js_tm_probe(int io, struct js_port *port) { struct js_tm_info info; - char *names[JS_TM_MODE_MAX] = { NULL, "ThrustMaster Millenium 3D Inceptor", NULL, - "ThrustMaster Rage 3D Gamepad", "ThrustMaster WCS III" }; - char axes[JS_TM_MODE_MAX] = { 0, 6, 0, 2, 0 }; - char buttons[JS_TM_MODE_MAX] = { 0, 5, 0, 10, 0 }; - + struct js_rm_models { + unsigned char id; + char *name; + char axes; + char buttons; + } models[] = { { 1, "ThrustMaster Millenium 3D Inceptor", 6, 6 }, + { 3, "ThrustMaster Rage 3D Gamepad", 2, 10 }, + { 163, "Thrustmaster Fusion GamePad", 2, 10 }, + { 0, NULL, 0, 0 }}; + char name[64]; unsigned char data[JS_TM_MAX_LENGTH]; - unsigned char u; + unsigned char a, b; + int i; if (check_region(io, 1)) return port; - if (((u = inb(io)) & 3) == 3) return port; - outb(0xff,io); - if (!((inb(io) ^ u) & ~u & 0xf)) return port; - - if(js_tm_read_packet(io, data)) { - printk(KERN_WARNING "joy-thrustmaster: probe - can't read packet\n"); - return port; - } + if (js_tm_read_packet(io, data)) return port; info.io = io; info.mode = data[JS_TM_BYTE_ID]; if (!info.mode) return port; - if (info.mode >= JS_TM_MODE_MAX || !names[info.mode]) { - printk(KERN_WARNING "joy-thrustmaster: unknown device detected " - "(io=%#x, id=%d), contact \n", - io, info.mode); - return port; - } + for (i = 0; models[i].id && models[i].id != info.mode; i++); - if (data[JS_TM_BYTE_DEF] != js_tm_id_to_def[info.mode]) { - printk(KERN_WARNING "joy-thrustmaster: wrong DEF (%d) for ID %d - should be %d\n", - data[JS_TM_BYTE_DEF], info.mode, js_tm_id_to_def[info.mode]); + if (models[i].id != info.mode) { + a = data[JS_TM_BYTE_DEF] >> 4; + b = (data[JS_TM_BYTE_DEF] & 0xf) << 3; + sprintf(name, "Unknown %d-axis, %d-button TM device %d", a, b, info.mode); + } else { + sprintf(name, models[i].name); + a = models[i].axes; + b = models[i].buttons; } request_region(io, 1, "joystick (thrustmaster)"); port = js_register_port(port, &info, 1, sizeof(struct js_tm_info), js_tm_read); printk(KERN_INFO "js%d: %s revision %d at %#x\n", - js_register_device(port, 0, axes[info.mode], buttons[info.mode], - names[info.mode], js_tm_open, js_tm_close), names[info.mode], data[JS_TM_BYTE_REV], io); - js_tm_init_corr(axes[info.mode], info.mode, port->axes, port->corr); + js_register_device(port, 0, a, b, name, js_tm_open, js_tm_close), name, data[JS_TM_BYTE_REV], io); + js_tm_init_corr(a, info.mode, port->axes, port->corr); return port; } @@ -321,7 +290,7 @@ { struct js_tm_info *info; - while (js_tm_port != NULL) { + while (js_tm_port) { js_unregister_device(js_tm_port->devs[0]); info = js_tm_port->info; release_region(info->io, 1); diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-turbografx.c linux/drivers/char/joystick/joy-turbografx.c --- v2.3.30/linux/drivers/char/joystick/joy-turbografx.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joy-turbografx.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* * joy-turbografx.c Version 1.2 * - * Copyright (c) 1998 Vojtech Pavlik + * Copyright (c) 1998-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -39,6 +41,7 @@ #include #include #include +#include MODULE_AUTHOR("Vojtech Pavlik "); @@ -57,18 +60,14 @@ #define JS_TG_BUTTON4 0x01 #define JS_TG_BUTTON5 0x08 -static struct js_port* js_tg_port = NULL; +static struct js_port* js_tg_port __initdata = NULL; static int js_tg[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 }; static int js_tg_2[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 }; static int js_tg_3[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 }; struct js_tg_info { -#ifdef USE_PARPORT struct pardevice *port; /* parport device */ -#else - int port; /* hw port */ -#endif int sticks; /* joysticks connected */ }; @@ -109,9 +108,7 @@ struct js_tg_info *info = dev->port->info; if (!MOD_IN_USE) { -#ifdef USE_PARPORT if (parport_claim(info->port)) return -EBUSY; -#endif JS_PAR_CTRL_OUT(0x04, info->port); } MOD_INC_USE_COUNT; @@ -129,9 +126,7 @@ MOD_DEC_USE_COUNT; if (!MOD_IN_USE) { JS_PAR_CTRL_OUT(0x00, info->port); -#ifdef USE_PARPORT parport_release(info->port); -#endif } return 0; } @@ -142,16 +137,12 @@ struct js_tg_info *info; int i; - while (js_tg_port != NULL) { + while (js_tg_port) { for (i = 0; i < js_tg_port->ndevs; i++) - if (js_tg_port->devs[i] != NULL) + if (js_tg_port->devs[i]) js_unregister_device(js_tg_port->devs[i]); info = js_tg_port->info; -#ifdef USE_PARPORT parport_unregister_device(info->port); -#else - release_region(info->port, 3); -#endif js_tg_port = js_unregister_port(js_tg_port); } } @@ -186,33 +177,25 @@ { struct js_tg_info iniinfo; struct js_tg_info *info = &iniinfo; + struct parport *pp; int i; if (config[0] < 0) return port; -#ifdef USE_PARPORT - { - struct parport *pp; - - if (config[0] > 0x10) - for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next); - else - for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--; - - if (pp == NULL) { - printk(KERN_ERR "joy-tg: no such parport\n"); - return port; - } - info->port = parport_register_device(pp, "joystick (turbografx)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); - if (!info->port) - return port; + if (config[0] > 0x10) + for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next); + else + for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--; + + if (!pp) { + printk(KERN_ERR "joy-tg: no such parport\n"); + return port; } -#else - info->port = config[0]; - if (check_region(info->port, 3)) return port; - request_region(info->port, 3, "joystick (turbografx)"); -#endif + + info->port = parport_register_device(pp, "joystick (turbografx)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); + if (!info->port) + return port; port = js_register_port(port, info, 7, sizeof(struct js_tg_info), js_tg_read); info = port->info; @@ -221,24 +204,14 @@ for (i = 0; i < 7; i++) if (config[i+1] > 0 && config[i+1] < 6) { -#ifdef USE_PARPORT printk(KERN_INFO "js%d: Multisystem joystick on %s\n", js_register_device(port, i, 2, config[i+1], "Multisystem joystick", js_tg_open, js_tg_close), info->port->port->name); -#else - printk(KERN_INFO "js%d: Multisystem joystick at %#x\n", - js_register_device(port, i, 2, config[i+1], "Multisystem joystick", js_tg_open, js_tg_close), - info->port); -#endif info->sticks |= (1 << i); } if (!info->sticks) { -#ifdef USE_PARPORT parport_unregister_device(info->port); -#else - release_region(info->port, 3); -#endif return port; } @@ -248,18 +221,30 @@ } #ifndef MODULE -void __init js_tg_setup(char *str, int *ints) +int __init js_tg_setup(SETUP_PARAM) { int i; - - if (!strcmp(str,"js_tg")) - for (i = 0; i <= ints[0] && i < 2; i++) js_tg[i] = ints[i+1]; - if (!strcmp(str,"js_tg_2")) - for (i = 0; i <= ints[0] && i < 2; i++) js_tg_2[i] = ints[i+1]; - if (!strcmp(str,"js_tg_3")) - for (i = 0; i <= ints[0] && i < 2; i++) js_tg_3[i] = ints[i+1]; - + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_tg[i] = ints[i+1]; + return 1; } +int __init js_tg_setup_2(SETUP_PARAM) +{ + int i; + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_tg_2[i] = ints[i+1]; + return 1; +} +int __init js_tg_setup_3(SETUP_PARAM) +{ + int i; + SETUP_PARSE(2); + for (i = 0; i <= ints[0] && i < 2; i++) js_tg_3[i] = ints[i+1]; + return 1; +} +__setup("js_tg=", js_tg_setup); +__setup("js_tg_2=", js_tg_setup_2); +__setup("js_tg_3=", js_tg_setup_3); #endif #ifdef MODULE diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joy-warrior.c linux/drivers/char/joystick/joy-warrior.c --- v2.3.30/linux/drivers/char/joystick/joy-warrior.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/joystick/joy-warrior.c Tue Dec 7 10:13:11 1999 @@ -0,0 +1,318 @@ +/* + * joy-warrior.c Version 0.1 + * + * Copyright (c) 1998 David Thompson + * Copyright (c) 1999 Vojtech Pavlik + * + * Sponsored by SuSE + */ + +/* + * This is a module for the Linux joystick driver, supporting + * the Logitech WingMan Warrior joystick. + */ + +/* + * This program is free warftware; 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 , or by paper mail: + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constants. + */ + +#define N_JOYSTICK_WAR 13 +#define JS_WAR_MAX_LENGTH 16 + +/* + * List of Warriors. + */ + +static struct js_port* js_war_port = NULL; + +static char js_war_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; + +/* + * Per-Warrior data. + */ + +struct js_war_info { + struct tty_struct* tty; + struct js_port* port; + int idx; + int len; + unsigned char data[JS_WAR_MAX_LENGTH]; + char used; +}; + +/* + * js_war_process_packet() decodes packets the driver receives from the + * Warrior. It updates the data accordingly. + */ + +static void js_war_process_packet(struct js_war_info* info) +{ + int **axes = info->port->axes; + int **buttons = info->port->buttons; + unsigned char *data = info->data; + int i; + + if (!info->idx) return; + + switch ((data[0] >> 4) & 7) { + + case 1: /* Button data */ + if (!info->port->devs[0]) return; + buttons[0][0] = ((data[3] & 0xa) >> 1) | ((data[3] & 0x5) << 1); + return; + case 2: /* Static status (Send !S to get one) */ +#if 0 + printk("joy-warrior: Static status:"); + for (i = 0; i < 12; i++) + printk(" %02x", info->data[i]); + printk("\n"); +#endif + return; + case 3: /* XY-axis info->data */ + if (!info->port->devs[0]) return; + axes[0][0] = ((data[0] & 8) << 5) - (data[2] | ((data[0] & 4) << 5)); + axes[0][1] = (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7); + return; + break; + case 4: /* Dynamic status */ +#if 0 + printk("joy-warrior: Dynamic status:"); + for (i = 0; i < 4; i++) + printk(" %02x", info->data[i]); + printk("\n"); +#endif + return; + case 5: /* Throttle, spinner, hat info->data */ + if (!info->port->devs[0]) return; + axes[0][2] = (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7); + axes[0][3] = (data[3] & 2 ? 1 : 0) - (info->data[3] & 1 ? 1 : 0); + axes[0][4] = (data[3] & 8 ? 1 : 0) - (info->data[3] & 4 ? 1 : 0); + axes[0][5] = (data[2] | ((data[0] & 4) << 5)) - ((data[0] & 8) << 5); + return; + default: + printk("joy-warrior: Unknown packet %d length %d:", (data[0] >> 4) & 7, info->idx); + for (i = 0; i < info->idx; i++) + printk(" %02x", data[i]); + printk("\n"); + return; + } +} + +/* + * js_war_open() is a callback from the joystick device open routine. + */ + +static int js_war_open(struct js_dev *jd) +{ + struct js_war_info *info = jd->port->info; + info->used++; + MOD_INC_USE_COUNT; + return 0; +} + +/* + * js_war_close() is a callback from the joystick device release routine. + */ + +static int js_war_close(struct js_dev *jd) +{ + struct js_war_info *info = jd->port->info; + if (!--info->used) { + js_unregister_device(jd->port->devs[0]); + js_war_port = js_unregister_port(jd->port); + } + MOD_DEC_USE_COUNT; + return 0; +} + +/* + * js_war_init_corr() initializes the correction values for the Warrior. + */ + +static void __init js_war_init_corr(struct js_corr **corr) +{ + int i; + + for (i = 0; i < 6; i++) { + corr[0][i].type = JS_CORR_BROKEN; + corr[0][i].prec = 0; + corr[0][i].coef[0] = -8; + corr[0][i].coef[1] = 8; + corr[0][i].coef[2] = (1 << 29) / (128 - 64); + corr[0][i].coef[3] = (1 << 29) / (128 - 64); + } + + corr[0][2].coef[2] = (1 << 29) / (128 - 16); + corr[0][2].coef[3] = (1 << 29) / (128 - 16); + + for (i = 3; i < 5; i++) { + corr[0][i].coef[0] = 0; + corr[0][i].coef[1] = 0; + corr[0][i].coef[2] = (1 << 29); + corr[0][i].coef[3] = (1 << 29); + } + + corr[0][5].prec = -1; + corr[0][5].coef[0] = 0; + corr[0][5].coef[1] = 0; + corr[0][5].coef[2] = (1 << 29) / 128; + corr[0][5].coef[3] = (1 << 29) / 128; +} + +/* + * js_war_ldisc_open() is the routine that is called upon setting our line + * discipline on a tty. + */ + +static int js_war_ldisc_open(struct tty_struct *tty) +{ + struct js_war_info iniinfo; + struct js_war_info *info = &iniinfo; + + info->tty = tty; + info->idx = 0; + info->len = 0; + info->used = 1; + + js_war_port = js_register_port(js_war_port, info, 1, sizeof(struct js_war_info), NULL); + + info = js_war_port->info; + info->port = js_war_port; + tty->disc_data = info; + + printk(KERN_INFO "js%d: WingMan Warrior on %s%d\n", + js_register_device(js_war_port, 0, 6, 4, "WingMan Warrior", js_war_open, js_war_close), + tty->driver.name, MINOR(tty->device) - tty->driver.minor_start); + + js_war_init_corr(js_war_port->corr); + + MOD_INC_USE_COUNT; + + return 0; +} + +/* + * js_war_ldisc_close() is the opposite of js_war_ldisc_open() + */ + +static void js_war_ldisc_close(struct tty_struct *tty) +{ + struct js_war_info* info = (struct js_war_info*) tty->disc_data; + if (!--info->used) { + js_unregister_device(info->port->devs[0]); + js_war_port = js_unregister_port(info->port); + } + MOD_DEC_USE_COUNT; +} + +/* + * js_war_ldisc_receive() is called by the low level driver when characters + * are ready for us. We then buffer them for further processing, or call the + * packet processing routine. + */ + +static void js_war_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) +{ + struct js_war_info* info = (struct js_war_info*) tty->disc_data; + int i; + + for (i = 0; i < count; i++) { + if (cp[i] & 0x80) { + if (info->idx) + js_war_process_packet(info); + info->idx = 0; + info->len = js_war_lengths[(cp[i] >> 4) & 7]; + } + + if (info->idx < JS_WAR_MAX_LENGTH) + info->data[info->idx++] = cp[i]; + + if (info->idx == info->len) { + if (info->idx) + js_war_process_packet(info); + info->idx = 0; + info->len = 0; + } + } +} + +/* + * js_war_ldisc_room() reports how much room we do have for receiving data. + * Although we in fact have infinite room, we need to specify some value + * here, so why not the size of our packet buffer. It's big anyway. + */ + +static int js_war_ldisc_room(struct tty_struct *tty) +{ + return JS_WAR_MAX_LENGTH; +} + +/* + * The line discipline structure. + */ + +static struct tty_ldisc js_war_ldisc = { + magic: TTY_LDISC_MAGIC, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) + name: "warrior", +#endif + open: js_war_ldisc_open, + close: js_war_ldisc_close, + receive_buf: js_war_ldisc_receive, + receive_room: js_war_ldisc_room, +}; + +/* + * The functions for inserting/removing us as a module. + */ + +#ifdef MODULE +int init_module(void) +#else +int __init js_war_init(void) +#endif +{ + if (tty_register_ldisc(N_JOYSTICK_WAR, &js_war_ldisc)) { + printk(KERN_ERR "joy-warrior: Error registering line discipline.\n"); + return -ENODEV; + } + + return 0; +} + +#ifdef MODULE +void cleanup_module(void) +{ + tty_register_ldisc(N_JOYSTICK_WAR, NULL); +} +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/char/joystick/joystick.c linux/drivers/char/joystick/joystick.c --- v2.3.30/linux/drivers/char/joystick/joystick.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/char/joystick/joystick.c Tue Dec 7 10:13:11 1999 @@ -1,7 +1,9 @@ /* - * joystick.c Version 1.2 + * joystick.c Version 1.2 * - * Copyright (c) 1996-1998 Vojtech Pavlik + * Copyright (c) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -33,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -42,11 +43,9 @@ #include #include #include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#include #include -#endif +#include +#include /* * Configurable parameters. @@ -55,6 +54,15 @@ #define JS_REFRESH_TIME HZ/50 /* Time between two reads of joysticks (20ms) */ /* + * Exported symbols. + */ + +EXPORT_SYMBOL(js_register_port); +EXPORT_SYMBOL(js_unregister_port); +EXPORT_SYMBOL(js_register_device); +EXPORT_SYMBOL(js_unregister_device); + +/* * Buffer macros. */ @@ -75,18 +83,6 @@ static int js_use_count = 0; /* - * Exported variables. - */ - -unsigned int js_time_speed = 0; -js_time_func js_get_time; -js_delta_func js_delta; - -unsigned int js_time_speed_a = 0; -js_time_func js_get_time_a; -js_delta_func js_delta_a; - -/* * Module info. */ @@ -94,244 +90,6 @@ MODULE_SUPPORTED_DEVICE("js"); /* - * js_get_time_*() are different functions to get current time. - * js_delta_*() are functions to compute time difference. - */ - -#ifdef __i386__ - -static unsigned int js_get_time_rdtsc(void) -{ - unsigned int x; - __asm__ __volatile__ ( "rdtsc" : "=A" (x) ); - return x; -} - -static unsigned int js_get_time_pit(void) -{ - unsigned long flags; - unsigned int x; - - __save_flags(flags); - __cli(); - outb(0, 0x43); - x = inb(0x40); - x |= inb(0x40) << 8; - __restore_flags(flags); - - return x; -} - -static int js_delta_pit(unsigned int x, unsigned int y) -{ - return y - x + ( y < x ? 1193180L / HZ : 0 ); -} - -static unsigned int js_get_time_counter(void) -{ - static int time_counter = 0; - return time_counter++; -} - -#else -#ifdef __alpha__ - -static unsigned int js_get_time_rpcc(void) -{ - unsigned int x; - __asm__ __volatile__ ( "rpcc %0" : "=r" (x) ); - return x; -} - -#else - -#ifndef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -static unsigned int js_get_time_system(void) -{ - static struct timeval js_tv; - get_fast_time(&js_tv); - return js_tv.tv_sec * 1000000L + js_tv.tv_usec; -} -#endif -#endif - -#endif -#endif - -static int js_delta_normal(unsigned int x, unsigned int y) -{ - return x - y; -} - -/* - * js_calibrate_time() calibrates a given timer. - */ - -static int __init js_calibrate_time(js_time_func get_time, js_delta_func delta) -{ - unsigned int t1, t2, t3; - unsigned long flags; - - __save_flags(flags); - __cli(); - t1 = get_time(); - udelay(1000); - t2 = get_time(); - t3 = get_time(); - __restore_flags(flags); - - return delta(t2, t1) - delta(t3, t2); -} - -/* - * js_calibrate_time_counter() calibrates the counter timer, which can't - * be calibrated using the above function. - */ - -#ifdef __i386__ - -static int __init js_calibrate_time_counter(void) -{ - unsigned int i, j, t1, t2, t3; - - j = jiffies; do { inb(0x201); t1 = js_get_time_counter(); } while (j == jiffies); - j = jiffies; do { inb(0x201); t2 = js_get_time_counter(); } while (j == jiffies); - - j = (t2 - t1) * HZ / 1000; - - t1 = js_get_time_pit(); - for (i = 0; i < 1000; i++) { - inb(0x201); - js_get_time_counter(); - } - t2 = js_get_time_pit(); - t3 = js_get_time_pit(); - - i = 1193180L / (js_delta_pit(t2, t1) - js_delta_pit(t3, t2)); - - if (DIFF(i,j) > 5) - printk(KERN_WARNING "js: Counter timer calibration unsure," - " pass1 (0.%d MHz) and pass2 (0.%d MHz) differ.\n", j, i); - - return (i + j) >> 1; -} - -#endif - -/* - * js_setup_time chooses the best available timers - * on the system and calibrates them. - */ - -static int __init js_setup_time(void) -{ - int t; - char *name, *name_a; - - name = ""; - name_a = ""; - js_time_speed = 0; - js_time_speed_a = 0; - -#ifdef __i386__ - - t = js_calibrate_time(js_get_time_pit, js_delta_pit); - - if (DIFF(t, 1193) > 5) - printk(KERN_WARNING "js: Measured PIT speed is %d.%03d MHz, but should be 1.193 MHz.\n" - KERN_WARNING "js: This is probably caused by wrong BogoMIPS value. It is: %ld, should be: %ld.\n", - t / 1000, t % 1000, loops_per_sec / 500000, loops_per_sec / (t * 500000 / 1193)); - - if (JS_HAS_RDTSC && (t = js_calibrate_time(js_get_time_rdtsc, js_delta_normal)) > 0) { - - js_time_speed_a = t; - js_get_time_a = js_get_time_rdtsc; - js_delta_a = js_delta_normal; - js_time_speed = t; - js_get_time = js_get_time_rdtsc; - js_delta = js_delta_normal; - name = "RDTSC"; - - } else { - - js_time_speed_a = t; - js_get_time_a = js_get_time_pit; - js_delta_a = js_delta_pit; - name_a = "PIT"; - - t = js_calibrate_time_counter(); - - js_time_speed = t; - js_get_time = js_get_time_counter; - js_delta = js_delta_normal; - name = "counter"; - - } - -#else -#ifdef __alpha__ - - t = js_calibrate_time(js_get_time_rpcc, js_delta_normal); - - js_time_speed_a = t; - js_get_time_a = js_get_time_rpcc; - js_delta_a = js_delta_normal; - js_time_speed = t; - js_get_time = js_get_time_rpcc; - js_delta = js_delta_normal; - name = "RPCC"; - -#else - -#ifndef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) - t = js_calibrate_time(js_get_time_system, js_delta_normal); - - js_time_speed_a = t; - js_get_time_a = js_get_time_system; - js_delta_a = js_delta_normal; - js_time_speed = t; - js_get_time = js_get_time_system; - js_delta = js_delta_normal; - name = "system"; -#endif -#endif - -#endif -#endif - - printk(KERN_INFO "js: Version %d.%d.%d ", - JS_VERSION >> 16 & 0xff, JS_VERSION >> 8 & 0xff, JS_VERSION & 0xff); - - if (js_time_speed_a <= 0 || js_time_speed <= 0) { - printk("\n"); - return -1; - } - - printk("using "); - - if (js_time_speed > 10000) { - t = js_time_speed / 1000 + (js_time_speed % 1000 >= 500); - printk("%d MHz ", t); - } else { - t = js_time_speed / 10 + (js_time_speed % 10 >= 5); - printk("%d.%02d MHz ", t / 100, t % 100); - } - - if (js_get_time_a != js_get_time) { - t = js_time_speed_a / 10 + (js_time_speed_a % 10 >= 5); - printk("%s timer and %d.%02d MHz %s timer.\n", - name, t / 100, t % 100, name_a); - } else { - printk("%s timer.\n", name); - } - - return 0; -} - - -/* * js_correct() performs correction of raw joystick data. */ @@ -365,7 +123,6 @@ return (buttons[i >> 5] >> (i & 0x1f)) & 1; } - /* * js_add_event() adds an event to the buffer. This requires additional * queue post-processing done by js_sync_buff. @@ -458,14 +215,17 @@ struct js_dev *curd = js_dev; unsigned long flags; - while (curp != NULL) { - curp->read(curp->info, curp->axes, curp->buttons); + while (curp) { + if (curp->read) + if (curp->read(curp->info, curp->axes, curp->buttons)) + curp->fail++; + curp->total++; curp = curp->next; } spin_lock_irqsave(&js_lock, flags); - while (curd != NULL) { + while (curd) { if (data) { js_process_data(curd); js_sync_buff(curd); @@ -486,11 +246,7 @@ * space. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) static ssize_t js_read(struct file *file, char *buf, size_t count, loff_t *ppos) -#else -static int js_read(struct inode *inode, struct file *file, char *buf, int count) -#endif { DECLARE_WAITQUEUE(wait, current); struct js_event *buff = (void *) buf; @@ -576,13 +332,8 @@ tmpevent.time = jiffies * (1000/HZ); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) if (copy_to_user(&buff[written], &tmpevent, sizeof(struct js_event))) retval = -EFAULT; -#else - if (!(retval = verify_area(VERIFY_WRITE, &buff[written], sizeof(struct js_event)))) - memcpy_tofs(&buff[written], &tmpevent, sizeof(struct js_event)); -#endif curl->startup++; written++; @@ -594,17 +345,11 @@ while ((jd->bhead != (new_tail = GOF(curl->tail))) && (written < blocks) && !retval) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) if (copy_to_user(&buff[written], &jd->buff[new_tail], sizeof(struct js_event))) retval = -EFAULT; if (put_user((__u32)(jd->buff[new_tail].time * (1000/HZ)), &buff[written].time)) retval = -EFAULT; -#else - if (!(retval = verify_area(VERIFY_WRITE, &buff[written], sizeof(struct js_event)))) { - memcpy_tofs(&buff[written], &jd->buff[new_tail], sizeof(struct js_event)); - put_user((__u32)(jd->buff[new_tail].time * (1000/HZ)), &buff[written].time); - } -#endif + curl->tail = new_tail; written++; } @@ -625,15 +370,9 @@ data.y = jd->num_axes < 2 ? 0 : ((js_correct(jd->new.axes[1], &jd->corr[1]) / 256) + 128) >> js_comp_glue.JS_CORR.y; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) retval = copy_to_user(buf, &data, sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0; -#else - if (!(retval = verify_area(VERIFY_WRITE, buf, sizeof(struct JS_DATA_TYPE)))) { - memcpy_tofs(buf, &data, sizeof(struct JS_DATA_TYPE)); - } -#endif - curl->startup = 0; + curl->startup = jd->num_axes + jd->num_buttons; curl->tail = GOB(jd->bhead); if (!retval) retval = sizeof(struct JS_DATA_TYPE); } @@ -645,12 +384,12 @@ if (orig_tail == jd->tail) { new_tail = curl->tail; curl = jd->list; - while (curl != NULL && curl->tail != jd->tail) { + while (curl && curl->tail != jd->tail) { if (ROT(jd->bhead, new_tail, curl->tail) || (jd->bhead == curl->tail)) new_tail = curl->tail; curl = curl->next; } - if (curl == NULL) jd->tail = new_tail; + if (!curl) jd->tail = new_tail; } spin_unlock_irqrestore(&js_lock, flags); @@ -662,8 +401,6 @@ * js_poll() does select() support. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) - static unsigned int js_poll(struct file *file, poll_table *wait) { struct js_list *curl = file->private_data; @@ -677,20 +414,6 @@ return retval; } -#else - -static int js_select(struct inode *inode, struct file *file, int sel_type, select_table *wait) -{ - struct js_list *curl = file->private_data; - if (sel_type == SEL_IN) { - if (GOF(curl->tail) != curl->dev->bhead) return 1; - select_wait(&curl->dev->wait, wait); - } - return 0; -} - -#endif - /* * js_ioctl handles misc ioctl calls. */ @@ -704,8 +427,6 @@ curl = file->private_data; jd = curl->dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) - switch (cmd) { /* @@ -758,95 +479,6 @@ } } -#else - - switch (cmd) { - -/* - * 0.x compatibility - */ - - case JS_SET_CAL: - if (verify_area(VERIFY_READ, (struct JS_DATA_TYPE *) arg, - sizeof(struct JS_DATA_TYPE))) return -EFAULT; - memcpy_fromfs(&js_comp_glue.JS_CORR, (struct JS_DATA_SAVE_TYPE *) arg, - sizeof(struct JS_DATA_TYPE)); - return 0; - case JS_GET_CAL: - if (verify_area(VERIFY_WRITE, (struct JS_DATA_TYPE *) arg, - sizeof(struct JS_DATA_TYPE))) return -EFAULT; - memcpy_tofs((struct JS_DATA_SAVE_TYPE *) arg, &js_comp_glue.JS_CORR, - sizeof(struct JS_DATA_TYPE)); - return 0; - case JS_SET_TIMEOUT: - if (verify_area(VERIFY_READ, (int *) arg, sizeof(int))) return -EFAULT; - js_comp_glue.JS_TIMEOUT = get_user((int *) arg); - return 0; - case JS_GET_TIMEOUT: - if (verify_area(VERIFY_WRITE, (int *) arg, sizeof(int))) return -EFAULT; - put_user(js_comp_glue.JS_TIMEOUT, (int *) arg); - return 0; - case JS_SET_TIMELIMIT: - if (verify_area(VERIFY_READ, (long *) arg, sizeof(long))) return -EFAULT; - js_comp_glue.JS_TIMELIMIT = get_user((long *) arg); - return 0; - case JS_GET_TIMELIMIT: - if (verify_area(VERIFY_WRITE, (long *) arg, sizeof(long))) return -EFAULT; - put_user(js_comp_glue.JS_TIMELIMIT, (long *) arg); - return 0; - case JS_SET_ALL: - if (verify_area(VERIFY_READ, (struct JS_DATA_SAVE_TYPE *) arg, - sizeof(struct JS_DATA_SAVE_TYPE))) return -EFAULT; - memcpy_fromfs(&js_comp_glue, (struct JS_DATA_SAVE_TYPE *) arg, - sizeof(struct JS_DATA_SAVE_TYPE)); - return 0; - case JS_GET_ALL: - if (verify_area(VERIFY_WRITE, (struct JS_DATA_SAVE_TYPE *) arg, - sizeof(struct JS_DATA_SAVE_TYPE))) return -EFAULT; - memcpy_tofs((struct JS_DATA_SAVE_TYPE *) arg, &js_comp_glue, - sizeof(struct JS_DATA_SAVE_TYPE)); - return 0; - -/* - * 1.x ioctl calls - */ - - case JSIOCGVERSION: - if (verify_area(VERIFY_WRITE, (__u32 *) arg, sizeof(__u32))) return -EFAULT; - put_user(JS_VERSION, (__u32 *) arg); - return 0; - case JSIOCGAXES: - if (verify_area(VERIFY_WRITE, (__u8 *) arg, sizeof(__u8))) return -EFAULT; - put_user(jd->num_axes, (__u8 *) arg); - return 0; - case JSIOCGBUTTONS: - if (verify_area(VERIFY_WRITE, (__u8 *) arg, sizeof(__u8))) return -EFAULT; - put_user(jd->num_buttons, (__u8 *) arg); - return 0; - case JSIOCSCORR: - if (verify_area(VERIFY_READ, (struct js_corr *) arg, - sizeof(struct js_corr) * jd->num_axes)) return -EFAULT; - memcpy_fromfs(jd->corr, (struct js_corr *) arg, - sizeof(struct js_corr) * jd->num_axes); - return 0; - case JSIOCGCORR: - if (verify_area(VERIFY_WRITE, (struct js_corr *) arg, - sizeof(struct js_corr) * jd->num_axes)) return -EFAULT; - memcpy_tofs((struct js_corr *) arg, - jd->corr, sizeof(struct js_corr) * jd->num_axes); - return 0; - default: - if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) { - len = strlen(jd->name) + 1; - if (verify_area(VERIFY_WRITE, (char *) arg, len)) return -EFAULT; - if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); - memcpy_tofs((char *) arg, jd->name, len); - return len; - } - } - -#endif - return -EINVAL; } @@ -868,21 +500,20 @@ spin_lock_irqsave(&js_lock, flags); - while (i > 0 && jd != NULL) { + while (i > 0 && jd) { jd = jd->next; i--; } spin_unlock_irqrestore(&js_lock, flags); - if (jd == NULL) return -ENODEV; + if (!jd) return -ENODEV; if ((result = jd->open(jd))) return result; - MOD_INC_USE_COUNT; - if (!js_use_count++) js_do_timer(0); + if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL))) { - if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL)) != NULL) { + MOD_INC_USE_COUNT; spin_lock_irqsave(&js_lock, flags); @@ -897,6 +528,8 @@ spin_unlock_irqrestore(&js_lock, flags); + if (!js_use_count++) js_do_timer(0); + } else { result = -ENOMEM; } @@ -909,11 +542,7 @@ * used by it. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) static int js_release(struct inode *inode, struct file *file) -#else -static void js_release(struct inode *inode, struct file *file) -#endif { struct js_list *curl = file->private_data; struct js_dev *jd = curl->dev; @@ -926,11 +555,11 @@ while (*curp && (*curp != curl)) curp = &((*curp)->next); *curp = (*curp)->next; - if (jd->list != NULL) + if (jd->list) if (curl->tail == jd->tail) { curl = jd->list; new_tail = curl->tail; - while (curl != NULL && curl->tail != jd->tail) { + while (curl && curl->tail != jd->tail) { if (ROT(jd->bhead, new_tail, curl->tail) || (jd->bhead == curl->tail)) new_tail = curl->tail; curl = curl->next; @@ -947,9 +576,7 @@ jd->close(jd); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) return 0; -#endif } /* @@ -968,7 +595,7 @@ printk(",--- Dumping Devices:\n"); printk("| js_dev = %x\n", (int) js_dev); - while (curd != NULL) { + while (curd) { printk("| %s-device %x, next %x axes %d, buttons %d, port %x - %#x\n", curd->next ? "|":"`", (int) curd, (int) curd->next, curd->num_axes, curd->num_buttons, (int) curd->port, curd->port->io); @@ -978,7 +605,7 @@ printk(">--- Dumping ports:\n"); printk("| js_port = %x\n", (int) js_port); - while (curp != NULL) { + while (curp) { printk("| %s-port %x, next %x, io %#x, devices %d\n", curp->next ? "|":"`", (int) curp, (int) curp->next, curp->io, curp->ndevs); @@ -1010,7 +637,7 @@ int i; unsigned long flags; - if ((all = kmalloc(sizeof(struct js_port) + 4 * devs * sizeof(void*) + infos, GFP_KERNEL)) == NULL) + if (!(all = kmalloc(sizeof(struct js_port) + 4 * devs * sizeof(void*) + infos, GFP_KERNEL))) return NULL; curp = all; @@ -1019,6 +646,8 @@ curp->prev = port; curp->read = read; curp->ndevs = devs; + curp->fail = 0; + curp->total = 0; curp->devs = all += sizeof(struct js_port); for (i = 0; i < devs; i++) curp->devs[i] = NULL; @@ -1036,7 +665,7 @@ spin_lock_irqsave(&js_lock, flags); - while (*ptrp != NULL) ptrp=&((*ptrp)->next); + while (*ptrp) ptrp=&((*ptrp)->next); *ptrp = curp; spin_unlock_irqrestore(&js_lock, flags); @@ -1052,7 +681,9 @@ spin_lock_irqsave(&js_lock, flags); - while (*curp != NULL && (*curp != port)) curp = &((*curp)->next); + printk("js: There were %d failures out of %d read attempts.\n", port->fail, port->total); + + while (*curp && (*curp != port)) curp = &((*curp)->next); *curp = (*curp)->next; spin_unlock_irqrestore(&js_lock, flags); @@ -1072,9 +703,9 @@ int i = 0; unsigned long flags; - if ((all = kmalloc(sizeof(struct js_dev) + 2 * axes * sizeof(int) + + if (!(all = kmalloc(sizeof(struct js_dev) + 2 * axes * sizeof(int) + 2 * (((buttons - 1) >> 5) + 1) * sizeof(int) + - axes * sizeof(struct js_corr) + strlen(name) + 1, GFP_KERNEL)) == NULL) + axes * sizeof(struct js_corr) + strlen(name) + 1, GFP_KERNEL))) return -1; curd = all; @@ -1082,10 +713,11 @@ curd->next = NULL; curd->list = NULL; curd->port = port; - init_waitqueue_head(&curd->wait); curd->open = open; curd->close = close; + init_waitqueue_head(&curd->wait); + curd->ahead = 0; curd->bhead = 0; curd->tail = JS_BUFF_SIZE - 1; @@ -1108,7 +740,7 @@ spin_lock_irqsave(&js_lock, flags); - while (*ptrd != NULL) { ptrd=&(*ptrd)->next; i++; } + while (*ptrd) { ptrd=&(*ptrd)->next; i++; } *ptrd = curd; spin_unlock_irqrestore(&js_lock, flags); @@ -1123,7 +755,7 @@ spin_lock_irqsave(&js_lock, flags); - while (*curd != NULL && (*curd != dev)) curd = &((*curd)->next); + while (*curd && (*curd != dev)) curd = &((*curd)->next); *curd = (*curd)->next; spin_unlock_irqrestore(&js_lock, flags); @@ -1138,11 +770,7 @@ static struct file_operations js_fops = { read: js_read, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) poll: js_poll, -#else - select: js_select, -#endif ioctl: js_ioctl, open: js_open, release: js_release, @@ -1159,15 +787,15 @@ int __init js_init(void) #endif { - int result; - - js_setup_time(); if (register_chrdev(JOYSTICK_MAJOR, "js", &js_fops)) { printk(KERN_ERR "js: unable to get major %d for joystick\n", JOYSTICK_MAJOR); return -EBUSY; } + printk(KERN_INFO "js: Joystick driver v%d.%d.%d (c) 1999 Vojtech Pavlik \n", + JS_VERSION >> 16 & 0xff, JS_VERSION >> 8 & 0xff, JS_VERSION & 0xff); + spin_lock_init(&js_lock); init_timer(&js_timer); @@ -1178,44 +806,61 @@ js_comp_glue.JS_TIMEOUT = JS_DEF_TIMEOUT; js_comp_glue.JS_TIMELIMIT = JS_DEF_TIMELIMIT; -#ifdef MODULE - result = 0; -#else - result = -ENODEV; +#ifndef MODULE +#ifdef CONFIG_JOY_PCI + js_pci_init(); +#endif #ifdef CONFIG_JOY_LIGHTNING - if (!js_l4_init()) result = 0; + js_l4_init(); #endif #ifdef CONFIG_JOY_SIDEWINDER - if (!js_sw_init()) result = 0; + js_sw_init(); #endif -#ifdef CONFIG_JOY_ASSASIN - if (!js_as_init()) result = 0; +#ifdef CONFIG_JOY_ASSASSIN + js_as_init(); #endif #ifdef CONFIG_JOY_LOGITECH - if (!js_lt_init()) result = 0; + js_lt_init(); #endif #ifdef CONFIG_JOY_THRUSTMASTER - if (!js_tm_init()) result = 0; + js_tm_init(); #endif #ifdef CONFIG_JOY_GRAVIS - if (!js_gr_init()) result = 0; + js_gr_init(); +#endif +#ifdef CONFIG_JOY_CREATIVE + js_cr_init(); #endif #ifdef CONFIG_JOY_ANALOG - if (!js_an_init()) result = 0; + js_an_init(); #endif #ifdef CONFIG_JOY_CONSOLE - if (!js_console_init()) result = 0; + js_console_init(); #endif #ifdef CONFIG_JOY_DB9 - if (!js_db9_init()) result = 0; + js_db9_init(); +#endif +#ifdef CONFIG_JOY_TURBOGRAFX + js_tg_init(); #endif #ifdef CONFIG_JOY_AMIGA - if (!js_am_init()) result = 0; + js_am_init(); +#endif +#ifdef CONFIG_JOY_MAGELLAN + js_mag_init(); +#endif +#ifdef CONFIG_JOY_WARRIOR + js_war_init(); +#endif +#ifdef CONFIG_JOY_SPACEORB + js_orb_init(); +#endif +#ifdef CONFIG_JOY_SPACEBALL + js_sball_init(); #endif - if (result) printk(KERN_ERR "js: no joysticks found\n"); #endif - return result; + return 0; } /* @@ -1230,3 +875,4 @@ printk(KERN_ERR "js: can't unregister device\n"); } #endif + diff -u --recursive --new-file v2.3.30/linux/drivers/net/Config.in linux/drivers/net/Config.in --- v2.3.30/linux/drivers/net/Config.in Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/Config.in Wed Dec 8 10:42:39 1999 @@ -247,7 +247,15 @@ dep_tristate ' STRIP (Metricom starmode radio IP)' CONFIG_STRIP $CONFIG_INET tristate ' AT&T WaveLAN & DEC RoamAbout DS support' CONFIG_WAVELAN tristate ' Aironet Arlan 655 & IC2200 DS support' CONFIG_ARLAN - + tristate ' Aironet 4500/4800 series adapters' CONFIG_AIRONET4500 + dep_tristate ' Aironet 4500/4800 ISA/PCI/PNP/365 support ' CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500 + if [ "$CONFIG_AIRONET4500" != "n" -a "$CONFIG_AIRONET4500_NONCS" != "n" ]; then + bool ' Aironet 4500/4800 PNP support ' CONFIG_AIRONET4500_PNP + dep_bool ' Aironet 4500/4800 PCI support ' CONFIG_AIRONET4500_PCI $CONFIG_PCI + dep_bool ' Aironet 4500/4800 ISA broken support (EXPERIMENTAL)' CONFIG_AIRONET4500_ISA $CONFIG_EXPERIMENTAL + dep_bool ' Aironet 4500/4800 I365 broken support (EXPERIMENTAL)' CONFIG_AIRONET4500_I365 $CONFIG_EXPERIMENTAL + fi + dep_tristate ' Aironet 4500/4800 PROC interface ' CONFIG_AIRONET4500_PROC $CONFIG_AIRONET4500 m fi endmenu diff -u --recursive --new-file v2.3.30/linux/drivers/net/Makefile linux/drivers/net/Makefile --- v2.3.30/linux/drivers/net/Makefile Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/Makefile Tue Dec 7 14:33:32 1999 @@ -27,7 +27,7 @@ # All of the (potential) objects that export symbols. # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'. -export-objs := 8390.o arcnet.o arlan.o ppp_async.o \ +export-objs := 8390.o arcnet.o arlan.o aironet4500_core.o aironet4500_card.o ppp_async.o \ ppp_generic.o slhc.o ifeq ($(CONFIG_PCMCIA),y) @@ -96,6 +96,12 @@ endif endif endif + + + +obj-$(CONFIG_AIRONET4500) += aironet4500_core.o +obj-$(CONFIG_AIRONET4500_NONCS) += aironet4500_card.o +obj-$(CONFIG_AIRONET4500_PROC) += aironet4500_proc.o obj-$(CONFIG_NET) += Space.o setup.o net_init.o loopback.o obj-$(CONFIG_SEEQ8005) += seeq8005.o diff -u --recursive --new-file v2.3.30/linux/drivers/net/aironet4500.h linux/drivers/net/aironet4500.h --- v2.3.30/linux/drivers/net/aironet4500.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/aironet4500.h Tue Dec 7 23:58:21 1999 @@ -0,0 +1,1638 @@ +/* + * Aironet 4500 Pcmcia driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ + + +#ifndef AIRONET4500_H +#define AIRONET4500_H +// redefined to avoid PCMCIA includes + +#include +#include +#include + +#if (LINUX_VERSION_CODE < 0x2030e) +#define NET_DEVICE device +#else +#define NET_DEVICE net_device +#endif + +#if LINUX_VERSION_CODE < 0x20300 +#define init_MUTEX(a) *(a) = MUTEX; +#endif + +#include +#include +#include +#include +#include +#include + +//damn idiot PCMCIA stuff +#ifndef DEV_NAME_LEN + #define DEV_NAME_LEN 32 +#endif + +struct pcmcia_junkdev_node_t { + char dev_name[DEV_NAME_LEN]; + u_short major, minor; + struct dev_node_t *next; +}; + +#ifndef CS_RELEASE +typedef struct pcmcia_junkdev_node_t dev_node_t; +#endif + + + +#if LINUX_VERSION_CODE <= 0x20100 + +typedef struct { volatile int lock ;} my_spinlock_t; + +#define my_spin_lock_irqsave(a,b) {\ + save_flags(b);\ + cli();\ + (a)->lock++;while(0);\ + if ((a)->lock != 1 )\ + printk("awc_spinlock high at locking \n");\ +} + +#define my_spin_unlock_irqrestore(a,b) {\ + cli(); (a)->lock--;while(0);\ + if ((a)->lock != 0 )\ + printk("awc_spinlock !=0 at unlocking \n");\ + restore_flags(b);\ +} + + +#else +#if LINUX_VERSION_CODE < 0x20300 +#include +#else +#include +#endif +#ifndef __SMP__ +// #warning non-SMP 2.2 kernel +#endif +typedef spinlock_t my_spinlock_t ; +#define my_spin_lock_irqsave(a,b) spin_lock_irqsave(a,b) +#define my_spin_unlock_irqrestore(a,b) spin_unlock_irqrestore(a,b) + +#endif //kernel version + + +#if LINUX_VERSION_CODE <= 0x20100 +#define in_interrupt() intr_count +#endif + + +#define AWC_ERROR -1 +#define AWC_SUCCESS 0 + +struct awc_cis { + unsigned char cis[0x301]; + unsigned char unknown302[0xdf]; + unsigned short configuration_register; + unsigned short pin_replacement_register; + unsigned short socket_and_copy_register; + +}; + + + +/*************************** REGISTER OFFSETS *********************/ +#define awc_Command_register 0x00 +#define awc_Param0_register 0x02 +#define awc_Param1_register 0x04 +#define awc_Param2_register 0x06 +#define awc_Status_register 0x08 +#define awc_Resp0_register 0x0A +#define awc_Resp1_register 0x0C +#define awc_Resp2_register 0x0E +#define awc_EvStat_register 0x30 +#define awc_EvIntEn_register 0x32 +#define awc_EvAck_register 0x34 +#define awc_SWSupport0_register 0x28 +#define awc_SWSupport1_register 0x2A +#define awc_SWSupport2_register 0x2C +#define awc_SWSupport3_register 0x2E +#define awc_LinkStatus_register 0x10 +// Memory access RID FID +#define awc_Select0_register 0x18 +#define awc_Offset0_register 0x1C +#define awc_Data0_register 0x36 +#define awc_Select1_register 0x1A +#define awc_Offset1_register 0x1E +#define awc_Data1_register 0x38 +// +#define awc_RxFID_register 0x20 +#define awc_TxAllocFID_register 0x22 +#define awc_TxComplFID_register 0x24 +#define awc_AuxPage_register 0x3A +#define awc_AuxOffset_register 0x3C +#define awc_AuxData_register 0x3E + + +struct awc_bap { + u16 select; + u16 offset; + u16 data; + volatile int lock; + volatile int status; + struct semaphore sem; + my_spinlock_t spinlock; + unsigned long flags; +}; + + + +#define AWC_COMMAND_STATE_WAIT_CMD_BUSY 1 +#define AWC_COMMAND_STATE_WAIT_CMD_ACK 2 +#define AWC_COMMAND_STATE_WAIT_BAP_BUSY 3 +#define AWC_COMMAND_STATE_BAP_NOT_SET 4 +#define AWC_COMMAND_STATE_BAP_SET 5 + +struct awc_command { + volatile int state; + volatile int lock_state; + struct NET_DEVICE * dev; + struct awc_private * priv; + u16 port; + struct awc_bap * bap; + u16 command; + u16 par0; + u16 par1; + u16 par2; + u16 status; + u16 resp0; + u16 resp1; + u16 resp2; + u16 rid; + u16 offset; + u16 len; + void * buff; + +}; + + + + +#define DOWN(a) down_interruptible( a ) ; +// if (in_interrupt()) { down_interruptible( a ) ; } else printk("semaphore DOWN in interrupt tried \n"); +#define UP(a) up( a ) ; +// if (in_interrupt()) {up( a ) ; } else printk("semaphore UP in interrupt tried \n"); + +/* if (!in_interrupt())\ + printk("bap lock under cli but not in int\n");\ +*/ +#define AWC_BAP_LOCK_UNDER_CLI_REAL(cmd) \ + if (!cmd.priv) {\ + printk(KERN_CRIT "awc4500: no priv present in command !");\ + }\ + cmd.bap = &(cmd.priv->bap1);\ + if (cmd.bap){\ + my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\ + cmd.bap->lock++;\ + if (cmd.bap->lock > 1)\ + printk("Bap 1 lock high\n");\ + cmd.lock_state |= AWC_BAP_LOCKED;\ + } + +#define AWC_BAP_LOCK_NOT_CLI_REAL(cmd) {\ + if (in_interrupt())\ + printk("bap lock not cli in int\n");\ + if (!cmd.priv) {\ + printk(KERN_CRIT "awc4500: no priv present in command,lockup follows !");\ + }\ + cmd.bap = &(cmd.priv->bap0);\ + my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\ + DOWN(&(cmd.priv->bap0.sem));\ + cmd.bap->lock++;\ + if (cmd.bap->lock > 1)\ + printk("Bap 0 lock high\n");\ + cmd.lock_state |= AWC_BAP_SEMALOCKED;\ +} + +#define AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd) {\ + cmd.bap = &(cmd.priv->bap0);\ + my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\ + cmd.bap->lock++;\ + if (cmd.bap->lock > 1)\ + printk("Bap 0 lock high\n");\ + cmd.lock_state |= AWC_BAP_LOCKED;\ +} + +#define BAP_LOCK_ANY(cmd)\ + if (in_interrupt()) AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd)\ + else AWC_BAP_LOCK_NOT_CLI_REAL(cmd) + +#define AWC_BAP_LOCK_NOT_CLI(cmd) BAP_LOCK_ANY(cmd) +#define AWC_BAP_LOCK_UNDER_CLI(cmd) AWC_BAP_LOCK_UNDER_CLI_REAL(cmd) +/* + if (!cmd.priv->bap1.lock ) {BAP_LOCK_ANY(cmd);}\ + else AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd); +*/ +#define AWC_BAP_LOCKED 0x01 +#define AWC_BAP_SEMALOCKED 0x02 + +#define AWC_BAP_BUSY 0x8000 +#define AWC_BAP_ERR 0x4000 +#define AWC_BAP_DONE 0x2000 + +#define AWC_CLI 1 +#define AWC_NOT_CLI 2 + +/*#define WAIT61x3 inb(0x61);\ + inb(0x61);\ + inb(0x61); +*/ +#define WAIT61x3 udelay(bap_sleep) + +#define AWC_INIT_COMMAND(context, a_com, a_dev,a_cmmand,a_pr0, a_rid, a_offset, a_len, a_buff) {\ + memset(&a_com,0,sizeof(a_com) );\ + a_com.dev = a_dev;\ + a_com.priv = a_dev->priv;\ + a_com.port = a_dev->base_addr;\ + a_com.bap = NULL;\ + a_com.command = a_cmmand;\ + a_com.par0 = a_pr0;\ + a_com.rid = a_rid;\ + a_com.offset = a_offset;\ + a_com.len = a_len;\ + a_com.buff = a_buff;\ + a_com.lock_state = 0;\ +}; + +/* väga veider asi järgnevast + makrost välja jäetud if (cmd.bap) AWC_IN((cmd.bap)->data);\ +*/ + +#define AWC_BAP_UNLOCK(com) { \ + if (com.bap){ \ + if ( (com.lock_state & AWC_BAP_SEMALOCKED) &&\ + (com.lock_state & AWC_BAP_LOCKED) ){\ + printk("Both Sema and simple lock \n");\ + }\ + if ( com.lock_state & AWC_BAP_SEMALOCKED ){\ + com.bap->lock--; \ + com.lock_state &= ~AWC_BAP_SEMALOCKED;\ + UP(&(com.bap->sem)); \ + my_spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\ + } else if (com.lock_state & AWC_BAP_LOCKED){\ + com.bap->lock--; \ + com.lock_state &= ~AWC_BAP_LOCKED;\ + my_spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\ + }\ + }\ +} + +#define AWC_RELEASE_COMMAND(com) {\ + AWC_BAP_UNLOCK(cmd);\ + } + + + +#define awc_manufacturer_code 0x015F +#define awc_product_code 0x0005 + + +#define awc_write(base,register,u16value) outw(u16value, (base)+(register)) +#define awc_read(base,register) inw((base)+(register)) +#define AWC_OUT(base,val) outw(val, base) +#define AWC_IN(base) inw(base) + + +#define awc_read_response(cmd) { \ + cmd->status=awc_read(cmd->port,awc_Status_register);\ + cmd->resp0=awc_read(cmd->port,awc_Resp0_register);\ + cmd->resp1=awc_read(cmd->port,awc_Resp1_register);\ + cmd->resp2=awc_read(cmd->port,awc_Resp2_register);\ +}; + +#define awc_command_busy(base) (awc_read(base,awc_Command_register) & 0x8000) +#define awc_command_read(base) awc_read(base,awc_Command_register) +#define awc_command_write(base,cmd) awc_write(base,awc_Command_register,cmd) +#define awc_event_status_Awake(base) (awc_read(base,awc_EvStat_register) & 0x0100) +#define awc_event_status_Link(base) (awc_read(base,awc_EvStat_register) & 0x0080) +#define awc_event_status_Cmd(base) (awc_read(base,awc_EvStat_register) & 0x0010) +#define awc_event_status_Alloc(base) (awc_read(base,awc_EvStat_register) & 0x0008) +#define awc_event_status_TxExc(base) (awc_read(base,awc_EvStat_register) & 0x0004) +#define awc_event_status_Tx(base) (awc_read(base,awc_EvStat_register) & 0x0002) +#define awc_event_status_TxResp(base) (awc_read(base,awc_EvStat_register) & 0x0006) +#define awc_event_status_Rx(base) (awc_read(base,awc_EvStat_register) & 0x0001) +#define awc_event_status(base) (awc_read(base,awc_EvStat_register)) + +#define awc_Link_Status(base) awc_read(base,awc_LinkStatus_register) + +#define awc_Rx_Fid(base) awc_read(base,awc_RxFID_register) +#define awc_Tx_Allocated_Fid(base) awc_read(base,awc_TxAllocFID_register) +#define awc_Tx_Compl_Fid(base) awc_read(base,awc_TxComplFID_register) + +#define awc_event_ack_ClrStckCmdBsy(base) awc_write(base,awc_EvAck_register, 0x4000) +#define awc_event_ack_WakeUp(base) awc_write(base,awc_EvAck_register, 0x2000) +#define awc_event_ack_Awaken(base) awc_write(base,awc_EvAck_register, 0x0100) +#define awc_event_ack_Link(base) awc_write(base,awc_EvAck_register, 0x0080) +#define awc_event_ack_Cmd(base) awc_write(base,awc_EvAck_register, 0x0010) +#define awc_event_ack_Alloc(base) awc_write(base,awc_EvAck_register, 0x0008) +#define awc_event_ack_TxExc(base) awc_write(base,awc_EvAck_register, 0x0004) +#define awc_event_ack_Tx(base) awc_write(base,awc_EvAck_register, 0x0002) +#define awc_event_ack_Rx(base) awc_write(base,awc_EvAck_register, 0x0001) + +#define awc_event_ack(base,ints) awc_write(base,awc_EvAck_register,ints) + +#define awc_ints_enabled(base) (awc_read(base,awc_EvIntEn_register)) +#define awc_ints_enable(base,ints) awc_write(base,awc_EvIntEn_register,ints) + + + +/************************ RX TX BUFF ************************/ + + +struct aironet4500_radio_rx_header { + u32 RxTime; + u16 Status; + u16 PayloadLength; + u8 Reserved0; + u8 RSSI; + u8 Rate; + u8 Frequency; + u8 Rx_association_count; + u8 Reserved1[3]; + u8 PLCP_header[4]; + +}; + + +struct aironet4500_radio_tx_header { + u32 SWSupport; + u16 Status; + #define aironet4500_tx_status_max_retries 0x0002 + #define aironet4500_tx_status_lifetime_exceeded 0x0004 + #define aironet4500_tx_status_AID_failure 0x0008 + #define aironet4500_tx_status_MAC_disabled 0x0010 + #define aironet4500_tx_status_association_lost 0x0020 + u16 PayloadLength; + u16 TX_Control; + #define aironet4500_tx_control_tx_ok_event_enable 0x0002 + #define aironet4500_tx_control_tx_fail_event_enable 0x0004 + #define aironet4500_tx_control_header_type_802_11 0x0008 + #define aironet4500_tx_control_payload_type_llc 0x0010 + #define aironet4500_tx_control_no_release 0x0020 + #define aironet4500_tx_control_reuse_fid \ + (aironet4500_tx_control_tx_ok_event_enable |\ + aironet4500_tx_control_tx_fail_event_enable |\ + aironet4500_tx_control_no_release) + #define aironet4500_tx_control_no_retries 0x0040 + #define aironet4500_tx_control_clear_AID 0x0080 + #define aironet4500_tx_control_strict_order 0x0100 + #define aironet4500_tx_control_use_rts 0x0200 + u16 AID; + u8 Tx_Long_Retry; + u8 Tx_Short_Retry; + u8 tx_association_count; + u8 tx_bit_rate; + #define aironet4500_tx_bit_rate_automatic 0 + #define aironet4500_tx_bit_rate_500kbps 1 + #define aironet4500_tx_bit_rate_1Mbps 2 + #define aironet4500_tx_bit_rate_2Mbps 4 + u8 Max_Long_Retry; + u8 Max_Short_Retry; + u8 Reserved0[2]; +}; + + +struct aironet4500_rx_fid { + + u16 rid; + struct aironet4500_radio_rx_header radio_rx; + struct ieee_802_11_header ieee_802_11; + u16 gap_length; + struct ieee_802_3_header ieee_802_3; + u8 * payload; +}; + + +struct aironet4500_tx_fid { + + u16 fid; + u16 fid_size; + struct aironet4500_radio_tx_header radio_tx; + struct ieee_802_11_header ieee_802_11; + u16 gap_length; + #define aironet4500_gap_len_without_802_3 6 + #define aironet4500_gap_len_with_802_3 0 + struct ieee_802_3_header ieee_802_3; + u8 * payload; +}; + +struct awc_fid { + + u32 type; + #define p80211_llc_snap 0x0100 + #define p80211_8021H 0x0200 + #define p80211_8022 0x0400 + #define p80211_8023 0x0800 + #define p80211_snap_8021H 0x1000 + #define p80211copy_path_skb 0x2000 + + u8 priority; + u8 busy; + + #define awc_tx_fid_complete_read 0x01 + u16 state; + union { + struct aironet4500_tx_fid tx; + struct aironet4500_rx_fid rx; + } u; + + struct ieee_802_11_snap_header snap; + struct ieee_802_11_802_1H_header bridge; + u16 bridge_size; + struct ieee_802_11_802_2_header p8022; + + u16 pkt_len; + u8 * mac; + struct sk_buff * skb; + long long transmit_start_time; + struct awc_fid * next; + struct awc_fid * prev; + +}; + + + +struct awc_fid_queue { + + + struct awc_fid * head; + struct awc_fid * tail; + int size; + my_spinlock_t lock; +}; + + +extern inline void +awc_fid_queue_init(struct awc_fid_queue * queue){ + + unsigned long flags; +#ifdef __SMP__ + queue->lock.lock = 0; +#endif + memset(queue,0, sizeof(struct awc_fid_queue)); + + my_spin_lock_irqsave(&queue->lock,flags); + queue->head = NULL; + queue->tail = NULL; + queue->size = 0; + my_spin_unlock_irqrestore(&queue->lock,flags); +}; + +extern inline void +awc_fid_queue_push_tail( struct awc_fid_queue * queue, + struct awc_fid * fid){ + + unsigned long flags; + + my_spin_lock_irqsave(&queue->lock,flags); + + fid->prev = queue->tail; + fid->next = NULL; + + if (queue->tail){ + queue->tail->next = fid; + } + queue->tail = fid; + + if (!queue->head) + queue->head = fid; + queue->size++; + + my_spin_unlock_irqrestore(&queue->lock,flags); + +}; + + +extern inline void +awc_fid_queue_push_head( struct awc_fid_queue * queue, + struct awc_fid * fid){ + + unsigned long flags; + + my_spin_lock_irqsave(&queue->lock,flags); + + fid->prev = NULL; + fid->next = queue->head; + + if (queue->head){ + queue->head->prev = fid; + } + queue->head = fid; + + if (!queue->tail) + queue->tail = fid; + queue->size++; + + + my_spin_unlock_irqrestore(&queue->lock,flags); + +}; + + + +extern inline void +awc_fid_queue_rm( struct awc_fid_queue * queue, + struct awc_fid * fid){ + + + if (fid->prev) { + fid->prev->next = fid->next; + }; + + if (fid->next) { + fid->next->prev = fid->prev; + }; + + if (fid == queue->tail) { + queue->tail = fid->prev; + }; + if (fid == queue->head) { + queue->head = fid->next; + }; + fid->next = NULL; + fid->prev = NULL; + queue->size--; + if (queue->size ==0 ){ + queue->tail = NULL; + queue->head = NULL; + } +}; + +extern inline void +awc_fid_queue_remove( struct awc_fid_queue * queue, + struct awc_fid * fid){ + unsigned long flags; + my_spin_lock_irqsave(&queue->lock,flags); + + awc_fid_queue_rm(queue,fid); + + my_spin_unlock_irqrestore(&queue->lock,flags); + +}; + + + +extern inline struct awc_fid * +awc_fid_queue_pop_head( struct awc_fid_queue * queue){ + + unsigned long flags; + struct awc_fid * fid; + + my_spin_lock_irqsave(&queue->lock,flags); + + fid = queue->head; + if (fid) + awc_fid_queue_rm(queue,fid); + + + my_spin_unlock_irqrestore(&queue->lock,flags); + + return fid; +}; + + + + +extern inline struct awc_fid * +awc_fid_queue_pop_tail( struct awc_fid_queue * queue){ + + unsigned long flags; + struct awc_fid * fid; + + my_spin_lock_irqsave(&queue->lock,flags); + + fid = queue->tail; + if (fid) + awc_fid_queue_rm(queue,fid); + + my_spin_unlock_irqrestore(&queue->lock,flags); + + return fid; +}; + + + +#define AWC_TX_HEAD_SIZE 0x44 +#define AWC_TX_ALLOC_SMALL_SIZE 150 +#define AWC_RX_BUFFS 50 + + +/***************************** RID & CONFIG ***********************/ + +struct awc_config{ + unsigned short Len; /* sizeof(PC4500_CONFIG) */ + unsigned short OperatingMode; /* operating mode */ + + #define MODE_STA_IBSS 0 + #define MODE_STA_ESS 1 + #define MODE_AP 2 + #define MODE_AP_RPTR 3 + #define MODE_ETHERNET_HOST (0<<8) /* rx payloads converted */ + #define MODE_LLC_HOST (1<<8) /* rx payloads left as is */ + #define MODE_AIRONET_EXTEND (1<<9) /* enable Aironet extenstions */ + #define MODE_AP_INTERFACE (1<<10) /* enable ap interface extensions */ + unsigned short ReceiveMode; /* receive mode */ + #define RXMODE_BC_MC_ADDR 0 + #define RXMODE_BC_ADDR 1 /* ignore multicasts */ + #define RXMODE_ADDR 2 /* ignore multicast and broadcast */ + #define RXMODE_RFMON 3 /* wireless monitor mode */ + #define RXMODE_RFMON_ANYBSS 4 + #define RXMODE_LANMON 5 /* lan style monitor -- data packets only */ + #define RXMODE_DISABLE_802_3_HEADER 0x100 /* disables 802.3 header on rx */ + + unsigned short FragmentThreshold; + unsigned short RtsThreshold; + unsigned char StationMacAddress[6]; + unsigned char Rates[8]; + unsigned short ShortRetryLimit; + unsigned short LongRetryLimit; + unsigned short TxLifetime; /* in kusec */ + unsigned short RxLifetime; /* in kusec */ + unsigned short Stationary; + unsigned short Ordering; + unsigned short DeviceType; /* for overriding device type */ + unsigned short _reserved1[5]; /*---------- Scanning/Associating ----------*/ + unsigned short ScanMode; + #define SCANMODE_ACTIVE 0 + #define SCANMODE_PASSIVE 1 + #define SCANMODE_AIROSCAN 2 + unsigned short ProbeDelay; /* in kusec */ + unsigned short ProbeEnergyTimeout; /* in kusec */ + unsigned short ProbeResponseTimeout; + unsigned short BeaconListenTimeout; + unsigned short JoinNetTimeout; + unsigned short AuthenticationTimeout; + unsigned short AuthenticationType; + #define AUTH_OPEN 1 + #define AUTH_SHAREDKEY 2 + #define AUTH_EXCLUDENONWEP 4 + unsigned short AssociationTimeout; + unsigned short SpecifiedApTimeout; + unsigned short OfflineScanInterval; + unsigned short OfflineScanDuration; + unsigned short LinkLossDelay; + unsigned short MaxBeaconLostTime; + unsigned short RefreshInterval; + #define DISABLE_REFRESH 0xFFFF + unsigned short _reserved1a[1]; /*---------- Power save operation ----------*/ + unsigned short PowerSaveMode; + #define POWERSAVE_CAM 0 + #define POWERSAVE_PSP 1 + #define POWERSAVE_PSP_CAM 2 + unsigned short SleepForDtims; + unsigned short ListenInterval; + unsigned short FastListenInterval; + unsigned short ListenDecay; + unsigned short FastListenDelay; + unsigned short _reserved2[2]; /*---------- Ap/Ibss config items ----------*/ + unsigned short BeaconPeriod; + unsigned short AtimDuration; + unsigned short HopPeriod; + unsigned short ChannelSet; + unsigned short Channel; + unsigned short DtimPeriod; + unsigned short _reserved3[2]; /*---------- Radio configuration ----------*/ + unsigned short RadioType; + #define RADIOTYPE_DEFAULT 0 + #define RADIOTYPE_802_11 1 + #define RADIOTYPE_LEGACY 2 + unsigned char u8RxDiversity; + unsigned char u8TxDiversity; + unsigned short TxPower; + #define TXPOWER_DEFAULT 0 + unsigned short RssiThreshold; + #define RSSI_DEFAULT 0 + unsigned short RadioSpecific[4]; /*---------- Aironet Extensions ----------*/ + unsigned char NodeName[16]; + unsigned short ArlThreshold; + unsigned short ArlDecay; + unsigned short ArlDelay; + unsigned short _reserved4[1]; /*---------- Aironet Extensions ----------*/ + unsigned short MagicAction; + #define MAGIC_ACTION_STSCHG 1 + #define MACIC_ACTION_RESUME 2 + #define MAGIC_IGNORE_MCAST (1<<8) + #define MAGIC_IGNORE_BCAST (1<<9) + #define MAGIC_SWITCH_TO_PSP (0<<10) + #define MAGIC_STAY_IN_CAM (1<<10) +}; + + + +struct awc_SSID { + u16 lenght; + u8 SSID[32]; +}; + +struct awc_SSIDs { + u16 ridLen; + struct awc_SSID SSID[3]; + +}; + +struct awc_fixed_APs{ + u16 ridLen; + u8 AP[4][6]; +}; + +struct awc_driver_name{ + u16 ridLen; + u8 name[16]; +}; + +struct awc_encapsulation{ + u16 etherType; + u16 Action; +}; + +struct awc_enc_trans{ + u16 ridLen; + struct awc_encapsulation rules[8]; +}; + +struct awc_wep_key { + u16 ridLen; + u16 KeyIndex; + u8 Address[6]; + u16 KeyLen; + u8 Key[16]; +}; + +struct awc_modulation { + u16 ridLen; + u16 Modulation; +}; + +struct awc_cap{ + u16 ridLen; + u8 OUI[3]; + u8 ProductNum[3]; + u8 ManufacturerName[32]; + u8 ProductName[16]; + u8 ProductVersion[8]; + u8 FactoryAddress[6]; + u8 AironetAddress[6]; + u16 RadioType; + u16 RegDomain; + u8 Callid[6]; + u8 SupportedRates[8]; + u8 RxDiversity; + u8 TxDiversity; + u16 TxPowerLevels[8]; + u16 HardwareVersion; + u16 HardwareCapabilities; + u16 TemperatureRange; + u16 SoftwareVersion; + u16 SoftwareSubVersion; + u16 InterfaceVersion; + u16 SoftwareCapabilities; + u8 BootBlockVersionMajor; + u8 BootBlockVersionMinor; + +}; + + +struct awc_status{ + u16 ridLen; + u8 MacAddress[6]; + u16 OperationalMode; + u16 ErrorCode; + u16 CurrentSignalQuality; + u16 SSIDlength; + u8 SSID[32]; + u8 ApName[16]; + u8 CurrentBssid[32]; + u8 PreviousBSSIDs[3][6]; + u16 BeaconPeriod; + u16 DtimPeriod; + u16 AtimDuration; + u16 HopPeriod; + u16 ChannelSet; + u16 Channel; + + u16 HopsToBackbone; + u16 ApTotalLoad; + u16 OurGeneratedLoad; + u16 AccumulatedArl; + +}; + + +struct awc_AP{ + u16 ridLen; + u16 TIM_Addr; + u16 Airo_Addr; +}; + +struct awc_Statistics_32 { + + u32 RidLen; + u32 RxOverrunErr; + u32 RxPlcpCrcErr; + u32 RxPlcpFormat; + u32 RxPlcpLength; + u32 RxMacCrcErr; + u32 RxMacCrcOk; + u32 RxWepErr; + u32 RxWepOk; + u32 RetryLong; + u32 RetryShort; + u32 MaxRetries; + u32 NoAck; + + u32 NoCts; + u32 RxAck; + u32 RxCts; + u32 TxAck; + u32 TxRts; + u32 TxCts; + u32 TxMc; + u32 TxBc; + u32 TxUcFrags; + u32 TxUcPackets; + u32 TxBeacon; + u32 RxBeacon; + u32 TxSinColl; + u32 TxMulColl; + u32 DefersNo; + u32 DefersProt; + u32 DefersEngy; + u32 DupFram; + u32 RxFragDisc; + u32 TxAged; + u32 RxAged; + u32 LostSync_Max; + u32 LostSync_Mis; + u32 LostSync_Arl; + u32 LostSync_Dea; + u32 LostSync_Disa; + u32 LostSync_Tsf; + u32 HostTxMc; + u32 HostTxBc; + u32 HostTxUc; + u32 HostTxFail; + u32 HostRxMc; + u32 HostRxBc; + u32 HostRxUc; + u32 HostRxDiscar; + u32 HmacTxMc; + u32 HmacTxBc; + u32 HmacTxUc; + u32 HmacTxFail; + u32 HmacRxMc; + u32 HmacRxBc; + u32 HmacRxUc; + u32 HmacRxDisca; + u32 HmacRxAcce; + u32 SsidMismatch; + u32 ApMismatch; + u32 RatesMismatc; + u32 AuthReject; + u32 AuthTimeout; + u32 AssocReject; + u32 AssocTimeout; + u32 NewReason; + u32 AuthFail_1; + u32 AuthFail_2; + u32 AuthFail_3; + u32 AuthFail_4; + u32 AuthFail_5; + u32 AuthFail_6; + u32 AuthFail_7; + u32 AuthFail_8; + u32 AuthFail_9; + u32 AuthFail_10; + u32 AuthFail_11; + u32 AuthFail_12; + u32 AuthFail_13; + u32 AuthFail_14; + u32 AuthFail_15; + u32 AuthFail_16; + u32 AuthFail_17; + u32 AuthFail_18; + u32 AuthFail_19; + u32 RxMan; + u32 TxMan; + u32 RxRefresh; + u32 TxRefresh; + u32 RxPoll; + u32 TxPoll; + u32 HostRetries; + u32 LostSync_HostReq; + u32 HostTxBytes; + u32 HostRxBytes; + u32 ElapsedUsec; + u32 ElapsedSec; + u32 LostSyncBett; +}; + +struct awc_Statistics_16 { + + u16 RidLen; + u16 RxOverrunErr; + u16 RxPlcpCrcErr; + u16 RxPlcpFormat; + u16 RxPlcpLength; + u16 RxMacCrcErr; + u16 RxMacCrcOk; + u16 RxWepErr; + u16 RxWepOk; + u16 RetryLong; + u16 RetryShort; + u16 MaxRetries; + u16 NoAck; + u16 NoCts; + u16 RxAck; + u16 RxCts; + u16 TxAck; + u16 TxRts; + u16 TxCts; + u16 TxMc; + u16 TxBc; + u16 TxUcFrags; + u16 TxUcPackets; + u16 TxBeacon; + u16 RxBeacon; + u16 TxSinColl; + u16 TxMulColl; + u16 DefersNo; + u16 DefersProt; + u16 DefersEngy; + u16 DupFram; + u16 RxFragDisc; + u16 TxAged; + u16 RxAged; + u16 LostSync_Max; + u16 LostSync_Mis; + u16 LostSync_Arl; + u16 LostSync_Dea; + u16 LostSync_Disa; + u16 LostSync_Tsf; + u16 HostTxMc; + u16 HostTxBc; + u16 HostTxUc; + u16 HostTxFail; + u16 HostRxMc; + u16 HostRxBc; + u16 HostRxUc; + u16 HostRxDiscar; + u16 HmacTxMc; + u16 HmacTxBc; + u16 HmacTxUc; + u16 HmacTxFail; + u16 HmacRxMc; + u16 HmacRxBc; + u16 HmacRxUc; + u16 HmacRxDisca; + u16 HmacRxAcce; + u16 SsidMismatch; + u16 ApMismatch; + u16 RatesMismatc; + u16 AuthReject; + u16 AuthTimeout; + u16 AssocReject; + u16 AssocTimeout; + u16 NewReason; + u16 AuthFail_1; + u16 AuthFail_2; + u16 AuthFail_3; + u16 AuthFail_4; + u16 AuthFail_5; + u16 AuthFail_6; + u16 AuthFail_7; + u16 AuthFail_8; + u16 AuthFail_9; + u16 AuthFail_10; + u16 AuthFail_11; + u16 AuthFail_12; + u16 AuthFail_13; + u16 AuthFail_14; + u16 AuthFail_15; + u16 AuthFail_16; + u16 AuthFail_17; + u16 AuthFail_18; + u16 AuthFail_19; + u16 RxMan; + u16 TxMan; + u16 RxRefresh; + u16 TxRefresh; + u16 RxPoll; + u16 TxPoll; + u16 HostRetries; + u16 LostSync_HostReq; + u16 HostTxBytes; + u16 HostRxBytes; + u16 ElapsedUsec; + u16 ElapsedSec; + u16 LostSyncBett; +}; + + +#define AWC_TXCTL_TXOK (1<<1) /* report if tx is ok */ +#define AWC_TXCTL_TXEX (1<<2) /* report if tx fails */ +#define AWC_TXCTL_802_3 (0<<3) /* 802.3 packet */ +#define AWC_TXCTL_802_11 (1<<3) /* 802.11 mac packet */ +#define AWC_TXCTL_ETHERNET (0<<4) /* payload has ethertype */ +#define AWC_TXCTL_LLC (1<<4) /* payload is llc */ +#define AWC_TXCTL_RELEASE (0<<5) /* release after completion */ +#define AWC_TXCTL_NORELEASE (1<<5) /* on completion returns to host */ + + +/************************* LINK STATUS STUFF *******************/ + +#define awc_link_status_loss_of_sync_missed_beacons 0x8000 +#define awc_link_status_loss_of_sync_max_retries 0x8001 +#define awc_link_status_loss_of_sync_ARL_exceed 0x8002 +#define awc_link_status_loss_of_sync_host_request 0x8003 +#define awc_link_status_loss_of_sync_TSF_sync 0x8004 +#define awc_link_status_deauthentication 0x8100 +#define awc_link_status_disassociation 0x8200 +#define awc_link_status_association_failed 0x8400 +#define awc_link_status_authentication_failed 0x0300 +#define awc_link_status_associated 0x0400 + +struct awc_strings { + int par; + unsigned int mask; + const char * string; + +}; + +#define awc_link_status_strings {\ +{awc_link_status_loss_of_sync_missed_beacons, 0xFFFF,"Loss of sync -- missed beacons"},\ +{awc_link_status_loss_of_sync_max_retries, 0xFFFF,"Loss of sync -- max retries"},\ +{awc_link_status_loss_of_sync_ARL_exceed, 0xFFFF,"Loss of sync -- average retry level (ARL) exceeded"},\ +{awc_link_status_loss_of_sync_host_request, 0xFFFF,"Loss of sync -- host request"},\ +{awc_link_status_loss_of_sync_TSF_sync, 0xFFFF,"Loss of sync -- TSF synchronization"},\ +{awc_link_status_deauthentication, 0xFF00,"Deauthentication "},\ +{awc_link_status_disassociation, 0xFF00,"Disassocation "},\ +{awc_link_status_association_failed , 0xFF00,"Association failed "},\ +{awc_link_status_authentication_failed, 0xFF00,"Authentication failure"},\ +{awc_link_status_associated, 0xFFFF,"Associated "},\ +{0,0,NULL}\ +} + + +/****************************** COMMANDS and DEFAULTS and STATUSES ***********/ + +/****************************** COMMANDS */ + + +// Command definitions + + + + +#define awc4500wout(base, com, p0,p1,p2) {\ + awc_write(base,awc_Param0_register, p0);\ + awc_write(base,awc_Param1_register, p1);\ + awc_write(base,awc_Param2_register, p2);\ + WAIT61x3;\ + awc_write(base,awc_Command_register, com);\ + WAIT61x3;\ +} +#define awc_wout(cmd, com, p0,p1,p2) {\ + awc_write(base,awc_Param0_register, p0);\ + awc_write(base,awc_Param1_register, p1);\ + awc_write(base,awc_Param2_register, p2);\ + WAIT61x3;\ + awc_write(base,awc_Command_register, com);\ + WAIT61x3;\ +} + + +#define awc_command_NOP(cmd) awc_wout( cmd,0x0000,0,0,0) // NOP +#define awc_command_Enable_All(cmd) awc_wout( cmd,0x0001,0,0,0) // Enable +#define awc_command_Enable_MAC(cmd) awc_wout( cmd,0x0101,0,0,0) // Enable Mac +#define awc_command_Enable_Rx(cmd) awc_wout( cmd,0x0201,0,0,0) // Enable Rx +#define awc_command_Disable_MAC(cmd) awc_wout( cmd,0x0002,0,0,0) // Disable +#define awc_command_Sync_Loss(cmd) awc_wout( cmd,0x0003,0,0,0) // Force a Loss of Sync +#define awc_command_Soft_Reset(cmd) awc_wout( cmd,0x0004,0,0,0) // Firmware Restart (soft reset) +#define awc_command_Host_Sleep(cmd) awc_wout( cmd,0x0005,0,0,0) // Host Sleep (must be issued as 0x0085) +#define awc_command_Magic_Packet(cmd) awc_wout( cmd,0x0006,0,0,0) // Magic Packet +#define awc_command_Read_Configuration(cmd) awc_wout( cmd,0x0008,0,0,0) // Read the Configuration from nonvolatile storage +#define awc_command_Allocate_TX_Buff(cmd,size) awc_wout( cmd,0x000A,size,0,0) // Allocate Transmit Buffer +#define awc_command_TX(cmd,FID) awc_wout( cmd,0x000B,FID ,0,0) // Transmit +#define awc_command_Deallocate(cmd,FID) awc_wout( cmd,0x000C,FID ,0,0) // Deallocate +#define awc_command_NOP2(cmd) awc_wout( cmd,0x0010,0,0,0) // NOP (same as 0x0000) +#define awc_command_Read_RID(cmd,RID) awc_wout( cmd,0x0021,RID ,0,0) // Read RID +#define awc_command_Write_RID(cmd,RID) awc_wout( cmd,0x0121,RID ,0,0) // Write RID +#define awc_command_Allocate_Buff(cmd,size) awc_wout( cmd,0x0028,size,0,0) // Allocate Buffer +#define awc_command_PSP_Nodes(cmd) awc_wout( cmd,0x0030,0,0,0) // PSP nodes (AP only) +#define awc_command_Set_Phy_register(cmd,phy_register,clear_bits, set_bits)\ + awc_wout( cmd,0x003E,phy_register,clear_bits, set_bits) // Set PHY register +#define awc_command_TX_Test(cmd,command, frequency, pattern) awc_wout( cmd,0x003F,command, frequency, pattern) // Transmitter Test +#define awc_command_RX_Test(cmd) awc_wout( cmd,0x013F,0,0,0) // RX Test +#define awc_command_Sleep(cmd) awc_wout( cmd,0x0085,0,0,0) // Go to Sleep (No Ack bit is mandatory) +#define awc_command_Save_Configuration(cmd) awc_wout( cmd,0x0108,0,0,0) // Save the configuration to nonvolatile + + +#define AWC_COMMAND_NOOP_BULL 0x000 +#define AWC_COMMAND_ENABLE 0x001 +#define AWC_COMMAND_ENABLE_MAC 0x101 +#define AWC_COMMAND_ENABLE_RX 0x201 +#define AWC_COMMAND_DISABLE 0x002 +#define AWC_COMMAND_LOSE_SYNC 0x003 +#define AWC_COMMAND_SOFT_RESET 0x004 +#define AWC_COMMAND_HOST_SLEEP 0x085 +#define AWC_COMMAND_MAGIC_PACKET 0x006 +#define AWC_COMMAND_READ_CONF 0x008 +#define AWC_COMMAND_SAVE_CONF 0x108 +#define AWC_COMMAND_TX_ALLOC 0x00A +#define AWC_COMMAND_TX 0x00B +#define AWC_COMMAND_DEALLOC 0x00C +#define AWC_COMMAND_NOOP 0x010 +#define AWC_COMMAND_READ_RID 0x021 +#define AWC_COMMAND_WRITE_RID 0x121 +#define AWC_COMMAND_ALLOC 0x028 +#define AWC_COMMAND_PSP_NODES 0x030 +#define AWC_COMMAND_SET_PHY 0x03E +#define AWC_COMMAND_TX_TEST 0x03F +#define AWC_COMMAND_SLEEP 0x085 + + +#define awc_command_name_strings {\ + {0x0000, 0x00FF,"awc_command_NOP " },\ + {0x0001, 0x00FF,"awc_command_Enable_All " },\ + {0x0101, 0x01FF,"awc_command_Enable_MAC " },\ + {0x0201, 0x01FF,"awc_command_Enable_Rx " },\ + {0x0002, 0x00FF,"awc_command_Disable_MAC " },\ + {0x0003, 0x00FF,"awc_command_Sync_Loss " },\ + {0x0004, 0x00FF,"awc_command_Soft_Reset " },\ + {0x0005, 0x00FF,"awc_command_Host_Sleep " },\ + {0x0006, 0x00FF,"awc_command_Magic_Packet " },\ + {0x0008, 0x00FF,"awc_command_Read_Configuration " },\ + {0x000A, 0x00FF,"awc_command_Allocate_TX_Buff " },\ + {0x000B, 0x00FF,"awc_command_TX " },\ + {0x000C, 0x00FF,"awc_command_Deallocate " },\ + {0x0010, 0x00FF,"awc_command_NOP2 " },\ + {0x0021, 0x00FF,"awc_command_Read_RID " },\ + {0x0121, 0x01FF,"awc_command_Write_RID " },\ + {0x0028, 0x00FF,"awc_command_Allocate_Buff " },\ + {0x0030, 0x00FF,"awc_command_PSP_Nodes " },\ + {0x003E, 0x00FF,"awc_command_Set_Phy_register " },\ + {0x003F, 0x00FF,"awc_command_TX_Test " },\ + {0x013F, 0x01FF,"awc_command_RX_Test " },\ + {0x0085, 0x00FF,"awc_command_Sleep " },\ + {0x0108, 0x01FF,"awc_command_Save_Configuration " },\ + {0x0000, 0x00FF, NULL}\ +}; + + +/***************************** STATUSES */ + +#define awc_reply_success 0x0000 + +#define awc_reply_error_strings {\ + { 0x0000, 0x00FF," Success"},\ + { 0x0001, 0x00FF," Illegal command."},\ + { 0x0002, 0x00FF," Illegal format."},\ + { 0x0003, 0x00FF," Invalid FID."},\ + { 0x0004, 0x00FF," Invalid RID."},\ + { 0x0005, 0x00FF," Too Large"},\ + { 0x0006, 0x00FF," MAC is not disabled."},\ + { 0x0007, 0x00FF," Alloc is still busy processing previous alloc"},\ + { 0x0008, 0x00FF," Invalid Mode Field"},\ + { 0x0009, 0x00FF," Tx is not allowed in monitor mode"},\ + { 0x000A, 0x00FF," Loop test or memory test error"},\ + { 0x000B, 0x00FF," Cannot read this RID."},\ + { 0x000C, 0x00FF," Cannot write to this RID."},\ + { 0x000D, 0x00FF," Tag not found."},\ + { 0x0080, 0x00FF," Config mode is invalid."},\ + { 0x0081, 0x00FF," Config hop interval is invalid."},\ + { 0x0082, 0x00FF," Config beacon interval is invalid."},\ + { 0x0083, 0x00FF," Config receive mode is invalid."},\ + { 0x0084, 0x00FF," Config MAC address is invalid."},\ + { 0x0085, 0x00FF," Config rates are invalid."},\ + { 0x0086, 0x00FF," Config ordering field is invalid."},\ + { 0x0087, 0x00FF," Config scan mode is invalid."},\ + { 0x0088, 0x00FF," Config authentication type is invalid."},\ + { 0x0089, 0x00FF," Config power save mode is invalid."},\ + { 0x008A, 0x00FF," Config radio type is invalid."},\ + { 0x008B, 0x00FF," Config diversity is invalid."},\ + { 0x008C, 0x00FF," Config SSID list is invalid."},\ + { 0x008D, 0x00FF," Config specified AP list is invalid."},\ + { 0x0000, 0x00FF, NULL}\ +}; + +#define awc_reply_command_failed( status) ((status & 0x7F00) == 0x7F) + + +/************************* PHY and TEST commands ****************/ + + +// this might be wrong and reading is not implemented(was not in spec properly) +#define awc_Set_PLCP_Word(PLCP_Word)\ + awc_command_Set_Phy_register(base,0x8000,0 ,PLCP_Word) +#define awc_Set_TX_Test_Freq(Tx_Test_Freq)\ + awc_command_Set_Phy_register(base,0x8002,0 ,Tx_Test_Freq) +#define awc_Set_Tx_Power(Tx_Power)\ + awc_command_Set_Phy_register(base,0x8004,0 ,Tx_Power) +#define awc_Set_RSSI_Treshold(RSSI_Treshold)\ + awc_command_Set_Phy_register(base,0x8006,0 ,RSSI_Treshold) +#define awc_Get_PLCP_Word(PLCP_Word)\ + awc_command_Set_Phy_register(base,0x8000,0 ,0) +#define awc_Get_TX_Test_Freq(Tx_Test_Freq)\ + awc_command_Set_Phy_register(base,0x8002,0 ,0) +#define awc_Get_Tx_Power(Tx_Power)\ + awc_command_Set_Phy_register(base,0x8004,0 ,0) +#define awc_Get_RSSI_Treshold(RSSI_Treshold)\ + awc_command_Set_Phy_register(base,0x8006,0 ,0) + + +#define awc_tx_test_code_end 0x0000 // Ends the transmitter test +#define awc_tx_test_code_loop 0x0001 // Loop back to the beginning of the commands +#define awc_tx_test_code_start 0x0002 // Start transmitting +#define awc_tx_test_code_stop 0x0003 // Stop transmitting +#define awc_tx_test_code_delayu 0x0004 // Delay for N usec where N is the next word +#define awc_tx_test_code_delayk 0x0005 // Delay for N Kusec where N is the next word +#define awc_tx_test_code_next 0x0006 // Go to the next frequency in the frequency RID +#define awc_tx_test_code_rx 0x0007 // Start receive mode + +#define awc_tx_test_code_strings {\ +{ awc_tx_test_code_end , 0x000f ," Ends the transmitter test"},\ +{ awc_tx_test_code_loop , 0x000f ," Loop back to the beginning of the commands"},\ +{ awc_tx_test_code_start , 0x000f ," Start transmitting"},\ +{ awc_tx_test_code_stop , 0x000f ," Stop transmitting"},\ +{ awc_tx_test_code_delayu , 0x000f ," Delay for N usec where N is the next word"},\ +{ awc_tx_test_code_delayk , 0x000f ," Delay for N Kusec where N is the next word"},\ +{ awc_tx_test_code_next , 0x000f ," Go to the next frequency in the frequency RID"},\ +{ awc_tx_test_code_rx , 0x000f ," Start receive mode"},\ +{ 0 , 0x000f ,NULL}\ +}; + + + +#define AWC_COMMSTAT_HARD_RESET 0x0000001 +#define AWC_COMMSTAT_WAKE 0x0000002 +#define AWC_COMMSTAT_SOFT_RESET 0x0000004 +#define AWC_COMMSTAT_CONFIGURE 0x0000008 +#define AWC_COMMSTAT_READ_CONF 0x0000010 +#define AWC_COMMSTAT_SAVE_CONF 0x0000020 +#define AWC_COMMSTAT_DEALLOC 0x0000040 +#define AWC_COMMSTAT_ALLOC_TX 0x0000080 +#define AWC_COMMSTAT_ALLOC_TEST 0x0000100 +#define AWC_COMMSTAT_ENABLE_MAC 0x0000200 +#define AWC_COMMSTAT_ENABLE_RX 0x0000400 +#define AWC_COMMSTAT_DISABLE_MAC 0x0000800 +#define AWC_COMMSTAT_RX_ACK 0x0001000 +#define AWC_COMMSTAT_TX_ACK 0x0002000 +#define AWC_COMMSTAT_AWAKEN_ACK 0x0004000 +#define AWC_COMMSTAT_TX_FAIL_ACK 0x0008000 +#define AWC_COMMSTAT_LINK_ACK 0x0010000 +#define AWC_COMMSTAT_CLR_CMD 0x0020000 +#define AWC_COMMSTAT_ALLOC_ACK 0x0040000 +#define AWC_COMMSTAT_HOST_SLEEP 0x0080000 +#define AWC_COMMSTAT_RX 0x0100000 +#define AWC_COMMSTAT_TX 0x0200000 +#define AWC_COMMSTAT_SLEEP 0x0400000 +#define AWC_COMMSTAT_PSP_NODES 0x0800000 +#define AWC_COMMSTAT_SET_TX_POWER 0x1000000 + + +/***************************** R I D ***************/ + +#define AWC_NOF_RIDS 18 +extern int awc_rid_setup(struct NET_DEVICE * dev); + +struct aironet4500_rid_selector{ + const u16 selector; + const unsigned MAC_Disable_at_write:1; + const unsigned read_only:1; + const unsigned may_change:1; + const char * name; +}; + + + + + +extern const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Status ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile ; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta; +extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear; + +#define awc_def_gen_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_General_Config,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_SSID_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_SSID_list,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_AP_List_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_AP_list,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Dname_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Driver_name,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_act_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Active_Config,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Cap_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Capabilities,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_AP_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_AP_Info,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Radio_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Radio_Info,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Stat_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Status,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Enc_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Encapsulation,offset, bits,1,1,0,0, mask, value, name, value_name} + +#define awc_def_WEPv_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_WEP_volatile,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_WEPnv_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_WEP_nonvolatile,offset, bits,1,1,0,0, mask, value, name, value_name} +#define awc_def_Modulation_RID(offset,name, bits,mask,value,value_name)\ + {&aironet4500_RID_Select_Modulation,offset, bits,1,1,0,0, mask, value, name, value_name} + +#define awc_def_Stats_RID(o16,offset,name, value_name)\ + {&aironet4500_RID_Select_32_stats,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name} +#define awc_def_Stats_delta_RID(o16,offset,name, value_name)\ + {&aironet4500_RID_Select_32_stats_delta,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name} +#define awc_def_Stats_clear_RID(o16,offset,name, value_name)\ + {&aironet4500_RID_Select_32_stats_delta,offset,32,1,1,0,0, 0xffffffff, 0, name,value_name} + +#define awc_def_Stats16_RID(offset,o32,name, value_name)\ + {&aironet4500_RID_Select_16_stats,offset, 16,1,1,0,0, 0xffffffff, 0, name, value_name} +#define awc_def_Stats16_delta_RID(offset,o32,name, value_name)\ + {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff, 0, name,value_name} +#define awc_def_Stats16_clear_RID(offset,o32,name, value_name)\ + {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff, 0, name,value_name} + + +#define aironet4500_RID_Select_strings {\ +{ 0xFF10, 0xffff, "General Configuration"},\ +{ 0xFF11, 0xffff, "Valid SSID list" },\ +{ 0xFF12, 0xffff, "Valid AP list"},\ +{ 0xFF13, 0xffff, "Driver name"},\ +{ 0xFF14, 0xffff, "Ethernet Protocol"},\ +{ 0xFF15, 0xffff, "WEP volatile"},\ +{ 0xFF16, 0xffff, "WEP nonvolatile"},\ +{ 0xFF17, 0xffff, "Modulation"},\ +{ 0xFF20, 0xffff, "Actual Configuration"},\ +{ 0xFF00, 0xffff, "Capabilities"},\ +{ 0xFF01, 0xffff, "AP Info"},\ +{ 0xFF02, 0xffff, "Radio Info"},\ +{ 0xFF50, 0xffff, "Status"},\ +{ 0xFF60, 0xffff, "Cumulative 16-bit Statistics"},\ +{ 0xFF61, 0xffff, "Delta 16-bit Statistics"},\ +{ 0xFF62, 0xffff, "Delta 16-bit Statistics and Clear"},\ +{ 0xFF68, 0xffff, "Cumulative 32-bit Statistics"},\ +{ 0xFF69, 0xffff, "Delta 32-bit Statistics "},\ +{ 0xFF6A, 0xffff, "Delta 32-bit Statistics and Clear"},\ +{ 0x0000, 0xffff, NULL}\ +} + + + + + +struct aironet4500_RID { + const struct aironet4500_rid_selector * selector; + const u32 offset; + const u8 bits; + const u8 array; + const u32 units; + const unsigned read_only:1; + const unsigned null_terminated:1; + const u32 mask; + const u32 value; + const char * name; + const char * value_name; + +}; + +struct aironet4500_RID_names{ + struct aironet4500_RID rid; + char *name; +}; + +struct aironet4500_RID_names_values{ + struct aironet4500_RID rid; + char *name; + u32 mask; +}; + +struct awc_rid_dir{ + const struct aironet4500_rid_selector * selector; + const int size; + const struct aironet4500_RID * rids; + struct NET_DEVICE * dev ; + void * buff; + int bufflen; // just checking +}; + +extern int awc_nof_rids; +extern struct awc_rid_dir awc_rids[]; + + + + + +struct awc_private { + dev_node_t node; + + + int dummy_test; + struct awc_config config; // card RID mirrors + struct awc_config general_config; // + struct awc_SSIDs SSIDs; + struct awc_fixed_APs fixed_APs; + struct awc_driver_name driver_name; + struct awc_enc_trans enc_trans; + struct awc_cap capabilities; + struct awc_status status; + struct awc_AP AP; + struct awc_Statistics_32 statistics; + struct awc_Statistics_32 statistics_delta; + struct awc_Statistics_32 statistics_delta_clear; + struct awc_Statistics_16 statistics16; + struct awc_Statistics_16 statistics16_delta; + struct awc_Statistics_16 statistics16_delta_clear; + struct awc_wep_key wep_volatile; + struct awc_wep_key wep_nonvolatile; + struct awc_modulation modulation; + + struct awc_rid_dir rid_dir[AWC_NOF_RIDS]; + int rids_read; + + + struct awc_bap bap0; + struct awc_bap bap1; + int sleeping_bap; + + struct awc_fid_queue tx_small_ready; + struct awc_fid_queue tx_large_ready; + struct awc_fid_queue tx_post_process; + struct awc_fid_queue tx_in_transmit; + my_spinlock_t queues_lock; + + struct awc_fid_queue rx_ready; + struct awc_fid_queue rx_post_process; + + + + struct semaphore tx_buff_semaphore; + volatile int tx_buffs_in_use; + volatile int tx_small_buffs_in_use; + volatile int tx_buffs_total; + volatile int tx_small_buffs_total; + int large_buff_mem; + int small_buff_no; + + int tx_timeout; + + volatile int mac_enabled; + u16 link_status; + u8 link_status_changed; + + volatile int ejected; + volatile int bh_running; + volatile int bh_active; + volatile int tx_chain_active; + volatile u16 enabled_interrupts; + volatile u16 waiting_interrupts; + volatile int interrupt_count; + + // Command serialize stuff + struct semaphore command_semaphore; + volatile int unlock_command_postponed; + struct awc_command cmd; + long long async_command_start; + volatile int command_semaphore_on; + struct tq_struct immediate_bh; + volatile int process_tx_results; + + u8 p2p[6]; + u8 bssid[6]; + int p2p_uc; + int p2p_found; + int p802_11_send; + + struct enet_statistics stats; + + struct ctl_table * proc_table; + + void * bus; + 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 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 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 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 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); + + + +extern int awc_debug; +extern int bap_sleep ; +extern int bap_sleep_after_setup ; +extern int sleep_before_command ; +extern int bap_sleep_before_write; +extern int sleep_in_command ; +extern int tx_queue_len ; +extern int tx_rate; +extern int awc_full_stats; + +#define MAX_AWCS 4 +extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS]; + + +#ifdef AWC_DEBUG + #define DEBUG(a,args...) if (awc_debug & a) printk( args) + #define AWC_ENTRY_EXIT_DEBUG(a) if (awc_debug & 8) printk( a) +#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.30/linux/drivers/net/aironet4500_card.c linux/drivers/net/aironet4500_card.c --- v2.3.30/linux/drivers/net/aironet4500_card.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/aironet4500_card.c Tue Dec 7 23:58:21 1999 @@ -0,0 +1,1118 @@ +/* + * Aironet 4500 PCI-ISA-i365 driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ +#ifdef MODULE +static const char *awc_version = +"aironet4500_cards.c v0.1 28/03/99 Elmer Joandi, elmer@ylenurme.ee.\n"; +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if LINUX_VERSION_CODE < 0x20100 +#include +#endif + +#include "aironet4500.h" + +#define PCI_VENDOR_ID_AIRONET 0x14b9 +#define PCI_DEVICE_AIRONET_4800_1 0x1 +#define PCI_DEVICE_AIRONET_4800 0x4500 +#define PCI_DEVICE_AIRONET_4500 0x4800 +#define AIRONET4X00_IO_SIZE 0x40 +#define AIRONET4X00_CIS_SIZE 0x300 +#define AIRONET4X00_MEM_SIZE 0x300 + +#define AIRONET4500_PCI 1 +#define AIRONET4500_PNP 2 +#define AIRONET4500_ISA 3 +#define AIRONET4500_365 4 + + +#ifdef CONFIG_AIRONET4500_PCI + +#include + + +static int reverse_probe =0 ; + + +static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, + int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ; + + +int awc4500_pci_probe(struct NET_DEVICE *dev) +{ + int cards_found = 0; + static int pci_index = 0; /* Static, for multiple probe calls. */ + u8 pci_irq_line = 0; +// int p; + + unsigned char awc_pci_dev, awc_pci_bus; + + if (!pcibios_present()) + return -1; + + for (;pci_index < 0xff; pci_index++) { + u16 vendor, device, pci_command, new_command; + u32 pci_memaddr; + u32 pci_ioaddr; + u32 pci_cisaddr; +#if LINUX_VERSION_CODE < 0x20100 + u16 pci_caps =0; + u8 pci_caps_ptr =0; +#endif + if (pcibios_find_class (PCI_CLASS_NETWORK_OTHER << 8, + reverse_probe ? 0xfe - pci_index : pci_index, + &awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){ + if (reverse_probe){ + continue; + } else { + 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); + +#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. */ + + if (vendor != PCI_VENDOR_ID_AIRONET) + continue; + if (device != PCI_DEVICE_AIRONET_4800_1 && + 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)) { +// printk(KERN_ERR "aironet4X00 mem addrs not available for maping \n"); +// continue; +// } + request_region(pci_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr"); +// 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); + udelay(10000); + + pcibios_read_config_word(awc_pci_bus, awc_pci_dev, + 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); + } + + +/* if (device == PCI_DEVICE_AIRONET_4800) + pcibios_write_config_dword(awc_pci_bus, awc_pci_dev, + 0x40, 0x00000000); + + udelay(1000); +*/ + if (device == PCI_DEVICE_AIRONET_4800) + pcibios_write_config_dword(awc_pci_bus, awc_pci_dev, + 0x40, 0x40000000); + + if (awc_pci_init(dev, awc_pci_bus, awc_pci_dev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){ + printk(KERN_ERR "awc4800 pci init failed \n"); + break; + } + dev = 0; + cards_found++; + } + + return cards_found ? 0 : -ENODEV; +} + + +static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr, + int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) { + + int i; + + if (!dev) { + dev = init_etherdev(dev, 0 ); + } + dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL ); + memset(dev->priv,0,sizeof(struct awc_private)); + if (!dev->priv) { + printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n"); + return -1; + }; + +// ether_setup(dev); + +// dev->tx_queue_len = tx_queue_len; + + dev->hard_start_xmit = &awc_start_xmit; +// dev->set_config = &awc_config_misiganes,aga mitte awc_config; + dev->get_stats = &awc_get_stats; +// dev->set_multicast_list = &awc_set_multicast_list; + dev->change_mtu = awc_change_mtu; + 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 + request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev); +#endif + awc_private_init( dev); + awc_init(dev); + + i=0; + while (aironet4500_devices[i] && i < MAX_AWCS-1) i++; + if (!aironet4500_devices[i]){ + aironet4500_devices[i]=dev; + ((struct awc_private *) + aironet4500_devices[i]->priv)->card_type = AIRONET4500_PCI; + + if (awc_proc_set_fun) + 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; + +} + +#ifdef MODULE +static void awc_pci_release(void) { + +// long flags; + int i=0; + + DEBUG(0, "awc_detach \n"); + + i=0; + while ( i < MAX_AWCS) { + if (!aironet4500_devices[i]) + {i++; continue;}; + if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PCI) + {i++; continue;} + + if (awc_proc_unset_fun) + awc_proc_unset_fun(i); + release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE); +// release_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); +// release_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem"); + + 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)); + + aironet4500_devices[i]=0; + + + i++; + } + + +} + + +#endif //MODULE + + +#endif /* CONFIG_AIRONET4500_PCI */ + +#ifdef CONFIG_AIRONET4500_PNP + +#if LINUX_VERSION_CODE > 0x20300 +#include +#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 +#define isapnp_find_logdev isapnp_find_dev +#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){ + struct isapnp_logdev *logdev; +#if LINUX_VERSION_CODE < 0x20300 + struct isapnp_config cfg; +#endif + DEBUG(0, "awc_pnp_reset \n"); + + if (!dev->priv ) { + printk("awc4500 no dev->priv in hw_reset\n"); + return -1; + }; + + logdev = ((struct isapnp_logdev *) ((struct awc_private *)dev->priv)->bus); + + if (!logdev ) { + printk("awc4500 no pnp logdev in hw_reset\n"); + return -1; + }; + + if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0) + printk("isapnp cfg failed at release \n"); + isapnp_deactivate(logdev->PNP_DEV_NUMBER); + isapnp_cfg_end(); + + udelay(100); + + + if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) { + printk("%s cfg begin failed in hw_reset for csn %x devnum %x \n", + 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 isa_index = 0; + int isa_irq_line = 0; + int isa_ioaddr = 0; + int card = 0; + 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 + ); + + if (!pnp_dev) break; + + isa_index++; + + logdev = isapnp_find_logdev(pnp_dev, ISAPNP_VENDOR('A','W','L'), + ISAPNP_FUNCTION(1), + 0); + if (!logdev){ + printk("No logical device found on Aironet board \n"); + return -ENODEV; + } + if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) { + printk("cfg begin failed for csn %x devnum %x \n", + 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) { + dev = init_etherdev(dev, 0 ); + } + dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL ); + memset(dev->priv,0,sizeof(struct awc_private)); + if (!dev->priv) { + printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n"); + return -1; + }; + ((struct awc_private *)dev->priv)->bus = logdev; + + // ether_setup(dev); + + // dev->tx_queue_len = tx_queue_len; + + dev->hard_start_xmit = &awc_start_xmit; + // dev->set_config = &awc_config_misiganes,aga mitte awc_config; + dev->get_stats = &awc_get_stats; + // dev->set_multicast_list = &awc_set_multicast_list; + dev->change_mtu = awc_change_mtu; + 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 + 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); + + ((struct awc_private *)dev->priv)->bus = logdev; + + cli(); + if ( awc_init(dev) ){ + printk("card not found at irq %x io %lx\n",dev->irq, dev->base_addr); + if (card==0){ + sti(); + return -1; + } + sti(); + break; + } + udelay(10); + sti(); + i=0; + while (aironet4500_devices[i] && i < MAX_AWCS-1) i++; + if (!aironet4500_devices[i] && i < MAX_AWCS-1 ){ + aironet4500_devices[i]=dev; + + ((struct awc_private *) + aironet4500_devices[i]->priv)->card_type = AIRONET4500_PNP; + + if (awc_proc_set_fun) + awc_proc_set_fun(i); + } else { + printk(KERN_CRIT "Out of resources (MAX_AWCS) \n"); + return -1; + } + + dev->tbusy = 1; + dev->start = 0; + + card++; + } + + if (card == 0) return -ENODEV; + return 0; +} + +#ifdef MODULE +static void awc_pnp_release(void) { + +// long flags; + int i=0; + struct isapnp_logdev *logdev; + + DEBUG(0, "awc_detach \n"); + + i=0; + while ( i < MAX_AWCS) { + if (!aironet4500_devices[i]) + {i++; continue;} + if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PNP) + {i++; continue;} + + logdev = ((struct isapnp_logdev *) ((struct awc_private *)aironet4500_devices[i]->priv)->bus); + + if (!logdev ) + printk("awc4500 no pnp logdev in pnp_release\n"); + + if (awc_proc_unset_fun) + awc_proc_unset_fun(i); + if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0) + printk("isapnp cfg failed at release \n"); + isapnp_deactivate(logdev->PNP_DEV_NUMBER); + isapnp_cfg_end(); + + release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE); +// release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); +// release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem"); + + 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)); + + aironet4500_devices[i]=0; + + + i++; + } + + +} + +#endif //MODULE +#endif /* CONFIG_AIRONET4500_PNP */ + +#ifdef CONFIG_AIRONET4500_ISA + +static int irq[] = {0,0,0,0,0}; +static int io[] = {0,0,0,0,0}; + +/* + 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 cards_found = 0; +// static int isa_index = 0; /* Static, for multiple probe calls. */ + int isa_irq_line = 0; + int isa_ioaddr = 0; +// int p; + int card = 0; + int i=0; + + if (! io[0] || ! irq[0]){ + + printk(" Both irq and io params must be supplied for ISA mode !!!\n"); + return -ENODEV; + } + + printk(KERN_WARNING " Aironet ISA Card in non-PNP(ISA) mode sometimes feels bad on interrupt \n"); + printk(KERN_WARNING " Use aironet4500_pnp if any problems(i.e. card malfunctioning). \n"); + printk(KERN_WARNING " Note that this isa probe is not friendly... must give exact parameters \n"); + + while (irq[card] !=0){ + + isa_ioaddr = io[card]; + isa_irq_line = irq[card]; + + request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr"); + + if (!dev) { + dev = init_etherdev(dev, 0 ); + } + dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL ); + memset(dev->priv,0,sizeof(struct awc_private)); + if (!dev->priv) { + printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n"); + return -1; + }; + + // ether_setup(dev); + + // dev->tx_queue_len = tx_queue_len; + + dev->hard_start_xmit = &awc_start_xmit; + // dev->set_config = &awc_config_misiganes,aga mitte awc_config; + dev->get_stats = &awc_get_stats; + // dev->set_multicast_list = &awc_set_multicast_list; + dev->change_mtu = awc_change_mtu; + 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 + 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) ){ + printk("card not found at irq %x mem %x\n",irq[card],io[card]); + if (card==0) + return -1; + break; + } + + i=0; + while (aironet4500_devices[i] && i < MAX_AWCS-1) i++; + if (!aironet4500_devices[i]){ + aironet4500_devices[i]=dev; + ((struct awc_private *) + aironet4500_devices[i]->priv)->card_type = AIRONET4500_ISA; + + if (awc_proc_set_fun) + awc_proc_set_fun(i); + } + + dev->tbusy = 1; + dev->start = 0; + + card++; + } + if (card == 0 ) { + return -ENODEV; + }; + return 0; +} + +#ifdef MODULE +static void awc_isa_release(void) { + +// long flags; + int i=0; + + DEBUG(0, "awc_detach \n"); + + i=0; + while ( i < MAX_AWCS) { + + if (!aironet4500_devices[i]) + {i++; continue;} + if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_ISA) + {i++; continue;} + + if (awc_proc_unset_fun) + awc_proc_unset_fun(i); + release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE); +// release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); +// release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem"); + + 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)); + + aironet4500_devices[i]=0; + + + i++; + } + + +} + +#endif //MODULE + +#endif /* CONFIG_AIRONET4500_ISA */ + +#ifdef CONFIG_AIRONET4500_365 + +#define port_range 0x40 + +int awc_i365_offset_ports[] = {0x3e0,0x3e0,0x3e2,0x3e2}; +int awc_i365_data_ports [] = {0x3e1,0x3e1,0x3e3,0x3e3}; +int awc_i365_irq[] = {5,5,11,12}; +int awc_i365_io[] = {0x140,0x100,0x400,0x440}; +int awc_i365_sockets = 0; + +struct i365_socket { + int offset_port ; + int data_port; + int socket; + int irq; + int io; + int manufacturer; + int product; +}; + +inline u8 i365_in (struct i365_socket * s, int offset) { + outb(offset + (s->socket % 2)* 0x40, s->offset_port); + return inb(s->data_port); +}; + +inline void i365_out (struct i365_socket * s, int offset,int data){ + outb(offset + (s->socket % 2)* 0x40 ,s->offset_port); + outb((data & 0xff),s->data_port) ; + +}; + +void awc_i365_card_release(struct i365_socket * s){ + + i365_out(s, 0x5, 0); // clearing ints + i365_out(s, 0x6, 0x20); // mem 16 bits + i365_out(s, 0x7, 0); // clear IO + i365_out(s, 0x3, 0); // gen ctrl reset + mem mode + i365_out(s, 0x2, 0); // reset power + i365_out(s, 0x2, i365_in(s, 0x2) & 0x7f ); // cardenable off + i365_out(s, 0x2, 0); // remove power + + +}; +int awc_i365_probe_once(struct i365_socket * s ){ + + + int caps=i365_in(s, 0); + int ret; + unsigned long jiff; +// short rev = 0x3000; + unsigned char cis [0x3e3]; + unsigned char * mem = phys_to_virt(0xd000); + int i; + int port ; + + DEBUG(1," i365 control ID %x \n", caps); + + if (caps & 0xC){ + return 1; + }; + + ret = i365_in(s, 0x1); + + if ((ret & 0xC0) != 0xC0){ + printk("card in socket %d port %x not in known state, %x \n", + s->socket, s->offset_port, ret ); + return -1; + }; + + + awc_i365_card_release(s); + + + udelay(100000); + + i365_out(s, 0x2, 0x10 ); // power enable + udelay(200000); + + i365_out(s, 0x2, 0x10 | 0x01 | 0x04 | 0x80); //power enable + + udelay(250000); + + if (!s->irq) + s->irq = 11; + + i365_out(s, 0x3, 0x40 | 0x20 | s->irq); + + jiff = jiffies; + + while (jiffies-jiff < HZ ) + if (i365_in(s,0x1) & 0x20) + break; + + if (! (i365_in(s,0x1) & 0x20) ){ + printk("irq enable timeout on socket %x \n", s->socket); + return -1; + }; + + i365_out(s,0x10,0xd0); + i365_out(s,0x11,0x0); + i365_out(s,0x12,0xd0); + i365_out(s,0x13,0x0); + i365_out(s,0x14,0x30 ); + i365_out(s,0x15,0x3f | 0x40); // enab mem reg bit + i365_out(s,0x06,0x01); // enab mem + + udelay(10000); + + cis[0] = 0x45; + +// memcpy_toio( 0xd3e0, &(cis[0]),0x1); + +// mem[0x3e0] = 0x0; +// mem[0] = 0x45; + + mem[0x3e0] = 0x45; + + udelay(10000); + + memcpy_fromio(cis,0xD000, 0x3e0); + + for (i = 0; i <= 0x3e2; i++) + printk("%02x", mem[i]); + for (i = 0; i <= 0x3e2; i++) + printk("%c", mem[i]); + + i=0; + while (i < 0x3e0){ + if (cis[i] == 0xff) + break; + if (cis[i] != 0x20 ){ + i = i + 2 + cis[i+1]; + continue; + }else { + s->manufacturer = cis[i+2] | (cis[i+3]<<8); + s->product = cis[i+4] | (cis[i+5]<<8); + break; + }; + i++; + }; + + DEBUG(1,"socket %x manufacturer %x product %x \n", + s->socket, s->manufacturer,s->product); + + i365_out(s,0x07, 0x1 | 0x2); // enable io 16bit + udelay(1000); + port = s->io; + i365_out(s,0x08, port & 0xff); + i365_out(s,0x09, (port & 0xff00)/ 0x100); + i365_out(s,0x0A, (port+port_range) & 0xff); + i365_out(s,0x0B, ((port+port_range) & 0xff00) /0x100); + + i365_out(s,0x06, 0x40); // enable io window + + udelay(1000); + + i365_out(s,0x3e0,0x45); + + outw(0x10, s->io); + + jiff = jiffies; + while (!(inw(s->io + 0x30) & 0x10)){ + + if (jiffies - jiff > HZ ){ + + printk("timed out waitin for command ack \n"); + break; + } + }; + + + outw(0x10, s->io + 0x34); + udelay(10000); + + return 0; + + + + +}; + + +static int awc_i365_init(struct i365_socket * s) { + + struct NET_DEVICE * dev; + int i; + + + dev = init_etherdev(0, sizeof(struct awc_private) ); + +// dev->tx_queue_len = tx_queue_len; + ether_setup(dev); + + dev->hard_start_xmit = &awc_start_xmit; +// dev->set_config = &awc_config_misiganes,aga mitte awc_config; + dev->get_stats = &awc_get_stats; + dev->set_multicast_list = &awc_set_multicast_list; + + 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; + + + awc_private_init( dev); + + i=0; + while (aironet4500_devices[i] && i < MAX_AWCS-1) i++; + if (!aironet4500_devices[i]){ + aironet4500_devices[i]=dev; + + ((struct awc_private *) + aironet4500_devices[i]->priv)->card_type = AIRONET4500_365; + + if (awc_proc_set_fun) + 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; + int i=0; + + DEBUG(0, "awc_detach \n"); + + i=0; + while ( i < MAX_AWCS) { + + if (!aironet4500_devices[i]) + {i++; continue;} + + if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_365) + {i++; continue;} + + if (awc_proc_unset_fun) + awc_proc_unset_fun(i); + + unregister_netdev(aironet4500_devices[i]); + + //kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private)); + kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE)); + + aironet4500_devices[i]=0; + + + i++; + } + + +} + + + + + + + +int awc_i365_probe(void) { + + int i = 1; + int k = 0; + int ret = 0; + int found=0; + + struct i365_socket s; + /* Always emit the version, before any failure. */ + + if (!awc_i365_sockets) { + printk(" awc i82635 4x00: use bitfiel opts awc_i365_sockets=0x3 <- (1|2) to probe sockets 0 and 1\n"); + return -1; + }; + + while (k < 4){ + if (i & awc_i365_sockets){ + + s.offset_port = awc_i365_offset_ports[k]; + s.data_port = awc_i365_data_ports[k]; + s.socket = k; + s.manufacturer = 0; + s.product = 0; + s.irq = awc_i365_irq[k]; + s.io = awc_i365_io[k]; + + ret = awc_i365_probe_once(&s); + if (!ret){ + if (awc_i365_init(&s)) + goto failed; + else found++; + } else if (ret == -1) + goto failed; + }; + k++; + i *=2; + }; + + if (!found){ + printk("no aironet 4x00 cards found\n"); + return -1; + } + return 0; + +failed: + awc_i365_release(); + return -1; + + +} + +#endif /* CONFIG_AIRONET4500_365 */ + +#ifdef MODULE +int init_module(void) +{ + int found = 0; + + printk("%s\n ", awc_version); + +#ifdef CONFIG_AIRONET4500_PCI + if (awc4500_pci_probe(NULL) == -ENODEV){ + printk("PCI 4X00 aironet cards not found\n"); + } else { + found++; + printk("PCI 4X00 found some cards \n"); + } +#endif +#ifdef CONFIG_AIRONET4500_PNP + if (awc4500_pnp_probe(NULL) == -ENODEV){ + printk("PNP 4X00 aironet cards not found\n"); + } else { + found++; + printk("PNP 4X00 found some cards \n"); + } +#endif +#ifdef CONFIG_AIRONET4500_365 + if ( awc_i365_probe() == -1) { + printk("PCMCIA 4X00 aironet cards not found for i365(without card services) initialization\n"); + } else { + found++ ; + printk("PCMCIA 4X00 found some cards, take care, this code is not supposed to work yet \n"); + } +#endif +#ifdef CONFIG_AIRONET4500_ISA + if (awc4500_isa_probe(NULL) == -ENODEV){ + printk("ISA 4X00 aironet ISA-bus non-PNP-mode cards not found\n"); + } else { + found++; + printk("ISA 4X00 found some cards \n"); + } +#endif + if (!found) return -1; + return 0; + + +} + +void cleanup_module(void) +{ + DEBUG(0, "awc_cs: unloading %c ",'\n'); +#ifdef CONFIG_AIRONET4500_PCI + awc_pci_release(); +#endif +#ifdef CONFIG_AIRONET4500_PNP + awc_pnp_release(); +#endif +#ifdef CONFIG_AIRONET4500_365 + awc_i365_release(); +#endif +#ifdef CONFIG_AIRONET4500_ISA + awc_isa_release(); +#endif + +} +#endif \ No newline at end of file diff -u --recursive --new-file v2.3.30/linux/drivers/net/aironet4500_core.c linux/drivers/net/aironet4500_core.c --- v2.3.30/linux/drivers/net/aironet4500_core.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/aironet4500_core.c Tue Dec 7 23:58:22 1999 @@ -0,0 +1,3225 @@ +/* + * Aironet 4500 Pcmcia driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "aironet4500.h" + + +int bap_sleep = 10 ; +int bap_sleep_after_setup = 1; +int sleep_before_command = 1; +int bap_sleep_before_write= 1; +int sleep_in_command = 1; + +EXPORT_SYMBOL(bap_sleep); +EXPORT_SYMBOL(bap_sleep_after_setup); +EXPORT_SYMBOL(sleep_before_command); +EXPORT_SYMBOL(bap_sleep_before_write); +EXPORT_SYMBOL(sleep_in_command); + +struct awc_strings awc_status_error_codes[]=awc_reply_error_strings; +struct awc_strings awc_command_names[]=awc_command_name_strings; +struct awc_strings awc_link_status_names[]=awc_link_status_strings; +struct awc_strings awc_rid_names[]=aironet4500_RID_Select_strings; +struct awc_strings awc_link_failure_reason_names[]=IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS; + +const char * awc_print_string( struct awc_strings* strings, int code){ + + struct awc_strings * str = strings; + int i = 0; + while (str[i].string != NULL){ + if (str[i].par == (code & str[i].mask )){ + return str[i].string; + }; + i++; + }; + return "UNKNOWN"; +}; + +int awc_dump_registers(struct NET_DEVICE * dev){ + +#ifdef AWC_DEBUG + int i; +#endif + int status= inw(dev->base_addr +4*2); + int r1= inw(dev->base_addr +5*2); + int r2= inw(dev->base_addr +6*2); + int r3= inw(dev->base_addr +7*2); + + printk(KERN_ERR "Command %s , result: %s, at memblk %x(RID %s) , offset %x \n", + awc_print_string(awc_command_names,status), + awc_print_string(awc_status_error_codes,r1), + r2, awc_print_string(awc_rid_names,r2), + r3); + +#ifdef AWC_DEBUG + printk(KERN_ERR "%s aironet register dump ",dev->name ); + + + for (i=0; i < 32; i++){ + printk("%4x ", inw(dev->base_addr + i*2 ) ); + if ( (i+1)%8 == 0){ + printk("\n"); + printk(KERN_ERR "%02x",(i+1)*2); + } + }; + printk(KERN_ERR " \n"); +#endif + return 0; +}; + +/****************************** COMMAND ******************/ + + +inline +int awc_command_busy_clear_wait(struct NET_DEVICE * dev){ +// long long jiff = jiffies; + u16 active_interrupts; + int cnt= 0; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_command_busy_clear_wait "); + + while (awc_command_busy(dev->base_addr)){ + if (cnt > 1000 ){ + printk(KERN_ERR "awc command busy too long, clearing\n"); + awc_dump_registers(dev); + awc_event_ack_ClrStckCmdBsy(dev->base_addr); + break; + }; + if (((struct awc_private*) dev->priv)->ejected) + return -1; + cnt++; + udelay(10); + } + + cnt = 0; + while (awc_command_busy(dev->base_addr)){ + //if (jiffies - jiff > (HZ/3)){ + if (cnt > 30000 ){ + printk(KERN_CRIT "awc command busy WAY too long, clearing\n"); + awc_dump_registers(dev); + awc_event_ack_ClrStckCmdBsy(dev->base_addr); + active_interrupts = awc_event_status(dev->base_addr); + awc_event_ack(dev->base_addr, active_interrupts); + + AWC_ENTRY_EXIT_DEBUG("BAD exit\n "); + return -1 ; + + }; + if (((struct awc_private*) dev->priv)->ejected) + return -1; + cnt++; + udelay(10); + } + + + AWC_ENTRY_EXIT_DEBUG(" exit\n "); + + return 0; + + +}; + + + +inline unsigned short +awc_issue_command_and_block(struct awc_command * cmd){ + + int ticks; + long long jiff; + u16 enabled_interrupts; + int cnt = 0; +// unsigned long flags; + + jiff = jiffies; + + + AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_and_block "); + + DOWN(&cmd->priv->command_semaphore); + +// save_flags(flags); +// cli(); + + if (awc_command_busy_clear_wait(cmd->dev)) goto final; + + if (cmd->priv->sleeping_bap) udelay(sleep_before_command); + + awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2); +// awc_dump_registers(cmd->dev); + + + if (cmd->priv->sleeping_bap) udelay(sleep_in_command); + + enabled_interrupts = awc_ints_enabled(cmd->dev->base_addr); + awc_ints_enable(cmd->dev->base_addr, enabled_interrupts & ~0x10); + if(cmd->priv->enabled_interrupts & 0x10) + cmd->priv->enabled_interrupts &= ~0x10; + + + while ( awc_command_read(cmd->port) == cmd->command) { + udelay(1); + awc_command_write(cmd->port, cmd->command); + //if ((jiffies - jiff) > 2){ + if (cnt > 2000 ){ + printk(" long wait with commmand reg busy in blocking command \n"); + awc_dump_registers(cmd->dev); + goto final; + }; + if (cmd->priv->ejected) + goto final; + cnt++; + udelay(10); + + }; + AWC_ENTRY_EXIT_DEBUG(" issued " ); + + ticks = 0; + while ( awc_event_status_Cmd(cmd->port) == 0) { + ticks++; + if (ticks > 100000){ + printk(" long wait with commmand reg busy \n"); + awc_dump_registers(cmd->dev); + goto final; + }; + if (ticks > 500){ + DEBUG(1, " long wait after issue 10mks * %d ", ticks ); + //printk(" long wait with command reg busy about ticks\n"); + // sti(); + } + if (cmd->priv->ejected) + goto final; + udelay(10); + } + if (cmd->priv->sleeping_bap) udelay(sleep_in_command); + + awc_read_response(cmd); + AWC_ENTRY_EXIT_DEBUG(" resp read \n"); + + if (awc_command_busy(cmd->port)) + awc_event_ack_ClrStckCmdBsy(cmd->port); + + awc_event_ack_Cmd(cmd->port); + if (cmd->priv->sleeping_bap) udelay(sleep_in_command); + + if (cmd->status & 0xff00){ + printk(KERN_ERR " bad response to command %s, parameter %x \n",awc_print_string(awc_command_names, cmd->command),cmd->par0); + awc_dump_registers(cmd->dev); + goto final; + } + + // restore_flags(flags); + UP(&cmd->priv->command_semaphore); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + udelay(1); + return 0; +final: +// restore_flags(flags); + UP(&cmd->priv->command_semaphore); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +}; + + +inline +unsigned short +awc_issue_command(struct awc_command * cmd){ + + +// long long jiff = jiffies; +// unsigned short enabled_ints; + int cnt = 0; +// int i=0; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command"); + + if (!cmd){ + printk(KERN_CRIT "cmd == NULL in awc_issue_command\n"); + return -1; + + } + if (!cmd->dev){ + printk(KERN_CRIT "cmd->dev == NULL in awc_issue_command\n"); + return -1; + + } + + DOWN(&cmd->priv->command_semaphore); + + if(awc_command_busy_clear_wait(cmd->dev)) goto final; + + if(!cmd->priv->enabled_interrupts & 0x10){ + cmd->priv->enabled_interrupts |= 0x10; + awc_ints_enable(cmd->port, cmd->priv->enabled_interrupts ); + } + + cmd->priv->async_command_start = jiffies; + cmd->priv->command_semaphore_on++; + + + awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2); + + while ( awc_command_read(cmd->port) == cmd->command) { + + awc_command_write(cmd->port, cmd->command); + //if ((jiffies - jiff) > 2){ + if (cnt > 2000) { + printk(" long wait with commmand reg busy in async command \n"); + awc_dump_registers(cmd->dev); + goto final; + }; + if (cmd->priv->ejected) + goto final; + cnt++; + udelay(10); + }; + + cmd->priv->cmd = *cmd; + + + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + UP(&cmd->priv->command_semaphore); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + +}; + +inline +unsigned short +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; + int cnt = 0; + long long jiff; + jiff = jiffies; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_no_ack "); + + + DOWN(&priv->command_semaphore); + + if (awc_command_busy_clear_wait(dev)) { + printk("aironet4x00 no_ack command (reset) with stuck card \n"); + } + + awc4500wout(dev->base_addr,com, par1, par2,par3); + + udelay(10); + while ( awc_event_status_Cmd(dev->base_addr) == 0) { + if (awc_command_read(dev->base_addr) == com) { + awc_command_write(dev->base_addr, com); + } + //if ((jiffies - jiff) > 2){ + if (cnt > 2000) { + printk(" long wait with commmand reg busy in noack command %d par %d %d %d\n",com,par1,par2,par3); + awc_dump_registers(dev); + goto final; + }; + if (priv->ejected) + goto final; + udelay(10); + cnt++; + } + + if (awc_command_busy(dev->base_addr)) + awc_event_ack_ClrStckCmdBsy(dev->base_addr); + + UP(&priv->command_semaphore); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; +final: + UP(&priv->command_semaphore); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +}; + + +/******************************** BAP *************************/ + +inline +int awc_bap_setup(struct awc_command * cmd) { + + int status; + long long jiff; + unsigned long flags; + int cleared = 0; + int cycles = 0; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_setup "); + + if ( cmd->priv->sleeping_bap) + udelay(bap_sleep); + + if (cmd->priv->ejected) + return -1; + + if (!cmd->bap || !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED))) + DEBUG(1,"no bap or bap not locked cmd %d !!", cmd->command); + + + status = AWC_IN(cmd->bap->offset); + + if (status & ~0x2000 ){ + WAIT61x3; + status = AWC_IN(cmd->bap->offset); + } + + if (status & ~0x2000 ){ + WAIT61x3; + AWC_IN(cmd->dev->base_addr + 0x26); + AWC_OUT(cmd->dev->base_addr + 0x26, 0); + WAIT61x3; + udelay(60); + #ifdef AWC_DEBUG + printk("b"); + #endif + status = AWC_IN(cmd->bap->offset); + } + + + if (status & 0xC000){ + printk(KERN_ERR "bap entered with err or busy bit set %x \n",status); + if (cmd->bap->lock != 1) + printk(KERN_ERR "bap lock bad same time %x\n",cmd->bap->lock); + awc_dump_registers(cmd->dev); + // AWC_OUT(cmd->bap->offset, 0x800); + } + +// save_flags(flags); +// cli(); + + AWC_OUT(cmd->bap->select, cmd->rid); + WAIT61x3; + AWC_OUT(cmd->bap->offset, cmd->offset); + +// restore_flags(flags); + + WAIT61x3; + + jiff = jiffies; + + while (1) { + cycles++; + status = AWC_IN(cmd->bap->offset); + if ( cmd->priv->sleeping_bap) + udelay(bap_sleep); + if (cmd->priv->ejected) + return -1; + udelay(1); + if (cycles > 10000) { + printk(KERN_CRIT "deadlock in bap\n"); + return AWC_ERROR; + }; + status = AWC_IN(cmd->bap->offset); + if (status & AWC_BAP_BUSY) { + if (cycles % 100 == 99 ) { + save_flags(flags); + cli(); + if (!cleared){ + AWC_IN(cmd->dev->base_addr + 0x26); + AWC_OUT(cmd->dev->base_addr + 0x26, 0); + WAIT61x3; + cleared = 1; + } + AWC_OUT(cmd->bap->select, cmd->rid); + WAIT61x3; + AWC_OUT(cmd->bap->offset, cmd->offset); + restore_flags(flags); + #ifdef AWC_DEBUG + printk("B"); + #endif + + if ( cmd->priv->sleeping_bap) + udelay(bap_sleep); + else udelay(30); + //restart_timeout(); + } + if (jiffies - jiff > 1 ) { + AWC_ENTRY_EXIT_DEBUG(" BAD BUSY exit \n"); + awc_dump_registers(cmd->dev); + return AWC_ERROR; + } + continue; + } + if (status & AWC_BAP_DONE) { + WAIT61x3; WAIT61x3; WAIT61x3; + + // if ((status & 0xfff) != cmd->offset) + // printk(KERN_ERR "awcPBD %x ",status); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + if (cmd->priv->sleeping_bap) + udelay(bap_sleep_after_setup); + + // success + return AWC_SUCCESS; + } + + if (status & AWC_BAP_ERR) { + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + // invalid rid or offset + printk(KERN_ERR "bap setup error bit set for rid %x offset %x \n",cmd->rid,cmd->offset); + awc_dump_registers(cmd->dev); + return AWC_ERROR; + } + if ( cmd->priv->sleeping_bap) + udelay(bap_sleep); + else udelay(1); + // -- awc missed it, try again + + save_flags(flags); + cli(); + AWC_OUT(cmd->bap->select, cmd->rid); + WAIT61x3; + AWC_OUT(cmd->bap->offset, cmd->offset); + WAIT61x3; + restore_flags(flags); + + if (jiffies - jiff > HZ) + if (! (status &(AWC_BAP_ERR |AWC_BAP_DONE |AWC_BAP_BUSY))){ + printk("aironet4500: bap setup lock without any status bits set"); + awc_dump_registers(cmd->dev); + return AWC_ERROR; + + }; + + } + + AWC_ENTRY_EXIT_DEBUG(" WE MUST NOT BE HERE exit \n"); +} + + + // requires call to awc_bap_setup() first +inline +int +awc_bap_read(struct awc_command * cmd) { + register u16 len; + register u16 * buff = (u16 *) cmd->buff; + register u16 port= cmd->bap->data; + + + AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_read "); + if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED))) + DEBUG(0,"no bap or bap not locked %d !!", cmd->command); + cmd->len = (cmd->len + 1) & (~1); // round up to even value + len = cmd->len / 2; + if (cmd->priv->ejected) + return -1; + + + if (cmd->priv->sleeping_bap) + udelay(bap_sleep_before_write); + + if (!cmd->priv->sleeping_bap) + while ( len-- > 0) + *buff++ = AWC_IN(port); + else + while ( len-- > 0){ + *buff++ = AWC_IN(port); + } + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + if (cmd->priv->ejected) + return -1; + + return AWC_SUCCESS; +} + + // requires call to awc_bap_setup() first +inline +int +awc_bap_write(struct awc_command * cmd){ + register u16 len; + register u16 * buff = (u16 *) cmd->buff; + register u16 port= cmd->bap->data; + + + AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_write "); + if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED))) + DEBUG(0,"no bap or bap not locked %d !!", cmd->command); + + cmd->len = (cmd->len + 1) & (~1); // round up to even value + len = cmd->len / 2; + + if (cmd->priv->ejected) + return -1; + + if (cmd->priv->sleeping_bap) + udelay(bap_sleep_before_write); + + + if (!cmd->priv->sleeping_bap) + while (len-- > 0) + AWC_OUT(port, *buff++); + else + while ( len-- > 0){ + AWC_OUT(port, *buff++); + } + if (cmd->priv->ejected) + return -1; + + + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + + return AWC_SUCCESS; +} + + + + +/***************************** RID READ/WRITE ********************/ + +const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config =(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; // See notes General Configuration Many configuration items. +const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list =(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; // See notes Valid SSID list List of SSIDs which the station may associate to. +const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list =(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; // See notes Valid AP list List of APs which the station may associate to. +const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name =(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; // See notes Driver name The name and version of the driver (for debugging) +const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation =(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; // See notes Ethernet Protocol Rules for encapsulating ethernet payloads onto 802.11. +const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile =(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile =(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation =(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config =(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; // Read only Actual Configuration This has the same format as the General Configuration. +const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities =(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; // Read Only Capabilities PC4500 Information +const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info =(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; // Read Only AP Info Access Point Information +const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info =(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; // Read Only Radio Info Radio Information -- note radio specific +const struct aironet4500_rid_selector aironet4500_RID_Select_Status =(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; // Read Only Status PC4500 Current Status Information +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats =(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; // Read Only 16-bit Statistics Cumulative 16-bit Statistics +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta =(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; // Read Only 16-bit Statistics Delta 16-bit Statistics (since last clear) +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear =(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; // Read Only / 16-bit Statistics Delta 16-bit Statistics and Clear +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats =(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; // Read Only 32-bit Statistics Cumulative 32-bit Statistics +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta =(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics" }; // Read Only 32-bit Statistics Delta 32-bit Statistics (since last clear) +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear =(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; // Read Only / 32-bit Statistics Delta 32-bit Statistics and Clear + +EXPORT_SYMBOL(aironet4500_RID_Select_General_Config); +EXPORT_SYMBOL(aironet4500_RID_Select_SSID_list); +EXPORT_SYMBOL(aironet4500_RID_Select_AP_list); +EXPORT_SYMBOL(aironet4500_RID_Select_Driver_name); +EXPORT_SYMBOL(aironet4500_RID_Select_Encapsulation); +EXPORT_SYMBOL(aironet4500_RID_Select_WEP_volatile); +EXPORT_SYMBOL(aironet4500_RID_Select_WEP_nonvolatile); +EXPORT_SYMBOL(aironet4500_RID_Select_Modulation); +EXPORT_SYMBOL(aironet4500_RID_Select_Active_Config); +EXPORT_SYMBOL(aironet4500_RID_Select_Capabilities); +EXPORT_SYMBOL(aironet4500_RID_Select_AP_Info); +EXPORT_SYMBOL(aironet4500_RID_Select_Radio_Info); +EXPORT_SYMBOL(aironet4500_RID_Select_Status); +EXPORT_SYMBOL(aironet4500_RID_Select_16_stats); +EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_delta); +EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_clear); +EXPORT_SYMBOL(aironet4500_RID_Select_32_stats); +EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_delta); +EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_clear); + + +struct awc_rid_dir awc_rids_temp[]={ + // following MUST be consistent with awc_rids_setup !!! + {&aironet4500_RID_Select_General_Config, 0x100 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_SSID_list, 0x68 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_AP_list, 0x20 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Driver_name, 0x12 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Encapsulation, 0x22 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Active_Config, 0x100 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Capabilities, 0x80 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Status, 0x6c , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_AP_Info, 0x06 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats, 0x184 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats_delta, 0x184 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats_clear, 0x184 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_WEP_volatile, 0x1c , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_WEP_nonvolatile, 0x1c , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_Modulation, 0x04 , NULL, NULL, NULL,0 }, + +#ifdef AWC_USE_16BIT_STATS + {&aironet4500_RID_Select_16_stats, 0xC2 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_16_stats_delta, 0xC2 , NULL, NULL, NULL,0 }, + {&aironet4500_RID_Select_16_stats_clear, 0xC2 , NULL, NULL, NULL,0 }, +#else + {NULL},{NULL},{NULL}, +#endif + + {0} + + +}; + + + +int +awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){ + struct awc_command cmd; + + int sleep_state ; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_readrid "); + if (!rid) return -1; + if (!rid->selector) return -1; + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector, + rid->selector->selector, rid->offset, (rid->bits / 8),pBuf); + + sleep_state = cmd.priv->sleeping_bap ; + cmd.priv->sleeping_bap = 1; + udelay(500); + if (awc_issue_command_and_block(&cmd)) goto final; + AWC_BAP_LOCK_NOT_CLI(cmd); + udelay(1); + if (awc_bap_setup(&cmd)) goto final; + udelay(1); + if (awc_bap_read(&cmd)) goto final; + cmd.priv->sleeping_bap = sleep_state; + AWC_BAP_UNLOCK(cmd); + + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + cmd.priv->sleeping_bap = sleep_state; + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + +int +awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){ + + struct awc_command cmd; + int sleep_state ; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid "); + + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector, + rid->selector->selector,rid->offset, rid->bits/8,pBuf); + + sleep_state = cmd.priv->sleeping_bap ; + cmd.priv->sleeping_bap = 1; + + udelay(500); + AWC_BAP_LOCK_NOT_CLI(cmd); + if (awc_issue_command_and_block(&cmd)) goto final; + udelay(10); + if (awc_bap_setup(&cmd)) goto final; + udelay(10); + if (awc_bap_write(&cmd)) goto final; + udelay(10); + cmd.command=0x121; + if (awc_issue_command_and_block(&cmd)) goto final; + AWC_BAP_UNLOCK(cmd); + cmd.priv->sleeping_bap = sleep_state; + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + cmd.priv->sleeping_bap = sleep_state; + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + +int +awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){ + struct awc_command cmd; + int sleep_state; + + AWC_ENTRY_EXIT_DEBUG(" entry awcreadrid_dir "); + + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector, + rid->selector->selector,0, rid->bufflen,rid->buff); + + sleep_state = cmd.priv->sleeping_bap ; + cmd.priv->sleeping_bap = 1; + + udelay(500); + if (awc_issue_command_and_block(&cmd)) goto final; + + AWC_BAP_LOCK_NOT_CLI(cmd); + + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_read(&cmd)) goto final; + cmd.priv->sleeping_bap = sleep_state; + AWC_BAP_UNLOCK(cmd); + + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + cmd.priv->sleeping_bap = sleep_state; + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + +int +awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid){ + + struct awc_command cmd; + int sleep_state ; + + + AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid_dir "); + + + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector, + rid->selector->selector,0, rid->bufflen,((char *)rid->buff)); + + sleep_state = cmd.priv->sleeping_bap ; + cmd.priv->sleeping_bap = 1; + + udelay(500); + if (awc_issue_command_and_block(&cmd)) goto final; + + AWC_BAP_LOCK_NOT_CLI(cmd); + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_write(&cmd)) goto final; + cmd.priv->sleeping_bap = sleep_state; + AWC_BAP_UNLOCK(cmd); + + cmd.command=0x121; + udelay(500); + if (awc_issue_command_and_block(&cmd)) goto final; + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + cmd.priv->sleeping_bap = sleep_state; + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + +EXPORT_SYMBOL(awc_readrid); +EXPORT_SYMBOL(awc_writerid); +EXPORT_SYMBOL(awc_readrid_dir); +EXPORT_SYMBOL(awc_writerid_dir); + +/***************************** STARTUP *******************/ + + +inline +int +awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){ + + struct awc_command cmd; +// struct awc_private * priv = (struct awc_private *)dev->priv; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_blocking_command "); + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,comm,0, 0, 0, 0 ,0 ); + + if (awc_issue_command_and_block(&cmd)) + goto final; + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + +}; + +int +awc_issue_soft_reset(struct NET_DEVICE * dev){ + + u16 status ; +// int i= 0; + +/* outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x32); + udelay(10); + outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x34); + + for (i=0; i< 32; i++) + outw(0,dev->base_addr + i*2); + udelay(100); + outw(0x6,dev->base_addr + 0x34); + udelay(100); + outw(0x6,dev->base_addr + 0x34); + outw(0x6,dev->base_addr + 0x34); + WAIT61x3; + AWC_IN(dev->base_addr + 0x26); + AWC_OUT(dev->base_addr + 0x26, 0); + WAIT61x3; + udelay(60); + + + outw(0x4, dev->base_addr); + udelay(1000); + WAIT61x3; + AWC_IN(dev->base_addr + 0x26); + AWC_OUT(dev->base_addr + 0x26, 0); + WAIT61x3; + udelay(60); +*/ + + status = awc_issue_command_no_ack(dev, AWC_COMMAND_SOFT_RESET,0,0,0); + +// awc_command_busy_clear_wait(dev); + + return status; +}; + +int +awc_issue_noop(struct NET_DEVICE * dev){ + int retval; + AWC_OUT(dev->base_addr + 0x28, 0); + AWC_OUT(dev->base_addr + 0x2A, 0); + udelay(1000); + retval= awc_issue_blocking_command(dev, AWC_COMMAND_NOOP); + udelay(1000); + return retval; +}; + +EXPORT_SYMBOL(awc_enable_MAC); + +int +awc_enable_MAC(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC "); + + if (priv->mac_enabled){ + + AWC_ENTRY_EXIT_DEBUG(" mac already enabled exit \n"); + return 0; + } + udelay(500); + if (awc_issue_blocking_command(dev, AWC_COMMAND_ENABLE)){ + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + } + udelay(500); + + priv->mac_enabled = 1; + + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; +}; + +EXPORT_SYMBOL(awc_disable_MAC); +int +awc_disable_MAC(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC "); + + if (!priv->mac_enabled){ + AWC_ENTRY_EXIT_DEBUG(" mac allready disabled exit \n"); + return 0; + } + udelay(1000); + if (awc_issue_blocking_command(dev, AWC_COMMAND_DISABLE)){ + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + } + udelay(1000); + priv->mac_enabled = 0; + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; +}; + + + +int +awc_read_all_rids(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + int status,i; + AWC_ENTRY_EXIT_DEBUG(" entry awc_read_all_rids "); + + for (i=0; i< AWC_NOF_RIDS && priv->rid_dir[i].selector ; i++){ + status = awc_readrid_dir(dev,&priv->rid_dir[i]); + udelay(50); + if (status) return status; + + } + priv->rids_read = 1; + + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; +} + +int +awc_write_all_rids(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + int i,status ; + AWC_ENTRY_EXIT_DEBUG(" entry awc_write_all_rids "); + + for (i=0;i < 5 && i< AWC_NOF_RIDS && priv->rid_dir[i].selector ; i++){ + status = awc_writerid_dir(dev,&priv->rid_dir[i]); + udelay(10); + if(status) return status; + } + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; +} + +/************************** FID QUEUES ****************************/ +/**************************** TX ALLOC / DEALLOC ***************/ + + + +int awc_tx_alloc(struct NET_DEVICE * dev) { + + struct awc_command cmd; + int k=0; + int tot=0; + struct awc_fid * fid = NULL; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_alloc "); + + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0A,0, 0,0,0,NULL); + cmd.par0 = dev->mtu + AWC_TX_HEAD_SIZE + 8 ; + + DEBUG(32,"about to allocate %x bytes ",cmd.priv->large_buff_mem); + DEBUG(32,"in %x large buffers ",cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) ); + + k=0;tot=0; + while (k < cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) ) { + + fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL ); + if (!fid) goto final; + memset(fid, 0, sizeof(struct awc_fid)); + + if (awc_issue_command_and_block(&cmd)) goto final; + + while ( awc_event_status_Alloc(cmd.port) == 0) ; + fid->u.tx.fid = awc_Tx_Allocated_Fid(cmd.port); + fid->u.tx.fid_size = dev->mtu + AWC_TX_HEAD_SIZE ; + + DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid); + if(fid->u.tx.fid == 0 + || cmd.status != 0xA){ + printk(KERN_ERR "%s bad tx_alloc\n",dev->name); + fid->busy =1; + goto final; + } else { + fid->busy =0; + tot++; + } + awc_event_ack_Alloc(cmd.port); + + // shoudlnt goto final after that + awc_fid_queue_push_tail(&cmd.priv->tx_large_ready,fid); + + k++; + } + cmd.priv->tx_buffs_total = tot; + DEBUG(32,"allocated %d large tx buffs\n",tot); + + cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ; + k =0; tot = 0; + + while (k < cmd.priv->small_buff_no) { + + fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL ); + if (!fid) goto final; + memset(fid, 0, sizeof(struct awc_fid)); + + cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ; + + if (awc_issue_command_and_block(&cmd)) goto final; + + while ( awc_event_status_Alloc(cmd.port) == 0) ; + fid->u.tx.fid = awc_Tx_Allocated_Fid(cmd.port); + fid->u.tx.fid_size = AWC_TX_ALLOC_SMALL_SIZE; + + DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid); + if(fid->u.tx.fid == 0 + || cmd.status != 0xA){ + printk(KERN_ERR "%s bad tx_alloc\n",dev->name); + fid->busy =1; + goto final; + } else { + fid->busy =0; + tot++; + } + awc_event_ack_Alloc(cmd.port); + + // shoudlnt goto final after that + awc_fid_queue_push_tail(&cmd.priv->tx_small_ready,fid); + + k++; + } + + cmd.priv->tx_small_buffs_total = tot; + DEBUG(32,"allocated %d small tx buffs\n",tot); + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + + final: + if (fid ) + kfree(fid); + printk(KERN_CRIT "%s awc tx prealloc failed \n",dev->name); + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + +}; + +int +awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){ + + struct awc_command cmd; + int fid_handle = 0; + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0C,0, 0,0,0,NULL); + + if (fid->u.tx.fid){ + fid_handle = cmd.par0 = fid->u.tx.fid; + fid->u.tx.fid = 0; + fid->busy =0; + kfree(fid); + + if (!cmd.priv->ejected) + if (awc_issue_command_and_block(&cmd)) goto final; + //awc_event_ack_Alloc(cmd.port); + } + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + + final: + printk(KERN_ERR "awc_tx_dealloc failed for fid %x \n",fid_handle); + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + + +}; + +int +awc_tx_dealloc(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + + + +// int k=0; + struct awc_fid * fid; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_dealloc "); + + while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_large_ready))) + awc_tx_dealloc_fid(dev,fid); + while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_small_ready))) + awc_tx_dealloc_fid(dev,fid); + while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_post_process))) + awc_tx_dealloc_fid(dev,fid); + while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_in_transmit))) + awc_tx_dealloc_fid(dev,fid); + + return 0; + +}; + + + +inline struct awc_fid * +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; + unsigned long flags; + struct awc_fid * fid = NULL; + int cnt=0; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_fid_lookup "); + + my_spin_lock_irqsave(&(priv->queues_lock),flags); + + + fid = priv->tx_in_transmit.head; + cnt = 0; + while (fid){ + if (fid->u.tx.fid == fid_handle){ + awc_fid_queue_remove(&priv->tx_in_transmit, fid); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return fid; + } + fid = fid->next; + // printk("iT\n"); + if (cnt++ > 200) { + // printk("bbb in awc_fid_queue\n"); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return 0; + }; + }; + + cnt=0; + fid = priv->tx_post_process.head; + while (fid){ + if (fid->u.tx.fid == fid_handle){ + awc_fid_queue_remove(&priv->tx_post_process, fid); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return fid; + } + fid = fid->next; + // printk("pp\n"); + if (cnt++ > 200) { + // printk("bbb in awc_fid_queue\n"); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return 0; + }; + + }; + + cnt=0; + fid = priv->tx_large_ready.head; + while (fid){ + if (fid->u.tx.fid == fid_handle){ + awc_fid_queue_remove(&priv->tx_large_ready, fid); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return fid; + } + fid = fid->next; + // printk("lr\n"); + if (cnt++ > 200) { + // printk("bbb in awc_fid_queue\n"); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return 0; + }; + + }; + cnt=0; + fid = priv->tx_small_ready.head; + while (fid){ + if (fid->u.tx.fid == fid_handle){ + awc_fid_queue_remove(&priv->tx_small_ready, fid); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return fid; + } + fid = fid->next; + // printk("sr\n"); + if (cnt++ > 200) { + // printk("bbb in awc_fid_queue\n"); + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + return 0; + }; + + }; + + my_spin_unlock_irqrestore(&(priv->queues_lock),flags); + + printk(KERN_ERR "%s tx fid %x not found \n",dev->name, fid_handle); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return NULL; +} + + + + + +int +awc_queues_init(struct NET_DEVICE * dev){ + struct awc_private * priv = (struct awc_private *)dev->priv; + struct awc_fid * fid = NULL; + int retv =0; + int k = 0; + + awc_fid_queue_init(&priv->tx_in_transmit); + awc_fid_queue_init(&priv->tx_post_process); + awc_fid_queue_init(&priv->tx_large_ready); + awc_fid_queue_init(&priv->tx_small_ready); + awc_fid_queue_init(&priv->rx_ready); + awc_fid_queue_init(&priv->rx_post_process); + + retv = awc_tx_alloc(dev); + + k = 0; + while (k < AWC_RX_BUFFS){ + fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL); + if (!fid) return -1; + awc_fid_queue_push_tail(&priv->rx_ready,fid); + k++; + }; + + if (retv) return retv; + + return 0; +}; + + +int +awc_queues_destroy(struct NET_DEVICE * dev){ + struct awc_private * priv = (struct awc_private *)dev->priv; + struct awc_fid * fid = NULL; + int retv =0; + + + + while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_ready))){ + kfree(fid); + } + while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_post_process))){ + kfree(fid); + } + + retv = awc_tx_dealloc(dev); + + return retv; +}; + + + +/****************************** 802.11router ******************/ +inline int +awc_802_11_copy_path_skb(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_copy_path_skb"); + + if (rx_buff->pkt_len < 22 ) rx_buff->pkt_len = 22; + +// if (!rx_buff->skb) + rx_buff->skb = dev_alloc_skb(rx_buff->pkt_len + 12 +2); + + + if (rx_buff->skb == NULL) { + printk(KERN_CRIT "couldnt alloc rx_buff->skb in rx event \n"); + priv->stats.rx_dropped++; + return -1; + } + rx_buff->type |= p80211copy_path_skb; + + rx_buff->skb->dev = dev; + +// skb_reserve(rx_buff->skb, rx_buff->pkt_len + 12 ); + + rx_buff->u.rx.payload = skb_put(rx_buff->skb, rx_buff->pkt_len + 12 ) ; + rx_buff->u.rx.payload = ((char *)rx_buff->u.rx.payload ) +12; + + AWC_ENTRY_EXIT_DEBUG("exit\n"); + + return 0; + + +}; + + +int +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; +// int i = 0; + + rx_buff->type =0; + + return awc_802_11_copy_path_skb(dev,rx_buff); +}; + + +/* called from INTERRUPT context, + + must deliver the packet to where it was meant by + awc_802_11_find_copy_path + + SHOULD be efficient and + queue the packet if operations take longer + +*/ + + +int parse_not_8023= 0; + +void +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; + u8 * payload = rx_buff->u.rx.payload; +// u8 * p802_3_macs_place = payload -12; + u16 pkt_len = rx_buff->pkt_len; + struct ieee_802_11_802_1H_header * bridge = NULL; + struct ieee_802_11_snap_header * snap = NULL; + struct ieee_802_11_802_1H_header * bridge_tmp; + struct ieee_802_11_snap_header * snap_tmp; + + u16 ptr = 0; + u16 len; + + AWC_ENTRY_EXIT_DEBUG("awc_802_11_router_rx"); + +// if (rx_buff->type & p80211_8023) + rx_buff->mac = rx_buff->u.rx.ieee_802_3.dst_mac; +// else +// rx_buff->mac = rx_buff->u.rx.ieee_802_11.mac1; + + if ( rx_buff->u.rx.ieee_802_11.frame_control == 0x8 ) + memcpy(priv->bssid,rx_buff->u.rx.ieee_802_11.mac3,6); + + while ((ptr < pkt_len - 1 ) && payload && parse_not_8023){ + + bridge_tmp = (struct ieee_802_11_802_1H_header*) &payload[ptr]; + snap_tmp = (struct ieee_802_11_snap_header*) &payload[ptr]; + len = ntohs( *((u16*)&payload[ptr]) ); + + + + if ( len < 0x5DC) { // not a protocol + + if ( len != pkt_len-2 - ptr){ + printk(KERN_ERR "%s bad encapsulation lenght %x at pkt offset %x \n",dev->name,len,ptr); + goto bad_packet; + } + DEBUG(1,"parisng packet of size %x\n",len); + ptr +=2; + continue; + } + + DEBUG(1,"parisng packet of proto %x\n",len); + + if (snap_tmp->dsap == 0xaa && snap_tmp->ssap == 0xaa && + pkt_len - ptr > sizeof(struct ieee_802_11_snap_header) ){ + + DEBUG(0x200,"%s SNAP ",dev->name); + if (snap_tmp->ctrl != 0x03){ + printk(KERN_ERR "%s unknown snap ctrl %x \n",dev->name,snap_tmp->ctrl); + goto bad_packet; + }; + if (snap_tmp->oui[0] == 0 && // LLC RFC1042 + snap_tmp->oui[1] == 0 && + snap_tmp->oui[2] == 0 ){ + snap = snap_tmp; + ptr += sizeof(struct ieee_802_11_snap_header); + DEBUG(0x200,"%s LLC RFC1042 \n",dev->name); + continue; + } + if (snap_tmp->oui[0] == 0 && // LLC 802.1H + snap_tmp->oui[1] == 0 && + snap_tmp->oui[2] == 0x78){ + snap = snap_tmp; + DEBUG(0x200,"%s LLC 802.1H \n",dev->name); + ptr += sizeof(struct ieee_802_11_snap_header); + continue; + }; + if (snap_tmp->oui[0] == 0x00 && // 802.1H itself + snap_tmp->oui[1] == 0x40 && + snap_tmp->oui[2] == 0x96){ + ptr += sizeof(struct ieee_802_11_802_1H_header); + if (ptr >= pkt_len){ + goto bad_packet; + DEBUG(1,"%s invalid packet len in 802.1H SNAP OUI check \n",dev->name); + } + DEBUG(0x200,"%s OUI 004096 \n",dev->name); + DEBUG(0x200," 802.1H uknown1 %x ",ntohs(bridge_tmp->unknown1)); + DEBUG(0x200," 802.1H uknw type %x \n",0xf000 & ntohs(bridge_tmp->unknown2)); + DEBUG(0x200," 802.1H payloadsize %x \n",0x0fff & ntohs(bridge_tmp->unknown2)); + + //goto bad_packet; // TODO + + bridge = bridge_tmp; + if (bridge_tmp->unknown1 == 0x0000 && + ((ntohs(bridge_tmp->unknown2) & 0xf000) == 0x1000 ) ){ + rx_buff->type |= p80211_8021H; + rx_buff->mac = &payload[ptr]; + DEBUG(0x200," 802.1H DATA packet of size %x\n",0xf000 & ntohs(bridge_tmp->unknown2) ); + memcpy(priv->p2p,rx_buff->u.rx.ieee_802_11.mac2, 6); + ptr +=12; + continue; + }; + DEBUG(0x200,"%s droping unknown 004096 packet \n ",dev->name); + goto bad_packet; + + + } + goto bad_packet; + } + if ( len > 0x5DC){ + // packet without linklevel header for us + + if ( len == 0x8000 || len == 0x8006){ + + DEBUG(0x200,"Non IP packet %x \n",ntohs(len)); + + }; + goto good_packet; + + }; + + goto good_packet; + } + + good_packet: + + if (ptr > pkt_len) goto bad_packet; + + if ( rx_buff->mac != (payload + ptr -12) ) + memcpy( payload +ptr -12, rx_buff->mac , 12); + + + + if (!payload || !skb || !rx_buff->skb || !rx_buff->u.rx.payload) + return ; + //skb->ip_summed = CHECKSUM_NONE; + skb->data = payload + ptr -12; + skb->len += ptr ; + + rx_buff->skb->protocol = eth_type_trans(rx_buff->skb,dev); + DEBUG(0x200,"eth_type_trans decided: %x\n",rx_buff->skb->protocol); + rx_buff->skb = NULL; + rx_buff->u.rx.payload = NULL; + priv->stats.rx_packets++; + netif_rx(skb); + AWC_ENTRY_EXIT_DEBUG("exit\n"); + return ; + + bad_packet: + 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); + rx_buff->skb = NULL; + rx_buff->u.rx.payload = NULL; + }; + + AWC_ENTRY_EXIT_DEBUG("exit\n"); + +}; + +void +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); + rx_buff->skb = NULL; + rx_buff->u.rx.payload = NULL; + priv->stats.rx_errors++; + + + AWC_ENTRY_EXIT_DEBUG("exit\n"); +}; + +/* + called from kernel->driver tx routine + must decide where and how to post the packet + must post the packet to wherever it decides + either copy to card or enqueue to destination queue + +*/ + + +int +awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, + struct sk_buff * skb){ + + + struct awc_private * priv = (struct awc_private * )dev->priv; + int i; + int len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* check min length*/ + struct awc_fid * fid = NULL; +// u16 saved_fid ; + u16 p2p_direct =priv->p2p_found; +// struct iphdr * ip_hdr; + //buffer = skb->data; + + AWC_ENTRY_EXIT_DEBUG("awc_802_11_tx_find_path_and_post"); + + DOWN(&priv->tx_buff_semaphore); + if (len > dev->mtu + 16 ) { + printk(KERN_ERR "%s packet size too large %d \n",dev->name, len); + goto final; + } + + if (len + AWC_TX_HEAD_SIZE < AWC_TX_ALLOC_SMALL_SIZE ) + fid = awc_fid_queue_pop_head(&priv->tx_small_ready); + + if (!fid) + fid = awc_fid_queue_pop_head(&priv->tx_large_ready); + + if (!fid) { + DEBUG(32,"%s buffs in use \n",dev->name); + goto no_space; + } +/* + if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE){ + awc_fid_queue_push_tail(&priv->tx_small_ready, fid); + fid = awc_fid_queue_pop_head(&priv->tx_large_ready); + } +*/ + if (!fid) { + DEBUG(32,"%s buffs in use \n",dev->name); + goto no_space; + } + + if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE - 14){ + printk(KERN_ERR "found too small tx fid size %d, pktlen %d \n",fid->u.tx.fid_size, len); + } + memset(&fid->u.tx.radio_tx, 0,sizeof(struct aironet4500_radio_tx_header)); + memset(&fid->u.tx.ieee_802_11, 0,sizeof(struct ieee_802_11_header)); + memset(&fid->u.tx.ieee_802_3, 0,sizeof(struct ieee_802_3_header)); + fid->u.tx.payload =NULL; + fid->u.tx.gap_length =0; + fid->busy = 1; + + + priv->tx_buffs_in_use++; + DEBUG(32,"found large buff %x \n",fid->u.tx.fid); + +/* + fid->type |= p80211_llc_snap; + fid->snap.dsap = 0xaa; + fid->snap.ssap = 0xaa; + fid->snap.ctrl = 0x03; + fid->snap.oui[0] = 0x0; + fid->snap.oui[1] = 0x0; + fid->snap.oui[2] = 0x0; +*/ + fid->skb = skb; + + + if (priv->p2p_uc && !priv->p2p_found){ // we go without encapsulation to neighbour; + + for (i=0; i < 6; i++) + if (priv->p2p[i] != skb->data[i]){ + p2p_direct = 1; + break; + } + }; + + if (tx_rate == 2 || tx_rate == 4 || tx_rate== 20 || tx_rate == 22) + fid->u.tx.radio_tx.tx_bit_rate = tx_rate; + fid->u.tx.radio_tx.TX_Control = + aironet4500_tx_control_tx_ok_event_enable | + aironet4500_tx_control_tx_fail_event_enable | + aironet4500_tx_control_no_release; + +/* if (len < 100){ + fid->u.tx.radio_tx.TX_Control |= + aironet4500_tx_control_use_rts; + }; +*/ +/* ip_hdr = skb->data + 14; + if (ip_hdr && skb->data[12] == 0x80 ){ + if (ip_hdr->tos & IPTOS_RELIABILITY) + fid->u.tx.radio_tx.TX_Control |= + aironet4500_tx_control_use_rts; + if (ip_hdr->tos & IPTOS_THROUGHPUT) + fid->u.tx.radio_tx.TX_Control |= + aironet4500_tx_control_no_retries; + }; +*/ + if (priv->p802_11_send || memcmp(dev->dev_addr, skb->data +6, 6) ){ + fid->u.tx.radio_tx.TX_Control |= + aironet4500_tx_control_header_type_802_11; + DEBUG(0x200,"%s bridging, forcing 802_11 send \n ",dev->name); + } + + + if (!priv->p2p_uc || p2p_direct) { + if ((fid->u.tx.radio_tx.TX_Control & + aironet4500_tx_control_header_type_802_11 )){ + + // including 802.3 header into 802.11 packet + fid->u.tx.radio_tx.PayloadLength = len -12; + fid->u.tx.ieee_802_3.payload_length = len -12 ; + fid->pkt_len = len -12; + fid->u.tx.payload = skb->data +12; + + if (!memcmp(dev->dev_addr, skb->data +6, 6)){ + memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6); + memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6); + memcpy(fid->u.tx.ieee_802_11.mac3,priv->status.CurrentBssid ,6); + memset(fid->u.tx.ieee_802_11.mac4,0,6); + fid->u.tx.ieee_802_11.frame_control = 0x8; + fid->u.tx.ieee_802_11.gapLen=6; + } else { + + memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6); + memcpy(fid->u.tx.ieee_802_11.mac2,dev->dev_addr,6); + memcpy(fid->u.tx.ieee_802_11.mac3,skb->data +6 ,6); + memset(fid->u.tx.ieee_802_11.mac4,0 ,6); + fid->u.tx.ieee_802_11.frame_control = 0x108; + fid->u.tx.ieee_802_11.gapLen=6; + + } + } else { // plain old 802.3, with hdr copied + fid->u.tx.radio_tx.PayloadLength = len -12; + fid->u.tx.ieee_802_3.payload_length = len -12; + fid->pkt_len = len - 12; + fid->u.tx.payload = skb->data +12; + }; + memcpy(fid->u.tx.ieee_802_3.dst_mac,skb->data, 12); + DEBUG(0x200,"%s tx simply 802.3 type \n ",dev->name); + + } else {// 802.1H bridgeing + fid->type |= p80211_8021H; + fid->bridge_size = len + sizeof(fid->bridge) ; + fid->bridge.dsap = 0xaa; + fid->bridge.ssap = 0xaa; + fid->bridge.ctrl = 0x03; + fid->bridge.oui[0] = 0x0; + fid->bridge.oui[1] = 0x40; + fid->bridge.oui[2] = 0x96; + fid->bridge.unknown1= 0x0000; + fid->bridge.unknown2= htons((len) & 0x1000); + fid->u.tx.radio_tx.PayloadLength = fid->bridge_size + 2; + fid->u.tx.ieee_802_3.payload_length = fid->u.tx.radio_tx.PayloadLength ; + + + fid->u.tx.payload = skb->data +12; + if ((fid->u.tx.radio_tx.TX_Control & + aironet4500_tx_control_header_type_802_11 )){ + + memcpy(fid->u.tx.ieee_802_11.mac1,priv->p2p,6); + memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6); + memcpy(fid->u.tx.ieee_802_11.mac3,priv->bssid ,6); + memset(fid->u.tx.ieee_802_11.mac4,0,6); + fid->u.tx.ieee_802_11.gapLen=6; + + fid->u.tx.ieee_802_11.frame_control = 0x8; + } + memcpy(fid->u.tx.ieee_802_3.dst_mac,priv->p2p, 6); + memcpy(fid->u.tx.ieee_802_3.src_mac,dev->dev_addr, 6); + fid->u.tx.payload = skb->data + 2 + sizeof(fid->bridge); + fid->pkt_len = len ; + + DEBUG(0x200,"%s tx simply 802.1H type \n ",dev->name); + + }; + + + + awc_fid_queue_push_tail(&priv->tx_in_transmit,fid); + 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; + + + no_space: + DEBUG(32,"%s tx buffs not found \n ",dev->name); + #ifdef AWC_DEBUG +// printk("s"); + #endif + dev->tbusy = 1; //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"); + return 1 ; + final: + priv->stats.tx_errors++; + UP(&priv->tx_buff_semaphore); + dev->tbusy = 0; + FREE_SKB(skb); + mark_bh(NET_BH); + AWC_ENTRY_EXIT_DEBUG("BADExit\n"); + return -1; + +}; + +/* + called from low level driver->card tx copy routine + probably wants to free skbuf if failed transmits won't be + resubmitted to another device (if more than one path) + or tried again (if tx buffer in card needs to be filled again) +*/ + + +void +awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, + struct awc_fid * tx_buff){ + + + AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_packet_to_card_write"); + + if (!tx_buff){ + DEBUG(1,"%s no damn tx_buff in awc_802_11_after_tx_packet_to_card_write \n",dev->name); + }; + + if(tx_buff->skb){ + FREE_SKB(tx_buff->skb); + tx_buff->skb = NULL; + } + mark_bh(NET_BH); + + AWC_ENTRY_EXIT_DEBUG("exit\n"); +}; + +/* + called from low level driver->card tx copy routine + probably wants to free skbuf if failed writes won't be + resubmitted to another device (if more than one path) + or tried again (if tx buffer in card needs to be filled again) +*/ + +void +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; + + + AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_failed_tx_packet_to_card_write"); + + if (!tx_buff){ + DEBUG(1,"%s no damn tx_buff in awc_802_11_after_failed_tx_packet_to_card_write \n",dev->name); + }; + + if(tx_buff->skb){ + FREE_SKB(tx_buff->skb); + tx_buff->skb = NULL; + tx_buff->busy =0; + printk(KERN_ERR "%s packet to card write failed \n",dev->name); + } + + awc_fid_queue_remove(&priv->tx_in_transmit,tx_buff); + + if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE) + awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff); + else + awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff); + + AWC_ENTRY_EXIT_DEBUG("exit\n"); + +}; + +void +awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + + AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_complete"); + + DEBUG(32,"tx complete status %x \n ",tx_buff->u.tx.radio_tx.Status); + + #ifdef AWC_DEBUG + if (tx_buff->u.tx.radio_tx.Status) + printk("tf%x ",tx_buff->u.tx.radio_tx.Status); + #endif + if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE){ + awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff); + priv->tx_small_buffs_in_use--; + } else { + awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff); + priv->tx_buffs_in_use--; + } + + tx_buff->busy = 0; + dev->tbusy = 0; + mark_bh(NET_BH); + + AWC_ENTRY_EXIT_DEBUG("exit\n"); +}; + + + + +/******************************** R X ***********************/ + + + +inline int +awc_receive_packet(struct NET_DEVICE * dev){ + + struct awc_command cmd; + u16 Fid; +// struct sk_buff *skb = NULL; + struct awc_fid * rx_buff; + + + struct awc_private * priv ; + int i; + + priv= (struct awc_private *)dev->priv; + rx_buff = priv->rx_ready.head ; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_receive_packet "); + + Fid = awc_Rx_Fid(dev->base_addr); + + DEBUG(128," RX FID %x \n",Fid); + + if (!Fid){ + printk(KERN_CRIT "No RxFid when rx event \n"); + return -1; + } + + + + if (!rx_buff){ + printk(KERN_CRIT "No rx_buff in rx event \n"); + return -1; + } + + rx_buff->type = 0; + + + AWC_INIT_COMMAND(AWC_CLI,cmd,dev,0,0, + Fid, 0, 0x14 , &(rx_buff->u.rx.radio_rx)); + + +// header reading , order is important + AWC_BAP_LOCK_UNDER_CLI(cmd); + + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_read(&cmd)) goto final; + + DEBUG(128, "rx receive radio header, length %x \n",rx_buff->u.rx.radio_rx.PayloadLength); + + cmd.buff = &(rx_buff->u.rx.ieee_802_11); + cmd.len = 0x20; + + if (awc_bap_read(&cmd)) goto final; + + DEBUG(128, "rx receive 802_11 header, framecontrol %x \n",rx_buff->u.rx.ieee_802_11.frame_control); + + if (rx_buff->u.rx.ieee_802_11.gapLen > 8) { + printk(KERN_ERR "%s: 802.11 gap lenght huge %d \n",dev->name,rx_buff->u.rx.ieee_802_11.gapLen); + goto final; + } + DEBUG(128,"SeqCtl %x, 802_11 macs: ",rx_buff->u.rx.ieee_802_11.SeqCtl); + if (awc_debug & 0x7000){ + DEBUG(0x7000, " %s mac1 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac1[i] )) ; + DEBUG(0x7000, " %s mac2 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac2[i] )) ; + DEBUG(0x7000, " %s mac3 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac3[i] )) ; + DEBUG(0x7000, " %s mac4 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac4[i] )) ; + } + DEBUG(128,"\n GapLen %d ",rx_buff->u.rx.ieee_802_11.gapLen ); + + if (rx_buff->u.rx.ieee_802_11.gapLen > 0) { + cmd.buff = rx_buff->u.rx.ieee_802_11.gap; + cmd.len = rx_buff->u.rx.ieee_802_11.gapLen; + if (awc_bap_read(&cmd)) goto final; + DEBUG(128, "rx receive gap header , gap length %x \n",rx_buff->u.rx.gap_length); + } + for (i = 0; i < rx_buff->u.rx.ieee_802_11.gapLen ; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.ieee_802_11.gap[i] )) ; + + + if ( !(priv->config.ReceiveMode & RXMODE_DISABLE_802_3_HEADER ) + ){ + cmd.buff = &(rx_buff->u.rx.ieee_802_3); + cmd.len = 0x10; + rx_buff->type |= p80211_8023; + if (awc_bap_read(&cmd)) goto final; + DEBUG(128, "rx receive 802_3 header, payload length %x \n",rx_buff->u.rx.ieee_802_3.payload_length); + DEBUG(128,"\n 802_3 status %x ",rx_buff->u.rx.ieee_802_3.status ); + DEBUG(128," RX payloadLen %x, dst,src: ",rx_buff->u.rx.ieee_802_3.payload_length); + if (awc_debug & 0x7000){ + for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.dst_mac[i] )) ; + for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.src_mac[i] )) ; + } + }; + + rx_buff->pkt_len = rx_buff->u.rx.radio_rx.PayloadLength; + + if (priv->config.OperatingMode & MODE_LLC_HOST) + rx_buff->type |= p80211_llc_snap; + + + if (awc_802_11_find_copy_path(dev,rx_buff)) goto final; + + + if (rx_buff->u.rx.payload ){ + cmd.buff = rx_buff->u.rx.payload; + cmd.len = rx_buff->pkt_len; + if (awc_bap_read(&cmd)) goto final; + DEBUG(128, "rx payload read %x \n",rx_buff->u.rx.ieee_802_3.payload_length); + }; + + AWC_BAP_UNLOCK(cmd); + + DEBUG(128,"\n payload hdr %x ",rx_buff->u.rx.ieee_802_3.status ); + if (awc_debug && rx_buff->u.rx.payload) + for (i = 0; i < 20; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.payload[i] )) ; + DEBUG(128,"%c",'\n'); + + awc_802_11_router_rx(dev,rx_buff); + + AWC_RELEASE_COMMAND(cmd); +// awc_event_ack_Rx(dev->base_addr); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + + awc_802_11_failed_rx_copy(dev,rx_buff); + // if (skb) dev_kfree_skb(skb, FREE_WRITE); + AWC_RELEASE_COMMAND(cmd); +// awc_event_ack_Rx(dev->base_addr); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; + +}; + + +int +awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) { + + struct awc_command cmd; + u16 size ; +// unsigned long flags; + int i; + struct awc_private * priv= (struct awc_private *)dev->priv; + + AWC_ENTRY_EXIT_DEBUG(" entry awc_transmit_packet "); + + if (priv->link_status_changed ){ + priv->link_status_changed =0; + awc_readrid_dir(dev,&priv->rid_dir[7]); + } + + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0xB, tx_buff->u.tx.fid, + tx_buff->u.tx.fid, 0, 0x14 , &(tx_buff->u.tx.radio_tx)); + + AWC_BAP_LOCK_NOT_CLI(cmd); + +#ifdef AWC_BY_BOOK +#warning By books is bad, AWC_BY_BOOK +#error cli sti bad here + if ( !(tx_buff->type &(p80211_llc_snap|p80211_8021H) ) + && !(tx_buff->u.tx.radio_tx.TX_Control & + aironet4500_tx_control_header_type_802_11 )){ + + cmd.buff=&(tx_buff->u.tx.radio_tx.TX_Control); + cmd.len = 0x2 ; + cmd.offset = 0x8; + save_flags(flags); + cli(); + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_write(&cmd)) goto final; + + cmd.buff=&(tx_buff->u.tx.ieee_802_3.payload_length); + cmd.len = 14; + cmd.offset = 0x36; + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_write(&cmd)) goto final; + restore_flags(flags); + + } else { +#endif + + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_write(&cmd)) goto final; + + DEBUG(64," wrote radio tx header for fid %x \n",tx_buff->u.tx.fid); + + // 802.11 + cmd.buff=&(tx_buff->u.tx.ieee_802_11); + cmd.len = 0x20; + if (awc_bap_write(&cmd)) goto final; + + // Gap + if (tx_buff->u.tx.ieee_802_11.gapLen) { + cmd.buff=&(tx_buff->u.tx.ieee_802_11.gap); + cmd.len = tx_buff->u.tx.ieee_802_11.gapLen; + if (awc_bap_write(&cmd)) goto final; + } + // 802.3 + if ( ! (tx_buff->u.tx.radio_tx.TX_Control & + aironet4500_tx_control_header_type_802_11 )){ + + cmd.buff=&(tx_buff->u.tx.ieee_802_3); + if (awc_debug & 0x7000){ + printk("%s TX dst ",dev->name); + for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.dst_mac[i]); + printk(" src "); + for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.src_mac[i]); + printk(" \n "); + } + cmd.len = 0x10; + if (awc_bap_write(&cmd)) goto final; + }; + + if (tx_buff->type & p80211_llc_snap) { + cmd.buff= & tx_buff->snap; + cmd.len = sizeof(tx_buff->snap); + if (awc_bap_write(&cmd)) goto final; + }; + + if (tx_buff->type & p80211_8021H) { + size = htons(tx_buff->bridge_size); + // size = tx_buff->bridge_size;// to seasure raw speed of f** UC + cmd.buff= & size; + cmd.len = 2 ; + if (awc_bap_write(&cmd)) goto final; + + cmd.buff= & tx_buff->bridge; + cmd.len = sizeof(tx_buff->bridge); + if (awc_bap_write(&cmd)) goto final; + }; + +#ifdef AWC_BY_BOOK + + } +#endif + cmd.buff= tx_buff->u.tx.payload; + cmd.len = tx_buff->pkt_len; + + if (awc_bap_write(&cmd)) goto final; + + + AWC_BAP_UNLOCK(cmd); + + if (awc_issue_command_and_block(&cmd)) goto final; +// if (awc_issue_command(&cmd)) goto final; + tx_buff->transmit_start_time = jiffies; + awc_802_11_after_tx_packet_to_card_write(dev,tx_buff); + // issue the transmit command + + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + final: + awc_802_11_after_failed_tx_packet_to_card_write(dev,tx_buff); + + printk(KERN_CRIT "%s awc tx command failed \n",dev->name); + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + + +inline int +awc_tx_complete_check(struct NET_DEVICE * dev){ + + struct awc_fid * fid; + struct awc_command cmd; + + + AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_complete_check "); + + + + fid = awc_fid_queue_pop_head(&((struct awc_private *)dev->priv)->tx_post_process); + + if (!fid) { + printk("awc_tx_complete_check with empty queue \n "); + return -1; + } + + DEBUG(64," tx_complete fid %x \n",fid->u.tx.fid); + + AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0,0, fid->u.tx.fid, + 0, 0x14 , &(fid->u.tx.radio_tx)); + + fid->state |= awc_tx_fid_complete_read; + + AWC_BAP_LOCK_NOT_CLI(cmd); + if (awc_bap_setup(&cmd)) goto final; + if (awc_bap_read(&cmd)) goto final; + AWC_BAP_UNLOCK(cmd); + + awc_802_11_after_tx_complete(dev,fid); + + + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + return 0; + + final: + awc_802_11_after_tx_complete(dev,fid); + printk(KERN_ERR "%s awc_tx_complete_check failed \n",dev->name); + AWC_RELEASE_COMMAND(cmd); + AWC_ENTRY_EXIT_DEBUG(" BAD exit \n"); + return -1; ; +} + + +#define AWC_QUEUE_BH {\ + if (!priv->bh_active && !priv->bh_running){\ + priv->bh_active = 1;\ + queue_task(&priv->immediate_bh, &tq_immediate);\ + mark_bh(IMMEDIATE_BH);\ + }\ + } + + +void +awc_bh(struct NET_DEVICE *dev){ + + struct awc_private * priv = (struct awc_private *)dev->priv; + int active_interrupts; + int enabled_interrupts; +// u16 tx_status; + int multi_ints = 0; +// u16 tx_fid = 0; +// unsigned long flags; + + DEBUG(8, "awc_bh awoken on jiffie %ld \n",jiffies); + + priv->bh_running = 1; + + active_interrupts = awc_event_status(dev->base_addr); + + enabled_interrupts = awc_ints_enabled(dev->base_addr); + + DEBUG(8, "awc_bh active ints %x \n",active_interrupts); + + if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) { +// printk(KERN_ERR "tx chain active in bh \n"); +// queue_task(&priv->immediate_bh, &tq_immediate); + goto bad_end; + } +start: + if (active_interrupts == 0xffff){ + + printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name); + dev->tbusy = 1; + dev->start = 0; + if (priv->command_semaphore_on){ + priv->command_semaphore_on--; + UP(&priv->command_semaphore); + } + priv->tx_chain_active =0; + goto bad_end; + + } + + if (priv->unlock_command_postponed ){ + + priv->unlock_command_postponed-- ; + if( priv->command_semaphore_on ){ + + awc_read_response((&priv->cmd)); + priv->async_command_start = 0; + if (priv->command_semaphore_on){ + + priv->command_semaphore_on--; + UP(&priv->command_semaphore); + } + } + }; + +/* if ( active_interrupts & 0x1 ){ + awc_receive_packet(dev) ; + awc_event_ack_Rx(dev->base_addr); + priv->waiting_interrupts &= ~0x1; + } +*/ + while (priv->tx_post_process.size) + if (awc_tx_complete_check(dev)) break; + + active_interrupts = awc_event_status(dev->base_addr); + + if (priv->command_semaphore_on || priv->tx_post_process.size){ + if (multi_ints++ < 10000){ + goto start; + } + }; + priv->bh_active = 0; + priv->bh_running = 0; + + priv->tx_chain_active = 0; + + + + bad_end: +// if (!priv->tx_chain_active) +// wake_up(&priv->tx_chain_wait_queue); + + priv->bh_running = 0; + priv->bh_active = 0; + return ; +}; + + +inline int +awc_interrupt_process(struct NET_DEVICE * dev){ + + struct awc_private * priv ; + int active_interrupts; + int enabled_interrupts; + u16 tx_status; + int multi_ints = 0; + u16 tx_fid = 0; +// u16 ints_to_ack =0; + struct awc_fid * fid = NULL; +// int interrupt_reenter = 0; + unsigned long flags; + + save_flags(flags); + cli(); +// disable_irq(dev->irq); + + DEBUG(2," entering interrupt handler %s ",dev->name); + + if (!dev) { + printk(KERN_ERR "No dev in interrupt \n"); + goto bad_end; + }; + + priv = (struct awc_private *)dev->priv; + + if (!priv) { + printk(KERN_ERR "No PRIV in interrupt \n"); + goto bad_end; + }; + + + enabled_interrupts = awc_ints_enabled(dev->base_addr); + active_interrupts = awc_event_status(dev->base_addr); + + DEBUG(2,"entry: processing interrupts waiting %x \n",priv->waiting_interrupts); + DEBUG(2,"entry: processing interrupts active %x \n",active_interrupts); + DEBUG(2,"entry: processing interrupts enabled %x \n",enabled_interrupts); +// 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 "); + + + + if (priv->waiting_interrupts & active_interrupts) + printk(KERN_ERR "double interrupt waiting %x active %x \n", + priv->waiting_interrupts, active_interrupts); + + // priv->waiting_interrupts |= active_interrupts; + + + + + +start: + DEBUG(2,"Start processing int, times %d\n",multi_ints); + + if (active_interrupts == 0xffff){ + + printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name); + //priv-> + dev->tbusy = 1; + dev->start = 0; + 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){ + + printk(KERN_ERR "ejected, last BH fired \n"); + + AWC_QUEUE_BH; + } + priv->interrupt_count--; + dev->interrupt = 0; + goto bad_end; + } + + + + if (active_interrupts & 0x100 ){ + awc_event_ack_Awaken(dev->base_addr); + udelay(10); + DEBUG(1,"%s device awoke \n",dev->name); + priv->waiting_interrupts &= ~0x100; + }; + if (active_interrupts & 0x80 ){ + + priv->link_status = awc_Link_Status(dev->base_addr); + DEBUG(1,"link status changed %x \n",priv->link_status); + awc_event_ack_Link(dev->base_addr); + priv->waiting_interrupts &= ~0x80; + if(priv->link_status == 0x400) + printk(KERN_INFO "%s Associated\n",dev->name ); + else { + printk(KERN_INFO "%s Link status change : %s \n",dev->name, awc_print_string(awc_link_status_names, priv->link_status) ); + if ( priv->link_status & 0x8100 || + priv->link_status & 0x0100 || + priv->link_status & 0x8200 || + priv->link_status & 0x8400 || + priv->link_status & 0x0300 ) + printk(KERN_INFO "%s Link status change reason : %s \n",dev->name, awc_print_string(awc_link_failure_reason_names, priv->link_status & 0xff) ); + + } + }; + + + if (active_interrupts & 0x10 & enabled_interrupts ){ + +// printk(KERN_ERR "cmd int shouldnt be active in interrupt routine\n"); + + awc_event_ack_Cmd(priv->cmd.port); + + if ( priv->enabled_interrupts & 0x10) + priv->enabled_interrupts &= ~0x10; + + enabled_interrupts = awc_ints_enabled(dev->base_addr); + + if (enabled_interrupts & 0x10){ + awc_ints_enable(dev->base_addr, enabled_interrupts & ~0x10); + } + + if (priv->command_semaphore_on){ + priv->unlock_command_postponed++; + + AWC_QUEUE_BH; + } + } + + if ((active_interrupts & 0x10) && !(0x10 & enabled_interrupts) ){ + +// printk(KERN_ERR "%s: aironet4500: cmd int shouldnt be active in interrupt routine\n",dev->name); + + //awc_event_ack_Cmd(priv->cmd.port); + } + + +// active_interrupts = awc_event_status(dev->base_addr); + + tx_status = active_interrupts & 0x6 ; + + + + if (tx_status) { + + tx_fid = awc_Tx_Compl_Fid(dev->base_addr); + if (!tx_fid){ + udelay(10); + tx_fid = awc_Tx_Compl_Fid(dev->base_addr); + } + if (!tx_fid) + printk(KERN_ERR "No tx fid when tx int active\n"); + + fid = awc_tx_fid_lookup_and_remove(dev, tx_fid); + if (fid) { + if (priv->process_tx_results) { + awc_fid_queue_push_tail(&priv->tx_post_process,fid); + AWC_QUEUE_BH; + }else { + 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; + mark_bh(NET_BH); + } + } else + printk(KERN_ERR "awc fid %x not found\n",tx_fid); + + + if (tx_status & 2){ + awc_event_ack_Tx(dev->base_addr); + priv->stats.tx_packets++; + priv->waiting_interrupts &= ~0x2; + } + if (tx_status & 4){ + priv->stats.tx_errors++; + awc_event_ack_TxExc(dev->base_addr); + priv->waiting_interrupts &= ~0x4; + } + if ((tx_status&6) == 6) + printk(KERN_NOTICE "%s: both tx and txExc up\n",dev->name); + + + } + +// active_interrupts = awc_event_status(dev->base_addr); + + if ( active_interrupts & 0x1 ){ + awc_receive_packet(dev); + awc_event_ack_Rx(dev->base_addr); + priv->waiting_interrupts &= ~0x1; + } + + active_interrupts = awc_event_status(dev->base_addr); + + if ((active_interrupts & 0x7) && + !priv->bh_active && + !priv->bh_running ){ + if (multi_ints++ < 5) + goto start; + } + if (multi_ints >=5 ) + printk(KERN_ERR "%s multi_ints > 5 interrupts still active %x\n",dev->name,active_interrupts); + + + priv->interrupt_count--; + dev->interrupt = 0; + + awc_ints_enable(dev->base_addr, 0x0000); + + + DEBUG(0x8, " enabling ints in interrupt_process %x \n", + priv->enabled_interrupts & ~priv->waiting_interrupts); + + + + AWC_ENTRY_EXIT_DEBUG(" exit \n"); + + awc_ints_enable(dev->base_addr, + priv->enabled_interrupts); + +//end_here: + +// enable_irq(dev->irq); + 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); + return -1; + + +}; + +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}; + +static int awc_debug = 0; // 0xffffff; +static int p802_11_send = 0; // 1 + +static int awc_process_tx_results = 0; +int tx_queue_len = 10; +int tx_rate = 0; +static int channel = 5; +//static int tx_full_rate = 0; +static int max_mtu = 2312; +static int adhoc = 0; +static int large_buff_mem = 1700 * 10; +static int small_buff_no = 20; +static int awc_full_stats = 0; +static char SSID[33] = {0}; +static int master= 0; +static int slave = 0; +// int debug =0; + +#if LINUX_VERSION_CODE >= 0x20100 + +MODULE_PARM(awc_debug,"i"); +MODULE_PARM(rx_queue_len,"i"); +MODULE_PARM(tx_rate,"i"); +MODULE_PARM(channel,"i"); +MODULE_PARM(tx_full_rate,"i"); +MODULE_PARM(adhoc,"i"); +MODULE_PARM(master,"i"); +MODULE_PARM(slave,"i"); +MODULE_PARM(max_mtu,"i"); +MODULE_PARM(large_buff_mem,"i"); +MODULE_PARM(small_buff_no,"i"); +MODULE_PARM(SSID,"1-4c31"); +#endif + +/*EXPORT_SYMBOL(tx_queue_len); +EXPORT_SYMBOL(awc_debug); + */ +EXPORT_SYMBOL(awc_init); +EXPORT_SYMBOL(awc_open); +EXPORT_SYMBOL(awc_close); +EXPORT_SYMBOL(awc_reset); +EXPORT_SYMBOL(awc_config); + +EXPORT_SYMBOL(aironet4500_devices); +EXPORT_SYMBOL(awc_debug); +//EXPORT_SYMBOL(); + +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); +EXPORT_SYMBOL(awc_change_mtu); +EXPORT_SYMBOL(awc_set_multicast_list); + +EXPORT_SYMBOL(awc_proc_set_fun); +EXPORT_SYMBOL(awc_proc_unset_fun); +EXPORT_SYMBOL(awc_register_proc); +EXPORT_SYMBOL(awc_unregister_proc); + + +/*************************** RESET INIT CONFIG ***********************/ + + + void awc_reset(struct NET_DEVICE *dev) +{ + + long long jiff; + + DEBUG(2, " awc_reset dev %x \n", (int)dev); + DEBUG(2, "%s: awc_reset \n", dev->name); + + awc_issue_soft_reset(dev); + + jiff = jiffies; + udelay(1000); + while (awc_command_read(dev->base_addr)){ + udelay(1000); + if (jiffies - jiff > 5*HZ){ + printk(KERN_CRIT "%s bad reset\n",dev->name); + break; + } + }; + +} + + int awc_config(struct NET_DEVICE *dev) +{ +// struct awc_private *priv = (struct awc_private *)dev->priv; + + DEBUG(2, "%s: awc_config \n", dev->name); + + + if( awc_disable_MAC(dev)) goto final; + udelay(100); + if( awc_write_all_rids(dev) ) goto final; + udelay(100); + if( awc_enable_MAC(dev)) goto final; + + return 0; + final: + return -1; +} + + +char name[] = "ElmerLinux"; + + int awc_init(struct NET_DEVICE *dev){ + struct awc_private *priv = (struct awc_private *)dev->priv; + int i; + const char * radioType; + + DEBUG(2, "%s: awc_init \n", dev->name); + + + + //awc_dump_registers(dev); + + if (adhoc & !max_mtu) + max_mtu= 2250; + else if (!max_mtu) + max_mtu= 1500; + + priv->sleeping_bap = 1; + + + priv->enabled_interrupts = awc_ints_enabled(dev->base_addr); + + if( awc_issue_noop(dev) ) goto final; + + awc_ints_enable(dev->base_addr,0); + + if( awc_disable_MAC(dev) ) goto final; + + +// awc_rids_setup(dev); + i=0; + while ( i < AWC_NOF_RIDS){ + if (awc_rids_temp[i].selector) + memcpy(&priv->rid_dir[i],&awc_rids_temp[i],sizeof(priv->rid_dir[0]) ); + else priv->rid_dir[i].selector = NULL; + i++; + } + + // following MUST be consistent with awc_rids !!! + priv->rid_dir[0].buff = &priv->config; // card RID mirrors + priv->rid_dir[1].buff = &priv->SSIDs; + priv->rid_dir[2].buff = &priv->fixed_APs; + priv->rid_dir[3].buff = &priv->driver_name; + priv->rid_dir[4].buff = &priv->enc_trans; + priv->rid_dir[5].buff = &priv->general_config; // + priv->rid_dir[6].buff = &priv->capabilities; + priv->rid_dir[7].buff = &priv->status; + priv->rid_dir[8].buff = &priv->AP; + priv->rid_dir[9].buff = &priv->statistics; + priv->rid_dir[10].buff = &priv->statistics_delta; + priv->rid_dir[11].buff = &priv->statistics_delta_clear; + priv->rid_dir[12].buff = &priv->wep_volatile; + priv->rid_dir[13].buff = &priv->wep_nonvolatile; + priv->rid_dir[14].buff = &priv->modulation; + + priv->rid_dir[15].buff = &priv->statistics16; + priv->rid_dir[16].buff = &priv->statistics16_delta; + priv->rid_dir[17].buff = &priv->statistics16_delta_clear; + + priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors + priv->rid_dir[1].bufflen = sizeof(priv->SSIDs); + priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs); + priv->rid_dir[3].bufflen = sizeof(priv->driver_name); + priv->rid_dir[4].bufflen = sizeof(priv->enc_trans); + priv->rid_dir[5].bufflen = sizeof(priv->general_config); // + priv->rid_dir[6].bufflen = sizeof(priv->capabilities); + priv->rid_dir[7].bufflen = sizeof(priv->status); + priv->rid_dir[8].bufflen = sizeof(priv->AP); + priv->rid_dir[9].bufflen = sizeof(priv->statistics); + priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta); + priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear); + priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile); + priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile); + priv->rid_dir[14].bufflen = sizeof(priv->modulation); + + priv->rid_dir[15].bufflen = sizeof(priv->statistics16); + priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta); + priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear); + + + if( awc_read_all_rids(dev) ) goto final; + + + priv->config.OperatingMode = 0;// MODE_LLC_HOST; + DEBUG(1,"ReceiveMode %x \n",priv->config.ReceiveMode); + // priv->config.ReceiveMode = RXMODE_DISABLE_802_3_HEADER; + + if (!adhoc) + priv->config.OperatingMode = MODE_STA_ESS; +// priv->config.OperatingMode = MODE_AP; +// priv->config.Rates[0] =0x82; +// priv->config.Rates[1] =0x4; +// priv->config.Rates[2] =tx_full_rate; +// priv->config.Rates[3] =0; +// priv->config.Rates[4] =0; +// priv->config.Rates[5] =0; +// priv->config.Rates[6] =0; +// priv->config.Rates[7] =0; + priv->config.Channel = channel; + if (adhoc && master){ + priv->config.JoinNetTimeout = 0x1;//0 is facotry default + } else if (adhoc && slave){ + priv->config.JoinNetTimeout = 0xffff; + }; +// priv->config.AuthenticationType = 1; + priv->config.Stationary =1; +// priv->config.ScanMode = 1; +// priv->config.LinkLossDelay = 100; + priv->config.FragmentThreshold = 1700; + priv->config.RtsThreshold = 1700; + memcpy(priv->config.NodeName, name, 10); + + DEBUG(1,"%s supported Rates \n",dev->name); + for (i=0; i< 8; i++) + DEBUG(1,"%x ",priv->capabilities.SupportedRates[i]); + DEBUG(1,"%c",'\n'); + DEBUG(1,"%s default Rates \n",dev->name); + for (i=0; i< 8; i++) + DEBUG(1,"%x ",priv->config.Rates[i]); + DEBUG(1,"%c",'\n'); + + + // here we go, bad aironet + memset(&priv->SSIDs,0,sizeof(priv->SSIDs)); + + memset(&priv->queues_lock,0,sizeof(priv->queues_lock)); + + priv->SSIDs.ridLen =0; + if (!SSID) { + priv->SSIDs.SSID[0].SSID[0] ='a'; + priv->SSIDs.SSID[0].SSID[1] ='b'; + priv->SSIDs.SSID[0].SSID[2] ='c'; + priv->SSIDs.SSID[0].lenght =3; + } else { + int sidlen = strlen(SSID); + memcpy(priv->SSIDs.SSID[0].SSID,SSID,sidlen); + priv->SSIDs.SSID[0].lenght = sidlen; + }; + + priv->SSIDs.SSID[1].lenght =0; + priv->SSIDs.SSID[1].SSID[0] =0; + priv->SSIDs.SSID[1].SSID[1] =0; + priv->SSIDs.SSID[2].lenght =0; + priv->SSIDs.SSID[2].SSID[0] =0; + priv->SSIDs.SSID[2].SSID[1] =0; + + +// priv->enc_trans.rules[0].etherType= 0x0008; +// priv->enc_trans.rules[0].Action = 1; + + memcpy( priv->config.StationMacAddress, + priv->capabilities.FactoryAddress, 6 ); + + memcpy(dev->dev_addr, priv->config.StationMacAddress, 6); + + DEBUG(2, "%s: awc_init success \n", dev->name); + + if (priv->capabilities.RadioType == 1) radioType = "802.11 Frequency Hoping"; + else if (priv->capabilities.RadioType == 2) radioType = "802.11 Direct Sequence"; + else if (priv->capabilities.RadioType == 4) radioType = "LM2000"; + else radioType = "Multiple Radio Types"; + + printk("%s: %s %s found @ 0x%lx irq %d firmwareVersion %d \n",dev->name, + priv->capabilities.ProductName,radioType, + dev->base_addr,dev->irq, + priv->capabilities.SoftwareVersion); + + return 0; + final: + printk(KERN_ERR "aironet init failed \n"); + return NODEV; + + }; + +int awc_private_init(struct NET_DEVICE * dev){ + struct awc_private * priv = (struct awc_private *) dev->priv; + int i = 0; + + DEBUG(2, "%s: awc_private_init \n", dev->name); + + + memset(priv, 0, sizeof(struct awc_private)); + + priv->bap0.select = dev->base_addr + awc_Select0_register; + priv->bap0.offset = dev->base_addr + awc_Offset0_register; + priv->bap0.data = dev->base_addr + awc_Data0_register; + priv->bap0.lock = 0; + priv->bap0.status = 0; + init_MUTEX(&priv->bap0.sem); + priv->bap1.select = dev->base_addr + awc_Select1_register; + priv->bap1.offset = dev->base_addr + awc_Offset1_register; + priv->bap1.data = dev->base_addr + awc_Data1_register; + priv->bap1.lock = 0; + priv->bap1.status = 0; + init_MUTEX(&priv->bap1.sem); + priv->sleeping_bap = 1; + + init_MUTEX(&priv->command_semaphore); + priv->command_semaphore_on = 0; + priv->unlock_command_postponed = 0; + priv->immediate_bh.next = NULL; + priv->immediate_bh.sync = 0; + priv->immediate_bh.routine = (void *)(void *)awc_bh; + priv->immediate_bh.data = dev; + priv->bh_running = 0; + priv->bh_active = 0; + priv->tx_chain_active = 0; + priv->enabled_interrupts= 0x00; + priv->waiting_interrupts= 0x00; + + + init_MUTEX(&priv->tx_buff_semaphore); + priv->tx_buffs_in_use = 0; + priv->tx_small_buffs_in_use = 0; + priv->mac_enabled =0; + priv->link_status =0; + priv->large_buff_mem = large_buff_mem; + if (priv->large_buff_mem < max_mtu + AWC_TX_HEAD_SIZE + 10 ) + priv->large_buff_mem = max_mtu + AWC_TX_HEAD_SIZE + 10; + priv->small_buff_no = small_buff_no; + if (priv->small_buff_no < 1 ) + priv->small_buff_no = 1 ; + + priv->process_tx_results = awc_process_tx_results; + + //init_waitqueue(&priv->tx_chain_wait_queue); + + for (i=0; i< 6 ; i++ ) { + priv->p2p[i] = 0xff; + priv->bssid[i] =0; + } +// priv->p2p_uc =1; + priv->p2p_found =0; + + priv->p802_11_send =p802_11_send; + + + priv->ejected =0; + dev->interrupt =0; + priv->interrupt_count =0; + + return 0; + +}; + +/**************************** OPEN CLOSE **********************/ + + + int awc_open(struct NET_DEVICE *dev) +{ + struct awc_private *priv = (struct awc_private *)dev->priv; + + + + 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; + + memcpy(dev->dev_addr, priv->config.StationMacAddress, 6); + + priv->enabled_interrupts = 0x87; + awc_ints_enable(dev->base_addr,priv->enabled_interrupts); + +// priv->p8022_client = register_8022_client; +// priv->snap_client = register_snap_client; + DEBUG(2, "%s: opened \n", dev->name); + + priv->sleeping_bap = 0; + + + MOD_INC_USE_COUNT; +// kernel_thread(awc_thread,dev,0); + + dev->tbusy = 0; dev->start = 1; + return 0; /* Always succeed */ + + final: + dev->tbusy = 0; dev->start = 0; + printk(KERN_ERR "aironet open failed \n"); + return -1; +} + + + 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; + + awc_disable_MAC(dev); + awc_queues_destroy(dev); + + awc_reset(dev); + + udelay(10000); + + DOWN(&priv->command_semaphore); + + MOD_DEC_USE_COUNT; + + UP(&priv->command_semaphore); + + return 0; +} + + + +/****************************** TX RX STUFF ******************/ + + + + void awc_tx_timeout(struct NET_DEVICE *dev) +{ + struct awc_private *priv = (struct awc_private *)dev->priv; + + 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++; + + dev->trans_start = jiffies; + dev->tbusy = 0; +} + +long long last_tx_q_hack = 0; +int direction = 1; + + 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); + + + if (!dev) { + DEBUG(1, " xmit dev=NULL, jiffie %ld \n",jiffies); + 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; + return 1; + } + + dev->trans_start = jiffies; + retval = awc_802_11_tx_find_path_and_post(dev,skb); + priv->tx_chain_active = 0; +// wake_up_interruptible(&priv->tx_chain_wait_queue); + +// if (!dev->tbusy) dev_tint(dev); + 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) { + +// struct awc_private *lp = (struct awc_private *)dev->priv; + + DEBUG(3, "%s: in rx_packet \n",dev->name); + + if (!rx_fid ){ + DEBUG(3, "%s: not rx_buff in rx_packet \n",dev->name); + return -1; + }; + if ( !rx_fid->skb){ + DEBUG(3, "%s: not rx_buff->skb in rx_packet \n",dev->name); + return -1; + }; + + + rx_fid->skb->protocol = eth_type_trans(rx_fid->skb,dev); + netif_rx(rx_fid->skb); + rx_fid = NULL; + + return 0; +} + + + void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + struct NET_DEVICE *dev = (struct NET_DEVICE *)dev_id; +// struct awc_private *lp; +// unsigned long flags; + +// if ((dev == NULL)) return; + +// lp = (struct awc_private *)dev->priv; + + + + + DEBUG(2, "%s: awc_interrupt \n", dev->name); + + awc_interrupt_process(dev); + + return; +} + + + +/************************ STATS, MULTICAST & STUFF ****************/ + + + + struct enet_statistics *awc_get_stats(struct NET_DEVICE *dev) +{ + struct awc_private *priv = (struct awc_private *)dev->priv; + unsigned long flags; +// int cnt = 0; +// int unlocked_stats_in_interrupt=0; + + DEBUG(2, "%s: awc_get_stats \n", dev->name); + + if (!dev->start) { + return 0; + } + save_flags(flags); + cli(); + if (awc_full_stats) + awc_readrid_dir(dev, &priv->rid_dir[9]); + restore_flags(flags); + + // the very following is the very wrong very probably + if (awc_full_stats){ + priv->stats.rx_fifo_errors = priv->statistics.RxOverrunErr ; + priv->stats.rx_crc_errors = priv->statistics.RxPlcpCrcErr + priv->statistics.RxMacCrcErr ; + priv->stats.rx_frame_errors = priv->statistics.RxPlcpFormat ; + priv->stats.rx_length_errors = priv->statistics.RxPlcpLength ; + priv->stats.rx_missed_errors = priv->statistics.RxAged ; + priv->stats.rx_over_errors = priv->statistics.RxOverrunErr ; + + priv->stats.collisions = priv->statistics.TxSinColl; + priv->stats.tx_aborted_errors = priv->statistics.TxAged ; + priv->stats.tx_fifo_errors = priv->statistics.HostTxFail ; + priv->stats.tx_window_errors = priv->statistics.TxMulColl ; + priv->stats.tx_heartbeat_errors = priv->statistics.DefersProt +priv->statistics.DefersEngy ; + priv->stats.tx_carrier_errors = priv->statistics.RetryLong +priv->statistics.RetryShort ; + priv->stats.multicast = priv->statistics.HostRxMc; + } + + +// printk("rx_packets %d\n",priv->stats.rx_packets); + return &(priv->stats); +} + + +int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){ + +// struct awc_private *priv = (struct awc_private *)dev->priv; + unsigned long flags; + + if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) ) + return -EINVAL; + + if (dev->start) { + printk("PLEASE, ifconfig %s down for mtu change\n",dev->name); + + }; + if (dev->mtu != new_mtu) { + save_flags(flags); + cli(); + awc_disable_MAC(dev); + awc_tx_dealloc(dev); + dev->mtu = new_mtu; + awc_tx_alloc(dev); + awc_enable_MAC(dev); + restore_flags(flags); + + printk("%s mtu has been changed to %d \n ",dev->name,dev->mtu); + + } + + return 0; + +}; + + + void +awc_set_multicast_list(struct NET_DEVICE *dev) { +// int ioaddr = dev->base_addr; + +/* if (dev->flags & IFF_PROMISC) + promisc + else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) + allmulti + else + normal + */ + + +} + + + +int (* awc_proc_set_fun) (int) = NULL; +int (* awc_proc_unset_fun) (int) = NULL; + + +int awc_register_proc(int (*awc_proc_set_device)(int),int (*awc_proc_unset_device)(int)){ + + AWC_ENTRY_EXIT_DEBUG("awc_register_proc"); + awc_proc_set_fun = awc_proc_set_device; + awc_proc_unset_fun = awc_proc_unset_device; + AWC_ENTRY_EXIT_DEBUG("exit"); + return 0; +}; + +int awc_unregister_proc(void){ + + AWC_ENTRY_EXIT_DEBUG("awc_unregister_proc"); + + awc_proc_set_fun = NULL; + awc_proc_unset_fun = NULL; + AWC_ENTRY_EXIT_DEBUG("exit"); + return 0; +}; + +#ifdef MODULE + +int init_module(void) +{ +// unsigned long flags; + +// debug = awc_debug; + printk(KERN_INFO"%s", aironet4500_core_version); + return 0; + + +} + +void cleanup_module(void) +{ + printk(KERN_INFO "aironet4500 unloading core module \n"); + +} + +#endif + \ No newline at end of file diff -u --recursive --new-file v2.3.30/linux/drivers/net/aironet4500_proc.c linux/drivers/net/aironet4500_proc.c --- v2.3.30/linux/drivers/net/aironet4500_proc.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/aironet4500_proc.c Tue Dec 7 23:58:22 1999 @@ -0,0 +1,553 @@ +/* + * Aironet 4500 Pcmcia driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +#ifdef CONFIG_PROC_FS + +#ifdef CONFIG_PROC_FS +#include +#else +#error awc driver needs CONFIG_PROC_FS +#endif + + + +#include "aironet4500_rid.c" + + +#define AWC_STR_SIZE 0x2ff0 +#define DEV_AWC_INFO 1 +#define DEV_AWC 1 + +struct awc_proc_private{ + struct ctl_table_header * sysctl_header; + struct ctl_table * proc_table; + struct ctl_table proc_table_device_root[2]; + struct ctl_table proc_table_sys_root[2]; + char proc_name[10]; +}; +static char awc_drive_info[AWC_STR_SIZE]="Zcom \n\0"; +static char awc_proc_buff[AWC_STR_SIZE]="\0"; +static int awc_int_buff; +static struct awc_proc_private awc_proc_priv[MAX_AWCS]; + +extern int awc_proc_unset_device(int device_number); + +int awc_proc_format_array(int write,char * buff, size_t * len, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){ + + u8 * data = rid_dir->buff + rid->offset; + int pos = 0; + int null_past = 0; + int hex = ((rid->mask == 0xff) && (rid->value == 0x0 )); + int string = ((rid->mask == 0) && (rid->value == 0 )); + u32 val =0; + int bytes = (rid->bits / 8); + int ch =0; + int i,k; + int array_len = rid->array; + int nullX = 0; + + + AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array"); + + if (rid->bits %8 ) bytes +=1; + + if (bytes > 4 && rid->array == 1){ + array_len = bytes; + bytes = 1; + hex = 1; + }; + if (bytes < 1 || bytes > 4){ + printk(KERN_ERR " weird number of bytes %d in aironet rid \n",bytes); + return -1; + }; + DEBUG(0x20000,"awc proc array bytes %d",bytes); + DEBUG(0x20000," hex %d",hex); + DEBUG(0x20000," string %d",string); + + DEBUG(0x20000," array_len %d \n",array_len); + DEBUG(0x20000," offset %d \n",rid->offset); + + if (!write){ + for (i=0; i < array_len ; i++){ + + if (bytes <= 1 ) val = data[i*bytes]; + else if (bytes <= 2 ) val = *((u16 *)&data[i*bytes]); + else if (bytes <= 4 ) val = *((u32 *)&data[i*bytes]); + + if (rid->null_terminated && !val) + null_past =1; + + if (hex && !string) + for (k=0; k = '0' && ch <='9') + ch -= '0'; + if (ch >= 'A' && ch <='F') + ch -= 'A'+ 0xA; + if (ch >= 'a' && ch <='f') + ch -= 'a'+ 0xA; + val += ch <<4; + k++; + + ch = *(buff + 2*i*bytes +k + nullX); + if (val == 0 && (ch == 'X' || ch == 'x')){ + nullX=2; + val = 0; + k = -1; + continue; + }; + if (ch >= '0' && ch <='9') + ch -= '0'; + if (ch >= 'A' && ch <='F') + ch -= 'A'+ 0xA; + if (ch >= 'a' && ch <='f') + ch -= 'a'+ 0xA; + + val += ch; + if (i*bytes > *len ) + val = 0; + } + if (rid->bits <=8 ) data[i*bytes] = val; + else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = val; + else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = val; + if (!val) null_past=1; + + } else { + for (k=0; k < bytes; k++){ + data[i*bytes +k] = *(buff + i*bytes +k); + if (i*bytes +k > *len || !data[i*bytes +k]) + null_past = 1;; + } + + } + if (null_past){ + if (rid->bits <=8 ) data[i*bytes] = 0; + else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = 0; + else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = 0; + } + + } + + }; + + +// *len = pos; + + AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array"); + return 0; +}; + + +int awc_proc_format_bits(int write,u32 * buff, size_t* lenp, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){ + + u8 * data = rid_dir->buff + rid->offset; + u32 val = 0; + int not_bool = 0; + + AWC_ENTRY_EXIT_DEBUG("awc_proc_format_bits"); + + if ((rid->bits == 8 && rid->mask == 0xff) || + (rid->bits == 16 && rid->mask == 0xffff) || + (rid->bits == 32 && rid->mask == 0xffffffff) ) + not_bool = 1; + + if (rid->bits <=8 ) val = *data; + else if (rid->bits <=16 ) val = *((u16 *)data); + else if (rid->bits <=32 ) val = *((u32 *)data); + + DEBUG(0x20000,"awc proc int enter data %x \n",val); + DEBUG(0x20000,"awc proc int enter buff %x \n",*buff); + DEBUG(0x20000,"awc proc int enter intbuff %x \n",awc_int_buff); + DEBUG(0x20000,"awc proc int enter lenp %x \n",*lenp); + + + + if (!write){ + if (rid->mask) + val &= rid->mask; + + if (!not_bool && rid->mask && + ((val & rid->mask) == (rid->value & rid->mask))) + *buff = 1; + else if (!not_bool) *buff = 0; + else *buff = val; + } else { + if (not_bool){ + val &= ~rid->mask; + val |= (*buff & rid->mask); + } else { + if (*buff){ + val &= ~rid->mask; + if (rid->value) + val |= rid->mask & rid->value; + else val |= rid->mask & ~rid->value; + } else val &= ~rid->mask; + }; + if (rid->bits == 8) *data = val & 0xff; + if (rid->bits == 16) *((u16*)data) = val &0xffff; + if (rid->bits == 32) *((u32*)data) = val &0xffffffff; + + } + DEBUG(0x20000,"awc proc int buff %x \n",awc_int_buff); + if (rid->bits <=8 ) val = *data; + else if (rid->bits <=16 ) val = *((u16 *)data); + else if (rid->bits <=32 ) val = *((u32 *)data); + + DEBUG(0x20000,"awc proc int data %x \n",val); + +// *lenp = sizeof(int); + *lenp += 1; + + AWC_ENTRY_EXIT_DEBUG("exit"); + return 0; + +}; + +int awc_proc_fun(ctl_table *ctl, int write, struct file * filp, + void *buffer, size_t *lenp) +{ + int retv =-1; + struct awc_private *priv = NULL; + unsigned long flags; +// int device_number = (int ) ctl->extra1; + + struct awc_rid_dir * rid_dir; + + struct NET_DEVICE * dev= NULL; + struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2; + + + AWC_ENTRY_EXIT_DEBUG("awc_proc_fun"); + + if (!write && filp) + if (filp->f_pos){ +// printk(KERN_CRIT "Oversize read\n"); + *lenp = 0;// hack against reading til eof + return 0; + } + + MOD_INC_USE_COUNT; + + rid_dir = ((struct awc_rid_dir *)ctl->extra1); + dev = rid_dir->dev; + + if (!dev){ + printk(KERN_ERR " NO device here \n"); + goto final; + } + + if(ctl->procname == NULL || awc_drive_info == NULL ){ + printk(KERN_WARNING " procname is NULL in sysctl_table or awc_mib_info is NULL \n at awc module\n "); + MOD_DEC_USE_COUNT; + return -1; + } + priv = (struct awc_private * ) dev->priv; + + if ((rid->selector->read_only || rid->read_only) && write){ + printk(KERN_ERR "This value is read-only \n"); + goto final; + }; + + if (!write && rid->selector->may_change) { + save_flags(flags); + cli(); + awc_readrid(dev,rid,rid_dir->buff + rid->offset); + restore_flags(flags); + }; + + if (rid->array > 1 || rid->bits > 32){ + if (write){ + retv = proc_dostring(ctl, write, filp, buffer, lenp); + if (retv) goto final; + retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid); + if (retv) goto final; + } else { + retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid); + if (retv) goto final; + retv = proc_dostring(ctl, write, filp, buffer, lenp); + if (retv) goto final; + } + } else { + if (write){ + retv = proc_dointvec(ctl, write, filp, buffer, lenp); + if (retv) goto final; + retv = awc_proc_format_bits(write, &awc_int_buff, lenp, rid_dir, rid); + if (retv) goto final; + } else { + retv = awc_proc_format_bits(write, &awc_int_buff, lenp,rid_dir, rid); + if (retv) goto final; + retv = proc_dointvec(ctl, write, filp, buffer, lenp); + if (retv) goto final; + } + } + if (write) { + save_flags(flags); + cli(); + + if (rid->selector->MAC_Disable_at_write){ + awc_disable_MAC(dev); + }; + awc_writerid(dev,rid,rid_dir->buff + rid->offset); + if (rid->selector->MAC_Disable_at_write){ + awc_enable_MAC(dev); + }; + restore_flags(flags); + + }; + + DEBUG(0x20000,"awc proc ret %x \n",retv); + DEBUG(0x20000,"awc proc lenp %x \n",*lenp); + + MOD_DEC_USE_COUNT; + return retv; + +final: + + AWC_ENTRY_EXIT_DEBUG("exit"); + MOD_DEC_USE_COUNT; + return -1 ; +} + + +char conf_reset_result[200]; + + +ctl_table awc_exdev_table[] = { + {0, NULL, NULL,0, 0400, NULL}, + {0} +}; +ctl_table awc_exroot_table[] = { + {254, "aironet4500", NULL, 0, 0555, NULL}, + {0} +}; + +ctl_table awc_driver_proc_table[] = { + {1, "debug" , &awc_debug, sizeof(awc_debug), 0600,NULL, proc_dointvec}, + {2, "bap_sleep" , &bap_sleep, sizeof(bap_sleep), 0600,NULL, proc_dointvec}, + {3, "bap_sleep_after_setup" , &bap_sleep_after_setup, sizeof(bap_sleep_after_setup), 0600,NULL, proc_dointvec}, + {4, "sleep_before_command" , &sleep_before_command, sizeof(sleep_before_command), 0600,NULL, proc_dointvec}, + {5, "bap_sleep_before_write" , &bap_sleep_before_write, sizeof(bap_sleep_before_write), 0600,NULL, proc_dointvec}, + {6, "sleep_in_command" , &sleep_in_command , sizeof(sleep_in_command), 0600,NULL, proc_dointvec}, + {0} +}; + +ctl_table awc_root_table[] = { + {254, "aironet4500", NULL, 0, 0555, awc_driver_proc_table}, + {0} +}; + +struct ctl_table_header * awc_driver_sysctl_header = NULL; + +const char awc_procname[]= "awc5"; + + +int awc_proc_set_device(int device_number){ + int group =0; + int rid = 0; + struct awc_priv * priv; + + + AWC_ENTRY_EXIT_DEBUG("awc_proc_set_device"); + if (!aironet4500_devices[device_number] || (awc_nof_rids <=0 )) return -1 ; + priv = (struct awc_priv * )aironet4500_devices[device_number]->priv; + + awc_rids_setup(aironet4500_devices[device_number]); + + memcpy(&(awc_proc_priv[device_number].proc_table_sys_root[0]), awc_exroot_table,sizeof(struct ctl_table)*2); + awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 254 - device_number; + memcpy(awc_proc_priv[device_number].proc_table_device_root, awc_exdev_table,sizeof(awc_exdev_table) ); + awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = device_number+1; + + awc_proc_priv[device_number].proc_table_sys_root->child = awc_proc_priv[device_number].proc_table_device_root; + memcpy(awc_proc_priv[device_number].proc_name,(struct awc_priv * )aironet4500_devices[device_number]->name,5); + awc_proc_priv[device_number].proc_name[4]=0; + // awc_proc_priv[device_number].proc_name[3]=48+device_number; + awc_proc_priv[device_number].proc_table_device_root[0].procname = &(awc_proc_priv[device_number].proc_name[0]); + awc_proc_priv[device_number].proc_table = kmalloc(sizeof(struct ctl_table) * (awc_nof_rids+2),GFP_KERNEL); + if (!awc_proc_priv[device_number].proc_table){ + printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n"); + return -1; + } + awc_proc_priv[device_number].proc_table_device_root[0].child=awc_proc_priv[device_number].proc_table; + + + if (awc_debug) printk("device %d of %d proc interface setup ",device_number, awc_nof_rids); + + + while (awc_rids[group].selector && group < awc_nof_rids){ + if (awc_debug & 0x20000) + printk(KERN_CRIT "ridgroup %s size %d \n", awc_rids[group].selector->name,awc_rids[group].size); + + awc_proc_priv[device_number].proc_table[group].ctl_name = group +1; + awc_proc_priv[device_number].proc_table[group+1].ctl_name = 0; + awc_proc_priv[device_number].proc_table[group].procname = awc_rids[group].selector->name; + awc_proc_priv[device_number].proc_table[group].data = awc_proc_buff; + awc_proc_priv[device_number].proc_table[group].maxlen = sizeof(awc_proc_buff) -1; + awc_proc_priv[device_number].proc_table[group].mode = 0600; + awc_proc_priv[device_number].proc_table[group].child = kmalloc(sizeof(struct ctl_table) * (awc_rids[group].size +2), GFP_KERNEL); + awc_proc_priv[device_number].proc_table[group].proc_handler = NULL; + awc_proc_priv[device_number].proc_table[group].strategy = NULL; + awc_proc_priv[device_number].proc_table[group].de = NULL; + awc_proc_priv[device_number].proc_table[group].extra1 = NULL; + awc_proc_priv[device_number].proc_table[group].extra2 = NULL; + if (!awc_proc_priv[device_number].proc_table[group].child) { + awc_proc_priv[device_number].proc_table[group].ctl_name = 0; + printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n"); + return 0; + } + rid=0; + while (awc_rids[group].rids[rid].selector && (rid < awc_rids[group].size -1)){ + +// DEBUG(0x20000,"rid %s \n", awc_rids[group].rids[rid].name); + + awc_proc_priv[device_number].proc_table[group].child[rid].ctl_name = rid +1; + awc_proc_priv[device_number].proc_table[group].child[rid+1].ctl_name = 0; + awc_proc_priv[device_number].proc_table[group].child[rid].procname = awc_rids[group].rids[rid].name; + if (awc_rids[group].rids[rid].array > 1 || + awc_rids[group].rids[rid].bits > 32 ){ + awc_proc_priv[device_number].proc_table[group].child[rid].data = awc_proc_buff; + awc_proc_priv[device_number].proc_table[group].child[rid].maxlen = sizeof(awc_proc_buff) -1; + } else { + awc_proc_priv[device_number].proc_table[group].child[rid].data = &awc_int_buff; + awc_proc_priv[device_number].proc_table[group].child[rid].maxlen = sizeof(awc_int_buff); + + } + if ( awc_rids[group].rids[rid].read_only || + awc_rids[group].rids[rid].selector->read_only ) + awc_proc_priv[device_number].proc_table[group].child[rid].mode = 0400; + else + awc_proc_priv[device_number].proc_table[group].child[rid].mode = 0600; + awc_proc_priv[device_number].proc_table[group].child[rid].child = NULL; + awc_proc_priv[device_number].proc_table[group].child[rid].proc_handler = awc_proc_fun; + awc_proc_priv[device_number].proc_table[group].child[rid].strategy = NULL; + awc_proc_priv[device_number].proc_table[group].child[rid].de = NULL; + awc_proc_priv[device_number].proc_table[group].child[rid].extra1 = (void *) &(((struct awc_private* )aironet4500_devices[device_number]->priv)->rid_dir[group]); + awc_proc_priv[device_number].proc_table[group].child[rid].extra2 = (void *) &(awc_rids[group].rids[rid]); + + rid++; + } + + group++; + + }; + + awc_proc_priv[device_number].sysctl_header = + register_sysctl_table(awc_proc_priv[device_number].proc_table_sys_root,0); + + AWC_ENTRY_EXIT_DEBUG("exit"); + + if (awc_proc_priv[device_number].sysctl_header) + return 0; + return 1; + +}; + +int awc_proc_unset_device(int device_number){ + int k; + + AWC_ENTRY_EXIT_DEBUG("awc_proc_unset_device"); + if (awc_proc_priv[device_number].sysctl_header){ + unregister_sysctl_table(awc_proc_priv[device_number].sysctl_header); + awc_proc_priv[device_number].sysctl_header = NULL; + } + if (awc_proc_priv[device_number].proc_table){ + for (k=0; awc_proc_priv[device_number].proc_table[k].ctl_name ; k++ ){ + if (awc_proc_priv[device_number].proc_table[k].child) + kfree(awc_proc_priv[device_number].proc_table[k].child); + } + kfree(awc_proc_priv[device_number].proc_table); + awc_proc_priv[device_number].proc_table = NULL; + } + if (awc_proc_priv[device_number].proc_table_device_root[0].ctl_name) + awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = 0; + if (awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name) + awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 0; + + AWC_ENTRY_EXIT_DEBUG("exit"); + return 0; +}; + +int init_module(void) { + int i=0; + + AWC_ENTRY_EXIT_DEBUG("init_module"); + + + for (i=0; i < MAX_AWCS; i++){ + awc_proc_set_device(i); + } + + awc_register_proc(awc_proc_set_device, awc_proc_unset_device); + + awc_driver_sysctl_header = register_sysctl_table(awc_root_table,0); + + AWC_ENTRY_EXIT_DEBUG("exit"); + return 0; + +}; + +void cleanup_module(void){ + + int i=0; + AWC_ENTRY_EXIT_DEBUG("cleanup_module"); + awc_unregister_proc(); + for (i=0; i < MAX_AWCS; i++){ + awc_proc_unset_device(i); + } + if (awc_driver_sysctl_header) + unregister_sysctl_table(awc_driver_sysctl_header); + AWC_ENTRY_EXIT_DEBUG("exit"); +}; + +#endif // whole proc system styff \ No newline at end of file diff -u --recursive --new-file v2.3.30/linux/drivers/net/aironet4500_rid.c linux/drivers/net/aironet4500_rid.c --- v2.3.30/linux/drivers/net/aironet4500_rid.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/aironet4500_rid.c Tue Dec 7 23:58:22 1999 @@ -0,0 +1,2199 @@ +/* + * Aironet 4500 Pcmcia driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ + +#include +#include + +#include "aironet4500.h" + + + +#define awc_RID_gen_RidLen {(const struct aironet4500_rid_selector *)&aironet4500_RID_Select_General_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" } +#define awc_RID_gen_OperatingMode_adhoc {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" } // Without AP +#define awc_RID_gen_OperatingMode_Infrastructure {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" }// With AP +#define awc_RID_gen_OperatingMode_AP {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" } // Aironet doesnt release info on use +#define awc_RID_gen_OperatingMode_AP_and_repeater {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" } // no info +#define awc_RID_gen_OperatingMode_No_payload_modify {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" } +#define awc_RID_gen_OperatingMode_LLC_802_3_convert {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" } +#define awc_RID_gen_OperatingMode_proprietary_ext {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" } // neened for 11Mbps +#define awc_RID_gen_OperatingMode_no_proprietary_ext {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" } +#define awc_RID_gen_OperatingMode_AP_ext {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" } // no info +#define awc_RID_gen_OperatingMode_no_AP_ext {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" } +#define awc_RID_gen_ReceiveMode {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000ffff,0x0000,"RX Mode"} +#define awc_RID_gen_ReceiveMode_BMA {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"} +#define awc_RID_gen_ReceiveMode_BA {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"} +#define awc_RID_gen_ReceiveMode_A {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"} +#define awc_RID_gen_ReceiveMode_802_11_monitor {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"} +#define awc_RID_gen_ReceiveMode_802_11_any_monitor {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"} +#define awc_RID_gen_ReceiveMode_LAN_monitor {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"} +#define awc_RID_gen_ReceiveMode_802_3_hdr_disable {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"} +#define awc_RID_gen_ReceiveMode_802_3_hdr_enable {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"} +#define awc_RID_gen_Fragmentation_threshold {&aironet4500_RID_Select_General_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"} // treshold of packet size starting to be fragmented +#define awc_RID_gen_RTS_threshold {&aironet4500_RID_Select_General_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"} // packet size, larger ones get sent with RTS/CTS +#define awc_RID_gen_Station_Mac_Id {&aironet4500_RID_Select_General_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"} +#define awc_RID_gen_Supported_rates {&aironet4500_RID_Select_General_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"} // Hex encoded 500kbps +#define awc_RID_gen_Basic_Rate {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"} // if 0x80 bit is set +#define awc_RID_gen_Rate_500kbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"} +#define awc_RID_gen_Rate_1Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"} +#define awc_RID_gen_Rate_2Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"} +#define awc_RID_gen_Rate_4Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"} +#define awc_RID_gen_Rate_5Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"} +#define awc_RID_gen_Rate_10Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"} +#define awc_RID_gen_Rate_11Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"} +#define awc_RID_gen_BasicRate_500kbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"} +#define awc_RID_gen_BasicRate_1Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"} +#define awc_RID_gen_BasicRate_2Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"} +#define awc_RID_gen_BasicRate_4Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"} +#define awc_RID_gen_BasicRate_5Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"} +#define awc_RID_gen_BasicRate_10Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"} +#define awc_RID_gen_BasicRate_11Mbps {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"} + + +#define awc_RID_gen_Long_retry_limit {&aironet4500_RID_Select_General_Config,0x0018,16, 1,1,0,0,0,0,"Short Retry Limit"} +#define awc_RID_gen_Short_retry_limit {&aironet4500_RID_Select_General_Config,0x001A,16, 1,1,0,0,0,0,"Long Retry Limit"} +#define awc_RID_gen_Tx_MSDU_lifetime {&aironet4500_RID_Select_General_Config,0x001C,16, 1,1000,0,0,0,0,"TX MSDU Lifetime"} +#define awc_RID_gen_Rx_MSDU_lifetime {&aironet4500_RID_Select_General_Config,0x001E,16, 1,1000,0,0,0,0,"RX MSDU Lifetime"} +#define awc_RID_gen_Stationary {&aironet4500_RID_Select_General_Config,0x0020,16, 1,1,0,0,0,0,"Stationary"} +#define awc_RID_gen_BC_MC_Ordering {&aironet4500_RID_Select_General_Config,0x0022,16, 1,1,0,0,0,0,"Strictly order Bcast and Mcast"} +#define awc_RID_gen_Device_type {&aironet4500_RID_Select_General_Config,0x0024,16, 1,1,1,0,0xffff,0x0065,"Radio Type PC4500"} +#define awc_RID_gen_Reserved_0x0026 {&aironet4500_RID_Select_General_Config,0x0026, 8,10,1,0,0,0,0,"Reserved 0x0028"} + + +//SCANNING/ASSOCIATING +#define awc_RID_gen_ScanMode awc_def_gen_RID(0x0030,"ScanMode", 16,0xf,0, NULL) +#define awc_RID_gen_ScanMode_Active awc_def_gen_RID(0x0030,"ScanMode Active", 16,0xf,0, "Active") +#define awc_RID_gen_ScanMode_Passive awc_def_gen_RID(0x0030,"ScanMode Passive", 16,0xf,1, "Passive") +#define awc_RID_gen_ScanMode_Aironet_ext awc_def_gen_RID(0x0030,"ScanMode Aironet Ext", 16,0xf,2, "Aironet Ext") +#define awc_RID_gen_ProbeDelay awc_def_gen_RID(0x0032,"ProbeDelay", 16,0xffff,0," msek") // Time ms to wait after switching to a channel for clear channel assessment. +#define awc_RID_gen_ProbeEnergyTimeout awc_def_gen_RID(0x0034,"ProbeEnergyTimeout", 16,0xffff,0,"msek") // Time to wait for energy after an active probe. +#define awc_RID_gen_ProbeResponseTimeout awc_def_gen_RID(0x0036,"ProbeResponseTimeout", 16,0xffff,0,"msek") // Time to wait for a probe response after energy detected. +#define awc_RID_gen_BeaconListenTimeout awc_def_gen_RID(0x0038,"BeaconListenTimeout", 16,0xffff,0,"msek") // 0 default 40 Time to listen for a beacon on each channel. +#define awc_RID_gen_IbssJoinNetTimeout awc_def_gen_RID(0x003A,"IbssJoinNetTimeout", 16,0xffff,0,"msek") // 0 default 10000 IBSS: Time to scan for an IBSS before forming a +#define awc_RID_gen_AuthenticationTimeout awc_def_gen_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek") // 0 default 2000 Time limit after which an authentication sequence will +#define awc_RID_gen_AuthenticationType awc_def_gen_RID(0x003E,"AuthenticationType", 16,0xffff,0,NULL) // 0 default 1 (open) // Selects the desired authentication and privacy methods. +#define awc_RID_gen_AuthenticationType_None awc_def_gen_RID(0x003E,"AuthenticationType None", 16,0xffff,0,"None") // 0x00 = None +#define awc_RID_gen_AuthenticationType_Open awc_def_gen_RID(0x003E,"AuthenticationType Open", 16,0xffff,1,"Open") // 0x01 = Open +#define awc_RID_gen_AuthenticationType_Shared awc_def_gen_RID(0x003E,"AuthenticationType Shared-Key", 16,0xffff,2,"Shared-Key") // 0x02 = Shared-Key +#define awc_RID_gen_AuthenticationType_Exclude_Open awc_def_gen_RID(0x003E,"AuthenticationType Exclude Open", 16,0xffff,4,"Exclude Open") // 0x04 = Exclude Unencrypted +#define awc_RID_gen_AssociationTimeout awc_def_gen_RID(0x0040,"AssociationTimeout", 16,0xffff,0,"msek") // 0 default 2000 ESS: Time limit after which an association sequence +#define awc_RID_gen_SpecifiedAPtimeout awc_def_gen_RID(0x0042,"SpecifiedAPtimeout", 16,0xffff,0,"msek") // 0 default 10000 0 selects the factory default [~10 sec]. +#define awc_RID_gen_OfflineScanInterval awc_def_gen_RID(0x0044,"OfflineScanInterval", 16,0xffff,0,"msek") // 0 0 0 disables offline scanning.(kus) The time period between offline scans. +#define awc_RID_gen_OfflineScanDuration awc_def_gen_RID(0x0046,"OfflineScanDuration", 16,0xffff,0,"msek") // 0 0 0 disables offline scanning. // (kus) The duration of an offline scan. +#define awc_RID_gen_LinkLossDelay awc_def_gen_RID(0x0048,"LinkLossDelay", 16,0xffff,0,"msek") // 0 0 Time to delay before reporting a loss of association +#define awc_RID_gen_MaxBeaconLostTime awc_def_gen_RID(0x004A,"MaxBeaconLostTime", 16,0xffff,0,"msek") // 0 default 500 If no beacons are received for this time period, the unit +#define awc_RID_gen_RefreshInterval awc_def_gen_RID(0x004C,"RefreshInterval", 16,0xffff,0,"msek") // 0 default 10000 At the specified interval, the station will send a refresh +//POWER SAVE OPERATION +#define awc_RID_gen_PowerSaveMode awc_def_gen_RID(0x0050,"PowerSaveMode", 16,0xffff,0,NULL) // 0 0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero. +#define awc_RID_gen_PowerSaveMode_CAM awc_def_gen_RID(0x0050,"PowerSaveMode CAM", 16,0x000f,0,"CAM") // 0 = CAM +#define awc_RID_gen_PowerSaveMode_PSP awc_def_gen_RID(0x0050,"PowerSaveMode PSP", 16,0x000f,1,"PSP") // 1 = PSP +#define awc_RID_gen_PowerSaveMode_Fast_PSP awc_def_gen_RID(0x0050,"PowerSaveMode Fast PSP", 16,0x000f,2,"Fast PSP") //2 = PSP-CAM [FASTPSP] +#define awc_RID_gen_SleepForDTIMs awc_def_gen_RID(0x0052,"SleepForDTIMs", 16,0xffff,0,"DTIMs") // 0 0If non-zero, the station may sleep through DTIMs; this +#define awc_RID_gen_ListenInterval awc_def_gen_RID(0x0054,"ListenInterval", 16,0xffff,0,"msek") // 0 default 200 kus Maximum time to awaken for TIMs. 0 selects factory +#define awc_RID_gen_FastListenInterval awc_def_gen_RID(0x0056,"FastListenInterval", 16,0xffff,0,"msek") // 0 default 100 kus The listen interval to be used immediately after +#define awc_RID_gen_ListenDecay awc_def_gen_RID(0x0058,"ListenDecay", 16,0xffff,0,"times") // 0 default 2Number of times to use the current listen interval +#define awc_RID_gen_FastListenDelay awc_def_gen_RID(0x005A,"FastListenDelay", 16,0xffff,0,"msek") // 0 default 200 kus Time interval to delay before going to fast listen +#define awc_RID_gen_Reserved0x005C awc_def_gen_RID(0x005C,"Reserved0x005C", 32,0,0,"") // +//ADHOC (or AP) OPERATION +#define awc_RID_gen_BeaconPeriod awc_def_gen_RID(0x0060,"BeaconPeriod", 16,0xffff,0,"msek") // 0 default 100 0 selects the factory default of [~100 ms]. (kus) +#define awc_RID_gen_AtimDuration awc_def_gen_RID(0x0062,"AtimDuration", 16,0xffff,0,"msek") // 0 default 5 kus The time period reserved for ATIMs immediately after (kus) the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS. +#define awc_RID_gen_Reserved0x0064 awc_def_gen_RID(0x0064,"Reserved64", 16,0xffff,0,"") // 0 0Reserved for future use +#define awc_RID_gen_DSChannel awc_def_gen_RID(0x0066,"DSChannel", 16,0xffff,0,"") // 0 default 1The desired operating channel. ()refer to 802.11) For North America, a Channel of 0 is 2412 MHz. +#define awc_RID_gen_Reserved0x0068 awc_def_gen_RID(0x0068,"Reserved68", 16,0xffff,0,"") // 0 0Reserved for future use +#define awc_RID_gen_DTIM_Period awc_def_gen_RID(0x006A,"DTIM Period", 16,0xffff,0,"") // 0 default 1Selects how often a beacon is a DTIM for APs +#define awc_RID_gen_Reserved0x0006C awc_def_gen_RID(0x006C,"Reserved6C", 32,0xffffffff,0,"") // 0's0's Reserved for future use +//RADIO OPERATION +#define awc_RID_gen_RadioSpreadType awc_def_gen_RID(0x0070,"RadioSpreadType", 16,0xffff,0,NULL) // 0 default 0Selects the radio operational mode. By default, this will +#define awc_RID_gen_RadioSpreadType_FH awc_def_gen_RID(0x0070,"RadioSpreadType FH", 16,0xffff,0,"FH") //0 = 802.11 FH Radio (Default) +#define awc_RID_gen_RadioSpreadType_DS awc_def_gen_RID(0x0070,"RadioSpreadType DS", 16,0xffff,1,"DS") //1 = 802.11 DS Radio +#define awc_RID_gen_RadioSpreadType_LM awc_def_gen_RID(0x0070,"RadioSpreadType LM2000", 16,0xffff,2,"LM2000") //2 = LM2000 (Legacy) DS Radio +#define awc_RID_gen_TX_antenna_Diversity awc_def_gen_RID(0x0072,"TX antenna Diversity", 16,0xff00,0,NULL) // 0 default 0x0303 This field is bit-mapped to select the operational +#define awc_RID_gen_TX_antenna_Diversity_default awc_def_gen_RID(0x0072,"TX antenna Diversity Default", 16,0xff00,0x0000,"Default") // 0 = Diversity as programmed at the factory +#define awc_RID_gen_TX_antenna_Diversity_1 awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 1", 16,0xff00,0x0100,"Antenna 1") // 1 = Antenna 1 only +#define awc_RID_gen_TX_antenna_Diversity_2 awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 2", 16,0xff00,0x0200,"Antenna 2") // 2 = Antenna 2 only +#define awc_RID_gen_TX_antenna_Diversity_both awc_def_gen_RID(0x0072,"TX antenna Diversity both antennas", 16,0xff00,0x0300,"both antennas") // 3 = Antennas 1 and 2 are active +#define awc_RID_gen_RX_antenna_Diversity awc_def_gen_RID(0x0072,"RX antenna Diversity", 16,0x00ff,0,NULL) // 0 default 0x0303 This field is bit-mapped to select the operational +#define awc_RID_gen_RX_antenna_Diversity_default awc_def_gen_RID(0x0072,"RX antenna Diversity Default", 16,0x00ff,0,"Default") // 0 = Diversity as programmed at the factory +#define awc_RID_gen_RX_antenna_Diversity_1 awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 1", 16,0x00ff,1,"Antenna 1") // 1 = Antenna 1 only +#define awc_RID_gen_RX_antenna_Diversity_2 awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 2", 16,0x00ff,2,"Antenna 2") // 2 = Antenna 2 only +#define awc_RID_gen_RX_antenna_Diversity_both awc_def_gen_RID(0x0072,"RX antenna Diversity both antennas", 16,0x00ff,3,"both antennas") // +#define awc_RID_gen_TransmitPower awc_def_gen_RID(0x0074,"TransmitPower", 16,0xffff,0,"mW (rounded up, btw)") // 0 default 250 or 0 selects the default (maximum power allowed for the +#define awc_RID_gen_RSSIthreshold awc_def_gen_RID(0x0076,"RSSIthreshold", 16,0xffff,0,"units") // 0 default 0 RSSI threshold. 0 selects factory default. +#define awc_RID_gen_Modulation awc_def_gen_RID(0x0078,"Modulation", 8,0xff,0,"") // modulation type +#define awc_RID_gen_Reserved0x0079 awc_def_gen_RID(0x0079,"Reserved0x0079", 56,0xff,0,"") // 0's0's reserved for future radio specific parameters + + +//AIRONET EXTENSIONS +#define awc_RID_gen_NodeName awc_def_gen_RID(0x0080,"NodeName", 128,0,0,"") // 0 0 Station name. +#define awc_RID_gen_ARLThreshold awc_def_gen_RID(0x0090,"ARLThreshold", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_gen_ARLDecay awc_def_gen_RID(0x0092,"ARLDecay", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_gen_ARLDelay awc_def_gen_RID(0x0094,"ARLDelay", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_gen_Unused0x0096 awc_def_gen_RID(0x0096,"Unused", 16,0,0,"") // +#define awc_RID_gen_MagicPacketAction awc_def_gen_RID(0x0098,"MagicPacketAction", 8,0xff,0," hell knows what") // 0 0 0 selects no action to be taken on a magic packet and" +#define awc_RID_gen_MagicPacketControl awc_def_gen_RID(0x0099,"MagicPacketControl", 8,0xff,0," hell know what") // 0 0 0 will disable the magic packet mode command" + + +#define awc_RID_act_RidLen {&aironet4500_RID_Select_Active_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" } +#define awc_RID_act_OperatingMode_adhoc {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" } +#define awc_RID_act_OperatingMode_Infrastructure {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" } +#define awc_RID_act_OperatingMode_AP {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" } +#define awc_RID_act_OperatingMode_AP_and_repeater {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" } +#define awc_RID_act_OperatingMode_No_payload_modify {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" } +#define awc_RID_act_OperatingMode_LLC_802_3_convert {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" } +#define awc_RID_act_OperatingMode_proprietary_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" } +#define awc_RID_act_OperatingMode_no_proprietary_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" } +#define awc_RID_act_OperatingMode_AP_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" } +#define awc_RID_act_OperatingMode_no_AP_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" } +#define awc_RID_act_ReceiveMode {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0xffffffff,0x0000,"RX Mode"} +#define awc_RID_act_ReceiveMode_BMA {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"} +#define awc_RID_act_ReceiveMode_BA {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"} +#define awc_RID_act_ReceiveMode_A {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"} +#define awc_RID_act_ReceiveMode_802_11_monitor {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"} +#define awc_RID_act_ReceiveMode_802_11_any_monitor {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"} +#define awc_RID_act_ReceiveMode_LAN_monitor {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"} +#define awc_RID_act_ReceiveMode_802_3_hdr_disable {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"} +#define awc_RID_act_ReceiveMode_802_3_hdr_enable {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"} +#define awc_RID_act_Fragmentation_threshold {&aironet4500_RID_Select_Active_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"} +#define awc_RID_act_RTS_threshold {&aironet4500_RID_Select_Active_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"} +#define awc_RID_act_Station_Mac_Id {&aironet4500_RID_Select_Active_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"} +#define awc_RID_act_Supported_rates {&aironet4500_RID_Select_Active_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"} +#define awc_RID_act_Basic_Rate {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"} +#define awc_RID_act_Rate_500kbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"} +#define awc_RID_act_Rate_1Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"} +#define awc_RID_act_Rate_2Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"} +#define awc_RID_act_Rate_4Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"} +#define awc_RID_act_Rate_5Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"} +#define awc_RID_act_Rate_10Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"} +#define awc_RID_act_Rate_11Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"} +#define awc_RID_act_BasicRate_500kbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"} +#define awc_RID_act_BasicRate_1Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"} +#define awc_RID_act_BasicRate_2Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"} +#define awc_RID_act_BasicRate_4Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"} +#define awc_RID_act_BasicRate_5Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"} +#define awc_RID_act_BasicRate_10Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"} +#define awc_RID_act_BasicRate_11Mbps {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"} + + +#define awc_RID_act_Long_retry_limit {&aironet4500_RID_Select_Active_Config,0x0018,16, 1,1,0,0,0,0,"Short Retry Limit"} +#define awc_RID_act_Short_retry_limit {&aironet4500_RID_Select_Active_Config,0x001A,16, 1,1,0,0,0,0,"Long Retry Limit"} +#define awc_RID_act_Tx_MSDU_lifetime {&aironet4500_RID_Select_Active_Config,0x001C,16, 1,1000,0,0,0,0,"TX MSDU Lifetime"} +#define awc_RID_act_Rx_MSDU_lifetime {&aironet4500_RID_Select_Active_Config,0x001E,16, 1,1000,0,0,0,0,"RX MSDU Lifetime"} +#define awc_RID_act_Stationary {&aironet4500_RID_Select_Active_Config,0x0020,16, 1,1,0,0,0,0,"Stationary"} +#define awc_RID_act_BC_MC_Ordering {&aironet4500_RID_Select_Active_Config,0x0022,16, 1,1,0,0,0,0,"Strictly order Bcast and Mcast"} +#define awc_RID_act_Device_type {&aironet4500_RID_Select_Active_Config,0x0024,16, 1,1,1,0,0xffff,0x0065,"Radio Type PC4500"} +#define awc_RID_act_Reserved_0x0026 {&aironet4500_RID_Select_Active_Config,0x0026, 8,10,1,0,0,0,0,"Reserved 0x0028"} + + +//SCANNING/ASSOCIATING +#define awc_RID_act_ScanMode awc_def_act_RID(0x0030,"ScanMode", 16,0xf,0, NULL) +#define awc_RID_act_ScanMode_Active awc_def_act_RID(0x0030,"ScanMode Active", 16,0xf,0, "Active") +#define awc_RID_act_ScanMode_Passive awc_def_act_RID(0x0030,"ScanMode Passive", 16,0xf,1, "Passive") +#define awc_RID_act_ScanMode_Aironet_ext awc_def_act_RID(0x0030,"ScanMode Aironet Ext", 16,0xf,2, "Aironet Ext") +#define awc_RID_act_ProbeDelay awc_def_act_RID(0x0032,"ProbeDelay", 16,0xffff,0," msek") // Time ms to wait after switching to a channel for clear channel assessment. +#define awc_RID_act_ProbeEnergyTimeout awc_def_act_RID(0x0034,"ProbeEnergyTimeout", 16,0xffff,0,"msek") // Time to wait for energy after an active probe. +#define awc_RID_act_ProbeResponseTimeout awc_def_act_RID(0x0036,"ProbeResponseTimeout", 16,0xffff,0,"msek") // Time to wait for a probe response after energy detected. +#define awc_RID_act_BeaconListenTimeout awc_def_act_RID(0x0038,"BeaconListenTimeout", 16,0xffff,0,"msek") // 0 default 40 Time to listen for a beacon on each channel. +#define awc_RID_act_IbssJoinNetTimeout awc_def_act_RID(0x003A,"IbssJoinNetTimeout", 16,0xffff,0,"msek") // 0 default 10000 IBSS: Time to scan for an IBSS before forming a +#define awc_RID_act_AuthenticationTimeout awc_def_act_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek") // 0 default 2000 Time limit after which an authentication sequence will +#define awc_RID_act_AuthenticationType awc_def_act_RID(0x003E,"AuthenticationType", 16,0xffff,0,NULL) // 0 default 1 (open) // Selects the desired authentication and privacy methods. +#define awc_RID_act_AuthenticationType_None awc_def_act_RID(0x003E,"AuthenticationType None", 16,0xffff,0,"None") // 0x00 = None +#define awc_RID_act_AuthenticationType_Open awc_def_act_RID(0x003E,"AuthenticationType Open", 16,0xffff,1,"Open") // 0x01 = Open +#define awc_RID_act_AuthenticationType_Shared awc_def_act_RID(0x003E,"AuthenticationType Shared-Key", 16,0xffff,2,"Shared-Key") // 0x02 = Shared-Key +#define awc_RID_act_AuthenticationType_Exclude_Open awc_def_act_RID(0x003E,"AuthenticationType Exclude Open", 16,0xffff,4,"Exclude Open") // 0x04 = Exclude Unencrypted +#define awc_RID_act_AssociationTimeout awc_def_act_RID(0x0040,"AssociationTimeout", 16,0xffff,0,"msek") // 0 default 2000 ESS: Time limit after which an association sequence +#define awc_RID_act_SpecifiedAPtimeout awc_def_act_RID(0x0042,"SpecifiedAPtimeout", 16,0xffff,0,"msek") // 0 default 10000 0 selects the factory default [~10 sec]. +#define awc_RID_act_OfflineScanInterval awc_def_act_RID(0x0044,"OfflineScanInterval", 16,0xffff,0,"msek") // 0 0 0 disables offline scanning.(kus) The time period between offline scans. +#define awc_RID_act_OfflineScanDuration awc_def_act_RID(0x0046,"OfflineScanDuration", 16,0xffff,0,"msek") // 0 0 0 disables offline scanning. // (kus) The duration of an offline scan. +#define awc_RID_act_LinkLossDelay awc_def_act_RID(0x0048,"LinkLossDelay", 16,0xffff,0,"msek") // 0 0 Time to delay before reporting a loss of association +#define awc_RID_act_MaxBeaconLostTime awc_def_act_RID(0x004A,"MaxBeaconLostTime", 16,0xffff,0,"msek") // 0 default 500 If no beacons are received for this time period, the unit +#define awc_RID_act_RefreshInterval awc_def_act_RID(0x004C,"RefreshInterval", 16,0xffff,0,"msek") // 0 default 10000 At the specified interval, the station will send a refresh +//POWER SAVE OPERATION +#define awc_RID_act_PowerSaveMode awc_def_act_RID(0x0050,"PowerSaveMode", 16,0xffff,0,NULL) // 0 0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero. +#define awc_RID_act_PowerSaveMode_CAM awc_def_act_RID(0x0050,"PowerSaveMode CAM", 16,0x000f,0,"CAM") // 0 = CAM +#define awc_RID_act_PowerSaveMode_PSP awc_def_act_RID(0x0050,"PowerSaveMode PSP", 16,0x000f,1,"PSP") // 1 = PSP +#define awc_RID_act_PowerSaveMode_Fast_PSP awc_def_act_RID(0x0050,"PowerSaveMode Fast PSP", 16,0x000f,2,"Fast PSP") //2 = PSP-CAM [FASTPSP] +#define awc_RID_act_SleepForDTIMs awc_def_act_RID(0x0052,"SleepForDTIMs", 16,0xffff,0,"DTIMs") // 0 0If non-zero, the station may sleep through DTIMs; this +#define awc_RID_act_ListenInterval awc_def_act_RID(0x0054,"ListenInterval", 16,0xffff,0,"msek") // 0 default 200 kus Maximum time to awaken for TIMs. 0 selects factory +#define awc_RID_act_FastListenInterval awc_def_act_RID(0x0056,"FastListenInterval", 16,0xffff,0,"msek") // 0 default 100 kus The listen interval to be used immediately after +#define awc_RID_act_ListenDecay awc_def_act_RID(0x0058,"ListenDecay", 16,0xffff,0,"times") // 0 default 2Number of times to use the current listen interval +#define awc_RID_act_FastListenDelay awc_def_act_RID(0x005A,"FastListenDelay", 16,0xffff,0,"msek") // 0 default 200 kus Time interval to delay before going to fast listen +#define awc_RID_act_Reserved0x005C awc_def_act_RID(0x005C,"Reserved0x005C", 32,0,0,"") // +//ADHOC (or AP) OPERATION +#define awc_RID_act_BeaconPeriod awc_def_act_RID(0x0060,"BeaconPeriod", 16,0xffff,0,"msek") // 0 default 100 0 selects the factory default of [~100 ms]. (kus) +#define awc_RID_act_AtimDuration awc_def_act_RID(0x0062,"AtimDuration", 16,0xffff,0,"msek") // 0 default 5 kus The time period reserved for ATIMs immediately after (kus) the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS. +#define awc_RID_act_Reserved0x0064 awc_def_act_RID(0x0064,"Reserved64", 16,0xffff,0,"") // 0 0Reserved for future use +#define awc_RID_act_DSChannel awc_def_act_RID(0x0066,"DSChannel", 16,0xffff,0,"") // 0 default 1The desired operating channel. ()refer to 802.11) For North America, a Channel of 0 is 2412 MHz. +#define awc_RID_act_Reserved0x0068 awc_def_act_RID(0x0068,"Reserved68", 16,0xffff,0,"") // 0 0Reserved for future use +#define awc_RID_act_DTIM_Period awc_def_act_RID(0x006A,"DTIM Period", 16,0xffff,0,"") // 0 default 1Selects how often a beacon is a DTIM for APs +#define awc_RID_act_Reserved0x0006C awc_def_act_RID(0x006C,"Reserved6C", 32,0xffffffff,0,"") // 0's0's Reserved for future use +//RADIO OPERATION +#define awc_RID_act_RadioSpreadType awc_def_act_RID(0x0070,"RadioSpreadType", 16,0xffff,0,NULL) // 0 default 0Selects the radio operational mode. By default, this will +#define awc_RID_act_RadioSpreadType_FH awc_def_act_RID(0x0070,"RadioSpreadType FH", 16,0xffff,0,"FH") //0 = 802.11 FH Radio (Default) +#define awc_RID_act_RadioSpreadType_DS awc_def_act_RID(0x0070,"RadioSpreadType DS", 16,0xffff,1,"DS") //1 = 802.11 DS Radio +#define awc_RID_act_RadioSpreadType_LM awc_def_act_RID(0x0070,"RadioSpreadType LM2000", 16,0xffff,2,"LM2000") //2 = LM2000 (Legacy) DS Radio +#define awc_RID_act_TX_antenna_Diversity awc_def_act_RID(0x0072,"TX antenna Diversity", 16,0xff00,0,NULL) // 0 default 0x0303 This field is bit-mapped to select the operational +#define awc_RID_act_TX_antenna_Diversity_default awc_def_act_RID(0x0072,"TX antenna Diversity Default", 16,0xff00,0x0000,"Default") // 0 = Diversity as programmed at the factory +#define awc_RID_act_TX_antenna_Diversity_1 awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 1", 16,0xff00,0x0100,"Antenna 1") // 1 = Antenna 1 only +#define awc_RID_act_TX_antenna_Diversity_2 awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 2", 16,0xff00,0x0200,"Antenna 2") // 2 = Antenna 2 only +#define awc_RID_act_TX_antenna_Diversity_both awc_def_act_RID(0x0072,"TX antenna Diversity both antennas", 16,0xff00,0x0300,"both antennas") // 3 = Antennas 1 and 2 are active +#define awc_RID_act_RX_antenna_Diversity awc_def_act_RID(0x0072,"RX antenna Diversity", 16,0x00ff,0,NULL) // 0 default 0x0303 This field is bit-mapped to select the operational +#define awc_RID_act_RX_antenna_Diversity_default awc_def_act_RID(0x0072,"RX antenna Diversity Default", 16,0x00ff,0,"Default") // 0 = Diversity as programmed at the factory +#define awc_RID_act_RX_antenna_Diversity_1 awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 1", 16,0x00ff,1,"Antenna 1") // 1 = Antenna 1 only +#define awc_RID_act_RX_antenna_Diversity_2 awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 2", 16,0x00ff,2,"Antenna 2") // 2 = Antenna 2 only +#define awc_RID_act_RX_antenna_Diversity_both awc_def_act_RID(0x0072,"RX antenna Diversity both antennas", 16,0x00ff,3,"both antennas") // +#define awc_RID_act_TransmitPower awc_def_act_RID(0x0074,"TransmitPower", 16,0xffff,0,"mW (rounded up, btw)") // 0 default 250 or 0 selects the default (maximum power allowed for the +#define awc_RID_act_RSSIthreshold awc_def_act_RID(0x0076,"RSSIthreshold", 16,0xffff,0,"units") // 0 default 0 RSSI threshold. 0 selects factory default. +#define awc_RID_act_Reserved0x0078 awc_def_act_RID(0x0078,"Reserved0x0078", 64,0,0,"") // 0's0's reserved for future radio specific parameters +#define awc_RID_act_Modulation awc_def_act_RID(0x0078,"Modulation", 8,0xff,0,"") // modulation type +#define awc_RID_act_Reserved0x0079 awc_def_act_RID(0x0079,"Reserved0x0079", 56,0xff,0,"") // 0's0's reserved for future radio specific parameters + +//AIRONET EXTENSIONS +#define awc_RID_act_NodeName awc_def_act_RID(0x0080,"NodeName", 128,0,0,"") // 0 0 Station name. +#define awc_RID_act_ARLThreshold awc_def_act_RID(0x0090,"ARLThreshold", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_act_ARLDecay awc_def_act_RID(0x0092,"ARLDecay", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_act_ARLDelay awc_def_act_RID(0x0094,"ARLDelay", 16,0xffff,0,"times") // 0 default 0xFFFF 0 selects the factory defaults. (which for now is +#define awc_RID_act_Unused0x0096 awc_def_act_RID(0x0096,"Unused", 16,0,0,"") // +#define awc_RID_act_MagicPacketAction awc_def_act_RID(0x0098,"MagicPacketAction", 8,0xff,0," hell knows what") // 0 0 0 selects no action to be taken on a magic packet and" +#define awc_RID_act_MagicPacketControl awc_def_act_RID(0x0099,"MagicPacketControl", 8,0xff,0," hell know what") // 0 0 0 will disable the magic packet mode command" + + + +// *************************** SSID RID + + + +#define awc_RID_SSID_RidLen awc_def_SSID_RID(0x0000,"RidLen", 16,0xffff,0,"") //RidLen ",16,0xffff,,"") // read-only Length of this RID including the length field 0x68 +#define awc_RID_SSID_Accept_any awc_def_SSID_RID(0x0002,"Accept Any SSID", 16,0xffff,0,"Accept ANY SSID") // +#define awc_RID_SSIDlen1 awc_def_SSID_RID(0x0002,"SSIDlen1", 16,0xffff,0,"") // 7 The length of the SSID1 byte string. +#define awc_RID_SSID1 awc_def_SSID_RID(0x0004,"SSID1", 255,0,0,"") // "tsunami" The identifier uniquely identifying the wireless system. +#define awc_RID_SSIDlen2 awc_def_SSID_RID(0x0024,"SSIDlen2", 16,0xffff,0,"") // 0 The length of the SSID2 byte string. +#define awc_RID_SSID2 awc_def_SSID_RID(0x0026,"SSID2", 255,0,0,"") // 0's The identifier uniquely identifying the wireless system. +#define awc_RID_SSIDlen3 awc_def_SSID_RID(0x0046,"SSIDlen3", 16,0xffff,0,"") // 0 The length of the SSID3 byte string. +#define awc_RID_SSID3 awc_def_SSID_RID(0x0048,"SSID3", 255,0,0,"") // 0's The identifier uniquely identifying the wireless system. + +// AP list + +#define awc_RID_AP_List_RidLen awc_def_AP_List_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_AP_List_SpecifiedAP1 awc_def_AP_List_RID(0x0002,"SpecifiedAP1", 48,0xff,0,"") // 0 Specifies the MAC address of an access point to attempt to associate to first, before looking for other Access Points +#define awc_RID_AP_List_SpecifiedAP2 awc_def_AP_List_RID(0x0008,"SpecifiedAP2", 48,0xff,0,"") // 0 Allows for a secondary AP to associate to if the radio cannot associate to the primary AP. +#define awc_RID_AP_List_SpecifiedAP3 awc_def_AP_List_RID(0x000E,"SpecifiedAP3", 48,0xff,0,"") // 0 Allows for a third option when specifying a list of APs. +#define awc_RID_AP_List_SpecifiedAP4 awc_def_AP_List_RID(0x0014,"SpecifiedAP4", 48,0xff,0,"") // 0 Allows for a fourth option when specifying a list of APs. + +// Driver Name + +#define awc_RID_Dname_RidLen awc_def_Dname_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_Dname_DriverName awc_def_Dname_RID(0x0002,"DriverName", 128,0,0,"") // The driver name and version can be written here for debugging support + + +// Encapsulation Transformations RID + +#define awc_RID_Enc_RidLen awc_def_Enc_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_Enc_EtherType1 awc_def_Enc_RID(0x0002,"EtherType1", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_1 awc_def_Enc_RID(0x0004,"RX Action 1", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_1_RFC_1042 awc_def_Enc_RID(0x0004,"RX Action 1", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_1_802_11 awc_def_Enc_RID(0x0004,"RX Action 1", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_1 awc_def_Enc_RID(0x0004,"TX Action 1", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_1_RFC_1042 awc_def_Enc_RID(0x0004,"TX Action 1", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_1_802_11 awc_def_Enc_RID(0x0004,"Tx Action 1", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType2 awc_def_Enc_RID(0x0006,"EtherType2", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_2 awc_def_Enc_RID(0x0008,"RX Action 2", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_2_RFC_1042 awc_def_Enc_RID(0x0008,"RX Action 2", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_2_802_11 awc_def_Enc_RID(0x0008,"RX Action 2", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_2 awc_def_Enc_RID(0x0008,"TX Action 2", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_2_RFC_1042 awc_def_Enc_RID(0x0008,"TX Action 2", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_2_802_11 awc_def_Enc_RID(0x0008,"Tx Action 2", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType3 awc_def_Enc_RID(0x000A,"EtherType3", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_3 awc_def_Enc_RID(0x000C,"RX Action 3", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_3_RFC_1042 awc_def_Enc_RID(0x000C,"RX Action 3", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_3_802_11 awc_def_Enc_RID(0x000C,"RX Action 3", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_3_ awc_def_Enc_RID(0x000C,"TX Action 3", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_3_RFC_1042 awc_def_Enc_RID(0x000C,"TX Action 3", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_3_802_11 awc_def_Enc_RID(0x000C,"Tx Action 3", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType4 awc_def_Enc_RID(0x000E,"EtherType4", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_4 awc_def_Enc_RID(0x0010,"RX Action 4", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_4_RFC_1042 awc_def_Enc_RID(0x0010,"RX Action 4", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_4_802_11 awc_def_Enc_RID(0x0010,"RX Action 4", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_4 awc_def_Enc_RID(0x0010,"TX Action 4", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_4_RFC_1042 awc_def_Enc_RID(0x0010,"TX Action 4", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_4_802_11 awc_def_Enc_RID(0x0010,"Tx Action 4", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType5 awc_def_Enc_RID(0x0012,"EtherType5", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_5 awc_def_Enc_RID(0x0014,"RX Action 5", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_5_RFC_1042 awc_def_Enc_RID(0x0014,"RX Action 5", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_5_802_11 awc_def_Enc_RID(0x0014,"RX Action 5", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_5 awc_def_Enc_RID(0x0014,"TX Action 5", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_5_RFC_1042 awc_def_Enc_RID(0x0014,"TX Action 5", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_5_802_11 awc_def_Enc_RID(0x0014,"Tx Action 5", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType6 awc_def_Enc_RID(0x0016,"EtherType6", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_6 awc_def_Enc_RID(0x0018,"RX Action 6", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_6_RFC_1042 awc_def_Enc_RID(0x0018,"RX Action 6", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_6_802_11 awc_def_Enc_RID(0x0018,"RX Action 6", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_6 awc_def_Enc_RID(0x0018,"TX Action 6", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_6_RFC_1042 awc_def_Enc_RID(0x0018,"TX Action 6", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_6_802_11 awc_def_Enc_RID(0x0018,"Tx Action 6", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType7 awc_def_Enc_RID(0x001A,"EtherType7", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_7 awc_def_Enc_RID(0x001C,"RX Action 8", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_7_RFC_1042 awc_def_Enc_RID(0x001C,"RX Action 7", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_7_802_11 awc_def_Enc_RID(0x001C,"RX Action 7", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_7 awc_def_Enc_RID(0x001C,"TX Action 7", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_7_RFC_1042 awc_def_Enc_RID(0x001C,"TX Action 7", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_7_802_11 awc_def_Enc_RID(0x001C,"Tx Action 7", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_EtherType8 awc_def_Enc_RID(0x001E,"EtherType7", 16,0xffff,0,"") // 0 Note, the ethertype values are in network transmission order. So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action. +#define awc_RID_Enc_Action_RX_8 awc_def_Enc_RID(0x0020,"RX Action 8", 16,0x0001,0,NULL) // 0 This field is bit encoded as follows: +#define awc_RID_Enc_Action_RX_8_RFC_1042 awc_def_Enc_RID(0x0020,"RX Action 8", 16,0x0001,1,"RX RFC1042") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_RX_8_802_11 awc_def_Enc_RID(0x0020,"RX Action 8", 16,0x0001,0,"RX 802.11") // bit 0 (0x0001) 1=RFC1042 is kept for receive packets. +#define awc_RID_Enc_Action_TX_8 awc_def_Enc_RID(0x0020,"TX Action 8", 16,0x0002,0,NULL) // +#define awc_RID_Enc_Action_TX_8_RFC_1042 awc_def_Enc_RID(0x0020,"TX Action 8", 16,0x0002,1,"TX 802.11" ) // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. +#define awc_RID_Enc_Action_TX_8_802_11 awc_def_Enc_RID(0x0020,"Tx Action 8", 16,0x0002,0,"TX RFC1042") // bit 1 (0x0002) 0=RFC1042 is used for transmit encapsulation. 1=802.1H is used for transmit encapsulation. + + +// WEP Key volatile +#define awc_RID_WEPv_RidLen awc_def_WEPv_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_WEPv_KeyIndex awc_def_WEPv_RID(0x0002,"KeyIndex", 16,0xffff,0,"Index to list of keys") +#define awc_RID_WEPv_Address awc_def_WEPv_RID(0x0004,"Address", 48,0xff,0,"mac address related to keys") +#define awc_RID_WEPv_KeyLen awc_def_WEPv_RID(0x000A,"KeyLen", 16,0xffff,0,"Key Length (0 and 5 are valid)") +#define awc_RID_WEPv_Key awc_def_WEPv_RID(0x000C,"Key", 128,0xff,0,"Key itself in hex coding") +#define awc_RID_WEPv_KeyAscii awc_def_WEPv_RID(0x000C,"KeyAscii", 128,0,0,"Key itself in ascii coding") + +// WEP Key non-volatile +#define awc_RID_WEPnv_RidLen awc_def_WEPnv_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_WEPnv_KeyIndex awc_def_WEPnv_RID(0x0002,"KeyIndex", 16,0xffff,0,"Index to list of keys") +#define awc_RID_WEPnv_Address awc_def_WEPnv_RID(0x0004,"Address", 48,0xff,0,"mac address related to keys") +#define awc_RID_WEPnv_KeyLen awc_def_WEPnv_RID(0x000A,"KeyLen", 16,0xffff,0,"Key Length (0 and 5 are valid)") +#define awc_RID_WEPnv_Key awc_def_WEPnv_RID(0x000C,"Key", 128,0xff,0,"Key itself in hex coding") +#define awc_RID_WEPnv_KeyAscii awc_def_WEPnv_RID(0x000C,"KeyAscii", 128,0,0,"Key itself in ascii coding") + +// Modulation +#define awc_RID_Modulation_RidLen awc_def_Modulation_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_Modulation_Modulation awc_def_Modulation_RID(0x0002,"Modulation", 16,0xffff,0,"Modulation") + + +// Capabilities RID +#define awc_RID_Cap_RidLen awc_def_Cap_RID(0x0000,"RidLen", 16,0xffff,0,"") // read-only Length of this RID including the length field +#define awc_RID_Cap_OUI awc_def_Cap_RID(0x0002,"OUI", 24,0xffff,0,"") // 0x00 0x40 This field will give the manufacturer OUI (fourth byte always zero). +#define awc_RID_Cap_ProductNum awc_def_Cap_RID(0x0006,"ProductNum", 24,0xffff,0,"") // 0x0004 This field will give the product number. +#define awc_RID_Cap_ManufacturerName awc_def_Cap_RID(0x0008,"ManufacturerName", 255,0,0,"") // ASCIIz encoding of manufacturer name. +#define awc_RID_Cap_ProductName awc_def_Cap_RID(0x0028,"ProductName", 128,0,0,"") // PC4500 ASCIIz encoding of product name. +#define awc_RID_Cap_ProductVersion awc_def_Cap_RID(0x0038,"ProductVersion", 64,0,0,"") // . ASCIIz encoding of product (firmware?) version. +#define awc_RID_Cap_FactoryAddress awc_def_Cap_RID(0x0040,"FactoryAddress", 48,0xff,0,"") // This field will contain the OEM assigned IEEE address. If there is no OEM address assigned, the Aironet assigned IEEE Address will be returned in this field. +#define awc_RID_Cap_AironetAddress awc_def_Cap_RID(0x0046,"AironetAddress", 48,0xff,0,"") // This field will contain the Aironet factory assigned IEEE address. +#define awc_RID_Cap_RadioSpreadType_DS awc_def_Cap_RID(0x004C,"RadioType_FH", 16,0x0001,1,"") // 0x01 = 802.11 FH +#define awc_RID_Cap_RadioSpreadType_FH awc_def_Cap_RID(0x004C,"RadioType_DS", 16,0x0002,2,"") // 0x02 = 802.11 DS +#define awc_RID_Cap_RadioSpreadType_Legacy awc_def_Cap_RID(0x004C,"RadioType_Legacy", 16,0x0004,4,"") // 0x04 = LM2000 (Legacy) DS // Note, more than one bit may be set for radios supporting multiple modes of operation. +#define awc_RID_Cap_RegDomain awc_def_Cap_RID(0x004E,"RegDomain", 16,0xffff,0,"") // This field indicates the registration domain/country The values as assigned by 802.11 will be used. +#define awc_RID_Cap_Callid awc_def_Cap_RID(0x0050,"Callid", 48,0xff,0,"") // This field indicates the callid assigned to the unit (if RegDomain is Japan) Each nibble will contain one decimal digit of the 12 digit callid. (Note, this is not the encoded format). +#define awc_RID_Cap_SupportedRates awc_def_Cap_RID(0x0056,"SupportedRates", 64,0xff,0,"") // 0x02, 0x04, This field will indicate the 802.11 supported rates as specified in the rates. +#define awc_RID_Cap_RxDiversity awc_def_Cap_RID(0x005E,"RxDiversity", 8 ,0xff,0,"") // 0x03 This field will indicate the number of antennas supported as a bit mask. +#define awc_RID_Cap_TxDiversity awc_def_Cap_RID(0x005F,"TxDiversity", 8 ,0xff,0,"") // 0x03 This field will indicate the number of antennas supported as a bit mask. +#define awc_RID_Cap_TxPowerLevels awc_def_Cap_RID(0x0060,"TxPowerLevels", 128,0xff,0,"") // 250 This table indicates the supported transmit power levels. (values are in mW) Zero terminates the list. Note, this may be further restricted depending on country selected. +#define awc_RID_Cap_HardwareVersion awc_def_Cap_RID(0x0070,"HardwareVersion", 16,0xffff,0,"") // 0 This indicates the revision of hardware. +#define awc_RID_Cap_HardwareCapabilit awc_def_Cap_RID(0x0072,"HardwareCapabilit", 16,0xffff,0,"") // 0 This is a bit-mapped field indicating harware capabilities. No bits have been assigned yet. Initially this is zero. +#define awc_RID_Cap_TemperatureRange awc_def_Cap_RID(0x0074,"TemperatureRange", 16,0xffff,0,"") // 0 This indicates the temperature range capability. +#define awc_RID_Cap_SoftwareVersion awc_def_Cap_RID(0x0076,"SoftwareVersion", 16,0xffff,0,"") // 0 This indicates the revision of software. +#define awc_RID_Cap_SoftwareVersion_major awc_def_Cap_RID(0x0076,"SoftwareVersion major", 16,0xff00,0,"") // The upper byte indicates the major version and the +#define awc_RID_Cap_SoftwareVersion_minor awc_def_Cap_RID(0x0076,"SoftwareVersion minor", 16,0x00ff,0,"") // lower byte the minor version. +#define awc_RID_Cap_SoftwareSubVersion awc_def_Cap_RID(0x0078,"SoftwareSubVersio", 16,0xffff,0,"") // 0 This indicates the sub-revision of software. +#define awc_RID_Cap_InterfaceVersion awc_def_Cap_RID(0x007A,"InterfaceVersion", 16,0xffff,0,"") // 0 This indicates the revision of the interface. This will be bumped whenever there are incompatible modifications made to the interfac This may be bumped on first release to ensure that "unreleased" utilities/drivers become unusable. +#define awc_RID_Cap_SoftwareCapabilities awc_def_Cap_RID(0x007C,"SoftwareCapabiliti", 160,0xff,0,"") // 0 This field gives a bit mapped indication of capabilities. No capability bits have yet been assigned. +#define awc_RID_Cap_BootBlockVersion awc_def_Cap_RID(0x007E,"BootBlockVersion ", 16,0xffff,0,"") // This indicates the revision of bootblock software. The upper byte indicates the major version and the lower byte the minor version. Note, BCD encoding is used. (version 2.11 would be 0x0211.) + + +// Status RID + +#define awc_RID_Status_RidLen awc_def_Stat_RID( 0x0000,"RidLen", 16,0xffff,0,"") // Length of this RID including the length field +#define awc_RID_Status_MacAddress awc_def_Stat_RID( 0x0002,"MacAddress", 48,0xff,0,"") // The MAC address in use by the station. +#define awc_RID_Status_OperationalMode awc_def_Stat_RID( 0x0008,"OperationalMode", 16,0xffff,0,NULL) // Bit-mapped. +#define awc_RID_Status_Configured awc_def_Stat_RID( 0x0008,"OperationalMode Configured", 16,0x0001,1,"Configured") // +#define awc_RID_Status_MAC_Enabled awc_def_Stat_RID( 0x0008,"OperationalMode MAC Enabled", 16,0x0002,2,"MAC Enabled") // +#define awc_RID_Status_Receive_Enabled awc_def_Stat_RID( 0x0008,"OperationalMode Receive Enabled", 16,0x0004,4,"Receive Enabled") // +#define awc_RID_Status_In_Sync awc_def_Stat_RID( 0x0008,"OperationalMode In Sync with cell", 16,0x0010,10,"In Sync with cell") // +#define awc_RID_Status_Associated awc_def_Stat_RID( 0x0008,"OperationalMode Associated", 16,0x0020,20,"Associated") // +#define awc_RID_Status_Error awc_def_Stat_RID( 0x0008,"OperationalMode Error", 16,0x8000,0x8000,"Error") // +#define awc_RID_Status_ErrorCode awc_def_Stat_RID( 0x000A,"ErrorCode", 16,0xffff,0,"") // Non-zero if an error state has been entered +#define awc_RID_Status_CurrentSignalQuality awc_def_Stat_RID( 0x000C,"CurrentSignalQuality",16,0xffff,0,"") // A measure of the current signal quality. +#define awc_RID_Status_SSIDlength awc_def_Stat_RID( 0x000E,"SSIDlength", 16,0xffff,0,"") // This length of the following SSID. +#define awc_RID_Status_SSID awc_def_Stat_RID( 0x0010,"SSID", 255,0,0,"") // The SSID that is currently in effect. +#define awc_RID_Status_ApName awc_def_Stat_RID( 0x0030,"ApName", 128,0,0,"") // The name of the current BSSID (ESS mode only) +#define awc_RID_Status_CurrentBssid awc_def_Stat_RID( 0x0040,"CurrentBssid", 48,0xff,0,"") // BSSID that is currently in effect. +#define awc_RID_Status_PreviousBssid1 awc_def_Stat_RID( 0x0046,"PreviousBssid1", 48,0xff,0,"") // A former BSSID. +#define awc_RID_Status_PreviousBssid2 awc_def_Stat_RID( 0x004C,"PreviousBssid2", 48,0xff,0,"") // A former BSSID. +#define awc_RID_Status_PreviousBssid3 awc_def_Stat_RID( 0x0052,"PreviousBssid3", 48,0xff,0,"") // A former BSSID. +#define awc_RID_Status_BeaconPeriod awc_def_Stat_RID( 0x0058,"BeaconPeriod", 16,0xffff,0,"msek") // (kus) The current beacon period. +#define awc_RID_Status_DtimPeriod awc_def_Stat_RID( 0x005A,"DtimPeriod", 16,0xffff,0,"units") // The current DTIM period (number of beacons between DTIMs). +#define awc_RID_Status_AtimDuration awc_def_Stat_RID( 0x005C,"AtimDuration", 16,0xffff,0,"msek") // (kus) The current ATIM window duration. Adhoc/Ibss only +#define awc_RID_Status_HopPeriod awc_def_Stat_RID( 0x005E,"HopPeriod", 16,0xffff,0,"msek") // (kus) The current hopping period. +#define awc_RID_Status_ChannelSet awc_def_Stat_RID( 0x0060,"ChannelSet", 16,0xffff,0,"Set") // The current channel set. +#define awc_RID_Status_Channel awc_def_Stat_RID( 0x0062,"Channel", 16,0xffff,0," ") // The current operating channel. +#define awc_RID_Status_HopsToBackbone awc_def_Stat_RID( 0x0064,"HopsToBackbone", 16,0xffff,0,"hops") // 0 indicates a backbone association. +#define awc_RID_Status_ApTotalLoad awc_def_Stat_RID( 0x0066,"ApTotalLoad", 16,0xffff,0,"units") // Total load including broadcast/multicast from backbone. This is the value extracted from the Aironet element. +#define awc_RID_Status_OurGeneratedLoad awc_def_Stat_RID( 0x0068,"OurGeneratedLoad", 16,0xffff,0,"units") // Total load generated by our station (transmitted and received). Excludes received broadcast/multicast traffic. +#define awc_RID_Status_AccumulatedArl awc_def_Stat_RID( 0x006A,"AccumulatedArl", 16,0xffff,0,"units") // + +// AP RID + +#define awc_RID_AP_16RidLen awc_def_AP_RID(0x0000,"RidLen", 16,0xffff,0,"") // 0x06, read-only Length of this RID including the length field +#define awc_RID_AP_TIM_addr awc_def_AP_RID(0x0002,"TIM Addr", 16,0xffff,0,"") // Read only The "Traffic Indication Map" is updated by the host via +#define awc_RID_AP_Airo_addr awc_def_AP_RID(0x0004,"Airo Addr", 16,0xffff,0,"") // Read only The "Aironet Information Element" is updated by the host via the AUX I/O ports. This is the address of the Aironet Element. + + +// Statistics RID + +#define awc_RID_Stats_RidLen awc_def_Stats_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats_RxOverrunErr awc_def_Stats_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats_RxPlcpCrcErr awc_def_Stats_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats_RxPlcpFormat awc_def_Stats_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats_RxPlcpLength awc_def_Stats_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats_RxMacCrcErr awc_def_Stats_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats_RxMacCrcOk awc_def_Stats_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats_RxWepErr awc_def_Stats_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_RxWepOk awc_def_Stats_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_RetryLong awc_def_Stats_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_RetryShort awc_def_Stats_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_MaxRetries awc_def_Stats_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACK-d.") +#define awc_RID_Stats_NoAck awc_def_Stats_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats_NoCts awc_def_Stats_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats_RxAck awc_def_Stats_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats_RxCts awc_def_Stats_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats_TxAck awc_def_Stats_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats_TxRts awc_def_Stats_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats_TxCts awc_def_Stats_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats_TxMc awc_def_Stats_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_TxBc awc_def_Stats_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats_TxUcFrags awc_def_Stats_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_TxUcPackets awc_def_Stats_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats_TxBeacon awc_def_Stats_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats_RxBeacon awc_def_Stats_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats_TxSinColl awc_def_Stats_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats_TxMulColl awc_def_Stats_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats_DefersNo awc_def_Stats_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats_DefersProt awc_def_Stats_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats_DefersEngy awc_def_Stats_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats_DupFram awc_def_Stats_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats_RxFragDisc awc_def_Stats_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats_TxAged awc_def_Stats_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats_RxAged awc_def_Stats_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats_LostSync_Max awc_def_Stats_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats_LostSync_Mis awc_def_Stats_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats_LostSync_Arl awc_def_Stats_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats_LostSync_Dea awc_def_Stats_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats_LostSync_Disa awc_def_Stats_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats_LostSync_Tsf awc_def_Stats_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats_HostTxMc awc_def_Stats_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats_HostTxBc awc_def_Stats_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats_HostTxUc awc_def_Stats_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats_HostTxFail awc_def_Stats_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats_HostRxMc awc_def_Stats_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats_HostRxBc awc_def_Stats_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats_HostRxUc awc_def_Stats_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats_HostRxDiscar awc_def_Stats_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats_HmacTxMc awc_def_Stats_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats_HmacTxBc awc_def_Stats_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats_HmacTxUc awc_def_Stats_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats_HmacTxFail awc_def_Stats_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats_HmacRxMc awc_def_Stats_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_HmacRxBc awc_def_Stats_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats_HmacRxUc awc_def_Stats_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_HmacRxDisca awc_def_Stats_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats_HmacRxAcce awc_def_Stats_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats_SsidMismatch awc_def_Stats_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats_ApMismatch awc_def_Stats_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats_RatesMismatc awc_def_Stats_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats_AuthReject awc_def_Stats_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats_AuthTimeout awc_def_Stats_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats_AssocReject awc_def_Stats_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats_AssocTimeout awc_def_Stats_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats_NewReason awc_def_Stats_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats_AuthFail_1 awc_def_Stats_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats_AuthFail_2 awc_def_Stats_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats_AuthFail_3 awc_def_Stats_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats_AuthFail_4 awc_def_Stats_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats_AuthFail_5 awc_def_Stats_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats_AuthFail_6 awc_def_Stats_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats_AuthFail_7 awc_def_Stats_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats_AuthFail_8 awc_def_Stats_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left)") +#define awc_RID_Stats_AuthFail_9 awc_def_Stats_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats_AuthFail_10 awc_def_Stats_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats_AuthFail_11 awc_def_Stats_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats_AuthFail_12 awc_def_Stats_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats_AuthFail_13 awc_def_Stats_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats_AuthFail_14 awc_def_Stats_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats_AuthFail_15 awc_def_Stats_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats_AuthFail_16 awc_def_Stats_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats_AuthFail_17 awc_def_Stats_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats_AuthFail_18 awc_def_Stats_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats_AuthFail_19 awc_def_Stats_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats_RxMan awc_def_Stats_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats_TxMan awc_def_Stats_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats_RxRefresh awc_def_Stats_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats_TxRefresh awc_def_Stats_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats_RxPoll awc_def_Stats_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats_TxPoll awc_def_Stats_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats_HostRetries awc_def_Stats_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats_LostSync_HostReq awc_def_Stats_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats_HostTxBytes awc_def_Stats_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats_HostRxBytes awc_def_Stats_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats_ElapsedUsec awc_def_Stats_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats_ElapsedSec awc_def_Stats_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats_LostSyncBett awc_def_Stats_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") + + + +#define awc_RID_Stats_delta_RidLen awc_def_Stats_delta_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats_delta_RxOverrunErr awc_def_Stats_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats_delta_RxPlcpCrcErr awc_def_Stats_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats_delta_RxPlcpFormat awc_def_Stats_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats_delta_RxPlcpLength awc_def_Stats_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats_delta_RxMacCrcErr awc_def_Stats_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats_delta_RxMacCrcOk awc_def_Stats_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats_delta_RxWepErr awc_def_Stats_delta_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_delta_RxWepOk awc_def_Stats_delta_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_delta_RetryLong awc_def_Stats_delta_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_delta_RetryShort awc_def_Stats_delta_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_delta_MaxRetries awc_def_Stats_delta_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACKd.") +#define awc_RID_Stats_delta_NoAck awc_def_Stats_delta_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats_delta_NoCts awc_def_Stats_delta_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats_delta_RxAck awc_def_Stats_delta_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats_delta_RxCts awc_def_Stats_delta_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats_delta_TxAck awc_def_Stats_delta_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats_delta_TxRts awc_def_Stats_delta_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats_delta_TxCts awc_def_Stats_delta_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats_delta_TxMc awc_def_Stats_delta_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_delta_TxBc awc_def_Stats_delta_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats_delta_TxUcFrags awc_def_Stats_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_delta_TxUcPackets awc_def_Stats_delta_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats_delta_TxBeacon awc_def_Stats_delta_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats_delta_RxBeacon awc_def_Stats_delta_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats_delta_TxSinColl awc_def_Stats_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats_delta_TxMulColl awc_def_Stats_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats_delta_DefersNo awc_def_Stats_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats_delta_DefersProt awc_def_Stats_delta_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats_delta_DefersEngy awc_def_Stats_delta_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats_delta_DupFram awc_def_Stats_delta_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats_delta_RxFragDisc awc_def_Stats_delta_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats_delta_TxAged awc_def_Stats_delta_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats_delta_RxAged awc_def_Stats_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats_delta_LostSync_Max awc_def_Stats_delta_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats_delta_LostSync_Mis awc_def_Stats_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats_delta_LostSync_Arl awc_def_Stats_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats_delta_LostSync_Dea awc_def_Stats_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats_delta_LostSync_Disa awc_def_Stats_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats_delta_LostSync_Tsf awc_def_Stats_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats_delta_HostTxMc awc_def_Stats_delta_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats_delta_HostTxBc awc_def_Stats_delta_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats_delta_HostTxUc awc_def_Stats_delta_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats_delta_HostTxFail awc_def_Stats_delta_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats_delta_HostRxMc awc_def_Stats_delta_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats_delta_HostRxBc awc_def_Stats_delta_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats_delta_HostRxUc awc_def_Stats_delta_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats_delta_HostRxDiscar awc_def_Stats_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats_delta_HmacTxMc awc_def_Stats_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats_delta_HmacTxBc awc_def_Stats_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats_delta_HmacTxUc awc_def_Stats_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats_delta_HmacTxFail awc_def_Stats_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats_delta_HmacRxMc awc_def_Stats_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_delta_HmacRxBc awc_def_Stats_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats_delta_HmacRxUc awc_def_Stats_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_delta_HmacRxDisca awc_def_Stats_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats_delta_HmacRxAcce awc_def_Stats_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats_delta_SsidMismatch awc_def_Stats_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats_delta_ApMismatch awc_def_Stats_delta_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats_delta_RatesMismatc awc_def_Stats_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats_delta_AuthReject awc_def_Stats_delta_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats_delta_AuthTimeout awc_def_Stats_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats_delta_AssocReject awc_def_Stats_delta_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats_delta_AssocTimeout awc_def_Stats_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats_delta_NewReason awc_def_Stats_delta_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats_delta_AuthFail_1 awc_def_Stats_delta_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats_delta_AuthFail_2 awc_def_Stats_delta_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats_delta_AuthFail_3 awc_def_Stats_delta_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats_delta_AuthFail_4 awc_def_Stats_delta_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats_delta_AuthFail_5 awc_def_Stats_delta_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats_delta_AuthFail_6 awc_def_Stats_delta_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats_delta_AuthFail_7 awc_def_Stats_delta_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats_delta_AuthFail_8 awc_def_Stats_delta_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left)") +#define awc_RID_Stats_delta_AuthFail_9 awc_def_Stats_delta_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats_delta_AuthFail_10 awc_def_Stats_delta_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats_delta_AuthFail_11 awc_def_Stats_delta_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats_delta_AuthFail_12 awc_def_Stats_delta_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats_delta_AuthFail_13 awc_def_Stats_delta_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats_delta_AuthFail_14 awc_def_Stats_delta_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats_delta_AuthFail_15 awc_def_Stats_delta_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats_delta_AuthFail_16 awc_def_Stats_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats_delta_AuthFail_17 awc_def_Stats_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats_delta_AuthFail_18 awc_def_Stats_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats_delta_AuthFail_19 awc_def_Stats_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats_delta_RxMan awc_def_Stats_delta_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats_delta_TxMan awc_def_Stats_delta_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats_delta_RxRefresh awc_def_Stats_delta_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats_delta_TxRefresh awc_def_Stats_delta_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats_delta_RxPoll awc_def_Stats_delta_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats_delta_TxPoll awc_def_Stats_delta_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats_delta_HostRetries awc_def_Stats_delta_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats_delta_LostSync_HostReq awc_def_Stats_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats_delta_HostTxBytes awc_def_Stats_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats_delta_HostRxBytes awc_def_Stats_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats_delta_ElapsedUsec awc_def_Stats_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats_delta_ElapsedSec awc_def_Stats_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats_delta_LostSyncBett awc_def_Stats_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") + + + +#define awc_RID_Stats_clear_RidLen awc_def_Stats_clear_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats_clear_RxOverrunErr awc_def_Stats_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats_clear_RxPlcpCrcErr awc_def_Stats_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats_clear_RxPlcpFormat awc_def_Stats_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats_clear_RxPlcpLength awc_def_Stats_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats_clear_RxMacCrcErr awc_def_Stats_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats_clear_RxMacCrcOk awc_def_Stats_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats_clear_RxWepErr awc_def_Stats_clear_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_clear_RxWepOk awc_def_Stats_clear_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats_clear_RetryLong awc_def_Stats_clear_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_clear_RetryShort awc_def_Stats_clear_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats_clear_MaxRetries awc_def_Stats_clear_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACKd.") +#define awc_RID_Stats_clear_NoAck awc_def_Stats_clear_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats_clear_NoCts awc_def_Stats_clear_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats_clear_RxAck awc_def_Stats_clear_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats_clear_RxCts awc_def_Stats_clear_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats_clear_TxAck awc_def_Stats_clear_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats_clear_TxRts awc_def_Stats_clear_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats_clear_TxCts awc_def_Stats_clear_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats_clear_TxMc awc_def_Stats_clear_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_clear_TxBc awc_def_Stats_clear_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats_clear_TxUcFrags awc_def_Stats_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats_clear_TxUcPackets awc_def_Stats_clear_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats_clear_TxBeacon awc_def_Stats_clear_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats_clear_RxBeacon awc_def_Stats_clear_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats_clear_TxSinColl awc_def_Stats_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats_clear_TxMulColl awc_def_Stats_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats_clear_DefersNo awc_def_Stats_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats_clear_DefersProt awc_def_Stats_clear_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats_clear_DefersEngy awc_def_Stats_clear_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats_clear_DupFram awc_def_Stats_clear_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats_clear_RxFragDisc awc_def_Stats_clear_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats_clear_TxAged awc_def_Stats_clear_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats_clear_RxAged awc_def_Stats_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats_clear_LostSync_Max awc_def_Stats_clear_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats_clear_LostSync_Mis awc_def_Stats_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats_clear_LostSync_Arl awc_def_Stats_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats_clear_LostSync_Dea awc_def_Stats_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats_clear_LostSync_Disa awc_def_Stats_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats_clear_LostSync_Tsf awc_def_Stats_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats_clear_HostTxMc awc_def_Stats_clear_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats_clear_HostTxBc awc_def_Stats_clear_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats_clear_HostTxUc awc_def_Stats_clear_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats_clear_HostTxFail awc_def_Stats_clear_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats_clear_HostRxMc awc_def_Stats_clear_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats_clear_HostRxBc awc_def_Stats_clear_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats_clear_HostRxUc awc_def_Stats_clear_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats_clear_HostRxDiscar awc_def_Stats_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats_clear_HmacTxMc awc_def_Stats_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats_clear_HmacTxBc awc_def_Stats_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats_clear_HmacTxUc awc_def_Stats_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats_clear_HmacTxFail awc_def_Stats_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats_clear_HmacRxMc awc_def_Stats_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_clear_HmacRxBc awc_def_Stats_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats_clear_HmacRxUc awc_def_Stats_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats_clear_HmacRxDisca awc_def_Stats_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats_clear_HmacRxAcce awc_def_Stats_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats_clear_SsidMismatch awc_def_Stats_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats_clear_ApMismatch awc_def_Stats_clear_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats_clear_RatesMismatc awc_def_Stats_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats_clear_AuthReject awc_def_Stats_clear_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats_clear_AuthTimeout awc_def_Stats_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats_clear_AssocReject awc_def_Stats_clear_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats_clear_AssocTimeout awc_def_Stats_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats_clear_NewReason awc_def_Stats_clear_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats_clear_AuthFail_1 awc_def_Stats_clear_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats_clear_AuthFail_2 awc_def_Stats_clear_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats_clear_AuthFail_3 awc_def_Stats_clear_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats_clear_AuthFail_4 awc_def_Stats_clear_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats_clear_AuthFail_5 awc_def_Stats_clear_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats_clear_AuthFail_6 awc_def_Stats_clear_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats_clear_AuthFail_7 awc_def_Stats_clear_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats_clear_AuthFail_8 awc_def_Stats_clear_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left)") +#define awc_RID_Stats_clear_AuthFail_9 awc_def_Stats_clear_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats_clear_AuthFail_10 awc_def_Stats_clear_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats_clear_AuthFail_11 awc_def_Stats_clear_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats_clear_AuthFail_12 awc_def_Stats_clear_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats_clear_AuthFail_13 awc_def_Stats_clear_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats_clear_AuthFail_14 awc_def_Stats_clear_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats_clear_AuthFail_15 awc_def_Stats_clear_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats_clear_AuthFail_16 awc_def_Stats_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats_clear_AuthFail_17 awc_def_Stats_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats_clear_AuthFail_18 awc_def_Stats_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats_clear_AuthFail_19 awc_def_Stats_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats_clear_RxMan awc_def_Stats_clear_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats_clear_TxMan awc_def_Stats_clear_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats_clear_RxRefresh awc_def_Stats_clear_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats_clear_TxRefresh awc_def_Stats_clear_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats_clear_RxPoll awc_def_Stats_clear_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats_clear_TxPoll awc_def_Stats_clear_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats_clear_HostRetries awc_def_Stats_clear_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats_clear_LostSync_HostReq awc_def_Stats_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats_clear_HostTxBytes awc_def_Stats_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats_clear_HostRxBytes awc_def_Stats_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats_clear_ElapsedUsec awc_def_Stats_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats_clear_ElapsedSec awc_def_Stats_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats_clear_LostSyncBett awc_def_Stats_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") + + + +#define awc_RID_Stats16_RidLen awc_def_Stats16_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats16_RxOverrunErr awc_def_Stats16_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats16_RxPlcpCrcErr awc_def_Stats16_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats16_RxPlcpFormat awc_def_Stats16_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats16_RxPlcpLength awc_def_Stats16_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats16_RxMacCrcErr awc_def_Stats16_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats16_RxMacCrcOk awc_def_Stats16_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats16_RxWepErr awc_def_Stats16_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_RxWepOk awc_def_Stats16_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_RetryLong awc_def_Stats16_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_RetryShort awc_def_Stats16_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_MaxRetries awc_def_Stats16_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACKd.") +#define awc_RID_Stats16_NoAck awc_def_Stats16_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats16_NoCts awc_def_Stats16_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats16_RxAck awc_def_Stats16_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats16_RxCts awc_def_Stats16_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats16_TxAck awc_def_Stats16_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats16_TxRts awc_def_Stats16_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats16_TxCts awc_def_Stats16_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats16_TxMc awc_def_Stats16_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_TxBc awc_def_Stats16_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats16_TxUcFrags awc_def_Stats16_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_TxUcPackets awc_def_Stats16_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats16_TxBeacon awc_def_Stats16_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats16_RxBeacon awc_def_Stats16_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats16_TxSinColl awc_def_Stats16_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats16_TxMulColl awc_def_Stats16_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats16_DefersNo awc_def_Stats16_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats16_DefersProt awc_def_Stats16_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats16_DefersEngy awc_def_Stats16_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats16_DupFram awc_def_Stats16_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats16_RxFragDisc awc_def_Stats16_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats16_TxAged awc_def_Stats16_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats16_RxAged awc_def_Stats16_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats16_LostSync_Max awc_def_Stats16_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats16_LostSync_Mis awc_def_Stats16_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats16_LostSync_Arl awc_def_Stats16_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats16_LostSync_Dea awc_def_Stats16_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats16_LostSync_Disa awc_def_Stats16_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats16_LostSync_Tsf awc_def_Stats16_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats16_HostTxMc awc_def_Stats16_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats16_HostTxBc awc_def_Stats16_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats16_HostTxUc awc_def_Stats16_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats16_HostTxFail awc_def_Stats16_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats16_HostRxMc awc_def_Stats16_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats16_HostRxBc awc_def_Stats16_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats16_HostRxUc awc_def_Stats16_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats16_HostRxDiscar awc_def_Stats16_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats16_HmacTxMc awc_def_Stats16_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats16_HmacTxBc awc_def_Stats16_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats16_HmacTxUc awc_def_Stats16_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats16_HmacTxFail awc_def_Stats16_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats16_HmacRxMc awc_def_Stats16_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_HmacRxBc awc_def_Stats16_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats16_HmacRxUc awc_def_Stats16_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_HmacRxDisca awc_def_Stats16_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats16_HmacRxAcce awc_def_Stats16_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats16_SsidMismatch awc_def_Stats16_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats16_ApMismatch awc_def_Stats16_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats16_RatesMismatc awc_def_Stats16_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats16_AuthReject awc_def_Stats16_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats16_AuthTimeout awc_def_Stats16_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats16_AssocReject awc_def_Stats16_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats16_AssocTimeout awc_def_Stats16_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats16_NewReason awc_def_Stats16_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats16_AuthFail_1 awc_def_Stats16_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats16_AuthFail_2 awc_def_Stats16_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats16_AuthFail_3 awc_def_Stats16_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats16_AuthFail_4 awc_def_Stats16_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats16_AuthFail_5 awc_def_Stats16_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats16_AuthFail_6 awc_def_Stats16_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats16_AuthFail_7 awc_def_Stats16_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats16_AuthFail_8 awc_def_Stats16_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left)") +#define awc_RID_Stats16_AuthFail_9 awc_def_Stats16_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats16_AuthFail_10 awc_def_Stats16_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats16_AuthFail_11 awc_def_Stats16_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats16_AuthFail_12 awc_def_Stats16_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats16_AuthFail_13 awc_def_Stats16_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats16_AuthFail_14 awc_def_Stats16_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats16_AuthFail_15 awc_def_Stats16_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats16_AuthFail_16 awc_def_Stats16_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats16_AuthFail_17 awc_def_Stats16_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats16_AuthFail_18 awc_def_Stats16_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats16_AuthFail_19 awc_def_Stats16_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats16_RxMan awc_def_Stats16_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats16_TxMan awc_def_Stats16_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats16_RxRefresh awc_def_Stats16_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats16_TxRefresh awc_def_Stats16_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats16_RxPoll awc_def_Stats16_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats16_TxPoll awc_def_Stats16_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats16_HostRetries awc_def_Stats16_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats16_LostSync_HostReq awc_def_Stats16_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats16_HostTxBytes awc_def_Stats16_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats16_HostRxBytes awc_def_Stats16_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats16_ElapsedUsec awc_def_Stats16_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats16_ElapsedSec awc_def_Stats16_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats16_LostSyncBett awc_def_Stats16_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") + + + +#define awc_RID_Stats16_delta_RidLen awc_def_Stats16_delta_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats16_delta_RxOverrunErr awc_def_Stats16_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats16_delta_RxPlcpCrcErr awc_def_Stats16_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats16_delta_RxPlcpFormat awc_def_Stats16_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats16_delta_RxPlcpLength awc_def_Stats16_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats16_delta_RxMacCrcErr awc_def_Stats16_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats16_delta_RxMacCrcOk awc_def_Stats16_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats16_delta_RxWepErr awc_def_Stats16_delta_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_delta_RxWepOk awc_def_Stats16_delta_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_delta_RetryLong awc_def_Stats16_delta_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_delta_RetryShort awc_def_Stats16_delta_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_delta_MaxRetries awc_def_Stats16_delta_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACKd.") +#define awc_RID_Stats16_delta_NoAck awc_def_Stats16_delta_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats16_delta_NoCts awc_def_Stats16_delta_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats16_delta_RxAck awc_def_Stats16_delta_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats16_delta_RxCts awc_def_Stats16_delta_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats16_delta_TxAck awc_def_Stats16_delta_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats16_delta_TxRts awc_def_Stats16_delta_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats16_delta_TxCts awc_def_Stats16_delta_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats16_delta_TxMc awc_def_Stats16_delta_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_delta_TxBc awc_def_Stats16_delta_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats16_delta_TxUcFrags awc_def_Stats16_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_delta_TxUcPackets awc_def_Stats16_delta_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats16_delta_TxBeacon awc_def_Stats16_delta_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats16_delta_RxBeacon awc_def_Stats16_delta_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats16_delta_TxSinColl awc_def_Stats16_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats16_delta_TxMulColl awc_def_Stats16_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats16_delta_DefersNo awc_def_Stats16_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats16_delta_DefersProt awc_def_Stats16_delta_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats16_delta_DefersEngy awc_def_Stats16_delta_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats16_delta_DupFram awc_def_Stats16_delta_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats16_delta_RxFragDisc awc_def_Stats16_delta_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats16_delta_TxAged awc_def_Stats16_delta_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats16_delta_RxAged awc_def_Stats16_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats16_delta_LostSync_Max awc_def_Stats16_delta_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats16_delta_LostSync_Mis awc_def_Stats16_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats16_delta_LostSync_Arl awc_def_Stats16_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats16_delta_LostSync_Dea awc_def_Stats16_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats16_delta_LostSync_Disa awc_def_Stats16_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats16_delta_LostSync_Tsf awc_def_Stats16_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats16_delta_HostTxMc awc_def_Stats16_delta_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats16_delta_HostTxBc awc_def_Stats16_delta_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats16_delta_HostTxUc awc_def_Stats16_delta_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats16_delta_HostTxFail awc_def_Stats16_delta_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats16_delta_HostRxMc awc_def_Stats16_delta_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats16_delta_HostRxBc awc_def_Stats16_delta_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats16_delta_HostRxUc awc_def_Stats16_delta_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats16_delta_HostRxDiscar awc_def_Stats16_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats16_delta_HmacTxMc awc_def_Stats16_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats16_delta_HmacTxBc awc_def_Stats16_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats16_delta_HmacTxUc awc_def_Stats16_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats16_delta_HmacTxFail awc_def_Stats16_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats16_delta_HmacRxMc awc_def_Stats16_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_delta_HmacRxBc awc_def_Stats16_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats16_delta_HmacRxUc awc_def_Stats16_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_delta_HmacRxDisca awc_def_Stats16_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats16_delta_HmacRxAcce awc_def_Stats16_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats16_delta_SsidMismatch awc_def_Stats16_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats16_delta_ApMismatch awc_def_Stats16_delta_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats16_delta_RatesMismatc awc_def_Stats16_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats16_delta_AuthReject awc_def_Stats16_delta_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats16_delta_AuthTimeout awc_def_Stats16_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats16_delta_AssocReject awc_def_Stats16_delta_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats16_delta_AssocTimeout awc_def_Stats16_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats16_delta_NewReason awc_def_Stats16_delta_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats16_delta_AuthFail_1 awc_def_Stats16_delta_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats16_delta_AuthFail_2 awc_def_Stats16_delta_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats16_delta_AuthFail_3 awc_def_Stats16_delta_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats16_delta_AuthFail_4 awc_def_Stats16_delta_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats16_delta_AuthFail_5 awc_def_Stats16_delta_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats16_delta_AuthFail_6 awc_def_Stats16_delta_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats16_delta_AuthFail_7 awc_def_Stats16_delta_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats16_delta_AuthFail_8 awc_def_Stats16_delta_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left)") +#define awc_RID_Stats16_delta_AuthFail_9 awc_def_Stats16_delta_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats16_delta_AuthFail_10 awc_def_Stats16_delta_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats16_delta_AuthFail_11 awc_def_Stats16_delta_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats16_delta_AuthFail_12 awc_def_Stats16_delta_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats16_delta_AuthFail_13 awc_def_Stats16_delta_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats16_delta_AuthFail_14 awc_def_Stats16_delta_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats16_delta_AuthFail_15 awc_def_Stats16_delta_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats16_delta_AuthFail_16 awc_def_Stats16_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats16_delta_AuthFail_17 awc_def_Stats16_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats16_delta_AuthFail_18 awc_def_Stats16_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats16_delta_AuthFail_19 awc_def_Stats16_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats16_delta_RxMan awc_def_Stats16_delta_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats16_delta_TxMan awc_def_Stats16_delta_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats16_delta_RxRefresh awc_def_Stats16_delta_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats16_delta_TxRefresh awc_def_Stats16_delta_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats16_delta_RxPoll awc_def_Stats16_delta_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats16_delta_TxPoll awc_def_Stats16_delta_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats16_delta_HostRetries awc_def_Stats16_delta_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats16_delta_LostSync_HostReq awc_def_Stats16_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats16_delta_HostTxBytes awc_def_Stats16_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats16_delta_HostRxBytes awc_def_Stats16_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats16_delta_ElapsedUsec awc_def_Stats16_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats16_delta_ElapsedSec awc_def_Stats16_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats16_delta_LostSyncBett awc_def_Stats16_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") + + +#define awc_RID_Stats16_clear_RidLen awc_def_Stats16_clear_RID(0x0000,0x0000,"RidLen", "Length of the RID including the length field.") +#define awc_RID_Stats16_clear_RxOverrunErr awc_def_Stats16_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)") +#define awc_RID_Stats16_clear_RxPlcpCrcErr awc_def_Stats16_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).") +#define awc_RID_Stats16_clear_RxPlcpFormat awc_def_Stats16_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.") +#define awc_RID_Stats16_clear_RxPlcpLength awc_def_Stats16_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.") +#define awc_RID_Stats16_clear_RxMacCrcErr awc_def_Stats16_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr", "Count of MAC CRC32 errors.") +#define awc_RID_Stats16_clear_RxMacCrcOk awc_def_Stats16_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk", "Count of MAC CRC32 received correctly.") +#define awc_RID_Stats16_clear_RxWepErr awc_def_Stats16_clear_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_clear_RxWepOk awc_def_Stats16_clear_RID(0x0010,0x0020,"Stats_RxWepOk", "Count of all WEP ICV checks that passed. (this value is included in Stats_RxMacCrcOk)") +#define awc_RID_Stats16_clear_RetryLong awc_def_Stats16_clear_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_clear_RetryShort awc_def_Stats16_clear_RID(0x0014,0x0028,"Stats_RetryShort", "Count of all short retries. (Does not include first attempt for a packet).") +#define awc_RID_Stats16_clear_MaxRetries awc_def_Stats16_clear_RID(0x0016,0x002C,"Stats_MaxRetries", "Count of number of packets that max-retried -- ie were never ACKd.") +#define awc_RID_Stats16_clear_NoAck awc_def_Stats16_clear_RID(0x0018,0x0030,"Stats_NoAck", "Count of number of times that ACK was not received.") +#define awc_RID_Stats16_clear_NoCts awc_def_Stats16_clear_RID(0x001A,0x0034,"Stats_NoCts", "Count of number of timer that CTS was not received.") +#define awc_RID_Stats16_clear_RxAck awc_def_Stats16_clear_RID(0x001C,0x0038,"Stats_RxAck", "Count of number of expected ACKs that were received.") +#define awc_RID_Stats16_clear_RxCts awc_def_Stats16_clear_RID(0x001E,0x003C,"Stats_RxCts", "Count of number of expected CTSs that were received.") +#define awc_RID_Stats16_clear_TxAck awc_def_Stats16_clear_RID(0x0020,0x0040,"Stats_TxAck", "Count of number of ACKs transmitted.") +#define awc_RID_Stats16_clear_TxRts awc_def_Stats16_clear_RID(0x0022,0x0044,"Stats_TxRts", "Count of number of RTSs transmitted.") +#define awc_RID_Stats16_clear_TxCts awc_def_Stats16_clear_RID(0x0024,0x0048,"Stats_TxCts", "Count of number of CTSs transmitted.") +#define awc_RID_Stats16_clear_TxMc awc_def_Stats16_clear_RID(0x0026,0x004C,"Stats_TxMc", " LMAC count of multicast packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_clear_TxBc awc_def_Stats16_clear_RID(0x0028,0x0050,"Stats_TxBc", " LMAC count of broadcast packets sent (uses 802.11") +#define awc_RID_Stats16_clear_TxUcFrags awc_def_Stats16_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC", " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).") +#define awc_RID_Stats16_clear_TxUcPackets awc_def_Stats16_clear_RID(0x002C,0x0058,"Stats_TxUcPackets", "LMAC count of unicast packets that were ACKd (uses 802.11 Address 1).") +#define awc_RID_Stats16_clear_TxBeacon awc_def_Stats16_clear_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.") +#define awc_RID_Stats16_clear_RxBeacon awc_def_Stats16_clear_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.") +#define awc_RID_Stats16_clear_TxSinColl awc_def_Stats16_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **") +#define awc_RID_Stats16_clear_TxMulColl awc_def_Stats16_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **") +#define awc_RID_Stats16_clear_DefersNo awc_def_Stats16_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **") +#define awc_RID_Stats16_clear_DefersProt awc_def_Stats16_clear_RID(0x0038,0x0070,"Stats_DefersProt", " Transmit frames deferred due to protocol.") +#define awc_RID_Stats16_clear_DefersEngy awc_def_Stats16_clear_RID(0x003A,0x0074,"Stats_DefersEngy", " Transmit frames deferred due to energy detect.") +#define awc_RID_Stats16_clear_DupFram awc_def_Stats16_clear_RID(0x003C,0x0078,"Stats_DupFram", " Duplicate receive frames and fragments.") +#define awc_RID_Stats16_clear_RxFragDisc awc_def_Stats16_clear_RID(0x003E,0x007C,"Stats_RxFragDisc", " Received partial frames. (each tally could indicate the discarding of one or more fragments)") +#define awc_RID_Stats16_clear_TxAged awc_def_Stats16_clear_RID(0x0040,0x0080,"Stats_TxAged", " Transmit packets exceeding maximum transmit lifetime. **") +#define awc_RID_Stats16_clear_RxAged awc_def_Stats16_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive", " packets exceeding maximum receive lifetime. **") +#define awc_RID_Stats16_clear_LostSync_Max awc_def_Stats16_clear_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry") +#define awc_RID_Stats16_clear_LostSync_Mis awc_def_Stats16_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons") +#define awc_RID_Stats16_clear_LostSync_Arl awc_def_Stats16_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being Exceeded exceeded.") +#define awc_RID_Stats16_clear_LostSync_Dea awc_def_Stats16_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed") +#define awc_RID_Stats16_clear_LostSync_Disa awc_def_Stats16_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa", " Lost sync with our cell due to being disassociated. ssoced") +#define awc_RID_Stats16_clear_LostSync_Tsf awc_def_Stats16_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF Timingtiming.") +#define awc_RID_Stats16_clear_HostTxMc awc_def_Stats16_clear_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.") +#define awc_RID_Stats16_clear_HostTxBc awc_def_Stats16_clear_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.") +#define awc_RID_Stats16_clear_HostTxUc awc_def_Stats16_clear_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.") +#define awc_RID_Stats16_clear_HostTxFail awc_def_Stats16_clear_RID(0x0056,0x00AC,"Stats_HostTxFail", " Count of host transmitted packets which failed.") +#define awc_RID_Stats16_clear_HostRxMc awc_def_Stats16_clear_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.") +#define awc_RID_Stats16_clear_HostRxBc awc_def_Stats16_clear_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.") +#define awc_RID_Stats16_clear_HostRxUc awc_def_Stats16_clear_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.") +#define awc_RID_Stats16_clear_HostRxDiscar awc_def_Stats16_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n Host not enabling receive.\n Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.") +#define awc_RID_Stats16_clear_HmacTxMc awc_def_Stats16_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.") +#define awc_RID_Stats16_clear_HmacTxBc awc_def_Stats16_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.") +#define awc_RID_Stats16_clear_HmacTxUc awc_def_Stats16_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.") +#define awc_RID_Stats16_clear_HmacTxFail awc_def_Stats16_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail", " Count of internally generated transmit packets that failed.") +#define awc_RID_Stats16_clear_HmacRxMc awc_def_Stats16_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_clear_HmacRxBc awc_def_Stats16_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.") +#define awc_RID_Stats16_clear_HmacRxUc awc_def_Stats16_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.") +#define awc_RID_Stats16_clear_HmacRxDisca awc_def_Stats16_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca", " Count of internally received packets that were discarded (usually because the destination address is not for the host).") +#define awc_RID_Stats16_clear_HmacRxAcce awc_def_Stats16_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce", " Count of internally received packets that were accepted") +#define awc_RID_Stats16_clear_SsidMismatch awc_def_Stats16_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.") +#define awc_RID_Stats16_clear_ApMismatch awc_def_Stats16_clear_RID(0x0074,0x00E8,"Stats_ApMismatch", " Count of specified AP mismatches.") +#define awc_RID_Stats16_clear_RatesMismatc awc_def_Stats16_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.") +#define awc_RID_Stats16_clear_AuthReject awc_def_Stats16_clear_RID(0x0078,0x00F0,"Stats_AuthReject", " Count of authentication rejections.") +#define awc_RID_Stats16_clear_AuthTimeout awc_def_Stats16_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout", " Count of authentication timeouts.") +#define awc_RID_Stats16_clear_AssocReject awc_def_Stats16_clear_RID(0x007C,0x00F8,"Stats_AssocReject", " Count of association rejections.") +#define awc_RID_Stats16_clear_AssocTimeout awc_def_Stats16_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.") +#define awc_RID_Stats16_clear_NewReason awc_def_Stats16_clear_RID(0x0080,0x0100,"Stats_NewReason", "Count of reason/status codes of greater than 19. (Values of 0 = successful are not counted)") +#define awc_RID_Stats16_clear_AuthFail_1 awc_def_Stats16_clear_RID(0x0082,0x0104,"Stats_AuthFail_1", "Unspecified reason.") +#define awc_RID_Stats16_clear_AuthFail_2 awc_def_Stats16_clear_RID(0x0084,0x0108,"Stats_AuthFail_2", "Previous authentication no longer valid.") +#define awc_RID_Stats16_clear_AuthFail_3 awc_def_Stats16_clear_RID(0x0086,0x010C,"Stats_AuthFail_3", "Deauthenticated because sending station is leaving (has left) IBSS or ESS.") +#define awc_RID_Stats16_clear_AuthFail_4 awc_def_Stats16_clear_RID(0x0088,0x0110,"Stats_AuthFail_4", "Disassociated due to inactivity") +#define awc_RID_Stats16_clear_AuthFail_5 awc_def_Stats16_clear_RID(0x008A,0x0114,"Stats_AuthFail_5", "Disassociated because AP is unable to handle all currently associated stations.") +#define awc_RID_Stats16_clear_AuthFail_6 awc_def_Stats16_clear_RID(0x008C,0x0118,"Stats_AuthFail_6", "Class 2 Frame received from non-Authenticated station.") +#define awc_RID_Stats16_clear_AuthFail_7 awc_def_Stats16_clear_RID(0x008E,0x011C,"Stats_AuthFail_7", "Class 3 Frame received from non-Associated station.") +#define awc_RID_Stats16_clear_AuthFail_8 awc_def_Stats16_clear_RID(0x0090,0x0120,"Stats_AuthFail_8", "Disassociated because sending station is leaving (has left) " ) +#define awc_RID_Stats16_clear_AuthFail_9 awc_def_Stats16_clear_RID(0x0092,0x0124,"Stats_AuthFail_9", "Station requesting (Re)Association is not Authenticated") +#define awc_RID_Stats16_clear_AuthFail_10 awc_def_Stats16_clear_RID(0x0094,0x0128,"Stats_AuthFail_10", "Cannot support all requested capabilities in the Capability") +#define awc_RID_Stats16_clear_AuthFail_11 awc_def_Stats16_clear_RID(0x0096,0x012C,"Stats_AuthFail_11", "Reassociation denied due to inability to confirm") +#define awc_RID_Stats16_clear_AuthFail_12 awc_def_Stats16_clear_RID(0x0098,0x0130,"Stats_AuthFail_12", "Association denied due to reason outside the scope of the 802.11") +#define awc_RID_Stats16_clear_AuthFail_13 awc_def_Stats16_clear_RID(0x009A,0x0134,"Stats_AuthFail_13", "Responding station does not support the specified Auth Alogorithm") +#define awc_RID_Stats16_clear_AuthFail_14 awc_def_Stats16_clear_RID(0x009C,0x0138,"Stats_AuthFail_14", "Received an out of sequence Authentication Frame.") +#define awc_RID_Stats16_clear_AuthFail_15 awc_def_Stats16_clear_RID(0x009E,0x013C,"Stats_AuthFail_15", "Authentication rejected due to challenge failure.") +#define awc_RID_Stats16_clear_AuthFail_16 awc_def_Stats16_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16", "Authentication rejected due to timeout waiting for next frame in sequence.") +#define awc_RID_Stats16_clear_AuthFail_17 awc_def_Stats16_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17", "Association denied because AP is unable to handle additional associated stations.") +#define awc_RID_Stats16_clear_AuthFail_18 awc_def_Stats16_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18", "Association denied due to requesting station not supportingall basic rates.") +#define awc_RID_Stats16_clear_AuthFail_19 awc_def_Stats16_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19", "Reserved") +#define awc_RID_Stats16_clear_RxMan awc_def_Stats16_clear_RID(0x00A8,0x0150,"Stats_RxMan", " Count of management packets received and handled.") +#define awc_RID_Stats16_clear_TxMan awc_def_Stats16_clear_RID(0x00AA,0x0154,"Stats_TxMan", " Count of management packets transmitted.") +#define awc_RID_Stats16_clear_RxRefresh awc_def_Stats16_clear_RID(0x00AC,0x0158,"Stats_RxRefresh", " Count of null data packets received.") +#define awc_RID_Stats16_clear_TxRefresh awc_def_Stats16_clear_RID(0x00AE,0x015C,"Stats_TxRefresh", " Count of null data packets transmitted.") +#define awc_RID_Stats16_clear_RxPoll awc_def_Stats16_clear_RID(0x00B0,0x0160,"Stats_RxPoll", "Count of PS-Poll packets received.") +#define awc_RID_Stats16_clear_TxPoll awc_def_Stats16_clear_RID(0x00B2,0x0164,"Stats_TxPoll", "Count of PS-Poll packets transmitted.") +#define awc_RID_Stats16_clear_HostRetries awc_def_Stats16_clear_RID(0x00B4,0x0168,"Stats_HostRetries", " Count of long and short retries used to transmit host packets (does not include first attempt).") +#define awc_RID_Stats16_clear_LostSync_HostReq awc_def_Stats16_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.") +#define awc_RID_Stats16_clear_HostTxBytes awc_def_Stats16_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes", " Count of bytes transferred from the host.") +#define awc_RID_Stats16_clear_HostRxBytes awc_def_Stats16_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes", " Count of bytes transferred to the host.") +#define awc_RID_Stats16_clear_ElapsedUsec awc_def_Stats16_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec", " Total time since power up (or clear) in microseconds.") +#define awc_RID_Stats16_clear_ElapsedSec awc_def_Stats16_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec", " Total time since power up (or clear) in seconds.") +#define awc_RID_Stats16_clear_LostSyncBett awc_def_Stats16_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point") +/* +const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config =(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; // See notes General Configuration Many configuration items. +const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list =(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; // See notes Valid SSID list List of SSIDs which the station may associate to. +const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list =(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; // See notes Valid AP list List of APs which the station may associate to. +const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name =(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; // See notes Driver name The name and version of the driver (for debugging) +const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation =(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; // See notes Ethernet Protocol Rules for encapsulating ethernet payloads onto 802.11. +const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile =(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile =(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation =(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; // +const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config =(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; // Read only Actual Configuration This has the same format as the General Configuration. +const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities =(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; // Read Only Capabilities PC4500 Information +const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info =(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; // Read Only AP Info Access Point Information +const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info =(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; // Read Only Radio Info Radio Information -- note radio specific +const struct aironet4500_rid_selector aironet4500_RID_Select_Status =(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; // Read Only Status PC4500 Current Status Information +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats =(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; // Read Only 16-bit Statistics Cumulative 16-bit Statistics +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta =(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; // Read Only 16-bit Statistics Delta 16-bit Statistics (since last clear) +const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear =(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; // Read Only / 16-bit Statistics Delta 16-bit Statistics and Clear +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats =(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; // Read Only 32-bit Statistics Cumulative 32-bit Statistics +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta =(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics" }; // Read Only 32-bit Statistics Delta 32-bit Statistics (since last clear) +const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear =(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; // Read Only / 32-bit Statistics Delta 32-bit Statistics and Clear +*/ + +struct aironet4500_RID awc_gen_RID[] ={ + awc_RID_gen_RidLen, + awc_RID_gen_OperatingMode_adhoc, + awc_RID_gen_OperatingMode_Infrastructure, + awc_RID_gen_OperatingMode_AP, + awc_RID_gen_OperatingMode_AP_and_repeater, + awc_RID_gen_OperatingMode_No_payload_modify, + awc_RID_gen_OperatingMode_LLC_802_3_convert, + awc_RID_gen_OperatingMode_proprietary_ext, + awc_RID_gen_OperatingMode_no_proprietary_ext, + awc_RID_gen_OperatingMode_AP_ext, + awc_RID_gen_OperatingMode_no_AP_ext, + awc_RID_gen_ReceiveMode, + awc_RID_gen_ReceiveMode_BMA, + awc_RID_gen_ReceiveMode_BA, + awc_RID_gen_ReceiveMode_A, + awc_RID_gen_ReceiveMode_802_11_monitor, + awc_RID_gen_ReceiveMode_802_11_any_monitor, + awc_RID_gen_ReceiveMode_LAN_monitor, + awc_RID_gen_ReceiveMode_802_3_hdr_disable, + awc_RID_gen_ReceiveMode_802_3_hdr_enable, + awc_RID_gen_Fragmentation_threshold, + awc_RID_gen_RTS_threshold, + awc_RID_gen_Station_Mac_Id, + awc_RID_gen_Supported_rates, + awc_RID_gen_Basic_Rate, + awc_RID_gen_Rate_500kbps, + awc_RID_gen_Rate_1Mbps, + awc_RID_gen_Rate_2Mbps, + awc_RID_gen_Rate_4Mbps, + awc_RID_gen_Rate_5Mbps, + awc_RID_gen_Rate_10Mbps, + awc_RID_gen_Rate_11Mbps, + awc_RID_gen_BasicRate_500kbps, + awc_RID_gen_BasicRate_1Mbps, + awc_RID_gen_BasicRate_2Mbps, + awc_RID_gen_BasicRate_4Mbps, + awc_RID_gen_BasicRate_5Mbps, + awc_RID_gen_BasicRate_10Mbps, + awc_RID_gen_BasicRate_11Mbps, + awc_RID_gen_Long_retry_limit, + awc_RID_gen_Short_retry_limit, + awc_RID_gen_Tx_MSDU_lifetime, + awc_RID_gen_Rx_MSDU_lifetime, + awc_RID_gen_Stationary, + awc_RID_gen_BC_MC_Ordering, + awc_RID_gen_Device_type, + awc_RID_gen_Reserved_0x0026, + awc_RID_gen_ScanMode, + awc_RID_gen_ScanMode_Active, + awc_RID_gen_ScanMode_Passive, + awc_RID_gen_ScanMode_Aironet_ext, + awc_RID_gen_ProbeDelay, + awc_RID_gen_ProbeEnergyTimeout, + awc_RID_gen_ProbeResponseTimeout, + awc_RID_gen_BeaconListenTimeout, + awc_RID_gen_IbssJoinNetTimeout, + awc_RID_gen_AuthenticationTimeout, + awc_RID_gen_AuthenticationType, + awc_RID_gen_AuthenticationType_None, + awc_RID_gen_AuthenticationType_Open, + awc_RID_gen_AuthenticationType_Shared, + awc_RID_gen_AuthenticationType_Exclude_Open, + awc_RID_gen_AssociationTimeout, + awc_RID_gen_SpecifiedAPtimeout, + awc_RID_gen_OfflineScanInterval, + awc_RID_gen_OfflineScanDuration, + awc_RID_gen_LinkLossDelay, + awc_RID_gen_MaxBeaconLostTime, + awc_RID_gen_RefreshInterval, + awc_RID_gen_PowerSaveMode, + awc_RID_gen_PowerSaveMode_CAM, + awc_RID_gen_PowerSaveMode_PSP, + awc_RID_gen_PowerSaveMode_Fast_PSP, + awc_RID_gen_SleepForDTIMs, + awc_RID_gen_ListenInterval, + awc_RID_gen_FastListenInterval, + awc_RID_gen_ListenDecay, + awc_RID_gen_FastListenDelay, + awc_RID_gen_Reserved0x005C, + awc_RID_gen_BeaconPeriod, + awc_RID_gen_AtimDuration, + awc_RID_gen_Reserved0x0064, + awc_RID_gen_DSChannel, + awc_RID_gen_Reserved0x0068, + awc_RID_gen_DTIM_Period, + awc_RID_gen_Reserved0x0006C, + awc_RID_gen_RadioSpreadType, + awc_RID_gen_RadioSpreadType_FH, + awc_RID_gen_RadioSpreadType_DS, + awc_RID_gen_RadioSpreadType_LM, + awc_RID_gen_TX_antenna_Diversity, + awc_RID_gen_TX_antenna_Diversity_default, + awc_RID_gen_TX_antenna_Diversity_1, + awc_RID_gen_TX_antenna_Diversity_2, + awc_RID_gen_TX_antenna_Diversity_both, + awc_RID_gen_RX_antenna_Diversity, + awc_RID_gen_RX_antenna_Diversity_default, + awc_RID_gen_RX_antenna_Diversity_1, + awc_RID_gen_RX_antenna_Diversity_2, + awc_RID_gen_RX_antenna_Diversity_both, + awc_RID_gen_TransmitPower, + awc_RID_gen_RSSIthreshold, + awc_RID_gen_Modulation, + awc_RID_gen_Reserved0x0079, + awc_RID_gen_NodeName, + awc_RID_gen_ARLThreshold, + awc_RID_gen_ARLDecay, + awc_RID_gen_ARLDelay, + awc_RID_gen_Unused0x0096, + awc_RID_gen_MagicPacketAction, + awc_RID_gen_MagicPacketControl, + {0} +}; + +struct aironet4500_RID awc_act_RID[]={ + awc_RID_act_RidLen, + awc_RID_act_OperatingMode_adhoc, + awc_RID_act_OperatingMode_Infrastructure, + awc_RID_act_OperatingMode_AP, + awc_RID_act_OperatingMode_AP_and_repeater, + awc_RID_act_OperatingMode_No_payload_modify, + awc_RID_act_OperatingMode_LLC_802_3_convert, + awc_RID_act_OperatingMode_proprietary_ext, + awc_RID_act_OperatingMode_no_proprietary_ext, + awc_RID_act_OperatingMode_AP_ext, + awc_RID_act_OperatingMode_no_AP_ext, + awc_RID_act_ReceiveMode, + awc_RID_act_ReceiveMode_BMA, + awc_RID_act_ReceiveMode_BA, + awc_RID_act_ReceiveMode_A, + awc_RID_act_ReceiveMode_802_11_monitor, + awc_RID_act_ReceiveMode_802_11_any_monitor, + awc_RID_act_ReceiveMode_LAN_monitor, + awc_RID_act_ReceiveMode_802_3_hdr_disable, + awc_RID_act_ReceiveMode_802_3_hdr_enable, + awc_RID_act_Fragmentation_threshold, + awc_RID_act_RTS_threshold, + awc_RID_act_Station_Mac_Id, + awc_RID_act_Supported_rates, + awc_RID_act_Basic_Rate, + awc_RID_act_Rate_500kbps, + awc_RID_act_Rate_1Mbps, + awc_RID_act_Rate_2Mbps, + awc_RID_act_Rate_4Mbps, + awc_RID_act_Rate_5Mbps, + awc_RID_act_Rate_10Mbps, + awc_RID_act_Rate_11Mbps, + awc_RID_act_BasicRate_500kbps, + awc_RID_act_BasicRate_1Mbps, + awc_RID_act_BasicRate_2Mbps, + awc_RID_act_BasicRate_4Mbps, + awc_RID_act_BasicRate_5Mbps, + awc_RID_act_BasicRate_10Mbps, + awc_RID_act_BasicRate_11Mbps, + awc_RID_act_Long_retry_limit, + awc_RID_act_Short_retry_limit, + awc_RID_act_Tx_MSDU_lifetime, + awc_RID_act_Rx_MSDU_lifetime, + awc_RID_act_Stationary, + awc_RID_act_BC_MC_Ordering, + awc_RID_act_Device_type, + awc_RID_act_Reserved_0x0026, + awc_RID_act_ScanMode, + awc_RID_act_ScanMode_Active, + awc_RID_act_ScanMode_Passive, + awc_RID_act_ScanMode_Aironet_ext, + awc_RID_act_ProbeDelay, + awc_RID_act_ProbeEnergyTimeout, + awc_RID_act_ProbeResponseTimeout, + awc_RID_act_BeaconListenTimeout, + awc_RID_act_IbssJoinNetTimeout, + awc_RID_act_AuthenticationTimeout, + awc_RID_act_AuthenticationType, + awc_RID_act_AuthenticationType_None, + awc_RID_act_AuthenticationType_Open, + awc_RID_act_AuthenticationType_Shared, + awc_RID_act_AuthenticationType_Exclude_Open, + awc_RID_act_AssociationTimeout, + awc_RID_act_SpecifiedAPtimeout, + awc_RID_act_OfflineScanInterval, + awc_RID_act_OfflineScanDuration, + awc_RID_act_LinkLossDelay, + awc_RID_act_MaxBeaconLostTime, + awc_RID_act_RefreshInterval, + awc_RID_act_PowerSaveMode, + awc_RID_act_PowerSaveMode_CAM, + awc_RID_act_PowerSaveMode_PSP, + awc_RID_act_PowerSaveMode_Fast_PSP, + awc_RID_act_SleepForDTIMs, + awc_RID_act_ListenInterval, + awc_RID_act_FastListenInterval, + awc_RID_act_ListenDecay, + awc_RID_act_FastListenDelay, + awc_RID_act_Reserved0x005C, + awc_RID_act_BeaconPeriod, + awc_RID_act_AtimDuration, + awc_RID_act_Reserved0x0064, + awc_RID_act_DSChannel, + awc_RID_act_Reserved0x0068, + awc_RID_act_DTIM_Period, + awc_RID_act_Reserved0x0006C, + awc_RID_act_RadioSpreadType, + awc_RID_act_RadioSpreadType_FH, + awc_RID_act_RadioSpreadType_DS, + awc_RID_act_RadioSpreadType_LM, + awc_RID_act_TX_antenna_Diversity, + awc_RID_act_TX_antenna_Diversity_default, + awc_RID_act_TX_antenna_Diversity_1, + awc_RID_act_TX_antenna_Diversity_2, + awc_RID_act_TX_antenna_Diversity_both, + awc_RID_act_RX_antenna_Diversity, + awc_RID_act_RX_antenna_Diversity_default, + awc_RID_act_RX_antenna_Diversity_1, + awc_RID_act_RX_antenna_Diversity_2, + awc_RID_act_RX_antenna_Diversity_both, + awc_RID_act_TransmitPower, + awc_RID_act_RSSIthreshold, + awc_RID_act_Modulation, + awc_RID_act_Reserved0x0079, + awc_RID_act_NodeName, + awc_RID_act_ARLThreshold, + awc_RID_act_ARLDecay, + awc_RID_act_ARLDelay, + awc_RID_act_Unused0x0096, + awc_RID_act_MagicPacketAction, + awc_RID_act_MagicPacketControl, + {0} +}; + + + +struct aironet4500_RID awc_SSID_RID[]={ + awc_RID_SSID_RidLen, + awc_RID_SSID_Accept_any, + awc_RID_SSIDlen1, + awc_RID_SSID1, + awc_RID_SSIDlen2, + awc_RID_SSID2, + awc_RID_SSIDlen3, + awc_RID_SSID3, + {0} +}; + + +struct aironet4500_RID awc_AP_List_RID[]={ + awc_RID_AP_List_RidLen, + awc_RID_AP_List_SpecifiedAP1, + awc_RID_AP_List_SpecifiedAP2, + awc_RID_AP_List_SpecifiedAP3, + awc_RID_AP_List_SpecifiedAP4, + {0} +}; + + +struct aironet4500_RID awc_Dname_RID[]={ + awc_RID_Dname_RidLen, + awc_RID_Dname_DriverName, + {0} +}; + + + + +struct aironet4500_RID awc_enc_RID[]={ + awc_RID_Enc_RidLen, + awc_RID_Enc_EtherType1, + awc_RID_Enc_Action_RX_1, + awc_RID_Enc_Action_RX_1_RFC_1042, + awc_RID_Enc_Action_RX_1_802_11, + awc_RID_Enc_Action_TX_1, + awc_RID_Enc_Action_TX_1_RFC_1042, + awc_RID_Enc_Action_TX_1_802_11, + awc_RID_Enc_EtherType2, + awc_RID_Enc_Action_RX_2, + awc_RID_Enc_Action_RX_2_RFC_1042, + awc_RID_Enc_Action_RX_2_802_11, + awc_RID_Enc_Action_TX_2, + awc_RID_Enc_Action_TX_2_RFC_1042, + awc_RID_Enc_Action_TX_2_802_11, + awc_RID_Enc_EtherType3, + awc_RID_Enc_Action_RX_3, + awc_RID_Enc_Action_RX_3_RFC_1042, + awc_RID_Enc_Action_RX_3_802_11, + awc_RID_Enc_Action_TX_3_, + awc_RID_Enc_Action_TX_3_RFC_1042, + awc_RID_Enc_Action_TX_3_802_11, + awc_RID_Enc_EtherType4, + awc_RID_Enc_Action_RX_4, + awc_RID_Enc_Action_RX_4_RFC_1042, + awc_RID_Enc_Action_RX_4_802_11, + awc_RID_Enc_Action_TX_4, + awc_RID_Enc_Action_TX_4_RFC_1042, + awc_RID_Enc_Action_TX_4_802_11, + awc_RID_Enc_EtherType5, + awc_RID_Enc_Action_RX_5, + awc_RID_Enc_Action_RX_5_RFC_1042, + awc_RID_Enc_Action_RX_5_802_11, + awc_RID_Enc_Action_TX_5, + awc_RID_Enc_Action_TX_5_RFC_1042, + awc_RID_Enc_Action_TX_5_802_11, + awc_RID_Enc_EtherType6, + awc_RID_Enc_Action_RX_6, + awc_RID_Enc_Action_RX_6_RFC_1042, + awc_RID_Enc_Action_RX_6_802_11, + awc_RID_Enc_Action_TX_6, + awc_RID_Enc_Action_TX_6_RFC_1042, + awc_RID_Enc_Action_TX_6_802_11, + awc_RID_Enc_EtherType7, + awc_RID_Enc_Action_RX_7, + awc_RID_Enc_Action_RX_7_RFC_1042, + awc_RID_Enc_Action_RX_7_802_11, + awc_RID_Enc_Action_TX_7, + awc_RID_Enc_Action_TX_7_RFC_1042, + awc_RID_Enc_Action_TX_7_802_11, + awc_RID_Enc_EtherType8, + awc_RID_Enc_Action_RX_8, + awc_RID_Enc_Action_RX_8_RFC_1042, + awc_RID_Enc_Action_RX_8_802_11, + awc_RID_Enc_Action_TX_8, + awc_RID_Enc_Action_TX_8_RFC_1042, + awc_RID_Enc_Action_TX_8_802_11, + {0} +}; + +struct aironet4500_RID awc_WEPv_RID[]={ + awc_RID_WEPv_RidLen, + awc_RID_WEPv_KeyIndex, + awc_RID_WEPv_Address, + awc_RID_WEPv_KeyLen, + awc_RID_WEPv_Key, + awc_RID_WEPv_KeyAscii, + {0} +}; + +struct aironet4500_RID awc_WEPnv_RID[]={ + awc_RID_WEPnv_RidLen, + awc_RID_WEPnv_KeyIndex, + awc_RID_WEPnv_Address, + awc_RID_WEPnv_KeyLen, + awc_RID_WEPnv_Key, + awc_RID_WEPnv_KeyAscii, + {0} +}; + +struct aironet4500_RID awc_Modulation_RID[]={ + awc_RID_Modulation_RidLen, + awc_RID_Modulation_Modulation, + {0} +}; + + + +struct aironet4500_RID awc_Cap_RID[]={ + awc_RID_Cap_RidLen, + awc_RID_Cap_OUI, + awc_RID_Cap_ProductNum, + awc_RID_Cap_ManufacturerName, + awc_RID_Cap_ProductName, + awc_RID_Cap_ProductVersion, + awc_RID_Cap_FactoryAddress, + awc_RID_Cap_AironetAddress, + awc_RID_Cap_RadioSpreadType_DS, + awc_RID_Cap_RadioSpreadType_FH, + awc_RID_Cap_RadioSpreadType_Legacy, + awc_RID_Cap_RegDomain, + awc_RID_Cap_Callid, + awc_RID_Cap_SupportedRates, + awc_RID_Cap_RxDiversity, + awc_RID_Cap_TxDiversity, + awc_RID_Cap_TxPowerLevels, + awc_RID_Cap_HardwareVersion, + awc_RID_Cap_HardwareCapabilit, + awc_RID_Cap_TemperatureRange, + awc_RID_Cap_SoftwareVersion, + awc_RID_Cap_SoftwareVersion_major, + awc_RID_Cap_SoftwareVersion_minor, + awc_RID_Cap_SoftwareSubVersion, + awc_RID_Cap_InterfaceVersion, + awc_RID_Cap_SoftwareCapabilities, + awc_RID_Cap_BootBlockVersion, + {0} +}; + + +struct aironet4500_RID awc_Status_RID[]={ + awc_RID_Status_RidLen, + awc_RID_Status_MacAddress, + awc_RID_Status_OperationalMode, + awc_RID_Status_Configured, + awc_RID_Status_MAC_Enabled, + awc_RID_Status_Receive_Enabled, + awc_RID_Status_In_Sync, + awc_RID_Status_Associated, + awc_RID_Status_Error, + awc_RID_Status_ErrorCode, + awc_RID_Status_CurrentSignalQuality, + awc_RID_Status_SSIDlength, + awc_RID_Status_SSID, + awc_RID_Status_ApName, + awc_RID_Status_CurrentBssid, + awc_RID_Status_PreviousBssid1, + awc_RID_Status_PreviousBssid2, + awc_RID_Status_PreviousBssid3, + awc_RID_Status_BeaconPeriod, + awc_RID_Status_DtimPeriod, + awc_RID_Status_AtimDuration, + awc_RID_Status_HopPeriod, + awc_RID_Status_ChannelSet, + awc_RID_Status_Channel, + awc_RID_Status_HopsToBackbone, + awc_RID_Status_ApTotalLoad, + awc_RID_Status_OurGeneratedLoad, + awc_RID_Status_AccumulatedArl, + {0} +}; + + +struct aironet4500_RID awc_AP_RID[]={ + awc_RID_AP_16RidLen, + awc_RID_AP_TIM_addr, + awc_RID_AP_Airo_addr, + {0} +}; + + +struct aironet4500_RID awc_Stats_RID[]={ + awc_RID_Stats_RidLen, + awc_RID_Stats_RxOverrunErr, + awc_RID_Stats_RxPlcpCrcErr, + awc_RID_Stats_RxPlcpFormat, + awc_RID_Stats_RxPlcpLength, + awc_RID_Stats_RxMacCrcErr, + awc_RID_Stats_RxMacCrcOk, + awc_RID_Stats_RxWepErr, + awc_RID_Stats_RxWepOk, + awc_RID_Stats_RetryLong, + awc_RID_Stats_RetryShort, + awc_RID_Stats_MaxRetries, + awc_RID_Stats_NoAck, + awc_RID_Stats_NoCts, + awc_RID_Stats_RxAck, + awc_RID_Stats_RxCts, + awc_RID_Stats_TxAck, + awc_RID_Stats_TxRts, + awc_RID_Stats_TxCts, + awc_RID_Stats_TxMc, + awc_RID_Stats_TxBc, + awc_RID_Stats_TxUcFrags, + awc_RID_Stats_TxUcPackets, + awc_RID_Stats_TxBeacon, + awc_RID_Stats_RxBeacon, + awc_RID_Stats_TxSinColl, + awc_RID_Stats_TxMulColl, + awc_RID_Stats_DefersNo, + awc_RID_Stats_DefersProt, + awc_RID_Stats_DefersEngy, + awc_RID_Stats_DupFram, + awc_RID_Stats_RxFragDisc, + awc_RID_Stats_TxAged, + awc_RID_Stats_RxAged, + awc_RID_Stats_LostSync_Max, + awc_RID_Stats_LostSync_Mis, + awc_RID_Stats_LostSync_Arl, + awc_RID_Stats_LostSync_Dea, + awc_RID_Stats_LostSync_Disa, + awc_RID_Stats_LostSync_Tsf, + awc_RID_Stats_HostTxMc, + awc_RID_Stats_HostTxBc, + awc_RID_Stats_HostTxUc, + awc_RID_Stats_HostTxFail, + awc_RID_Stats_HostRxMc, + awc_RID_Stats_HostRxBc, + awc_RID_Stats_HostRxUc, + awc_RID_Stats_HostRxDiscar, + awc_RID_Stats_HmacTxMc, + awc_RID_Stats_HmacTxBc, + awc_RID_Stats_HmacTxUc, + awc_RID_Stats_HmacTxFail, + awc_RID_Stats_HmacRxMc, + awc_RID_Stats_HmacRxBc, + awc_RID_Stats_HmacRxUc, + awc_RID_Stats_HmacRxDisca, + awc_RID_Stats_HmacRxAcce, + awc_RID_Stats_SsidMismatch, + awc_RID_Stats_ApMismatch, + awc_RID_Stats_RatesMismatc, + awc_RID_Stats_AuthReject, + awc_RID_Stats_AuthTimeout, + awc_RID_Stats_AssocReject, + awc_RID_Stats_AssocTimeout, + awc_RID_Stats_NewReason, + awc_RID_Stats_AuthFail_1, + awc_RID_Stats_AuthFail_2, + awc_RID_Stats_AuthFail_3, + awc_RID_Stats_AuthFail_4, + awc_RID_Stats_AuthFail_5, + awc_RID_Stats_AuthFail_6, + awc_RID_Stats_AuthFail_7, + awc_RID_Stats_AuthFail_8, + awc_RID_Stats_AuthFail_9, + awc_RID_Stats_AuthFail_10, + awc_RID_Stats_AuthFail_11, + awc_RID_Stats_AuthFail_12, + awc_RID_Stats_AuthFail_13, + awc_RID_Stats_AuthFail_14, + awc_RID_Stats_AuthFail_15, + awc_RID_Stats_AuthFail_16, + awc_RID_Stats_AuthFail_17, + awc_RID_Stats_AuthFail_18, + awc_RID_Stats_AuthFail_19, + awc_RID_Stats_RxMan, + awc_RID_Stats_TxMan, + awc_RID_Stats_RxRefresh, + awc_RID_Stats_TxRefresh, + awc_RID_Stats_RxPoll, + awc_RID_Stats_TxPoll, + awc_RID_Stats_HostRetries, + awc_RID_Stats_LostSync_HostReq, + awc_RID_Stats_HostTxBytes, + awc_RID_Stats_HostRxBytes, + awc_RID_Stats_ElapsedUsec, + awc_RID_Stats_ElapsedSec, + awc_RID_Stats_LostSyncBett, + {0} +}; + + + +struct aironet4500_RID awc_Stats_delta_RID[]={ + awc_RID_Stats_delta_RidLen, + awc_RID_Stats_delta_RxOverrunErr, + awc_RID_Stats_delta_RxPlcpCrcErr, + awc_RID_Stats_delta_RxPlcpFormat, + awc_RID_Stats_delta_RxPlcpLength, + awc_RID_Stats_delta_RxMacCrcErr, + awc_RID_Stats_delta_RxMacCrcOk, + awc_RID_Stats_delta_RxWepErr, + awc_RID_Stats_delta_RxWepOk, + awc_RID_Stats_delta_RetryLong, + awc_RID_Stats_delta_RetryShort, + awc_RID_Stats_delta_MaxRetries, + awc_RID_Stats_delta_NoAck, + awc_RID_Stats_delta_NoCts, + awc_RID_Stats_delta_RxAck, + awc_RID_Stats_delta_RxCts, + awc_RID_Stats_delta_TxAck, + awc_RID_Stats_delta_TxRts, + awc_RID_Stats_delta_TxCts, + awc_RID_Stats_delta_TxMc, + awc_RID_Stats_delta_TxBc, + awc_RID_Stats_delta_TxUcFrags, + awc_RID_Stats_delta_TxUcPackets, + awc_RID_Stats_delta_TxBeacon, + awc_RID_Stats_delta_RxBeacon, + awc_RID_Stats_delta_TxSinColl, + awc_RID_Stats_delta_TxMulColl, + awc_RID_Stats_delta_DefersNo, + awc_RID_Stats_delta_DefersProt, + awc_RID_Stats_delta_DefersEngy, + awc_RID_Stats_delta_DupFram, + awc_RID_Stats_delta_RxFragDisc, + awc_RID_Stats_delta_TxAged, + awc_RID_Stats_delta_RxAged, + awc_RID_Stats_delta_LostSync_Max, + awc_RID_Stats_delta_LostSync_Mis, + awc_RID_Stats_delta_LostSync_Arl, + awc_RID_Stats_delta_LostSync_Dea, + awc_RID_Stats_delta_LostSync_Disa, + awc_RID_Stats_delta_LostSync_Tsf, + awc_RID_Stats_delta_HostTxMc, + awc_RID_Stats_delta_HostTxBc, + awc_RID_Stats_delta_HostTxUc, + awc_RID_Stats_delta_HostTxFail, + awc_RID_Stats_delta_HostRxMc, + awc_RID_Stats_delta_HostRxBc, + awc_RID_Stats_delta_HostRxUc, + awc_RID_Stats_delta_HostRxDiscar, + awc_RID_Stats_delta_HmacTxMc, + awc_RID_Stats_delta_HmacTxBc, + awc_RID_Stats_delta_HmacTxUc, + awc_RID_Stats_delta_HmacTxFail, + awc_RID_Stats_delta_HmacRxMc, + awc_RID_Stats_delta_HmacRxBc, + awc_RID_Stats_delta_HmacRxUc, + awc_RID_Stats_delta_HmacRxDisca, + awc_RID_Stats_delta_HmacRxAcce, + awc_RID_Stats_delta_SsidMismatch, + awc_RID_Stats_delta_ApMismatch, + awc_RID_Stats_delta_RatesMismatc, + awc_RID_Stats_delta_AuthReject, + awc_RID_Stats_delta_AuthTimeout, + awc_RID_Stats_delta_AssocReject, + awc_RID_Stats_delta_AssocTimeout, + awc_RID_Stats_delta_NewReason, + awc_RID_Stats_delta_AuthFail_1, + awc_RID_Stats_delta_AuthFail_2, + awc_RID_Stats_delta_AuthFail_3, + awc_RID_Stats_delta_AuthFail_4, + awc_RID_Stats_delta_AuthFail_5, + awc_RID_Stats_delta_AuthFail_6, + awc_RID_Stats_delta_AuthFail_7, + awc_RID_Stats_delta_AuthFail_8, + awc_RID_Stats_delta_AuthFail_9, + awc_RID_Stats_delta_AuthFail_10, + awc_RID_Stats_delta_AuthFail_11, + awc_RID_Stats_delta_AuthFail_12, + awc_RID_Stats_delta_AuthFail_13, + awc_RID_Stats_delta_AuthFail_14, + awc_RID_Stats_delta_AuthFail_15, + awc_RID_Stats_delta_AuthFail_16, + awc_RID_Stats_delta_AuthFail_17, + awc_RID_Stats_delta_AuthFail_18, + awc_RID_Stats_delta_AuthFail_19, + awc_RID_Stats_delta_RxMan, + awc_RID_Stats_delta_TxMan, + awc_RID_Stats_delta_RxRefresh, + awc_RID_Stats_delta_TxRefresh, + awc_RID_Stats_delta_RxPoll, + awc_RID_Stats_delta_TxPoll, + awc_RID_Stats_delta_HostRetries, + awc_RID_Stats_delta_LostSync_HostReq, + awc_RID_Stats_delta_HostTxBytes, + awc_RID_Stats_delta_HostRxBytes, + awc_RID_Stats_delta_ElapsedUsec, + awc_RID_Stats_delta_ElapsedSec, + awc_RID_Stats_delta_LostSyncBett, + {0} +}; + +struct aironet4500_RID awc_Stats_clear_RID[]={ + awc_RID_Stats_clear_RidLen, + awc_RID_Stats_clear_RxOverrunErr, + awc_RID_Stats_clear_RxPlcpCrcErr, + awc_RID_Stats_clear_RxPlcpFormat, + awc_RID_Stats_clear_RxPlcpLength, + awc_RID_Stats_clear_RxMacCrcErr, + awc_RID_Stats_clear_RxMacCrcOk, + awc_RID_Stats_clear_RxWepErr, + awc_RID_Stats_clear_RxWepOk, + awc_RID_Stats_clear_RetryLong, + awc_RID_Stats_clear_RetryShort, + awc_RID_Stats_clear_MaxRetries, + awc_RID_Stats_clear_NoAck, + awc_RID_Stats_clear_NoCts, + awc_RID_Stats_clear_RxAck, + awc_RID_Stats_clear_RxCts, + awc_RID_Stats_clear_TxAck, + awc_RID_Stats_clear_TxRts, + awc_RID_Stats_clear_TxCts, + awc_RID_Stats_clear_TxMc, + awc_RID_Stats_clear_TxBc, + awc_RID_Stats_clear_TxUcFrags, + awc_RID_Stats_clear_TxUcPackets, + awc_RID_Stats_clear_TxBeacon, + awc_RID_Stats_clear_RxBeacon, + awc_RID_Stats_clear_TxSinColl, + awc_RID_Stats_clear_TxMulColl, + awc_RID_Stats_clear_DefersNo, + awc_RID_Stats_clear_DefersProt, + awc_RID_Stats_clear_DefersEngy, + awc_RID_Stats_clear_DupFram, + awc_RID_Stats_clear_RxFragDisc, + awc_RID_Stats_clear_TxAged, + awc_RID_Stats_clear_RxAged, + awc_RID_Stats_clear_LostSync_Max, + awc_RID_Stats_clear_LostSync_Mis, + awc_RID_Stats_clear_LostSync_Arl, + awc_RID_Stats_clear_LostSync_Dea, + awc_RID_Stats_clear_LostSync_Disa, + awc_RID_Stats_clear_LostSync_Tsf, + awc_RID_Stats_clear_HostTxMc, + awc_RID_Stats_clear_HostTxBc, + awc_RID_Stats_clear_HostTxUc, + awc_RID_Stats_clear_HostTxFail, + awc_RID_Stats_clear_HostRxMc, + awc_RID_Stats_clear_HostRxBc, + awc_RID_Stats_clear_HostRxUc, + awc_RID_Stats_clear_HostRxDiscar, + awc_RID_Stats_clear_HmacTxMc, + awc_RID_Stats_clear_HmacTxBc, + awc_RID_Stats_clear_HmacTxUc, + awc_RID_Stats_clear_HmacTxFail, + awc_RID_Stats_clear_HmacRxMc, + awc_RID_Stats_clear_HmacRxBc, + awc_RID_Stats_clear_HmacRxUc, + awc_RID_Stats_clear_HmacRxDisca, + awc_RID_Stats_clear_HmacRxAcce, + awc_RID_Stats_clear_SsidMismatch, + awc_RID_Stats_clear_ApMismatch, + awc_RID_Stats_clear_RatesMismatc, + awc_RID_Stats_clear_AuthReject, + awc_RID_Stats_clear_AuthTimeout, + awc_RID_Stats_clear_AssocReject, + awc_RID_Stats_clear_AssocTimeout, + awc_RID_Stats_clear_NewReason, + awc_RID_Stats_clear_AuthFail_1, + awc_RID_Stats_clear_AuthFail_2, + awc_RID_Stats_clear_AuthFail_3, + awc_RID_Stats_clear_AuthFail_4, + awc_RID_Stats_clear_AuthFail_5, + awc_RID_Stats_clear_AuthFail_6, + awc_RID_Stats_clear_AuthFail_7, + awc_RID_Stats_clear_AuthFail_8, + awc_RID_Stats_clear_AuthFail_9, + awc_RID_Stats_clear_AuthFail_10, + awc_RID_Stats_clear_AuthFail_11, + awc_RID_Stats_clear_AuthFail_12, + awc_RID_Stats_clear_AuthFail_13, + awc_RID_Stats_clear_AuthFail_14, + awc_RID_Stats_clear_AuthFail_15, + awc_RID_Stats_clear_AuthFail_16, + awc_RID_Stats_clear_AuthFail_17, + awc_RID_Stats_clear_AuthFail_18, + awc_RID_Stats_clear_AuthFail_19, + awc_RID_Stats_clear_RxMan, + awc_RID_Stats_clear_TxMan, + awc_RID_Stats_clear_RxRefresh, + awc_RID_Stats_clear_TxRefresh, + awc_RID_Stats_clear_RxPoll, + awc_RID_Stats_clear_TxPoll, + awc_RID_Stats_clear_HostRetries, + awc_RID_Stats_clear_LostSync_HostReq, + awc_RID_Stats_clear_HostTxBytes, + awc_RID_Stats_clear_HostRxBytes, + awc_RID_Stats_clear_ElapsedUsec, + awc_RID_Stats_clear_ElapsedSec, + awc_RID_Stats_clear_LostSyncBett, + {0} +}; +#ifdef AWC_USE_16BIT_STATS +struct aironet4500_RID awc_Stats16_RID[]={ + awc_RID_Stats16_RidLen, + awc_RID_Stats16_RxOverrunErr, + awc_RID_Stats16_RxPlcpCrcErr, + awc_RID_Stats16_RxPlcpFormat, + awc_RID_Stats16_RxPlcpLength, + awc_RID_Stats16_RxMacCrcErr, + awc_RID_Stats16_RxMacCrcOk, + awc_RID_Stats16_RxWepErr, + awc_RID_Stats16_RxWepOk, + awc_RID_Stats16_RetryLong, + awc_RID_Stats16_RetryShort, + awc_RID_Stats16_MaxRetries, + awc_RID_Stats16_NoAck, + awc_RID_Stats16_NoCts, + awc_RID_Stats16_RxAck, + awc_RID_Stats16_RxCts, + awc_RID_Stats16_TxAck, + awc_RID_Stats16_TxRts, + awc_RID_Stats16_TxCts, + awc_RID_Stats16_TxMc, + awc_RID_Stats16_TxBc, + awc_RID_Stats16_TxUcFrags, + awc_RID_Stats16_TxUcPackets, + awc_RID_Stats16_TxBeacon, + awc_RID_Stats16_RxBeacon, + awc_RID_Stats16_TxSinColl, + awc_RID_Stats16_TxMulColl, + awc_RID_Stats16_DefersNo, + awc_RID_Stats16_DefersProt, + awc_RID_Stats16_DefersEngy, + awc_RID_Stats16_DupFram, + awc_RID_Stats16_RxFragDisc, + awc_RID_Stats16_TxAged, + awc_RID_Stats16_RxAged, + awc_RID_Stats16_LostSync_Max, + awc_RID_Stats16_LostSync_Mis, + awc_RID_Stats16_LostSync_Arl, + awc_RID_Stats16_LostSync_Dea, + awc_RID_Stats16_LostSync_Disa, + awc_RID_Stats16_LostSync_Tsf, + awc_RID_Stats16_HostTxMc, + awc_RID_Stats16_HostTxBc, + awc_RID_Stats16_HostTxUc, + awc_RID_Stats16_HostTxFail, + awc_RID_Stats16_HostRxMc, + awc_RID_Stats16_HostRxBc, + awc_RID_Stats16_HostRxUc, + awc_RID_Stats16_HostRxDiscar, + awc_RID_Stats16_HmacTxMc, + awc_RID_Stats16_HmacTxBc, + awc_RID_Stats16_HmacTxUc, + awc_RID_Stats16_HmacTxFail, + awc_RID_Stats16_HmacRxMc, + awc_RID_Stats16_HmacRxBc, + awc_RID_Stats16_HmacRxUc, + awc_RID_Stats16_HmacRxDisca, + awc_RID_Stats16_HmacRxAcce, + awc_RID_Stats16_SsidMismatch, + awc_RID_Stats16_ApMismatch, + awc_RID_Stats16_RatesMismatc, + awc_RID_Stats16_AuthReject, + awc_RID_Stats16_AuthTimeout, + awc_RID_Stats16_AssocReject, + awc_RID_Stats16_AssocTimeout, + awc_RID_Stats16_NewReason, + awc_RID_Stats16_AuthFail_1, + awc_RID_Stats16_AuthFail_2, + awc_RID_Stats16_AuthFail_3, + awc_RID_Stats16_AuthFail_4, + awc_RID_Stats16_AuthFail_5, + awc_RID_Stats16_AuthFail_6, + awc_RID_Stats16_AuthFail_7, + awc_RID_Stats16_AuthFail_8, + awc_RID_Stats16_AuthFail_9, + awc_RID_Stats16_AuthFail_10, + awc_RID_Stats16_AuthFail_11, + awc_RID_Stats16_AuthFail_12, + awc_RID_Stats16_AuthFail_13, + awc_RID_Stats16_AuthFail_14, + awc_RID_Stats16_AuthFail_15, + awc_RID_Stats16_AuthFail_16, + awc_RID_Stats16_AuthFail_17, + awc_RID_Stats16_AuthFail_18, + awc_RID_Stats16_AuthFail_19, + awc_RID_Stats16_RxMan, + awc_RID_Stats16_TxMan, + awc_RID_Stats16_RxRefresh, + awc_RID_Stats16_TxRefresh, + awc_RID_Stats16_RxPoll, + awc_RID_Stats16_TxPoll, + awc_RID_Stats16_HostRetries, + awc_RID_Stats16_LostSync_HostReq, + awc_RID_Stats16_HostTxBytes, + awc_RID_Stats16_HostRxBytes, + awc_RID_Stats16_ElapsedUsec, + awc_RID_Stats16_ElapsedSec, + awc_RID_Stats16_LostSyncBett, + {0} +}; + +struct aironet4500_RID awc_Stats16_delta_RID[]={ + awc_RID_Stats16_delta_RidLen, + awc_RID_Stats16_delta_RxOverrunErr, + awc_RID_Stats16_delta_RxPlcpCrcErr, + awc_RID_Stats16_delta_RxPlcpFormat, + awc_RID_Stats16_delta_RxPlcpLength, + awc_RID_Stats16_delta_RxMacCrcErr, + awc_RID_Stats16_delta_RxMacCrcOk, + awc_RID_Stats16_delta_RxWepErr, + awc_RID_Stats16_delta_RxWepOk, + awc_RID_Stats16_delta_RetryLong, + awc_RID_Stats16_delta_RetryShort, + awc_RID_Stats16_delta_MaxRetries, + awc_RID_Stats16_delta_NoAck, + awc_RID_Stats16_delta_NoCts, + awc_RID_Stats16_delta_RxAck, + awc_RID_Stats16_delta_RxCts, + awc_RID_Stats16_delta_TxAck, + awc_RID_Stats16_delta_TxRts, + awc_RID_Stats16_delta_TxCts, + awc_RID_Stats16_delta_TxMc, + awc_RID_Stats16_delta_TxBc, + awc_RID_Stats16_delta_TxUcFrags, + awc_RID_Stats16_delta_TxUcPackets, + awc_RID_Stats16_delta_TxBeacon, + awc_RID_Stats16_delta_RxBeacon, + awc_RID_Stats16_delta_TxSinColl, + awc_RID_Stats16_delta_TxMulColl, + awc_RID_Stats16_delta_DefersNo, + awc_RID_Stats16_delta_DefersProt, + awc_RID_Stats16_delta_DefersEngy, + awc_RID_Stats16_delta_DupFram, + awc_RID_Stats16_delta_RxFragDisc, + awc_RID_Stats16_delta_TxAged, + awc_RID_Stats16_delta_RxAged, + awc_RID_Stats16_delta_LostSync_Max, + awc_RID_Stats16_delta_LostSync_Mis, + awc_RID_Stats16_delta_LostSync_Arl, + awc_RID_Stats16_delta_LostSync_Dea, + awc_RID_Stats16_delta_LostSync_Disa, + awc_RID_Stats16_delta_LostSync_Tsf, + awc_RID_Stats16_delta_HostTxMc, + awc_RID_Stats16_delta_HostTxBc, + awc_RID_Stats16_delta_HostTxUc, + awc_RID_Stats16_delta_HostTxFail, + awc_RID_Stats16_delta_HostRxMc, + awc_RID_Stats16_delta_HostRxBc, + awc_RID_Stats16_delta_HostRxUc, + awc_RID_Stats16_delta_HostRxDiscar, + awc_RID_Stats16_delta_HmacTxMc, + awc_RID_Stats16_delta_HmacTxBc, + awc_RID_Stats16_delta_HmacTxUc, + awc_RID_Stats16_delta_HmacTxFail, + awc_RID_Stats16_delta_HmacRxMc, + awc_RID_Stats16_delta_HmacRxBc, + awc_RID_Stats16_delta_HmacRxUc, + awc_RID_Stats16_delta_HmacRxDisca, + awc_RID_Stats16_delta_HmacRxAcce, + awc_RID_Stats16_delta_SsidMismatch, + awc_RID_Stats16_delta_ApMismatch, + awc_RID_Stats16_delta_RatesMismatc, + awc_RID_Stats16_delta_AuthReject, + awc_RID_Stats16_delta_AuthTimeout, + awc_RID_Stats16_delta_AssocReject, + awc_RID_Stats16_delta_AssocTimeout, + awc_RID_Stats16_delta_NewReason, + awc_RID_Stats16_delta_AuthFail_1, + awc_RID_Stats16_delta_AuthFail_2, + awc_RID_Stats16_delta_AuthFail_3, + awc_RID_Stats16_delta_AuthFail_4, + awc_RID_Stats16_delta_AuthFail_5, + awc_RID_Stats16_delta_AuthFail_6, + awc_RID_Stats16_delta_AuthFail_7, + awc_RID_Stats16_delta_AuthFail_8, + awc_RID_Stats16_delta_AuthFail_9, + awc_RID_Stats16_delta_AuthFail_10, + awc_RID_Stats16_delta_AuthFail_11, + awc_RID_Stats16_delta_AuthFail_12, + awc_RID_Stats16_delta_AuthFail_13, + awc_RID_Stats16_delta_AuthFail_14, + awc_RID_Stats16_delta_AuthFail_15, + awc_RID_Stats16_delta_AuthFail_16, + awc_RID_Stats16_delta_AuthFail_17, + awc_RID_Stats16_delta_AuthFail_18, + awc_RID_Stats16_delta_AuthFail_19, + awc_RID_Stats16_delta_RxMan, + awc_RID_Stats16_delta_TxMan, + awc_RID_Stats16_delta_RxRefresh, + awc_RID_Stats16_delta_TxRefresh, + awc_RID_Stats16_delta_RxPoll, + awc_RID_Stats16_delta_TxPoll, + awc_RID_Stats16_delta_HostRetries, + awc_RID_Stats16_delta_LostSync_HostReq, + awc_RID_Stats16_delta_HostTxBytes, + awc_RID_Stats16_delta_HostRxBytes, + awc_RID_Stats16_delta_ElapsedUsec, + awc_RID_Stats16_delta_ElapsedSec, + awc_RID_Stats16_delta_LostSyncBett, + {0} +}; + +struct aironet4500_RID awc_Stats16_clear_RID[]={ + awc_RID_Stats16_clear_RidLen, + awc_RID_Stats16_clear_RxOverrunErr, + awc_RID_Stats16_clear_RxPlcpCrcErr, + awc_RID_Stats16_clear_RxPlcpFormat, + awc_RID_Stats16_clear_RxPlcpLength, + awc_RID_Stats16_clear_RxMacCrcErr, + awc_RID_Stats16_clear_RxMacCrcOk, + awc_RID_Stats16_clear_RxWepErr, + awc_RID_Stats16_clear_RxWepOk, + awc_RID_Stats16_clear_RetryLong, + awc_RID_Stats16_clear_RetryShort, + awc_RID_Stats16_clear_MaxRetries, + awc_RID_Stats16_clear_NoAck, + awc_RID_Stats16_clear_NoCts, + awc_RID_Stats16_clear_RxAck, + awc_RID_Stats16_clear_RxCts, + awc_RID_Stats16_clear_TxAck, + awc_RID_Stats16_clear_TxRts, + awc_RID_Stats16_clear_TxCts, + awc_RID_Stats16_clear_TxMc, + awc_RID_Stats16_clear_TxBc, + awc_RID_Stats16_clear_TxUcFrags, + awc_RID_Stats16_clear_TxUcPackets, + awc_RID_Stats16_clear_TxBeacon, + awc_RID_Stats16_clear_RxBeacon, + awc_RID_Stats16_clear_TxSinColl, + awc_RID_Stats16_clear_TxMulColl, + awc_RID_Stats16_clear_DefersNo, + awc_RID_Stats16_clear_DefersProt, + awc_RID_Stats16_clear_DefersEngy, + awc_RID_Stats16_clear_DupFram, + awc_RID_Stats16_clear_RxFragDisc, + awc_RID_Stats16_clear_TxAged, + awc_RID_Stats16_clear_RxAged, + awc_RID_Stats16_clear_LostSync_Max, + awc_RID_Stats16_clear_LostSync_Mis, + awc_RID_Stats16_clear_LostSync_Arl, + awc_RID_Stats16_clear_LostSync_Dea, + awc_RID_Stats16_clear_LostSync_Disa, + awc_RID_Stats16_clear_LostSync_Tsf, + awc_RID_Stats16_clear_HostTxMc, + awc_RID_Stats16_clear_HostTxBc, + awc_RID_Stats16_clear_HostTxUc, + awc_RID_Stats16_clear_HostTxFail, + awc_RID_Stats16_clear_HostRxMc, + awc_RID_Stats16_clear_HostRxBc, + awc_RID_Stats16_clear_HostRxUc, + awc_RID_Stats16_clear_HostRxDiscar, + awc_RID_Stats16_clear_HmacTxMc, + awc_RID_Stats16_clear_HmacTxBc, + awc_RID_Stats16_clear_HmacTxUc, + awc_RID_Stats16_clear_HmacTxFail, + awc_RID_Stats16_clear_HmacRxMc, + awc_RID_Stats16_clear_HmacRxBc, + awc_RID_Stats16_clear_HmacRxUc, + awc_RID_Stats16_clear_HmacRxDisca, + awc_RID_Stats16_clear_HmacRxAcce, + awc_RID_Stats16_clear_SsidMismatch, + awc_RID_Stats16_clear_ApMismatch, + awc_RID_Stats16_clear_RatesMismatc, + awc_RID_Stats16_clear_AuthReject, + awc_RID_Stats16_clear_AuthTimeout, + awc_RID_Stats16_clear_AssocReject, + awc_RID_Stats16_clear_AssocTimeout, + awc_RID_Stats16_clear_NewReason, + awc_RID_Stats16_clear_AuthFail_1, + awc_RID_Stats16_clear_AuthFail_2, + awc_RID_Stats16_clear_AuthFail_3, + awc_RID_Stats16_clear_AuthFail_4, + awc_RID_Stats16_clear_AuthFail_5, + awc_RID_Stats16_clear_AuthFail_6, + awc_RID_Stats16_clear_AuthFail_7, + awc_RID_Stats16_clear_AuthFail_8, + awc_RID_Stats16_clear_AuthFail_9, + awc_RID_Stats16_clear_AuthFail_10, + awc_RID_Stats16_clear_AuthFail_11, + awc_RID_Stats16_clear_AuthFail_12, + awc_RID_Stats16_clear_AuthFail_13, + awc_RID_Stats16_clear_AuthFail_14, + awc_RID_Stats16_clear_AuthFail_15, + awc_RID_Stats16_clear_AuthFail_16, + awc_RID_Stats16_clear_AuthFail_17, + awc_RID_Stats16_clear_AuthFail_18, + awc_RID_Stats16_clear_AuthFail_19, + awc_RID_Stats16_clear_RxMan, + awc_RID_Stats16_clear_TxMan, + awc_RID_Stats16_clear_RxRefresh, + awc_RID_Stats16_clear_TxRefresh, + awc_RID_Stats16_clear_RxPoll, + awc_RID_Stats16_clear_TxPoll, + awc_RID_Stats16_clear_HostRetries, + awc_RID_Stats16_clear_LostSync_HostReq, + awc_RID_Stats16_clear_HostTxBytes, + awc_RID_Stats16_clear_HostRxBytes, + awc_RID_Stats16_clear_ElapsedUsec, + awc_RID_Stats16_clear_ElapsedSec, + awc_RID_Stats16_clear_LostSyncBett, + {0} +}; + +#endif + +struct awc_rid_dir awc_rids[]={ + // following MUST be consistent with awc_rids_setup !!! + {&aironet4500_RID_Select_General_Config,sizeof(awc_gen_RID) / sizeof(struct aironet4500_RID) ,awc_gen_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_SSID_list, sizeof(awc_SSID_RID) / sizeof(struct aironet4500_RID) , awc_SSID_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_AP_list, sizeof(awc_AP_List_RID) / sizeof(struct aironet4500_RID) , awc_AP_List_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Driver_name, sizeof(awc_Dname_RID) / sizeof(struct aironet4500_RID) , awc_Dname_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Encapsulation, sizeof(awc_enc_RID) / sizeof(struct aironet4500_RID) , awc_enc_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Active_Config, sizeof(awc_act_RID) / sizeof(struct aironet4500_RID) , awc_act_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Capabilities, sizeof(awc_Cap_RID) / sizeof(struct aironet4500_RID) , awc_Cap_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Status, sizeof(awc_Status_RID) / sizeof(struct aironet4500_RID) , awc_Status_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_AP_Info, sizeof(awc_AP_RID) / sizeof(struct aironet4500_RID) , awc_AP_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats, sizeof(awc_Stats_RID) / sizeof(struct aironet4500_RID) , awc_Stats_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats_delta, sizeof(awc_Stats_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats_delta_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_32_stats_clear, sizeof(awc_Stats_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats_clear_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_WEP_volatile, sizeof(awc_WEPv_RID) / sizeof(struct aironet4500_RID) , awc_WEPv_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_WEP_nonvolatile, sizeof(awc_WEPnv_RID) / sizeof(struct aironet4500_RID) , awc_WEPnv_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_Modulation, sizeof(awc_Modulation_RID) / sizeof(struct aironet4500_RID) , awc_Modulation_RID , NULL, NULL,0 }, + +#ifdef AWC_USE_16BIT_STATS + {&aironet4500_RID_Select_16_stats, sizeof(awc_Stats16_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_16_stats_delta, sizeof(awc_Stats16_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_delta_RID , NULL, NULL,0 }, + {&aironet4500_RID_Select_16_stats_clear, sizeof(awc_Stats16_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_clear_RID , NULL, NULL,0 }, +#else + {NULL},{NULL},{NULL}, +#endif + + {0} + + +}; + + +int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1; + + +int awc_rids_setup(struct NET_DEVICE * dev){ + + struct awc_private * priv = (struct awc_private *) dev->priv; + int i=0; + while ( i < AWC_NOF_RIDS){ + if (awc_rids[i].selector) + memcpy(&priv->rid_dir[i],&awc_rids[i],sizeof(priv->rid_dir[0]) ); + else priv->rid_dir[i].selector = NULL; + i++; + } + for (i=0; i< AWC_NOF_RIDS && i < awc_nof_rids; i++){ + priv->rid_dir[i].dev = dev; + }; + + // following MUST be consistent with awc_rids !!! + priv->rid_dir[0].buff = &priv->config; // card RID mirrors + priv->rid_dir[1].buff = &priv->SSIDs; + priv->rid_dir[2].buff = &priv->fixed_APs; + priv->rid_dir[3].buff = &priv->driver_name; + priv->rid_dir[4].buff = &priv->enc_trans; + priv->rid_dir[5].buff = &priv->general_config; // + priv->rid_dir[6].buff = &priv->capabilities; + priv->rid_dir[7].buff = &priv->status; + priv->rid_dir[8].buff = &priv->AP; + priv->rid_dir[9].buff = &priv->statistics; + priv->rid_dir[10].buff = &priv->statistics_delta; + priv->rid_dir[11].buff = &priv->statistics_delta_clear; + priv->rid_dir[12].buff = &priv->wep_volatile; + priv->rid_dir[13].buff = &priv->wep_nonvolatile; + priv->rid_dir[14].buff = &priv->modulation; + + priv->rid_dir[15].buff = &priv->statistics16; + priv->rid_dir[16].buff = &priv->statistics16_delta; + priv->rid_dir[17].buff = &priv->statistics16_delta_clear; + + priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors + priv->rid_dir[1].bufflen = sizeof(priv->SSIDs); + priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs); + priv->rid_dir[3].bufflen = sizeof(priv->driver_name); + priv->rid_dir[4].bufflen = sizeof(priv->enc_trans); + priv->rid_dir[5].bufflen = sizeof(priv->general_config); // + priv->rid_dir[6].bufflen = sizeof(priv->capabilities); + priv->rid_dir[7].bufflen = sizeof(priv->status); + priv->rid_dir[8].bufflen = sizeof(priv->AP); + priv->rid_dir[9].bufflen = sizeof(priv->statistics); + priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta); + priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear); + priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile); + priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile); + priv->rid_dir[14].bufflen = sizeof(priv->modulation); + + priv->rid_dir[15].bufflen = sizeof(priv->statistics16); + priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta); + priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear); + + return 0; + +}; + + + + + diff -u --recursive --new-file v2.3.30/linux/drivers/net/lance.c linux/drivers/net/lance.c --- v2.3.30/linux/drivers/net/lance.c Wed Aug 18 11:36:42 1999 +++ linux/drivers/net/lance.c Tue Dec 7 15:38:22 1999 @@ -437,9 +437,9 @@ There are two HP versions, check the BIOS for the configuration port. This method provided by L. Julliard, Laurent_Julliard@grenoble.hp.com. */ - if (readw(0x000f0102) == 0x5048) { + if (isa_readw(0x000f0102) == 0x5048) { static const short ioaddr_table[] = { 0x300, 0x320, 0x340, 0x360}; - int hp_port = (readl(0x000f00f1) & 1) ? 0x499 : 0x99; + int hp_port = (isa_readl(0x000f00f1) & 1) ? 0x499 : 0x99; /* We can have boards other than the built-in! Verify this is on-board. */ if ((inb(hp_port) & 0xc0) == 0x80 && ioaddr_table[inb(hp_port) & 3] == ioaddr) diff -u --recursive --new-file v2.3.30/linux/drivers/net/pcmcia/Config.in linux/drivers/net/pcmcia/Config.in --- v2.3.30/linux/drivers/net/pcmcia/Config.in Thu Nov 11 20:11:41 1999 +++ linux/drivers/net/pcmcia/Config.in Tue Dec 7 14:33:32 1999 @@ -14,6 +14,7 @@ dep_tristate ' New Media PCMCIA support' CONFIG_PCMCIA_NMCLAN $CONFIG_PCMCIA dep_tristate ' SMC 91Cxx PCMCIA support' CONFIG_PCMCIA_SMC91C92 $CONFIG_PCMCIA dep_tristate ' Xircom 16-bit PCMCIA support' CONFIG_PCMCIA_XIRC2PS $CONFIG_PCMCIA + dep_tristate ' Aironet 4500/4800 PCMCIA support ' CONFIG_AIRONET4500_CS $CONFIG_AIRONET4500 $CONFIG_PCMCIA if [ "$CONFIG_CARDBUS" = "y" ]; then dep_tristate ' 3Com 3c575 CardBus support' CONFIG_PCMCIA_3C575 m diff -u --recursive --new-file v2.3.30/linux/drivers/net/pcmcia/Makefile linux/drivers/net/pcmcia/Makefile --- v2.3.30/linux/drivers/net/pcmcia/Makefile Thu Nov 11 20:11:41 1999 +++ linux/drivers/net/pcmcia/Makefile Tue Dec 7 14:33:32 1999 @@ -35,6 +35,7 @@ obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o obj-$(CONFIG_PCMCIA_NETWAVE) += netwave_cs.o obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan_cs.o +obj-$(CONFIG_AIRONET4500_CS) += aironet4500_cs.o # Cardbus client drivers obj-$(CONFIG_PCMCIA_3C575) += 3c575_cb.o diff -u --recursive --new-file v2.3.30/linux/drivers/net/pcmcia/aironet4500_cs.c linux/drivers/net/pcmcia/aironet4500_cs.c --- v2.3.30/linux/drivers/net/pcmcia/aironet4500_cs.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/net/pcmcia/aironet4500_cs.c Tue Dec 7 23:58:22 1999 @@ -0,0 +1,640 @@ +/* + * Aironet 4500 Pcmcia driver + * + * Elmer Joandi, Januar 1999 + * Copyright Elmer Joandi, all rights restricted + * + * + * Revision 0.1 ,started 30.12.1998 + * + * + */ + +static const char *awc_version = +"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n"; + + +#include +//#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#if LINUX_VERSION_CODE < 0x20300 +#ifdef MODULE +#include +#endif +#endif +#include + +#include "../aironet4500.h" + + +static u_int irq_mask = 0x5eF8; +static int awc_ports[] = {0x140,0x100,0xc0, 0x80 }; +#if LINUX_VERSION_CODE > 0x20100 +MODULE_PARM(irq_mask, "i"); + +#endif + + +#define RUN_AT(x) (jiffies+(x)) + +#ifdef PCMCIA_DEBUG +static int pc_debug = PCMCIA_DEBUG; +MODULE_PARM(pc_debug, "i"); +#define PC_DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) +static char *version = +"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n"; +#else +#define PC_DEBUG(n, args...) +#endif + +/* Index of functions. */ + +static dev_info_t dev_info = "aironet4500_cs"; + +static dev_link_t *awc_attach(void); +static void awc_detach(dev_link_t *); +static void awc_release(u_long arg); +static int awc_event(event_t event, int priority, + event_callback_args_t *args); + +static dev_link_t *dev_list = NULL; + +static void cs_error(client_handle_t handle, int func, int ret) +{ +#if CS_RELEASE_CODE < 0x2911 + CardServices(ReportError, dev_info, (void *)func, (void *)ret); +#else + error_info_t err = { func, ret }; + CardServices(ReportError, handle, &err); +#endif +} + +#define CFG_CHECK(fn, args...) if (CardServices(fn, args) != 0) goto next_entry + +static void flush_stale_links(void) +{ + dev_link_t *link, *next; + for (link = dev_list; link; link = next) { + next = link->next; + if (link->state & DEV_STALE_LINK) + awc_detach(link); + } +} + + +/* + We never need to do anything when a awc device is "initialized" + by the net software, because we only register already-found cards. +*/ + +static int awc_pcmcia_init(struct NET_DEVICE *dev) +{ + return awc_init(dev); + +} + +static int awc_pcmcia_open(struct NET_DEVICE *dev) +{ + dev_link_t *link; + int status; + + for (link = dev_list; link; link = link->next) + if (link->priv == dev) break; + if (!DEV_OK(link)) + return -ENODEV; + + status = awc_open(dev); + + if (!status ) + link->open++; + + return status; +} + +static int awc_pcmcia_close(struct NET_DEVICE *dev) +{ +// int ioaddr = dev->base_addr; + dev_link_t *link; + int ret; + + for (link = dev_list; link; link = link->next) + if (link->priv == dev) break; + if (link == NULL) + return -ENODEV; + + PC_DEBUG(2, "%s: closing device.\n", dev->name); + + link->open--; + ret = awc_close(dev); + + if (link->state & DEV_STALE_CONFIG) { + link->release.expires = RUN_AT( HZ/20 ); + link->state |= DEV_RELEASE_PENDING; + add_timer(&link->release); + } + return ret; +} + +/* + awc_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 *awc_attach(void) +{ + client_reg_t client_reg; + dev_link_t *link = NULL; + struct NET_DEVICE *dev = NULL; + int ret; + + PC_DEBUG(0, "awc_attach()\n"); + flush_stale_links(); + + /* Create the PC card device object. */ + link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + memset(link, 0, sizeof(struct dev_link_t)); + link->dev = kmalloc(sizeof(struct dev_node_t), GFP_KERNEL); + memset(link->dev, 0, sizeof(struct dev_node_t)); + + link->release.function = &awc_release; + link->release.data = (u_long)link; +// link->io.NumPorts1 = 32; + link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; +// link->io.IOAddrLines = 5; + link->irq.Attributes = IRQ_HANDLE_PRESENT ; // |IRQ_TYPE_EXCLUSIVE ; + link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; + link->irq.IRQInfo2 = irq_mask; + link->irq.Handler = &awc_interrupt; + link->conf.Attributes = CONF_ENABLE_IRQ; + link->conf.Vcc = 50; + link->conf.IntType = INT_MEMORY_AND_IO; + link->conf.ConfigIndex = 1; + link->conf.Present = PRESENT_OPTION; + + /* Create the network device object. */ + + 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"); + kfree(link->dev); + kfree(link); + return NULL; + }; + dev->priv = kmalloc(sizeof(struct awc_private), GFP_KERNEL); + if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); return NULL;}; + memset(dev->priv,0,sizeof(struct awc_private)); + +// link->dev->minor = dev->minor; +// link->dev->major = dev->major; + + /* The 4500-specific entries in the device structure. */ + +// dev->tx_queue_len = tx_queue_len; + + dev->hard_start_xmit = &awc_start_xmit; +// dev->set_config = &awc_config_misiganes,aga mitte awc_config; + dev->get_stats = &awc_get_stats; +// dev->set_multicast_list = &awc_set_multicast_list; + + ether_setup(dev); + + dev->name = ((struct awc_private *)dev->priv)->node.dev_name; + + dev->init = &awc_pcmcia_init; + dev->open = &awc_pcmcia_open; + dev->stop = &awc_pcmcia_close; + dev->tbusy = 1; + dev->start = 0; + + link->priv = dev; +#if CS_RELEASE_CODE > 0x2911 + link->irq.Instance = dev; +#endif + + /* 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 = &awc_event; + client_reg.Version = 0x0210; + client_reg.event_callback_args.client_data = link; + ret = CardServices(RegisterClient, &link->handle, &client_reg); + if (ret != 0) { + cs_error(link->handle, RegisterClient, ret); + awc_detach(link); + return NULL; + } + + return link; +} /* awc_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 awc_detach(dev_link_t *link) +{ + dev_link_t **linkp; + long flags; + int i=0; + + DEBUG(0, "awc_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) { + awc_release((u_long)link); + if (link->state & DEV_STALE_CONFIG) { + link->state |= DEV_STALE_LINK; + return; + } + } + + if (link->handle) + CardServices(DeregisterClient, link->handle); + + /* Unlink device structure, free bits */ + *linkp = link->next; + + i=0; + while ( i < MAX_AWCS) { + if (!aironet4500_devices[i]) + {i++; continue;} + if (aironet4500_devices[i] == link->priv){ + if (awc_proc_unset_fun) + awc_proc_unset_fun(i); + + aironet4500_devices[i]=0; + } + i++; + } + + if (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->dev, sizeof(struct dev_node_t)); + kfree_s(link, sizeof(struct dev_link_t)); + +} /* awc_detach */ + +/* + + awc_pcmcia_config() is scheduled to run after a CARD_INSERTION event + is received, to configure the PCMCIA socket, and to make the + ethernet device available to the system. + +*/ + +#define CS_CHECK(fn, args...) \ +while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed + +static void awc_pcmcia_config(dev_link_t *link) +{ + client_handle_t handle; + struct NET_DEVICE *dev; + struct awc_private *lp; + tuple_t tuple; + int ii; + cisparse_t parse; + u_short buf[64]; + int last_fn, last_ret, i = 0; +// int ioaddr; + u16 *phys_addr; + int retval; + + handle = link->handle; + dev = link->priv; + phys_addr = (u16 *)dev->dev_addr; + + PC_DEBUG(0, "awc_pcmcia_config(0x%p)\n", link); + + tuple.Attributes = 0; + tuple.DesiredTuple = CISTPL_CONFIG; + CS_CHECK(GetFirstTuple, handle, &tuple); + tuple.TupleData = (cisdata_t *)buf; + tuple.TupleDataMax = 64; + tuple.TupleOffset = 0; + 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; + + tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; + CS_CHECK(GetFirstTuple, handle, &tuple); + + while (1) { + cistpl_cftable_entry_t dflt = { 0 }; + cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); + CFG_CHECK(GetTupleData, handle, &tuple); + CFG_CHECK(ParseTuple, handle, &tuple, &parse); + + if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; + if (cfg->index == 0) goto next_entry; + link->conf.ConfigIndex = cfg->index; + + /* Use power settings for Vcc and Vpp if present */ + /* Note that the CIS values need to be rescaled */ + if (cfg->vcc.present & (1<conf.Vcc = cfg->vcc.param[CISTPL_POWER_VNOM]/10000; + else if (dflt.vcc.present & (1<conf.Vcc = dflt.vcc.param[CISTPL_POWER_VNOM]/10000; + + if (cfg->vpp1.present & (1<conf.Vpp1 = link->conf.Vpp2 = + cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; + else if (dflt.vpp1.present & (1<conf.Vpp1 = link->conf.Vpp2 = + dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; + + /* Do we need to allocate an interrupt? */ + if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) + link->conf.Attributes |= CONF_ENABLE_IRQ; + + /* IO window settings */ + link->io.NumPorts1 = link->io.NumPorts2 = 0; + if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; + link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; + if (!(io->flags & CISTPL_IO_8BIT)) + link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; + if (!(io->flags & CISTPL_IO_16BIT)) { + + link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; + printk(KERN_CRIT "8-bit IO not supported on this aironet 4500 driver \n"); + } + link->io.BasePort1 = io->win[0].base; + + link->io.NumPorts1 = io->win[0].len; + if (io->nwin > 1) { + link->io.Attributes2 = link->io.Attributes1; + link->io.BasePort2 = io->win[1].base; + link->io.NumPorts2 = io->win[1].len; + } + } + ii = 0; + last_fn = RequestIO; + while ((last_ret = CardServices(RequestIO, link->handle, &link->io)) ){ + + if (ii > 4) + goto cs_failed; + link->io.BasePort1 = awc_ports[ii]; + ii++; + }; + + + break; + + next_entry: + if (CardServices(GetNextTuple, handle, &tuple)) + break; + } + + if (link->conf.Attributes & CONF_ENABLE_IRQ){ + + ii = 0; last_fn = RequestIRQ; + while ((last_ret = CardServices(RequestIRQ, link->handle, &link->irq)) ){ + + ii++; + while (!(irq_mask & (1 << ii) ) && ii < 15) + ii++; + link->irq.IRQInfo2 = 1 << ii; + + if(ii > 15) + goto cs_failed; + printk("trying irq %d , mask %x \n",ii, link->irq.IRQInfo2); + + }; + } + + CS_CHECK(RequestConfiguration, link->handle, &link->conf); + + + dev->irq = link->irq.AssignedIRQ; + dev->base_addr = link->io.BasePort1; + + + awc_private_init( dev); + + + + retval = register_netdev(dev); + if (retval != 0) { + printk(KERN_NOTICE "awc_cs: register_netdev() failed for dev %x retval %x\n",(unsigned int)dev,retval); + goto failed; + } + + if(awc_pcmcia_init(dev)) goto failed; + + i=0; + while (aironet4500_devices[i] && i < MAX_AWCS-1) i++; + if (!aironet4500_devices[i]){ + aironet4500_devices[i]=dev; + if (awc_proc_set_fun) + awc_proc_set_fun(i); + } + + + link->state &= ~DEV_CONFIG_PENDING; + + lp = (struct awc_private *)dev->priv; + + DEBUG(1,"pcmcia config complete on port %x \n",(unsigned int)dev->base_addr); + + return; + +cs_failed: + cs_error(link->handle, last_fn, last_ret); + link->dev=NULL; +failed: + + awc_release((u_long)link); + return; + +} /* awc_pcmcia_config */ + +/* + After a card is removed, awc_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. + +*/ + +static void awc_release(u_long arg) +{ + dev_link_t *link = (dev_link_t *)arg; + struct NET_DEVICE *dev = link->priv; + + DEBUG(0, "awc_release(0x%p)\n", link); + + if (link->open) { + DEBUG(1, "awc_cs: release postponed, '%s' still open\n", + link->dev->dev_name); + link->state |= DEV_STALE_CONFIG; + return; + } + + CardServices(ReleaseConfiguration, link->handle); + CardServices(ReleaseIO, link->handle, &link->io); + CardServices(ReleaseIRQ, link->handle, &link->irq); + + CardServices(ReleaseWindow, link->win); + if (link->dev) + unregister_netdev(dev); + // link->dev = NULL; + + link->state &= ~DEV_CONFIG; + if (link->state & DEV_STALE_LINK) + awc_detach(link); + +} /* awc_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 net drivers from trying + to talk to the card any more. +*/ + +static int awc_event(event_t event, int priority, + event_callback_args_t *args) +{ + dev_link_t *link = args->client_data; + struct NET_DEVICE *dev = link->priv; + + PC_DEBUG(1, "awc_event(0x%06x)\n", event); + + switch (event) { + case CS_EVENT_CARD_REMOVAL: + link->state &= ~DEV_PRESENT; + if (link->state & DEV_CONFIG) { + dev->tbusy = 1; dev->start = 0; + link->release.expires = RUN_AT( HZ/20 ); + add_timer(&link->release); + } + break; + case CS_EVENT_CARD_INSERTION: + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + awc_pcmcia_config(link); + break; + case CS_EVENT_PM_SUSPEND: + link->state |= DEV_SUSPEND; + /* Fall through... */ + case CS_EVENT_RESET_PHYSICAL: + if (link->state & DEV_CONFIG) { + if (link->open) { + dev->tbusy = 1; dev->start = 0; + } + CardServices(ReleaseConfiguration, link->handle); + } + break; + case CS_EVENT_PM_RESUME: + link->state &= ~DEV_SUSPEND; + /* Fall through... */ + case CS_EVENT_CARD_RESET: + if (link->state & DEV_CONFIG) { + CardServices(RequestConfiguration, link->handle, &link->conf); + if (link->open) { + // awc_reset(dev); + dev->tbusy = 0; dev->start = 1; + } + } + break; + } + return 0; +} /* awc_event */ + + + +int init_module(void) +{ + servinfo_t serv; + + /* Always emit the version, before any failure. */ + printk(KERN_INFO"%s", awc_version); + PC_DEBUG(0, "%s\n", version); + CardServices(GetCardServicesInfo, &serv); + if (serv.Revision != CS_RELEASE_CODE) { + printk(KERN_NOTICE "awc_cs: Card Services release " + "does not match!\n"); + return -1; + } + register_pcmcia_driver(&dev_info, &awc_attach, &awc_detach); + return 0; +} + +void cleanup_module(void) +{ + DEBUG(0, "awc_cs: unloading %c ",'\n'); + unregister_pcmcia_driver(&dev_info); + + while (dev_list != NULL) { + if (dev_list->state & DEV_CONFIG) + awc_release((u_long)dev_list); + awc_detach(dev_list); + } + +// while (dev_list != NULL) +// awc_detach(dev_list); +} + + \ No newline at end of file diff -u --recursive --new-file v2.3.30/linux/drivers/net/setup.c linux/drivers/net/setup.c --- v2.3.30/linux/drivers/net/setup.c Tue Nov 23 22:42:20 1999 +++ linux/drivers/net/setup.c Tue Dec 7 14:33:32 1999 @@ -22,6 +22,10 @@ extern int yam_init(void); extern int acenic_probe(void); +extern int awc4500_pci_probe(void); +extern int awc4500_isa_probe(void); +extern int awc4500_pnp_probe(void); +extern int awc4500_365_probe(void); extern int arcnet_init(void); extern int bigmac_probe(void); extern int bmac_probe(void); @@ -214,6 +218,22 @@ {starfire_probe, 0}, #endif +/* +* +* Wireless non-HAM +* +*/ +#ifdef CONFIG_AIRONET4500_NONCS + +#ifdef CONFIG_AIRONET4500_PCI + {awc4500_pci_probe,0}, +#endif + +#ifdef CONFIG_AIRONET4500_PNP + {awc4500_pnp_probe,0}, +#endif + +#endif /* * Amateur Radio Drivers */ diff -u --recursive --new-file v2.3.30/linux/drivers/pci/Config.in linux/drivers/pci/Config.in --- v2.3.30/linux/drivers/pci/Config.in Wed Dec 31 16:00:00 1969 +++ linux/drivers/pci/Config.in Tue Dec 7 15:38:22 1999 @@ -0,0 +1,7 @@ +# +# PCI configuration +# + +if [ "$CONFIG_PCI" = "y" ]; then + bool 'PCI device name database' CONFIG_PCI_NAMES +fi diff -u --recursive --new-file v2.3.30/linux/drivers/pci/Makefile linux/drivers/pci/Makefile --- v2.3.30/linux/drivers/pci/Makefile Thu Nov 11 20:11:42 1999 +++ linux/drivers/pci/Makefile Tue Dec 7 15:37:17 1999 @@ -33,10 +33,10 @@ include $(TOPDIR)/Rules.make -names.o: names.c devlist.h +names.o: names.c devlist.h classlist.h -devlist.h: pci.ids gen-devlist - ./gen-devlist devlist.h +devlist.h classlist.h: pci.ids gen-devlist + ./gen-devlist */ @@ -8,13 +8,13 @@ #include static void -pq(char *c) +pq(FILE *f, char *c) { while (*c) { if (*c == '"') - printf("\\\""); + fprintf(f, "\\\""); else - putchar(*c); + fputc(*c, f); c++; } } @@ -24,6 +24,15 @@ { char line[1024], *c, vend[8]; int vendors = 0; + int mode = 0; + FILE *devf, *clsf; + + devf = fopen("devlist.h", "w"); + clsf = fopen("classlist.h", "w"); + if (!devf || !clsf) { + fprintf(stderr, "Cannot create output file!\n"); + return 1; + } while (fgets(line, sizeof(line)-1, stdin)) { if ((c = strchr(line, '\n'))) @@ -31,36 +40,65 @@ if (!line[0] || line[0] == '#') continue; if (line[1] == ' ') { - vend[0] = 0; - continue; + if (line[0] == 'C' && strlen(line) > 4 && line[4] == ' ') { + vend[0] = line[2]; + vend[1] = line[3]; + vend[2] = 0; + mode = 2; + } else goto err; } - if (line[0] == '\t') { - if (vend[0] && strlen(line) > 5 && line[5] == ' ') { - c = line + 5; - while (*c == ' ') - *c++ = 0; - printf("\tDEVICE(%s,%s,\"", vend, line+1); - pq(c); - puts("\")"); + else if (line[0] == '\t') { + if (line[1] == '\t') + continue; + switch (mode) { + case 1: + if (strlen(line) > 5 && line[5] == ' ') { + c = line + 5; + while (*c == ' ') + *c++ = 0; + fprintf(devf, "\tDEVICE(%s,%s,\"", vend, line+1); + pq(devf, c); + fputs("\")\n", devf); + } else goto err; + break; + case 2: + if (strlen(line) > 3 && line[3] == ' ') { + c = line + 3; + while (*c == ' ') + *c++ = 0; + fprintf(clsf, "CLASS(%s%s, \"%s\")\n", vend, line+1, c); + } else goto err; + break; + default: + goto err; } } else if (strlen(line) > 4 && line[4] == ' ') { c = line + 4; while (*c == ' ') *c++ = 0; if (vendors) - puts("ENDVENDOR()\n"); + fputs("ENDVENDOR()\n\n", devf); vendors++; strcpy(vend, line); - printf("VENDOR(%s,\"", vend); - pq(c); - puts("\")"); + fprintf(devf, "VENDOR(%s,\"", vend); + pq(devf, c); + fputs("\")\n", devf); + mode = 1; + } else { + err: + fprintf(stderr, "Syntax error in mode %d: %s\n", mode, line); + return 1; } } - puts("ENDVENDOR()\n\ + fputs("ENDVENDOR()\n\ \n\ #undef VENDOR\n\ #undef DEVICE\n\ -#undef ENDVENDOR"); +#undef ENDVENDOR\n", devf); + fputs("\n#undef CLASS", clsf); + + fclose(devf); + fclose(clsf); return 0; } diff -u --recursive --new-file v2.3.30/linux/drivers/pci/names.c linux/drivers/pci/names.c --- v2.3.30/linux/drivers/pci/names.c Thu Nov 11 20:11:42 1999 +++ linux/drivers/pci/names.c Tue Dec 7 15:38:22 1999 @@ -1,9 +1,7 @@ /* - * $Id: oldproc.c,v 1.24 1998/10/11 15:13:04 mj Exp $ + * PCI Class and Device Name Tables * - * Backward-compatible procfs interface for PCI. - * - * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter, + * Copyright 1993--1999 Drew Eckhardt, Frederic Potter, * David Mosberger-Tang, Martin Mares */ @@ -12,6 +10,8 @@ #include #include +#ifdef CONFIG_PCI_NAMES + struct pci_device_info { unsigned short device; unsigned short seen; @@ -92,3 +92,43 @@ } } } + +/* + * Class names. Not in .init section as they are needed in runtime. + */ + +static u16 pci_class_numbers[] = { +#define CLASS(x,y) 0x##x, +#include "classlist.h" +}; + +static char *pci_class_names[] = { +#define CLASS(x,y) y, +#include "classlist.h" +}; + +char * +pci_class_name(u32 class) +{ + int i; + + for(i=0; iname, "PCI device %04x:%04x", dev->vendor, dev->device); +} + +char * +pci_class_name(u32 class) +{ + return NULL; +} + +#endif diff -u --recursive --new-file v2.3.30/linux/drivers/pci/pci.c linux/drivers/pci/pci.c --- v2.3.30/linux/drivers/pci/pci.c Tue Dec 7 09:32:44 1999 +++ linux/drivers/pci/pci.c Tue Dec 7 15:37:17 1999 @@ -491,13 +491,16 @@ pci_read_config_word(dev, PCI_CB_SUBSYSTEM_ID, &dev->subsystem_device); break; default: /* unknown header */ - bad: printk(KERN_ERR "PCI: device %s has unknown header type %02x, ignoring.\n", dev->slot_name, hdr_type); continue; + bad: + printk(KERN_ERR "PCI: %s: class %x doesn't match header type %02x. Ignoring class.\n", + dev->slot_name, class, hdr_type); + dev->class = PCI_CLASS_NOT_DEFINED; } - DBG("PCI: %02x:%02x [%04x/%04x]\n", bus->number, dev->devfn, dev->vendor, dev->device); + DBG("PCI: %02x:%02x [%04x/%04x] %06x %02x\n", bus->number, dev->devfn, dev->vendor, dev->device, class, hdr_type); /* * Put it into the global PCI device chain. It's used to diff -u --recursive --new-file v2.3.30/linux/drivers/pci/pci.ids linux/drivers/pci/pci.ids --- v2.3.30/linux/drivers/pci/pci.ids Tue Dec 7 09:32:44 1999 +++ linux/drivers/pci/pci.ids Tue Dec 7 15:37:17 1999 @@ -4,7 +4,7 @@ # Maintained by Martin Mares # If you have any new entries, send them to the maintainer. # -# $Id: pci.ids,v 1.41 1999/10/30 09:25:10 mj Exp $ +# $Id: pci.ids,v 1.43 1999/12/04 12:32:55 mj Exp $ # # Vendors, devices and subsystems. Please keep sorted. @@ -221,6 +221,7 @@ 1113 1207 EN-1207-TX Fast Ethernet 1109 2400 ANA-6944A/TX Fast Ethernet 1186 1100 DFE-500TX Fast Ethernet + 1186 1112 DFE-570TX Fast Ethernet 1282 9100 AEF-380TXD Fast Ethernet 2646 0001 KNE100TX Fast Ethernet 000a 21230 Video Codec @@ -649,9 +650,12 @@ 1092 0157 FIRE GL 1000 PRO 1097 3d01 Jeronimo Pro 3d3d 0100 Reference Permedia 2 3D - 8000 LYNX FireWire Host Controller + 8000 PCILynx/PCILynx2 IEEE 1394 Link Layer Controller + e4bf 1010 CF1-1-SNARE + e4bf 1020 CF1-2-SNARE 8009 OHCI Compliant FireWire Controller 8019 TSB12LV23 OHCI Compliant IEEE-1394 Controller + e4bf 1010 CF2-1-CYMBAL a001 TDC1570 a100 TDC1561 ac10 PCI1050 @@ -671,6 +675,7 @@ fe00 FireWire Host Controller fe03 12C01A FireWire Host Controller 104d Sony Corporation + 8039 CXD3222 iLINK Controller 104e Oak Technology, Inc 0017 OTI-64017 0107 OTI-107 [Spitfire] @@ -1236,6 +1241,8 @@ 1683 IGA-1683 2000 CyberPro 2000 2010 CyberPro 2000A + 5000 CyberPro 5000 + 5050 CyberPro 5050 10eb Artists Graphics 0101 3GA 8111 Twist3 Frame Grabber @@ -1483,7 +1490,7 @@ 112e Infomedia Microelectronics Inc. 112f Imaging Technology Inc 0000 MVC IC-PCI - 0001 Video frame grabber/processor + 0001 MVC IM-PCI Video frame grabber/processor 1130 Computervision 1131 Philips Semiconductors 7145 SAA7145 @@ -2202,6 +2209,7 @@ 1280 Photoscript Group Ltd. 1281 Yokogawa Electric Corporation 1282 Davicom Semiconductor, Inc. + 9102 Ethernet 100/10 MBit 1283 Integrated Technology Express, Inc. 673a IT8330G 8330 IT8330G @@ -2271,6 +2279,7 @@ 12b8 Korg 12b9 US Robotics/3Com 1006 WinModem + 1008 56K FaxModem Model 5610 12ba PMC Sierra 12bb Nippon Unisoft Corporation 12bc Array Microsystems @@ -2286,6 +2295,7 @@ 12c4 Connect Tech Inc 12c5 Picture Elements Incorporated 0081 PCIVST [Grayscale Thresholding Engine] + 0086 THR2 Thresholder 12c6 Mitani Corporation 12c7 Dialogic Corp 12c8 G Force Co, Ltd @@ -2436,22 +2446,40 @@ 131d Sysmic, Inc. 131e Xinex Networks Inc 131f Siig Inc + 1000 CyberSerial (1-port) 16550 + 1001 CyberSerial (1-port) 16650 + 1002 CyberSerial (1-port) 16850 1010 Duet 1S(16550)+1P 1011 Duet 1S(16650)+1P 1012 Duet 1S(16850)+1P 1020 CyberParallel (1-port) 1021 CyberParallel (2-port) + 1030 CyberSerial (2-port) 16550 + 1031 CyberSerial (2-port) 16650 + 1032 CyberSerial (2-port) 16850 1034 Trio 2S(16550)+1P 1035 Trio 2S(16650)+1P 1036 Trio 2S(16850)+1P + 1050 CyberSerial (4-port) 16550 + 1051 CyberSerial (4-port) 16650 + 1052 CyberSerial (4-port) 16850 + 2000 CyberSerial (1-port) 16550 + 2001 CyberSerial (1-port) 16650 + 2002 CyberSerial (1-port) 16850 2010 Duet 1S(16550)+1P 2011 Duet 1S(16650)+1P 2012 Duet 1S(16850)+1P 2020 CyberParallel (1-port) 2021 CyberParallel (2-port) + 2030 CyberSerial (2-port) 16550 + 2031 CyberSerial (2-port) 16650 + 2032 CyberSerial (2-port) 16850 2040 Trio 1S(16550)+2P 2041 Trio 1S(16650)+2P 2042 Trio 1S(16850)+2P + 2050 CyberSerial (4-port) 16550 + 2051 CyberSerial (4-port) 16650 + 2052 CyberSerial (4-port) 16850 2060 Trio 2S(16550)+1P 2061 Trio 2S(16650)+1P 2062 Trio 2S(16850)+1P @@ -2572,7 +2600,9 @@ 1395 Ambicom Inc 1396 Cipher Systems Inc 1397 Cologne Chip Designs GmbH - 2bd0 ISDN network controller + 2bd0 ISDN network controller [HFC-PCI] + 1397 2bd0 ISDN Board + e4bf 1000 CI1-1-Harp 1398 Clarion co. Ltd 1399 Rios systems Co Ltd 139a Alacritech Inc @@ -2705,6 +2735,7 @@ 1410 Midas lab Inc 1411 Ikos Systems Inc 1412 IC Ensemble Inc + 1712 ICE1712 [Envy24] 1413 Addonics 1414 Microsoft Corporation 1415 Oxford Semiconductor Ltd @@ -2969,7 +3000,10 @@ 1517 ECHOTEK Corp 1518 PEP MODULAR Computers GmbH 1519 TELEFON AKTIEBOLAGET LM Ericsson -151a GLOBETEK Inc +151a Globetek + 1002 PCI-1002 + 1004 PCI-1004 + 1008 PCI-1008 151b COMBOX Ltd 151c DIGITAL AUDIO LABS Inc 151d Fujitsu Computer Products Of America @@ -3310,6 +3344,11 @@ 103c 10C7 MegaRaid T5 1111 1111 MegaRaid 466 113c 03A2 MegaRaid + 2410 82801 82810 Chipset ISA Bridge (LPC) + 2411 82801 82810 Chipset IDE + 2412 82801 82810 Chipset USB + 2413 82801 82810 Chipset SMBus + 2418 82801 82810 PCI Bridge 5200 EtherExpress PRO/100 5201 EtherExpress PRO/100 7000 82371SB PIIX3 ISA [Natoma/Triton II] @@ -3485,6 +3524,7 @@ 0001 Model 300 128k 0059 0001 128k ISDN-S/T Adapter 0059 0003 128k ISDN-U Adapter +e4bf EKF Elektronik GmbH eabb Aashima Technology B.V. ecc0 Echo Corporation edd8 ARK Logic Inc diff -u --recursive --new-file v2.3.30/linux/drivers/pci/proc.c linux/drivers/pci/proc.c --- v2.3.30/linux/drivers/pci/proc.c Tue Dec 7 09:32:44 1999 +++ linux/drivers/pci/proc.c Tue Dec 7 15:37:17 1999 @@ -306,84 +306,6 @@ * Backward compatible /proc/pci interface. */ -static const char *pci_strclass (unsigned int class) -{ - switch (class >> 8) { - case PCI_CLASS_NOT_DEFINED: return "Non-VGA device"; - case PCI_CLASS_NOT_DEFINED_VGA: return "VGA compatible device"; - - case PCI_CLASS_STORAGE_SCSI: return "SCSI storage controller"; - case PCI_CLASS_STORAGE_IDE: return "IDE interface"; - case PCI_CLASS_STORAGE_FLOPPY: return "Floppy disk controller"; - case PCI_CLASS_STORAGE_IPI: return "IPI bus controller"; - case PCI_CLASS_STORAGE_RAID: return "RAID bus controller"; - case PCI_CLASS_STORAGE_OTHER: return "Unknown mass storage controller"; - - case PCI_CLASS_NETWORK_ETHERNET: return "Ethernet controller"; - case PCI_CLASS_NETWORK_TOKEN_RING: return "Token ring network controller"; - case PCI_CLASS_NETWORK_FDDI: return "FDDI network controller"; - case PCI_CLASS_NETWORK_ATM: return "ATM network controller"; - case PCI_CLASS_NETWORK_OTHER: return "Network controller"; - - case PCI_CLASS_DISPLAY_VGA: return "VGA compatible controller"; - case PCI_CLASS_DISPLAY_XGA: return "XGA compatible controller"; - case PCI_CLASS_DISPLAY_OTHER: return "Display controller"; - - case PCI_CLASS_MULTIMEDIA_VIDEO: return "Multimedia video controller"; - case PCI_CLASS_MULTIMEDIA_AUDIO: return "Multimedia audio controller"; - case PCI_CLASS_MULTIMEDIA_OTHER: return "Multimedia controller"; - - case PCI_CLASS_MEMORY_RAM: return "RAM memory"; - case PCI_CLASS_MEMORY_FLASH: return "FLASH memory"; - case PCI_CLASS_MEMORY_OTHER: return "Memory"; - - case PCI_CLASS_BRIDGE_HOST: return "Host bridge"; - case PCI_CLASS_BRIDGE_ISA: return "ISA bridge"; - case PCI_CLASS_BRIDGE_EISA: return "EISA bridge"; - case PCI_CLASS_BRIDGE_MC: return "MicroChannel bridge"; - case PCI_CLASS_BRIDGE_PCI: return "PCI bridge"; - case PCI_CLASS_BRIDGE_PCMCIA: return "PCMCIA bridge"; - case PCI_CLASS_BRIDGE_NUBUS: return "NuBus bridge"; - case PCI_CLASS_BRIDGE_CARDBUS: return "CardBus bridge"; - case PCI_CLASS_BRIDGE_OTHER: return "Bridge"; - - case PCI_CLASS_COMMUNICATION_SERIAL: return "Serial controller"; - case PCI_CLASS_COMMUNICATION_PARALLEL: return "Parallel controller"; - case PCI_CLASS_COMMUNICATION_OTHER: return "Communication controller"; - - case PCI_CLASS_SYSTEM_PIC: return "PIC"; - case PCI_CLASS_SYSTEM_DMA: return "DMA controller"; - case PCI_CLASS_SYSTEM_TIMER: return "Timer"; - case PCI_CLASS_SYSTEM_RTC: return "RTC"; - case PCI_CLASS_SYSTEM_OTHER: return "System peripheral"; - - case PCI_CLASS_INPUT_KEYBOARD: return "Keyboard controller"; - case PCI_CLASS_INPUT_PEN: return "Digitizer Pen"; - case PCI_CLASS_INPUT_MOUSE: return "Mouse controller"; - case PCI_CLASS_INPUT_OTHER: return "Input device controller"; - - case PCI_CLASS_DOCKING_GENERIC: return "Generic Docking Station"; - case PCI_CLASS_DOCKING_OTHER: return "Docking Station"; - - case PCI_CLASS_PROCESSOR_386: return "386"; - case PCI_CLASS_PROCESSOR_486: return "486"; - case PCI_CLASS_PROCESSOR_PENTIUM: return "Pentium"; - case PCI_CLASS_PROCESSOR_ALPHA: return "Alpha"; - case PCI_CLASS_PROCESSOR_POWERPC: return "Power PC"; - case PCI_CLASS_PROCESSOR_CO: return "Co-processor"; - - case PCI_CLASS_SERIAL_FIREWIRE: return "FireWire (IEEE 1394)"; - case PCI_CLASS_SERIAL_ACCESS: return "ACCESS Bus"; - case PCI_CLASS_SERIAL_SSA: return "SSA"; - case PCI_CLASS_SERIAL_USB: return "USB Controller"; - case PCI_CLASS_SERIAL_FIBER: return "Fiber Channel"; - - case PCI_CLASS_HOT_SWAP_CONTROLLER: return "Hot Swap Controller"; - - default: return "Unknown class"; - } -} - /* * Convert some of the configuration space registers of the device at * address (bus,devfn) into a string (possibly several lines each). @@ -392,8 +314,8 @@ */ static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) { - unsigned int class_rev; - unsigned char latency, min_gnt, max_lat; + u32 class_rev; + unsigned char latency, min_gnt, max_lat, *class; int reg, len = 0; pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); @@ -404,10 +326,12 @@ return -1; len += sprintf(buf + len, " Bus %2d, device %3d, function %2d:\n", dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); - len += sprintf(buf + len, " %s: %s (rev %d).\n", - pci_strclass(class_rev >> 8), - dev->name, - class_rev & 0xff); + class = pci_class_name(class_rev >> 16); + if (class) + len += sprintf(buf+len, " %s", class); + else + len += sprintf(buf+len, " Class %04x", class_rev >> 16); + len += sprintf(buf+len, ": %s (rev %d).\n", dev->name, class_rev & 0xff); if (dev->irq) { if (len + 40 > size) @@ -512,7 +436,7 @@ { if (pci_present()) { proc_bus_pci_dir = proc_mkdir("pci", proc_bus); - create_proc_info_entry("devices",0, proc_bus_pci_dir, + create_proc_info_entry("devices", 0, proc_bus_pci_dir, get_pci_dev_info); proc_bus_pci_add(pci_root); create_proc_read_entry("pci", 0, NULL, pci_read_proc, NULL); diff -u --recursive --new-file v2.3.30/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c --- v2.3.30/linux/drivers/scsi/aic7xxx.c Tue Dec 7 09:32:45 1999 +++ linux/drivers/scsi/aic7xxx.c Tue Dec 7 21:58:30 1999 @@ -9084,7 +9084,7 @@ * aic7xxx_setup */ if(aic7xxx) - aic7xxx_setup(aic7xxx, NULL); + aic7xxx_setup(aic7xxx); if(dummy_buffer[0] != 'P') printk(KERN_WARNING "aic7xxx: Please read the file /usr/src/linux/drivers" "/scsi/README.aic7xxx\n" diff -u --recursive --new-file v2.3.30/linux/drivers/scsi/sgiwd93.c linux/drivers/scsi/sgiwd93.c --- v2.3.30/linux/drivers/scsi/sgiwd93.c Thu Nov 11 20:11:48 1999 +++ linux/drivers/scsi/sgiwd93.c Wed Dec 8 08:39:41 1999 @@ -257,7 +257,7 @@ hcp->desc.pnext = PHYSADDR(buf); } -int __init sgiwd93_detect(Scsi_Host_Template *HPsUX) +int __init sgiwd93_detect(Scsi_Host_Template *SGIblows) { static unsigned char called = 0; struct hpc3_scsiregs *hregs = &hpc3c0->scsi_chan0; @@ -267,9 +267,9 @@ if(called) return 0; /* Should bitch on the console about this... */ - HPsUX->proc_name = "SGIWD93"; + SGIblows->proc_name = "SGIWD93"; - sgiwd93_host = scsi_register(HPsUX, sizeof(struct WD33C93_hostdata)); + sgiwd93_host = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata)); sgiwd93_host->base = (unsigned char *) hregs; sgiwd93_host->irq = 1; diff -u --recursive --new-file v2.3.30/linux/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c --- v2.3.30/linux/drivers/sound/sonicvibes.c Tue Dec 7 09:32:46 1999 +++ linux/drivers/sound/sonicvibes.c Tue Dec 7 10:12:01 1999 @@ -83,6 +83,7 @@ * OSS more closely; remove possible wakeup race * 28.10.99 0.22 More waitqueue races fixed * 01.12.99 0.23 New argument to allocate_resource + * 07.12.99 0.24 More allocate_resource semantics change * */ @@ -2434,7 +2435,7 @@ if (!pci_present()) /* No PCI bus in this machine! */ return -ENODEV; - printk(KERN_INFO "sv: version v0.23 time " __TIME__ " " __DATE__ "\n"); + printk(KERN_INFO "sv: version v0.24 time " __TIME__ " " __DATE__ "\n"); #if 0 if (!(wavetable_mem = __get_free_pages(GFP_KERNEL, 20-PAGE_SHIFT))) printk(KERN_INFO "sv: cannot allocate 1MB of contiguous nonpageable memory for wavetable data\n"); @@ -2458,7 +2459,7 @@ memcpy(ddmaname, sv_ddma_name, ddmanamelen); pcidev->resource[RESOURCE_DDMA].name = ddmaname; if (allocate_resource(&ioport_resource, pcidev->resource+RESOURCE_DDMA, - 2*SV_EXTENT_DMA, 0x1000, 0x10000-2*SV_EXTENT_DMA, 1024, pcidev)) { + 2*SV_EXTENT_DMA, 0x1000, 0x10000-2*SV_EXTENT_DMA, 1024, NULL, NULL)) { pcidev->resource[RESOURCE_DDMA].name = NULL; kfree(ddmaname); printk(KERN_ERR "sv: cannot allocate DDMA controller io ports\n"); diff -u --recursive --new-file v2.3.30/linux/drivers/usb/Config.in linux/drivers/usb/Config.in --- v2.3.30/linux/drivers/usb/Config.in Tue Nov 23 22:42:21 1999 +++ linux/drivers/usb/Config.in Wed Dec 8 10:45:44 1999 @@ -29,7 +29,6 @@ dep_tristate ' EZUSB Firmware downloader' CONFIG_USB_EZUSB $CONFIG_USB comment 'USB Devices' - dep_tristate ' USB hub support (Required!)' CONFIG_USB_HUB $CONFIG_USB dep_tristate ' USB mouse support' CONFIG_USB_MOUSE $CONFIG_USB dep_tristate ' USB HP scanner support' CONFIG_USB_HP_SCANNER $CONFIG_USB dep_tristate ' USB keyboard support' CONFIG_USB_KBD $CONFIG_USB diff -u --recursive --new-file v2.3.30/linux/drivers/usb/Makefile linux/drivers/usb/Makefile --- v2.3.30/linux/drivers/usb/Makefile Thu Nov 11 20:11:49 1999 +++ linux/drivers/usb/Makefile Wed Dec 8 10:45:44 1999 @@ -72,14 +72,6 @@ MI_OBJS +=hp_scanner.o endif -ifeq ($(CONFIG_USB_HUB),y) - L_OBJS += hub.o -endif -ifeq ($(CONFIG_USB_HUB),m) - M_OBJS += hub.o - MI_OBJS += hub.o -endif - ifeq ($(CONFIG_USB_ACM),y) L_OBJS += acm.o endif @@ -212,9 +204,11 @@ $(LD) $(LD_RFLAG) -r -o $@ ohci-hcd.o ohci-root-hub.o ifeq ($(CONFIG_USB_PROC),y) -usbcore.o: usb.o usb-debug.o usb-core.o proc_usb.o - $(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o proc_usb.o +usbcore.o: usb.o usb-debug.o usb-core.o proc_usb.o hub.o + $(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o proc_usb.o \ + hub.o else -usbcore.o: usb.o usb-debug.o usb-core.o - $(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o +usbcore.o: usb.o usb-debug.o usb-core.o hub.o + $(LD) $(LD_RFLAG) -r -o $@ usb.o usb-debug.o usb-core.o \ + hub.o endif diff -u --recursive --new-file v2.3.30/linux/drivers/usb/hub.c linux/drivers/usb/hub.c --- v2.3.30/linux/drivers/usb/hub.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/hub.c Wed Dec 8 10:45:44 1999 @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -519,16 +518,3 @@ */ usb_deregister(&hub_driver); } /* usb_hub_cleanup() */ - -#ifdef MODULE -int init_module(void) -{ - return usb_hub_init(); -} - -void cleanup_module(void) -{ - usb_hub_cleanup(); -} -#endif - diff -u --recursive --new-file v2.3.30/linux/drivers/usb/usb-core.c linux/drivers/usb/usb-core.c --- v2.3.30/linux/drivers/usb/usb-core.c Sun Nov 7 16:37:34 1999 +++ linux/drivers/usb/usb-core.c Wed Dec 8 10:45:44 1999 @@ -33,6 +33,8 @@ #ifdef CONFIG_USB_PROC proc_usb_init(); #endif + usb_hub_init(); + #ifndef CONFIG_USB_MODULE # ifdef CONFIG_USB_UHCI uhci_init(); @@ -70,9 +72,6 @@ # ifdef CONFIG_USB_DC2XX usb_dc2xx_init(); # endif -# ifdef CONFIG_USB_HUB - usb_hub_init(); -# endif # ifdef CONFIG_USB_SCSI usb_scsi_init(); # endif @@ -89,10 +88,8 @@ #ifdef CONFIG_USB_PROC proc_usb_cleanup (); #endif + usb_hub_cleanup(); #ifndef MODULE -# ifdef CONFIG_USB_HUB - usb_hub_cleanup(); -# endif # ifdef CONFIG_USB_MOUSE usb_mouse_cleanup(); # endif diff -u --recursive --new-file v2.3.30/linux/drivers/usb/usb_scsi.c linux/drivers/usb/usb_scsi.c --- v2.3.30/linux/drivers/usb/usb_scsi.c Tue Nov 23 22:42:21 1999 +++ linux/drivers/usb/usb_scsi.c Tue Dec 7 10:07:45 1999 @@ -1,11 +1,12 @@ - /* Driver for USB SCSI-like devices * - * (C) Michael Gee (michael@linuxspecific.com) 1999 + * (c) 1999 Michael Gee (michael@linuxspecific.com) + * (c) 1999 Matthew Dharm (mdharm@one-eyed-alien.net) * - * This driver is schizoid - it makes a USB device appear as both a SCSI device - * and a character device. The latter is only available if the device has an - * interrupt endpoint, and is used specifically to receive interrupt events. + * This driver is schizoid - it makes a USB device appear as both a SCSI + * device and a character device. The latter is only available if the device + * has an interrupt endpoint, and is used specifically to receive interrupt + * events. * * In order to support various 'strange' devices, this module supports plug-in * device-specific filter modules, which can do their own thing when required. @@ -58,7 +59,7 @@ #ifdef REWRITE_PROJECT #define IRQ_PERIOD 255 #else -#define IRQ_PERIOD 0 /* single IRQ transfer then remove it */ +#define IRQ_PERIOD 0 /* single IRQ transfer then remove it */ #endif /* @@ -70,38 +71,37 @@ int usbscsi_debug = 1; struct us_data { - struct us_data *next; /* next device */ - struct usb_device *pusb_dev; - struct usb_scsi_filter *filter; /* filter driver */ - void *fdata; /* filter data */ - unsigned int flags; /* from filter initially */ - __u8 ifnum; /* interface number */ - __u8 ep_in; /* in endpoint */ - __u8 ep_out; /* out ....... */ - __u8 ep_int; /* interrupt . */ - __u8 subclass; /* as in overview */ - __u8 protocol; /* .............. */ - __u8 attention_done; /* force attention on first command */ - int (*pop)(Scsi_Cmnd *); /* protocol specific do cmd */ - int (*pop_reset)(struct us_data *); /* ................. device reset */ - GUID(guid); /* unique dev id */ - struct Scsi_Host *host; /* our dummy host data */ - Scsi_Host_Template *htmplt; /* own host template */ - int host_number; /* to find us */ - int host_no; /* allocated by scsi */ - int fixedlength; /* expand commands */ - Scsi_Cmnd *srb; /* current srb */ - int action; /* what to do */ - wait_queue_head_t waitq; /* thread waits */ - wait_queue_head_t ip_waitq; /* for CBI interrupts */ - __u16 ip_data; /* interrupt data */ - int ip_wanted; /* needed */ - int pid; /* control thread */ - struct semaphore *notify; /* wait for thread to begin */ - void *irq_handle; /* for USB interrupt requests */ - unsigned int irqpipe; /* remember pipe for release_irq */ - int mode_xlate; /* if current SCSI command is MODE_6 */ - /* but is translated to MODE_10 for UFI */ + struct us_data *next; /* next device */ + struct usb_device *pusb_dev; + struct usb_scsi_filter *filter; /* filter driver */ + void *fdata; /* filter data */ + unsigned int flags; /* from filter initially */ + __u8 ifnum; /* interface number */ + __u8 ep_in; /* in endpoint */ + __u8 ep_out; /* out ....... */ + __u8 ep_int; /* interrupt . */ + __u8 subclass; /* as in overview */ + __u8 protocol; /* .............. */ + __u8 attention_done; /* force attn on first cmd */ + int (*pop)(Scsi_Cmnd *); /* protocol specific do cmd */ + int (*pop_reset)(struct us_data *); /* ........... device reset */ + GUID(guid); /* unique dev id */ + struct Scsi_Host *host; /* our dummy host data */ + Scsi_Host_Template *htmplt; /* own host template */ + int host_number; /* to find us */ + int host_no; /* allocated by scsi */ + int fixedlength; /* expand commands */ + Scsi_Cmnd *srb; /* current srb */ + int action; /* what to do */ + wait_queue_head_t waitq; /* thread waits */ + wait_queue_head_t ip_waitq; /* for CBI interrupts */ + __u16 ip_data; /* interrupt data */ + int ip_wanted; /* needed */ + int pid; /* control thread */ + struct semaphore *notify; /* wait for thread to begin */ + void *irq_handle; /* for USB int requests */ + unsigned int irqpipe; /* pipe for release_irq */ + int mode_xlate; /* trans MODE_6 to _10? */ }; /* @@ -131,230 +131,230 @@ static int us_one_transfer(struct us_data *us, int pipe, char *buf, int length) { - int max_size = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)) * 16; - int this_xfer; - int result; - unsigned long partial; - int maxtry = 100; - while (length) { - this_xfer = length > max_size ? max_size : length; - length -= this_xfer; - do { - /* US_DEBUGP("Bulk xfer %x(%d)\n", (unsigned int)buf, this_xfer); */ - result = usb_bulk_msg(us->pusb_dev, pipe, buf, - this_xfer, &partial, HZ*5); - - if (result != 0 || partial != this_xfer) - US_DEBUGP("bulk_msg returned %d xferred %lu/%d\n", - result, partial, this_xfer); - - if (result == USB_ST_STALL) { - US_DEBUGP("clearing endpoint halt for pipe %x\n", pipe); - usb_clear_halt(us->pusb_dev, - usb_pipeendpoint(pipe) | (pipe & USB_DIR_IN)); - } - - /* we want to retry if the device reported NAK */ - if (result == USB_ST_TIMEOUT) { - if (partial != this_xfer) { - return 0; /* I do not like this */ - } - if (!maxtry--) - break; - this_xfer -= partial; - buf += partial; - } else if (!result && partial != this_xfer) { - /* short data - assume end */ - result = USB_ST_DATAUNDERRUN; - break; - } else if (result == USB_ST_STALL && us->protocol == US_PR_CB) { - if (!maxtry--) - break; - this_xfer -= partial; - buf += partial; - } else - break; - } while ( this_xfer ); - if (result) - return result; - buf += this_xfer; - } + int max_size = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)) * 16; + int this_xfer; + int result; + unsigned long partial; + int maxtry = 100; + while (length) { + this_xfer = length > max_size ? max_size : length; + length -= this_xfer; + do { + US_DEBUGP("Bulk xfer %x(%d)\n", (unsigned int)buf, this_xfer); + result = usb_bulk_msg(us->pusb_dev, pipe, buf, + this_xfer, &partial, HZ*5); + + if (result != 0 || partial != this_xfer) + US_DEBUGP("bulk_msg returned %d xferred %lu/%d\n", + result, partial, this_xfer); + + if (result == USB_ST_STALL) { + US_DEBUGP("clearing endpoint halt for pipe %x\n", pipe); + usb_clear_halt(us->pusb_dev, + usb_pipeendpoint(pipe) | (pipe & USB_DIR_IN)); + } - return 0; + /* we want to retry if the device reported NAK */ + if (result == USB_ST_TIMEOUT) { + if (partial != this_xfer) { + return 0; /* I do not like this */ + } + if (!maxtry--) + break; + this_xfer -= partial; + buf += partial; + } else if (!result && partial != this_xfer) { + /* short data - assume end */ + result = USB_ST_DATAUNDERRUN; + break; + } else if (result == USB_ST_STALL && us->protocol == US_PR_CB) { + if (!maxtry--) + break; + this_xfer -= partial; + buf += partial; + } else + break; + } while ( this_xfer ); + if (result) + return result; + buf += this_xfer; + } + + return 0; } static int us_transfer(Scsi_Cmnd *srb, int dir_in) { - struct us_data *us = (struct us_data *)srb->host_scribble; - int i; - int result = -1; - unsigned int pipe = dir_in ? usb_rcvbulkpipe(us->pusb_dev, us->ep_in) : - usb_sndbulkpipe(us->pusb_dev, us->ep_out); - - if (srb->use_sg) { - struct scatterlist *sg = (struct scatterlist *) srb->request_buffer; - - for (i = 0; i < srb->use_sg; i++) { - result = us_one_transfer(us, pipe, sg[i].address, sg[i].length); - if (result) - break; + struct us_data *us = (struct us_data *)srb->host_scribble; + int i; + int result = -1; + unsigned int pipe = dir_in ? usb_rcvbulkpipe(us->pusb_dev, us->ep_in) : + usb_sndbulkpipe(us->pusb_dev, us->ep_out); + + if (srb->use_sg) { + struct scatterlist *sg = (struct scatterlist *) srb->request_buffer; + + for (i = 0; i < srb->use_sg; i++) { + result = us_one_transfer(us, pipe, sg[i].address, sg[i].length); + if (result) + break; + } } - } - else - result = us_one_transfer(us, pipe, - srb->request_buffer, srb->request_bufflen); - - if (result) - US_DEBUGP("us_transfer returning error %d\n", result); - return result; + else + result = us_one_transfer(us, pipe, + srb->request_buffer, srb->request_bufflen); + + if (result) + US_DEBUGP("us_transfer returning error %d\n", result); + return result; } static unsigned int us_transfer_length(Scsi_Cmnd *srb) { - int i; - unsigned int total = 0; + int i; + unsigned int total = 0; - /* always zero for some commands */ - switch (srb->cmnd[0]) { - case SEEK_6: - case SEEK_10: - case REZERO_UNIT: - case ALLOW_MEDIUM_REMOVAL: - case START_STOP: - case TEST_UNIT_READY: - return 0; + /* always zero for some commands */ + switch (srb->cmnd[0]) { + case SEEK_6: + case SEEK_10: + case REZERO_UNIT: + case ALLOW_MEDIUM_REMOVAL: + case START_STOP: + case TEST_UNIT_READY: + return 0; + + default: + break; + } + + if (srb->use_sg) { + struct scatterlist *sg = (struct scatterlist *) srb->request_buffer; - default: - break; - } - - if (srb->use_sg) { - struct scatterlist *sg = (struct scatterlist *) srb->request_buffer; - - for (i = 0; i < srb->use_sg; i++) { - total += sg[i].length; - } - return total; - } - else - return srb->request_bufflen; + for (i = 0; i < srb->use_sg; i++) { + total += sg[i].length; + } + return total; + } + else + return srb->request_bufflen; } static int pop_CBI_irq(int state, void *buffer, int len, void *dev_id) { - struct us_data *us = (struct us_data *)dev_id; + struct us_data *us = (struct us_data *)dev_id; - if (state != USB_ST_REMOVED) { - us->ip_data = le16_to_cpup((__u16 *)buffer); - /* US_DEBUGP("Interrupt Status %x\n", us->ip_data); */ - } - if (us->ip_wanted) { - us->ip_wanted = 0; - wake_up(&us->ip_waitq); - } + if (state != USB_ST_REMOVED) { + us->ip_data = le16_to_cpup((__u16 *)buffer); + /* US_DEBUGP("Interrupt Status %x\n", us->ip_data); */ + } + if (us->ip_wanted) { + us->ip_wanted = 0; + wake_up(&us->ip_waitq); + } - /* we don't want another interrupt */ - return 0; + /* we don't want another interrupt */ + return 0; } static int pop_CB_reset(struct us_data *us) { - unsigned char cmd[12]; - int result; + unsigned char cmd[12]; + int result; - US_DEBUGP("pop_CB_reset\n"); + US_DEBUGP("pop_CB_reset\n"); - memset(cmd, -1, sizeof(cmd)); - cmd[0] = SEND_DIAGNOSTIC; - cmd[1] = 4; - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, - 0, us->ifnum, cmd, sizeof(cmd), HZ*5); + memset(cmd, -1, sizeof(cmd)); + cmd[0] = SEND_DIAGNOSTIC; + cmd[1] = 4; + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), + US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, + 0, us->ifnum, cmd, sizeof(cmd), HZ*5); - /* long wait for reset */ + /* long wait for reset */ - schedule_timeout(HZ*6); + schedule_timeout(HZ*6); - US_DEBUGP("pop_CB_reset: clearing endpoint halt\n"); - usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN); - usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT); + US_DEBUGP("pop_CB_reset: clearing endpoint halt\n"); + usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN); + usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT); - US_DEBUGP("pop_CB_reset done\n"); - return 0; + US_DEBUGP("pop_CB_reset done\n"); + return 0; } static int pop_CB_command(Scsi_Cmnd *srb) { - struct us_data *us = (struct us_data *)srb->host_scribble; - unsigned char cmd[16]; - int result; - int retry = 5; - int done_start = 0; + struct us_data *us = (struct us_data *)srb->host_scribble; + unsigned char cmd[16]; + int result; + int retry = 5; + int done_start = 0; - while (retry--) { + while (retry--) { - if (us->flags & US_FL_FIXED_COMMAND) { - memset(cmd, 0, us->fixedlength); + if (us->flags & US_FL_FIXED_COMMAND) { + memset(cmd, 0, us->fixedlength); - /* fix some commands */ + /* fix some commands */ - switch (srb->cmnd[0]) { - case WRITE_6: - case READ_6: - cmd[0] = srb->cmnd[0] | 0x20; - cmd[1] = srb->cmnd[1] & 0xE0; - cmd[2] = 0; - cmd[3] = srb->cmnd[1] & 0x1F; - cmd[4] = srb->cmnd[2]; - cmd[5] = srb->cmnd[3]; - cmd[8] = srb->cmnd[4]; - break; + switch (srb->cmnd[0]) { + case WRITE_6: + case READ_6: + cmd[0] = srb->cmnd[0] | 0x20; + cmd[1] = srb->cmnd[1] & 0xE0; + cmd[2] = 0; + cmd[3] = srb->cmnd[1] & 0x1F; + cmd[4] = srb->cmnd[2]; + cmd[5] = srb->cmnd[3]; + cmd[8] = srb->cmnd[4]; + break; - case MODE_SENSE: - case MODE_SELECT: - us->mode_xlate = (srb->cmnd[0] == MODE_SENSE); - cmd[0] = srb->cmnd[0] | 0x40; - cmd[1] = srb->cmnd[1]; - cmd[2] = srb->cmnd[2]; - cmd[8] = srb->cmnd[4]; - break; + case MODE_SENSE: + case MODE_SELECT: + us->mode_xlate = (srb->cmnd[0] == MODE_SENSE); + cmd[0] = srb->cmnd[0] | 0x40; + cmd[1] = srb->cmnd[1]; + cmd[2] = srb->cmnd[2]; + cmd[8] = srb->cmnd[4]; + break; - default: - us->mode_xlate = 0; - memcpy(cmd, srb->cmnd, srb->cmd_len); - break; - } - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, - 0, us->ifnum, - cmd, us->fixedlength, HZ*5); - if (!done_start && (us->subclass == US_SC_UFI /*|| us->subclass == US_SC_8070*/) - && cmd[0] == TEST_UNIT_READY && result) { - /* as per spec try a start command, wait and retry */ - - done_start++; - memset(cmd, 0, sizeof(cmd)); - cmd[0] = START_STOP; - cmd[4] = 1; /* start */ - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, - 0, us->ifnum, - cmd, us->fixedlength, HZ*5); - wait_ms(100); - retry++; - continue; - } - } else { - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, - 0, us->ifnum, - srb->cmnd, srb->cmd_len, HZ*5); - } - if (/*result != USB_ST_STALL &&*/ result != USB_ST_TIMEOUT) - return result; - } + default: + us->mode_xlate = 0; + memcpy(cmd, srb->cmnd, srb->cmd_len); + break; + } + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), + US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, + 0, us->ifnum, + cmd, us->fixedlength, HZ*5); + if (!done_start && (us->subclass == US_SC_UFI /*|| us->subclass == US_SC_8070*/) + && cmd[0] == TEST_UNIT_READY && result) { + /* as per spec try a start command, wait and retry */ + + done_start++; + memset(cmd, 0, sizeof(cmd)); + cmd[0] = START_STOP; + cmd[4] = 1; /* start */ + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), + US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, + 0, us->ifnum, + cmd, us->fixedlength, HZ*5); + wait_ms(100); + retry++; + continue; + } + } else { + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), + US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE, + 0, us->ifnum, + srb->cmnd, srb->cmd_len, HZ*5); + } + if (/*result != USB_ST_STALL &&*/ result != USB_ST_TIMEOUT) + return result; + } - return result; + return result; } /* @@ -363,237 +363,237 @@ static int pop_CB_status(Scsi_Cmnd *srb) { - struct us_data *us = (struct us_data *)srb->host_scribble; - int result; - __u8 status[2]; - int retry = 5; - - US_DEBUGP("pop_CB_status, proto=%x\n", us->protocol); - switch (us->protocol) { - case US_PR_CB: - /* get from control */ - - while (retry--) { - result = usb_control_msg(us->pusb_dev, usb_rcvctrlpipe(us->pusb_dev,0), - USB_REQ_GET_STATUS, USB_DIR_IN | USB_TYPE_STANDARD | USB_RT_DEVICE, - 0, us->ifnum, - status, sizeof(status), HZ*5); - if (result != USB_ST_TIMEOUT) + struct us_data *us = (struct us_data *)srb->host_scribble; + int result; + __u8 status[2]; + int retry = 5; + + US_DEBUGP("pop_CB_status, proto=%x\n", us->protocol); + switch (us->protocol) { + case US_PR_CB: + /* get from control */ + + while (retry--) { + result = usb_control_msg(us->pusb_dev, usb_rcvctrlpipe(us->pusb_dev,0), + USB_REQ_GET_STATUS, USB_DIR_IN | USB_TYPE_STANDARD | USB_RT_DEVICE, + 0, us->ifnum, + status, sizeof(status), HZ*5); + if (result != USB_ST_TIMEOUT) + break; + } + if (result) { + US_DEBUGP("Bad AP status request %d\n", result); + return DID_ABORT << 16; + } + US_DEBUGP("Got AP status %x %x\n", status[0], status[1]); + if (srb->cmnd[0] != REQUEST_SENSE && srb->cmnd[0] != INQUIRY && + ( (status[0] & ~3) || status[1])) + return (DID_OK << 16) | 2; + else + return DID_OK << 16; break; - } - if (result) { - US_DEBUGP("Bad AP status request %d\n", result); - return DID_ABORT << 16; - } - US_DEBUGP("Got AP status %x %x\n", status[0], status[1]); - if (srb->cmnd[0] != REQUEST_SENSE && srb->cmnd[0] != INQUIRY && - ( (status[0] & ~3) || status[1])) - return (DID_OK << 16) | 2; - else - return DID_OK << 16; - break; - case US_PR_CBI: - /* get from interrupt pipe */ + case US_PR_CBI: + /* get from interrupt pipe */ - /* add interrupt transfer, marked for removal */ - us->ip_wanted = 1; - us->irqpipe = usb_rcvintpipe(us->pusb_dev, us->ep_int); - result = usb_request_irq(us->pusb_dev, us->irqpipe, pop_CBI_irq, - IRQ_PERIOD, (void *)us, &us->irq_handle); - if (result) { - US_DEBUGP("usb_request_irq failed (0x%x), No interrupt for CBI\n", - result); - return DID_ABORT << 16; - } + /* add interrupt transfer, marked for removal */ + us->ip_wanted = 1; + us->irqpipe = usb_rcvintpipe(us->pusb_dev, us->ep_int); + result = usb_request_irq(us->pusb_dev, us->irqpipe, pop_CBI_irq, + IRQ_PERIOD, (void *)us, &us->irq_handle); + if (result) { + US_DEBUGP("usb_request_irq failed (0x%x), No interrupt for CBI\n", + result); + return DID_ABORT << 16; + } - sleep_on(&us->ip_waitq); + sleep_on(&us->ip_waitq); #ifdef REWRITE_PROJECT - usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe); - us->irq_handle = NULL; + usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe); + us->irq_handle = NULL; #endif - if (us->ip_wanted) { - US_DEBUGP("Did not get interrupt on CBI\n"); - us->ip_wanted = 0; - return DID_ABORT << 16; - } + if (us->ip_wanted) { + US_DEBUGP("Did not get interrupt on CBI\n"); + us->ip_wanted = 0; + return DID_ABORT << 16; + } - US_DEBUGP("Got interrupt data %x\n", us->ip_data); + US_DEBUGP("Got interrupt data %x\n", us->ip_data); - /* sort out what it means */ + /* sort out what it means */ - if (us->subclass == US_SC_UFI) { - /* gives us asc and ascq, as per request sense */ + if (us->subclass == US_SC_UFI) { + /* gives us asc and ascq, as per request sense */ - if (srb->cmnd[0] == REQUEST_SENSE || - srb->cmnd[0] == INQUIRY) - return DID_OK << 16; - else - return (DID_OK << 16) + ((us->ip_data & 0xff) ? 2 : 0); + if (srb->cmnd[0] == REQUEST_SENSE || + srb->cmnd[0] == INQUIRY) + return DID_OK << 16; + else + return (DID_OK << 16) + ((us->ip_data & 0xff) ? 2 : 0); + } + if (us->ip_data & 0xff) { + US_DEBUGP("Bad CBI interrupt data %x\n", us->ip_data); + return DID_ABORT << 16; + } + return (DID_OK << 16) + ((us->ip_data & 0x300) ? 2 : 0); } - if (us->ip_data & 0xff) { - US_DEBUGP("Bad CBI interrupt data %x\n", us->ip_data); - return DID_ABORT << 16; - } - return (DID_OK << 16) + ((us->ip_data & 0x300) ? 2 : 0); - } - return DID_ERROR << 16; + return DID_ERROR << 16; } /* Protocol command handlers */ static int pop_CBI(Scsi_Cmnd *srb) { - int result; + int result; - /* run the command */ + /* run the command */ - if ((result = pop_CB_command(srb))) { - US_DEBUGP("CBI command %x\n", result); - if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) { - return (DID_OK << 16) | 2; + if ((result = pop_CB_command(srb))) { + US_DEBUGP("CBI command %x\n", result); + if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) { + return (DID_OK << 16) | 2; + } + return DID_ERROR << 16; } - return DID_ERROR << 16; - } - /* transfer the data */ + /* transfer the data */ - if (us_transfer_length(srb)) { - result = us_transfer(srb, US_DIRECTION(srb->cmnd[0])); - if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) { - US_DEBUGP("CBI transfer %x\n", result); - return DID_ERROR << 16; - } + if (us_transfer_length(srb)) { + result = us_transfer(srb, US_DIRECTION(srb->cmnd[0])); + if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) { + US_DEBUGP("CBI transfer %x\n", result); + return DID_ERROR << 16; + } #if 0 - else if (result == USB_ST_DATAUNDERRUN) { - return DID_OK << 16; - } - } else { - if (!result) { - return DID_OK << 16; - } + else if (result == USB_ST_DATAUNDERRUN) { + return DID_OK << 16; + } + } else { + if (!result) { + return DID_OK << 16; + } #endif - } + } - /* get status */ - return pop_CB_status(srb); + /* get status */ + return pop_CB_status(srb); } static int pop_Bulk_reset(struct us_data *us) { - int result; + int result; - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - US_BULK_RESET, USB_TYPE_CLASS | USB_RT_INTERFACE, - US_BULK_RESET_HARD, us->ifnum, - NULL, 0, HZ*5); - if (result) - US_DEBUGP("Bulk hard reset failed %d\n", result); - usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN); - usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT); + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), + US_BULK_RESET, USB_TYPE_CLASS | USB_RT_INTERFACE, + US_BULK_RESET_HARD, us->ifnum, + NULL, 0, HZ*5); + if (result) + US_DEBUGP("Bulk hard reset failed %d\n", result); + usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN); + usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT); - /* long wait for reset */ + /* long wait for reset */ - schedule_timeout(HZ*6); + schedule_timeout(HZ*6); - return result; + return result; } /* * The bulk only protocol handler. - * Uses the in and out endpoints to transfer commands and data (nasty) + * Uses the in and out endpoints to transfer commands and data (nasty) */ static int pop_Bulk(Scsi_Cmnd *srb) { - struct us_data *us = (struct us_data *)srb->host_scribble; - struct bulk_cb_wrap bcb; - struct bulk_cs_wrap bcs; - int result; - unsigned long partial; - int stall; - - /* set up the command wrapper */ - - bcb.Signature = US_BULK_CB_SIGN; - bcb.DataTransferLength = us_transfer_length(srb);; - bcb.Flags = US_DIRECTION(srb->cmnd[0]) << 7; - bcb.Tag = srb->serial_number; - bcb.Lun = 0; - memset(bcb.CDB, 0, sizeof(bcb.CDB)); - memcpy(bcb.CDB, srb->cmnd, srb->cmd_len); - if (us->flags & US_FL_FIXED_COMMAND) { - bcb.Length = us->fixedlength; - } else { - bcb.Length = srb->cmd_len; - } - - /* send it to out endpoint */ - - US_DEBUGP("Bulk command S %x T %x L %d F %d CL %d\n", - bcb.Signature, bcb.Tag, bcb.DataTransferLength, - bcb.Flags, bcb.Length); - result = usb_bulk_msg(us->pusb_dev, - usb_sndbulkpipe(us->pusb_dev, us->ep_out), &bcb, - US_BULK_CB_WRAP_LEN, &partial, HZ*5); - if (result) { - US_DEBUGP("Bulk command result %x\n", result); - return DID_ABORT << 16; - } - - //return DID_BAD_TARGET << 16; - /* send/receive data */ - - if (bcb.DataTransferLength) { - result = us_transfer(srb, bcb.Flags); - if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) { - US_DEBUGP("Bulk transfer result %x\n", result); - return DID_ABORT << 16; + struct us_data *us = (struct us_data *)srb->host_scribble; + struct bulk_cb_wrap bcb; + struct bulk_cs_wrap bcs; + int result; + unsigned long partial; + int stall; + + /* set up the command wrapper */ + + bcb.Signature = US_BULK_CB_SIGN; + bcb.DataTransferLength = us_transfer_length(srb);; + bcb.Flags = US_DIRECTION(srb->cmnd[0]) << 7; + bcb.Tag = srb->serial_number; + bcb.Lun = 0; + memset(bcb.CDB, 0, sizeof(bcb.CDB)); + memcpy(bcb.CDB, srb->cmnd, srb->cmd_len); + if (us->flags & US_FL_FIXED_COMMAND) { + bcb.Length = us->fixedlength; + } else { + bcb.Length = srb->cmd_len; } - } - /* get status */ + /* send it to out endpoint */ - stall = 0; - do { + US_DEBUGP("Bulk command S %x T %x L %d F %d CL %d\n", + bcb.Signature, bcb.Tag, bcb.DataTransferLength, + bcb.Flags, bcb.Length); result = usb_bulk_msg(us->pusb_dev, - usb_rcvbulkpipe(us->pusb_dev, us->ep_in), &bcs, - US_BULK_CS_WRAP_LEN, &partial, HZ*5); - if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) - stall++; - else - break; - } while ( stall < 3); - if (result && result != USB_ST_DATAUNDERRUN) { - US_DEBUGP("Bulk status result = %x\n", result); - return DID_ABORT << 16; - } - - /* check bulk status */ - - US_DEBUGP("Bulk status S %x T %x R %d V %x\n", - bcs.Signature, bcs.Tag, bcs.Residue, bcs.Status); - if (bcs.Signature != US_BULK_CS_SIGN || bcs.Tag != bcb.Tag || - bcs.Status > US_BULK_STAT_PHASE) { - US_DEBUGP("Bulk logical error\n"); - return DID_ABORT << 16; - } - switch (bcs.Status) { - case US_BULK_STAT_OK: - return DID_OK << 16; - - case US_BULK_STAT_FAIL: - /* check for underrun - dont report */ - if (bcs.Residue) - return DID_OK << 16; - //pop_Bulk_reset(us); - break; + usb_sndbulkpipe(us->pusb_dev, us->ep_out), &bcb, + US_BULK_CB_WRAP_LEN, &partial, HZ*5); + if (result) { + US_DEBUGP("Bulk command result %x\n", result); + return DID_ABORT << 16; + } - case US_BULK_STAT_PHASE: - return DID_ERROR << 16; - } + //return DID_BAD_TARGET << 16; + /* send/receive data */ + + if (bcb.DataTransferLength) { + result = us_transfer(srb, bcb.Flags); + if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) { + US_DEBUGP("Bulk transfer result %x\n", result); + return DID_ABORT << 16; + } + } + + /* get status */ + + stall = 0; + do { + result = usb_bulk_msg(us->pusb_dev, + usb_rcvbulkpipe(us->pusb_dev, us->ep_in), &bcs, + US_BULK_CS_WRAP_LEN, &partial, HZ*5); + if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) + stall++; + else + break; + } while ( stall < 3); + if (result && result != USB_ST_DATAUNDERRUN) { + US_DEBUGP("Bulk status result = %x\n", result); + return DID_ABORT << 16; + } + + /* check bulk status */ + + US_DEBUGP("Bulk status S %x T %x R %d V %x\n", + bcs.Signature, bcs.Tag, bcs.Residue, bcs.Status); + if (bcs.Signature != US_BULK_CS_SIGN || bcs.Tag != bcb.Tag || + bcs.Status > US_BULK_STAT_PHASE) { + US_DEBUGP("Bulk logical error\n"); + return DID_ABORT << 16; + } + switch (bcs.Status) { + case US_BULK_STAT_OK: + return DID_OK << 16; + + case US_BULK_STAT_FAIL: + /* check for underrun - dont report */ + if (bcs.Residue) + return DID_OK << 16; + //pop_Bulk_reset(us); + break; + + case US_BULK_STAT_PHASE: + return DID_ERROR << 16; + } - return (DID_OK << 16) | 2; /* check sense required */ + return (DID_OK << 16) | 2; /* check sense required */ } /* Host functions */ @@ -601,25 +601,25 @@ /* detect adapter (always true ) */ static int us_detect(struct SHT *sht) { - /* FIXME - not nice at all, but how else ? */ - struct us_data *us = (struct us_data *)sht->proc_dir; - char name[32]; - - sprintf(name, "usbscsi%d", us->host_number); - sht->name = sht->proc_name = kmalloc(strlen(name)+1, GFP_KERNEL); - if (!sht->proc_name) + /* FIXME - not nice at all, but how else ? */ + struct us_data *us = (struct us_data *)sht->proc_dir; + char name[32]; + + sprintf(name, "usbscsi%d", us->host_number); + sht->name = sht->proc_name = kmalloc(strlen(name)+1, GFP_KERNEL); + if (!sht->proc_name) + return 0; + strcpy(sht->proc_name, name); + sht->proc_dir = NULL; + us->host = scsi_register(sht, sizeof(us)); + if (us->host) { + us->host->hostdata[0] = (unsigned long)us; + us->host_no = us->host->host_no; + return 1; + } + kfree(sht->proc_name); + sht->proc_name = sht->name = NULL; return 0; - strcpy(sht->proc_name, name); - sht->proc_dir = NULL; - us->host = scsi_register(sht, sizeof(us)); - if (us->host) { - us->host->hostdata[0] = (unsigned long)us; - us->host_no = us->host->host_no; - return 1; - } - kfree(sht->proc_name); - sht->proc_name = sht->name = NULL; - return 0; } /* release - must be here to stop scsi @@ -628,71 +628,71 @@ */ static int us_release(struct Scsi_Host *psh) { - struct us_data *us = (struct us_data *)psh->hostdata[0]; - struct us_data *prev = (struct us_data *)&us_list; + struct us_data *us = (struct us_data *)psh->hostdata[0]; + struct us_data *prev = (struct us_data *)&us_list; - if (us->irq_handle) { - usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe); - us->irq_handle = NULL; - } - if (us->filter) - us->filter->release(us->fdata); - if (us->pusb_dev) - usb_deregister(&scsi_driver); - - /* FIXME - leaves hanging host template copy */ - /* (because scsi layer uses it after removal !!!) */ - while (prev->next != us) - prev = prev->next; - prev->next = us->next; - return 0; + if (us->irq_handle) { + usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe); + us->irq_handle = NULL; + } + if (us->filter) + us->filter->release(us->fdata); + if (us->pusb_dev) + usb_deregister(&scsi_driver); + + /* FIXME - leaves hanging host template copy */ + /* (because scsi layer uses it after removal !!!) */ + while (prev->next != us) + prev = prev->next; + prev->next = us->next; + return 0; } /* run command */ static int us_command( Scsi_Cmnd *srb ) { - US_DEBUGP("Bad use of us_command\n"); + US_DEBUGP("Bad use of us_command\n"); - return DID_BAD_TARGET << 16; + return DID_BAD_TARGET << 16; } /* run command */ static int us_queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *)) { - struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; - US_DEBUGP("Command wakeup\n"); - if (us->srb) { - /* busy */ - } - srb->host_scribble = (unsigned char *)us; - us->srb = srb; - srb->scsi_done = done; - us->action = US_ACT_COMMAND; + US_DEBUGP("Command wakeup\n"); + if (us->srb) { + /* busy */ + } + srb->host_scribble = (unsigned char *)us; + us->srb = srb; + srb->scsi_done = done; + us->action = US_ACT_COMMAND; - /* wake up the process task */ + /* wake up the process task */ - wake_up_interruptible(&us->waitq); + wake_up_interruptible(&us->waitq); - return 0; + return 0; } static int us_abort( Scsi_Cmnd *srb ) { - return 0; + return 0; } static int us_bus_reset( Scsi_Cmnd *srb ) { - struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; - us->pop_reset(us); - return SUCCESS; + us->pop_reset(us); + return SUCCESS; } static int us_host_reset( Scsi_Cmnd *srb ) { - return 0; + return 0; } #undef SPRINTF @@ -700,62 +700,62 @@ int usb_scsi_proc_info (char *buffer, char **start, off_t offset, int length, int hostno, int inout) { - struct us_data *us = us_list; - char *pos = buffer; - char *vendor; - char *product; - char *style = ""; - - /* find our data from hostno */ - - while (us) { - if (us->host_no == hostno) - break; - us = us->next; - } - - if (!us) - return -ESRCH; - - /* null on outward */ - - if (inout) - return length; - - if (!us->pusb_dev || !(vendor = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iManufacturer))) - vendor = "?"; - if (!us->pusb_dev || !(product = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iProduct))) - product = "?"; - - switch (us->protocol) { - case US_PR_CB: - style = "Control/Bulk"; - break; - - case US_PR_CBI: - style = "Control/Bulk/Interrupt"; - break; - - case US_PR_ZIP: - style = "Bulk only"; - break; - - } - SPRINTF ("Host scsi%d: usb-scsi\n", hostno); - SPRINTF ("Device: %s %s - GUID " GUID_FORMAT "\n", vendor, product, GUID_ARGS(us->guid) ); - SPRINTF ("Style: %s\n", style); - - /* - * Calculate start of next buffer, and return value. - */ - *start = buffer + offset; - - if ((pos - buffer) < offset) - return (0); - else if ((pos - buffer - offset) < length) - return (pos - buffer - offset); - else - return (length); + struct us_data *us = us_list; + char *pos = buffer; + char *vendor; + char *product; + char *style = ""; + + /* find our data from hostno */ + + while (us) { + if (us->host_no == hostno) + break; + us = us->next; + } + + if (!us) + return -ESRCH; + + /* null on outward */ + + if (inout) + return length; + + if (!us->pusb_dev || !(vendor = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iManufacturer))) + vendor = "?"; + if (!us->pusb_dev || !(product = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iProduct))) + product = "?"; + + switch (us->protocol) { + case US_PR_CB: + style = "Control/Bulk"; + break; + + case US_PR_CBI: + style = "Control/Bulk/Interrupt"; + break; + + case US_PR_ZIP: + style = "Bulk only"; + break; + + } + SPRINTF ("Host scsi%d: usb-scsi\n", hostno); + SPRINTF ("Device: %s %s - GUID " GUID_FORMAT "\n", vendor, product, GUID_ARGS(us->guid) ); + SPRINTF ("Style: %s\n", style); + + /* + * Calculate start of next buffer, and return value. + */ + *start = buffer + offset; + + if ((pos - buffer) < offset) + return (0); + else if ((pos - buffer - offset) < length) + return (pos - buffer - offset); + else + return (length); } /* @@ -763,599 +763,599 @@ */ static Scsi_Host_Template my_host_template = { - NULL, /* next */ - NULL, /* module */ - NULL, /* proc_dir */ - usb_scsi_proc_info, - NULL, /* name - points to unique */ - us_detect, - us_release, - NULL, /* info */ - NULL, /* ioctl */ - us_command, - us_queuecommand, - NULL, /* eh_strategy */ - us_abort, - us_bus_reset, - us_bus_reset, - us_host_reset, - NULL, /* abort */ - NULL, /* reset */ - NULL, /* slave_attach */ - NULL, /* bios_param */ - 1, /* can_queue */ - -1, /* this_id */ - SG_ALL, /* sg_tablesize */ - 1, /* cmd_per_lun */ - 0, /* present */ - FALSE, /* unchecked_isa_dma */ - FALSE, /* use_clustering */ - TRUE, /* use_new_eh_code */ - TRUE /* emulated */ + NULL, /* next */ + NULL, /* module */ + NULL, /* proc_dir */ + usb_scsi_proc_info, + NULL, /* name - points to unique */ + us_detect, + us_release, + NULL, /* info */ + NULL, /* ioctl */ + us_command, + us_queuecommand, + NULL, /* eh_strategy */ + us_abort, + us_bus_reset, + us_bus_reset, + us_host_reset, + NULL, /* abort */ + NULL, /* reset */ + NULL, /* slave_attach */ + NULL, /* bios_param */ + 1, /* can_queue */ + -1, /* this_id */ + SG_ALL, /* sg_tablesize */ + 1, /* cmd_per_lun */ + 0, /* present */ + FALSE, /* unchecked_isa_dma */ + FALSE, /* use_clustering */ + TRUE, /* use_new_eh_code */ + TRUE /* emulated */ }; static unsigned char sense_notready[] = { - 0x70, /* current error */ - 0x00, - 0x02, /* not ready */ - 0x00, - 0x00, - 10, /* additional length */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x04, /* not ready */ - 0x03, /* manual intervention */ - 0x00, - 0x00, - 0x00, - 0x00 + 0x70, /* current error */ + 0x00, + 0x02, /* not ready */ + 0x00, + 0x00, + 10, /* additional length */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x04, /* not ready */ + 0x03, /* manual intervention */ + 0x00, + 0x00, + 0x00, + 0x00 }; static int usbscsi_control_thread(void * __us) { - struct us_data *us = (struct us_data *)__us; - int action; + struct us_data *us = (struct us_data *)__us; + int action; - lock_kernel(); + lock_kernel(); - /* - * This thread doesn't need any user-level access, - * so get rid of all our resources.. - */ - exit_mm(current); - exit_files(current); - //exit_fs(current); - - sprintf(current->comm, "usbscsi%d", us->host_number); - - unlock_kernel(); - - up(us->notify); - - for(;;) { - siginfo_t info; - int unsigned long signr; - - interruptible_sleep_on(&us->waitq); - - action = us->action; - us->action = 0; - - switch (action) { - case US_ACT_COMMAND: - if (us->srb->target || us->srb->lun) { - /* bad device */ - US_DEBUGP( "Bad device number (%d/%d) or dev %x\n", - us->srb->target, us->srb->lun, (unsigned int)us->pusb_dev); - us->srb->result = DID_BAD_TARGET << 16; - } else if (!us->pusb_dev) { - - /* our device has gone - pretend not ready */ - - if (us->srb->cmnd[0] == REQUEST_SENSE) { - memcpy(us->srb->request_buffer, sense_notready, sizeof(sense_notready)); - us->srb->result = DID_OK << 16; - } else { - us->srb->result = (DID_OK << 16) | 2; - } - } else { - US_DEBUG(us_show_command(us->srb)); + /* + * This thread doesn't need any user-level access, + * so get rid of all our resources.. + */ + exit_mm(current); + exit_files(current); + //exit_fs(current); + + sprintf(current->comm, "usbscsi%d", us->host_number); + + unlock_kernel(); + + up(us->notify); + + for(;;) { + siginfo_t info; + int unsigned long signr; + + interruptible_sleep_on(&us->waitq); + + action = us->action; + us->action = 0; + + switch (action) { + case US_ACT_COMMAND: + if (us->srb->target || us->srb->lun) { + /* bad device */ + US_DEBUGP( "Bad device number (%d/%d) or dev %x\n", + us->srb->target, us->srb->lun, (unsigned int)us->pusb_dev); + us->srb->result = DID_BAD_TARGET << 16; + } else if (!us->pusb_dev) { + + /* our device has gone - pretend not ready */ + + if (us->srb->cmnd[0] == REQUEST_SENSE) { + memcpy(us->srb->request_buffer, sense_notready, sizeof(sense_notready)); + us->srb->result = DID_OK << 16; + } else { + us->srb->result = (DID_OK << 16) | 2; + } + } else { + US_DEBUG(us_show_command(us->srb)); - /* check for variable length - do properly if so */ + /* check for variable length - do properly if so */ - if (us->filter && us->filter->command) - us->srb->result = us->filter->command(us->fdata, us->srb); - else if (us->srb->cmnd[0] == START_STOP && - us->pusb_dev->descriptor.idProduct == 0x0001 && - us->pusb_dev->descriptor.idVendor == 0x04e6) - us->srb->result = DID_OK << 16; - else { - unsigned int savelen = us->srb->request_bufflen; - unsigned int saveallocation = 0; - - switch (us->srb->cmnd[0]) { - case REQUEST_SENSE: - if (us->srb->request_bufflen > 18) - us->srb->request_bufflen = 18; - else - break; - saveallocation = us->srb->cmnd[4]; - us->srb->cmnd[4] = 18; - break; - - case INQUIRY: - if (us->srb->request_bufflen > 36) - us->srb->request_bufflen = 36; - else - break; - saveallocation = us->srb->cmnd[4]; - us->srb->cmnd[4] = 36; - break; + if (us->filter && us->filter->command) + us->srb->result = us->filter->command(us->fdata, us->srb); + else if (us->srb->cmnd[0] == START_STOP && + us->pusb_dev->descriptor.idProduct == 0x0001 && + us->pusb_dev->descriptor.idVendor == 0x04e6) + us->srb->result = DID_OK << 16; + else { + unsigned int savelen = us->srb->request_bufflen; + unsigned int saveallocation = 0; + + switch (us->srb->cmnd[0]) { + case REQUEST_SENSE: + if (us->srb->request_bufflen > 18) + us->srb->request_bufflen = 18; + else + break; + saveallocation = us->srb->cmnd[4]; + us->srb->cmnd[4] = 18; + break; + + case INQUIRY: + if (us->srb->request_bufflen > 36) + us->srb->request_bufflen = 36; + else + break; + saveallocation = us->srb->cmnd[4]; + us->srb->cmnd[4] = 36; + break; + + case MODE_SENSE: + if (us->srb->request_bufflen > 4) + us->srb->request_bufflen = 4; + else + break; + saveallocation = us->srb->cmnd[4]; + us->srb->cmnd[4] = 4; + break; + + case LOG_SENSE: + case MODE_SENSE_10: + if (us->srb->request_bufflen > 8) + us->srb->request_bufflen = 8; + else + break; + saveallocation = (us->srb->cmnd[7] << 8) | us->srb->cmnd[8]; + us->srb->cmnd[7] = 0; + us->srb->cmnd[8] = 8; + break; + + default: + break; + } /* end switch on cmnd[0] */ + us->srb->result = us->pop(us->srb); + + if (savelen != us->srb->request_bufflen && + us->srb->result == (DID_OK << 16)) { + unsigned char *p = (unsigned char *)us->srb->request_buffer; + unsigned int length = 0; + + /* set correct length and retry */ + switch (us->srb->cmnd[0]) { + case REQUEST_SENSE: + /* simply return 18 bytes */ + p[7] = 10; + length = us->srb->request_bufflen;; + break; + + case INQUIRY: + length = p[4] + 5 > savelen ? savelen : p[4] + 5; + us->srb->cmnd[4] = length; + break; + + case MODE_SENSE: + length = p[0] + 4 > savelen ? savelen : p[0] + 4; + us->srb->cmnd[4] = 4; + break; + + case LOG_SENSE: + length = ((p[2] << 8) + p[3]) + 4 > savelen ? savelen : ((p[2] << 8) + p[3]) + 4; + us->srb->cmnd[7] = length >> 8; + us->srb->cmnd[8] = length; + break; + + case MODE_SENSE_10: + length = ((p[0] << 8) + p[1]) + 8 > savelen ? savelen : ((p[0] << 8) + p[1]) + 8; + us->srb->cmnd[7] = length >> 8; + us->srb->cmnd[8] = length; + break; + } /* end switch on cmnd[0] */ + + US_DEBUGP("Old/New length = %d/%d\n", + savelen, length); + + if (us->srb->request_bufflen != length) { + US_DEBUGP("redoing cmd with len=%d\n", length); + us->srb->request_bufflen = length; + us->srb->result = us->pop(us->srb); + } + /* reset back to original values */ + + us->srb->request_bufflen = savelen; + switch (us->srb->cmnd[0]) { + case REQUEST_SENSE: + case INQUIRY: + case MODE_SENSE: + if (us->srb->use_sg == 0 && length > 0) { + int i; + printk(KERN_DEBUG "Data is"); + for (i = 0; i < 32 && i < length; ++i) + printk(" %.2x", ((unsigned char *)us->srb->request_buffer)[i]); + if (i < length) + printk(" ..."); + printk("\n"); + } + us->srb->cmnd[4] = saveallocation; + if (us->mode_xlate) { + /* convert MODE_SENSE_10 return data + * format to MODE_SENSE_6 format */ + unsigned char *dta = (unsigned char *)us->srb->request_buffer; + dta[0] = dta[1]; /* data len */ + dta[1] = dta[2]; /* med type */ + dta[2] = dta[3]; /* dev-spec prm */ + dta[3] = dta[7]; /* block desc len */ + printk (KERN_DEBUG USB_SCSI "new MODE_SENSE_6 data = %.2X %.2X %.2X %.2X\n", + dta[0], dta[1], dta[2], dta[3]); + } + break; + + case LOG_SENSE: + case MODE_SENSE_10: + us->srb->cmnd[7] = saveallocation >> 8; + us->srb->cmnd[8] = saveallocation; + break; + } /* end switch on cmnd[0] */ + } + /* force attention on first command */ + if (!us->attention_done) { + US_DEBUGP("forcing unit attention\n"); + if (us->srb->cmnd[0] == REQUEST_SENSE) { + if (us->srb->result == (DID_OK << 16)) { + unsigned char *p = (unsigned char *)us->srb->request_buffer; + + us->attention_done = 1; + if ((p[2] & 0x0f) != UNIT_ATTENTION) { + p[2] = UNIT_ATTENTION; + p[12] = 0x29; /* power on, reset or bus-reset */ + p[13] = 0; + } + } + } else if (us->srb->cmnd[0] != INQUIRY && + us->srb->result == (DID_OK << 16)) { + us->srb->result |= 2; /* force check condition */ + } + } + } + } + US_DEBUGP("scsi cmd done, result=%x\n", us->srb->result); + us->srb->scsi_done(us->srb); + us->srb = NULL; + break; + + case US_ACT_ABORT: + break; + + case US_ACT_DEVICE_RESET: + break; + + case US_ACT_BUS_RESET: + break; + + case US_ACT_HOST_RESET: + break; + + } /* end switch on action */ + + if (signal_pending(current)) { + /* sending SIGUSR1 makes us print out some info */ + spin_lock_irq(¤t->sigmask_lock); + signr = dequeue_signal(¤t->blocked, &info); + spin_unlock_irq(¤t->sigmask_lock); + + if (signr == SIGUSR2) { + usbscsi_debug = !usbscsi_debug; + printk(USB_SCSI "debug toggle = %d\n", usbscsi_debug); + } else { + break; /* exit the loop on any other signal */ + } + } + } - case MODE_SENSE: - if (us->srb->request_bufflen > 4) - us->srb->request_bufflen = 4; - else - break; - saveallocation = us->srb->cmnd[4]; - us->srb->cmnd[4] = 4; - break; - - case LOG_SENSE: - case MODE_SENSE_10: - if (us->srb->request_bufflen > 8) - us->srb->request_bufflen = 8; - else - break; - saveallocation = (us->srb->cmnd[7] << 8) | us->srb->cmnd[8]; - us->srb->cmnd[7] = 0; - us->srb->cmnd[8] = 8; - break; + MOD_DEC_USE_COUNT; - default: - break; - } /* end switch on cmnd[0] */ - us->srb->result = us->pop(us->srb); - - if (savelen != us->srb->request_bufflen && - us->srb->result == (DID_OK << 16)) { - unsigned char *p = (unsigned char *)us->srb->request_buffer; - unsigned int length = 0; - - /* set correct length and retry */ - switch (us->srb->cmnd[0]) { - case REQUEST_SENSE: - /* simply return 18 bytes */ - p[7] = 10; - length = us->srb->request_bufflen;; - break; + printk("usbscsi_control_thread exiting\n"); - case INQUIRY: - length = p[4] + 5 > savelen ? savelen : p[4] + 5; - us->srb->cmnd[4] = length; - break; + return 0; +} - case MODE_SENSE: - length = p[0] + 4 > savelen ? savelen : p[0] + 4; - us->srb->cmnd[4] = 4; +static void * scsi_probe(struct usb_device *dev, unsigned int ifnum) +{ + struct usb_interface_descriptor *interface; + int i; + char *mf; /* manufacturer */ + char *prod; /* product */ + char *serial; /* serial number */ + struct us_data *ss = NULL; + struct usb_scsi_filter *filter = filters; + void *fdata = NULL; + unsigned int flags = 0; + GUID(guid); + struct us_data *prev; + Scsi_Host_Template *htmplt; + int protocol = 0; + int subclass = 0; + + GUID_CLEAR(guid); + mf = usb_string(dev, dev->descriptor.iManufacturer); + prod = usb_string(dev, dev->descriptor.iProduct); + serial = usb_string(dev, dev->descriptor.iSerialNumber); + + /* probe with filters first */ + + if (mf && prod) { + while (filter) { + if ((fdata = filter->probe(dev, mf, prod, serial)) != NULL) { + flags = filter->flags; + printk(KERN_INFO "USB Scsi filter %s\n", filter->name); break; + } + filter = filter->next; + } + } - case LOG_SENSE: - length = ((p[2] << 8) + p[3]) + 4 > savelen ? savelen : ((p[2] << 8) + p[3]) + 4; - us->srb->cmnd[7] = length >> 8; - us->srb->cmnd[8] = length; - break; + /* generic devices next */ - case MODE_SENSE_10: - length = ((p[0] << 8) + p[1]) + 8 > savelen ? savelen : ((p[0] << 8) + p[1]) + 8; - us->srb->cmnd[7] = length >> 8; - us->srb->cmnd[8] = length; - break; - } /* end switch on cmnd[0] */ + if (fdata == NULL) { - US_DEBUGP("Old/New length = %d/%d\n", - savelen, length); + /* some exceptions */ + if (dev->descriptor.idVendor == 0x04e6 && + dev->descriptor.idProduct == 0x0001) { + /* shuttle E-USB */ + protocol = US_PR_CB; + subclass = US_SC_8070; /* an assumption */ + } else if (dev->descriptor.bDeviceClass != 0 || + dev->actconfig->interface[ifnum].altsetting[0].bInterfaceClass != + USB_CLASS_MASS_STORAGE || + dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass < US_SC_MIN || + dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass > US_SC_MAX) { + return NULL; + } - if (us->srb->request_bufflen != length) { - US_DEBUGP("redoing cmd with len=%d\n", length); - us->srb->request_bufflen = length; - us->srb->result = us->pop(us->srb); - } - /* reset back to original values */ - - us->srb->request_bufflen = savelen; - switch (us->srb->cmnd[0]) { - case REQUEST_SENSE: - case INQUIRY: - case MODE_SENSE: - if (us->srb->use_sg == 0 && length > 0) { - int i; - printk(KERN_DEBUG "Data is"); - for (i = 0; i < 32 && i < length; ++i) - printk(" %.2x", ((unsigned char *)us->srb->request_buffer)[i]); - if (i < length) - printk(" ..."); - printk("\n"); - } - us->srb->cmnd[4] = saveallocation; - if (us->mode_xlate) { - /* convert MODE_SENSE_10 return data - * format to MODE_SENSE_6 format */ - unsigned char *dta = (unsigned char *)us->srb->request_buffer; - dta[0] = dta[1]; /* data len */ - dta[1] = dta[2]; /* med type */ - dta[2] = dta[3]; /* dev-spec prm */ - dta[3] = dta[7]; /* block desc len */ - printk (KERN_DEBUG USB_SCSI "new MODE_SENSE_6 data = %.2X %.2X %.2X %.2X\n", - dta[0], dta[1], dta[2], dta[3]); - } - break; + /* now check if we have seen it before */ - case LOG_SENSE: - case MODE_SENSE_10: - us->srb->cmnd[7] = saveallocation >> 8; - us->srb->cmnd[8] = saveallocation; + if (dev->descriptor.iSerialNumber && + usb_string(dev, dev->descriptor.iSerialNumber) ) { + make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct, + usb_string(dev, dev->descriptor.iSerialNumber)); + } else { + make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct, + "0"); + } + for (ss = us_list; ss; ss = ss->next) { + if (!ss->pusb_dev && GUID_EQUAL(guid, ss->guid)) { + US_DEBUGP("Found existing GUID " GUID_FORMAT "\n", + GUID_ARGS(guid)); + flags = ss->flags; break; - } /* end switch on cmnd[0] */ } - /* force attention on first command */ - if (!us->attention_done) { - US_DEBUGP("forcing unit attention\n"); - if (us->srb->cmnd[0] == REQUEST_SENSE) { - if (us->srb->result == (DID_OK << 16)) { - unsigned char *p = (unsigned char *)us->srb->request_buffer; - - us->attention_done = 1; - if ((p[2] & 0x0f) != UNIT_ATTENTION) { - p[2] = UNIT_ATTENTION; - p[12] = 0x29; /* power on, reset or bus-reset */ - p[13] = 0; - } - } - } else if (us->srb->cmnd[0] != INQUIRY && - us->srb->result == (DID_OK << 16)) { - us->srb->result |= 2; /* force check condition */ - } - } - } } - US_DEBUGP("scsi cmd done, result=%x\n", us->srb->result); - us->srb->scsi_done(us->srb); - us->srb = NULL; - break; + } - case US_ACT_ABORT: - break; + if (!ss) { + if ((ss = (struct us_data *)kmalloc(sizeof(*ss), GFP_KERNEL)) == NULL) { + printk(KERN_WARNING USB_SCSI "Out of memory\n"); + if (filter) + filter->release(fdata); + return NULL; + } + memset(ss, 0, sizeof(struct us_data)); + } + + interface = &dev->actconfig->interface[ifnum].altsetting[0]; + ss->filter = filter; + ss->fdata = fdata; + ss->flags = flags; + if (subclass) { + ss->subclass = subclass; + ss->protocol = protocol; + } else { + ss->subclass = interface->bInterfaceSubClass; + ss->protocol = interface->bInterfaceProtocol; + } + ss->attention_done = 0; + + /* set the protocol op */ - case US_ACT_DEVICE_RESET: + US_DEBUGP("Protocol "); + switch (ss->protocol) { + case US_PR_CB: + US_DEBUGPX("Control/Bulk\n"); + ss->pop = pop_CBI; + ss->pop_reset = pop_CB_reset; break; - case US_ACT_BUS_RESET: + case US_PR_CBI: + US_DEBUGPX("Control/Bulk/Interrupt\n"); + ss->pop = pop_CBI; + ss->pop_reset = pop_CB_reset; break; - case US_ACT_HOST_RESET: + default: + US_DEBUGPX("Bulk\n"); + ss->pop = pop_Bulk; + ss->pop_reset = pop_Bulk_reset; break; + } - } /* end switch on action */ + /* + * We are expecting a minimum of 2 endpoints - in and out (bulk). + * An optional interrupt is OK (necessary for CBI protocol). + * We will ignore any others. + */ + + for (i = 0; i < interface->bNumEndpoints; i++) { + if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) + == USB_ENDPOINT_XFER_BULK) { + if (interface->endpoint[i].bEndpointAddress & USB_DIR_IN) + ss->ep_in = interface->endpoint[i].bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK; + else + ss->ep_out = interface->endpoint[i].bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK; + } else if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) + == USB_ENDPOINT_XFER_INT) { + ss->ep_int = interface->endpoint[i].bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK; + } + } + US_DEBUGP("Endpoints In %d Out %d Int %d\n", + ss->ep_in, ss->ep_out, ss->ep_int); - if (signal_pending(current)) { - /* sending SIGUSR1 makes us print out some info */ - spin_lock_irq(¤t->sigmask_lock); - signr = dequeue_signal(¤t->blocked, &info); - spin_unlock_irq(¤t->sigmask_lock); - - if (signr == SIGUSR2) { - usbscsi_debug = !usbscsi_debug; - printk(USB_SCSI "debug toggle = %d\n", usbscsi_debug); - } else { - break; /* exit the loop on any other signal */ - } - } - } + /* save the interface number */ + ss->ifnum = ifnum; - MOD_DEC_USE_COUNT; + /* exit if strange looking */ - printk("usbscsi_control_thread exiting\n"); + if (usb_set_interface(dev, interface->bInterfaceNumber, 0) || + !ss->ep_in || !ss->ep_out || (ss->protocol == US_PR_CBI && ss->ep_int == 0)) { + US_DEBUGP("Problems with device\n"); + if (ss->host) { + scsi_unregister_module(MODULE_SCSI_HA, ss->htmplt); + kfree(ss->htmplt->name); + kfree(ss->htmplt); + } + if (filter) + filter->release(fdata); + kfree(ss); + return NULL; /* no endpoints */ + } - return 0; -} + if (dev->actconfig->iConfiguration && usb_string(dev, dev->actconfig->iConfiguration)) + US_DEBUGP("Configuration %s\n", + usb_string(dev, dev->actconfig->iConfiguration)); + if (interface->iInterface && usb_string(dev, interface->iInterface)) + US_DEBUGP("Interface %s\n", + usb_string(dev, interface->iInterface)); + + ss->pusb_dev = dev; + + /* Now generate a scsi host definition, and register with scsi above us */ + + if (!ss->host) { + + /* make unique id if possible */ + + US_DEBUGP("New GUID " GUID_FORMAT "\n", GUID_ARGS(guid)); + memcpy(ss->guid, guid, sizeof(guid)); + + /* set class specific stuff */ + + US_DEBUGP("SubClass "); + switch (ss->subclass) { + case US_SC_RBC: + US_DEBUGPX("Reduced Block Commands\n"); + break; + case US_SC_8020: + US_DEBUGPX("8020\n"); + break; + case US_SC_QIC: + US_DEBUGPX("QIC157\n"); + break; + case US_SC_8070: + US_DEBUGPX("8070\n"); + ss->flags |= US_FL_FIXED_COMMAND; + ss->fixedlength = 12; + break; + case US_SC_SCSI: + US_DEBUGPX("Transparent SCSI\n"); + break; + case US_SC_UFI: + US_DEBUGPX(" UFF\n"); + ss->flags |= US_FL_FIXED_COMMAND; + ss->fixedlength = 12; + break; -static void * scsi_probe(struct usb_device *dev, unsigned int ifnum) -{ - struct usb_interface_descriptor *interface; - int i; - char *mf; /* manufacturer */ - char *prod; /* product */ - char *serial; /* serial number */ - struct us_data *ss = NULL; - struct usb_scsi_filter *filter = filters; - void *fdata = NULL; - unsigned int flags = 0; - GUID(guid); - struct us_data *prev; - Scsi_Host_Template *htmplt; - int protocol = 0; - int subclass = 0; - - GUID_CLEAR(guid); - mf = usb_string(dev, dev->descriptor.iManufacturer); - prod = usb_string(dev, dev->descriptor.iProduct); - serial = usb_string(dev, dev->descriptor.iSerialNumber); - - /* probe with filters first */ - - if (mf && prod) { - while (filter) { - if ((fdata = filter->probe(dev, mf, prod, serial)) != NULL) { - flags = filter->flags; - printk(KERN_INFO "USB Scsi filter %s\n", filter->name); - break; - } - filter = filter->next; - } - } - - /* generic devices next */ - - if (fdata == NULL) { - - /* some exceptions */ - if (dev->descriptor.idVendor == 0x04e6 && - dev->descriptor.idProduct == 0x0001) { - /* shuttle E-USB */ - protocol = US_PR_CB; - subclass = US_SC_8070; /* an assumption */ - } else if (dev->descriptor.bDeviceClass != 0 || - dev->actconfig->interface[ifnum].altsetting[0].bInterfaceClass != - USB_CLASS_MASS_STORAGE || - dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass < US_SC_MIN || - dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass > US_SC_MAX) { - return NULL; - } - - /* now check if we have seen it before */ - - if (dev->descriptor.iSerialNumber && - usb_string(dev, dev->descriptor.iSerialNumber) ) { - make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct, - usb_string(dev, dev->descriptor.iSerialNumber)); - } else { - make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct, - "0"); - } - for (ss = us_list; ss; ss = ss->next) { - if (!ss->pusb_dev && GUID_EQUAL(guid, ss->guid)) { - US_DEBUGP("Found existing GUID " GUID_FORMAT "\n", - GUID_ARGS(guid)); - flags = ss->flags; - break; - } - } - } + default: + break; + } - if (!ss) { - if ((ss = (struct us_data *)kmalloc(sizeof(*ss), GFP_KERNEL)) == NULL) { - printk(KERN_WARNING USB_SCSI "Out of memory\n"); - if (filter) - filter->release(fdata); - return NULL; - } - memset(ss, 0, sizeof(struct us_data)); - } - - interface = &dev->actconfig->interface[ifnum].altsetting[0]; - ss->filter = filter; - ss->fdata = fdata; - ss->flags = flags; - if (subclass) { - ss->subclass = subclass; - ss->protocol = protocol; - } else { - ss->subclass = interface->bInterfaceSubClass; - ss->protocol = interface->bInterfaceProtocol; - } - ss->attention_done = 0; - - /* set the protocol op */ - - US_DEBUGP("Protocol "); - switch (ss->protocol) { - case US_PR_CB: - US_DEBUGPX("Control/Bulk\n"); - ss->pop = pop_CBI; - ss->pop_reset = pop_CB_reset; - break; - - case US_PR_CBI: - US_DEBUGPX("Control/Bulk/Interrupt\n"); - ss->pop = pop_CBI; - ss->pop_reset = pop_CB_reset; - break; - - default: - US_DEBUGPX("Bulk\n"); - ss->pop = pop_Bulk; - ss->pop_reset = pop_Bulk_reset; - break; - } - - /* - * We are expecting a minimum of 2 endpoints - in and out (bulk). - * An optional interrupt is OK (necessary for CBI protocol). - * We will ignore any others. - */ - - for (i = 0; i < interface->bNumEndpoints; i++) { - if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_BULK) { - if (interface->endpoint[i].bEndpointAddress & USB_DIR_IN) - ss->ep_in = interface->endpoint[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - else - ss->ep_out = interface->endpoint[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - } else if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_INT) { - ss->ep_int = interface->endpoint[i].bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - } - } - US_DEBUGP("Endpoints In %d Out %d Int %d\n", - ss->ep_in, ss->ep_out, ss->ep_int); - - /* save the interface number */ - ss->ifnum = ifnum; - - /* exit if strange looking */ - - if (usb_set_interface(dev, interface->bInterfaceNumber, 0) || - !ss->ep_in || !ss->ep_out || (ss->protocol == US_PR_CBI && ss->ep_int == 0)) { - US_DEBUGP("Problems with device\n"); - if (ss->host) { - scsi_unregister_module(MODULE_SCSI_HA, ss->htmplt); - kfree(ss->htmplt->name); - kfree(ss->htmplt); - } - if (filter) - filter->release(fdata); - kfree(ss); - return NULL; /* no endpoints */ - } - - if (dev->actconfig->iConfiguration && usb_string(dev, dev->actconfig->iConfiguration)) - US_DEBUGP("Configuration %s\n", - usb_string(dev, dev->actconfig->iConfiguration)); - if (interface->iInterface && usb_string(dev, interface->iInterface)) - US_DEBUGP("Interface %s\n", - usb_string(dev, interface->iInterface)); - - ss->pusb_dev = dev; - - /* Now generate a scsi host definition, and register with scsi above us */ - - if (!ss->host) { - - /* make unique id if possible */ - - US_DEBUGP("New GUID " GUID_FORMAT "\n", GUID_ARGS(guid)); - memcpy(ss->guid, guid, sizeof(guid)); - - /* set class specific stuff */ - - US_DEBUGP("SubClass "); - switch (ss->subclass) { - case US_SC_RBC: - US_DEBUGPX("Reduced Block Commands\n"); - break; - case US_SC_8020: - US_DEBUGPX("8020\n"); - break; - case US_SC_QIC: - US_DEBUGPX("QIC157\n"); - break; - case US_SC_8070: - US_DEBUGPX("8070\n"); - ss->flags |= US_FL_FIXED_COMMAND; - ss->fixedlength = 12; - break; - case US_SC_SCSI: - US_DEBUGPX("Transparent SCSI\n"); - break; - case US_SC_UFI: - US_DEBUGPX(" UFF\n"); - ss->flags |= US_FL_FIXED_COMMAND; - ss->fixedlength = 12; - break; + /* create unique host template */ - default: - break; - } + if ((htmplt = (Scsi_Host_Template *)kmalloc(sizeof(*ss->htmplt), GFP_KERNEL)) == NULL ) { + printk(KERN_WARNING USB_SCSI "Out of memory\n"); + if (filter) + filter->release(fdata); + kfree(ss); + return NULL; + } + memcpy(htmplt, &my_host_template, sizeof(my_host_template)); + ss->host_number = my_host_number++; - /* create unique host template */ + (struct us_data *)htmplt->proc_dir = ss; - if ((htmplt = (Scsi_Host_Template *)kmalloc(sizeof(*ss->htmplt), GFP_KERNEL)) == NULL ) { - printk(KERN_WARNING USB_SCSI "Out of memory\n"); - if (filter) - filter->release(fdata); - kfree(ss); - return NULL; - } - memcpy(htmplt, &my_host_template, sizeof(my_host_template)); - ss->host_number = my_host_number++; - - (struct us_data *)htmplt->proc_dir = ss; - - if (dev->descriptor.idVendor == 0x04e6 && - dev->descriptor.idProduct == 0x0001) { - __u8 qstat[2]; - int result; - - /* shuttle E-USB */ - result = usb_control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0), - 1, 0xC0, - 0, ss->ifnum, - qstat, 2, HZ*5); - US_DEBUGP("C0 status %x %x\n", qstat[0], qstat[1]); - init_waitqueue_head(&ss->ip_waitq); - ss->irqpipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int); - result = usb_request_irq(ss->pusb_dev, ss->irqpipe, pop_CBI_irq, - IRQ_PERIOD, (void *)ss, &ss->irq_handle); - if (result) - return NULL; + if (dev->descriptor.idVendor == 0x04e6 && + dev->descriptor.idProduct == 0x0001) { + __u8 qstat[2]; + int result; + + /* shuttle E-USB */ + result = usb_control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0), + 1, 0xC0, + 0, ss->ifnum, + qstat, 2, HZ*5); + US_DEBUGP("C0 status %x %x\n", qstat[0], qstat[1]); + init_waitqueue_head(&ss->ip_waitq); + ss->irqpipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int); + result = usb_request_irq(ss->pusb_dev, ss->irqpipe, pop_CBI_irq, + IRQ_PERIOD, (void *)ss, &ss->irq_handle); + if (result) + return NULL; - interruptible_sleep_on_timeout(&ss->ip_waitq, HZ*6); + interruptible_sleep_on_timeout(&ss->ip_waitq, HZ*6); #ifdef REWRITE_PROJECT - /* FIXME: Don't know if this release_irq() call is at the - right place/time. */ - usb_release_irq(ss->pusb_dev, ss->irq_handle, ss->irqpipe); - ss->irq_handle = NULL; + /* FIXME: Don't know if this release_irq() call is at the + right place/time. */ + usb_release_irq(ss->pusb_dev, ss->irq_handle, ss->irqpipe); + ss->irq_handle = NULL; #endif - } else if (ss->protocol == US_PR_CBI) - init_waitqueue_head(&ss->ip_waitq); + } else if (ss->protocol == US_PR_CBI) + init_waitqueue_head(&ss->ip_waitq); - /* start up our thread */ + /* start up our thread */ - { - DECLARE_MUTEX_LOCKED(sem); + { + DECLARE_MUTEX_LOCKED(sem); - init_waitqueue_head(&ss->waitq); - - ss->notify = &sem; - ss->pid = kernel_thread(usbscsi_control_thread, ss, - CLONE_FS | CLONE_FILES | CLONE_SIGHAND); - if (ss->pid < 0) { - printk(KERN_WARNING USB_SCSI "Unable to start control thread\n"); - kfree(htmplt); - if (filter) - filter->release(fdata); - kfree(ss); - return NULL; - } + init_waitqueue_head(&ss->waitq); + + ss->notify = &sem; + ss->pid = kernel_thread(usbscsi_control_thread, ss, + CLONE_FS | CLONE_FILES | CLONE_SIGHAND); + if (ss->pid < 0) { + printk(KERN_WARNING USB_SCSI "Unable to start control thread\n"); + kfree(htmplt); + if (filter) + filter->release(fdata); + kfree(ss); + return NULL; + } - /* wait for it to start */ + /* wait for it to start */ - down(&sem); - } + down(&sem); + } - /* now register - our detect function will be called */ + /* now register - our detect function will be called */ - scsi_register_module(MODULE_SCSI_HA, htmplt); + scsi_register_module(MODULE_SCSI_HA, htmplt); - /* put us in the list */ + /* put us in the list */ - prev = (struct us_data *)&us_list; - while (prev->next) - prev = prev->next; - prev->next = ss; - } + prev = (struct us_data *)&us_list; + while (prev->next) + prev = prev->next; + prev->next = ss; + } - printk(KERN_WARNING "DANGEROUS: USB SCSI driver data integrity not assured !!!\n"); - printk(KERN_INFO "USB SCSI device found at address %d\n", dev->devnum); + printk(KERN_WARNING "DANGEROUS: USB SCSI driver data integrity not assured !!!\n"); + printk(KERN_INFO "USB SCSI device found at address %d\n", dev->devnum); - return ss; + return ss; } static void scsi_disconnect(struct usb_device *dev, void *ptr) @@ -1363,7 +1363,7 @@ struct us_data *ss = ptr; if (!ss) - return; + return; if (ss->filter) ss->filter->release(ss->fdata); ss->pusb_dev = NULL; diff -u --recursive --new-file v2.3.30/linux/fs/Config.in linux/fs/Config.in --- v2.3.30/linux/fs/Config.in Tue Nov 23 22:42:21 1999 +++ linux/fs/Config.in Tue Dec 7 10:10:45 1999 @@ -22,7 +22,7 @@ # msdos filesystems tristate 'DOS FAT fs support' CONFIG_FAT_FS dep_tristate ' MSDOS fs support' CONFIG_MSDOS_FS $CONFIG_FAT_FS -dep_tristate ' UMSDOS: Unix-like filesystem on top of standard MSDOS filesystem' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS +dep_tristate ' UMSDOS: Unix-like filesystem on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS dep_tristate ' VFAT (Windows-95) fs support' CONFIG_VFAT_FS $CONFIG_FAT_FS if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then @@ -37,11 +37,6 @@ define_bool CONFIG_JOLIET n fi -tristate 'UDF filesystem support (read only)' CONFIG_UDF_FS -if [ "$CONFIG_UDF_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' UDF write support (DANGEROUS)' CONFIG_UDF_RW -fi - tristate 'Minix fs support' CONFIG_MINIX_FS tristate 'NTFS filesystem support (read only)' CONFIG_NTFS_FS if [ "$CONFIG_NTFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then @@ -67,6 +62,10 @@ tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS if [ "$CONFIG_SYSV_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then bool ' SYSV filesystem write support (DANGEROUS)' CONFIG_SYSV_FS_WRITE +fi +tristate 'UDF filesystem support (read only)' CONFIG_UDF_FS +if [ "$CONFIG_UDF_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' UDF write support (DANGEROUS)' CONFIG_UDF_RW fi tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS if [ "$CONFIG_UFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then diff -u --recursive --new-file v2.3.30/linux/fs/dcache.c linux/fs/dcache.c --- v2.3.30/linux/fs/dcache.c Sun Nov 7 16:37:34 1999 +++ linux/fs/dcache.c Tue Dec 7 10:01:57 1999 @@ -553,8 +553,7 @@ /* * An insecure source has sent us a dentry, here we verify it. * - * This is just to make knfsd able to have the dentry pointer - * in the NFS file handle. + * This is used by ncpfs in its readdir implementation. * * NOTE! Do _not_ dereference the pointers before we have * validated them. We can test the pointer values, but we diff -u --recursive --new-file v2.3.30/linux/fs/ext2/inode.c linux/fs/ext2/inode.c --- v2.3.30/linux/fs/ext2/inode.c Tue Dec 7 09:32:47 1999 +++ linux/fs/ext2/inode.c Tue Dec 7 10:01:57 1999 @@ -42,7 +42,8 @@ */ void ext2_delete_inode (struct inode * inode) { - if (inode->i_ino == EXT2_ACL_IDX_INO || + if (is_bad_inode(inode) || + inode->i_ino == EXT2_ACL_IDX_INO || inode->i_ino == EXT2_ACL_DATA_INO) return; inode->u.ext2_i.i_dtime = CURRENT_TIME; diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/Config.in linux/fs/ncpfs/Config.in --- v2.3.30/linux/fs/ncpfs/Config.in Tue Dec 7 09:32:48 1999 +++ linux/fs/ncpfs/Config.in Tue Dec 7 10:21:10 1999 @@ -6,9 +6,7 @@ bool ' Clear remove/delete inhibit when needed' CONFIG_NCPFS_STRONG bool ' Use NFS namespace if available' CONFIG_NCPFS_NFS_NS bool ' Use LONG (OS/2) namespace if available' CONFIG_NCPFS_OS2_NS -if [ "$CONFIG_NCPFS_OS2_NS" = "y" ]; then - bool ' Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS -fi +bool ' Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS bool ' Allow mounting of volume subdirectories' CONFIG_NCPFS_MOUNT_SUBDIR bool ' NDS authentication support' CONFIG_NCPFS_NDS_DOMAINS bool ' Use Native Language Support' CONFIG_NCPFS_NLS diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c --- v2.3.30/linux/fs/ncpfs/dir.c Tue Dec 7 09:32:48 1999 +++ linux/fs/ncpfs/dir.c Tue Dec 7 10:21:10 1999 @@ -4,7 +4,7 @@ * Copyright (C) 1995, 1996 by Volker Lendecke * Modified for big endian by J.F. Chadima and David S. Miller * Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache - * Modified 1998 Wolfram Pienkoss for NLS + * Modified 1998, 1999 Wolfram Pienkoss for NLS * Modified 1999 Wolfram Pienkoss for directory caching * */ @@ -110,25 +110,23 @@ /* - * XXX: It would be better to use the tolower from linux/ctype.h, - * but _ctype is needed and it is not exported. - */ -#define tolower(c) (((c) >= 'A' && (c) <= 'Z') ? (c)-('A'-'a') : (c)) - -/* * Note: leave the hash unchanged if the directory * is case-sensitive. */ static int ncp_hash_dentry(struct dentry *dentry, struct qstr *this) { + struct nls_table *t; unsigned long hash; int i; + t = NCP_IO_TABLE(dentry); + if (!ncp_case_sensitive(dentry->d_inode)) { hash = init_name_hash(); for (i=0; ilen ; i++) - hash = partial_name_hash(tolower(this->name[i]),hash); + hash = partial_name_hash(ncp_tolower(t, this->name[i]), + hash); this->hash = end_name_hash(hash); } return 0; @@ -137,18 +135,13 @@ static int ncp_compare_dentry(struct dentry *dentry, struct qstr *a, struct qstr *b) { - int i; - - if (a->len != b->len) return 1; + if (a->len != b->len) + return 1; if (ncp_case_sensitive(dentry->d_inode)) - return strncmp(a->name, b->name, a->len); + return strncmp(a->name, b->name, a->len); - for (i=0; ilen; i++) - if (tolower(a->name[i]) != tolower(b->name[i])) - return 1; - - return 0; + return ncp_strnicmp(NCP_IO_TABLE(dentry), a->name, b->name, a->len); } /* @@ -301,10 +294,9 @@ { struct ncp_server *server; struct inode *dir = dentry->d_parent->d_inode; - int res, val = 0; - int len = dentry->d_name.len; struct ncp_entry_info finfo; - __u8 __name[dentry->d_name.len + 1]; + int res, val = 0, len = dentry->d_name.len + 1; + __u8 __name[len]; if (!dentry->d_inode || !dir) goto finished; @@ -324,45 +316,39 @@ if (val) goto finished; - PPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld\n", + DDPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n", dentry->d_parent->d_name.name, dentry->d_name.name, NCP_GET_AGE(dentry)); - memcpy(__name, dentry->d_name.name, len); - __name[len] = '\0'; - - PPRINTK("ncp_lookup_validate: %s, len %d\n", __name, len); - PPRINTK("ncp_lookup_validate: server lookup for %s/%s\n", - dentry->d_parent->d_name.name, __name); - if (ncp_is_server_root(dir)) { - io2vol(server, __name, 1); - res = ncp_lookup_volume(server, __name, &(finfo.i)); + res = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, 1); + if (!res) + res = ncp_lookup_volume(server, __name, &(finfo.i)); } else { - io2vol(server, __name, !ncp_preserve_case(dir)); - res = ncp_obtain_info(server, dir, __name, &(finfo.i)); + res = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, !ncp_preserve_case(dir)); + if (!res) + res = ncp_obtain_info(server, dir, __name, &(finfo.i)); } - PPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n", + DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n", dentry->d_parent->d_name.name, __name, res); /* * If we didn't find it, or if it has a different dirEntNum to * what we remember, it's not valid any more. */ if (!res) { - if (finfo.i.dirEntNum == NCP_FINFO(dentry->d_inode)->dirEntNum) + if (finfo.i.dirEntNum == NCP_FINFO(dentry->d_inode)->dirEntNum) { + ncp_new_dentry(dentry); val=1; - else - PPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n"); + } else + DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n"); - vol2io(server, finfo.i.entryName, - !ncp_preserve_entry_case(dir, finfo.i.NSCreator)); ncp_update_inode2(dentry->d_inode, &finfo); - if (val) - ncp_new_dentry(dentry); } finished: - PPRINTK("ncp_lookup_validate: result=%d\n", val); + DDPRINTK("ncp_lookup_validate: result=%d\n", val); return val; } @@ -425,11 +411,12 @@ goto out; next = next->next; } - dent = NULL; + return NULL; + out: - if (dent) - if (dent->d_inode) - return dget(dent); + if (dent->d_inode) + return dget(dent); + return NULL; } @@ -439,8 +426,7 @@ struct ncp_server *server = NCP_SERVER(inode); struct nw_info_struct i; - if (!ncp_conn_valid(server) || - ncp_is_server_root(inode)) + if (!ncp_conn_valid(server) || ncp_is_server_root(inode)) return 0; if (ncp_obtain_info(server, inode, NULL, &i)) @@ -517,8 +503,7 @@ ctl.page = find_lock_page(&inode->i_data, ctl.ofs); if (!ctl.page) goto invalid_cache; - ctl.cache = (union ncp_dir_cache *) - kmap(ctl.page); + ctl.cache = (union ncp_dir_cache *) kmap(ctl.page); if (!Page_Uptodate(ctl.page)) goto invalid_cache; } @@ -605,17 +590,19 @@ { struct dentry *newdent, *dentry = filp->f_dentry; struct inode *newino, *inode = dentry->d_inode; - struct ncp_server *server = NCP_SERVER(inode); struct ncp_cache_control ctl = *ctrl; struct qstr qname; - ino_t ino = 0; int valid = 0; + ino_t ino = 0; + __u8 __name[256]; - vol2io(server, entry->i.entryName, - !ncp_preserve_entry_case(inode, entry->i.NSCreator)); + qname.len = 256; + if (ncp_vol2io(NCP_SERVER(inode), __name, &qname.len, + entry->i.entryName, entry->i.nameLen, + !ncp_preserve_entry_case(inode, entry->i.NSCreator))) + return 1; /* I'm not sure */ - qname.name = entry->i.entryName; - qname.len = entry->i.nameLen; + qname.name = __name; qname.hash = full_name_hash(qname.name, qname.len); if (dentry->d_op && dentry->d_op->d_hash) @@ -661,8 +648,7 @@ ctl.ofs += 1; ctl.page = grab_cache_page(&inode->i_data, ctl.ofs); if (ctl.page) - ctl.cache = (union ncp_dir_cache *) - kmap(ctl.page); + ctl.cache = (union ncp_dir_cache *) kmap(ctl.page); } if (ctl.cache) { ctl.cache->dentry[ctl.idx] = newdent; @@ -677,8 +663,8 @@ ino = find_inode_number(dentry, &qname); if (!ino) ino = iunique(inode->i_sb, 2); - ctl.filled = filldir(dirent, entry->i.entryName, - entry->i.nameLen, filp->f_pos, ino); + ctl.filled = filldir(dirent, qname.name, qname.len, + filp->f_pos, ino); if (!ctl.filled) filp->f_pos += 1; } @@ -723,8 +709,9 @@ } } -static void ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir, - struct ncp_cache_control *ctl) +static void +ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir, + struct ncp_cache_control *ctl) { struct dentry *dentry = filp->f_dentry; struct inode *dir = dentry->d_inode; @@ -760,19 +747,21 @@ { struct ncp_server* server = NCP_SBP(sb); struct nw_info_struct i; - int result; + int result, len = strlen(server->m.mounted_vol) + 1; + __u8 __name[len]; if (ncp_single_volume(server)) { struct dentry* dent; result = -ENOENT; - io2vol(server, server->m.mounted_vol, 1); - if (ncp_lookup_volume(server, server->m.mounted_vol, &i)) { + if (ncp_io2vol(server, __name, &len, server->m.mounted_vol, + len-1, 1)) + goto out; + if (ncp_lookup_volume(server, __name, &i)) { PPRINTK("ncp_conn_logged_in: %s not found\n", server->m.mounted_vol); goto out; } - vol2io(server, i.entryName, 1); dent = sb->s_root; if (dent) { struct inode* ino = dent->d_inode; @@ -795,29 +784,29 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry) { - struct ncp_server *server; + struct ncp_server *server = NCP_SERVER(dir); struct inode *inode = NULL; - int error, res, len = dentry->d_name.len; struct ncp_entry_info finfo; - __u8 __name[dentry->d_name.len + 1]; - - server = NCP_SERVER(dir); + int error, res, len = dentry->d_name.len + 1; + __u8 __name[len]; error = -EIO; if (!ncp_conn_valid(server)) goto finished; - memcpy(__name, dentry->d_name.name, len); - __name[len] = '\0'; - PPRINTK("ncp_lookup: %s, len %d\n", __name, len); PPRINTK("ncp_lookup: server lookup for %s/%s\n", - dentry->d_parent->d_name.name, __name); + dentry->d_parent->d_name.name, dentry->d_name.name); + if (ncp_is_server_root(dir)) { - io2vol(server, __name, 1); - res = ncp_lookup_volume(server, __name, &(finfo.i)); + res = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, 1); + if (!res) + res = ncp_lookup_volume(server, __name, &(finfo.i)); } else { - io2vol(server, __name, !ncp_preserve_case(dir)); - res = ncp_obtain_info(server, dir, __name, &(finfo.i)); + res = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, !ncp_preserve_case(dir)); + if (!res) + res = ncp_obtain_info(server, dir, __name, &(finfo.i)); } PPRINTK("ncp_lookup: looked for %s/%s, res=%d\n", dentry->d_parent->d_name.name, __name, res); @@ -827,9 +816,6 @@ if (res) goto add_entry; - vol2io(server, finfo.i.entryName, - !ncp_preserve_entry_case(dir, finfo.i.NSCreator)); - /* * Create an inode for the entry. */ @@ -839,10 +825,10 @@ inode = ncp_iget(dir->i_sb, &finfo); if (inode) { + ncp_new_dentry(dentry); add_entry: dentry->d_op = &ncp_dentry_operations; d_add(dentry, inode); - ncp_new_dentry(dentry); error = 0; } @@ -879,10 +865,10 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode, int attributes) { - int error, result; - struct ncp_entry_info finfo; struct ncp_server *server = NCP_SERVER(dir); - __u8 _name[dentry->d_name.len + 1]; + struct ncp_entry_info finfo; + int error, result, len = dentry->d_name.len + 1; + __u8 __name[len]; PPRINTK("ncp_create_new: creating %s/%s, mode=%x\n", dentry->d_parent->d_name.name, dentry->d_name.name, mode); @@ -891,16 +877,15 @@ goto out; ncp_age_dentry(server, dentry); - - memcpy(_name, dentry->d_name.name, dentry->d_name.len); - _name[dentry->d_name.len] = '\0'; - - io2vol(server, _name, !ncp_preserve_case(dir)); + error = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, !ncp_preserve_case(dir)); + if (error) + goto out; error = -EACCES; - result = ncp_open_create_file_or_subdir(server, dir, _name, - OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE, - attributes, AR_READ | AR_WRITE, &finfo); + result = ncp_open_create_file_or_subdir(server, dir, __name, + OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE, + attributes, AR_READ | AR_WRITE, &finfo); if (!result) { finfo.access = O_RDWR; error = ncp_instantiate(dir, dentry, &finfo); @@ -921,10 +906,10 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode) { - int error; struct ncp_entry_info finfo; struct ncp_server *server = NCP_SERVER(dir); - __u8 _name[dentry->d_name.len + 1]; + int error, len = dentry->d_name.len + 1; + __u8 __name[len]; DPRINTK("ncp_mkdir: making %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name); @@ -933,13 +918,13 @@ goto out; ncp_age_dentry(server, dentry); - - memcpy(_name, dentry->d_name.name, dentry->d_name.len); - _name[dentry->d_name.len] = '\0'; - io2vol(server, _name, !ncp_preserve_case(dir)); + error = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, !ncp_preserve_case(dir)); + if (error) + goto out; error = -EACCES; - if (ncp_open_create_file_or_subdir(server, dir, _name, + if (ncp_open_create_file_or_subdir(server, dir, __name, OC_MODE_CREATE, aDIR, 0xffff, &finfo) == 0) { @@ -951,9 +936,9 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry) { - int error, result; struct ncp_server *server = NCP_SERVER(dir); - __u8 _name[dentry->d_name.len + 1]; + int error, result, len = dentry->d_name.len + 1; + __u8 __name[len]; DPRINTK("ncp_rmdir: removing %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name); @@ -966,11 +951,12 @@ if (!list_empty(&dentry->d_hash)) goto out; - memcpy(_name, dentry->d_name.name, dentry->d_name.len); - _name[dentry->d_name.len] = '\0'; - - io2vol(server, _name, !ncp_preserve_case(dir)); - result = ncp_del_file_or_subdir(server, dir, _name); + error = ncp_io2vol(server, __name, &len, dentry->d_name.name, + len-1, !ncp_preserve_case(dir)); + if (error) + goto out; + + result = ncp_del_file_or_subdir(server, dir, __name); switch (result) { case 0x00: error = 0; @@ -1063,38 +1049,42 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { - int old_len = old_dentry->d_name.len; - int new_len = new_dentry->d_name.len; + struct ncp_server *server = NCP_SERVER(old_dir); int error; - char _old_name[old_dentry->d_name.len + 1]; - char _new_name[new_dentry->d_name.len + 1]; + int old_len = old_dentry->d_name.len + 1; + int new_len = new_dentry->d_name.len + 1; + __u8 __old_name[old_len], __new_name[new_len]; DPRINTK("ncp_rename: %s/%s to %s/%s\n", old_dentry->d_parent->d_name.name, old_dentry->d_name.name, new_dentry->d_parent->d_name.name, new_dentry->d_name.name); error = -EIO; - if (!ncp_conn_valid(NCP_SERVER(old_dir))) + if (!ncp_conn_valid(server)) goto out; - ncp_age_dentry(NCP_SERVER(old_dir), old_dentry); - ncp_age_dentry(NCP_SERVER(new_dir), new_dentry); + ncp_age_dentry(server, old_dentry); + ncp_age_dentry(server, new_dentry); + + error = ncp_io2vol(server, __old_name, &old_len, + old_dentry->d_name.name, old_len-1, + !ncp_preserve_case(old_dir)); + if (error) + goto out; + + error = ncp_io2vol(server, __new_name, &new_len, + new_dentry->d_name.name, new_len-1, + !ncp_preserve_case(new_dir)); + if (error) + goto out; - memcpy(_old_name, old_dentry->d_name.name, old_len); - _old_name[old_len] = '\0'; - io2vol(NCP_SERVER(old_dir), _old_name, !ncp_preserve_case(old_dir)); - - memcpy(_new_name, new_dentry->d_name.name, new_len); - _new_name[new_len] = '\0'; - io2vol(NCP_SERVER(new_dir), _new_name, !ncp_preserve_case(new_dir)); - - error = ncp_ren_or_mov_file_or_subdir(NCP_SERVER(old_dir), - old_dir, _old_name, - new_dir, _new_name); + error = ncp_ren_or_mov_file_or_subdir(server, old_dir, __old_name, + new_dir, __new_name); #ifdef CONFIG_NCPFS_STRONG - if ((error == 0x90 || error == -EACCES) && NCP_SERVER(old_dir)->m.flags & NCP_MOUNT_STRONG) { /* RO */ - error = ncp_force_rename(old_dir, old_dentry, _old_name, - new_dir, new_dentry, _new_name); + if ((error == 0x90 || error == -EACCES) && + server->m.flags & NCP_MOUNT_STRONG) { /* RO */ + error = ncp_force_rename(old_dir, old_dentry, __old_name, + new_dir, new_dentry, __new_name); } #endif switch (error) { diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/inode.c linux/fs/ncpfs/inode.c --- v2.3.30/linux/fs/ncpfs/inode.c Sun Nov 7 16:37:34 1999 +++ linux/fs/ncpfs/inode.c Tue Dec 7 10:21:10 1999 @@ -124,16 +124,15 @@ } inode->i_blocks = (inode->i_size + NCP_BLOCK_SIZE - 1) >> NCP_BLOCK_SHIFT; - inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwinfo->i.modifyTime), - le16_to_cpu(nwinfo->i.modifyDate)); - inode->i_ctime = ncp_date_dos2unix(le16_to_cpu(nwinfo->i.creationTime), - le16_to_cpu(nwinfo->i.creationDate)); - inode->i_atime = ncp_date_dos2unix(0, - le16_to_cpu(nwinfo->i.lastAccessDate)); + inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime), + le16_to_cpu(nwi->modifyDate)); + inode->i_ctime = ncp_date_dos2unix(le16_to_cpu(nwi->creationTime), + le16_to_cpu(nwi->creationDate)); + inode->i_atime = ncp_date_dos2unix(0, le16_to_cpu(nwi->lastAccessDate)); - NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum; - NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum; - NCP_FINFO(inode)->volNumber = nwinfo->i.volNumber; + NCP_FINFO(inode)->DosDirNum = nwi->DosDirNum; + NCP_FINFO(inode)->dirEntNum = nwi->dirEntNum; + NCP_FINFO(inode)->volNumber = nwi->volNumber; } /* diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/ioctl.c linux/fs/ncpfs/ioctl.c --- v2.3.30/linux/fs/ncpfs/ioctl.c Tue Dec 7 09:32:48 1999 +++ linux/fs/ncpfs/ioctl.c Tue Dec 7 10:21:10 1999 @@ -3,7 +3,7 @@ * * Copyright (C) 1995, 1996 by Volker Lendecke * Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache - * Modified 1998 Wolfram Pienkoss for NLS + * Modified 1998, 1999 Wolfram Pienkoss for NLS * */ @@ -527,7 +527,8 @@ codepage = NULL; user.codepage[NCP_IOCSNAME_LEN] = 0; - if (!user.codepage[0]) + if (!user.codepage[0] || + !strcmp(user.codepage, "default")) codepage = load_nls_default(); else { codepage = load_nls(user.codepage); @@ -538,13 +539,21 @@ iocharset = NULL; user.iocharset[NCP_IOCSNAME_LEN] = 0; - if (user.iocharset[0] == 0) + if (!user.iocharset[0] || + !strcmp(user.iocharset, "default")) { iocharset = load_nls_default(); - else { - iocharset = load_nls(user.iocharset); - if (!iocharset) { - unload_nls(codepage); - return -EBADRQC; + NCP_CLR_FLAG(server, NCP_FLAG_UTF8); + } else { + if (!strcmp(user.iocharset, "utf8")) { + iocharset = load_nls_default(); + NCP_SET_FLAG(server, NCP_FLAG_UTF8); + } else { + iocharset = load_nls(user.iocharset); + if (!iocharset) { + unload_nls(codepage); + return -EBADRQC; + } + NCP_CLR_FLAG(server, NCP_FLAG_UTF8); } } @@ -564,35 +573,28 @@ case NCP_IOC_GETCHARSETS: /* not tested */ { struct ncp_nls_ioctl user; + int len; memset(&user, 0, sizeof(user)); - if (server->nls_vol) - if (server->nls_vol->charset) { - strncpy(user.codepage, - server->nls_vol->charset, - NCP_IOCSNAME_LEN); - user.codepage[NCP_IOCSNAME_LEN] = 0; - if (!strcmp(user.codepage, "default")) - /* unfortunately, we cannot set - 'default' charset... maybe - we should change load_nls()? - It is easy, do not initialize - 'tables' in fs/nls/nls_base.c - with NULL, but with - 'default_table'... */ - memset(user.codepage, 0, - sizeof(user.codepage)); - } + if (server->nls_vol && server->nls_vol->charset) { + len = strlen(server->nls_vol->charset); + if (len > NCP_IOCSNAME_LEN) + len = NCP_IOCSNAME_LEN; + strncpy(user.codepage, + server->nls_vol->charset, len); + user.codepage[len] = 0; + } - if (server->nls_io) - if (server->nls_io->charset) { + if (NCP_IS_FLAG(server, NCP_FLAG_UTF8)) + strcpy(user.iocharset, "utf8"); + else + if (server->nls_io && server->nls_io->charset) { + len = strlen(server->nls_io->charset); + if (len > NCP_IOCSNAME_LEN) + len = NCP_IOCSNAME_LEN; strncpy(user.iocharset, - server->nls_io->charset, - NCP_IOCSNAME_LEN); - user.iocharset[NCP_IOCSNAME_LEN] = 0; - if (!strcmp(user.iocharset, "default")) - memset(user.iocharset, 0, - sizeof(user.iocharset)); + server->nls_io->charset, len); + user.iocharset[len] = 0; } if (copy_to_user((struct ncp_nls_ioctl*)arg, &user, diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/ncplib_kernel.c linux/fs/ncpfs/ncplib_kernel.c --- v2.3.30/linux/fs/ncpfs/ncplib_kernel.c Mon Nov 1 13:56:27 1999 +++ linux/fs/ncpfs/ncplib_kernel.c Tue Dec 7 10:21:10 1999 @@ -4,6 +4,7 @@ * Copyright (C) 1995, 1996 by Volker Lendecke * Modified for big endian by J.F. Chadima and David S. Miller * Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache + * Modified 1999 Wolfram Pienkoss for NLS * */ @@ -886,4 +887,225 @@ } #endif /* CONFIG_NCPFS_IOCTL_LOCKING */ +#ifdef CONFIG_NCPFS_NLS +/* This are the NLS conversion routines with inspirations and code parts + * from the vfat file system and hints from Petr Vandrovec. + */ + +inline unsigned char +ncp__tolower(struct nls_table *t, unsigned char c) +{ + unsigned char nc = t->charset2lower[c]; + + return nc ? nc : c; +} + +inline unsigned char +ncp__toupper(struct nls_table *t, unsigned char c) +{ + unsigned char nc = t->charset2upper[c]; + + return nc ? nc : c; +} + +int +ncp__io2vol(struct ncp_server *server, unsigned char *vname, unsigned int *vlen, + const unsigned char *iname, unsigned int ilen, int cc) +{ + struct nls_table *in = server->nls_io; + struct nls_table *out = server->nls_vol; + struct nls_unicode uc; + unsigned char nc, *up; + int i, k, maxlen = *vlen - 1; + __u16 ec; + + *vlen = 0; + + for (i = 0; i < ilen;) { + if (*vlen == maxlen) + return -ENAMETOOLONG; + + if (NCP_IS_FLAG(server, NCP_FLAG_UTF8)) { + k = utf8_mbtowc(&ec, iname, ilen - i); + if (k == -1) + return -EINVAL; + uc.uni1 = ec & 0xFF; + uc.uni2 = ec >> 8; + iname += k; + i += k; + } else { + if (*iname == NCP_ESC) { + if (i > ilen - 5) + return -EINVAL; + + ec = 0; + for (k = 1; k < 5; k++) { + nc = iname[k]; + ec <<= 4; + if (nc >= '0' && nc <= '9') { + ec |= nc - '0'; + continue; + } + if (nc >= 'a' && nc <= 'f') { + ec |= nc - ('a' - 10); + continue; + } + if (nc >= 'A' && nc <= 'F') { + ec |= nc - ('A' - 10); + continue; + } + return -EINVAL; + } + uc.uni1 = ec & 0xFF; + uc.uni2 = ec >> 8; + iname += 5; + i += 5; + } else { + uc = in->charset2uni[*iname]; + iname++; + i++; + } + } + + up = out->page_uni2charset[uc.uni2]; + if (!up) + return -EINVAL; + + nc = up[uc.uni1]; + if (!nc) + return -EINVAL; + + *vname = cc ? ncp_toupper(out, nc) : nc; + vname++; + *vlen += 1; + } + + *vname = 0; + return 0; +} + +int +ncp__vol2io(struct ncp_server *server, unsigned char *iname, unsigned int *ilen, + const unsigned char *vname, unsigned int vlen, int cc) +{ + struct nls_table *in = server->nls_vol; + struct nls_table *out = server->nls_io; + struct nls_unicode uc; + unsigned char nc, *up; + int i, k, maxlen = *ilen - 1; + __u16 ec; + + *ilen = 0; + + for (i = 0; i < vlen; i++) { + if (*ilen == maxlen) + return -ENAMETOOLONG; + + uc = in->charset2uni[cc ? ncp_tolower(in, *vname) : *vname]; + + if (NCP_IS_FLAG(server, NCP_FLAG_UTF8)) { + k = utf8_wctomb(iname, (uc.uni2 << 8) + uc.uni1, + maxlen - *ilen); + if (k == -1) + return -ENAMETOOLONG; + iname += k; + *ilen += k; + } else { + up = out->page_uni2charset[uc.uni2]; + if (up) + nc = up[uc.uni1]; + else + nc = 0; + + if (nc) { + *iname = nc; + iname++; + *ilen += 1; + } else { + if (*ilen > maxlen - 5) + return -ENAMETOOLONG; + ec = (uc.uni2 << 8) + uc.uni1; + *iname = NCP_ESC; + for (k = 4; k > 0; k--) { + nc = ec & 0xF; + iname[k] = nc > 9 ? nc + ('a' - 10) + : nc + '0'; + ec >>= 4; + } + iname += 5; + *ilen += 5; + } + } + vname++; + } + + *iname = 0; + return 0; +} + +#else + +int +ncp__io2vol(unsigned char *vname, unsigned int *vlen, + const unsigned char *iname, unsigned int ilen, int cc) +{ + int i; + + if (*vlen <= ilen) + return -ENAMETOOLONG; + + if (cc) + for (i = 0; i < ilen; i++) { + *vname = toupper(*iname); + vname++; + iname++; + } + else { + memmove(vname, iname, ilen); + vname += ilen; + } + *vlen = ilen; + *vname = 0; + return 0; +} + +int +ncp__vol2io(unsigned char *iname, unsigned int *ilen, + const unsigned char *vname, unsigned int vlen, int cc) +{ + int i; + + if (*ilen <= vlen) + return -ENAMETOOLONG; + + if (cc) + for (i = 0; i < vlen; i++) { + *iname = tolower(*vname); + iname++; + vname++; + } + else { + memmove(iname, vname, vlen); + iname += vlen; + } + + *ilen = vlen; + *iname = 0; + return 0; +} + +#endif + +inline int +ncp_strnicmp(struct nls_table *t, const unsigned char *s1, + const unsigned char *s2, int n) +{ + int i; + + for (i=0; i -#endif +#else +#include +#endif /* CONFIG_NCPFS_NLS */ #include @@ -97,81 +99,39 @@ #endif /* CONFIG_NCPFS_MOUNT_SUBDIR */ #ifdef CONFIG_NCPFS_NLS -/* This are the NLS conversion routines with inspirations and code parts - * from the vfat file system and hints from Petr Vandrovec. - */ -/* - * It should be replaced by charset specifc conversion. Gordon Chaffee - * has prepared some things, but I don't know, what he thinks about it. - * The conversion tables for the io charsets should be generatable by - * Unicode table, shouldn't it? I have written so generation code for it. - * The tables for the vendor specific codepages...? Hmm. The Samba sources - * contains also any hints. - */ - -#define toupperif(c, u) ((((u) != 0) && ((c) >= 'a') && ((c) <= 'z')) \ - ? (c)-('a'-'A') : (c)) -#define tolowerif(c, u) ((((u) != 0) && ((c) >= 'A') && ((c) <= 'Z')) \ - ? (c)-('A'-'a') : (c)) - -static inline void -io2vol(struct ncp_server *server, char *name, int case_trans) -{ - unsigned char nc; - unsigned char *np; - unsigned char *up; - struct nls_unicode uc; - struct nls_table *nls_in; - struct nls_table *nls_out; - - nls_in = server->nls_io; - nls_out = server->nls_vol; - np = name; - - while (*np) - { - nc = 0; - uc = nls_in->charset2uni[toupperif(*np, case_trans)]; - up = nls_out->page_uni2charset[uc.uni2]; - if (up != NULL) nc = up[uc.uni1]; - if (nc != 0) *np = nc; - np++; - } -} - -static inline void -vol2io(struct ncp_server *server, char *name, int case_trans) -{ - unsigned char nc; - unsigned char *np; - unsigned char *up; - struct nls_unicode uc; - struct nls_table *nls_in; - struct nls_table *nls_out; - - nls_in = server->nls_vol; - nls_out = server->nls_io; - np = name; - - while (*np) - { - nc = 0; - uc = nls_in->charset2uni[*np]; - up = nls_out->page_uni2charset[uc.uni2]; - if (up != NULL) nc = up[uc.uni1]; - if (nc == 0) nc = *np; - *np = tolowerif(nc, case_trans); - np++; - } -} +inline unsigned char ncp__tolower(struct nls_table *, unsigned char); +inline unsigned char ncp__toupper(struct nls_table *, unsigned char); +int ncp__io2vol(struct ncp_server *, unsigned char *, unsigned int *, + const unsigned char *, unsigned int, int); +int ncp__vol2io(struct ncp_server *, unsigned char *, unsigned int *, + const unsigned char *, unsigned int, int); + +#define NCP_ESC ':' +#define NCP_IO_TABLE(dentry) (NCP_SERVER((dentry)->d_inode)->nls_io) +#define ncp_tolower(t, c) ncp__tolower(t, c) +#define ncp_toupper(t, c) ncp__toupper(t, c) +#define ncp_io2vol(S,m,i,n,k,U) ncp__io2vol(S,m,i,n,k,U) +#define ncp_vol2io(S,m,i,n,k,U) ncp__vol2io(S,m,i,n,k,U) #else -#define io2vol(S,N,U) if (U) str_upper(N) -#define vol2io(S,N,U) if (U) str_lower(N) +int ncp__io2vol(unsigned char *, unsigned int *, + const unsigned char *, unsigned int, int); +int ncp__vol2io(unsigned char *, unsigned int *, + const unsigned char *, unsigned int, int); + +#define NCP_IO_TABLE(dentry) NULL +#define ncp_tolower(t, c) tolower(c) +#define ncp_toupper(t, c) toupper(c) +#define ncp_io2vol(S,m,i,n,k,U) ncp__io2vol(m,i,n,k,U) +#define ncp_vol2io(S,m,i,n,k,U) ncp__vol2io(m,i,n,k,U) #endif /* CONFIG_NCPFS_NLS */ + +inline int +ncp_strnicmp(struct nls_table *, + const unsigned char *, const unsigned char *, int); #define NCP_GET_AGE(dentry) (jiffies - (dentry)->d_time) #define NCP_MAX_AGE(server) ((server)->dentry_ttl) diff -u --recursive --new-file v2.3.30/linux/fs/ncpfs/symlink.c linux/fs/ncpfs/symlink.c --- v2.3.30/linux/fs/ncpfs/symlink.c Tue Dec 7 09:32:48 1999 +++ linux/fs/ncpfs/symlink.c Tue Dec 7 10:21:10 1999 @@ -74,8 +74,8 @@ unsigned int follow) { struct inode *inode=dentry->d_inode; - int error, length, cnt; - char *link; + int error, length, len, cnt; + char *link, *buf; #ifdef DEBUG PRINTK("ncp_follow_link(dentry=%p,base=%p,follow=%u)\n",dentry,base,follow); @@ -91,7 +91,7 @@ return ERR_PTR(-EIO); } - for (cnt = 0; (link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1, GFP_NFS))==NULL; cnt++) { + for (cnt = 0; (link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_NFS))==NULL; cnt++) { if (cnt > 10) { dput(base); return ERR_PTR(-EAGAIN); /* -ENOMEM? */ @@ -108,14 +108,25 @@ kfree(link); return ERR_PTR(-EIO); } - - link[length]=0; - vol2io(NCP_SERVER(inode), link+8, 0); + len = NCP_MAX_SYMLINK_SIZE; + buf = (char *) kmalloc(len, GFP_NFS); + if (!buf) { + dput(base); + kfree(link); + return ERR_PTR(-EAGAIN); + } + error = ncp_vol2io(NCP_SERVER(inode), buf, &len, link+8, length-8, 0); + kfree(link); + if (error) { + dput(base); + kfree(buf); + return ERR_PTR(error); + } /* UPDATE_ATIME(inode); */ - base=lookup_dentry(link+8, base, follow); - kfree(link); + base = lookup_dentry(buf, base, follow); + kfree(buf); return base; } @@ -125,8 +136,8 @@ static int ncp_readlink(struct dentry * dentry, char * buffer, int buflen) { struct inode *inode=dentry->d_inode; - char *link; - int length,error; + char *link, *buf; + int length, len, error; #ifdef DEBUG PRINTK("ncp_readlink(dentry=%p,buffer=%p,buflen=%d)\n",dentry,buffer,buflen); @@ -138,7 +149,7 @@ if(ncp_make_open(inode,O_RDONLY)) return -EIO; - if((link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1,GFP_NFS))==NULL) + if((link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE,GFP_NFS))==NULL) return -ENOMEM; error = ncp_read_kernel(NCP_SERVER(inode),NCP_FINFO(inode)->file_handle, @@ -150,15 +161,25 @@ goto out; } - link[length] = 0; + len = NCP_MAX_SYMLINK_SIZE; + buf = (char *) kmalloc(len, GFP_NFS); + if (!buf) { + error = -ENOMEM; + goto out; + } + error = ncp_vol2io(NCP_SERVER(inode), buf, &len, link+8, length-8, 0); + if (error || buflen < len) { + error = -EIO; + kfree(buf); + goto out; + } - vol2io(NCP_SERVER(inode), link+8, 0); - - error = length - 8; - if(copy_to_user(buffer, link+8, error)) + error = len; + if(copy_to_user(buffer, buf, error)) error = -EFAULT; - -out:; + kfree(buf); + +out: kfree(link); return error; } @@ -166,9 +187,9 @@ /* ----- create a new symbolic link -------------------------------------- */ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { - int i,length; struct inode *inode; char *link; + int length, err, i; #ifdef DEBUG PRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname); @@ -177,7 +198,7 @@ if (!(NCP_SERVER(dir)->m.flags & NCP_MOUNT_SYMLINKS)) return -EPERM; /* EPERM is returned by VFS if symlink procedure does not exist */ - if ((length=strlen(symname))>NCP_MAX_SYMLINK_SIZE) + if ((length=strlen(symname))>NCP_MAX_SYMLINK_SIZE-8) return -EINVAL; if ((link=(char *)kmalloc(length+9,GFP_NFS))==NULL) @@ -192,12 +213,16 @@ ((__u32 *)link)[0]=NCP_SYMLINK_MAGIC0; ((__u32 *)link)[1]=NCP_SYMLINK_MAGIC1; - memcpy(link+8, symname, length+1); /* including last zero for io2vol */ /* map to/from server charset, do not touch upper/lower case as symlink can point out of ncp filesystem */ - io2vol(NCP_SERVER(inode), link+8, 0); - + length += 1; + err = ncp_io2vol(NCP_SERVER(inode),link+8,&length,symname,length-1,0); + if (err) { + kfree(link); + return err; + } + if(ncp_write_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, 0, length+8, link, &i) || i!=length+8) { kfree(link); diff -u --recursive --new-file v2.3.30/linux/fs/nfs/inode.c linux/fs/nfs/inode.c --- v2.3.30/linux/fs/nfs/inode.c Sun Nov 7 16:37:34 1999 +++ linux/fs/nfs/inode.c Tue Dec 7 10:03:12 1999 @@ -958,8 +958,6 @@ return err; #ifdef CONFIG_PROC_FS - rpc_register_sysctl(); - rpc_proc_init(); rpc_proc_register(&nfs_rpcstat); #endif return register_filesystem(&nfs_fs_type); diff -u --recursive --new-file v2.3.30/linux/fs/nfsd/nfsproc.c linux/fs/nfsd/nfsproc.c --- v2.3.30/linux/fs/nfsd/nfsproc.c Tue Nov 23 22:42:21 1999 +++ linux/fs/nfsd/nfsproc.c Tue Dec 7 10:01:57 1999 @@ -1,7 +1,10 @@ /* * nfsproc2.c Process version 2 NFS requests. + * linux/fs/nfsd/nfs2proc.c + * + * Process version 2 NFS requests. * - * Copyright (C) 1995 Olaf Kirch + * Copyright (C) 1995-1997 Olaf Kirch */ #include @@ -144,7 +147,7 @@ ntohl(rqstp->rq_addr.sin_addr.s_addr), ntohs(rqstp->rq_addr.sin_port), argp->count); - argp->count = avail; + argp->count = avail << 2; } resp->count = argp->count; @@ -273,19 +276,22 @@ rdev = (dev_t) size; if (type != S_IFBLK && type != S_IFCHR) { rdev = 0; - } else if (type == S_IFCHR && size == ~(u32) 0) { + } else if (type == S_IFCHR && !(attr->ia_valid & ATTR_SIZE)) { /* If you think you've seen the worst, grok this. */ attr->ia_mode = S_IFIFO | mode; type = S_IFIFO; } else if (size != rdev) { /* dev got truncated because of 16bit Linux dev_t */ - nfserr = nfserr_io; /* or nfserr_inval? */ + nfserr = nfserr_inval; goto out_unlock; } else { /* Okay, char or block special */ is_borc = 1; } + /* we've used the SIZE information, so discard it */ + attr->ia_valid &= ~ATTR_SIZE; + /* Make sure the type and device matches */ nfserr = nfserr_exist; if (inode && (type != (inode->i_mode & S_IFMT) || @@ -442,8 +448,8 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, struct nfsd_readdirres *resp) { - u32 * buffer; - int nfserr, count; + u32 * buffer; + int nfserr, count; dprintk("nfsd: READDIR %d/%d %d bytes at %d\n", SVCFH_DEV(&argp->fh), SVCFH_INO(&argp->fh), @@ -556,33 +562,15 @@ { NFSERR_DQUOT, EDQUOT }, #endif { NFSERR_STALE, ESTALE }, - { NFSERR_WFLUSH, EIO }, { -1, EIO } }; int i; for (i = 0; nfs_errtbl[i].nfserr != -1; i++) { if (nfs_errtbl[i].syserr == errno) - return htonl (nfs_errtbl[i].nfserr); + return htonl(nfs_errtbl[i].nfserr); } printk (KERN_INFO "nfsd: non-standard errno: %d\n", errno); return nfserr_io; } -#if 0 -static void -nfsd_dump(char *tag, u32 *buf, int len) -{ - int i; - - printk(KERN_NOTICE - "nfsd: %s (%d words)\n", tag, len); - - for (i = 0; i < len && i < 32; i += 8) - printk(KERN_NOTICE - " %08lx %08lx %08lx %08lx" - " %08lx %08lx %08lx %08lx\n", - buf[i], buf[i+1], buf[i+2], buf[i+3], - buf[i+4], buf[i+5], buf[i+6], buf[i+7]); -} -#endif diff -u --recursive --new-file v2.3.30/linux/fs/nfsd/nfssvc.c linux/fs/nfsd/nfssvc.c --- v2.3.30/linux/fs/nfsd/nfssvc.c Wed Oct 27 16:34:12 1999 +++ linux/fs/nfsd/nfssvc.c Tue Dec 7 10:01:57 1999 @@ -196,7 +196,8 @@ kxdrproc_t xdr; u32 nfserr; - dprintk("nfsd_dispatch: proc %d\n", rqstp->rq_proc); + dprintk("nfsd_dispatch: vers %d proc %d\n", + rqstp->rq_vers, rqstp->rq_proc); proc = rqstp->rq_procinfo; /* Check whether we have this call in the cache. */ diff -u --recursive --new-file v2.3.30/linux/fs/nfsd/nfsxdr.c linux/fs/nfsd/nfsxdr.c --- v2.3.30/linux/fs/nfsd/nfsxdr.c Wed Nov 26 13:08:38 1997 +++ linux/fs/nfsd/nfsxdr.c Tue Dec 7 10:01:57 1999 @@ -18,9 +18,14 @@ #define NFSDDBG_FACILITY NFSDDBG_XDR u32 nfs_ok, nfserr_perm, nfserr_noent, nfserr_io, nfserr_nxio, - nfserr_inval, nfserr_acces, nfserr_exist, nfserr_nodev, nfserr_notdir, - nfserr_isdir, nfserr_fbig, nfserr_nospc, nfserr_rofs, - nfserr_nametoolong, nfserr_dquot, nfserr_stale; + nfserr_acces, nfserr_exist, nfserr_xdev, nfserr_nodev, + nfserr_notdir, nfserr_isdir, nfserr_inval, nfserr_fbig, + nfserr_nospc, nfserr_rofs, nfserr_mlink, + nfserr_nametoolong, nfserr_notempty, nfserr_dquot, nfserr_stale, + nfserr_remote, nfserr_badhandle, nfserr_notsync, + nfserr_badcookie, nfserr_notsupp, nfserr_toosmall, + nfserr_serverfault, nfserr_badtype, nfserr_jukebox; + #ifdef NFSD_OPTIMIZE_SPACE # define inline @@ -52,18 +57,32 @@ nfserr_noent = htonl(NFSERR_NOENT); nfserr_io = htonl(NFSERR_IO); nfserr_inval = htonl(NFSERR_INVAL); - nfserr_nxio = htonl(NFSERR_NXIO); - nfserr_acces = htonl(NFSERR_ACCES); - nfserr_exist = htonl(NFSERR_EXIST); - nfserr_nodev = htonl(NFSERR_NODEV); - nfserr_notdir = htonl(NFSERR_NOTDIR); - nfserr_isdir = htonl(NFSERR_ISDIR); - nfserr_fbig = htonl(NFSERR_FBIG); - nfserr_nospc = htonl(NFSERR_NOSPC); - nfserr_rofs = htonl(NFSERR_ROFS); + nfserr_nxio = htonl(NFSERR_NXIO); + nfserr_acces = htonl(NFSERR_ACCES); + nfserr_exist = htonl(NFSERR_EXIST); + nfserr_xdev = htonl(NFSERR_XDEV); + nfserr_nodev = htonl(NFSERR_NODEV); + nfserr_notdir = htonl(NFSERR_NOTDIR); + nfserr_isdir = htonl(NFSERR_ISDIR); + nfserr_inval = htonl(NFSERR_INVAL); + nfserr_fbig = htonl(NFSERR_FBIG); + nfserr_nospc = htonl(NFSERR_NOSPC); + nfserr_rofs = htonl(NFSERR_ROFS); + nfserr_mlink = htonl(NFSERR_MLINK); nfserr_nametoolong = htonl(NFSERR_NAMETOOLONG); - nfserr_dquot = htonl(NFSERR_DQUOT); - nfserr_stale = htonl(NFSERR_STALE); + nfserr_notempty = htonl(NFSERR_NOTEMPTY); + nfserr_dquot = htonl(NFSERR_DQUOT); + nfserr_stale = htonl(NFSERR_STALE); + nfserr_remote = htonl(NFSERR_REMOTE); + nfserr_badhandle = htonl(NFSERR_BADHANDLE); + nfserr_notsync = htonl(NFSERR_NOT_SYNC); + nfserr_badcookie = htonl(NFSERR_BAD_COOKIE); + nfserr_notsupp = htonl(NFSERR_NOTSUPP); + nfserr_toosmall = htonl(NFSERR_TOOSMALL); + nfserr_serverfault = htonl(NFSERR_SERVERFAULT); + nfserr_badtype = htonl(NFSERR_BADTYPE); + nfserr_jukebox = htonl(NFSERR_JUKEBOX); + inited = 1; } diff -u --recursive --new-file v2.3.30/linux/fs/nfsd/vfs.c linux/fs/nfsd/vfs.c --- v2.3.30/linux/fs/nfsd/vfs.c Sun Nov 7 16:37:34 1999 +++ linux/fs/nfsd/vfs.c Tue Dec 7 10:01:57 1999 @@ -48,7 +48,12 @@ /* Hack until we have a macro check for mandatory locks. */ #ifndef IS_ISMNDLK -#define IS_ISMNDLK(i) (((i)->i_mode & (S_ISGID|S_IXGRP)) == S_ISGID) +/* We must ignore files (but only file) which might have mandatory + * locks on them because there is no way to know if the accesser has + * the lock. + */ +#define IS_ISMNDLK(i) (((i)->i_mode & (S_ISGID|S_IXGRP|S_IFMT)) \ + == (S_ISGID|S_IFREG)) #endif /* Check for dir entries '.' and '..' */ @@ -78,39 +83,44 @@ static struct raparms * raparml = NULL; static struct raparms * raparm_cache = NULL; + +/* + * We need to do a check-parent every time + * after we have locked the parent - to verify + * that the parent is still our parent and + * that we are still hashed onto it.. + * + * This is required in case two processes race + * on removing (or moving) the same entry: the + * parent lock will serialize them, but the + * other process will be too late.. + * + * Note that this nfsd_check_parent is identical + * the check_parent in linux/fs/namei.c. + */ +#define nfsd_check_parent(dir, dentry) \ + ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_hash)) + /* * Lock a parent directory following the VFS locking protocol. */ int fh_lock_parent(struct svc_fh *parent_fh, struct dentry *dchild) { - int nfserr = 0; - fh_lock(parent_fh); /* * Make sure the parent->child relationship still holds, * and that the child is still hashed. */ - if (dchild->d_parent != parent_fh->fh_dentry) - goto out_not_parent; - if (list_empty(&dchild->d_hash)) - goto out_not_hashed; -out: - return nfserr; + if (nfsd_check_parent(parent_fh->fh_dentry, dchild)) + return 0; -out_not_parent: printk(KERN_WARNING - "fh_lock_parent: %s/%s parent changed\n", + "fh_lock_parent: %s/%s parent changed or child unhashed\n", dchild->d_parent->d_name.name, dchild->d_name.name); - goto out_unlock; -out_not_hashed: - printk(KERN_WARNING - "fh_lock_parent: %s/%s unhashed\n", - dchild->d_parent->d_name.name, dchild->d_name.name); -out_unlock: - nfserr = nfserr_noent; + fh_unlock(parent_fh); - goto out; + return nfserr_noent; } /* @@ -250,6 +260,32 @@ inode = dentry->d_inode; err = inode_change_ok(inode, iap); + /* could be a "touch" (utimes) request where the user is not the owner but does + * have write permission. In this case the user should be allowed to set + * both times to the current time. We could just assume any such SETATTR + * is intended to set the times to "now", but we do a couple of simple tests + * to increase our confidence. + */ +#define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) +#define MAX_TOUCH_TIME_ERROR (30*60) + if (err + && (iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET + && iap->ia_mtime == iap->ia_ctime + ) { + /* looks good. now just make sure time is in the right ballpark. + * solaris, at least, doesn't seem to care what the time request is + */ + time_t delta = iap->ia_atime - CURRENT_TIME; + 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" + */ + iap->ia_valid &= ~BOTH_TIME_SET; + err = inode_change_ok(inode, iap); + } + } + if (err) goto out_nfserr; @@ -415,11 +451,28 @@ /* * Sync a file + * As this calls fsync (not fdatasync) there is no need for a write_inode + * after it. */ void -nfsd_sync(struct inode *inode, struct file *filp) +nfsd_sync(struct file *filp) { + dprintk("nfsd: sync file %s\n", filp->f_dentry->d_name.name); + down(&filp->f_dentry->d_inode->i_sem); filp->f_op->fsync(filp, filp->f_dentry); + up(&filp->f_dentry->d_inode->i_sem); +} + +void +nfsd_sync_dir(struct dentry *dp) +{ + struct inode *inode = dp->d_inode; + int (*fsync) (struct file *, struct dentry *); + + if (inode->i_op->default_file_ops + && (fsync = inode->i_op->default_file_ops->fsync)) { + fsync(NULL, dp); + } } /* @@ -574,7 +627,7 @@ /* clear setuid/setgid flag after write */ if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) { struct iattr ia; - kernel_cap_t saved_cap; + kernel_cap_t saved_cap = 0; ia.ia_valid = ATTR_MODE; ia.ia_mode = inode->i_mode & ~(S_ISUID | S_ISGID); @@ -616,15 +669,14 @@ if (inode->i_state & I_DIRTY) { dprintk("nfsd: write sync %d\n", current->pid); - nfsd_sync(inode, &file); - write_inode_now(inode); + nfsd_sync(&file); } wake_up(&inode->i_wait); last_ino = inode->i_ino; last_dev = inode->i_dev; } - dprintk("nfsd: write complete\n"); + dprintk("nfsd: write complete err=%d\n", err); if (err >= 0) err = 0; else @@ -672,6 +724,7 @@ * If it has, the parent directory should already be locked. */ if (!resfhp->fh_dverified) { + /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ dchild = lookup_dentry(fname, dget(dentry), 0); err = PTR_ERR(dchild); if (IS_ERR(dchild)) @@ -682,20 +735,24 @@ if (err) goto out; } else { + /* called from nfsd_proc_create */ dchild = resfhp->fh_dentry; - if (!fhp->fh_locked) + if (!fhp->fh_locked) { + /* not actually possible */ printk(KERN_ERR "nfsd_create: parent %s/%s not locked!\n", dentry->d_parent->d_name.name, dentry->d_name.name); + err = -EIO; + goto out; + } } /* * Make sure the child dentry is still negative ... */ err = nfserr_exist; if (dchild->d_inode) { - printk(KERN_WARNING - "nfsd_create: dentry %s/%s not negative!\n", + dprintk("nfsd_create: dentry %s/%s not negative!\n", dentry->d_name.name, dchild->d_name.name); goto out; } @@ -725,6 +782,9 @@ case S_IFSOCK: opfunc = dirp->i_op->mknod; break; + default: + printk("nfsd: bad file type %o in nfsd_create\n", type); + err = nfserr_inval; } if (!opfunc) goto out; @@ -740,8 +800,10 @@ if (err < 0) goto out_nfserr; - if (EX_ISSYNC(fhp->fh_export)) - write_inode_now(dirp); + if (EX_ISSYNC(fhp->fh_export)) { + nfsd_sync_dir(dentry); + write_inode_now(dchild->d_inode); + } /* * Update the file handle to get the new inode info. @@ -779,7 +841,7 @@ struct inode *inode; struct iattr newattrs; int err; - kernel_cap_t saved_cap; + kernel_cap_t saved_cap = 0; err = fh_verify(rqstp, fhp, S_IFREG, MAY_WRITE | MAY_TRUNC); if (err) @@ -815,6 +877,8 @@ 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) @@ -848,7 +912,10 @@ goto out; UPDATE_ATIME(inode); - /* N.B. Why does this call need a get_fs()?? */ + /* N.B. Why does this call need a get_fs()?? + * Remove the set_fs and watch the fireworks:-) --okir + */ + oldfs = get_fs(); set_fs(KERNEL_DS); err = inode->i_op->readlink(dentry, buf, *lenp); set_fs(oldfs); @@ -913,7 +980,7 @@ err = dirp->i_op->symlink(dirp, dnew, path); if (!err) { if (EX_ISSYNC(fhp->fh_export)) - write_inode_now(dirp); + nfsd_sync_dir(dentry); } else err = nfserrno(-err); } @@ -945,7 +1012,7 @@ err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); if (err) goto out; - err = fh_verify(rqstp, tfhp, S_IFREG, MAY_NOP); + err = fh_verify(rqstp, tfhp, -S_IFDIR, MAY_NOP); if (err) goto out; @@ -991,7 +1058,7 @@ err = dirp->i_op->link(dold, dirp, dnew); if (!err) { if (EX_ISSYNC(ffhp->fh_export)) { - write_inode_now(dirp); + nfsd_sync_dir(ddir); write_inode_now(dest); } } else @@ -1010,29 +1077,12 @@ } /* - * We need to do a check-parent every time - * after we have locked the parent - to verify - * that the parent is still our parent and - * that we are still hashed onto it.. - * - * This is required in case two processes race - * on removing (or moving) the same entry: the - * parent lock will serialize them, but the - * other process will be too late.. - * - * Note that this nfsd_check_parent is different - * than the one in linux/include/dcache_func.h. - */ -#define nfsd_check_parent(dir, dentry) \ - ((dir) == (dentry)->d_parent->d_inode && !list_empty(&dentry->d_hash)) - -/* * This follows the model of double_lock() in the VFS. */ static inline void nfsd_double_down(struct semaphore *s1, struct semaphore *s2) { if (s1 != s2) { - if ((unsigned long) s1 > (unsigned long) s2) { + if ((unsigned long) s1 < (unsigned long) s2) { struct semaphore *tmp = s1; s1 = s2; s2 = tmp; @@ -1102,13 +1152,13 @@ nfsd_double_down(&tdir->i_sem, &fdir->i_sem); err = -ENOENT; /* GAM3 check for parent changes after locking. */ - if (nfsd_check_parent(fdir, odentry) && - nfsd_check_parent(tdir, ndentry)) { + if (nfsd_check_parent(fdentry, odentry) && + nfsd_check_parent(tdentry, ndentry)) { err = vfs_rename(fdir, odentry, tdir, ndentry); if (!err && EX_ISSYNC(tfhp->fh_export)) { - write_inode_now(fdir); - write_inode_now(tdir); + nfsd_sync_dir(tdentry); + nfsd_sync_dir(fdentry); } } else dprintk("nfsd: Caught race in nfsd_rename"); @@ -1182,17 +1232,13 @@ rdentry->d_count++; nfsd_double_down(&dirp->i_sem, &rdentry->d_inode->i_sem); - if (!fhp->fh_pre_mtime) - fhp->fh_pre_mtime = dirp->i_mtime; fhp->fh_locked = 1; err = -ENOENT; - if (nfsd_check_parent(dirp, rdentry)) + if (nfsd_check_parent(dentry, rdentry)) err = vfs_rmdir(dirp, rdentry); rdentry->d_count--; - if (!fhp->fh_post_version) - fhp->fh_post_version = dirp->i_version; fhp->fh_locked = 0; nfsd_double_up(&dirp->i_sem, &rdentry->d_inode->i_sem); @@ -1201,8 +1247,11 @@ if (err) goto out_nfserr; - if (EX_ISSYNC(fhp->fh_export)) - write_inode_now(dirp); + if (EX_ISSYNC(fhp->fh_export)) { + down(&dentry->d_inode->i_sem); + nfsd_sync_dir(dentry); + up(&dentry->d_inode->i_sem); + } out: return err; @@ -1334,7 +1383,7 @@ { struct inode *inode = dentry->d_inode; int err; - kernel_cap_t saved_cap; + kernel_cap_t saved_cap = 0; if (acc == MAY_NOP) return 0; diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_base.c linux/fs/nls/nls_base.c --- v2.3.30/linux/fs/nls/nls_base.c Thu Aug 26 13:05:40 1999 +++ linux/fs/nls/nls_base.c Tue Dec 7 10:21:10 1999 @@ -4,6 +4,8 @@ * Native language support--charsets and unicode translations. * By Gordon Chaffee 1996, 1997 * + * Unicode based case conversion 1999 by Wolfram Pienkoss + * */ #include @@ -363,6 +365,78 @@ page00 }; +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + +static unsigned char charset2upper[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + void inc_use_count(void) { @@ -376,6 +450,8 @@ "default", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp437.c linux/fs/nls/nls_cp437.c --- v2.3.30/linux/fs/nls/nls_cp437.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp437.c Tue Dec 7 10:21:10 1999 @@ -355,7 +355,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -369,15 +404,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x90, 0x92, 0x92, 0x00, 0x99, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -385,12 +421,11 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -407,6 +442,8 @@ "cp437", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp737.c linux/fs/nls/nls_cp737.c --- v2.3.30/linux/fs/nls/nls_cp737.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp737.c Tue Dec 7 10:21:10 1999 @@ -283,7 +283,42 @@ page20, NULL, page22, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x80-0x87 */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x88-0x8f */ + 0xa8, 0xa9, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xe0, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xe1, 0xe2, 0xe3, 0xe5, 0xe6, 0xe7, /* 0xe8-0xef */ + 0xe9, 0xf1, 0xf2, 0xf3, 0xe4, 0xe8, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -297,28 +332,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x98-0x9f */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0xa0-0xa7 */ + 0x90, 0x91, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x97, 0xea, 0xeb, 0xec, 0xf4, 0xed, 0xee, 0xef, /* 0xe0-0xe7 */ + 0xf5, 0xf0, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -335,6 +370,8 @@ "cp737", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp775.c linux/fs/nls/nls_cp775.c --- v2.3.30/linux/fs/nls/nls_cp775.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp775.c Tue Dec 7 10:21:10 1999 @@ -283,7 +283,42 @@ page20, NULL, page22, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8b, 0x8b, 0x8c, 0xa5, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x85, 0x96, 0x98, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x83, 0x8c, 0xa2, 0xa4, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x88, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xd0, 0xd1, 0xd2, /* 0xb0-0xb7 */ + 0xd3, 0xb9, 0xba, 0xbb, 0xbc, 0xd4, 0xd5, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xd6, 0xd7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xd8, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xa2, 0xe1, 0x93, 0xe7, 0xe4, 0xe4, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe9, 0xe9, 0xeb, 0xeb, 0xec, 0x89, 0xec, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -297,28 +332,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x8a, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0xa0, 0x8e, 0x95, 0x8f, 0x80, /* 0x80-0x87 */ + 0xad, 0xed, 0x8a, 0x8a, 0xa1, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x92, 0x92, 0xe2, 0x99, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x97, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xe0, 0xa3, 0xa3, 0x8d, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0x00, 0xea, 0x00, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xb5, 0xb6, 0xb7, 0xb8, 0xbd, 0xbe, 0xc6, 0xc7, /* 0xd0-0xd7 */ + 0xcf, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0xe3, /* 0xe0-0xe7 */ + 0xe8, 0xe8, 0xea, 0xea, 0xee, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -335,6 +370,8 @@ "cp775", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp850.c linux/fs/nls/nls_cp850.c --- v2.3.30/linux/fs/nls/nls_cp850.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp850.c Tue Dec 7 10:21:10 1999 @@ -247,7 +247,42 @@ page20, NULL, NULL, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0x85, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd0, 0x88, 0x89, 0x8a, 0xd5, 0xa1, 0x8c, /* 0xd0-0xd7 */ + 0x8b, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x8d, 0xdf, /* 0xd8-0xdf */ + 0xa2, 0xe1, 0x93, 0x95, 0xe4, 0xe4, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe7, 0xa3, 0x96, 0x97, 0xec, 0xec, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -261,28 +296,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xb7, 0x8f, 0x80, /* 0x80-0x87 */ + 0xd2, 0xd3, 0xd4, 0xd8, 0xd7, 0xde, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x92, 0x92, 0xe2, 0x99, 0xe3, 0xea, 0xeb, /* 0x90-0x97 */ + 0x00, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ + 0xb5, 0xd6, 0xe0, 0xe9, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd1, 0xd1, 0xd2, 0xd3, 0xd4, 0x49, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0xe8, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xed, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -299,6 +334,8 @@ "cp850", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp852.c linux/fs/nls/nls_cp852.c --- v2.3.30/linux/fs/nls/nls_cp852.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp852.c Tue Dec 7 10:21:10 1999 @@ -247,7 +247,42 @@ NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8b, 0x8b, 0x8c, 0xab, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x92, 0x92, 0x93, 0x94, 0x96, 0x96, 0x98, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9c, 0x9c, 0x88, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa5, 0xa5, 0xa7, 0xa7, /* 0xa0-0xa7 */ + 0xa9, 0xa9, 0xaa, 0xab, 0x9f, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0xd8, /* 0xb0-0xb7 */ + 0xad, 0xb9, 0xba, 0xbb, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd0, 0xd4, 0x89, 0xd4, 0xe5, 0xa1, 0x8c, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xee, 0x85, 0xdf, /* 0xd8-0xdf */ + 0xa2, 0xe1, 0x93, 0xe4, 0xe4, 0xe5, 0xe7, 0xe7, /* 0xe0-0xe7 */ + 0xea, 0xa3, 0xea, 0xfb, 0xec, 0xec, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfd, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -261,28 +296,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x8a, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x00, 0x00, 0x00, 0x95, 0x00, 0x97, /* 0x90-0x97 */ - 0x00, 0x99, 0x9a, 0x9b, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0x00, /* 0xa0-0xa7 */ - 0xa8, 0x00, 0xaa, 0x00, 0xac, 0x00, 0xae, 0xaf, /* 0xa8-0xaf */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xde, 0x8f, 0x80, /* 0x80-0x87 */ + 0x9d, 0xd3, 0x8a, 0x8a, 0xd7, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x91, 0xe2, 0x99, 0x95, 0x95, 0x97, /* 0x90-0x97 */ + 0x97, 0x99, 0x9a, 0x9b, 0x9b, 0x9d, 0x9e, 0xac, /* 0x98-0x9f */ + 0xb5, 0xd6, 0xe0, 0xe9, 0xa4, 0xa4, 0xa6, 0xa6, /* 0xa0-0xa7 */ + 0xa8, 0xa8, 0xaa, 0x8d, 0xac, 0xb8, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0x00, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbd, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0xd2, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0xe3, 0x00, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, /* 0xe8-0xef */ + 0xd1, 0xd1, 0xd2, 0xd3, 0xd2, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xb7, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe3, 0xd5, 0xe6, 0xe6, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xe8, 0xeb, 0xed, 0xed, 0xdd, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0x00, 0xfc, 0x00, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xeb, 0xfc, 0xfc, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -299,6 +334,8 @@ "cp852", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp855.c linux/fs/nls/nls_cp855.c --- v2.3.30/linux/fs/nls/nls_cp855.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp855.c Tue Dec 7 10:21:10 1999 @@ -247,7 +247,42 @@ NULL, page21, NULL, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x80, 0x82, 0x82, 0x84, 0x84, 0x86, 0x86, /* 0x80-0x87 */ + 0x88, 0x88, 0x8a, 0x8a, 0x8c, 0x8c, 0x8e, 0x8e, /* 0x88-0x8f */ + 0x90, 0x90, 0x92, 0x92, 0x94, 0x94, 0x96, 0x96, /* 0x90-0x97 */ + 0x98, 0x98, 0x9a, 0x9a, 0x9c, 0x9c, 0x9e, 0x9e, /* 0x98-0x9f */ + 0xa0, 0xa0, 0xa2, 0xa2, 0xa4, 0xa4, 0xa6, 0xa6, /* 0xa0-0xa7 */ + 0xa8, 0xa8, 0xaa, 0xaa, 0xac, 0xac, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb5, 0xb7, /* 0xb0-0xb7 */ + 0xb7, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbd, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd0, 0xd2, 0xd2, 0xd4, 0xd4, 0xd6, 0xd6, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xd8, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xde, 0xe1, 0xe1, 0xe3, 0xe3, 0xe5, 0xe5, 0xe7, /* 0xe0-0xe7 */ + 0xe7, 0xe9, 0xe9, 0xeb, 0xeb, 0xed, 0xed, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf1, 0xf3, 0xf3, 0xf5, 0xf5, 0xf7, /* 0xf0-0xf7 */ + 0xf7, 0xf9, 0xf9, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -261,28 +296,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x00, 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, /* 0x80-0x87 */ - 0x00, 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, /* 0x88-0x8f */ - 0x00, 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, /* 0x90-0x97 */ - 0x00, 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, /* 0x98-0x9f */ - 0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x81, 0x81, 0x83, 0x83, 0x85, 0x85, 0x87, 0x87, /* 0x80-0x87 */ + 0x89, 0x89, 0x8b, 0x8b, 0x8d, 0x8d, 0x8f, 0x8f, /* 0x88-0x8f */ + 0x91, 0x91, 0x93, 0x93, 0x95, 0x95, 0x97, 0x97, /* 0x90-0x97 */ + 0x99, 0x99, 0x9b, 0x9b, 0x9d, 0x9d, 0x9f, 0x9f, /* 0x98-0x9f */ + 0xa1, 0xa1, 0xa3, 0xa3, 0xa5, 0xa5, 0xa7, 0xa7, /* 0xa0-0xa7 */ + 0xa9, 0xa9, 0xab, 0xab, 0xad, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb6, 0xb8, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0x00, 0xea, 0x00, 0xec, 0x00, 0xee, 0xef, /* 0xe8-0xef */ - 0xf0, 0x00, 0xf2, 0x00, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */ - 0xf8, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xd1, 0xd1, 0xd3, 0xd3, 0xd5, 0xd5, 0xd7, 0xd7, /* 0xd0-0xd7 */ + 0xdd, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xe0, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe2, 0xe2, 0xe4, 0xe4, 0xe6, 0xe6, 0xe8, /* 0xe0-0xe7 */ + 0xe8, 0xea, 0xea, 0xec, 0xec, 0xee, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf2, 0xf2, 0xf4, 0xf4, 0xf6, 0xf6, 0xf8, /* 0xf0-0xf7 */ + 0xf8, 0xfa, 0xfa, 0xfc, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -299,6 +334,8 @@ "cp855", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp857.c linux/fs/nls/nls_cp857.c --- v2.3.30/linux/fs/nls/nls_cp857.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp857.c Tue Dec 7 10:21:10 1999 @@ -211,7 +211,42 @@ NULL, NULL, NULL, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x69, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9f, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa7, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0x85, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0x88, 0x89, 0x8a, 0x00, 0xa1, 0x8c, /* 0xd0-0xd7 */ + 0x8b, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xec, 0xdf, /* 0xd8-0xdf */ + 0xa2, 0xe1, 0x93, 0x95, 0xe4, 0xe4, 0xe6, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xa3, 0x96, 0x97, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -225,28 +260,28 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0x00, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xb7, 0x8f, 0x80, /* 0x80-0x87 */ + 0xd2, 0xd3, 0xd4, 0xd8, 0xd7, 0x49, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x92, 0x92, 0xe2, 0x99, 0xe3, 0xea, 0xeb, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x9e, /* 0x98-0x9f */ + 0xb5, 0xd6, 0xe0, 0xe9, 0xa5, 0xa5, 0xa6, 0xa6, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xde, 0x00, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -263,6 +298,8 @@ "cp857", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp860.c linux/fs/nls/nls_cp860.c --- v2.3.30/linux/fs/nls/nls_cp860.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp860.c Tue Dec 7 10:21:10 1999 @@ -319,7 +319,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0xa0, 0x87, /* 0x80-0x87 */ + 0x88, 0x88, 0x8a, 0xa1, 0x93, 0x8d, 0x84, 0x83, /* 0x88-0x8f */ + 0x82, 0x85, 0x8a, 0x93, 0x94, 0x95, 0xa3, 0x97, /* 0x90-0x97 */ + 0x8d, 0x94, 0x81, 0x9b, 0x9c, 0x97, 0x9e, 0xa2, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0x95, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -333,15 +368,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, /* 0x80-0x87 */ - 0x00, 0x89, 0x00, 0x8b, 0x8c, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x96, 0x00, /* 0x90-0x97 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0x8f, 0x8e, 0x91, 0x86, 0x80, /* 0x80-0x87 */ + 0x89, 0x89, 0x92, 0x8b, 0x8c, 0x98, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x8c, 0x99, 0xa9, 0x96, 0x9d, /* 0x90-0x97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x86, 0x8b, 0x9f, 0x96, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -349,12 +385,11 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -371,6 +406,8 @@ "cp860", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp861.c linux/fs/nls/nls_cp861.c --- v2.3.30/linux/fs/nls/nls_cp861.c Sun Jan 4 10:55:09 1998 +++ linux/fs/nls/nls_cp861.c Tue Dec 7 10:21:10 1999 @@ -355,7 +355,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8c, 0x8c, 0x95, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x98, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa0, 0xa1, 0xa2, 0xa3, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -369,15 +404,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x8b, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x97, /* 0x90-0x97 */ - 0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x8b, 0x8b, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x92, 0x92, 0x00, 0x99, 0x8d, 0x00, 0x97, /* 0x90-0x97 */ + 0x97, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ + 0xa4, 0xa5, 0xa6, 0xa7, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -385,12 +421,11 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif static void inc_use_count(void) @@ -407,6 +442,8 @@ "cp861", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp862.c linux/fs/nls/nls_cp862.c --- v2.3.30/linux/fs/nls/nls_cp862.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp862.c Tue Dec 7 10:21:10 1999 @@ -391,7 +391,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -405,15 +440,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -421,12 +457,12 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -442,6 +478,8 @@ "cp862", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp863.c linux/fs/nls/nls_cp863.c --- v2.3.30/linux/fs/nls/nls_cp863.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp863.c Tue Dec 7 10:21:10 1999 @@ -355,7 +355,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x83, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x85, 0x8f, /* 0x88-0x8f */ + 0x82, 0x8a, 0x88, 0x93, 0x89, 0x8b, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x93, 0x81, 0x9b, 0x9c, 0x97, 0x96, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x8c, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -369,13 +404,14 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x84, 0x00, 0x86, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x94, 0x95, 0x00, 0x00, /* 0x90-0x97 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0x84, 0x84, 0x8e, 0x86, 0x80, /* 0x80-0x87 */ + 0x92, 0x94, 0x91, 0x95, 0xa8, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x99, 0x94, 0x95, 0x9e, 0x9d, /* 0x90-0x97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ @@ -385,12 +421,12 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -406,6 +442,8 @@ "cp863", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp864.c linux/fs/nls/nls_cp864.c --- v2.3.30/linux/fs/nls/nls_cp864.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp864.c Tue Dec 7 10:21:10 1999 @@ -346,7 +346,42 @@ NULL, NULL, NULL, NULL, NULL, NULL, pagefe, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -360,15 +395,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0x91, 0x00, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -379,9 +415,9 @@ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -397,6 +433,8 @@ "cp864", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp865.c linux/fs/nls/nls_cp865.c --- v2.3.30/linux/fs/nls/nls_cp865.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp865.c Tue Dec 7 10:21:10 1999 @@ -355,7 +355,42 @@ page20, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */ + 0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -369,15 +404,16 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x90, 0x92, 0x92, 0x00, 0x99, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ + 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ @@ -385,12 +421,12 @@ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -406,6 +442,8 @@ "cp865", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp866.c linux/fs/nls/nls_cp866.c --- v2.3.30/linux/fs/nls/nls_cp866.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp866.c Tue Dec 7 10:21:10 1999 @@ -283,7 +283,42 @@ NULL, page21, page22, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x80-0x87 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x88-0x8f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x90-0x97 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf1, 0xf1, 0xf3, 0xf3, 0xf5, 0xf5, 0xf7, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -297,28 +332,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0xa0-0xa7 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0xf0, 0x00, 0xf2, 0x00, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0xe0-0xe7 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0xe8-0xef */ + 0xf0, 0xf0, 0xf2, 0xf2, 0xf4, 0xf4, 0xf6, 0xf6, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -334,6 +370,8 @@ "cp866", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp869.c linux/fs/nls/nls_cp869.c --- v2.3.30/linux/fs/nls/nls_cp869.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp869.c Tue Dec 7 10:21:10 1999 @@ -247,7 +247,42 @@ page20, NULL, NULL, NULL, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x00, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x9d, 0x8e, 0x9e, /* 0x88-0x8f */ + 0x9f, 0xa0, 0xa2, 0x00, 0x00, 0xa3, 0xfb, 0x97, /* 0x90-0x97 */ + 0xfd, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xd6, 0xd7, 0xd8, 0xdd, /* 0xa0-0xa7 */ + 0xde, 0xe0, 0xe1, 0xab, 0xe2, 0xe3, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xe4, 0xe5, 0xe6, /* 0xb0-0xb7 */ + 0xe7, 0xb9, 0xba, 0xbb, 0xbc, 0xe8, 0xe9, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xea, 0xeb, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xec, /* 0xc8-0xcf */ + 0xee, 0xf2, 0xf3, 0xf4, 0xf6, 0xfa, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -261,28 +296,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x00, 0x9c, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x90, 0x91, 0x92, 0x00, 0x00, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x86, 0x9c, 0x8d, 0x8f, 0x90, /* 0x98-0x9f */ + 0x91, 0xa1, 0x92, 0x95, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, /* 0xe8-0xef */ - 0xf0, 0xf1, 0x00, 0x00, 0x00, 0xf5, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, /* 0xf8-0xff */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xa4, 0xa5, /* 0xd0-0xd7 */ + 0xa6, 0xd9, 0xda, 0xdb, 0xdc, 0xa7, 0xa8, 0xdf, /* 0xd8-0xdf */ + 0xa9, 0xaa, 0xac, 0xad, 0xb5, 0xb6, 0xb7, 0xb8, /* 0xe0-0xe7 */ + 0xbd, 0xbe, 0xc6, 0xc7, 0xcf, 0xcf, 0xd0, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xd1, 0xd2, 0xd3, 0xf5, 0xd4, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xd5, 0x96, 0xfc, 0x98, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -298,6 +334,8 @@ "cp869", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_cp874.c linux/fs/nls/nls_cp874.c --- v2.3.30/linux/fs/nls/nls_cp874.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_cp874.c Tue Dec 7 10:21:10 1999 @@ -211,7 +211,42 @@ page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -225,14 +260,15 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ @@ -240,13 +276,13 @@ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -262,6 +298,8 @@ "cp874", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-1.c linux/fs/nls/nls_iso8859-1.c --- v2.3.30/linux/fs/nls/nls_iso8859-1.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-1.c Tue Dec 7 10:21:10 1999 @@ -135,7 +135,42 @@ page00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -149,28 +184,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -186,6 +222,8 @@ "iso8859-1", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-14.c linux/fs/nls/nls_iso8859-14.c --- v2.3.30/linux/fs/nls/nls_iso8859-14.c Thu Aug 26 13:05:40 1999 +++ linux/fs/nls/nls_iso8859-14.c Tue Dec 7 10:21:10 1999 @@ -219,6 +219,79 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa2, 0xa2, 0xa3, 0xab, 0xab, 0xab, 0xa7, /* 0xa0-0xa7 */ + 0xb8, 0xa9, 0xba, 0xab, 0xbc, 0xad, 0xae, 0xff, /* 0xa8-0xaf */ + 0xb1, 0xb1, 0xb3, 0xb3, 0xb5, 0xb5, 0xb6, 0xb9, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbf, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + +static unsigned char charset2upper[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa1, 0xa3, 0xa6, 0xa6, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xa6, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb0, 0xb2, 0xb2, 0xb4, 0xb4, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xa8, 0xb7, 0xaa, 0xbb, 0xac, 0xbd, 0xbd, 0xbb, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xaf, /* 0xf8-0xff */ +}; + + static void inc_use_count(void) { MOD_INC_USE_COUNT; @@ -233,6 +306,8 @@ "iso8859-14", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-15.c linux/fs/nls/nls_iso8859-15.c --- v2.3.30/linux/fs/nls/nls_iso8859-15.c Fri Dec 18 08:09:51 1998 +++ linux/fs/nls/nls_iso8859-15.c Tue Dec 7 10:21:10 1999 @@ -212,6 +212,79 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb8, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbd, 0xbd, 0xff, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + +static unsigned char charset2upper[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa6, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb4, 0xb9, 0xba, 0xbb, 0xbc, 0xbc, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xbe, /* 0xf8-0xff */ +}; + + static void inc_use_count(void) { MOD_INC_USE_COUNT; @@ -226,6 +299,8 @@ "iso8859-15", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-2.c linux/fs/nls/nls_iso8859-2.c --- v2.3.30/linux/fs/nls/nls_iso8859-2.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-2.c Tue Dec 7 10:21:10 1999 @@ -207,7 +207,42 @@ page00, page01, page02, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xb1, 0xa2, 0xb3, 0xa4, 0xb5, 0xb6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xb9, 0xba, 0xbb, 0xbc, 0xad, 0xbe, 0xbf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -221,28 +256,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0x00, 0xb2, 0x00, 0xb4, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ + 0xb0, 0xa1, 0xb2, 0xa3, 0xb4, 0xa5, 0xa6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xa9, 0xaa, 0xab, 0xac, 0xbd, 0xae, 0xaf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -258,6 +294,8 @@ "iso8859-2", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-3.c linux/fs/nls/nls_iso8859-3.c --- v2.3.30/linux/fs/nls/nls_iso8859-3.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-3.c Tue Dec 7 10:21:10 1999 @@ -207,7 +207,42 @@ page00, page01, page02, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xb1, 0xa2, 0xa3, 0xa4, 0x00, 0xb6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0x69, 0xba, 0xbb, 0xbc, 0xad, 0x00, 0xbf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0x00, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -221,28 +256,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xa1, 0xb2, 0xb3, 0xb4, 0x00, 0xa6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0x49, 0xaa, 0xab, 0xac, 0xbd, 0x00, 0xaf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */ + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -258,6 +294,8 @@ "iso8859-3", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-4.c linux/fs/nls/nls_iso8859-4.c --- v2.3.30/linux/fs/nls/nls_iso8859-4.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-4.c Tue Dec 7 10:21:10 1999 @@ -207,7 +207,42 @@ page00, page01, page02, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xb1, 0xa2, 0xb3, 0xa4, 0xb5, 0xb6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xb9, 0xba, 0xbb, 0xbc, 0xad, 0xbe, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbf, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -221,28 +256,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0x00, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0x00, 0xb2, 0x00, 0xb4, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ + 0xb0, 0xa1, 0xb2, 0xa3, 0xb4, 0xa5, 0xa6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xa9, 0xaa, 0xab, 0xac, 0xbd, 0xae, 0xbd, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -258,6 +294,8 @@ "iso8859-4", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-5.c linux/fs/nls/nls_iso8859-5.c --- v2.3.30/linux/fs/nls/nls_iso8859-5.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-5.c Tue Dec 7 10:21:10 1999 @@ -211,7 +211,42 @@ NULL, page21, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xa0-0xa7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xad, 0xfe, 0xff, /* 0xa8-0xaf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -225,28 +260,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xd0-0xd7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xf0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xf0-0xf7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xfd, 0xae, 0xaf, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -262,6 +298,8 @@ "iso8859-5", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-6.c linux/fs/nls/nls_iso8859-6.c --- v2.3.30/linux/fs/nls/nls_iso8859-6.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-6.c Tue Dec 7 10:21:10 1999 @@ -171,7 +171,42 @@ page00, NULL, NULL, NULL, NULL, NULL, page06, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -185,28 +220,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -222,6 +258,8 @@ "iso8859-6", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-7.c linux/fs/nls/nls_iso8859-7.c --- v2.3.30/linux/fs/nls/nls_iso8859-7.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-7.c Tue Dec 7 10:21:10 1999 @@ -247,7 +247,42 @@ page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xdc, 0xb7, /* 0xb0-0xb7 */ + 0xdd, 0xde, 0xdf, 0xbb, 0xfc, 0xbd, 0xfd, 0xfe, /* 0xb8-0xbf */ + 0xc0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -261,28 +296,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */ + 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xb6, 0xb8, 0xb9, 0xba, /* 0xd8-0xdf */ + 0xe0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd3, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xbc, 0xbe, 0xbf, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -298,6 +334,8 @@ "iso8859-7", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-8.c linux/fs/nls/nls_iso8859-8.c --- v2.3.30/linux/fs/nls/nls_iso8859-8.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-8.c Tue Dec 7 10:21:10 1999 @@ -211,7 +211,42 @@ page20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -225,28 +260,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ + 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -262,6 +298,8 @@ "iso8859-8", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_iso8859-9.c linux/fs/nls/nls_iso8859-9.c --- v2.3.30/linux/fs/nls/nls_iso8859-9.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_iso8859-9.c Tue Dec 7 10:21:10 1999 @@ -171,7 +171,42 @@ page00, page01, NULL, NULL, NULL, NULL, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x69, 0xfe, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -185,28 +220,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x49, 0xde, 0x00, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -222,6 +258,8 @@ "iso8859-9", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/nls/nls_koi8-r.c linux/fs/nls/nls_koi8-r.c --- v2.3.30/linux/fs/nls/nls_koi8-r.c Sun Jan 25 10:05:47 1998 +++ linux/fs/nls/nls_koi8-r.c Tue Dec 7 10:21:10 1999 @@ -283,7 +283,42 @@ NULL, NULL, page22, page23, NULL, page25, NULL, NULL, }; -#if 0 +static unsigned char charset2lower[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xa3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */ +}; + static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ @@ -297,28 +332,29 @@ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ - 0xa0, 0xa1, 0xa2, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa0, 0xa1, 0xa2, 0xb3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; -#endif + static void inc_use_count(void) { @@ -334,6 +370,8 @@ "koi8-r", page_uni2charset, charset2uni, + charset2lower, + charset2upper, inc_use_count, dec_use_count, NULL diff -u --recursive --new-file v2.3.30/linux/fs/open.c linux/fs/open.c --- v2.3.30/linux/fs/open.c Tue Dec 7 09:32:48 1999 +++ linux/fs/open.c Tue Dec 7 15:32:51 1999 @@ -79,13 +79,18 @@ return error; } -asmlinkage long sys_truncate(const char * path, unsigned long length) +static inline long do_sys_truncate(const char * path, loff_t length) { struct dentry * dentry; struct inode * inode; int error; lock_kernel(); + + error = -EINVAL; + if (length < 0) /* sorry, but loff_t says... */ + goto out; + dentry = namei(path); error = PTR_ERR(dentry); @@ -128,13 +133,21 @@ return error; } -asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) +asmlinkage long sys_truncate(const char * path, unsigned long length) +{ + return do_sys_truncate(path, length); +} + +static inline long do_sys_ftruncate(unsigned int fd, loff_t length) { struct inode * inode; struct dentry *dentry; struct file * file; int error; + error = -EINVAL; + if (length < 0) + goto out; error = -EBADF; file = fget(fd); if (!file) @@ -162,6 +175,24 @@ out: return error; } + +asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) +{ + return do_sys_ftruncate(fd, length); +} + +/* LFS versions of truncate are only needed on 32 bit machines */ +#if BITS_PER_LONG == 32 +asmlinkage long sys_truncate64(const char * path, loff_t length) +{ + return do_sys_truncate(path, length); +} + +asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) +{ + return do_sys_ftruncate(fd, length); +} +#endif #if !(defined(__alpha__) || defined(__ia64__)) diff -u --recursive --new-file v2.3.30/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h --- v2.3.30/linux/include/asm-alpha/system.h Tue Dec 7 09:32:49 1999 +++ linux/include/asm-alpha/system.h Tue Dec 7 13:59:01 1999 @@ -317,12 +317,11 @@ #define tbia() __tbi(-2, /* no second argument */) /* - * Give prototypes to shut up gcc. + * Atomic exchange. */ -extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val); -extern __inline__ unsigned long xchg_u64(volatile long *m, unsigned long val); -extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val) +extern __inline__ unsigned long +__xchg_u32(volatile int *m, unsigned long val) { unsigned long dummy; @@ -341,7 +340,8 @@ return val; } -extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val) +extern __inline__ unsigned long +__xchg_u64(volatile long *m, unsigned long val) { unsigned long dummy; @@ -360,32 +360,108 @@ return val; } -/* - * This function doesn't exist, so you'll get a linker error - * if something tries to do an invalid xchg(). - * - * This only works if the compiler isn't horribly bad at optimizing. - * gcc-2.5.8 reportedly can't handle this, but as that doesn't work - * too well on the alpha anyway.. - */ +/* This function doesn't exist, so you'll get a linker error + if something tries to do an invalid xchg(). */ extern void __xchg_called_with_bad_pointer(void); static __inline__ unsigned long -__xchg(unsigned long x, volatile void * ptr, int size) +__xchg(volatile void *ptr, unsigned long x, int size) { switch (size) { case 4: - return xchg_u32(ptr, x); + return __xchg_u32(ptr, x); case 8: - return xchg_u64(ptr, x); + return __xchg_u64(ptr, x); } __xchg_called_with_bad_pointer(); return x; } -#define xchg(ptr,x) \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg(ptr,x) \ + ({ \ + __typeof__(*(ptr)) _x_ = (x); \ + (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ + }) + #define tas(ptr) (xchg((ptr),1)) + + +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define __HAVE_ARCH_CMPXCHG 1 + +extern __inline__ unsigned long +__cmpxchg_u32(volatile int *m, int old, int new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldl_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stl_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +extern __inline__ unsigned long +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldq_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stq_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +/* This function doesn't exist, so you'll get a linker error + if something tries to do an invalid cmpxchg(). */ +extern void __cmpxchg_called_with_bad_pointer(void); + +static __inline__ unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + switch (size) { + case 4: + return __cmpxchg_u32(ptr, old, new); + case 8: + return __cmpxchg_u64(ptr, old, new); + } + __cmpxchg_called_with_bad_pointer(); + return old; +} + +#define cmpxchg(ptr,o,n) \ + ({ \ + __typeof__(*(ptr)) _o_ = (o); \ + __typeof__(*(ptr)) _n_ = (n); \ + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ + (unsigned long)_n_, sizeof(*(ptr))); \ + }) #endif /* __ASSEMBLY__ */ diff -u --recursive --new-file v2.3.30/linux/include/asm-i386/system.h linux/include/asm-i386/system.h --- v2.3.30/linux/include/asm-i386/system.h Tue Dec 7 09:32:49 1999 +++ linux/include/asm-i386/system.h Tue Dec 7 14:10:48 1999 @@ -3,6 +3,7 @@ #include #include +#include /* for LOCK_PREFIX */ #ifdef __KERNEL__ @@ -207,6 +208,50 @@ } return x; } + +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#if CPU != 386 +#define __HAVE_ARCH_CMPXCHG 1 + +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long prev; + switch (size) { + case 1: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + } + return old; +} + +#define cmpxchg(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) + +#else +/* Compiling for a 386 proper. Is it worth implementing via cli/sti? */ +#endif /* * Force strict CPU ordering. diff -u --recursive --new-file v2.3.30/linux/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h --- v2.3.30/linux/include/asm-i386/unistd.h Mon Nov 1 13:56:27 1999 +++ linux/include/asm-i386/unistd.h Tue Dec 7 15:32:51 1999 @@ -196,6 +196,9 @@ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 /* user-visible error numbers are in the range -1 - -124: see */ @@ -270,6 +273,19 @@ : "=a" (__res) \ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ + : "=a" (__res) \ + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ + "0" ((long)(arg6))); \ __syscall_return(type,__res); \ } diff -u --recursive --new-file v2.3.30/linux/include/linux/802_11.h linux/include/linux/802_11.h --- v2.3.30/linux/include/linux/802_11.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/802_11.h Tue Dec 7 14:33:32 1999 @@ -0,0 +1,191 @@ +#ifndef IEEE_802_11 +#define IEEE_802_11 + +#include + +enum ieee_802_11_link_status_failure_reason { + reserved0, Unspecified=1, Previous_not_valid, + Sender_Quits_ESS_or_IBSS, + Due_Inactivity, AP_Overload, + Class_2_from_NonAuth, + Class_3_from_NonAuth, + Sender_Quits_BSS, + Association_requester_not_authenticated, + Reserved10 +}; + + +#define IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS \ +{ \ + {reserved0, 0xff," Reserved reason "},\ + {Unspecified, 0xff," Unspecified Reason "},\ + {Previous_not_valid, 0xff," Previous Authentication no longer valid "},\ + {Sender_Quits_ESS_or_IBSS,0xff," Deauthenticated because sending station is leaving (has left) IBSS or ESS "},\ + {Due_Inactivity, 0xff," Disassociated due to inactivity "},\ + {AP_Overload, 0xff," Disassociated because AP is unable to handle all currently associated stations "},\ + {Class_2_from_NonAuth, 0xff," Class 2 frame received from non-Authenticated station"},\ + {Class_3_from_NonAuth, 0xff," Class 3 frame received from non­Associated station"},\ + {Sender_Quits_BSS, 0xff," Disassociated because sending station is leaving (has left) BSS"},\ + {Association_requester_not_authenticated,0xff," Station requesting (Re)Association is not Authenticated with responding station"},\ + {Reserved10, 0xff," Reserved"},\ + {0,0,NULL}\ +}; + + + +struct ieee_802_11_header { + u16 frame_control;// needs to be subtyped + u16 duration; + u8 mac1[6]; + u8 mac2[6]; + u8 mac3[6]; + u16 SeqCtl; + u8 mac4[6]; + u16 gapLen; + u8 gap[8]; +}; + + +struct ieee_802_3_header { + + u16 status; + u16 payload_length; + u8 dst_mac[6]; + u8 src_mac[6]; + +}; + +#define P80211_OUI_LEN 3 + +struct ieee_802_11_snap_header { + + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + +} __attribute__ ((packed)); + +#define P80211_LLC_OUI_LEN 3 + +struct ieee_802_11_802_1H_header { + + u8 dsap; + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u16 unknown1; /* packet type ID fields */ + u16 unknown2; /* here is something like length in some cases */ +} __attribute__ ((packed)); + +struct ieee_802_11_802_2_header { + + u8 dsap; + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u8 type; /* packet type ID field. i guess, */ + +} __attribute__ ((packed)); + + + +// following is incoplete and may be incorrect and need reorganization + +#define ieee_802_11_frame_type_Management 0x00 +#define ieee_802_11_frame_type_Control 0x01 +#define ieee_802_11_frame_type_Data 0x10 +#define ieee_802_11_frame_type_Reserved 0x11 + +#define ieee_802_11_frame_subtype_Association_Req 0x0 // Association Request +#define ieee_802_11_frame_subtype_Association_Resp 0x1 // Association Response +#define ieee_802_11_frame_subtype_Reassociation_Req 0x2 // Reassociation Request +#define ieee_802_11_frame_subtype_Reassociation_Resp 0x3 // Reassociation Response +#define ieee_802_11_frame_subtype_Probe_Req 0x4 // Probe Request +#define ieee_802_11_frame_subtype_Probe_Resp 0x5 // Probe Response +#define ieee_802_11_frame_subtype_Beacon 0x8 // Beacon +#define ieee_802_11_frame_subtype_ATIM 0x9 // ATIM +#define ieee_802_11_frame_subtype_Disassociation 0xA // Disassociation +#define ieee_802_11_frame_subtype_Authentication 0xB // Authentication +#define ieee_802_11_frame_subtype_Deauthentication 0xC // Deauthentication +#define ieee_802_11_frame_subtype_PS_Poll 0xA // PS-Poll +#define ieee_802_11_frame_subtype_RTS 0xB // RTS +#define ieee_802_11_frame_subtype_CTS 0xC // CTS +#define ieee_802_11_frame_subtype_ACK 0xD // ACK +#define ieee_802_11_frame_subtype_CFEnd 0xE // CF-End +#define ieee_802_11_frame_subtype_CFEnd_CFAck 0xF // CF-End + CF-Ack +#define ieee_802_11_frame_subtype_Data 0x0 // Data +#define ieee_802_11_frame_subtype_Data_CFAck 0x1 // Data + CF-Ack +#define ieee_802_11_frame_subtype_Data_CF_Poll 0x2 // Data + CF-Poll +#define ieee_802_11_frame_subtype_Data_CF_AckCF_Poll 0x3 // Data + CF-Ack + CF-Poll +#define ieee_802_11_frame_subtype_NullFunction 0x4 // Null Function (no data) +#define ieee_802_11_frame_subtype_CF_Ack 0x5 // CF-Ack (no data) +#define ieee_802_11_frame_subtype_CF_Poll 0x6 // CF-Poll (no data) +#define ieee_802_11_frame_subtype_CF_AckCF_Poll 0x7 // CF-Ack + CF-Poll (no data) + + +#define ieee_802_11_frame_subtype_strings {\ + { ieee_802_11_frame_subtype_Association_Req, 0xF,"f Association Request"},\ + { ieee_802_11_frame_subtype_Association_Resp, 0xF,"1 Association Response"},\ + { ieee_802_11_frame_subtype_Reassociation_Req, 0xF,"2 Reassociation Request"},\ + { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,"3 Reassociation Response"},\ + { ieee_802_11_frame_subtype_Probe_Req , 0xF,"4 Probe Request"},\ + { ieee_802_11_frame_subtype_Probe_Resp , 0xF,"5 Probe Response"},\ + { ieee_802_11_frame_subtype_Beacon , 0xF,"8 Beacon"},\ + { ieee_802_11_frame_subtype_ATIM , 0xF,"9 ATIM"},\ + { ieee_802_11_frame_subtype_Disassociation, 0xF,"A Disassociation"},\ + { ieee_802_11_frame_subtype_Authentication, 0xF,"B Authentication"},\ + { ieee_802_11_frame_subtype_Deauthentication, 0xF,"C Deauthentication"},\ + { ieee_802_11_frame_subtype_PS_Poll , 0xF,"A PS-Poll"},\ + { ieee_802_11_frame_subtype_RTS , 0xF,"B RTS"},\ + { ieee_802_11_frame_subtype_CTS , 0xF,"C CTS"},\ + { ieee_802_11_frame_subtype_ACK , 0xF,"D ACK"},\ + { ieee_802_11_frame_subtype_CFEnd , 0xF,"E CF-End"},\ + { ieee_802_11_frame_subtype_CFEnd_CFAck , 0xF,"F CF-End + CF-Ack"},\ + { ieee_802_11_frame_subtype_Data , 0xF,"0 Data"},\ + { ieee_802_11_frame_subtype_Data_CFAck , 0xF,"1 Data + CF-Ack"},\ + { ieee_802_11_frame_subtype_Data_CFPoll , 0xF,"2 Data + CF-Poll"},\ + { ieee_802_11_frame_subtype_Data_CFAck_CFPoll, 0xF,"3 Data + CF-Ack + CF-Poll"},\ + { ieee_802_11_frame_subtype_Null_Function , 0xF,"4 Null Function (no data)"},\ + { ieee_802_11_frame_subtype_CFAck , 0xF,"5 CF-Ack (no data)"},\ + { ieee_802_11_frame_subtype_CFPoll , 0xF,"6 CF-Poll (no data)"},\ + { ieee_802_11_frame_subtype_CFAck_CFPoll, 0xF,"y7 CF-Ack + CF-Poll (no data)"},\ + { 0,0,NULL}\ +} +struct ieee_802_11_frame_subtype_class { + u8 subtype; + u8 mask; + u8 class; + u8 type; +}; +#define ieee_802_11_frame_subtype_classes {\ + { ieee_802_11_frame_subtype_Association_Req, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Association_Resp, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Reassociation_Req, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Probe_Req , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Probe_Resp , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Beacon , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_ATIM , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Disassociation, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Authentication, 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Deauthentication, 0xF,3,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_PS-Poll , 0xF,3,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_RTS , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CTS , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_ACK , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CFEnd , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CFEnd_CFAck , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_Data , 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CFAck , 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CF_Poll 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CF_AckCF_Poll, 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_NullFunction 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_Ack , 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_Poll , 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_AckCF_Poll, 0xF,1,ieee_802_11_frame_type_Data},\ + { 0,0,NULL}\ +} + + +#endif \ No newline at end of file diff -u --recursive --new-file v2.3.30/linux/include/linux/agp_backend.h linux/include/linux/agp_backend.h --- v2.3.30/linux/include/linux/agp_backend.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/agp_backend.h Tue Dec 7 16:22:34 1999 @@ -0,0 +1,224 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight + * Copyright (C) 1999 Xi Graphics + * + * 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 + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +#ifndef _AGP_BACKEND_H +#define _AGP_BACKEND_H 1 + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define AGPGART_VERSION_MAJOR 0 +#define AGPGART_VERSION_MINOR 99 + +enum chipset_type { + NOT_SUPPORTED, + INTEL_GENERIC, + INTEL_LX, + INTEL_BX, + INTEL_GX, + INTEL_I810, + VIA_GENERIC, + VIA_VP3, + VIA_MVP3, + VIA_APOLLO_PRO, + SIS_GENERIC, + AMD_GENERIC, + AMD_IRONGATE, + ALI_M1541, + ALI_GENERIC +}; + +typedef struct _agp_version { + u16 major; + u16 minor; +} agp_version; + +typedef struct _agp_kern_info { + agp_version version; + struct pci_dev *device; + enum chipset_type chipset; + unsigned long mode; + off_t aper_base; + size_t aper_size; + int max_memory; /* In pages */ + int current_memory; +} agp_kern_info; + +/* + * The agp_memory structure has information + * about the block of agp memory allocated. + * A caller may manipulate the next and prev + * pointers to link each allocated item into + * a list. These pointers are ignored by the + * backend. Everything else should never be + * written to, but the caller may read any of + * the items to detrimine the status of this + * block of agp memory. + * + */ + +typedef struct _agp_memory { + int key; + struct _agp_memory *next; + struct _agp_memory *prev; + size_t page_count; + int num_scratch_pages; + unsigned long *memory; + off_t pg_start; + u32 type; + u8 is_bound; + u8 is_flushed; +} agp_memory; + +#define AGP_NORMAL_MEMORY 0 + +extern void agp_free_memory(agp_memory *); + +/* + * void agp_free_memory(agp_memory *curr) : + * + * This function frees memory associated with + * an agp_memory pointer. It is the only function + * that can be called when the backend is not owned + * by the caller. (So it can free memory on client + * death.) + * + * It takes an agp_memory pointer as an argument. + * + */ + +extern agp_memory *agp_allocate_memory(size_t, u32); + +/* + * agp_memory *agp_allocate_memory(size_t page_count, u32 type) : + * + * This function allocates a group of pages of + * a certain type. + * + * It takes a size_t argument of the number of pages, and + * an u32 argument of the type of memory to be allocated. + * Every agp bridge device will allow you to allocate + * AGP_NORMAL_MEMORY which maps to physical ram. Any other + * type is device dependant. + * + * It returns NULL whenever memory is unavailable. + * + */ + +extern void agp_copy_info(agp_kern_info *); + +/* + * void agp_copy_info(agp_kern_info *info) : + * + * This function copies information about the + * agp bridge device and the state of the agp + * backend into an agp_kern_info pointer. + * + * It takes an agp_kern_info pointer as an + * argument. The caller should insure that + * this pointer is valid. + * + */ + +extern int agp_bind_memory(agp_memory *, off_t); + +/* + * int agp_bind_memory(agp_memory *curr, off_t pg_start) : + * + * This function binds an agp_memory structure + * into the graphics aperture translation table. + * + * It takes an agp_memory pointer and an offset into + * the graphics aperture translation table as arguments + * + * It returns -EINVAL if the pointer == NULL. + * It returns -EBUSY if the area of the table + * requested is already in use. + * + */ + +extern int agp_unbind_memory(agp_memory *); + +/* + * int agp_unbind_memory(agp_memory *curr) : + * + * This function removes an agp_memory structure + * from the graphics aperture translation table. + * + * It takes an agp_memory pointer as an argument. + * + * It returns -EINVAL if this piece of agp_memory + * is not currently bound to the graphics aperture + * translation table or if the agp_memory + * pointer == NULL + * + */ + +extern void agp_enable(u32); + +/* + * void agp_enable(u32 mode) : + * + * This function initializes the agp point-to-point + * connection. + * + * It takes an agp mode register as an argument + * + */ + +extern int agp_backend_acquire(void); + +/* + * int agp_backend_acquire(void) : + * + * This Function attempts to acquire the agp + * backend. + * + * returns -EBUSY if agp is in use, + * returns 0 if the caller owns the agp backend + */ + +extern void agp_backend_release(void); + +/* + * void agp_backend_release(void) : + * + * This Function releases the lock on the agp + * backend. + * + * The caller must insure that the graphics + * aperture translation table is read for use + * by another entity. (Ensure that all memory + * it bound is unbound.) + * + */ + +#endif /* _AGP_BACKEND_H */ diff -u --recursive --new-file v2.3.30/linux/include/linux/agpgart.h linux/include/linux/agpgart.h --- v2.3.30/linux/include/linux/agpgart.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/agpgart.h Tue Dec 7 16:22:34 1999 @@ -0,0 +1,216 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight + * Copyright (C) 1999 Xi Graphics + * + * 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 + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS 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. + * + */ + +#ifndef _AGP_H +#define _AGP_H 1 + +#define AGPIOC_BASE 'A' +#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, agp_info*) +#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) +#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) +#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, agp_setup*) +#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, agp_region*) +#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, agp_region*) +#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, agp_allocate*) +#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) +#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, agp_bind*) +#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, agp_unbind*) + +#define AGP_DEVICE "/dev/agpgart" + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef __KERNEL__ +#include +#include + +typedef struct _agp_version { + __u16 major; + __u16 minor; +} agp_version; + +typedef struct _agp_info { + agp_version version; /* version of the driver */ + __u32 bridge_id; /* bridge vendor/device */ + __u32 agp_mode; /* mode info of bridge */ + off_t aper_base; /* base of aperture */ + size_t aper_size; /* size of aperture */ + size_t pg_total; /* max pages (swap + system) */ + size_t pg_system; /* max pages (system) */ + size_t pg_used; /* current pages used */ +} agp_info; + +typedef struct _agp_setup { + __u32 agp_mode; /* mode info of bridge */ +} agp_setup; + +/* + * The "prot" down below needs still a "sleep" flag somehow ... + */ +typedef struct _agp_segment { + off_t pg_start; /* starting page to populate */ + size_t pg_count; /* number of pages */ + int prot; /* prot flags for mmap */ +} agp_segment; + +typedef struct _agp_region { + pid_t pid; /* pid of process */ + size_t seg_count; /* number of segments */ + struct _agp_segment *seg_list; +} agp_region; + +typedef struct _agp_allocate { + int key; /* tag of allocation */ + size_t pg_count; /* number of pages */ + __u32 type; /* 0 == normal, other devspec */ +} agp_allocate; + +typedef struct _agp_bind { + int key; /* tag of allocation */ + off_t pg_start; /* starting page to populate */ +} agp_bind; + +typedef struct _agp_unbind { + int key; /* tag of allocation */ + __u32 priority; /* priority for paging out */ +} agp_unbind; + +#else /* __KERNEL__ */ + +#define AGPGART_MINOR 175 + +#define AGP_UNLOCK() up(&(agp_fe.agp_mutex)); +#define AGP_LOCK() down(&(agp_fe.agp_mutex)); +#define AGP_LOCK_INIT() sema_init(&(agp_fe.agp_mutex), 1) + +#ifndef _AGP_BACKEND_H +typedef struct _agp_version { + u16 major; + u16 minor; +} agp_version; + +#endif + +typedef struct _agp_info { + agp_version version; /* version of the driver */ + u32 bridge_id; /* bridge vendor/device */ + u32 agp_mode; /* mode info of bridge */ + off_t aper_base; /* base of aperture */ + size_t aper_size; /* size of aperture */ + size_t pg_total; /* max pages (swap + system) */ + size_t pg_system; /* max pages (system) */ + size_t pg_used; /* current pages used */ +} agp_info; + +typedef struct _agp_setup { + u32 agp_mode; /* mode info of bridge */ +} agp_setup; + +/* + * The "prot" down below needs still a "sleep" flag somehow ... + */ +typedef struct _agp_segment { + off_t pg_start; /* starting page to populate */ + size_t pg_count; /* number of pages */ + int prot; /* prot flags for mmap */ +} agp_segment; + +typedef struct _agp_segment_priv { + off_t pg_start; + size_t pg_count; + pgprot_t prot; +} agp_segment_priv; + +typedef struct _agp_region { + pid_t pid; /* pid of process */ + size_t seg_count; /* number of segments */ + struct _agp_segment *seg_list; +} agp_region; + +typedef struct _agp_allocate { + int key; /* tag of allocation */ + size_t pg_count; /* number of pages */ + u32 type; /* 0 == normal, other devspec */ +} agp_allocate; + +typedef struct _agp_bind { + int key; /* tag of allocation */ + off_t pg_start; /* starting page to populate */ +} agp_bind; + +typedef struct _agp_unbind { + int key; /* tag of allocation */ + u32 priority; /* priority for paging out */ +} agp_unbind; + +typedef struct _agp_client { + struct _agp_client *next; + struct _agp_client *prev; + pid_t pid; + int num_segments; + agp_segment_priv **segments; +} agp_client; + +typedef struct _agp_controller { + struct _agp_controller *next; + struct _agp_controller *prev; + pid_t pid; + int num_clients; + agp_memory *pool; + agp_client *clients; +} agp_controller; + +#define AGP_FF_ALLOW_CLIENT 0 +#define AGP_FF_ALLOW_CONTROLLER 1 +#define AGP_FF_IS_CLIENT 2 +#define AGP_FF_IS_CONTROLLER 3 +#define AGP_FF_IS_VALID 4 + +typedef struct _agp_file_private { + struct _agp_file_private *next; + struct _agp_file_private *prev; + pid_t my_pid; + u32 access_flags; +} agp_file_private; + +struct agp_front_data { + struct semaphore agp_mutex; + agp_controller *current_controller; + agp_controller *controllers; + agp_file_private *file_priv_list; + u8 used_by_controller; + u8 backend_acquired; +}; + +#endif /* __KERNEL__ */ + +#endif /* _AGP_H */ diff -u --recursive --new-file v2.3.30/linux/include/linux/joystick.h linux/include/linux/joystick.h --- v2.3.30/linux/include/linux/joystick.h Sun Nov 7 16:37:34 1999 +++ linux/include/linux/joystick.h Tue Dec 7 14:26:27 1999 @@ -4,7 +4,9 @@ /* * /usr/include/linux/joystick.h Version 1.2 * - * Copyright (C) 1996-1998 Vojtech Pavlik + * Copyright (C) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -34,7 +36,7 @@ * Version */ -#define JS_VERSION 0x01020d +#define JS_VERSION 0x01020f /* * Types and constants for reading from /dev/js @@ -128,64 +130,61 @@ #include -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) +#error "You need to use at least v2.2 Linux kernel." #endif -#ifndef LINUX_VERSION_CODE -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0) -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define JS_HAS_RDTSC (current_cpu_data.x86_capability & 0x10) -#include -#else -#ifdef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,35) -#define JS_HAS_RDTSC (x86_capability & 0x10) -#else -#define JS_HAS_RDTSC 0 -#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#include +typedef struct wait_queue *wait_queue_head_t; +#define __setup(a,b) +#define BASE_ADDRESS(x,i) ((x)->base_address[i]) +#define DECLARE_WAITQUEUE(x,y) struct wait_queue x = { y, NULL } +#define init_waitqueue_head(x) do { *(x) = NULL; } while (0) +#define __set_current_state(x) current->state = x +#define SETUP_PARAM char *str, int *ints +#define SETUP_PARSE(x) do {} while (0) #else -#define JS_HAS_RDTSC (x86_capability & 0x10) -#endif -#define __initdata -#define __init -#define __cli cli -#define __save_flags(flags) save_flags(flags) -#define __restore_flags(flags) restore_flags(flags) -#define spin_lock_irqsave(x, flags) do { save_flags(flags); cli(); } while (0) -#define spin_unlock_irqrestore(x, flags) restore_flags(flags) -#define spin_lock_init(x) do { } while (0) -typedef struct { int something; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } -#define MODULE_AUTHOR(x) -#define MODULE_PARM(x,y) -#define MODULE_SUPPORTED_DEVICE(x) -#define signal_pending(x) (((x)->signal) & ~((x)->blocked)) +#include +#define BASE_ADDRESS(x,i) ((x)->resource[i].start) +#define SETUP_PARAM char *str +#define SETUP_PARSE(x) int ints[x]; get_options(str, x, ints) #endif +#define PCI_VENDOR_ID_AUREAL 0x12eb + /* * Parport stuff */ -#define USE_PARPORT - #include -#include + +#define JS_PAR_STATUS_INVERT (0x80) +#define JS_PAR_CTRL_INVERT (0x04) #define JS_PAR_DATA_IN(y) parport_read_data(y->port) #define JS_PAR_DATA_OUT(x,y) parport_write_data(y->port, x) #define JS_PAR_STATUS(y) parport_read_status(y->port) + +#ifndef PARPORT_NEED_GENERIC_OPS #define JS_PAR_CTRL_IN(y) parport_read_control(y->port) -#define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) -#define JS_PAR_ECTRL_OUT(x,y) outb(x, ECONTROL(y->port)) +#else +#define JS_PAR_CTRL_IN(y) inb(y->port->base+2) +#endif -#define JS_PAR_STATUS_INVERT (0x80) -#define JS_PAR_CTRL_INVERT (0x04) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) +#define JS_PAR_ECTRL_OUT(x,y) parport_write_econtrol(y->port, x) +#else +#define JS_PAR_CTRL_OUT(x,y) \ + do { \ + if ((x) & 0x20) parport_data_reverse(y->port); \ + else parport_data_forward(y->port); \ + parport_write_control(y->port, (x) & ~0x20); \ + } while (0) +#define JS_PAR_ECTRL_OUT(x,y) /*parport sets PS/2 mode on ECR chips */ +#define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE +#define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE +#endif /* * Internal types @@ -194,8 +193,6 @@ struct js_dev; typedef int (*js_read_func)(void *info, int **axes, int **buttons); -typedef unsigned int (*js_time_func)(void); -typedef int (*js_delta_func)(unsigned int x, unsigned int y); typedef int (*js_ops_func)(struct js_dev *dev); struct js_data { @@ -239,20 +236,14 @@ struct js_corr **corr; void *info; int ndevs; + int fail; + int total; }; /* * Sub-module interface */ -extern unsigned int js_time_speed; -extern js_time_func js_get_time; -extern js_delta_func js_delta; - -extern unsigned int js_time_speed_a; -extern js_time_func js_get_time_a; -extern js_delta_func js_delta_a; - extern struct js_port *js_register_port(struct js_port *port, void *info, int devs, int infos, js_read_func read); extern struct js_port *js_unregister_port(struct js_port *port); @@ -270,19 +261,19 @@ extern int js_an_init(void); extern int js_as_init(void); extern int js_console_init(void); +extern int js_cr_init(void); extern int js_db9_init(void); extern int js_gr_init(void); extern int js_l4_init(void); extern int js_lt_init(void); +extern int js_mag_init(void); +extern int js_pci_init(void); extern int js_sw_init(void); +extern int js_sball_init(void); +extern int js_orb_init(void); extern int js_tm_init(void); - -extern void js_am_setup(char *str, int *ints); -extern void js_an_setup(char *str, int *ints); -extern void js_as_setup(char *str, int *ints); -extern void js_console_setup(char *str, int *ints); -extern void js_db9_setup(char *str, int *ints); -extern void js_l4_setup(char *str, int *ints); +extern int js_tg_init(void); +extern int js_war_init(void); #endif /* __KERNEL__ */ diff -u --recursive --new-file v2.3.30/linux/include/linux/mman.h linux/include/linux/mman.h --- v2.3.30/linux/include/linux/mman.h Mon Oct 7 05:18:36 1996 +++ linux/include/linux/mman.h Tue Dec 7 09:36:24 1999 @@ -4,5 +4,6 @@ #include #define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 #endif /* _LINUX_MMAN_H */ diff -u --recursive --new-file v2.3.30/linux/include/linux/ncp_fs.h linux/include/linux/ncp_fs.h --- v2.3.30/linux/include/linux/ncp_fs.h Mon Nov 1 13:56:27 1999 +++ linux/include/linux/ncp_fs.h Tue Dec 7 14:13:15 1999 @@ -213,7 +213,7 @@ #endif /* DEBUG_NCP_MALLOC */ /* linux/fs/ncpfs/inode.c */ -int ncp_notify_change(struct dentry *, struct iattr *attr); +int ncp_notify_change(struct dentry *, struct iattr *); struct super_block *ncp_read_super(struct super_block *, void *, int); struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); void ncp_update_inode(struct inode *, struct ncp_entry_info *); @@ -250,54 +250,24 @@ /* linux/fs/ncpfs/ncplib_kernel.c */ int ncp_make_closed(struct inode *); -static inline void str_upper(char *name) -{ - while (*name) { - if (*name >= 'a' && *name <= 'z') { - *name -= ('a' - 'A'); - } - name++; - } -} - -static inline void str_lower(char *name) -{ - while (*name) { - if (*name >= 'A' && *name <= 'Z') { - *name += ('a' - 'A'); - } - name++; - } -} +#define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber]) -static inline int ncp_namespace(struct inode *inode) +static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) { - struct ncp_server *server = NCP_SERVER(inode); - return server->name_space[NCP_FINFO(inode)->volNumber]; -} - -static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) { -#if defined(CONFIG_NCPFS_NFS_NS) || defined(CONFIG_NCPFS_OS2_NS) +#ifdef CONFIG_NCPFS_SMALLDOS int ns = ncp_namespace(i); -#endif -#if defined(CONFIG_NCPFS_SMALLDOS) && defined(CONFIG_NCPFS_OS2_NS) - if ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS)) - return 0; -#endif - return + + if ((ns == NW_NS_DOS) #ifdef CONFIG_NCPFS_OS2_NS - (ns == NW_NS_OS2) || -#endif /* CONFIG_NCPFS_OS2_NS */ -#ifdef CONFIG_NCPFS_NFS_NS - (ns == NW_NS_NFS) || -#endif /* CONFIG_NCPFS_NFS_NS */ - 0; + || ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS)) +#endif /* CONFIG_NCPFS_OS2_NS */ + ) + return 0; +#endif /* CONFIG_NCPFS_SMALLDOS */ + return 1; } -static inline int ncp_preserve_case(struct inode *i) -{ - return ncp_preserve_entry_case(i, NW_NS_OS2); -} +#define ncp_preserve_case(i) (ncp_namespace(i) != NW_NS_DOS) static inline int ncp_case_sensitive(struct inode *i) { diff -u --recursive --new-file v2.3.30/linux/include/linux/ncp_fs_sb.h linux/include/linux/ncp_fs_sb.h --- v2.3.30/linux/include/linux/ncp_fs_sb.h Sat Oct 9 11:47:50 1999 +++ linux/include/linux/ncp_fs_sb.h Tue Dec 7 10:21:10 1999 @@ -52,23 +52,23 @@ int root_setuped; -/* info for packet signing */ - int sign_wanted; /* 1=Server needs signed packets */ - int sign_active; /* 0=don't do signing, 1=do */ + /* info for packet signing */ + int sign_wanted; /* 1=Server needs signed packets */ + int sign_active; /* 0=don't do signing, 1=do */ char sign_root[8]; /* generated from password and encr. key */ char sign_last[16]; /* Authentication info: NDS or BINDERY, username */ struct { - int auth_type; - size_t object_name_len; - void* object_name; - int object_type; + int auth_type; + size_t object_name_len; + void* object_name; + int object_type; } auth; /* Password info */ struct { - size_t len; - void* data; + size_t len; + void* data; } priv; /* nls info: codepage for volume and charset for I/O */ @@ -77,10 +77,18 @@ /* maximum age in jiffies */ int dentry_ttl; + + /* miscellaneous */ + unsigned int flags; }; #define ncp_sb_info ncp_server +#define NCP_FLAG_UTF8 1 + +#define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag)) +#define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag)) +#define NCP_IS_FLAG(server, flag) ((server)->flags & (flag)) static inline int ncp_conn_valid(struct ncp_server *server) { diff -u --recursive --new-file v2.3.30/linux/include/linux/nfs.h linux/include/linux/nfs.h --- v2.3.30/linux/include/linux/nfs.h Fri Oct 22 13:21:55 1999 +++ linux/include/linux/nfs.h Tue Dec 7 10:01:57 1999 @@ -1,5 +1,8 @@ /* * NFS protocol definitions + * + * This file contains constants mostly for Version 2 of the protocol, + * but also has a couple of NFSv3 bits in (notably the error codes). */ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H @@ -24,30 +27,50 @@ #define NFSMODE_FIFO 0010000 -enum nfs_stat { - NFS_OK = 0, - NFSERR_PERM = 1, - NFSERR_NOENT = 2, - NFSERR_IO = 5, - NFSERR_NXIO = 6, - NFSERR_EAGAIN = 11, - NFSERR_ACCES = 13, - NFSERR_EXIST = 17, - NFSERR_XDEV = 18, - NFSERR_NODEV = 19, - NFSERR_NOTDIR = 20, - NFSERR_ISDIR = 21, - NFSERR_INVAL = 22, /* that Sun forgot */ - NFSERR_FBIG = 27, - NFSERR_NOSPC = 28, - NFSERR_ROFS = 30, - NFSERR_OPNOTSUPP = 45, - NFSERR_NAMETOOLONG = 63, - NFSERR_NOTEMPTY = 66, - NFSERR_DQUOT = 69, - NFSERR_STALE = 70, - NFSERR_WFLUSH = 99 -}; +/* + * NFS stats. The good thing with these values is that NFSv3 errors are + * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which + * no-one uses anyway), so we can happily mix code as long as we make sure + * no NFSv3 errors are returned to NFSv2 clients. + * Error codes that have a `--' in the v2 column are not part of the + * standard, but seem to be widely used nevertheless. + */ + enum nfs_stat { + NFS_OK = 0, /* v2 v3 */ + NFSERR_PERM = 1, /* v2 v3 */ + NFSERR_NOENT = 2, /* v2 v3 */ + NFSERR_IO = 5, /* v2 v3 */ + NFSERR_NXIO = 6, /* v2 v3 */ + NFSERR_EAGAIN = 11, /* v2 v3 */ + NFSERR_ACCES = 13, /* v2 v3 */ + NFSERR_EXIST = 17, /* v2 v3 */ + NFSERR_XDEV = 18, /* v3 */ + NFSERR_NODEV = 19, /* v2 v3 */ + NFSERR_NOTDIR = 20, /* v2 v3 */ + NFSERR_ISDIR = 21, /* v2 v3 */ + NFSERR_INVAL = 22, /* v2 v3 that Sun forgot */ + NFSERR_FBIG = 27, /* v2 v3 */ + NFSERR_NOSPC = 28, /* v2 v3 */ + NFSERR_ROFS = 30, /* v2 v3 */ + NFSERR_MLINK = 31, /* v3 */ + NFSERR_OPNOTSUPP = 45, /* v2 v3 */ + NFSERR_NAMETOOLONG = 63, /* v2 v3 */ + NFSERR_NOTEMPTY = 66, /* v2 v3 */ + NFSERR_DQUOT = 69, /* v2 v3 */ + NFSERR_STALE = 70, /* v2 v3 */ + NFSERR_REMOTE = 71, /* v2 v3 */ + NFSERR_WFLUSH = 99, /* v2 */ + NFSERR_BADHANDLE = 10001, /* v3 */ + NFSERR_NOT_SYNC = 10002, /* v3 */ + NFSERR_BAD_COOKIE = 10003, /* v3 */ + NFSERR_NOTSUPP = 10004, /* v3 */ + NFSERR_TOOSMALL = 10005, /* v3 */ + NFSERR_SERVERFAULT = 10006, /* v3 */ + NFSERR_BADTYPE = 10007, /* v3 */ + NFSERR_JUKEBOX = 10008 /* v3 */ + }; + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs_ftype { NFNON = 0, @@ -93,7 +116,14 @@ #define NFS_MNT_PORT 627 #define NFS_MNTPROC_MNT 1 #define NFS_MNTPROC_UMNT 3 -#endif + +/* + * This is really a general kernel constant, but since nothing like + * this is defined in the kernel headers, I have to do it here. + */ +#define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1)) + +#endif /* __KERNEL__ */ #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) diff -u --recursive --new-file v2.3.30/linux/include/linux/nfs3.h linux/include/linux/nfs3.h --- v2.3.30/linux/include/linux/nfs3.h Mon Apr 7 11:35:31 1997 +++ linux/include/linux/nfs3.h Tue Dec 7 10:01:57 1999 @@ -12,7 +12,6 @@ #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 -#define NFS3_FHSIZE NFS_FHSIZE #define NFS3_COOKIESIZE 4 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 @@ -25,38 +24,28 @@ #define NFS3MODE_FIFO 0010000 -enum nfs3_stat { - NFS3_OK = 0, - NFS3ERR_PERM = 1, - NFS3ERR_NOENT = 2, - NFS3ERR_IO = 5, - NFS3ERR_NXIO = 6, - NFS3ERR_EAGAIN = 11, - NFS3ERR_ACCES = 13, - NFS3ERR_EXIST = 17, - NFS3ERR_XDEV = 18, /* new in NFSv3 */ - NFS3ERR_NODEV = 19, - NFS3ERR_NOTDIR = 20, - NFS3ERR_ISDIR = 21, - NFS3ERR_INVAL = 22, /* new in NFSv3 */ - NFS3ERR_FBIG = 27, - NFS3ERR_NOSPC = 28, - NFS3ERR_ROFS = 30, - NFS3ERR_MLINK = 31, /* new in NFSv3 */ - NFS3ERR_NAMETOOLONG = 63, - NFS3ERR_NOTEMPTY = 66, - NFS3ERR_DQUOT = 69, - NFS3ERR_STALE = 70, - NFS3ERR_REMOTE = 71, /* new in NFSv3 */ - NFS3ERR_BADHANDLE = 10001,/* ditto */ - NFS3ERR_NOT_SYNC = 10002,/* ditto */ - NFS3ERR_BAD_COOKIE = 10003,/* ditto */ - NFS3ERR_NOTSUPP = 10004,/* ditto */ - NFS3ERR_TOOSMALL = 10005,/* ditto */ - NFS3ERR_SERVERFAULT = 10006,/* ditto */ - NFS3ERR_BADTYPE = 10007,/* ditto */ - NFS3ERR_JUKEBOX = 10008,/* ditto */ -}; +/* Flags for access() call */ +#define NFS3_ACCESS_READ 0x0001 +#define NFS3_ACCESS_LOOKUP 0x0002 +#define NFS3_ACCESS_MODIFY 0x0004 +#define NFS3_ACCESS_EXTEND 0x0008 +#define NFS3_ACCESS_DELETE 0x0010 +#define NFS3_ACCESS_EXECUTE 0x0020 + +/* Flags for create mode */ +#define NFS3_CREATE_UNCHECKED 0 +#define NFS3_CREATE_GUARDED 1 +#define NFS3_CREATE_EXCLUSIVE 2 + +/* NFSv3 file system properties */ +#define NFS3_FSF_LINK 0x0001 +#define NFS3_FSF_SYMLINK 0x0002 +#define NFS3_FSF_HOMOGENEOUS 0x0008 +#define NFS3_FSF_CANSETTIME 0x0010 +/* Some shorthands. See fs/nfsd/nfs3proc.c */ +#define NFS3_FSF_DEFAULT 0x001B +#define NFS3_FSF_BILLYBOY 0x0018 +#define NFS3_FSF_READONLY 0x0008 enum nfs3_ftype { NF3NON = 0, @@ -92,10 +81,8 @@ #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) -struct nfs3_fh { - __u32 size; - __u8 data[NFS3_FHSIZE]; -}; +/* Number of 32bit words in post_op_attr */ +#define NFS3_POST_OP_ATTR_WORDS 22 struct nfs3_fattr { enum nfs3_ftype type; diff -u --recursive --new-file v2.3.30/linux/include/linux/nfsd/const.h linux/include/linux/nfsd/const.h --- v2.3.30/linux/include/linux/nfsd/const.h Wed Aug 18 16:44:09 1999 +++ linux/include/linux/nfsd/const.h Tue Dec 7 10:01:57 1999 @@ -1,19 +1,14 @@ /* - * include/linux/nfsd/nfsconst.h + * include/linux/nfsd/const.h * * Various constants related to NFS. * - * Copyright (C) 1995 Olaf Kirch + * Copyright (C) 1995-1997 Olaf Kirch */ -#ifndef __NFSCONST_H__ -#define __NFSCONST_H__ +#ifndef _LINUX_NFSD_CONST_H +#define _LINUX_NFSD_CONST_H -#include -#include -#include -#include -#include #include /* @@ -33,7 +28,7 @@ #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX -#define NFS3_FHSIZE NFS_FHSIZE +#define NFS3_FHSIZE 64 #define NFS3_COOKIEVERFSIZE 8 #define NFS3_CREATEVERFSIZE 8 #define NFS3_WRITEVERFSIZE 8 @@ -44,43 +39,6 @@ # define NFS_SUPER_MAGIC 0x6969 #endif -/* - * NFS stats. The good thing with these values is that NFSv3 errors are - * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which - * no-one uses anyway), so we can happily mix code as long as we make sure - * no NFSv3 errors are returned to NFSv2 clients. - */ -#define NFS_OK 0 /* v2 v3 */ -#define NFSERR_PERM 1 /* v2 v3 */ -#define NFSERR_NOENT 2 /* v2 v3 */ -#define NFSERR_IO 5 /* v2 v3 */ -#define NFSERR_NXIO 6 /* v2 v3 */ -#define NFSERR_ACCES 13 /* v2 v3 */ -#define NFSERR_EXIST 17 /* v2 v3 */ -#define NFSERR_XDEV 18 /* v3 */ -#define NFSERR_NODEV 19 /* v2 v3 */ -#define NFSERR_NOTDIR 20 /* v2 v3 */ -#define NFSERR_ISDIR 21 /* v2 v3 */ -#define NFSERR_INVAL 22 /* v3 */ -#define NFSERR_FBIG 27 /* v2 v3 */ -#define NFSERR_NOSPC 28 /* v2 v3 */ -#define NFSERR_ROFS 30 /* v2 v3 */ -#define NFSERR_MLINK 31 /* v3 */ -#define NFSERR_NAMETOOLONG 63 /* v2 v3 */ -#define NFSERR_NOTEMPTY 66 /* v2 v3 */ -#define NFSERR_DQUOT 69 /* v2 v3 */ -#define NFSERR_STALE 70 /* v2 v3 */ -#define NFSERR_REMOTE 71 /* v3 */ -#define NFSERR_WFLUSH 99 /* v2 */ -#define NFSERR_BADHANDLE 10001 /* v3 */ -#define NFSERR_NOT_SYNC 10002 /* v3 */ -#define NFSERR_BAD_COOKIE 10003 /* v3 */ -#define NFSERR_NOTSUPP 10004 /* v3 */ -#define NFSERR_TOOSMALL 10005 /* v3 */ -#define NFSERR_SERVERFAULT 10006 /* v3 */ -#define NFSERR_BADTYPE 10007 /* v3 */ -#define NFSERR_JUKEBOX 10008 /* v3 */ - #endif /* __KERNEL__ */ -#endif /* __NFSCONST_H__ */ +#endif /* _LINUX_NFSD_CONST_H */ diff -u --recursive --new-file v2.3.30/linux/include/linux/nfsd/export.h linux/include/linux/nfsd/export.h --- v2.3.30/linux/include/linux/nfsd/export.h Wed Oct 27 16:34:12 1999 +++ linux/include/linux/nfsd/export.h Tue Dec 7 12:59:42 1999 @@ -4,16 +4,17 @@ * Public declarations for NFS exports. The definitions for the * syscall interface are in nfsctl.h * - * Copyright (C) 1995, 1996 Olaf Kirch + * Copyright (C) 1995-1997 Olaf Kirch */ #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H -#include -#include -#include -#include +#include +#ifdef __KERNEL__ +# include +# include +#endif /* * Important limits for the exports stuff. diff -u --recursive --new-file v2.3.30/linux/include/linux/nfsd/nfsd.h linux/include/linux/nfsd/nfsd.h --- v2.3.30/linux/include/linux/nfsd/nfsd.h Wed Aug 18 16:44:14 1999 +++ linux/include/linux/nfsd/nfsd.h Tue Dec 7 14:11:33 1999 @@ -24,7 +24,7 @@ /* * nfsd version */ -#define NFSD_VERSION "0.4" +#define NFSD_VERSION "0.5" #ifdef __KERNEL__ /* @@ -146,6 +146,7 @@ nfserr_rofs, nfserr_mlink, nfserr_nametoolong, + nfserr_notempty, nfserr_dquot, nfserr_stale, nfserr_remote, diff -u --recursive --new-file v2.3.30/linux/include/linux/nfsd/nfsfh.h linux/include/linux/nfsd/nfsfh.h --- v2.3.30/linux/include/linux/nfsd/nfsfh.h Wed Oct 27 16:34:12 1999 +++ linux/include/linux/nfsd/nfsfh.h Tue Dec 7 14:11:32 1999 @@ -11,12 +11,15 @@ * Copyright (C) 1995, 1996, 1997 Olaf Kirch */ -#ifndef NFSD_FH_H -#define NFSD_FH_H +#ifndef _LINUX_NFSD_FH_H +#define _LINUX_NFSD_FH_H -#include -#include -#include +#include +#ifdef __KERNEL__ +# include +# include +# include +#endif #include #include @@ -83,10 +86,6 @@ struct knfs_fh fh_handle; /* FH data */ struct dentry * fh_dentry; /* validated dentry */ struct svc_export * fh_export; /* export pointer */ - size_t fh_pre_size; /* size before operation */ - time_t fh_pre_mtime; /* mtime before oper */ - time_t fh_pre_ctime; /* ctime before oper */ - unsigned long fh_post_version;/* inode version after oper */ unsigned char fh_locked; /* inode locked by us */ unsigned char fh_dverified; /* dentry has been checked */ } svc_fh; @@ -138,10 +137,9 @@ struct dentry *dentry = fhp->fh_dentry; struct inode *inode; - /* dfprintk(FILEOP, "nfsd: fh_lock(%x/%ld) locked = %d\n", - SVCFH_DEV(fhp), SVCFH_INO(fhp), fhp->fh_locked); - */ + SVCFH_DEV(fhp), (long)SVCFH_INO(fhp), fhp->fh_locked); + if (!fhp->fh_dverified) { printk(KERN_ERR "fh_lock: fh not verified!\n"); return; @@ -154,8 +152,6 @@ inode = dentry->d_inode; down(&inode->i_sem); - if (!fhp->fh_pre_mtime) - fhp->fh_pre_mtime = inode->i_mtime; fhp->fh_locked = 1; } @@ -172,41 +168,11 @@ struct dentry *dentry = fhp->fh_dentry; struct inode *inode = dentry->d_inode; - if (!fhp->fh_post_version) - fhp->fh_post_version = inode->i_version; fhp->fh_locked = 0; up(&inode->i_sem); } } - -/* - * Release an inode - */ -#if 0 -#define fh_put(fhp) __fh_put(fhp, __FILE__, __LINE__) - -static inline void -__fh_put(struct svc_fh *fhp, char *file, int line) -{ - struct dentry *dentry; - - if (!fhp->fh_dverified) - return; - - dentry = fhp->fh_dentry; - if (!dentry->d_count) { - printk("nfsd: trying to free free dentry in %s:%d\n" - " file %s/%s\n", - file, line, - dentry->d_parent->d_name.name, dentry->d_name.name); - } else { - fh_unlock(fhp); - fhp->fh_dverified = 0; - dput(dentry); - } -} -#endif - #endif /* __KERNEL__ */ -#endif /* NFSD_FH_H */ + +#endif /* _LINUX_NFSD_FH_H */ diff -u --recursive --new-file v2.3.30/linux/include/linux/nfsd/syscall.h linux/include/linux/nfsd/syscall.h --- v2.3.30/linux/include/linux/nfsd/syscall.h Mon Dec 28 14:10:01 1998 +++ linux/include/linux/nfsd/syscall.h Tue Dec 7 14:11:35 1999 @@ -3,15 +3,18 @@ * * This file holds all declarations for the knfsd syscall interface. * - * Copyright (C) 1995 Olaf Kirch + * Copyright (C) 1995-1997 Olaf Kirch */ #ifndef NFSD_SYSCALL_H #define NFSD_SYSCALL_H -#include -#include -#include +#include +#ifdef __KERNEL__ +# include +# include +# include +#endif #include #include #include diff -u --recursive --new-file v2.3.30/linux/include/linux/nls.h linux/include/linux/nls.h --- v2.3.30/linux/include/linux/nls.h Thu Jan 7 09:25:02 1999 +++ linux/include/linux/nls.h Tue Dec 7 10:21:10 1999 @@ -7,7 +7,8 @@ char *charset; unsigned char **page_uni2charset; struct nls_unicode *charset2uni; - + unsigned char *charset2lower; + unsigned char *charset2upper; void (*inc_use_count) (void); void (*dec_use_count) (void); struct nls_table *next; diff -u --recursive --new-file v2.3.30/linux/include/linux/pci.h linux/include/linux/pci.h --- v2.3.30/linux/include/linux/pci.h Tue Dec 7 09:32:51 1999 +++ linux/include/linux/pci.h Tue Dec 7 15:37:17 1999 @@ -450,6 +450,7 @@ int pci_proc_attach_device(struct pci_dev *dev); int pci_proc_detach_device(struct pci_dev *dev); void pci_name_device(struct pci_dev *dev); +char *pci_class_name(u32 class); void pci_read_bridge_bases(struct pci_bus *child); struct resource *pci_find_parent_resource(struct pci_dev *dev, struct resource *res); diff -u --recursive --new-file v2.3.30/linux/include/linux/pci_ids.h linux/include/linux/pci_ids.h --- v2.3.30/linux/include/linux/pci_ids.h Tue Nov 23 22:42:21 1999 +++ linux/include/linux/pci_ids.h Tue Dec 7 15:37:17 1999 @@ -27,32 +27,37 @@ #define PCI_BASE_CLASS_DISPLAY 0x03 #define PCI_CLASS_DISPLAY_VGA 0x0300 #define PCI_CLASS_DISPLAY_XGA 0x0301 +#define PCI_CLASS_DISPLAY_3D 0x0302 #define PCI_CLASS_DISPLAY_OTHER 0x0380 #define PCI_BASE_CLASS_MULTIMEDIA 0x04 #define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 #define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 #define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 #define PCI_BASE_CLASS_MEMORY 0x05 -#define PCI_CLASS_MEMORY_RAM 0x0500 -#define PCI_CLASS_MEMORY_FLASH 0x0501 -#define PCI_CLASS_MEMORY_OTHER 0x0580 +#define PCI_CLASS_MEMORY_RAM 0x0500 +#define PCI_CLASS_MEMORY_FLASH 0x0501 +#define PCI_CLASS_MEMORY_OTHER 0x0580 #define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_HOST 0x0600 -#define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_CLASS_BRIDGE_EISA 0x0602 -#define PCI_CLASS_BRIDGE_MC 0x0603 -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 -#define PCI_CLASS_BRIDGE_NUBUS 0x0606 -#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 -#define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_CLASS_BRIDGE_HOST 0x0600 +#define PCI_CLASS_BRIDGE_ISA 0x0601 +#define PCI_CLASS_BRIDGE_EISA 0x0602 +#define PCI_CLASS_BRIDGE_MC 0x0603 +#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 +#define PCI_CLASS_BRIDGE_OTHER 0x0680 #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 +#define PCI_CLASS_COMMUNICATION_MODEM 0x0703 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 #define PCI_BASE_CLASS_SYSTEM 0x08 @@ -60,17 +65,20 @@ #define PCI_CLASS_SYSTEM_DMA 0x0801 #define PCI_CLASS_SYSTEM_TIMER 0x0802 #define PCI_CLASS_SYSTEM_RTC 0x0803 +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 #define PCI_CLASS_SYSTEM_OTHER 0x0880 #define PCI_BASE_CLASS_INPUT 0x09 #define PCI_CLASS_INPUT_KEYBOARD 0x0900 #define PCI_CLASS_INPUT_PEN 0x0901 #define PCI_CLASS_INPUT_MOUSE 0x0902 +#define PCI_CLASS_INPUT_SCANNER 0x0903 +#define PCI_CLASS_INPUT_GAMEPORT 0x0904 #define PCI_CLASS_INPUT_OTHER 0x0980 #define PCI_BASE_CLASS_DOCKING 0x0a #define PCI_CLASS_DOCKING_GENERIC 0x0a00 -#define PCI_CLASS_DOCKING_OTHER 0x0a01 +#define PCI_CLASS_DOCKING_OTHER 0x0a80 #define PCI_BASE_CLASS_PROCESSOR 0x0b #define PCI_CLASS_PROCESSOR_386 0x0b00 @@ -78,6 +86,7 @@ #define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 #define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 #define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 +#define PCI_CLASS_PROCESSOR_MIPS 0x0b30 #define PCI_CLASS_PROCESSOR_CO 0x0b40 #define PCI_BASE_CLASS_SERIAL 0x0c @@ -86,11 +95,25 @@ #define PCI_CLASS_SERIAL_SSA 0x0c02 #define PCI_CLASS_SERIAL_USB 0x0c03 #define PCI_CLASS_SERIAL_FIBER 0x0c04 +#define PCI_CLASS_SERIAL_SMBUS 0x0c05 #define PCI_BASE_CLASS_INTELLIGENT 0x0e #define PCI_CLASS_INTELLIGENT_I2O 0x0e00 -#define PCI_CLASS_HOT_SWAP_CONTROLLER 0xff00 +#define PCI_BASE_CLASS_SATELLITE 0x0f +#define PCI_CLASS_SATELLITE_TV 0x0f00 +#define PCI_CLASS_SATELLITE_AUDIO 0x0f01 +#define PCI_CLASS_SATELLITE_VOICE 0x0f03 +#define PCI_CLASS_SATELLITE_DATA 0x0f04 + +#define PCI_BASE_CLASS_CRYPT 0x10 +#define PCI_CLASS_CRYPT_NETWORK 0x1000 +#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 +#define PCI_CLASS_CRYPT_OTHER 0x1080 + +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 +#define PCI_CLASS_SP_DPIO 0x1100 +#define PCI_CLASS_SP_OTHER 0x1180 #define PCI_CLASS_OTHERS 0xff diff -u --recursive --new-file v2.3.30/linux/kernel/acct.c linux/kernel/acct.c --- v2.3.30/linux/kernel/acct.c Thu Aug 26 13:05:41 1999 +++ linux/kernel/acct.c Tue Dec 7 10:14:17 1999 @@ -150,12 +150,12 @@ { struct file *file = NULL, *old_acct = NULL; char *tmp; - int error = -EPERM; + int error; - lock_kernel(); if (!capable(CAP_SYS_PACCT)) - goto out; + return -EPERM; + lock_kernel(); if (name) { tmp = getname(name); error = PTR_ERR(tmp); @@ -257,8 +257,6 @@ * into the accounting file. This function should only be called from * do_exit(). */ -#define KSTK_EIP(stack) (((unsigned long *)(stack))[1019]) -#define KSTK_ESP(stack) (((unsigned long *)(stack))[1022]) /* * do_acct_process does all actual work. diff -u --recursive --new-file v2.3.30/linux/kernel/capability.c linux/kernel/capability.c --- v2.3.30/linux/kernel/capability.c Thu Aug 26 13:05:42 1999 +++ linux/kernel/capability.c Tue Dec 7 17:09:12 1999 @@ -9,7 +9,7 @@ #include /* Note: never hold tasklist_lock while spinning for this one */ -spinlock_t task_capability_lock; +spinlock_t task_capability_lock = SPIN_LOCK_UNLOCKED; /* * For sys_getproccap() and sys_setproccap(), any of the three diff -u --recursive --new-file v2.3.30/linux/mm/memory.c linux/mm/memory.c --- v2.3.30/linux/mm/memory.c Tue Dec 7 09:32:52 1999 +++ linux/mm/memory.c Tue Dec 7 11:19:39 1999 @@ -982,7 +982,6 @@ struct vm_area_struct * vma, unsigned long address, pte_t * page_table, swp_entry_t entry, int write_access) { - int dograb = 0; struct page *page = lookup_swap_cache(entry); pte_t pte; diff -u --recursive --new-file v2.3.30/linux/mm/mremap.c linux/mm/mremap.c --- v2.3.30/linux/mm/mremap.c Tue Nov 23 22:42:21 1999 +++ linux/mm/mremap.c Tue Dec 7 09:36:24 1999 @@ -124,15 +124,14 @@ } static inline unsigned long move_vma(struct vm_area_struct * vma, - unsigned long addr, unsigned long old_len, unsigned long new_len) + unsigned long addr, unsigned long old_len, unsigned long new_len, + unsigned long new_addr) { struct vm_area_struct * new_vma; new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (new_vma) { - unsigned long new_addr = get_unmapped_area(addr, new_len); - - if (new_addr && !move_page_tables(current->mm, new_addr, addr, old_len)) { + if (!move_page_tables(current->mm, new_addr, addr, old_len)) { *new_vma = *vma; new_vma->vm_start = new_addr; new_vma->vm_end = new_addr+new_len; @@ -163,20 +162,49 @@ /* * Expand (or shrink) an existing mapping, potentially moving it at the * same time (controlled by the MREMAP_MAYMOVE flag and available VM space) + * + * MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise + * This option implies MREMAP_MAYMOVE. */ asmlinkage unsigned long sys_mremap(unsigned long addr, unsigned long old_len, unsigned long new_len, - unsigned long flags) + unsigned long flags, unsigned long new_addr) { struct vm_area_struct *vma; unsigned long ret = -EINVAL; down(¤t->mm->mmap_sem); + if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE)) + goto out; + if (addr & ~PAGE_MASK) goto out; + old_len = PAGE_ALIGN(old_len); new_len = PAGE_ALIGN(new_len); + /* new_addr is only valid if MREMAP_FIXED is specified */ + if (flags & MREMAP_FIXED) { + if (new_addr & ~PAGE_MASK) + goto out; + if (!(flags & MREMAP_MAYMOVE)) + goto out; + + if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len) + goto out; + + /* Check if the location we're moving into overlaps the + * old location at all, and fail if it does. + */ + if ((new_addr <= addr) && (new_addr+new_len) > addr) + goto out; + + if ((addr <= new_addr) && (addr+old_len) > new_addr) + goto out; + + do_munmap(new_addr, new_len); + } + /* * Always allow a shrinking remap: that just unmaps * the unnecessary pages.. @@ -184,11 +212,12 @@ ret = addr; if (old_len >= new_len) { do_munmap(addr+new_len, old_len - new_len); - goto out; + if (!(flags & MREMAP_FIXED) || (new_addr == addr)) + goto out; } /* - * Ok, we need to grow.. + * Ok, we need to grow.. or relocate. */ ret = -EFAULT; vma = find_vma(current->mm, addr); @@ -214,8 +243,11 @@ !vm_enough_memory((new_len - old_len) >> PAGE_SHIFT)) goto out; - /* old_len exactly to the end of the area.. */ + /* old_len exactly to the end of the area.. + * And we're not relocating the area. + */ if (old_len == vma->vm_end - addr && + !((flags & MREMAP_FIXED) && (addr != new_addr)) && (old_len != new_len || !(flags & MREMAP_MAYMOVE))) { unsigned long max_addr = TASK_SIZE; if (vma->vm_next) @@ -241,10 +273,15 @@ * We weren't able to just expand or shrink the area, * we need to create a new one and move it.. */ - if (flags & MREMAP_MAYMOVE) - ret = move_vma(vma, addr, old_len, new_len); - else - ret = -ENOMEM; + ret = -ENOMEM; + if (flags & MREMAP_MAYMOVE) { + if (!(flags & MREMAP_FIXED)) { + new_addr = get_unmapped_area(addr, new_len); + if (!new_addr) + goto out; + } + ret = move_vma(vma, addr, old_len, new_len, new_addr); + } out: up(¤t->mm->mmap_sem); return ret; diff -u --recursive --new-file v2.3.30/linux/mm/numa.c linux/mm/numa.c --- v2.3.30/linux/mm/numa.c Tue Dec 7 09:32:52 1999 +++ linux/mm/numa.c Mon Dec 6 21:40:20 1999 @@ -7,7 +7,6 @@ #include #include #include -#include #include int numnodes = 1; /* Initialized for UMA platforms */ diff -u --recursive --new-file v2.3.30/linux/net/sunrpc/clnt.c linux/net/sunrpc/clnt.c --- v2.3.30/linux/net/sunrpc/clnt.c Mon Nov 1 13:56:27 1999 +++ linux/net/sunrpc/clnt.c Tue Dec 7 10:03:12 1999 @@ -76,6 +76,10 @@ dprintk("RPC: creating %s client for %s (xprt %p)\n", program->name, servname, xprt); +#ifdef RPC_DEBUG + rpc_register_sysctl(); +#endif + if (!xprt) goto out; if (vers >= program->nrvers || !(version = program->version[vers])) diff -u --recursive --new-file v2.3.30/linux/net/sunrpc/stats.c linux/net/sunrpc/stats.c --- v2.3.30/linux/net/sunrpc/stats.c Tue Dec 7 09:32:52 1999 +++ linux/net/sunrpc/stats.c Tue Dec 7 10:03:12 1999 @@ -126,6 +126,7 @@ static inline struct proc_dir_entry * do_register(const char *name, void *data, int issvc) { + rpc_proc_init(); dprintk("RPC: registering /proc/net/rpc/%s\n", name); return create_proc_read_entry(name, 0, proc_net_rpc, issvc? svc_proc_read : rpc_proc_read, diff -u --recursive --new-file v2.3.30/linux/net/sunrpc/sunrpc_syms.c linux/net/sunrpc/sunrpc_syms.c --- v2.3.30/linux/net/sunrpc/sunrpc_syms.c Wed Aug 19 16:16:04 1998 +++ linux/net/sunrpc/sunrpc_syms.c Tue Dec 7 10:03:12 1999 @@ -76,9 +76,7 @@ /* RPC statistics */ #ifdef CONFIG_PROC_FS -EXPORT_SYMBOL(rpc_proc_init); EXPORT_SYMBOL(rpc_proc_register); -EXPORT_SYMBOL(rpc_register_sysctl); EXPORT_SYMBOL(rpc_proc_unregister); EXPORT_SYMBOL(rpc_proc_read); EXPORT_SYMBOL(svc_proc_register); diff -u --recursive --new-file v2.3.30/linux/net/sunrpc/svc.c linux/net/sunrpc/svc.c --- v2.3.30/linux/net/sunrpc/svc.c Tue May 11 17:29:46 1999 +++ linux/net/sunrpc/svc.c Tue Dec 7 10:03:12 1999 @@ -32,6 +32,9 @@ struct svc_serv *serv; xdr_init(); +#ifdef RPC_DEBUG + rpc_register_sysctl(); +#endif if (!(serv = (struct svc_serv *) kmalloc(sizeof(*serv), GFP_KERNEL))) return NULL;