diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/CREDITS linux.ac/CREDITS --- linux.vanilla/CREDITS Sat Sep 11 00:54:01 1999 +++ linux.ac/CREDITS Sun Sep 19 17:38:38 1999 @@ -482,11 +482,11 @@ S: USA N: Alex deVries -E: puffin@redhat.com -D: Various SGI parts, bits of HAL2 and Newport -S: 18 Bernier Terrace -S: Kanata, Ontario -S: K2L 2V@ +E: adevries@thepuffingroup.com +D: Various SGI parts, bits of HAL2 and Newport, PA-RISC Linux. +S: 41.5 William Street +S: Ottawa, Ontario +S: K1N 6Z9 S: CANADA N: Eddie C. Dost @@ -858,6 +858,14 @@ S: 14059 Berlin S: Germany +N: David Hinds +E: dhinds@zen.stanford.edu +W: http://hyper.stanford.edu/~dhinds +D: PCMCIA and CardBus stuff, PCMCIA-HOWTO, PCMCIA client drivers +S: 2019 W. Middlefield Rd #1 +S: Mountain View, CA 94043 +S: USA + N: Michael Hipp E: hippm@informatik.uni-tuebingen.de D: drivers for the racal ni5210 & ni6510 Ethernet-boards @@ -1399,11 +1407,13 @@ E: acme@conectiva.com.br W: http://www.conectiva.com.br/~acme D: wanrouter hacking +D: USB hacking +D: miscellaneous Makefile & Config.in fixes D: Cyclom 2X synchronous card driver D: i18n for minicom, net-tools, util-linux, fetchmail, etc -S: Conectiva Informatica LTDA +S: Conectiva Informática LTDA S: R. Prof. Rubens Elke Braga, 558 - Parolin -S: 80220-320 Curitiba - Parana +S: 80220-320 Curitiba - Paraná S: Brazil N: Michael Meskes @@ -1628,6 +1638,13 @@ S: Tula 300000 S: Russia +N: Johnnie Peters +E: jpeters@phx.mcd.mot.com +D: Motorola PowerPC changes for PReP +S: 2900 S. Diable Way +S: Tempe, Arizona 85282 +S: USA + N: Kirk Petersen E: kirk@speakeasy.org W: http://www.speakeasy.org/~kirk/ @@ -1954,7 +1971,7 @@ S: Canada M2N 2Z1 N: Adrian Sun -E: asun@u.washington.edu +E: asun@cobaltnet.com D: hfs support D: alpha rtc port, random appletalk fixes S: Department of Zoology, University of Washington @@ -1997,9 +2014,9 @@ D: Miscellaneous kernel hacker D: Cyclom 2X driver hacker D: linuxconf apache & proftpd module maintainer -S: Conectiva Informatica LTDA +S: Conectiva Informática LTDA S: R. Prof. Rubens Elke Braga, 558 - Parolin -S: 80220-320 Curitiba - Parana +S: 80220-320 Curitiba - Paraná S: Brazil N: Stefan Traby @@ -2193,8 +2210,14 @@ N: David Weinehall E: tao@acc.umu.se -D: NE/2-driver maintainer +W: http://www.acc.umu.se/~tao/ +W: http://www.acc.umu.se/~mcalinux/ +D: Fixes for the NE/2-driver D: Miscellaneous MCA-support +D: Cleanup of the Config-files +S: Axtorpsvagen 40:20 +S: S-903 37 UMEA +S: Sweden N: Matt Welsh E: mdw@metalab.unc.edu diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/Documentation/CodingStyle linux.ac/Documentation/CodingStyle --- linux.vanilla/Documentation/CodingStyle Wed Jun 24 22:30:07 1998 +++ linux.ac/Documentation/CodingStyle Tue Sep 14 20:48:06 1999 @@ -210,3 +210,26 @@ "indent" has a lot of options, and especially when it comes to comment re-formatting you may want to take a look at the manual page. But remember: "indent" is not a fix for bad programming. + + + Chapter 7: Configuration-files + +For configuration options (arch/xxx/config.in, and all the Config.in files), +somewhat different indentation is used. + +An indention level of 3 is used in the code, while the text in the config- +options should have an indention-level of 2 to indicate dependencies. The +latter only applies to bool/tristate options. For other options, just use +common sense. An example: + +if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate 'Apply nitroglycerine inside the keyboard (DANGEROUS)' CONFIG_BOOM + if [ "$CONFIG_BOOM" != "n" ]; then + bool ' Output nice messages when you explode' CONFIG_CHEER + fi +fi + +Generally, CONFIG_EXPERIMENTAL should surround all options not considered +stable. All options that are known to trash data (experimental write- +support for file-systems, for instance) should be denoted (DANGEROUS), other +Experimental options should be denoted (EXPERIMENTAL). diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/Documentation/Configure.help linux.ac/Documentation/Configure.help --- linux.vanilla/Documentation/Configure.help Sat Sep 11 00:54:01 1999 +++ linux.ac/Documentation/Configure.help Sun Sep 19 17:28:24 1999 @@ -74,9 +74,13 @@ MAINTAINERS, REPORTING_BUGS, Documentation/BUG-HUNTING, and Documentation/oops-tracing.txt in the kernel source). + This option will also make obsoleted drivers available. These are + drivers that have been replaced by something else, and/or are + scheduled to be removed in a future kernel release. + Unless you intend to help test and develop a feature or driver that falls into this category, or you have a situation that requires - using these features you should probably say N here, which will + using these features, you should probably say N here, which will cause this configure script to present you with fewer choices. If you say Y here, you will be offered the choice of using features or drivers that are currently considered to be in the alpha-test phase. @@ -162,7 +166,7 @@ time indication of CPU usage, by lighting whenever the idle task is not currently executing. -Kernel FP software completion +Kernel FP software completion (EXPERIMENTAL) CONFIG_MATHEMU This option is required for IEEE compliant floating point arithmetic on the Alpha. The only time you would ever not say Y is to say M in @@ -1306,7 +1310,7 @@ http://lena.fnet.fr/ (To browse the WWW, you need to have access to a machine on the Internet that has a program like lynx or netscape). -Support for Algorithmics P4032 +Support for Algorithmics P4032 (EXPERIMENTAL) CONFIG_ALGOR_P4032 This is an evaluation board of the British company Algorithmics. The board uses the R4300 and a R5230 CPUs. For more information about @@ -1600,7 +1604,7 @@ If you want to use your SGI's built-in serial ports under Linux, answer Y. -SGI Newport Graphics support +SGI Newport Graphics support (EXPERIMENTAL) CONFIG_SGI_NEWPORT_GFX If you have an SGI machine and you want to compile the graphics drivers, say Y here. This will include the code for the @@ -1828,7 +1832,7 @@ you have use for it; the module is called binfmt_misc.o. If you don't know what to answer at this point, say Y. -Solaris binary emulation +Solaris binary emulation (EXPERIMENTAL) CONFIG_SOLARIS_EMUL This is experimental code which will enable you to run (many) Solaris binaries on your SPARC Linux machine. @@ -1989,7 +1993,7 @@ This enables support for Cirrus Logic GD542x/543x based boards on Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum. If you have a PCI-based system, this enables support for these chips: - GD-543x, GD-544x, GD-5480. + GD-543x, GD-544x, GD-546x (Laguna), or GD-5480. Say N unless you have such a graphics board or plan to get one before you next recompile the kernel. @@ -2020,7 +2024,7 @@ If you have a S3 Trio say Y. Say N for S3 Virge. ATI Mach64 display support -CONFIG_FB_ATY +CONFIG_FB_ATY (EXPERIMENTAL) This driver supports graphics boards with the ATI Mach64 chips. PowerMac "control" frame buffer device support @@ -2077,7 +2081,7 @@ includes a server that supports the frame buffer device directly (XF68_FBDev). -Matrox unified accelerated driver +Matrox unified accelerated driver (EXPERIMENTAL) CONFIG_FB_MATROX Say Y here if you have Matrox Millennium, Matrox Millennium II, Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox @@ -2819,7 +2823,7 @@ Say Y unless you know what you are doing. -The IPv6 protocol +The IPv6 protocol (EXPERIMENTAL) CONFIG_IPV6 This is experimental support for the next version of the Internet Protocol: IP version 6 (also called IPng "IP next generation"). @@ -2946,7 +2950,7 @@ The module will be called af_spx.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. -DECnet networking +DECnet networking (EXPERIMENTAL) CONFIG_DECNET The DECnet networking protocol was used in many products made by Digital (now Compaq). It provides reliable stream and sequenced @@ -2971,7 +2975,7 @@ use this system call and the proper way to get the information provided by this call is to use rtnetlink. -DECnet Router Support +DECnet Router Support (EXPERIMENTAL) CONFIG_DECNET_ROUTER Add support for turning your DECnet Endnode into a level 1 or 2 router. This is an unfinished option for developers only. If you @@ -3460,7 +3464,7 @@ can only use one protocol at a time, depending on what the other end can understand). -CCITT X.25 Packet Layer +CCITT X.25 Packet Layer (EXPERIMENTAL) CONFIG_X25 X.25 is a set of standardized network protocols, similar in scope to frame relay; the one physical line from your box to the X.25 network @@ -3512,7 +3516,7 @@ want), say M here and read Documentation/modules.txt. The module will be called lapb.o. If unsure, say N. -802.2 LLC (VERY EXPERIMENTAL) +802.2 LLC (EXPERIMENTAL) CONFIG_LLC This is a Logical Link Layer protocol used for X.25 connections over Ethernet, using ordinary Ethernet cards. @@ -3843,14 +3847,15 @@ about anything having "SCSI" in its name other than hard disks, CDROMs or tapes, say Y here. These won't be supported by the kernel directly, so you need some additional software which knows how to - talk to these devices using the SCSI protocol. For CD-writers, you - would need the program cdwrite, available via FTP (user: anonymous) - from ftp://metalab.unc.edu/pub/Linux/utils/disk-management; for - other devices, it's possible that you'll have to write the driver - software yourself, so have a look at the SCSI-HOWTO and at the - SCSI-Programming-HOWTO, both available via FTP (user: anonymous) in - ftp://metalab.unc.edu/pub/Linux/docs/HOWTO. Please read the file - Documentation/scsi-generic.txt for more information. + talk to these devices using the SCSI protocol. For scanners, look at + SANE (www.mostang.com/sane). For CD writer software look at cdrecord + (www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private + /cdrecord.html) and for burning a "disk at once": cdrdao + (www.ping.de/sites/daneb/cdrdao.html). Cdparanoia is a high quality + digital reader of audio CDs (www.xiph.org/paranoia). + For other devices, it's possible that you'll have to write the driver + software yourself. Please read the file Documentation/scsi-generic.txt + for more information. If you want to compile this as a module ( = code which can be inserted in and removed from the running kernel whenever you want), @@ -4066,6 +4071,15 @@ does not work correctly without modification please contact the author by email at ipslinux@us.ibm.com. +IBM ServeRAID Support +CONFIG_SCSI_IPS + This is support for the IBM ServeRAID hardware RAID controllers. + Consult the SCSI-HOWTO, available via anonymous FTP from + ftp://metalab.unc.edu/pub/Linux/docs/HOWTO, and the file + README.ips in drivers/scsi for more information. If this driver + does not work correctly without modification please contact the + author by email at ipslinux@us.ibm.com. + BusLogic SCSI support CONFIG_SCSI_BUSLOGIC This is support for BusLogic MultiMaster and FlashPoint SCSI Host @@ -4277,7 +4291,13 @@ MB/s with wide FAST-40 LVD devices and controllers. Recent versions of the 53C8XX chips are better supported by the - option "SYM53C8XX SCSI support", below. + option "SYM53C8XX SCSI support", below. This option will configure + a different driver. + + If you want the kernel to select the recommended driver for each of + of your NCR/SYM53C8XX controllers you may just configure both the + NCR53C8XX and the SYM53C8XX options to Y, or if modules are preferred, + load first the sym53c8xx.o module and then the ncr53c8xx.o module. Note: there is yet another driver for the 53c8xx family of controllers ("NCR53c7,8xx SCSI support" above). If you want to use them both, @@ -4396,7 +4416,7 @@ There is no safe option and the default answer is recommended. -assume boards are SYMBIOS compatible +assume boards are SYMBIOS compatible (EXPERIMENTAL) CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT This option allows you to enable some features depending on GPIO wiring. These General Purpose Input/Output pins can be used for @@ -4933,7 +4953,7 @@ Generally, saying N is fine. -SCSI Debug host simulator. +SCSI Debugging host simulator (EXPERIMENTAL) CONFIG_SCSI_DEBUG This is a host adapter simulator that can be programmed to simulate a large number of conditions that could occur on a real bus. The @@ -4995,7 +5015,7 @@ This enables support for the Cumana SCSI I card. If you have an Acorn system with one of these, say Y. If unsure, say N. -Cumana SCSI II support +Cumana SCSI II support (EXPERIMENTAL) CONFIG_SCSI_CUMANA_2 This enables support for the Cumana SCSI II card. If you have an Acorn system with one of these, say Y. If unsure, say N. @@ -5006,12 +5026,12 @@ in the Econet socket. If you have an Acorn system with one of these, say Y. If unsure, say N. -EESOX SCSI support +EESOX SCSI support (EXPERIMENTAL) CONFIG_SCSI_EESOXSCSI This enables support for the EESOX SCSI card. If you have an Acorn system with one of these, say Y, otherwise say N. -Powertec SCSI support +Powertec SCSI support (EXPERIMENTAL) CONFIG_SCSI_POWERTECSCSI This enables support for the Powertec SCSI card on Acorn systems. If you have one of these, say Y. If unsure, say N. @@ -5305,6 +5325,23 @@ The kernels on both machines need to have this PLIP option enabled for this to work. + The plipconfig utility, can be used to change several parameters + of the plip driver once it has been opened. It is part of the net-tools + package, whose location and current version number is contained in + the file Documentation/Changes. + + This drivers performs better if the parallel port used has an IRQ + associated with it, but can also work in poll mode with no IRQ. + If IRQ-less mode is used, it is required to change the trigger timeout + on the *other* side of the connection to about 10000usec (on a i386), + though values as small as 5000usec are known to work. If both sides are + used in IRQ-less mode, both sides need to use said trigger timeout. + In order to perform this change on a Linux, the command + 'plipconfig plipX trigger 10000' can be used, where plipX is the + appropriate PLIP device. + For a discussion on the trigger timeout, see + Documentation/networking/PLIP.txt. + The PLIP driver has two modes, mode 0 and mode 1. The parallel ports (the connectors at the computers with 25 holes) are connected with "null printer" or "Turbo Laplink" cables which can transmit 4 bits @@ -5353,7 +5390,7 @@ module, say M here and read Documentation/modules.txt. If unsure, say N. -Ethertap network tap +Ethertap network tap (EXPERIMENTAL) CONFIG_ETHERTAP If you say Y here (and have said Y to "Kernel/User network link driver", above) and create a character special file /dev/tap0 with @@ -5521,7 +5558,7 @@ full bandwidth of your network connection, try saying Y here. If unsure, say N. -QoS and/or fair queueing +QoS and/or fair queueing (EXPERIMENTAL) CONFIG_NET_SCHED When the kernel has several packets to send out over the network devices, it has to make a decision which one to send first. This is @@ -5726,6 +5763,18 @@ whenever you want). If you want to compile it as a module, say M here and read Documentation/modules.txt. +SBNI Leased Line Adapters +CONFIG_SBNI + This is a driver for ISA SBNI12-xx cards that is a low cost + alternative to leased line modems. Say Y if you want to insert + driver into kernel or say M to compile driver as a module. + + You can find more information and last versions of drivers and + utilities at http://www.granch.ru. If you have any question you + can mail to sbni@granch.ru. + + Say N if unsure. + WAN Drivers CONFIG_WAN_DRIVERS Say Y to this option if your Linux box contains a WAN card and you @@ -5790,7 +5839,7 @@ you say N, the PPP support will not be included in the driver (saves about 16 KB of kernel memory). -Cyclom 2X(tm) multiprotocol cards +Cyclom 2X(tm) multiprotocol cards (EXPERIMENTAL) CONFIG_CYCLADES_SYNC Cyclom 2X from Cyclades Corporation (http://www.cyclades.com and http://www.cyclades.com.br; to browse the WWW, you need to have @@ -5962,6 +6011,18 @@ module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. +PCI DM9102 support +CONFIG_DM9102 + This driver is for DM9102 compatible PCI cards from Davicom + (http://www.davicom.com.tw) + If you have a PCI DM9102 network (Ethernet) card, say Y. + + 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 dmfe.o. If you want to compile it as a + module, say M here and read Documentation/modules.txt as well as + Documentation/networking/net-modules.txt. + Racal-Interlan (Micom) NI cards CONFIG_NET_VENDOR_RACAL If you have a network (Ethernet) card belonging to this class, such @@ -5974,7 +6035,7 @@ the questions about NI cards. If you say Y, you will be asked for your specific card in the following questions. -NI5010 support +NI5010 support (EXPERIMENTAL) CONFIG_NI5010 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6011,7 +6072,7 @@ module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. -RealTek 8129/8139 (not 8019/8029!) support +RealTek 8129/8139 (not 8019/8029!) support (EXPERIMENTAL) CONFIG_RTL8139 This is a driver for the Fast Ethernet PCI network cards based on the RTL8129 and RTL8139 chips. If you have one of those, say Y and @@ -6023,7 +6084,7 @@ say M here and read Documentation/modules.txt. This is recommended. The module will be called rtl8139.o. -Packet Engines Yellowfin Gigabit-NIC support +Packet Engines Yellowfin Gigabit-NIC support (EXPERIMENTAL) CONFIG_YELLOWFIN Say Y here if you have a Packet Engines G-NIC PCI Gigabit Ethernet adapter. This adapter is used by the Beowulf Linux cluster project. @@ -6056,7 +6117,7 @@ If you don't have this card, of course say N. -Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support +Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support (EXPERIMENTAL) CONFIG_ACENIC Say Y here if you have an Alteon AceNIC, 3Com 3C985(B), NetGear GA620, SGI Gigabit or Farallon PN9000-SX PCI Gigabit Ethernet @@ -6144,7 +6205,7 @@ Documentation/networking/net-modules.txt. The module will be called 3c505.o. -3c507 support +3c507 support (EXPERIMENTAL) CONFIG_EL16 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6374,7 +6435,7 @@ Documentation/networking/net-modules.txt. The module will be called ewrk3.o. -SEEQ8005 support +SEEQ8005 support (EXPERIMENTAL) CONFIG_SEEQ8005 This is a driver for the SEEQ 8005 network (Ethernet) card. If this is for you, read the Ethernet-HOWTO, available via FTP (user: @@ -6560,7 +6621,7 @@ module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. -Mylex EISA LNE390A/LNE390B support +Mylex EISA LNE390A/LNE390B support (EXPERIMENTAL) CONFIG_LNE390 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6572,7 +6633,7 @@ module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. -Novell/Eagle/Microdyne NE3210 EISA support +Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL) CONFIG_NE3210 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6658,7 +6719,7 @@ module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. -ICL EtherTeam 16i/32 support +ICL EtherTeam 16i/32 support (EXPERIMENTAL) CONFIG_ETH16I If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6700,7 +6761,7 @@ a module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. -Racal-Interlan EISA ES3210 support +Racal-Interlan EISA ES3210 support (EXPERIMENTAL) CONFIG_ES3210 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available via FTP (user: anonymous) in @@ -6730,7 +6791,7 @@ Say Y here if you have an Seeq based Ethernet network card. This is used in many Silicon Graphics machines. -Zenith Z-Note support +Zenith Z-Note support (EXPERIMENTAL) CONFIG_ZNET The Zenith Z-Note notebook computer has a built-in network (Ethernet) card, and this is the Linux driver for it. Note that the @@ -7225,13 +7286,6 @@ ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/mini. Probably the quota support is only useful for multi user systems. If unsure, say N. -Acorn's ADFS filesystem support (read only) (EXPERIMENTAL) -CONFIG_ADFS_FS - The Advanced Disk File System is the filesystem used on floppy and - hard disks by Acorn Systems. Currently in development, as a read- - only driver for hard disks. These should be the first partition - (eg. /dev/[sh]d?1) on each of your drives. If unsure, say N. - Minix fs support CONFIG_MINIX_FS Minix is a simple operating system used in many classes about OS's. @@ -7324,7 +7378,7 @@ like lynx or netscape). Say Y here if you want to be able to read Joliet CDROMs under Linux. -UDF Filesystem support +UDF Filesystem support (read only) CONFIG_UDF_FS This is the new filesystem used by some CDROMS and DVD drivers. Say Y if you intend to mount DVD discs or CDRWs written in packet mode, @@ -7524,7 +7578,7 @@ Most people say N here. -NFS server support +NFS server support (EXPERIMENTAL) CONFIG_NFSD If you want your Linux box to act as a NFS *server*, so that other computers on your local network which support NFS can access certain @@ -7552,7 +7606,7 @@ directories that are mount points on the local filesystem (this is how nfsd behaves on Sun systems), say yes here. If unsure, say N. -OS/2 HPFS filesystem support (read/write) +OS/2 HPFS filesystem support CONFIG_HPFS_FS OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS is the filesystem used for organizing files on OS/2 hard disk @@ -7589,7 +7643,7 @@ The module will be called ntfs.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. -NTFS read-write support (experimental) +NTFS write support (DANGEROUS) CONFIG_NTFS_RW If you say Y here, you will (hopefully) be able to write to NTFS file systems as well as read from them. The read-write support @@ -7656,7 +7710,7 @@ The module is called affs.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. If unsure, say N. -Apple Macintosh filesystem support (experimental) +Apple Macintosh filesystem support (EXPERIMENTAL) CONFIG_HFS_FS If you say Y here, you will be able to mount Macintosh-formatted floppy disks and hard drive partitions with full read-write access. @@ -7683,7 +7737,7 @@ If you don't know whether you need it, then you don't need it: answer N. -QNX filesystem support (EXPERIMENTAL) +QNX filesystem support (read only) (EXPERIMENTAL) CONFIG_QNX4FS_FS This is the filesystem used by the operating system QNX 4. Say Y if you intend to mount QNX hard disks or floppies. Unless you say Y to @@ -7697,7 +7751,7 @@ If unsure, say N. -QNXFS read-write support (FOR TESTING ONLY) +QNXFS write support (DANGEROUS) CONFIG_QNX4FS_RW Say Y if you want to test write support for QNX filesystems. @@ -7720,7 +7774,7 @@ If you are not a part of a fairly large, distributed network, you probably do not need an automounter, and can say N here. -UFS filesystem support +UFS filesystem support (read only) CONFIG_UFS_FS BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, OpenBSD and NeXTstep) use a filesystem called UFS. Some System V @@ -7750,12 +7804,12 @@ If you haven't heard about all of this before, it's safe to say N. -UFS filesystem write support (experimental) +UFS filesystem write support (DANGEROUS) CONFIG_UFS_FS_WRITE Say Y here if you want to try writing to UFS partitions. This is experimental, so you should back up your UFS partitions beforehand. -EFS filesystem support (experimental) +EFS filesystem support (read only) (EXPERIMENTAL) CONFIG_EFS_FS EFS is the filesystem used for CDROMs and filesystems by SGI's IRIX. This implementation only offers read-only access. If you don't know @@ -7767,18 +7821,6 @@ Say Y to this only if you plan on mounting disks with SGI disklabels. This is not required to mount EFS-format CDROMs. -EFS filesystem support (experimental) -CONFIG_EFS_FS - EFS is the filesystem used for CDROMs and filesystems by SGI's IRIX. - This implementation only offers read-only access. If you don't know - what all this is about, it's safe to say N. For more information - about EFS see it's homepage at http://aeschi.ch.eu.org/efs. - -SGI disklabel support -CONFIG_SGI_DISKLABEL - Say Y to this only if you plan on mounting disks with SGI disklabels. - This is not required to mount EFS-format CDROMs. - BSD disklabel (FreeBSD partition tables) support CONFIG_BSD_DISKLABEL FreeBSD uses its own hard disk partition scheme on your PC. It @@ -8614,7 +8656,7 @@ and read Documentation/modules.txt. The module will be called esp.o. If unsure, say N. -Multi-Tech multiport card support +Multi-Tech multiport card support (EXPERIMENTAL) CONFIG_ISI This is a driver for the Multi-Tech cards which provide several serial ports. The driver is experimental and can currently only be @@ -8926,7 +8968,7 @@ backup programs assume for SCSI tape drives) or `1' (no restriction on block size, but disables builtin compression). -Number of DMA buffers +Number of DMA buffers (EXPERIMENTAL) CONFIG_FT_NR_BUFFERS Please leave this at `3' unless you REALLY know what you are doing. It is not necessary to change this value. Values below 3 make the @@ -9096,7 +9138,7 @@ short description of the parameters that can be set at boot or load time. -FDC FIFO Threshold before requesting DMA service +FDC FIFO Threshold before requesting DMA service (EXPERIMENTAL) CONFIG_FT_FDC_THR Set the FIFO threshold of the FDC. If this is higher the DMA controller may serve the FDC after a higher latency time. If this is @@ -9107,7 +9149,7 @@ If unsure, don't touch the initial value, i.e. leave it at "8". -FDC maximum data rate +FDC maximum data rate (EXPERIMENTAL) CONFIG_FT_FDC_MAX_RATE With some motherboard/FDC combinations ftape will not be able to run your FDC/tape drive combination at the highest available @@ -9140,6 +9182,9 @@ The AMD K6-2 (stepping 8 and above) and K6-3 processors have two MTRRs. These are supported. + + The AMD Athlon (K7) uses exactly the same MTRR architecture as + the Intel P6 family and this processor is supported by this driver. The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These are supported. @@ -9365,11 +9410,12 @@ your computer. For details, read Documentation/watchdog.txt in the kernel source. - The watchdog is usually used together with the watchdog daemon - which is available via FTP (user: anonymous) from - ftp://tsx-11.mit.edu/pub/linux/sources/sbin/. This daemon can also - monitor NFS connections and can reboot the machine when the process - table is full. + The watchdog is usually used together with the watchdog daemon which is + available via FTP (user: anonymous) from + ftp://metalab.unc.edu/pub/linux/system/daemons/watchdog. This daemon can + check a larger part of the system. For instance it can monitor NFS + connections and reboot the machine when the process table is full or the + workload exceeds a predefined value. If unsure, say N. @@ -9744,20 +9790,6 @@ You can say M here to compile this driver as a module; the module is called sb.o. -Generic OPL2/OPL3 FM synthesizer support -CONFIG_SOUND_ADLIB - Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). - Answering Y is usually a safe and recommended choice, however some - cards may have software (TSR) FM emulation. Enabling FM support with - these cards may cause trouble (I don't currently know of any such - cards, however). - - Please read the file Documentation/sound/OPL3 if your card has an - OPL3 chip. - - If unsure, say Y. - - #Loopback MIDI device support #CONFIG_SOUND_VMIDI ### @@ -9896,6 +9928,11 @@ See also Documentation/sound/Opti and Documentation/sound/MAD16 for more information on setting these cards up as modules. +VIA 82Cxxx audio support +CONFIG_SOUND_VIA82CXXX + Answer Y if you have a VIA82C686 chip, typically found built + onto a motherboard. + Full support for Turtle Beach WaveFront synth/sound cards CONFIG_SOUND_WAVEFRONT Answer Y or M if you have a Tropez Plus, Tropez or Maui sound card @@ -10027,7 +10064,15 @@ FM synthesizer (YM3812/OPL-3) support CONFIG_SOUND_YM3812 - Answer Y here, unless you know you will not need the option. + Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). + Answering Y is usually a safe and recommended choice, however some + cards may have software (TSR) FM emulation. Enabling FM support with + these cards may cause trouble (I don't currently know of any such + cards, however). + Please read the file Documentation/sound/OPL3 if your card has an + OPL3 chip. + + If unsure, say Y. Sun Audio support CONFIG_SUN_AUDIO @@ -10224,6 +10269,23 @@ Say Y here to include support for the Rockwell WaveArtist sound system. This driver is mainly for the NetWinder. +VIA 82Cxxx Audio Codec +CONFIG_SOUND_VIA82CXXX + Say Y here to include support for the audio codec found on + VIA 82Cxxx-based chips. Typically these are built into a motherboard. + DO NOT select SoundBlaster or Adlib with this driver, unless you have + a SoundBlaster or Adlib card in addition to your VIA audio chip. + +NeoMagic 256AV/256ZX sound chipsets +CONFIG_SOUND_NM256 + Say M here to include audio support for the NeoMagic 256AV/256ZX + chipsets. These are the audio chipsets found in the Sony Z505S/SX/DX, + some Sony F-series, and the Dell Latitude CPi and CPt laptops. It includes + support for an AC97-compatible mixer and an apparently proprietary sound + engine. + + See Documentation/sound/NM256 for further information. + Are you using a crosscompiler CONFIG_CROSSCOMPILE Say Y here if you are compiling the kernel on a different @@ -10635,7 +10697,7 @@ This is the driver for the Sun ESP SCSI host adapter. The ESP chipset is present in most SPARC-based computers. -SPARC /dev/openprom compatibility driver +SPARC /dev/openprom compatibility driver (EXPERIMENTAL) CONFIG_SUN_OPENPROMIO This driver provides user programs with an interface to the SPARC PROM device tree. The driver implements a SunOS-compatible @@ -10734,7 +10796,7 @@ If you anticipate running this kernel on a computer with a MC68060 processor, say Y. Otherwise, say N. -Math emulation support +Math emulation support (EXPERIMENTAL) CONFIG_M68KFPU_EMU At some point in the future, this will cause floating-point math instructions to be emulated by the kernel on machines that lack a @@ -10793,6 +10855,7 @@ Note that even if you say N here, you can still use your expansion cards. If in doubt, say Y. +Amiga 1200/600 PCMCIA support (EXPERIMENTAL) CONFIG_AMIGA_PCMCIA Include support in the kernel for pcmcia on Amiga 1200 and Amiga 600. If you intend to use pcmcia cards say Y; otherwise say N. @@ -10924,7 +10987,7 @@ 1260 accelerator, and the optional SCSI module, say Y. Otherwise, say N. -Blizzard PowerUP 603e+ SCSI support +Blizzard PowerUP 603e+ SCSI support (EXPERIMENTAL) CONFIG_BLZ603EPLUS_SCSI If you have an Amiga 1200 with a Phase5 Blizzard PowerUP 603e+ accelerator, say Y. Otherwise, say N. @@ -11108,7 +11171,7 @@ want). If you want to compile it as a module, say M here and read Documentation/modules.txt. -Atari DSP56k Digital Signal Processor support +Atari DSP56k Digital Signal Processor support (EXPERIMENTAL) CONFIG_ATARI_DSP56K If you want to be able to use the DSP56001 in Falcons, say Y. This driver is still experimental, and if you don't know what it is, or @@ -11502,6 +11565,25 @@ Enter either 0x20c, 0x30c, 0x24c or 0x34c here. The card default is 0x34c, if you haven't changed the jumper setting on the card. +Trust FM Radio Card +CONFIG_RADIO_TRUST + Choose Y here if you have this FM radio card, and then fill in the + port address below. + + In order to control your radio card, you will need to use programs + that are compatible with the Video for Linux API. Information on + this API and pointers to "v4l" programs may be found at + http://roadrunner.swansea.uk.linux.org/v4l.shtml. + + If you want to compile this driver as a module ( = code which can be + inserted in and removed from the running kernel whenever you want), + say M here and read Documentation/modules.txt. The module will be + called radio-trust.o. + +Trust FM Radio I/O port +CONFIG_RADIO_TRUST_PORT + Enter the I/O port of your card (usually 0x350 or 0x358). + PlanB Video-In for PowerMacs CONFIG_VIDEO_PLANB PlanB is the V4L driver for the PowerMac 7x00/8x00 series video @@ -11688,7 +11770,7 @@ to crash during startup when this option is enabled. Say Y unless you experience problems that you suspect may be caused by this. -Disable pgtable cache +Disable pgtable cache (EXPERIMENTAL) CONFIG_NO_PGT_CACHE Normally the kernel maintains a `quicklist' of preallocated pagetable structures in order to increase performance. On machines with very @@ -11711,7 +11793,7 @@ time by entering them here. As a minimum, you should specify the memory size and the root device (eg, mem=64M root=/dev/nfs) -Hardware alignment trap +Hardware alignment trap (EXPERIMENTAL) CONFIG_ALIGNMENT_TRAP ARM processors can not fetch/store information which is not naturally aligned on the bus, ie, a 4 byte fetch must start at an address divisable @@ -11818,7 +11900,7 @@ If you say Y here, you also need to say Y or M to a compression protocol below. -IrLAP Deflate Compression Protocol +IrLAP Deflate Compression Protocol (EXPERIMENTAL) CONFIG_IRDA_DEFLATE Say Y here if you want to build support for the Deflate compression protocol. The deflate compression (GZIP) is exactly @@ -12041,7 +12123,7 @@ boards from BVM Ltd. Everyone using one of these boards should say Y here. -Universal Serial Bus (USB) Support (Experimental) +Universal Serial Bus (USB) support (EXPERIMENTAL) CONFIG_USB This will enable support for the Universal Serial Bus (USB). USB allows you to connect up to 127 external devices such as keyboards, @@ -12147,7 +12229,7 @@ It is safe to say N to this -- it is not needed for normal printing or parallel port CD-ROM/disk support. -Kernel httpd acceleration (experimental) +Kernel httpd acceleration (EXPERIMENTAL) CONFIG_KHTTPD The kernel httpd acceleration daemon (kHTTPd) is a (limited) webserver build into the kernel. It is limited since it can only @@ -12167,6 +12249,8 @@ # capitalize: AppleTalk, Ethernet, DOS, DMA, FAT, FTP, Internet, # Intel, IRQ, Linux, MSDOS, NetWare, NetWinder, NFS, # PCI, SCSI, SPARC +# capitalize +# comments: DANGEROUS, EXPERIMENTAL, OBSOLETE # two words: hard drive, hard disk, sound card, home page # other: it's safe to save; daemon; use --, not - or --- # diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/Documentation/fb/clgenfb.txt linux.ac/Documentation/fb/clgenfb.txt --- linux.vanilla/Documentation/fb/clgenfb.txt Sat Sep 11 00:54:01 1999 +++ linux.ac/Documentation/fb/clgenfb.txt Sat Sep 11 19:31:00 1999 @@ -45,9 +45,7 @@ Version 1.9.4.4 --------------- * Preliminary Laguna support -* Overhaul color register routines. Shifts are now based on offset - values in var.cmap, so as long as those are correctly set for PReP - things should work (knock on wood). +* Overhaul color register routines. * Associated with the above, console colors are now obtained from a LUT called 'palette' instead of from the VGA registers. This code was modeled after that in atyfb and matroxfb. diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/Documentation/filesystems/proc.txt linux.ac/Documentation/filesystems/proc.txt --- linux.vanilla/Documentation/filesystems/proc.txt Thu Jan 1 01:00:00 1970 +++ linux.ac/Documentation/filesystems/proc.txt Wed Sep 15 23:53:21 1999 @@ -0,0 +1,1379 @@ + +----------------------------------------------------------------------- + + T H E /proc F I L E S Y S T E M + +----------------------------------------------------------------------- +/proc/sys Terrehon Bowden January 27 1999 + Bodo Bauer +----------------------------------------------------------------------- +Version 1.1 Kernel version 2.2 +----------------------------------------------------------------------- +Contents + +1 Introduction/Credits + +1.1 Legal Issues + +2 The /proc file system + +2.1 Process specific subdirectories +2.2 Kernel data +2.3 IDE devices in /proc/ide +2.4 Networking info in /proc/net +2.5 SCSI info +2.6 Parallel port info in /proc/parport +2.7 TTY info in /proc/tty + +3 Reading and modifying kernel parameters + +3.1 /proc/sys/debug and /proc/sys/proc +3.2 /proc/fs - File system data +3.3 /proc/fs/binfmt_misc - Miscellaneous binary formats +3.4 /proc/sys/kernel - General kernel parameters +3.5 /proc/sys/vm - The virtual memory subsystem +3.6 /proc/sys/dev - Device specific parameters +3.7 /proc/sys/sunrpc - Remote procedure calls +3.8 /proc/sys/net - Networking stuff +3.9 /proc/sys/net/ipv4 - IPV4 settings=20 +3.10 Appletalk +3.11 IPX + +----------------------------------------------------------------------- + +1 Introduction/Credits + +This documentation is part of a soon to be released book published by +IDG Books on the SuSE Linux distribution. As there is no complete +documentation for the /proc file system and we've used many freely +available sources to write this chapter, it seems only fair to give +the work back to the Linux community. This work is based on the +2.1.132 and 2.2.0-pre-kernel versions. I'm afraid it's still far from +complete, but we hope it will be useful. As far as we know, it is the +first 'all-in-one' document about the /proc file system. It is +focused on the Intel x86 hardware, so if you are looking for PPC, ARM, +SPARC, APX, etc., features, you probably won't find what you are +looking for. It also only covers IPv4 networking, not IPv6 nor other +protocols - sorry. + +We'd like to thank Alan Cox, Rik van Riel, and Alexey Kuznetsov. We'd +also like to extend a special thank you to Andi Kleen for +documentation, which we relied on heavily to create this document, as +well as the additional information he provided. Thanks to everybody +else who contributed source or docs to the Linux kernel and helped +create a great piece of software... :) + +If you have any comments, corrections or additions, please don't +hesitate to contact Bodo Bauer at bb@ricochet.net. We'll be happy to +add them to this document. + +The latest version of this document is available online at +http://www.suse.com/~bb/Docs/proc.html in HTML, ASCII, and as +Postscript file. + +1.1 Legal Stuff + +We don't guarantee the correctness of this document, and if you come +to us complaining about how you screwed up your system because of +incorrect documentation, we won't feel responsible... + +----------------------------------------------------------------------- + +2 The /proc file system + +The proc file system acts as an interface to internal data structures +in the kernel. It can be used to obtain information about the system +and to change certain kernel parameters at runtime. It contains +(among other things) one subdirectory for each process running on the +system which is named after the process id (PID) of the process. The +link self points to the process reading the file system. + +2.1 Process specific subdirectories + +Each process subdirectory has the in table 1.1 listed entries. + + _________________________________________________ + cmdline Command line arguments + environ Values of environment variables + fd Directory, which contains all file descriptors + mem Memory held by this process + stat Process status + status Process status in human readable form + cwd Link to the current working directory + exe Link to the executable of this process + maps Memory maps + root Link to the root directory of this process + statm Process memory status information + _________________________________________________ + Table 1.1: Process specific entries in /proc + +For example, to get the status information of a process, all you have +to do is read the file /proc/PID/status: + +> cat /proc/self/status +Name: cat +State: R (running) +Pid: 5633 +PPid: 5609 +Uid: 501 501 501 501 +Gid: 100 100 100 100 +Groups: 100 16 +VmSize: 804 kB +VmLck: 0 kB +VmRSS: 344 kB +VmData: 68 kB +VmStk: 20 kB +VmExe: 12 kB +VmLib: 660 kB +SigPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 0000000000000000 +SigCgt: 0000000000000000 +CapInh: 00000000fffffeff +CapPrm: 0000000000000000 +CapEff: 0000000000000000 + +This shows you almost the same information as you would get if you +viewed it with the ps command. In fact, ps uses the proc file system +to obtain its information. + +The statm file contains more detailed information about the process +memory usage. It contains seven values with the following meanings: + +size total program size +resident size of in memory portions +shared number of the pages that are shared +trs number of pages that are 'code' +drs number of pages of data/stack +lrs number of pages of library +dt number of dirty pages + +The ratio text/data/library is approximate only by heuristics. + +2.2 Kernel data + +Similar to the process entries, these are files which give information +about the running kernel. The files used to obtain this information +are contained in /proc and are listed in table 1.2. Not all of these +will be present in your system. It depends on the kernel configuration +and the loaded modules, which files are there, and which are missing. + + ________________________________________________ + apm Advanced power management info + cmdline Kernel command line + cpuinfo Info about the CPU + devices Available devices (block and character) + dma Used DMS channels + filesystems Supported filesystems + interrupts Interrupt usage + ioports I/O port usage + kcore Kernel core image + kmsg Kernel messages + ksyms Kernel symbol table + loadavg Load average + locks Kernel locks + meminfo Memory info + misc Miscellaneous + modules List of loaded modules + mounts Mounted filesystems + partitions Table of partitions known to the system + rtc Real time clock + slabinfo Slab pool info + stat Overall statistics + swaps Swap space utilization + uptime System uptime + version Kernel version + ________________________________________________ + Table 1.2: Kernel info in /proc + +You can, for example, check which interrupts are currently in use and +what they are used for by looking in the file /proc/interrupts: + +> cat /proc/interrupts + CPU0 + 0: 8728810 XT-PIC timer + 1: 895 XT-PIC keyboard + 2: 0 XT-PIC cascade + 3: 531695 XT-PIC aha152x + 4: 2014133 XT-PIC serial + 5: 44401 XT-PIC pcnet_cs + 8: 2 XT-PIC rtc + 11: 8 XT-PIC i82365 + 12: 182918 XT-PIC PS/2 Mouse + 13: 1 XT-PIC fpu + 14: 1232265 XT-PIC ide0 + 15: 7 XT-PIC ide1 +NMI: 0 + +There three more important subdirectories in /proc: net, scsi and +sys. The general rule is that the contents, or even the existence of +these directories, depends on your kernel configuration. If SCSI is +not enabled, the directory scsi may not exist. The same is true with +the net, which is only there when networking support is present in the +running kernel. + +The slabinfo file gives information about memory usage on the slab +level. Linux uses slab pools for memory management above page level +in version 2.2. Commonly used objects have their own slab pool (like +network buffers, directory cache, etc.). + +2.3 IDE devices in /proc/ide + +This subdirectory contains information about all IDE devices that the +kernel is aware of. There is one subdirectory for each device +(i.e. hard disk) containing the following files: + + cache The cache + capacity Capacity of the medium + driver Driver and version + geometry Physical and logical geometry + identify Device identify block + media Media type + model Device identifier + settings Device setup + smart_thresholds IDE disk management thresholds + smart_values IDE disk management values + +2.4 Networking info in /proc/net + +This directory follows the usual pattern. Table 1.3 lists the files +and their meaning. + + ____________________________________________________ + arp Kernel ARP table + dev network devices with statistics + dev_mcast Lists the Layer2 multicast groups a + device is listening to (interface index, + label, number of references, number of + bound addresses). + dev_stat network device status + ip_fwchains Firewall chain linkage + ip_fwnames Firewall chains + ip_masq Directory containing the masquerading + tables. + ip_masquerade Major masquerading table + netstat Network statistics + raw Raw device statistics + route Kernel routing table + rpc Directory containing rpc info + rt_cache Routing cache + snmp SNMP data + sockstat Socket statistics + tcp TCP sockets + tr_rif Token ring RIF routing table + udp UDP sockets + unix UNIX domain sockets + wireless Wireless interface data (Wavelan etc) + igmp IP multicast addresses, which this host joined + psched Global packet scheduler parameters. + netlink List of PF_NETLINK sockets. + ip_mr_vifs List of multicast virtual interfaces. + ip_mr_cache List of multicast routing cache. + udp6 UDP sockets (IPv6) + tcp6 TCP sockets (IPv6) + raw6 Raw device statistics (IPv6) + igmp6 IP multicast addresses, which this host joineed (IPv6) + if_inet6 List of IPv6 interface addresses. + ipv6_route Kernel routing table for IPv6 + rt6_stats global IPv6 routing tables statistics. + sockstat6 Socket statistics (IPv6) + snmp6 Snmp data (IPv6) + ____________________________________________________ + Table 1.3: Network info in /proc/net + +You can use this information to see which network devices are +available in your system and how much traffic was routed over those +devices: + +> cat /proc/net/dev +Inter-|Receive |[... + face |bytes packets errs drop fifo frame compressed multicast|[... + lo: 908188 5596 0 0 0 0 0 0 [... + ppp0:15475140 20721 410 0 0 410 0 0 [... + eth0: 614530 7085 0 0 0 0 0 1 [... + +...] Transmit +...] bytes packets errs drop fifo colls carrier compressed +...] 908188 5596 0 0 0 0 0 0 +...] 1375103 17405 0 0 0 0 0 0 +...] 1703981 5535 0 0 0 3 0 0 + +2.5 SCSI info + +If you have a SCSI host adapter in your system, you'll find a +subdirectory named after the driver for this adapter in /proc/scsi. +You'll also see a list of all recognized SCSI devices in /proc/scsi: + +>cat /proc/scsi/scsi +Attached devices: +Host: scsi0 Channel: 00 Id: 00 Lun: 00 + Vendor: QUANTUM Model: XP34550W Rev: LXY4 + Type: Direct-Access ANSI SCSI revision: 02 +Host: scsi0 Channel: 00 Id: 01 Lun: 00 + Vendor: SEAGATE Model: ST34501W Rev: 0018 + Type: Direct-Access ANSI SCSI revision: 02 +Host: scsi0 Channel: 00 Id: 02 Lun: 00 + Vendor: SEAGATE Model: ST34501W Rev: 0017 + Type: Direct-Access ANSI SCSI revision: 02 +Host: scsi0 Channel: 00 Id: 04 Lun: 00 + Vendor: ARCHIVE Model: Python 04106-XXX Rev: 703b + Type: Sequential-Access ANSI SCSI revision: 02 + +The directory named after the driver has one file for each adapter +found in the system. These files contain information about +the controller, including the used IRQ and the IO address range: + +>cat /proc/scsi/ncr53c8xx/0 +General information: + Chip NCR53C875, device id 0xf, revision id 0x4 + IO port address 0xec00, IRQ number 11 + Synchronous period factor 12, max commands per lun 4 + +2.6 Parallel port info in /proc/parport + +The directory /proc/parport contains information about the parallel +ports of your system. It has one subdirectory for each port, named +after the port number (0,1,2,...). + +This directory contains four files: + + autoprobe Autoprobe results of this port + devices Connected device modules + hardware Hardware info (port type, io-port, DMA, IRQ, etc.) + irq Used interrupt, if any + +2.7 TTY info in /proc/tty + +Information about the available and the actually used tty's can be +found in /proc/tty. You'll find entries for drivers and line +disciplines in this directory, as shown in the table below: + + drivers List of drivers and their usage + ldiscs Registered line disciplines + driver/serial Usage statistic and status of single tty lines + +To see which tty's are currently in use, you can simply look into the +file /proc/tty/drivers: + +>cat /proc/tty/drivers +pty_slave /dev/pts 136 0-255 pty:slave +pty_master /dev/ptm 128 0-255 pty:master +pty_slave /dev/ttyp 3 0-255 pty:slave +pty_master /dev/pty 2 0-255 pty:master +serial /dev/cua 5 64-67 serial:callout +serial /dev/ttyS 4 64-67 serial +/dev/tty0 /dev/tty0 4 0 system:vtmaster +/dev/ptmx /dev/ptmx 5 2 system +/dev/console /dev/console 5 1 system:console +/dev/tty /dev/tty 5 0 system:/dev/tty +unknown /dev/tty 4 1-63 console + +----------------------------------------------------------------------- + +3 Reading and modifying kernel parameters + +A very interesting part of /proc is the directory /proc/sys. This not +only provides information, it also allows you to change parameters +within the kernel. Be very careful when trying this. You can optimize +your system, but you also can crash it. Never play around with kernel +parameters on a production system. Set up a development machine and +test to make sure that everything works the way you want it to. You +may have no alternative but to reboot the machine once an error has +been made. + +To change a value, simply echo the new value into the file. An example +is given below in the section on the file system data. You need to be +root to do this. You can create your own boot script to get this done +every time your system boots. + +The files in /proc/sys can be used to tune and monitor miscellaneous +and general things in the operation of the Linux kernel. Since some +of the files can inadvertently disrupt your system, it is advisable to +read both documentation and source before actually making +adjustments. In any case, be very careful when writing to any of these +files. The entries in /proc may change slightly between the 2.1.* and +the 2.2 kernel, so review the kernel documentation if there is any +doubt. You'll find the documentation in the directory +/usr/src/linux/Documentation/sys. This chapter is heavily based on the +documentation included in the pre 2.2 kernels. Thanks to Rick van Riel +for providing this information. + +3.1 /proc/sys/debug and /proc/sys/proc + +These two subdirectories are empty. + +3.2 /proc/fs - File system data + +This subdirectory contains specific file system, file handle, inode, +dentry and quota information. + +Currently, these files are in /proc/sys/fs: + +dentry-state + Status of the directory cache. Since directory entries are + dynamically allocated and deallocated, this file gives information + about the current status. It holds six values, in which the last + two are not used and are always zero. The other four mean: + + nr_dentry Seems to be zero all the time + nr_unused Number of unused cache entries + age_limit Age in seconds after the entry may be + reclaimed, when memory is short + want_pages internal + +dquot-nr and dquot-max + The file dquot-max shows the maximum number of cached disk quota + entries. + + The file dquot-nr shows the number of allocated disk quota + entries and the number of free disk quota entries. + + If the number of free cached disk quotas is very low and you have + a large number of simultaneous system users, you might want + to raise the limit. + +file-nr and file-max + The kernel allocates file handles dynamically, but as yet + doesn't free them again. + + The value in file-max denotes the maximum number of file handles + that the Linux kernel will allocate. When you get a lot of error + messages about running out of file handles, you might want to raise + this limit. The default value is 4096. To change it, just write the + new number into the file: + + # cat /proc/sys/fs/file-max + 4096 + # echo 8192 > /proc/sys/fs/file-max + # cat /proc/sys/fs/file-max + 8192 + + This method of revision is useful for all customizable parameters + of the kernel - simply echo the new value to the corresponding + file. + + The three values in file-nr denote the number of allocated file + handles, the number of used file handles, and the maximum number of + file handles. When the allocated file handles come close to the + maximum, but the number of actually used ones is far behind, you've + encountered a peak in your usage of file handles and you don't need + to increase the maximum. + + However, there is still a per process limit of open files, which + unfortunatly can't be changed that easily. It is set to 1024 by + default. To change this you have to edit the files limits.h and + fs.h in the directory /usr/src/linux/include/linux. Change the + definition of NR_OPEN and recompile the kernel. + +inode-state, inode-nr and inode-max + As with file handles, the kernel allocates the inode structures + dynamically, but can't free them yet. + + The value in inode-max denotes the maximum number of inode + handlers. This value should be 3 to 4 times larger than the value + in file-max, since stdin, stdout, and network sockets also need an + inode struct to handle them. If you regularly run out of inodes, + you should increase this value. + + The file inode-nr contains the first two items from inode-state, so + we'll skip to that file... + + inode-state contains three actual numbers and four dummy values. The + actual numbers are (in order of appearance) nr_inodes, nr_free_inodes, + and preshrink. + + nr_inodes + Denotes the number of inodes the system has allocated. This can + be slightly more than inode-max because Linux allocates them one + pageful at a time. + + nr_free_inodes + Represents the number of free inodes and pre shrink is nonzero + when the nr_inodes > inode-max and the system needs to prune the + inode list instead of allocating more. + +super-nr and super-max + Again, super block structures are allocated by the kernel, + but not freed. The file super-max contains the maximum number of + super block handlers, where super-nr shows the number of + currently allocated ones. + + Every mounted file system needs a super block, so if you plan to + mount lots of file systems, you may want to increase these + numbers. + +3.3 /proc/fs/binfmt_misc - Miscellaneous binary formats + +Besides these files, there is the subdirectory +/proc/sys/fs/binfmt_misc. This handles the kernel support for +miscellaneous binary formats. + +Binfmt_misc provides the ability to register additional binary formats +to the Kernel without compiling an additional module/kernel. Therefore +binfmt_misc needs to know magic numbers at the beginning or the +filename extension of the binary. + +It works by maintaining a linked list of structs, that contain a +description of a binary format, including a magic with size (or the +filename extension), offset and mask, and the interpreter name. On +request it invokes the given interpreter with the original program as +argument, as binfmt_java and binfmt_em86 and binfmt_mz do. +Since binfmt_misc does not define any default binary-formats, you have to +register an additional binary-format. + +There are two general files in binfmt_misc and one file per registered +format. The two general files are register and status. + +Registering a new binary format + +echo :name:type:offset:magic:mask:interpreter: > /proc/sys/fs/binfmt_misc/register + +with appropriate name (the name for the /proc-dir entry), offset +(defaults to 0, if omitted), magic and mask (which can be omitted, +defaults to all 0xff) and last but not least, the interpreter that is +to be invoked (for example and testing '/bin/echo'). Type can be M for +usual magic matching or E for filename extension matching (give +extension in place of magic). + +To check or reset the status of the binary format handler: + +If you do a cat on the file /proc/sys/fs/binfmt_misc/status, you will +get the current status (enabled/disabled) of binfmt_misc. Change the +status by echoing 0 (disables) or 1 (enables) or -1 (caution: this +clears all previously registered binary formats) to status. For +example echo 0 > status to disable binfmt_misc (temporarily). + +Status of a single handler + +Each registered handler has an entry in /proc/sys/fs/binfmt_misc. +These files perform the same function as status, but their scope is +limited to the actual binary format. By cating this file, you also +receive all related information about the interpreter/magic of the +binfmt. + +Example usage of binfmt_misc (emulate binfmt_java) + +cd /proc/sys/fs/binfmt_misc +echo ':Java:M::\xca\xfe\xba\xbe::/usr/local/java/bin/javawrapper:' > register +echo ':HTML:E::html::/usr/local/java/bin/appletviewer:' > register +echo ':Applet:M::%lx)", adr, ret)); + return ret; } -static inline unsigned long uvirt_to_bus(unsigned long adr) +static inline unsigned long uvirt_to_bus(unsigned long adr) { - return virt_to_bus(phys_to_virt(uvirt_to_phys(adr))); -} + unsigned long kva, ret; -/* convert virtual kernel memory address to physical address */ -/* (virt_to_phys only works for kmalloced kernel memory) */ + kva = uvirt_to_kva(pgd_offset(current->mm, adr), adr); + ret = virt_to_bus((void *)kva); + MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret)); + return ret; +} -static inline unsigned long kvirt_to_phys(unsigned long adr) +static inline unsigned long kvirt_to_bus(unsigned long adr) { - return uvirt_to_phys(VMALLOC_VMADDR(adr)); + unsigned long va, kva, ret; + + va = VMALLOC_VMADDR(adr); + kva = uvirt_to_kva(pgd_offset_k(va), va); + ret = virt_to_bus((void *)kva); + MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret)); + return ret; } -static inline unsigned long kvirt_to_bus(unsigned long adr) +/* Here we want the physical address of the memory. + * This is used when initializing the contents of the + * area and marking the pages as reserved. + */ +static inline unsigned long kvirt_to_pa(unsigned long adr) { - return uvirt_to_bus(VMALLOC_VMADDR(adr)); -} + unsigned long va, kva, ret; + va = VMALLOC_VMADDR(adr); + kva = uvirt_to_kva(pgd_offset_k(va), va); + ret = __pa(kva); + MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret)); + return ret; +} -static void * rvmalloc(unsigned long size) +static void *rvmalloc(unsigned long size) { - void * mem; + void *mem; unsigned long adr, page; - + + /* Round it off to PAGE_SIZE */ size += (PAGE_SIZE - 1); size &= ~(PAGE_SIZE - 1); - mem=vmalloc(size); - if (mem) - { - memset(mem, 0, size); /* Clear the ram out, no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) - { - page = kvirt_to_phys(adr); - mem_map_reserve(MAP_NR(phys_to_virt(page))); - adr+=PAGE_SIZE; - if (size > PAGE_SIZE) - size-=PAGE_SIZE; - else - size=0; - } + mem = vmalloc(size); + if (!mem) + return NULL; + + memset(mem, 0, size); /* Clear the ram out, no junk to the user */ + adr = (unsigned long) mem; + while (size > 0) { + page = kvirt_to_pa(adr); + mem_map_reserve(MAP_NR(__va(page))); + adr += PAGE_SIZE; + if (size > PAGE_SIZE) + size -= PAGE_SIZE; + else + size = 0; } + return mem; } -static void rvfree(void * mem, unsigned long size) +static void rvfree(void *mem, unsigned long size) { unsigned long adr, page; - + + if (!mem) + return; + size += (PAGE_SIZE - 1); size &= ~(PAGE_SIZE - 1); - if (mem) - { - adr=(unsigned long) mem; - while (size > 0) - { - page = kvirt_to_phys(adr); - mem_map_unreserve(MAP_NR(phys_to_virt(page))); - adr+=PAGE_SIZE; - if (size > PAGE_SIZE) - size-=PAGE_SIZE; - else - size=0; - } - vfree(mem); + adr=(unsigned long) mem; + while (size > 0) { + page = kvirt_to_pa(adr); + mem_map_unreserve(MAP_NR(__va(page))); + adr += PAGE_SIZE; + if (size > PAGE_SIZE) + size -= PAGE_SIZE; + else + size = 0; } + vfree(mem); } -int usb_cpia_get_version(struct usb_device *dev, void *buf) +static int usb_cpia_get_version(struct usb_device *dev, void *buf) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE) | 0x80; - dr.request = USB_REQ_CPIA_GET_VERSION; - dr.value = 0; - dr.index = 0; - dr.length = 4; - - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, 4); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_CPIA_GET_VERSION, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, buf, 4, HZ); } -int usb_cpia_get_pnp_id(struct usb_device *dev, void *buf) +#ifdef NOTUSED +static int usb_cpia_get_pnp_id(struct usb_device *dev, void *buf) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE) | 0x80; - dr.request = USB_REQ_CPIA_GET_PNP_ID; - dr.value = 0; - dr.index = 0; - dr.length = 6; - - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, 6); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_CPIA_GET_PNP_ID, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, buf, 6, HZ); } +#endif -int usb_cpia_get_camera_status(struct usb_device *dev, void *buf) +#ifdef NOTUSED +static int usb_cpia_get_camera_status(struct usb_device *dev, void *buf) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE) | 0x80; - dr.request = USB_REQ_CPIA_GET_CAMERA_STATUS; - dr.value = 0; - dr.index = 0; - dr.length = 8; - - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, 8); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_CPIA_GET_CAMERA_STATUS, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, buf, 8, HZ); } +#endif -int usb_cpia_goto_hi_power(struct usb_device *dev) +static int usb_cpia_goto_hi_power(struct usb_device *dev) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_GOTO_HI_POWER; - dr.value = 0; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_GOTO_HI_POWER, USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, NULL, 0, HZ); } -int usb_cpia_get_vp_version(struct usb_device *dev, void *buf) +static int usb_cpia_get_vp_version(struct usb_device *dev, void *buf) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_GET_VP_VERSION; - dr.value = 0; - dr.index = 0; - dr.length = 4; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, buf, 4); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + USB_REQ_CPIA_GET_VP_VERSION, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, 0, buf, 4, HZ); } -int usb_cpia_set_sensor_fps(struct usb_device *dev, int sensorbaserate, int sensorclkdivisor) +static int usb_cpia_set_sensor_fps(struct usb_device *dev, int sensorbaserate, int sensorclkdivisor) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_SET_SENSOR_FPS; - dr.value = (sensorclkdivisor << 8) + sensorbaserate; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_SET_SENSOR_FPS, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, + (sensorbaserate << 8) + sensorclkdivisor, 0, NULL, 0, HZ); } -int usb_cpia_grab_frame(struct usb_device *dev, int streamstartline) +static int usb_cpia_grab_frame(struct usb_device *dev, int streamstartline) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_GRAB_FRAME; - dr.value = streamstartline << 8; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_GRAB_FRAME, USB_TYPE_VENDOR | USB_RECIP_DEVICE, + streamstartline << 8, 0, NULL, 0, HZ); } -int usb_cpia_upload_frame(struct usb_device *dev, int forceupload) +static int usb_cpia_upload_frame(struct usb_device *dev, int forceupload) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_UPLOAD_FRAME; - dr.value = forceupload; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_UPLOAD_FRAME, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, forceupload, 0, NULL, 0, HZ); } -int usb_cpia_set_grab_mode(struct usb_device *dev, int continuousgrab) +static int usb_cpia_set_grab_mode(struct usb_device *dev, int continuousgrab) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_SET_GRAB_MODE; - dr.value = continuousgrab; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_SET_GRAB_MODE, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, continuousgrab, + 0, NULL, 0, HZ); } -int usb_cpia_set_format(struct usb_device *dev, int size, int subsample, int order) +static int usb_cpia_set_format(struct usb_device *dev, int size, int subsample, int order) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_SET_FORMAT; - dr.value = (subsample << 8) + size; - dr.index = order; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_SET_FORMAT, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, + (subsample << 8) + size, order, NULL, 0, HZ); } -int usb_cpia_set_compression(struct usb_device *dev, int compmode, int decimation) +static int usb_cpia_set_roi(struct usb_device *dev, int colstart, int colend, int rowstart, int rowend) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_SET_COMPRESSION; - dr.value = (decimation << 8) + compmode; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_SET_ROI, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, + (colend << 8) + colstart, (rowend << 8) + rowstart, + NULL, 0, HZ); } -int usb_cpia_initstreamcap(struct usb_device *dev, int skipframes, int streamstartline) +static int usb_cpia_set_compression(struct usb_device *dev, int compmode, int decimation) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_INIT_STREAM_CAP; - dr.value = (streamstartline << 8) + skipframes; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_SET_COMPRESSION, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, + (decimation << 8) + compmode, 0, NULL, 0, HZ); } -int usb_cpia_finistreamcap(struct usb_device *dev) +#ifdef NOTUSED +static int usb_cpia_initstreamcap(struct usb_device *dev, int skipframes, int streamstartline) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_FINI_STREAM_CAP; - dr.value = 0; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_INIT_STREAM_CAP, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, + (streamstartline << 8) + skipframes, 0, NULL, 0, HZ); } -int usb_cpia_startstreamcap(struct usb_device *dev) +static int usb_cpia_finistreamcap(struct usb_device *dev) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_START_STREAM_CAP; - dr.value = 0; - dr.index = 0; - dr.length = 0; - - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_FINI_STREAM_CAP, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, NULL, 0, HZ); } -int usb_cpia_endstreamcap(struct usb_device *dev) +static int usb_cpia_startstreamcap(struct usb_device *dev) { - devrequest dr; - - dr.requesttype = (USB_TYPE_VENDOR | USB_RECIP_DEVICE); - dr.request = USB_REQ_CPIA_END_STREAM_CAP; - dr.value = 0; - dr.index = 0; - dr.length = 0; + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_START_STREAM_CAP, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, NULL, 0, HZ); +} - return dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); +static int usb_cpia_endstreamcap(struct usb_device *dev) +{ + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + USB_REQ_CPIA_END_STREAM_CAP, + USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, NULL, 0, HZ); } +#endif /* How much data is left in the scratch buf? */ #define scratch_left(x) (cpia->scratchlen - (int)((char *)x - (char *)cpia->scratch)) static void cpia_parse_data(struct usb_cpia *cpia) { + struct cpia_frame *frame, *pframe; unsigned char *data = cpia->scratch; unsigned long l; - int done; - done = 0; - while (!done && scratch_left(data)) { - switch (cpia->state) { + frame = &cpia->frame[cpia->curframe]; + pframe = &cpia->frame[(cpia->curframe - 1 + CPIA_NUMFRAMES) % CPIA_NUMFRAMES]; + + while (1) { + if (!scratch_left(data)) + goto out; + + switch (frame->scanstate) { case STATE_SCANNING: { - unsigned char *begin = data; + struct cpia_frame_header *header; /* We need atleast 2 bytes for the magic value */ - if (scratch_left(data) < 2) { - done = 1; - break; - } + if (scratch_left(data) < 2) + goto out; - /* 0x1968 is magic */ - printk("header: %X\n", (*data << 8) + *(data + 1)); - if ((*data == 0x19) && (*(data + 1) == 0x68)) { - cpia->state = STATE_HEADER; - printk("moving to header\n"); + header = (struct cpia_frame_header *)data; + + if (be16_to_cpup(&header->magic) == CPIA_MAGIC) { + frame->scanstate = STATE_HEADER; break; } /* Woops, lost the header, find the end of the frame */ - if (scratch_left(data) < 4) { - done = 1; - break; - } + if (scratch_left(data) < 4) + goto out; - printk("Scanning for end of frame\n"); + /* See if we found the end of the frame */ while (scratch_left(data) >= 4) { - if ((*data == 0xFF) && - (*(data + 1) == 0xFF) && - (*(data + 2) == 0xFF) && - (*(data + 3) == 0xFF)) { + if (*((__u32 *)data) == 0xFFFFFFFF) { +printk("found end of frame\n"); data += 4; - break; +goto error; } data++; } -#ifdef CPIA_DEBUG - printk("scan: scanned %d bytes\n", data-begin); -#endif break; } case STATE_HEADER: /* We need atleast 64 bytes for the header */ - if (scratch_left(data) < 64) { - done = 1; - break; - } + if (scratch_left(data) < + sizeof(struct cpia_frame_header)) + goto out; + memcpy(&frame->header, data, + sizeof(struct cpia_frame_header)); + + /* Skip over the header */ + data += sizeof(struct cpia_frame_header); + + frame->hdrwidth = (frame->header.col_end - + frame->header.col_start) * 8; + frame->hdrheight = (frame->header.row_end - + frame->header.row_start) * 4; #ifdef CPIA_DEBUG - printk("header: framerate %d\n", data[41]); + printk("cpia: frame size %dx%d\n", + frame->hdrwidth, frame->hdrheight); + printk("cpia: frame %scompressed\n", + frame->header.comp_enable ? "" : "not "); #endif - data += 64; + frame->scanstate = STATE_LINES; + frame->curline = 0; - cpia->state = STATE_LINES; - break; case STATE_LINES: { - unsigned char *begin = data; - int found = 0; - - while (scratch_left(data)) { - if (*data == 0xFD) { - data++; - found = 1; - break; - } else if ((*data == 0xFF) && - (scratch_left(data) >= 3) && - (*(data + 1) == 0xFF) && - (*(data + 2) == 0xFF) && - (*(data + 3) == 0xFF)) { - data += 4; - cpia->curline = 144; - found = 1; - break; - } - - data++; + unsigned char *f, *end; + unsigned int len; + int i; + int y, u, y1, v, r, g, b; + + /* We want atleast 2 bytes for the length */ + if (scratch_left(data) < 2) + goto out; + + /* Grab the length */ + len = data[0] + (data[1] << 8); + +printk("line %d, %d bytes long\n", frame->curline, len); + /* Check to make sure it's nothing outrageous */ + if (len > (frame->hdrwidth * 2) + 1) { + printk(KERN_INFO "cpia: bad length, resynching\n"); + goto error; } - if (data-begin == 355 && cpia->frame[cpia->curframe].width != 64) { - int i; - char *f = cpia->frame[cpia->curframe].data, *b = begin; - - b += 2; - f += (cpia->frame[cpia->curframe].width * 3) * cpia->curline; - - for (i = 0; i < 176; i++) - f[(i * 3) + 0] = - f[(i * 3) + 1] = - f[(i * 3) + 2] = - b[(i * 2)]; + /* Make sure there's enough data for the entire line */ + if (scratch_left(data + 2) < len) + goto out; + + /* Skip over the length */ + data += 2; + + /* Is the end of the line there */ + if (data[len - 1] != 0xFD) { + printk(KERN_INFO "cpia: lost synch\n"); +end = data + len - 1 - 4; +printk("%02X %02X %02X %02X %02X %02X %02X %02X\n", +end[0], end[1], +end[2], end[3], +end[4], end[5], +end[6], end[7]); + goto error; } - if (found) { - cpia->curline++; - if (cpia->curline >= 144) { - wake_up(&cpia->wq); - cpia->state = STATE_SCANNING; - cpia->curline = 0; - cpia->curframe = -1; - done = 1; + /* Start at the beginning */ + end = data + len - 1; + + f = frame->data + (frame->width * 3 * frame->curline); + + if (frame->header.comp_enable) { + unsigned char *fp; + + /* We use the previous frame as a reference */ + fp = pframe->data + + (frame->width * 3 * frame->curline); + + while (data < end) { + if (*data & 1) { + /* Compress RLE data */ + i = *data >> 1; + memcpy(f, fp, i * 3); + f += (i * 3); + fp += (i * 3); + data++; + } else { + /* Raw data */ + +#define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) + +y = *data++ - 16; +u = *data++ - 128; +y1 = *data++ - 16; +v = *data++ - 128; +r = 104635 * v; +g = -25690 * u + -53294 * v; +b = 132278 * u; +y *= 76310; +y1 *= 76310; +*f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); +*f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); + fp += 6; +/* + f[0] = f[1] = f[2] = *data; + f += 3; + data += 2; + fp += 3; +*/ + } } } else { - data = begin; - done = 1; + /* Raw data */ + while (data < end) { +y = *data++ - 16; +u = *data++ - 128; +y1 = *data++ - 16; +v = *data++ - 128; +r = 104635 * v; +g = -25690 * u + -53294 * v; +b = 132278 * u; +y *= 76310; +y1 *= 76310; +*f++ = LIMIT(b + y); *f++ = LIMIT(g + y); *f++ = LIMIT(r + y); +*f++ = LIMIT(b + y1); *f++ = LIMIT(g + y1); *f++ = LIMIT(r + y1); + } } - + +#ifdef CPIA_DEBUG + /* Make sure we found the end correctly */ + if (*data != 0xFD) + printk("cpia: missed end!\n"); +#endif + + /* Skip the last byte */ + data++; + + if (++frame->curline >= frame->hdrheight) + goto nextframe; + break; } } } +nextframe: + if (scratch_left(data) >= 4 && *((__u32 *)data) == 0xFFFFFFFF) { + data += 4; +printk("end of frame found normally\n"); +} + + frame->grabstate = FRAME_DONE; + cpia->curframe = -1; + + /* This will cause the process to request another frame */ + if (waitqueue_active(&frame->wq)) + wake_up_interruptible(&frame->wq); + + goto out; + +error: + frame->grabstate = FRAME_ERROR; + cpia->curframe = -1; + cpia->compress = 0; + + /* This will cause the process to request another frame */ + if (waitqueue_active(&frame->wq)) + wake_up_interruptible(&frame->wq); + +out: +printk("scanned %d bytes, %d left\n", data - cpia->scratch, scratch_left(data)); /* Grab the remaining */ l = scratch_left(data); memmove(cpia->scratch, data, l); - cpia->scratchlen = l; } /* - * For the moment there is no actual data compression (making blocks - * of data contiguous). This just checks the "frames" array for errors. + * Make all of the blocks of data contiguous */ -static int cpia_compress_isochronous(struct usb_isoc_desc *isodesc) +static int cpia_compress_isochronous(struct usb_cpia *cpia, struct usb_isoc_desc *isodesc) { - char *data = isodesc->data; + unsigned char *cdata, *data; int i, totlen = 0; + cdata = isodesc->data; + data = cpia->scratch + cpia->scratchlen; for (i = 0; i < isodesc->frame_count; i++) { - int n = isodesc->frames [i].frame_length; - int st = isodesc->frames [i].frame_status; - + int n = isodesc->frames[i].frame_length; #ifdef CPIA_DEBUG - /* Debugging */ + int st = isodesc->frames[i].frame_status; + if (st) printk(KERN_DEBUG "cpia data error: [%d] len=%d, status=%X\n", i, n, st); #endif + if ((cpia->scratchlen + n) > SCRATCH_BUF_SIZE) { + printk(KERN_ERR "cpia: scratch buf overflow!\n"); + return 0; + } + + if (n) + memmove(data, cdata, n); + data += n; + totlen += n; + cpia->scratchlen += n; + cdata += isodesc->frame_size; } return totlen; @@ -481,157 +542,114 @@ static int cpia_isoc_irq(int status, void *__buffer, int len, void *dev_id) { - struct usb_cpia *cpia = dev_id; - struct usb_device *dev = cpia->dev; + struct usb_cpia *cpia = (struct usb_cpia *)dev_id; struct cpia_sbuf *sbuf; int i; - char *p; if (!cpia->streaming) { printk("oops, not streaming, but interrupt\n"); return 0; } - if (cpia->curframe < 0) { - if (cpia->frame[0].state == FRAME_READY) { - cpia->curframe = 0; - cpia->frame[0].state = FRAME_GRABBING; -#ifdef CPIA_DEBUG - printk("capturing to frame 0\n"); -#endif - } else if (cpia->frame[1].state == FRAME_READY) { - cpia->curframe = 1; - cpia->frame[1].state = FRAME_GRABBING; -#ifdef CPIA_DEBUG - printk("capturing to frame 1\n"); -#endif -#ifdef CPIA_DEBUG - } else - printk("no frame available\n"); -#else - } -#endif - } - - sbuf = &cpia->sbuf[cpia->receivesbuf]; - + sbuf = &cpia->sbuf[cpia->cursbuf]; usb_kill_isoc(sbuf->isodesc); - /* Do something to it now */ - sbuf->len = cpia_compress_isochronous(sbuf->isodesc); + /* Copy the data received into our scratch buffer */ + len = cpia_compress_isochronous(cpia, sbuf->isodesc); -#ifdef CPIA_DEBUG - if (sbuf->len) - printk("%d bytes received\n", sbuf->len); -#endif +printk("%d bytes received\n", len); + /* If we don't have a frame we're current working on, complain */ + if (len) { + if (cpia->curframe < 0) + printk("cpia: received data, but no frame available\n"); + else + cpia_parse_data(cpia); + } - if (sbuf->len && cpia->curframe >= 0) { - if (sbuf->len > (SCRATCH_BUF_SIZE - cpia->scratchlen)) { - printk("overflow!\n"); - return 0; - } - memcpy(cpia->scratch + cpia->scratchlen, sbuf->data, sbuf->len); - cpia->scratchlen += sbuf->len; + for (i = 0; i < FRAMES_PER_DESC; i++) + sbuf->isodesc->frames[i].frame_length = FRAME_SIZE_PER_DESC; - cpia_parse_data(cpia); - } + /* Move to the next sbuf */ + cpia->cursbuf = (cpia->cursbuf + 1) % CPIA_NUMSBUF; /* Reschedule this block of Isochronous desc */ - /* - usb_run_isoc(sbuf->isodesc, NULL); - */ -/* - usb_schedule_isochronous(dev, sbuf->isodesc, cpia->sbuf[(cpia->receivesbuf + 2) % 3].isodesc); -*/ - - /* Move to the next one */ - cpia->receivesbuf = (cpia->receivesbuf + 1) % 3; + usb_run_isoc(sbuf->isodesc, cpia->sbuf[cpia->cursbuf].isodesc); - return 1; + return -1; } -int cpia_init_isoc(struct usb_cpia *cpia) +static int cpia_init_isoc(struct usb_cpia *cpia) { struct usb_device *dev = cpia->dev; struct usb_isoc_desc *id; int fx, err; - cpia->receivesbuf = 0; - + cpia->curframe = -1; + cpia->cursbuf = 0; cpia->scratchlen = 0; - cpia->curline = 0; - cpia->state = STATE_SCANNING; - /* ALT_ISOC is only doing double-buffering, not triple. */ - err = usb_init_isoc (dev, usb_rcvisocpipe (dev, 1), FRAMES_PER_DESC, cpia, - &cpia->sbuf[0].isodesc); - if (err) - printk ("cpia_init_isoc: usb_init_isoc() ret. %d\n", err); - err = usb_init_isoc (dev, usb_rcvisocpipe (dev, 1), FRAMES_PER_DESC, cpia, - &cpia->sbuf[1].isodesc); - if (err) - printk ("cpia_init_isoc: usb_init_isoc() ret. %d\n", err); + /* We double buffer the Iso lists */ + err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, + cpia, &cpia->sbuf[0].isodesc); + if (err) { + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + err); + return -ENOMEM; + } - if (!cpia->sbuf[0].isodesc || !cpia->sbuf[1].isodesc) { - if (cpia->sbuf[0].isodesc) - usb_free_isoc (cpia->sbuf[0].isodesc); - if (cpia->sbuf[1].isodesc) - usb_free_isoc (cpia->sbuf[1].isodesc); + err = usb_init_isoc(dev, usb_rcvisocpipe(dev, 1), FRAMES_PER_DESC, + cpia, &cpia->sbuf[1].isodesc); + if (err) { + printk(KERN_ERR "cpia_init_isoc: usb_init_isoc() ret %d\n", + err); + usb_free_isoc (cpia->sbuf[0].isodesc); return -ENOMEM; } -#if 0 - cpia->sbuf[0].isodesc = usb_allocate_isochronous(dev, usb_rcvisocpipe(dev,1), cpia->sbuf[0].data, STREAM_BUF_SIZE, 960, cpia_isoc_irq, cpia); - cpia->sbuf[1].isodesc = usb_allocate_isochronous(dev, usb_rcvisocpipe(dev,1), cpia->sbuf[1].data, STREAM_BUF_SIZE, 960, cpia_isoc_irq, cpia); - cpia->sbuf[2].isodesc = usb_allocate_isochronous(dev, usb_rcvisocpipe(dev,1), cpia->sbuf[2].data, STREAM_BUF_SIZE, 960, cpia_isoc_irq, cpia); -#endif #ifdef CPIA_DEBUG printk("isodesc[0] @ %p\n", cpia->sbuf[0].isodesc); printk("isodesc[1] @ %p\n", cpia->sbuf[1].isodesc); -#if 0 - printk("isodesc[2] @ %p\n", cpia->sbuf[2].isodesc); -#endif #endif /* Set the Isoc. desc. parameters. */ /* First for desc. [0] */ - id = cpia->sbuf [0].isodesc; + id = cpia->sbuf[0].isodesc; id->start_type = START_ASAP; id->callback_frames = 10; /* on every 10th frame */ id->callback_fn = cpia_isoc_irq; id->data = cpia->sbuf[0].data; id->buf_size = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC; for (fx = 0; fx < FRAMES_PER_DESC; fx++) - id->frames [fx].frame_length = FRAME_SIZE_PER_DESC; + id->frames[fx].frame_length = FRAME_SIZE_PER_DESC; /* and the desc. [1] */ - id = cpia->sbuf [1].isodesc; + id = cpia->sbuf[1].isodesc; id->start_type = 0; /* will follow the first desc. */ id->callback_frames = 10; /* on every 10th frame */ id->callback_fn = cpia_isoc_irq; id->data = cpia->sbuf[1].data; id->buf_size = FRAME_SIZE_PER_DESC * FRAMES_PER_DESC; for (fx = 0; fx < FRAMES_PER_DESC; fx++) - id->frames [fx].frame_length = FRAME_SIZE_PER_DESC; - - usb_run_isoc (cpia->sbuf[0].isodesc, NULL); - usb_run_isoc (cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc); + id->frames[fx].frame_length = FRAME_SIZE_PER_DESC; -#if 0 - usb_schedule_isochronous(dev, cpia->sbuf[0].isodesc, NULL); - usb_schedule_isochronous(dev, cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc); - usb_schedule_isochronous(dev, cpia->sbuf[2].isodesc, cpia->sbuf[1].isodesc); -#endif + usb_run_isoc(cpia->sbuf[0].isodesc, NULL); + usb_run_isoc(cpia->sbuf[1].isodesc, cpia->sbuf[0].isodesc); #ifdef CPIA_DEBUG printk("done scheduling\n"); #endif - if (usb_set_interface(cpia->dev, 1, 3)) { - printk("cpia_set_interface error\n"); - return -EINVAL; + /* Alternate interface 3 is is the biggest frame size */ + if (usb_set_interface(cpia->dev, 1, 3) < 0) { + printk("usb_set_interface error\n"); + return -EBUSY; } - usb_cpia_startstreamcap(cpia->dev); +#if 0 + if (usb_cpia_grab_frame(dev, 120) < 0) { + printk(KERN_INFO "cpia_grab_frame error\n"); + return -EBUSY; + } +#endif cpia->streaming = 1; #ifdef CPIA_DEBUG @@ -641,41 +659,102 @@ return 0; } -void cpia_stop_isoc(struct usb_cpia *cpia) +static void cpia_stop_isoc(struct usb_cpia *cpia) { - struct usb_device *dev = cpia->dev; - if (!cpia->streaming) return; cpia->streaming = 0; - /* Stop the streaming */ - usb_cpia_endstreamcap(cpia->dev); + /* Turn off continuous grab */ + if (usb_cpia_set_grab_mode(cpia->dev, 0) < 0) { + printk(KERN_INFO "cpia_set_grab_mode error\n"); + return /* -EBUSY */; + } + +#if 0 + if (usb_cpia_grab_frame(cpia->dev, 0) < 0) { + printk(KERN_INFO "cpia_grab_frame error\n"); + return /* -EBUSY */; + } +#endif /* Set packet size to 0 */ - if (usb_set_interface(cpia->dev, 1, 0)) { - printk("cpia_set_interface error\n"); + if (usb_set_interface(cpia->dev, 1, 0) < 0) { + printk(KERN_INFO "usb_set_interface error\n"); return /* -EINVAL */; } /* Unschedule all of the iso td's */ - usb_kill_isoc (cpia->sbuf[1].isodesc); - usb_kill_isoc (cpia->sbuf[0].isodesc); -#if 0 - usb_unschedule_isochronous(dev, cpia->sbuf[2].isodesc); - usb_unschedule_isochronous(dev, cpia->sbuf[1].isodesc); - usb_unschedule_isochronous(dev, cpia->sbuf[0].isodesc); -#endif + usb_kill_isoc(cpia->sbuf[1].isodesc); + usb_kill_isoc(cpia->sbuf[0].isodesc); /* Delete them all */ - usb_free_isoc (cpia->sbuf[1].isodesc); - usb_free_isoc (cpia->sbuf[0].isodesc); -#if 0 - usb_delete_isochronous(dev, cpia->sbuf[2].isodesc); - usb_delete_isochronous(dev, cpia->sbuf[1].isodesc); - usb_delete_isochronous(dev, cpia->sbuf[0].isodesc); -#endif + usb_free_isoc(cpia->sbuf[1].isodesc); + usb_free_isoc(cpia->sbuf[0].isodesc); +} + +static int cpia_new_frame(struct usb_cpia *cpia, int framenum) +{ + struct cpia_frame *frame; + int width, height; + +printk("new frame %d\n", framenum); + if (framenum == -1) { + int i; + for (i = 0; i < CPIA_NUMFRAMES; i++) + if (cpia->frame[i].grabstate == FRAME_READY) + break; + + if (i >= CPIA_NUMFRAMES) { + printk("no frame ready\n"); + return 0; + } + + framenum = i; +printk("using frame %d\n", framenum); + } + + if (cpia->curframe != -1 && cpia->curframe != framenum) + return 0; + + frame = &cpia->frame[framenum]; + width = frame->width; + height = frame->height; + + /* Make sure it's not too big */ + if (width > 352) + width = 352; + width = (width / 8) * 8; /* Multiple of 8 */ + + if (height > 288) + height = 288; + height = (height / 4) * 4; /* Multiple of 4 */ + + /* Set the ROI they want */ + if (usb_cpia_set_roi(cpia->dev, 0, width / 8, 0, height / 4) < 0) + return -EBUSY; + + if (usb_cpia_set_compression(cpia->dev, cpia->compress ? 1 : 0, 0) < 0) { + printk(KERN_INFO "cpia_set_compression error\n"); + return -EBUSY; + } + + /* We want a fresh frame every 30 we get */ + cpia->compress = (cpia->compress + 1) % 30; + + /* Grab the frame */ + if (usb_cpia_upload_frame(cpia->dev, 1) < 0) { + printk(KERN_INFO "cpia_upload_frame error\n"); + return -EBUSY; + } + + frame->grabstate = FRAME_GRABBING; + frame->scanstate = STATE_SCANNING; + + cpia->curframe = framenum; + + return 0; } /* Video 4 Linux API */ @@ -688,13 +767,14 @@ printk("cpia_open\n"); #endif + cpia->frame[0].grabstate = FRAME_UNUSED; + cpia->frame[1].grabstate = FRAME_UNUSED; + + /* Allocate memory for the frame buffers */ cpia->fbuf = rvmalloc(2 * MAX_FRAME_SIZE); if (!cpia->fbuf) goto open_err_ret; - cpia->frame[0].state = FRAME_DONE; - cpia->frame[1].state = FRAME_DONE; - cpia->frame[0].data = cpia->fbuf; cpia->frame[1].data = cpia->fbuf + MAX_FRAME_SIZE; #ifdef CPIA_DEBUG @@ -710,37 +790,17 @@ if (!cpia->sbuf[1].data) goto open_err_on1; -#if 0 - cpia->sbuf[0].data = kmalloc(STREAM_BUF_SIZE, GFP_KERNEL); - if (!cpia->sbuf[0].data) - goto open_err_on0; - - cpia->sbuf[1].data = kmalloc(STREAM_BUF_SIZE, GFP_KERNEL); - if (!cpia->sbuf[1].data) - goto open_err_on1; - - cpia->sbuf[2].data = kmalloc(STREAM_BUF_SIZE, GFP_KERNEL); - if (!cpia->sbuf[2].data) - goto open_err_on2; -#endif - #ifdef CPIA_DEBUG printk("sbuf[0] @ %p\n", cpia->sbuf[0].data); printk("sbuf[1] @ %p\n", cpia->sbuf[1].data); -#if 0 - printk("sbuf[2] @ %p\n", cpia->sbuf[2].data); -#endif #endif - cpia->curframe = -1; - cpia->receivesbuf = 0; - - usb_cpia_initstreamcap(cpia->dev, 0, 60); - err = cpia_init_isoc(cpia); if (err) goto open_err_on2; + MOD_INC_USE_COUNT; + return 0; open_err_on2: @@ -761,13 +821,12 @@ printk("cpia_close\n"); #endif - cpia_stop_isoc(cpia); + MOD_DEC_USE_COUNT; - usb_cpia_finistreamcap(cpia->dev); + cpia_stop_isoc(cpia); rvfree(cpia->fbuf, 2 * MAX_FRAME_SIZE); - kfree(cpia->sbuf[2].data); kfree(cpia->sbuf[1].data); kfree(cpia->sbuf[0].data); } @@ -791,23 +850,32 @@ { struct video_capability b; +#ifdef CPIA_DEBUG + printk("GCAP\n"); +#endif + strcpy(b.name, "CPiA USB Camera"); - b.type = VID_TYPE_CAPTURE /* | VID_TYPE_SUBCAPTURE */; + b.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE; b.channels = 1; b.audios = 0; - b.maxwidth = 176 /* 352 */; - b.maxheight = 144 /* 240 */; - b.minwidth = 176 /* (Something small?) */; - b.minheight = 144 /* " " */; + b.maxwidth = 352; /* CIF */ + b.maxheight = 288; /* " */ + b.minwidth = 176; /* QCIF */ + b.minheight = 144; /* " */ if (copy_to_user(arg, &b, sizeof(b))) return -EFAULT; + return 0; } case VIDIOCGCHAN: { struct video_channel v; +#ifdef CPIA_DEBUG + printk("GCHAN\n"); +#endif + if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; if (v.channel != 0) @@ -826,47 +894,14 @@ { int v; - if (copy_from_user(&v, arg, sizeof(v))) - return -EFAULT; - - if (v != 0) - return -EINVAL; - - return 0; - } - case VIDIOCGTUNER: - { - struct video_tuner v; - - if (copy_from_user(&v, arg, sizeof(v))) - return -EFAULT; - - if (v.tuner) - return -EINVAL; - - strcpy(v.name, "Format"); - - v.rangelow = 0; - v.rangehigh = 0; - v.flags = 0; - v.mode = VIDEO_MODE_AUTO; - - if (copy_to_user(arg, &v, sizeof(v))) - return -EFAULT; - - return 0; - } - case VIDIOCSTUNER: - { - struct video_tuner v; +#ifdef CPIA_DEBUG + printk("SCHAN\n"); +#endif if (copy_from_user(&v, arg, sizeof(v))) return -EFAULT; - if (v.tuner) - return -EINVAL; - - if (v.mode != VIDEO_MODE_AUTO) + if (v != 0) return -EINVAL; return 0; @@ -875,6 +910,10 @@ { struct video_picture p; +#ifdef CPIA_DEBUG + printk("GPICT\n"); +#endif + p.colour = 0x8000; /* Damn British people :) */ p.hue = 0x8000; p.brightness = 180 << 8; /* XXX */ @@ -895,6 +934,10 @@ { struct video_picture p; +#ifdef CPIA_DEBUG + printk("SPICT\n"); +#endif + if (copy_from_user(&p, arg, sizeof(p))) return -EFAULT; @@ -910,7 +953,7 @@ struct video_window vw; #ifdef CPIA_DEBUG - printk("VIDIOCSWIN\n"); + printk("SWIN\n"); #endif if (copy_from_user(&vw, arg, sizeof(vw))) @@ -924,6 +967,8 @@ if (vw.width != 144) return -EINVAL; + cpia->compress = 0; + return 0; } case VIDIOCGWIN: @@ -931,7 +976,7 @@ struct video_window vw; #ifdef CPIA_DEBUG - printk("VIDIOCGWIN\n"); + printk("GWIN\n"); #endif vw.x = 0; @@ -949,6 +994,9 @@ case VIDIOCGMBUF: { struct video_mbuf vm; +#ifdef CPIA_DEBUG + printk("MBUF\n"); +#endif memset(&vm, 0, sizeof(vm)); vm.size = MAX_FRAME_SIZE * 2; @@ -965,6 +1013,7 @@ { struct video_mmap vm; + if (copy_from_user((void *)&vm, (void *)arg, sizeof(vm))) return -EFAULT; @@ -980,53 +1029,85 @@ if ((vm.frame != 0) && (vm.frame != 1)) return -EINVAL; + if (cpia->frame[vm.frame].grabstate == FRAME_GRABBING) + return -EBUSY; + + /* Don't compress if the size changed */ + if ((cpia->frame[vm.frame].width != vm.width) || + (cpia->frame[vm.frame].height != vm.height)) + cpia->compress = 0; + cpia->frame[vm.frame].width = vm.width; cpia->frame[vm.frame].height = vm.height; - /* Mark it as free */ - cpia->frame[vm.frame].state = FRAME_READY; + /* Mark it as ready */ + cpia->frame[vm.frame].grabstate = FRAME_READY; - return 0; + return cpia_new_frame(cpia, vm.frame); } case VIDIOCSYNC: { int frame; +#ifdef CPIA_DEBUG + printk("SYNC\n"); +#endif + if (copy_from_user((void *)&frame, arg, sizeof(int))) return -EFAULT; #ifdef CPIA_DEBUG - printk("syncing to frame %d\n", frame); + printk("cpia: syncing to frame %d\n", frame); #endif - switch (cpia->frame[frame].state) { - case FRAME_UNUSED: - return -EINVAL; - case FRAME_READY: - case FRAME_GRABBING: - interruptible_sleep_on(&cpia->wq); - case FRAME_DONE: - cpia->frame[frame].state = FRAME_UNUSED; - break; + + switch (cpia->frame[frame].grabstate) { + case FRAME_UNUSED: + return -EINVAL; + case FRAME_READY: + case FRAME_GRABBING: +redo: + do { +printk("enter sleeping\n"); + interruptible_sleep_on(&cpia->frame[frame].wq); +printk("back from sleeping\n"); + if (signal_pending(current)) + return -EINTR; + } while (cpia->frame[frame].grabstate == + FRAME_GRABBING); + + if (cpia->frame[frame].grabstate == + FRAME_ERROR) { + int ret; + + if ((ret = cpia_new_frame(cpia, frame)) < 0) + return ret; + goto redo; + } + case FRAME_DONE: + cpia->frame[frame].grabstate = FRAME_UNUSED; + break; } + #ifdef CPIA_DEBUG - printk("synced to frame %d\n", frame); + printk("cpia: finished, synced to frame %d\n", frame); #endif - return 0; + + return cpia_new_frame(cpia, -1); } + case VIDIOCKEY: + return 0; case VIDIOCCAPTURE: return -EINVAL; case VIDIOCGFBUF: - return -EINVAL; case VIDIOCSFBUF: return -EINVAL; - case VIDIOCKEY: - return 0; - case VIDIOCGFREQ: + case VIDIOCGTUNER: + case VIDIOCSTUNER: return -EINVAL; + case VIDIOCGFREQ: case VIDIOCSFREQ: return -EINVAL; case VIDIOCGAUDIO: - return -EINVAL; case VIDIOCSAUDIO: return -EINVAL; default: @@ -1037,17 +1118,14 @@ static long cpia_read(struct video_device *dev, char *buf, unsigned long count, int noblock) { +#if 0 struct usb_cpia *cpia = (struct usb_cpia *)dev; int len; +#endif #ifdef CPIA_DEBUG printk("cpia_read: %ld bytes\n", count); #endif -#if 0 - len = cpia_capture(cpia, buf, count); - - return len; -#endif return 0; } @@ -1064,17 +1142,17 @@ return -EINVAL; pos = (unsigned long)cpia->fbuf; - while (size > 0) - { - page = kvirt_to_phys(pos); + while (size > 0) { + page = kvirt_to_pa(pos); if (remap_page_range(start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; - start+=PAGE_SIZE; - pos+=PAGE_SIZE; + + start += PAGE_SIZE; + pos += PAGE_SIZE; if (size > PAGE_SIZE) - size-=PAGE_SIZE; + size -= PAGE_SIZE; else - size=0; + size = 0; } return 0; @@ -1097,87 +1175,92 @@ 0 }; -static void usb_cpia_configure(struct usb_cpia *cpia) +static int usb_cpia_configure(struct usb_cpia *cpia) { struct usb_device *dev = cpia->dev; unsigned char version[4]; - unsigned char pnpid[6]; - unsigned char camerastat[8]; - unsigned char *buf; - if (usb_set_configuration(dev, dev->config[0].bConfigurationValue)) { - printk (KERN_INFO " Failed usb_set_configuration: CPIA\n"); - return; + if (usb_set_configuration(dev, dev->config[0].bConfigurationValue) < 0) { + printk(KERN_INFO "cpia: usb_set_configuration failed\n"); + return -EBUSY; } - if (usb_cpia_get_version(dev, version)) { - printk("cpia_get_version error\n"); - return; + /* Set packet size to 0 */ + if (usb_set_interface(dev, 1, 0) < 0) { + printk(KERN_INFO "usb_set_interface error\n"); + return -EBUSY; } - printk("cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", - version[0], version[1], version[2], version[3]); - - if (usb_cpia_get_pnp_id(dev, pnpid)) { - printk("cpia_get_pnp_id error\n"); - return; + if (usb_cpia_get_version(dev, version) < 0) { + printk(KERN_INFO "cpia_get_version error\n"); + return -EBUSY; } - printk("cpia: PnP Id: Vendor: %X, Product: %X, Revision: %X\n", - (pnpid[1] << 8) + pnpid[0], (pnpid[3] << 8) + pnpid[2], - (pnpid[5] << 8) + pnpid[4]); + printk("cpia: Firmware v%d.%d, VC Hardware v%d.%d\n", + version[0], version[1], version[2], version[3]); memcpy(&cpia->vdev, &cpia_template, sizeof(cpia_template)); - init_waitqueue_head(&cpia->wq); + init_waitqueue_head(&cpia->frame[0].wq); + init_waitqueue_head(&cpia->frame[1].wq); if (video_register_device(&cpia->vdev, VFL_TYPE_GRABBER) == -1) { - printk("video_register_device failed\n"); - return; + printk(KERN_INFO "video_register_device failed\n"); + return -EBUSY; } - if (usb_cpia_goto_hi_power(dev)) { - printk("cpia_goto_hi_power error\n"); - return; + if (usb_cpia_goto_hi_power(dev) < 0) { + printk(KERN_INFO "cpia_goto_hi_power error\n"); + goto error; } - if (usb_cpia_get_vp_version(dev, version)) { - printk("cpia_get_vp_version error\n"); - return; + if (usb_cpia_get_vp_version(dev, version) < 0) { + printk(KERN_INFO "cpia_get_vp_version error\n"); + goto error; } printk("cpia: VP v%d rev %d\n", version[0], version[1]); printk("cpia: Camera Head ID %04X\n", (version[3] << 8) + version[2]); - /* Turn off continuous grab */ - if (usb_cpia_set_grab_mode(dev, 1)) { - printk("cpia_set_grab_mode error\n"); - return; + /* Turn on continuous grab */ + if (usb_cpia_set_grab_mode(dev, 1) < 0) { + printk(KERN_INFO "cpia_set_grab_mode error\n"); + goto error; } /* Set up the sensor to be 30fps */ - if (usb_cpia_set_sensor_fps(dev, 1, 0)) { - printk("cpia_set_sensor_fps error\n"); - return; + if (usb_cpia_set_sensor_fps(dev, 1, 0) < 0) { + printk(KERN_INFO "cpia_set_sensor_fps error\n"); + goto error; } - /* Set video into QCIF mode, and order into YUYV mode */ - if (usb_cpia_set_format(dev, CPIA_QCIF, 1, CPIA_YUYV)) { - printk("cpia_set_format error\n"); - return; + /* Set video into CIF mode, and order into YUYV mode */ + if (usb_cpia_set_format(dev, CPIA_CIF, 1, CPIA_YUYV) < 0) { + printk(KERN_INFO "cpia_set_format error\n"); + goto error; } /* Turn off compression */ - if (usb_cpia_set_compression(dev, 0, 0)) { - printk("cpia_set_compression error\n"); - return; + if (usb_cpia_set_compression(dev, 0, 0) < 0) { + printk(KERN_INFO "cpia_set_compression error\n"); + goto error; } + + cpia->compress = 0; + + return 0; + +error: + video_unregister_device(&cpia->vdev); + + kfree(cpia); + + return -EBUSY; } static int cpia_probe(struct usb_device *dev) { struct usb_interface_descriptor *interface; - struct usb_endpoint_descriptor *endpoint; struct usb_cpia *cpia; /* We don't handle multi-config cameras */ @@ -1191,6 +1274,8 @@ return -1; if (dev->descriptor.idProduct != 0x0002) return -1; + + /* Checking vendor/product should be enough, but what the hell */ if (interface->bInterfaceClass != 0xFF) return -1; if (interface->bInterfaceSubClass != 0x00) @@ -1209,9 +1294,7 @@ dev->private = cpia; cpia->dev = dev; - usb_cpia_configure(cpia); - - return 0; + return usb_cpia_configure(cpia); } static void cpia_disconnect(struct usb_device *dev) @@ -1231,9 +1314,6 @@ { NULL, NULL } }; -/* - * This should be a separate module. - */ int usb_cpia_init(void) { usb_register(&cpia_driver); @@ -1241,6 +1321,11 @@ return 0; } +void usb_cpia_cleanup(void) +{ + usb_deregister(&cpia_driver); +} + #ifdef MODULE int init_module(void) { @@ -1249,6 +1334,7 @@ void cleanup_module(void) { + usb_cpia_cleanup(); } #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/cpia.h linux.ac/drivers/usb/cpia.h --- linux.vanilla/drivers/usb/cpia.h Tue Sep 7 22:07:06 1999 +++ linux.ac/drivers/usb/cpia.h Wed Sep 15 23:54:19 1999 @@ -78,9 +78,10 @@ #define CPIA_YUYV 0 #define CPIA_UYVY 1 -#define STREAM_BUF_SIZE (PAGE_SIZE * 4) +#define STREAM_BUF_SIZE (PAGE_SIZE * 4) +/* #define STREAM_BUF_SIZE (FRAMES_PER_DESC * FRAME_SIZE_PER_DESC) */ -#define SCRATCH_BUF_SIZE (STREAM_BUF_SIZE * 2) +#define SCRATCH_BUF_SIZE (STREAM_BUF_SIZE * 2) #define FRAMES_PER_DESC 10 #define FRAME_SIZE_PER_DESC 960 /* Shouldn't be hardcoded */ @@ -91,54 +92,97 @@ STATE_LINES, /* Parsing lines */ }; +#define CPIA_MAGIC 0x1968 +struct cpia_frame_header { + __u16 magic; /* 0 - 1 */ + __u16 timestamp; /* 2 - 3 */ + __u16 unused; /* 4 - 5 */ + __u16 timestamp1; /* 6 - 7 */ + __u8 unused1[8]; /* 8 - 15 */ + __u8 video_size; /* 16 0 = QCIF, 1 = CIF */ + __u8 sub_sample; /* 17 0 = 4:2:0, 1 = 4:2:2 */ + __u8 yuv_order; /* 18 0 = YUYV, 1 = UYVY */ + __u8 unused2[5]; /* 19 - 23 */ + __u8 col_start; /* 24 */ + __u8 col_end; /* 25 */ + __u8 row_start; /* 26 */ + __u8 row_end; /* 27 */ + __u8 comp_enable; /* 28 0 = non compressed, 1 = compressed */ + __u8 decimation; /* 29 0 = no decimation, 1 = decimation */ + __u8 y_thresh; /* 30 */ + __u8 uv_thresh; /* 31 */ + __u8 system_state; /* 32 */ + __u8 grab_state; /* 33 */ + __u8 stream_state; /* 34 */ + __u8 fatal_error; /* 35 */ + __u8 cmd_error; /* 36 */ + __u8 debug_flags; /* 37 */ + __u8 camera_state_7; /* 38 */ + __u8 camera_state_8; /* 39 */ + __u8 cr_achieved; /* 40 */ + __u8 fr_achieved; /* 41 */ + __u8 unused3[22]; /* 42 - 63 */ +}; + struct usb_device; struct cpia_sbuf { char *data; - int len; struct usb_isoc_desc *isodesc; -#if 0 - void *isodesc; -#endif }; enum { - FRAME_READY, /* Ready to grab into */ + FRAME_UNUSED, /* Unused (no MCAPTURE) */ + FRAME_READY, /* Ready to start grabbing */ FRAME_GRABBING, /* In the process of being grabbed into */ FRAME_DONE, /* Finished grabbing, but not been synced yet */ - FRAME_UNUSED, /* Unused (no MCAPTURE) */ + FRAME_ERROR, /* Something bad happened while processing */ }; struct cpia_frame { - char *data; - int width; - int height; - int state; + char *data; /* Frame buffer */ + + struct cpia_frame_header header; /* Header from stream */ + + int width; /* Width application is expecting */ + int height; /* Height */ + + int hdrwidth; /* Width the frame actually is */ + int hdrheight; /* Height */ + + int grabstate; /* State of grabbing */ + int scanstate; /* State of scanning */ + + int curline; /* Line of frame we're working on */ + + wait_queue_head_t wq; /* Processes waiting */ }; +#define CPIA_NUMFRAMES 2 +#define CPIA_NUMSBUF 2 + struct usb_cpia { struct video_device vdev; /* Device structure */ struct usb_device *dev; - int streaming; + int streaming; /* Are we streaming Isochronous? */ + int grabbing; /* Are we grabbing? */ - char *fbuf; /* Videodev buffer area */ + int compress; /* Should the next frame be compressed? */ - int curframe; - struct cpia_frame frame[2]; /* Double buffering */ + char *fbuf; /* Videodev buffer area */ - int receivesbuf; /* Current receiving sbuf */ - struct cpia_sbuf sbuf[3]; /* Triple buffering */ + int curframe; + struct cpia_frame frame[CPIA_NUMFRAMES]; /* Double buffering */ - int state; /* Current scanning state */ - int curline; + int cursbuf; /* Current receiving sbuf */ + struct cpia_sbuf sbuf[CPIA_NUMSBUF]; /* Double buffering */ - char scratch[SCRATCH_BUF_SIZE]; + /* Scratch space from the Isochronous pipe */ + unsigned char scratch[SCRATCH_BUF_SIZE]; int scratchlen; - - wait_queue_head_t wq; }; #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ezusb.c linux.ac/drivers/usb/ezusb.c --- linux.vanilla/drivers/usb/ezusb.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/ezusb.c Thu Sep 16 16:30:36 1999 @@ -40,7 +40,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include "usb.h" @@ -225,7 +229,7 @@ unsigned long flags; spin_lock_irqsave(&ez->lock, flags); - if (!list_empty(&ez->async_pending)) { + if (!list_empty(&ez->async_completed)) { as = list_entry(ez->async_pending.next, struct async, asynclist); list_del(&as->asynclist); INIT_LIST_HEAD(&as->asynclist); @@ -285,7 +289,7 @@ dr.value = pos; dr.index = 0; dr.length = len; - i = ez->usbdev->bus->op->control_msg(ez->usbdev, usb_rcvctrlpipe(ez->usbdev, 0), &dr, b, len); + i = ez->usbdev->bus->op->control_msg(ez->usbdev, usb_rcvctrlpipe(ez->usbdev, 0), &dr, b, len, HZ); if (i) { up(&ez->mutex); printk(KERN_WARNING "ezusb: upload failed pos %u len %u ret %d\n", dr.value, dr.length, i); @@ -346,7 +350,7 @@ dr.value = pos; dr.index = 0; dr.length = len; - i = ez->usbdev->bus->op->control_msg(ez->usbdev, usb_sndctrlpipe(ez->usbdev, 0), &dr, b, len); + i = ez->usbdev->bus->op->control_msg(ez->usbdev, usb_sndctrlpipe(ez->usbdev, 0), &dr, b, len, HZ); if (i) { up(&ez->mutex); printk(KERN_WARNING "ezusb: download failed pos %u len %u ret %d\n", dr.value, dr.length, i); @@ -429,8 +433,8 @@ } } } - i = usb_control_msg(usbdev, pipe, request, requesttype, value, index, tbuf, length); - if (i < 0) { + i = usb_control_msg(usbdev, pipe, request, requesttype, value, index, tbuf, length, HZ); + if (i) { if (length > 0) free_page((unsigned long)tbuf); printk(KERN_WARNING "ezusb: EZUSB_CONTROL failed rqt %u rq %u len %u ret %d\n", @@ -473,8 +477,8 @@ } } } - ret = usbdev->bus->op->bulk_msg(usbdev, pipe, tbuf, length, &len2); - if (ret < 0) { + ret = usbdev->bus->op->bulk_msg(usbdev, pipe, tbuf, length, &len2, HZ*5); + if (ret) { if (length > 0) free_page((unsigned long)tbuf); printk(KERN_WARNING "ezusb: EZUSB_BULK failed ep 0x%x len %u ret %d\n", @@ -501,14 +505,14 @@ static int ezusb_setinterface(struct usb_device *usbdev, unsigned int interface, unsigned int altsetting) { - if (usb_set_interface(usbdev, interface, altsetting) < 0) + if (usb_set_interface(usbdev, interface, altsetting)) return -EINVAL; return 0; } static int ezusb_setconfiguration(struct usb_device *usbdev, unsigned int config) { - if (usb_set_configuration(usbdev, config) < 0) + if (usb_set_configuration(usbdev, config)) return -EINVAL; return 0; } @@ -628,8 +632,7 @@ printk(KERN_DEBUG "ezusb: usb_init_isoc error %d\n", i); goto err_inval; } - as->desc.iso->start_type = START_ABSOLUTE; - as->desc.iso->start_frame = ai->startframe; + as->desc.iso->start_type = START_ASAP; as->desc.iso->callback_frames = 0; as->desc.iso->callback_fn = async_completed; as->desc.iso->data = as->data; @@ -940,12 +943,12 @@ } ez->usbdev = usbdev; usbdev->private = ez; - if (usb_set_configuration(usbdev, usbdev->config[0].bConfigurationValue) < 0) { + if (usb_set_configuration(usbdev, usbdev->config[0].bConfigurationValue)) { printk(KERN_ERR "ezusb: set_configuration failed\n"); goto err; } interface = &usbdev->config[0].interface[0].altsetting[1]; - if (usb_set_interface(usbdev, 0, 1) < 0) { + if (usb_set_interface(usbdev, 0, 1)) { printk(KERN_ERR "ezusb: set_interface failed\n"); goto err; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ezusb.h linux.ac/drivers/usb/ezusb.h --- linux.vanilla/drivers/usb/ezusb.h Tue Sep 7 22:07:06 1999 +++ linux.ac/drivers/usb/ezusb.h Thu Sep 16 16:30:36 1999 @@ -43,58 +43,45 @@ void *data; }; +#define EZUSB_CONTROL _IOWR('E', 0, struct ezusb_ctrltransfer) + struct ezusb_bulktransfer { unsigned int ep; unsigned int len; void *data; }; +#define EZUSB_BULK _IOWR('E', 2, struct ezusb_bulktransfer) + +#define EZUSB_RESETEP _IOR('E', 3, unsigned int) + struct ezusb_setinterface { unsigned int interface; unsigned int altsetting; }; -struct ezusb_isoframestat { - unsigned int length; - unsigned int status; -}; - -struct ezusb_asynccompleted { - int status; - unsigned length; - void *context; - struct ezusb_isoframestat isostat[0]; -}; +#define EZUSB_SETINTERFACE _IOR('E', 4, struct ezusb_setinterface) -struct ezusb_asyncbulk { +struct ezusb_isotransfer { unsigned int ep; - unsigned int len; - void *context; - void *data; + unsigned int pktsz; + unsigned int framesperint; }; -struct ezusb_asynciso { +struct ezusb_isodata { unsigned int ep; - - unsigned int framecnt; - unsigned int startframe; - - void *context; + unsigned int size; + unsigned int bufqueued; + unsigned int buffree; void *data; - struct ezusb_isoframestat isostat[0]; }; -#define EZUSB_CONTROL _IOWR('E', 0, struct ezusb_ctrltransfer) -#define EZUSB_BULK _IOWR('E', 2, struct ezusb_bulktransfer) -#define EZUSB_RESETEP _IOR('E', 3, unsigned int) -#define EZUSB_SETINTERFACE _IOR('E', 4, struct ezusb_setinterface) -#define EZUSB_SETCONFIGURATION _IOR('E', 5, unsigned int) -#define EZUSB_ASYNCCOMPLETED _IOW('E', 8, struct ezusb_asynccompleted) -#define EZUSB_ASYNCCOMPLETEDNB _IOW('E', 9, struct ezusb_asynccompleted) -#define EZUSB_REQUESTBULK _IOR('E', 16, struct ezusb_asyncbulk) -#define EZUSB_REQUESTISO _IOR('E', 17, struct ezusb_asynciso) -#define EZUSB_TERMINATEASYNC _IOR('E', 18, void *) -#define EZUSB_GETFRAMENUMBER _IOW('E', 18, unsigned int) +#define EZUSB_STARTISO _IOR('E', 8, struct ezusb_isotransfer) +#define EZUSB_STOPISO _IOR('E', 9, unsigned int) +#define EZUSB_ISODATA _IOWR('E', 10, struct ezusb_isodata) +#define EZUSB_PAUSEISO _IOR('E', 11, unsigned int) +#define EZUSB_RESUMEISO _IOR('E', 12, unsigned int) /* --------------------------------------------------------------------- */ #endif /* _LINUX_EZUSB_H */ + diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/hp_scanner.c linux.ac/drivers/usb/hp_scanner.c --- linux.vanilla/drivers/usb/hp_scanner.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/hp_scanner.c Thu Sep 16 16:30:36 1999 @@ -42,7 +42,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include "usb.h" @@ -130,7 +134,7 @@ return bytes_written ? bytes_written : -EINTR; } - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial); + result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev,usb_sndbulkpipe(hps->hpscan_dev, 2), obuf, thistime, &partial, HZ*10); //printk(KERN_DEBUG "write stats: result:%d thistime:%lu partial:%lu\n", result, thistime, partial); @@ -188,7 +192,7 @@ return -ENODEV; this_read = (count > IBUF_SIZE) ? IBUF_SIZE : count; - result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial); + result = hps->hpscan_dev->bus->op->bulk_msg(hps->hpscan_dev, usb_rcvbulkpipe(hps->hpscan_dev, 1), ibuf, this_read, &partial, HZ*10); printk(KERN_DEBUG "read stats: result:%d this_read:%u partial:%lu\n", result, this_read, partial); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/hub.c linux.ac/drivers/usb/hub.c --- linux.vanilla/drivers/usb/hub.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/hub.c Sat Sep 18 01:50:17 1999 @@ -12,7 +12,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include @@ -34,33 +38,33 @@ { return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB, - USB_DT_HUB << 8, 0, data, size); + USB_DT_HUB << 8, 0, data, size, HZ); } static int usb_clear_port_feature(struct usb_device *dev, int port, int feature) { return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0); + USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ); } static int usb_set_port_feature(struct usb_device *dev, int port, int feature) { return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0); + USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ); } static int usb_get_hub_status(struct usb_device *dev, void *data) { /* FIXME: Don't hardcode 4 */ return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), - USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0, data, 4); + USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0, data, 4, HZ); } static int usb_get_port_status(struct usb_device *dev, int port, void *data) { /* FIXME: Don't hardcode 4 */ return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), - USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port, data, 4); + USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port, data, 4, HZ); } /* diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/keyboard.c linux.ac/drivers/usb/keyboard.c --- linux.vanilla/drivers/usb/keyboard.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/keyboard.c Sat Sep 18 01:53:21 1999 @@ -21,7 +21,7 @@ #define PCKBD_RELEASED 0x80 #define PCKBD_NEEDS_E0 0x80 -#define USBKBD_MODIFIER_BASE 120 +#define USBKBD_MODIFIER_BASE 224 #define USBKBD_KEYCODE_OFFSET 2 #define USBKBD_KEYCODE_COUNT 6 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/keymap.c linux.ac/drivers/usb/keymap.c --- linux.vanilla/drivers/usb/keymap.c Mon May 24 17:31:36 1999 +++ linux.ac/drivers/usb/keymap.c Thu Sep 16 16:30:36 1999 @@ -22,7 +22,7 @@ 0xbd, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1d, 0x2a, 0x38, 0xdb, 0x9d, 0x36, 0xb8, 0xdc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -42,7 +42,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x2a, 0x38, 0xdb, 0x9d, 0x36, 0xb8, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/mouse.c linux.ac/drivers/usb/mouse.c --- linux.vanilla/drivers/usb/mouse.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/mouse.c Sat Sep 18 01:50:29 1999 @@ -40,7 +40,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include "usb.h" @@ -120,7 +124,11 @@ wake_up_interruptible(&mouse->wait); if (mouse->fasync) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) + kill_fasync(mouse->fasync, SIGIO, POLL_IN); +#else kill_fasync(mouse->fasync, SIGIO); +#endif return 1; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ohci-debug.c linux.ac/drivers/usb/ohci-debug.c --- linux.vanilla/drivers/usb/ohci-debug.c Thu Aug 5 20:30:23 1999 +++ linux.ac/drivers/usb/ohci-debug.c Thu Sep 16 16:30:36 1999 @@ -80,7 +80,7 @@ printk(KERN_DEBUG " ohci ED:\n"); printk(KERN_DEBUG " status = 0x%x\n", stat); - printk(KERN_DEBUG " %sMPS %d%s%s%s%s tc%d e%d fa%d%s\n", + printk(KERN_DEBUG " %sMPS %d%s%s%s%s tc%d e%d fa%d [HCD_%d%s]\n", skip ? "Skip " : "", mps, isoc ? " Isoc." : "", @@ -91,7 +91,8 @@ toggle, endnum, funcaddr, - (stat & ED_ALLOCATED) ? " Allocated" : ""); + ohci_ed_hcdtype(ed) >> 27, + (stat & ED_ALLOCATED) ? ", Allocated" : ""); printk(KERN_DEBUG " tail_td = 0x%x\n", ed_tail_td(ed)); printk(KERN_DEBUG " head_td = 0x%x\n", ed_head_td(ed)); printk(KERN_DEBUG " next_ed = 0x%x\n", le32_to_cpup(&ed->next_ed)); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ohci-hcd.c linux.ac/drivers/usb/ohci-hcd.c --- linux.vanilla/drivers/usb/ohci-hcd.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/ohci-hcd.c Thu Sep 16 16:30:36 1999 @@ -14,7 +14,7 @@ * [ Open Host Controller Interface driver for USB. ] * [ (C) Copyright 1999 Linus Torvalds (uhci.c) ] * [ (C) Copyright 1999 Gregory P. Smith ] - * [ $Log: ohci.c,v $ ] + * [ _Log: ohci-hcd.c,v _ * [ Revision 1.1 1999/04/05 08:32:30 greg ] * * v4.2 1999/09/05 ISO API alpha, new dev alloc, neg Error-codes @@ -47,7 +47,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include @@ -224,7 +228,7 @@ return 0; } -static int sohci_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len) +static int sohci_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len, int timeout) { DECLARE_WAITQUEUE(wait, current); struct ohci_state state = {0, TD_NOTACCESSED}; @@ -254,7 +258,7 @@ OHCI_DEBUG(printk("USB HC trans req ed %x: %x :", ed->hwINFO, (unsigned int ) ed); ) OHCI_DEBUG({ int i; for( i= 0; i<8 ;i++) printk(" %4x", ((unsigned int *) ed)[i]) ; printk("\n"); }; ) if (ED_STATE(ed) != ED_OPER) ohci_link_ed(ohci, ed); - schedule_timeout(HZ*5); + schedule_timeout(timeout); if(state.status == TD_NOTACCESSED) { current->state = TASK_UNINTERRUPTIBLE; @@ -266,7 +270,7 @@ return state.status; } -static int sohci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *rval) +static int sohci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *rval, int timeout) { DECLARE_WAITQUEUE(wait, current); struct ohci_state state = {0, TD_NOTACCESSED}; @@ -286,7 +290,7 @@ ohci_trans_req(ohci, ed, 0, NULL, data, len, (__OHCI_BAG) &state, (__OHCI_BAG) &wait,(usb_pipeout(pipe))?BULK_OUT:BULK_IN, sohci_blocking_handler); if (ED_STATE(ed) != ED_OPER) ohci_link_ed(ohci, ed); - schedule_timeout(HZ*5); + schedule_timeout(timeout); if(state.status == TD_NOTACCESSED) { current->state = TASK_UNINTERRUPTIBLE; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ohci-hcd.h linux.ac/drivers/usb/ohci-hcd.h --- linux.vanilla/drivers/usb/ohci-hcd.h Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/ohci-hcd.h Thu Sep 16 17:14:50 1999 @@ -12,7 +12,7 @@ * [ Open Host Controller Interface driver for USB. ] * [ (C) Copyright 1999 Linus Torvalds (uhci.c) ] * [ (C) Copyright 1999 Gregory P. Smith ] - * [ $Log: ohci.c,v $ ] + * [ _Log: ohci-hcd.h,v _ * [ Revision 1.1 1999/04/05 08:32:30 greg ] * * v4.0 1999/08/18 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ohci.c linux.ac/drivers/usb/ohci.c --- linux.vanilla/drivers/usb/ohci.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/ohci.c Thu Sep 16 16:30:36 1999 @@ -15,7 +15,7 @@ * Architecture" book by Mindshare, Inc. It was a reasonable introduction * and overview of USB and the two dominant host controller interfaces * however you're better off just reading the real specs available - * from www.usb.org as you'll need them to get enough detailt to + * from www.usb.org as you'll need them to get enough details to * actually implement a HCD. The book has many typos and omissions * Beware, the specs are the victim of a committee. * @@ -24,7 +24,7 @@ * * No filesystems were harmed in the development of this code. * - * $Id: ohci.c,v 1.43 1999/05/16 22:35:24 greg Exp $ + * $Id: ohci.c,v 1.77 1999/09/16 04:30:19 greg Exp $ */ #include @@ -37,7 +37,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include @@ -201,7 +205,6 @@ spin_unlock_irqrestore(&ohci_edtd_lock, flags); } /* ohci_add_ed_to_hw() */ - /* * Put a control ED on the controller's list */ @@ -275,24 +278,19 @@ for (;;) { int_ed = bus_to_virt(le32_to_cpup(&int_ed->next_ed)); /* stop if we get to the end or to another dummy ED. */ - if (int_ed == 0) - break; + if (!int_ed) + break; /* return NULL */ status = le32_to_cpup(&int_ed->status); - if ((status & OHCI_ED_FA) == 0) - break; + if ((status & OHCI_ED_FA) == 0) { + int_ed = NULL; + break; /* return NULL */ + } /* check whether all the appropriate fields match */ if ((status & 0x7ffa7ff) == req_status) - return int_ed; + break; /* return int_ed */ } - return 0; -} - -/* - * Put an isochronous ED on the controller's list - */ -inline void ohci_add_isoc_ed(struct ohci *ohci, struct ohci_ed *ed) -{ - ohci_add_periodic_ed(ohci, ed, 1); + spin_unlock_irqrestore(&ohci_edtd_lock, flags); + return int_ed; } @@ -326,14 +324,14 @@ * adds it to a list of EDs to destroy during the SOF interrupt * processing would be useful (and be callable from an interrupt). */ -void ohci_wait_for_ed_safe(struct ohci_regs *regs, struct ohci_ed *ed, int ed_type) +void ohci_wait_for_ed_safe(struct ohci_regs *regs, struct ohci_ed *ed) { __u32 *hw_listcurrent; /* tell the controller to skip this ED */ ed->status |= cpu_to_le32(OHCI_ED_SKIP); - switch (ed_type) { + switch (ohci_ed_hcdtype(ed)) { case HCD_ED_CONTROL: hw_listcurrent = ®s->ed_controlcurrent; break; @@ -370,7 +368,7 @@ * * Note that the SKIP bit is left on in the removed ED. */ -void ohci_remove_norm_ed_from_hw(struct ohci *ohci, struct ohci_ed *ed, int ed_type) +void ohci_remove_norm_ed_from_hw(struct ohci *ohci, struct ohci_ed *ed) { unsigned long flags; struct ohci_regs *regs = ohci->regs; @@ -378,6 +376,7 @@ __u32 bus_ed = virt_to_bus(ed); __u32 bus_cur; __u32 *hw_listhead_p; + __u32 ed_type = ohci_ed_hcdtype(ed); if (ed == NULL || !bus_ed) return; @@ -391,7 +390,9 @@ hw_listhead_p = ®s->ed_bulkhead; break; default: - printk(KERN_ERR "Unknown HCD ED type %d.\n", ed_type); +#ifdef OHCI_DEBUG + printk(KERN_ERR "Wrong HCD ED type: %d.\n", ed_type); +#endif return; } @@ -426,7 +427,7 @@ /* * Make sure this ED is not being accessed by the HC as we speak. */ - ohci_wait_for_ed_safe(regs, ed, ed_type); + ohci_wait_for_ed_safe(regs, ed); /* clear any links from the ED for safety */ ed->next_ed = 0; @@ -434,24 +435,6 @@ spin_unlock_irqrestore(&ohci_edtd_lock, flags); } /* ohci_remove_norm_ed_from_hw() */ -/* - * Remove an ED from the controller's control list. Note that the SKIP bit - * is left on in the removed ED. - */ -inline void ohci_remove_control_ed(struct ohci *ohci, struct ohci_ed *ed) -{ - ohci_remove_norm_ed_from_hw(ohci, ed, HCD_ED_CONTROL); -} - -/* - * Remove an ED from the controller's bulk list. Note that the SKIP bit - * is left on in the removed ED. - */ -inline void ohci_remove_bulk_ed(struct ohci *ohci, struct ohci_ed *ed) -{ - ohci_remove_norm_ed_from_hw(ohci, ed, HCD_ED_BULK); -} - /* * Remove a periodic ED from the host controller @@ -476,7 +459,7 @@ while (cur_ed) { if (ed == cur_ed) { /* remove the ED */ /* set its SKIP bit and be sure its not in use */ - ohci_wait_for_ed_safe(ohci->regs, ed, HCD_ED_INT); + ohci_wait_for_ed_safe(ohci->regs, ed); /* unlink it */ spin_lock_irqsave(&ohci_edtd_lock, flags); @@ -506,6 +489,20 @@ /* + * Remove an ED from the host controller, choosing + */ +void ohci_remove_ed(struct ohci *ohci, struct ohci_ed *ed) +{ + /* Remove the ED from the HC */ + if (ohci_ed_hcdtype(ed) & HCD_ED_NORMAL) { + ohci_remove_norm_ed_from_hw(ohci, ed); + } else { + ohci_remove_periodic_ed(ohci, ed); + } +} /* ohci_remove_ed() */ + + +/* * Remove all the EDs which have a given device address from a list. * Used when the device is unplugged. * Returns 1 if anything was changed. @@ -573,7 +570,7 @@ * Remove a TD from the given EDs TD list. The TD is freed as well. * (so far this function hasn't been needed) */ -static void ohci_remove_td_from_ed(struct ohci_td *td, struct ohci_ed *ed) +void ohci_remove_td_from_ed(struct ohci_td *td, struct ohci_ed *ed) { unsigned long flags; struct ohci_td *head_td; @@ -670,10 +667,9 @@ * pool. Return NULL if none are left. * * NOTE: This function does not allocate and attach the dummy_td. - * That is done in ohci_fill_ed(). FIXME: it should probably be moved - * into here. + * That is done in ohci_fill_ed(). [should we really do that here?] */ -static struct ohci_ed *ohci_get_free_ed(struct ohci_device *dev) +static struct ohci_ed *ohci_get_free_ed(struct ohci_device *dev, __u32 ed_type) { int idx; @@ -687,6 +683,7 @@ new_ed->status |= cpu_to_le32(OHCI_ED_SKIP); /* mark it as allocated */ allocate_ed(new_ed); + ohci_ed_set_hcdtype(new_ed, ed_type); new_ed->ohci_dev = dev; return new_ed; } @@ -764,8 +761,7 @@ * force the Allocated bit on. */ struct ohci_ed *ohci_fill_ed(struct ohci_device *dev, struct ohci_ed *ed, - int maxpacketsize, int lowspeed, int endp_id, - int isoc_tds) + int maxpacketsize, int lowspeed, int endp_id) { struct ohci_td *dummy_td; @@ -789,11 +785,12 @@ /* set the head TD to the dummy and clear the Carry & Halted bits */ ed->_head_td = ed->tail_td; - ed->status = cpu_to_le32( + ed->status &= cpu_to_le32(OHCI_ED_HCD_MASK); + ed->status |= cpu_to_le32( ed_set_maxpacket(maxpacketsize) | ed_set_speed(lowspeed) | (endp_id & 0x7ff) | - ((isoc_tds == 0) ? OHCI_ED_F_NORM : OHCI_ED_F_ISOC)); + ((ohci_ed_hcdtype(ed) != HCD_ED_ISOC) ? OHCI_ED_F_NORM : OHCI_ED_F_ISOC)); allocate_ed(ed); ed->next_ed = 0; @@ -959,7 +956,7 @@ /* Get an ED and TD */ interrupt_ed = ohci_get_periodic_ed(dev, period, pipe, 0); if (interrupt_ed == 0) { - interrupt_ed = ohci_get_free_ed(dev); + interrupt_ed = ohci_get_free_ed(dev, HCD_ED_INT); if (!interrupt_ed) { printk(KERN_ERR "Out of EDs on device %p in ohci_request_irq\n", dev); return (-ENOMEM); @@ -970,7 +967,7 @@ * device number (function address), and type of TD. */ ohci_fill_ed(dev, interrupt_ed, maxps, usb_pipeslow(pipe), - usb_pipe_endpdev(pipe), 0 /* normal TDs */); + usb_pipe_endpdev(pipe) ); interrupt_ed->status &= cpu_to_le32(~OHCI_ED_SKIP); /* Assimilate the new ED into the collective */ @@ -1077,7 +1074,7 @@ static void * ohci_generic_trans(struct usb_device *usb_dev, int pipe, int data_td_toggle, int round, int autofree, void *dev_id, usb_device_irq handler, void *data, int len, - int ed_type, struct ohci_td *setup_td, struct ohci_td *status_td) + __u32 ed_type, struct ohci_td *setup_td, struct ohci_td *status_td) { struct ohci_device *dev = usb_to_ohci(usb_dev); struct ohci_ed *trans_ed; @@ -1089,7 +1086,7 @@ printk(KERN_DEBUG "ohci_request_trans()\n"); #endif - trans_ed = ohci_get_free_ed(dev); + trans_ed = ohci_get_free_ed(dev, ed_type); if (!trans_ed) { printk("usb-ohci: couldn't get ED for dev %p\n", dev); return NULL; @@ -1142,8 +1139,7 @@ ohci_fill_ed(dev, trans_ed, usb_maxpacket(usb_dev, pipe, usb_pipeout(pipe)), usb_pipeslow(pipe), - usb_pipe_endpdev(pipe), - (ed_type == HCD_ED_ISOC) ); + usb_pipe_endpdev(pipe) ); /* initialize the toggle carry flag in the ED */ if (usb_gettoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe))) @@ -1202,7 +1198,7 @@ * * This function is NOT safe to call from an interrupt. */ -static int ohci_terminate_trans(struct usb_device *usb_dev, void *handle, int ed_type) +static int ohci_terminate_trans(struct usb_device *usb_dev, void *handle) { struct ohci_ed *req_ed = (struct ohci_ed *) handle; struct ohci_device *dev = usb_to_ohci(usb_dev); @@ -1213,20 +1209,10 @@ /* stop the transfer & collect the number of bytes */ /* (this is the non-interrupt safe function call) */ - ohci_wait_for_ed_safe(regs, req_ed, ed_type); + ohci_wait_for_ed_safe(regs, req_ed); - /* Remove the ED from the appropriate HC list */ - switch (ed_type) { - case HCD_ED_ISOC: - ohci_remove_periodic_ed(dev->ohci, req_ed); - break; - case HCD_ED_CONTROL: - ohci_remove_control_ed(dev->ohci, req_ed); - break; - case HCD_ED_BULK: - ohci_remove_bulk_ed(dev->ohci, req_ed); - break; - } + /* Remove the ED from the HC */ + ohci_remove_ed(dev->ohci, req_ed); ohci_free_ed(req_ed); /* return it to the pool */ @@ -1252,7 +1238,15 @@ /* pass the TDs completion status back to control_msg */ if (dev_id) { int *completion_status = (int *)dev_id; - *completion_status = stats; + + switch (stats) { + case USB_ST_NOERROR: + case USB_ST_DATAOVERRUN: + *completion_status = len; + break; + default: + *completion_status = -stats; + } } wake_up(&control_wakeup); @@ -1274,13 +1268,13 @@ * This function can NOT be called from an interrupt. */ static int ohci_control_msg(struct usb_device *usb_dev, unsigned int pipe, - devrequest *cmd, void *data, int len) + devrequest *cmd, void *data, int len, int timeout) { struct ohci_device *dev = usb_to_ohci(usb_dev); void *trans_handle; struct ohci_td *setup_td, *status_td; DECLARE_WAITQUEUE(wait, current); - int completion_status = -1; + int completion_status = USB_ST_TIMEOUT; devrequest our_cmd; /* byte-swap fields of cmd if necessary */ @@ -1356,8 +1350,8 @@ return USB_ST_INTERNALERROR; } - /* wait a "reasonable" amount of time for it to complete */ - schedule_timeout(HZ); + /* wait a user defined amount of time for it to complete */ + schedule_timeout(timeout); remove_wait_queue(&control_wakeup, &wait); @@ -1369,9 +1363,12 @@ * Also, since the TDs were autofreed, there is no guarantee that * they haven't been reclaimed by another transfer by now... */ - if (completion_status != 0) { - const char *what = (completion_status < 0)? "timed out": - cc_names[completion_status & 0xf]; + if (completion_status < 0) { + const char *what; + if (completion_status == USB_ST_TIMEOUT) + what = "timed out"; + else + what = cc_names[(-completion_status) & 0xf]; printk(KERN_ERR "ohci_control_msg: %s on pipe %x cmd %x %x %x %x %x", what, pipe, cmd->requesttype, cmd->request, cmd->value, cmd->index, cmd->length); @@ -1422,10 +1419,8 @@ /* no TD cleanup, the TDs were auto-freed as they finished */ /* remove the generic_trans ED from the HC and free it */ - ohci_terminate_trans(usb_dev, trans_handle, HCD_ED_CONTROL); + ohci_terminate_trans(usb_dev, trans_handle); - if (completion_status < 0) - completion_status = USB_ST_TIMEOUT; return completion_status; } /* ohci_control_msg() */ @@ -1471,7 +1466,7 @@ */ static int ohci_terminate_bulk(struct usb_device *usb_dev, void * handle) { - return ohci_terminate_trans(usb_dev, handle, HCD_ED_CONTROL); + return ohci_terminate_trans(usb_dev, handle); } /* ohci_terminate_bulk() */ @@ -1536,24 +1531,6 @@ } /* ohci_bulk_msg_td_handler() */ -/* - * Request to send or receive bulk data for a blocking bulk_msg call. - * - * bulk_request->bytes_transferred_p is a pointer to an integer that - * will be set to the number of bytes that have been successfully - * transferred upon completion. The interrupt handler will update it - * after each internal TD completes successfully. - */ -static struct ohci_ed* ohci_request_bulk_msg(struct ohci_bulk_msg_request_state *bulk_request) -{ - /* initialize the internal counter */ - bulk_request->_bytes_done = 0; - - return ohci_request_bulk(bulk_request->usb_dev, bulk_request->pipe, - ohci_bulk_msg_td_handler, - bulk_request->data, bulk_request->length, - bulk_request); -} /* ohci_request_bulk_msg() */ static DECLARE_WAIT_QUEUE_HEAD(bulk_wakeup); @@ -1574,7 +1551,7 @@ } /* ohci_bulk_msg_completed() */ -static int ohci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *bytes_transferred_p) +static int ohci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *bytes_transferred_p, int timeout) { DECLARE_WAITQUEUE(wait, current); int completion_status = USB_ST_INTERNALERROR; @@ -1598,6 +1575,7 @@ req.bytes_transferred_p = bytes_transferred_p; req.dev_id = &completion_status; req.completion = ohci_bulk_msg_completed; + req._bytes_done = 0; if (bytes_transferred_p) *bytes_transferred_p = 0; @@ -1611,10 +1589,20 @@ current->state = TASK_UNINTERRUPTIBLE; add_wait_queue(&bulk_wakeup, &wait); - req_ed = ohci_request_bulk_msg(&req); + /* + * Request to send or receive bulk data for a blocking bulk_msg call. + * + * req.bytes_transferred_p is a pointer to an integer that + * will be set to the number of bytes that have been successfully + * transferred upon completion. The interrupt handler will update it + * after each internal TD completes successfully. + */ + req_ed = ohci_request_bulk(usb_dev, pipe, + ohci_bulk_msg_td_handler, + data, len, &req); - /* FIXME this should to wait for a caller specified time... */ - schedule_timeout(HZ*5); + /* wait for a caller specified time... */ + schedule_timeout(timeout); /* completion_status will only stay in this state of the * request never finished */ @@ -1629,7 +1617,7 @@ * a previously requested bulk transfer. -greg */ /* stop the transfer & collect the number of bytes */ - ohci_wait_for_ed_safe(regs, req_ed, HCD_ED_BULK); + ohci_wait_for_ed_safe(regs, req_ed); /* Get the number of bytes transferred out of the head TD * on the ED if it didn't finish while we were waiting. */ @@ -1659,7 +1647,7 @@ remove_wait_queue(&bulk_wakeup, &wait); /* remove the ED from the HC */ - ohci_remove_bulk_ed(usb_to_ohci(usb_dev)->ohci, req_ed); + ohci_remove_norm_ed_from_hw(usb_to_ohci(usb_dev)->ohci, req_ed); /* save the toggle value back into the usb_dev */ usb_settoggle(usb_dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), @@ -1681,31 +1669,19 @@ /* - * Allocate a new USB device to be attached to an OHCI controller + * Allocate a new USB device attached to this OHCI controller */ -static struct usb_device *ohci_usb_allocate(struct usb_device *parent) +static int ohci_dev_allocate(struct usb_device *usb_dev) { - struct usb_device *usb_dev; struct ohci_device *dev; int idx; /* - * Allocate the generic USB device - */ - usb_dev = kmalloc(sizeof(*usb_dev), GFP_KERNEL); - if (!usb_dev) - return NULL; - - memset(usb_dev, 0, sizeof(*usb_dev)); - - /* * Allocate an OHCI device (EDs and TDs for this device) */ dev = kmalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - kfree(usb_dev); - return NULL; - } + if (!dev) + return -1; memset(dev, 0, sizeof(*dev)); @@ -1721,80 +1697,71 @@ usb_dev->hcpriv = dev; dev->usb = usb_dev; - /* - * Link the device to its parent (hub, etc..) if any. - */ - usb_dev->parent = parent; + if (usb_dev->parent) + dev->ohci = usb_to_ohci(usb_dev->parent)->ohci; - if (parent) { - usb_dev->bus = parent->bus; - dev->ohci = usb_to_ohci(parent)->ohci; - } - - return usb_dev; -} /* ohci_usb_allocate() */ + return 0; +} /* ohci_dev_allocate() */ /* - * Free a usb device. - * - * TODO This function needs to take better care of the EDs and TDs, etc. + * Free a usb device on this ohci controller. */ -static int ohci_usb_deallocate(struct usb_device *usb_dev) +static int ohci_dev_deallocate(struct usb_device *usb_dev) { struct ohci_device *dev = usb_to_ohci(usb_dev); ohci_remove_device(dev->ohci, usb_dev->devnum); - /* kfree(usb_to_ohci(usb_dev)); */ - /* kfree(usb_dev); */ + kfree(usb_to_ohci(usb_dev)); return 0; } - -static void *ohci_alloc_isochronous (struct usb_device *usb_dev, unsigned int pipe, void *data, int len, int maxsze, usb_device_irq completed, void *dev_id) +static int ohci_get_current_frame_number(struct usb_device *usb_dev) { - return NULL; + return USB_ST_NOTSUPPORTED; } -static void ohci_delete_isochronous (struct usb_device *dev, void *_isodesc) +static int ohci_alloc_isochronous (struct usb_device *usb_dev, +unsigned int pipe, int frame_count, void *context, +struct usb_isoc_desc **isocdesc) { - return; + return USB_ST_NOTSUPPORTED; } -static int ohci_sched_isochronous (struct usb_device *usb_dev, void *_isodesc, void *_pisodesc) +static void ohci_delete_isochronous (struct usb_isoc_desc *isocdesc) { - return USB_ST_NOTSUPPORTED; + return; } -static int ohci_unsched_isochronous (struct usb_device *usb_dev, void *_isodesc) +static int ohci_sched_isochronous (struct usb_isoc_desc *isocdesc, +struct usb_isoc_desc *pr_isocdesc) { return USB_ST_NOTSUPPORTED; } -static int ohci_compress_isochronous (struct usb_device *usb_dev, void *_isodesc) +static int ohci_unsched_isochronous (struct usb_isoc_desc *isocdesc) { return USB_ST_NOTSUPPORTED; } - /* * functions for the generic USB driver */ struct usb_operations ohci_device_operations = { - ohci_usb_allocate, - ohci_usb_deallocate, + ohci_dev_allocate, + ohci_dev_deallocate, ohci_control_msg, ohci_bulk_msg, ohci_request_irq, ohci_release_irq, ohci_request_bulk, ohci_terminate_bulk, + ohci_get_current_frame_number, ohci_alloc_isochronous, ohci_delete_isochronous, ohci_sched_isochronous, - ohci_unsched_isochronous, - ohci_compress_isochronous + ohci_unsched_isochronous }; @@ -1887,8 +1854,10 @@ /* Enter the USB Operational state & start the frames a flowing.. */ writel_set(OHCI_USB_OPER, &ohci->regs->control); - /* Enable control lists */ - writel_set(OHCI_USB_IE | OHCI_USB_CLE | OHCI_USB_BLE, &ohci->regs->control); + /* Enable control lists, claim the host controller */ + writel_set( + OHCI_USB_IE | OHCI_USB_CLE | OHCI_USB_BLE, + &ohci->regs->control); /* Force global power enable -gal@cs.uni-magdeburg.de */ /* @@ -1988,10 +1957,11 @@ /* * Allocate a device for the new thingy that's been attached */ - usb_dev = ohci_usb_allocate(root_hub->usb); - dev = usb_dev->hcpriv; + usb_dev = usb_alloc_dev(root_hub->usb, root_hub->usb->bus); + if (!usb_dev) + return; - dev->ohci = ohci; + dev = usb_dev->hcpriv; usb_connect(dev->usb); @@ -2360,6 +2330,8 @@ struct usb_bus *bus; struct ohci_device *dev; struct usb_device *usb; + struct ohci_hcca *hcca; + u32 ctrl; #if 0 printk(KERN_DEBUG "entering alloc_ohci %p\n", mem_base); @@ -2368,22 +2340,28 @@ ohci = kmalloc(sizeof(*ohci), GFP_KERNEL); if (!ohci) return NULL; - memset(ohci, 0, sizeof(*ohci)); ohci->irq = -1; ohci->regs = mem_base; INIT_LIST_HEAD(&ohci->interrupt_list); - bus = kmalloc(sizeof(*bus), GFP_KERNEL); - if (!bus) - return NULL; - - memset(bus, 0, sizeof(*bus)); + /* + * Allocate the Host Controller Communications Area on a 256 + * byte boundary. XXX take the easy way out and just grab a + * page as that's guaranteed to have a nice boundary. + */ + hcca = (struct ohci_hcca *) __get_free_page(GFP_KERNEL); + if (hcca == NULL) + goto au_free_ohci; + memset(hcca, 0, sizeof(struct ohci_hcca)); + + bus = usb_alloc_bus(&ohci_device_operations); + if (!bus) + goto au_free_hcca; ohci->bus = bus; bus->hcpriv = ohci; - bus->op = &ohci_device_operations; /* * Allocate the USB device structure and root hub. @@ -2393,25 +2371,21 @@ * a nice pool of memory with pointers to endpoint descriptors * for the different interrupts. */ - usb = ohci_usb_allocate(NULL); + usb = usb_alloc_dev(NULL, bus); if (!usb) - return NULL; + goto au_free_bus; - dev = usb_to_ohci(usb); - ohci->bus->root_hub= ohci_to_usb(dev); usb->bus = bus; + + dev = usb_to_ohci(usb); + dev->ohci = ohci; + dev->hcca = hcca; + + ohci->bus->root_hub = ohci_to_usb(dev); /* Initialize the root hub */ dev->ohci = ohci; /* link back to the controller */ - /* - * Allocate the Host Controller Communications Area on a 256 - * byte boundary. XXX take the easy way out and just grab a - * page as that's guaranteed to have a nice boundary. - */ - dev->hcca = (struct ohci_hcca *) __get_free_page(GFP_KERNEL); - memset(dev->hcca, 0, sizeof(struct ohci_hcca)); - /* Tell the controller where the HCCA is */ writel(virt_to_bus(dev->hcca), &ohci->regs->hcca); @@ -2431,6 +2405,25 @@ } printk(KERN_DEBUG "usb-ohci: %d root hub ports found\n", usb->maxchild); + + /* + * Fix up legacy mode + */ + + ctrl = readl(&ohci->regs->control); + if(ctrl&OHCI_USB_IR) + { + int ct = 0; + /* Ask SMM for the controls */ + writel(8, &ohci->regs->cmdstatus); + printk(KERN_INFO "usb-ohci: switching interface from legacy mode.\n"); + while((readl(&ohci->regs->control)&OHCI_USB_IR) && ct < 250) + { + udelay(100); + ct++; + } + } + /* * Initialize the ED polling "tree" (for simplicity's sake in * this driver many nodes in the tree will be identical) @@ -2485,6 +2478,15 @@ #endif return ohci; + +au_free_bus: + usb_free_bus(bus); +au_free_hcca: + free_page((unsigned long)hcca); +au_free_ohci: + kfree(ohci); + return NULL; + } /* alloc_ohci() */ @@ -2747,14 +2749,27 @@ */ static int init_ohci(struct pci_dev *dev) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) unsigned long mem_base = dev->resource[0].flags; /* If its OHCI, its memory */ if (mem_base & PCI_BASE_ADDRESS_SPACE_IO) return -ENODEV; + pci_set_master(dev); + /* Get the memory address and map it for IO */ mem_base = dev->resource[0].start; +#else + unsigned long mem_base = dev->base_address[0]; + + /* If its OHCI, its memory */ + if (mem_base & PCI_BASE_ADDRESS_SPACE_IO) + return -ENODEV; + + /* Get the memory address and map it for IO */ + mem_base &= PCI_BASE_ADDRESS_MEM_MASK; +#endif /* no interrupt won't work... */ if (dev->irq == 0) { diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/ohci.h linux.ac/drivers/usb/ohci.h --- linux.vanilla/drivers/usb/ohci.h Thu Aug 5 20:30:23 1999 +++ linux.ac/drivers/usb/ohci.h Sat Sep 18 19:40:11 1999 @@ -6,7 +6,7 @@ * * (C) Copyright 1999 Gregory P. Smith * - * $Id: ohci.h,v 1.24 1999/05/16 10:18:26 greg Exp $ + * $Id: ohci.h,v 1.40 1999/09/05 07:26:46 greg Exp $ */ #include @@ -148,19 +148,45 @@ #define OHCI_ED_EN (0xf << 7) #define OHCI_ED_FA (0x7f) + #define ed_get_en(ed) ((le32_to_cpup(&(ed)->status) & OHCI_ED_EN) >> 7) #define ed_get_fa(ed) (le32_to_cpup(&(ed)->status) & OHCI_ED_FA) /* NOTE: bits 27-31 of the status dword are reserved for the HCD */ +#define OHCI_ED_HCD_MASK (0x1f << 27) /* * We'll use this status flag for to mark if an ED is in use by the - * driver or not. If the bit is set, it is being used. + * driver or not. If the bit is set, it is being used. (bit 31) */ #define ED_ALLOCATED (1 << 31) #define ed_allocated(ed) (le32_to_cpup(&(ed).status) & ED_ALLOCATED) #define allocate_ed(ed) ((ed)->status |= cpu_to_le32(ED_ALLOCATED)) /* + * These store the endpoint transfer type for this ED in the status + * field. (bits 27 and 28) + * Bit 28: + * 0 = Periodic ED + * Bit 27: + * 0 = Isochronous + * 1 = Interrupt + * 1 = Normal ED + * Bit 27: + * 0 = Control + * 1 = Bulk + */ +#define HCD_ED_NORMAL (1 << 28) /* (2 << 27) */ +#define HCD_ED_ISOC (0) +#define HCD_ED_INT (1 << 27) +#define HCD_ED_CONTROL (2 << 27) +#define HCD_ED_BULK (3 << 27) +#define HCD_ED_MASK (3 << 27) + +#define ohci_ed_hcdtype(ed) (le32_to_cpup(&(ed)->status) & HCD_ED_MASK) +#define ohci_ed_set_hcdtype(ed, t) ( (ed)->status = ((ed)->status & ~cpu_to_le32(HCD_ED_MASK)) | cpu_to_le32((t) & HCD_ED_MASK) ) + + +/* * The HCCA (Host Controller Communications Area) is a 256 byte * structure defined in the OHCI spec. that the host controller is * told the base address of. It must be 256-byte aligned. @@ -299,15 +325,6 @@ } roothub; } __attribute((aligned(32))); -/* - * These are used by internal ED managing functions as a - * parameter to state the type of ED to deal with (when it matters). - */ -#define HCD_ED_ISOC (0) -#define HCD_ED_INT (1) -#define HCD_ED_CONTROL (2) -#define HCD_ED_BULK (3) - /* * Read a MMIO register and re-write it after ANDing with (m) */ @@ -368,12 +385,16 @@ /* * Control register masks */ +#define OHCI_USB_RESUME (1 << 6) #define OHCI_USB_OPER (2 << 6) #define OHCI_USB_SUSPEND (3 << 6) #define OHCI_USB_PLE (1 << 2) /* Periodic (interrupt) list enable */ #define OHCI_USB_IE (1 << 3) /* Isochronous list enable */ #define OHCI_USB_CLE (1 << 4) /* Control list enable */ #define OHCI_USB_BLE (1 << 5) /* Bulk list enable */ +#define OHCI_USB_IR (1 << 8) /* Int. Routing, HCD ownership */ +#define OHCI_USB_RWC (1 << 9) /* Remote Wakeup Connected */ +#define OHCI_USB_RWE (1 << 10) /* Remote Wakeup Enable */ /* * Command status register masks diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/printer.c linux.ac/drivers/usb/printer.c --- linux.vanilla/drivers/usb/printer.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/printer.c Thu Sep 16 16:30:36 1999 @@ -16,7 +16,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include "usb.h" @@ -58,7 +62,7 @@ dr.value = 0; dr.index = 0; dr.length = 1; - if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, &status, 1)) { + if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, &status, 1, HZ)) { return 0; } return status; @@ -104,7 +108,7 @@ dr.value = 0; dr.index = 0; dr.length = 0; - dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0, HZ); } static int open_printer(struct inode * inode, struct file * file) @@ -129,10 +133,11 @@ printer_check_status(p); - file->private_data = p; // printer_reset(p); init_waitqueue_head(&p->wait_q); + + MOD_INC_USE_COUNT; return 0; } @@ -143,13 +148,12 @@ free_page((unsigned long)p->obuf); p->isopen = 0; file->private_data = NULL; + /* free the resources if the printer is no longer around */ if(!p->pusb_dev) { minor_data[p->minor] = NULL; kfree(p); - - MOD_DEC_USE_COUNT; - } + MOD_DEC_USE_COUNT; return 0; } @@ -184,7 +188,7 @@ } result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev, usb_sndbulkpipe(p->pusb_dev, endpoint_num), - obuf, thistime, &partial); + obuf, thistime, &partial, HZ*20); if (partial) { obuf += partial; thistime -= partial; @@ -243,7 +247,7 @@ result = p->pusb_dev->bus->op->bulk_msg(p->pusb_dev, usb_rcvbulkpipe(p->pusb_dev, endpoint_num), - buf, this_read, &partial); + buf, this_read, &partial, HZ*20); /* unlike writes, we don't retry a NAK, just stop now */ if (!result & partial) @@ -344,7 +348,7 @@ dr.value = 0; dr.index = 0; dr.length = sizeof(ieee_id) - 1; - if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, ieee_id, sizeof(ieee_id)-1) == 0) { + if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, ieee_id, sizeof(ieee_id)-1, HZ) == 0) { if (ieee_id[1] < sizeof(ieee_id) - 1) ieee_id[ieee_id[1]+2] = '\0'; else @@ -373,7 +377,6 @@ minor_data[pp->minor] = NULL; kfree(pp); dev->private = NULL; /* just in case */ - MOD_DEC_USE_COUNT; } static struct usb_driver printer_driver = { @@ -402,8 +405,6 @@ { int result; - MOD_INC_USE_COUNT; - if ((result = register_chrdev(USB_PRINTER_MAJOR, "usblp", &usb_printer_fops)) < 0) { printk(KERN_WARNING "usbprinter: Cannot register device\n"); return result; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/proc_usb.c linux.ac/drivers/usb/proc_usb.c --- linux.vanilla/drivers/usb/proc_usb.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/proc_usb.c Sat Sep 18 01:50:32 1999 @@ -534,7 +534,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), (devrequest *)&ctrl, tbuf, ctrl.dlen); + i = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), (devrequest *)&ctrl, tbuf, ctrl.dlen, HZ); if (!i && ctrl.dlen) { copy_to_user_ret(ctrl.data, tbuf, ctrl.dlen, -EFAULT); } @@ -542,7 +542,7 @@ if (ctrl.dlen) { copy_from_user_ret(tbuf, ctrl.data, ctrl.dlen, -EFAULT); } - i = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), (devrequest *)&ctrl, tbuf, ctrl.dlen); + i = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), (devrequest *)&ctrl, tbuf, ctrl.dlen, HZ); } free_page((unsigned long)tbuf); if (i) { @@ -577,7 +577,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2); + i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -585,7 +585,7 @@ if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2); + i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { @@ -655,7 +655,7 @@ } i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, ctrl.value, ctrl.index, tbuf, - ctrl.length); + ctrl.length, HZ); if (!i && ctrl.length) { copy_to_user_ret(ctrl.data, tbuf, ctrl.length, -EFAULT); } @@ -665,7 +665,7 @@ } i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, ctrl.value, ctrl.index, tbuf, - ctrl.length); + ctrl.length, HZ); } free_page((unsigned long)tbuf); if (i) { @@ -695,7 +695,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2); + i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); if (!i && len2) { copy_to_user_ret(bulk.data, tbuf, len2, -EFAULT); } @@ -703,7 +703,7 @@ if (len1) { copy_from_user_ret(tbuf, bulk.data, len1, -EFAULT); } - i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2); + i = dev->bus->op->bulk_msg(dev, pipe, tbuf, len1, &len2, HZ*5); } free_page((unsigned long)tbuf); if (i) { diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/uchi.h linux.ac/drivers/usb/uchi.h --- linux.vanilla/drivers/usb/uchi.h Thu Jan 1 01:00:00 1970 +++ linux.ac/drivers/usb/uchi.h Thu Sep 16 17:14:46 1999 @@ -0,0 +1,293 @@ +#ifndef __LINUX_UHCI_H +#define __LINUX_UHCI_H + +#include + +#include "usb.h" + +/* + * Universal Host Controller Interface data structures and defines + */ + +/* Command register */ +#define USBCMD 0 +#define USBCMD_RS 0x0001 /* Run/Stop */ +#define USBCMD_HCRESET 0x0002 /* Host reset */ +#define USBCMD_GRESET 0x0004 /* Global reset */ +#define USBCMD_EGSM 0x0008 /* Global Suspend Mode */ +#define USBCMD_FGR 0x0010 /* Force Global Resume */ +#define USBCMD_SWDBG 0x0020 /* SW Debug mode */ +#define USBCMD_CF 0x0040 /* Config Flag (sw only) */ +#define USBCMD_MAXP 0x0080 /* Max Packet (0 = 32, 1 = 64) */ + +/* Status register */ +#define USBSTS 2 +#define USBSTS_USBINT 0x0001 /* Interrupt due to IOC */ +#define USBSTS_ERROR 0x0002 /* Interrupt due to error */ +#define USBSTS_RD 0x0004 /* Resume Detect */ +#define USBSTS_HSE 0x0008 /* Host System Error - basically PCI problems */ +#define USBSTS_HCPE 0x0010 /* Host Controller Process Error - the scripts were buggy */ +#define USBSTS_HCH 0x0020 /* HC Halted */ + +/* Interrupt enable register */ +#define USBINTR 4 +#define USBINTR_TIMEOUT 0x0001 /* Timeout/CRC error enable */ +#define USBINTR_RESUME 0x0002 /* Resume interrupt enable */ +#define USBINTR_IOC 0x0004 /* Interrupt On Complete enable */ +#define USBINTR_SP 0x0008 /* Short packet interrupt enable */ + +#define USBFRNUM 6 +#define USBFLBASEADD 8 +#define USBSOF 12 + +/* USB port status and control registers */ +#define USBPORTSC1 16 +#define USBPORTSC2 18 +#define USBPORTSC_CCS 0x0001 /* Current Connect Status ("device present") */ +#define USBPORTSC_CSC 0x0002 /* Connect Status Change */ +#define USBPORTSC_PE 0x0004 /* Port Enable */ +#define USBPORTSC_PEC 0x0008 /* Port Enable Change */ +#define USBPORTSC_LS 0x0030 /* Line Status */ +#define USBPORTSC_RD 0x0040 /* Resume Detect */ +#define USBPORTSC_LSDA 0x0100 /* Low Speed Device Attached */ +#define USBPORTSC_PR 0x0200 /* Port Reset */ +#define USBPORTSC_SUSP 0x1000 /* Suspend */ + +#define UHCI_NULL_DATA_SIZE 0x7ff /* for UHCI controller TD */ + +#define UHCI_PTR_BITS 0x000F +#define UHCI_PTR_TERM 0x0001 +#define UHCI_PTR_QH 0x0002 +#define UHCI_PTR_DEPTH 0x0004 + +#define UHCI_NUMFRAMES 1024 /* in the frame list [array] */ +#define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */ +#define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */ + +struct uhci_td; + +struct uhci_qh { + /* Hardware fields */ + __u32 link; /* Next queue */ + __u32 element; /* Queue element pointer */ + + /* Software fields */ + atomic_t refcnt; /* Reference counting */ + struct uhci_device *dev; /* The owning device */ + struct uhci_qh *skel; /* Skeleton head */ + + struct uhci_td *first; /* First TD in the chain */ + + wait_queue_head_t wakeup; +} __attribute__((aligned(16))); + +struct uhci_framelist { + __u32 frame[UHCI_NUMFRAMES]; +} __attribute__((aligned(4096))); + +/* + * for TD : + */ +#define TD_CTRL_SPD (1 << 29) /* Short Packet Detect */ +#define TD_CTRL_C_ERR_MASK (3 << 27) /* Error Counter bits */ +#define TD_CTRL_LS (1 << 26) /* Low Speed Device */ +#define TD_CTRL_IOS (1 << 25) /* Isochronous Select */ +#define TD_CTRL_IOC (1 << 24) /* Interrupt on Complete */ +#define TD_CTRL_ACTIVE (1 << 23) /* TD Active */ +#define TD_CTRL_STALLED (1 << 22) /* TD Stalled */ +#define TD_CTRL_DBUFERR (1 << 21) /* Data Buffer Error */ +#define TD_CTRL_BABBLE (1 << 20) /* Babble Detected */ +#define TD_CTRL_NAK (1 << 19) /* NAK Received */ +#define TD_CTRL_CRCTIMEO (1 << 18) /* CRC/Time Out Error */ +#define TD_CTRL_BITSTUFF (1 << 17) /* Bit Stuff Error */ +#define TD_CTRL_ACTLEN_MASK 0x7ff /* actual length, encoded as n - 1 */ + +#define TD_CTRL_ANY_ERROR (TD_CTRL_STALLED | TD_CTRL_DBUFERR | \ + TD_CTRL_BABBLE | TD_CTRL_CRCTIME | TD_CTRL_BITSTUFF) + +#define uhci_status_bits(ctrl_sts) (ctrl_sts & 0xFE0000) +#define uhci_actual_length(ctrl_sts) ((ctrl_sts + 1) & TD_CTRL_ACTLEN_MASK) /* 1-based */ + +#define uhci_ptr_to_virt(x) bus_to_virt(x & ~UHCI_PTR_BITS) + +/* + * for TD : + */ +#define UHCI_TD_REMOVE 0x0001 /* Remove when done */ + +/* + * for TD : (a.k.a. Token) + */ +#define TD_TOKEN_TOGGLE 19 + +#define uhci_maxlen(token) ((token) >> 21) +#define uhci_toggle(token) (((token) >> TD_TOKEN_TOGGLE) & 1) +#define uhci_endpoint(token) (((token) >> 15) & 0xf) +#define uhci_devaddr(token) (((token) >> 8) & 0x7f) +#define uhci_devep(token) (((token) >> 8) & 0x7ff) +#define uhci_packetid(token) ((token) & 0xff) +#define uhci_packetout(token) (uhci_packetid(token) != USB_PID_IN) +#define uhci_packetin(token) (uhci_packetid(token) == USB_PID_IN) + + +/* + * The documentation says "4 words for hardware, 4 words for software". + * + * That's silly, the hardware doesn't care. The hardware only cares that + * the hardware words are 16-byte aligned, and we can have any amount of + * sw space after the TD entry as far as I can tell. + * + * But let's just go with the documentation, at least for 32-bit machines. + * On 64-bit machines we probably want to take advantage of the fact that + * hw doesn't really care about the size of the sw-only area. + * + * Alas, not anymore, we have more than 4 words for software, woops + */ +struct uhci_td { + /* Hardware fields */ + __u32 link; + __u32 status; + __u32 info; + __u32 buffer; + + /* Software fields */ + unsigned int *backptr; /* Where to remove this from.. */ + struct list_head irq_list; /* Active interrupt list.. */ + + usb_device_irq completed; /* Completion handler routine */ + void *dev_id; + + atomic_t refcnt; /* Reference counting */ + struct uhci_device *dev; /* The owning device */ + struct uhci_qh *qh; /* QH this TD is a part of (ignored for Isochronous) */ + int flags; /* Remove, etc */ + int isoc_td_number; /* 0-relative number within a usb_isoc_desc. */ +} __attribute__((aligned(16))); + + +/* + * Note the alignment requirements of the entries + * + * Each UHCI device has pre-allocated QH and TD entries. + * You can use more than the pre-allocated ones, but I + * don't see you usually needing to. + */ +struct uhci; + +#if 0 +#define UHCI_MAXTD 64 + +#define UHCI_MAXQH 16 +#endif + +/* The usb device part must be first! Not anymore -jerdfelt */ +struct uhci_device { + struct usb_device *usb; + + atomic_t refcnt; + + struct uhci *uhci; +#if 0 + struct uhci_qh qh[UHCI_MAXQH]; /* These are the "common" qh's for each device */ + struct uhci_td td[UHCI_MAXTD]; +#endif + + unsigned long data[16]; +}; + +#define uhci_to_usb(uhci) ((uhci)->usb) +#define usb_to_uhci(usb) ((struct uhci_device *)(usb)->hcpriv) + +/* + * There are various standard queues. We set up several different + * queues for each of the three basic queue types: interrupt, + * control, and bulk. + * + * - There are various different interrupt latencies: ranging from + * every other USB frame (2 ms apart) to every 256 USB frames (ie + * 256 ms apart). Make your choice according to how obnoxious you + * want to be on the wire, vs how critical latency is for you. + * - The control list is done every frame. + * - There are 4 bulk lists, so that up to four devices can have a + * bulk list of their own and when run concurrently all four lists + * will be be serviced. + * + * This is a bit misleading, there are various interrupt latencies, but they + * vary a bit, interrupt2 isn't exactly 2ms, it can vary up to 4ms since the + * other queues can "override" it. interrupt4 can vary up to 8ms, etc. Minor + * problem + * + * In the case of the root hub, these QH's are just head's of qh's. Don't + * be scared, it kinda makes sense. Look at this wonderful picture care of + * Linus: + * + * generic-iso-QH -> dev1-iso-QH -> generic-irq-QH -> dev1-irq-QH -> ... + * | | | | + * End dev1-iso-TD1 End dev1-irq-TD1 + * | + * dev1-iso-TD2 + * | + * .... + * + * This may vary a bit (the UHCI docs don't explicitly say you can put iso + * transfers in QH's and all of their pictures don't have that either) but + * other than that, that is what we're doing now + * + * And now we don't put Iso transfers in QH's, so we don't waste one on it + * + * To keep with Linus' nomenclature, this is called the QH skeleton. These + * labels (below) are only signficant to the root hub's QH's + */ +#define UHCI_NUM_SKELQH 10 + +#define skel_int2_qh skelqh[0] +#define skel_int4_qh skelqh[1] +#define skel_int8_qh skelqh[2] +#define skel_int16_qh skelqh[3] +#define skel_int32_qh skelqh[4] +#define skel_int64_qh skelqh[5] +#define skel_int128_qh skelqh[6] +#define skel_int256_qh skelqh[7] + +#define skel_control_qh skelqh[8] + +#define skel_bulk_qh skelqh[9] + +/* + * This describes the full uhci information. + * + * Note how the "proper" USB information is just + * a subset of what the full implementation needs. + */ +struct uhci { + int irq; + unsigned int io_addr; + unsigned int io_size; + + int control_pid; + int control_running; + int control_continue; + + struct list_head uhci_list; + + struct usb_bus *bus; + + struct uhci_qh skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */ + + struct uhci_framelist *fl; /* Frame list */ + struct list_head interrupt_list; /* List of interrupt-active TD's for this uhci */ + + struct uhci_td *ticktd; +}; + +/* needed for the debugging code */ +struct uhci_td *uhci_link_to_td(unsigned int element); + +/* Debugging code */ +void uhci_show_td(struct uhci_td *td); +void uhci_show_status(struct uhci *uhci); +void uhci_show_queue(struct uhci_qh *qh); +void uhci_show_queues(struct uhci *uhci); + +#endif + diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/uhci.c linux.ac/drivers/usb/uhci.c --- linux.vanilla/drivers/usb/uhci.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/uhci.c Sat Sep 18 01:53:08 1999 @@ -41,7 +41,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include @@ -1035,7 +1039,7 @@ } /* td points to the last td in the list, which interrupts on completion */ -static int uhci_run_control(struct uhci_device *dev, struct uhci_td *first, struct uhci_td *last) +static int uhci_run_control(struct uhci_device *dev, struct uhci_td *first, struct uhci_td *last, int timeout) { DECLARE_WAITQUEUE(wait, current); struct uhci_qh *qh = uhci_qh_alloc(dev); @@ -1053,7 +1057,8 @@ /* Add it into the skeleton */ uhci_insert_qh(&dev->uhci->skel_control_qh, qh); - schedule_timeout(HZ * 5); /* 5 seconds */ + /* wait a user specified reasonable amount of time */ + schedule_timeout(timeout); remove_wait_queue(&qh->wakeup, &wait); @@ -1094,7 +1099,7 @@ * there is no restriction on length of transfers * anymore */ -static int uhci_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len) +static int uhci_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len, int timeout) { struct uhci_device *dev = usb_to_uhci(usb_dev); struct uhci_td *first, *td, *prevtd; @@ -1184,7 +1189,7 @@ td->link = UHCI_PTR_TERM; /* Terminate */ /* Start it up.. */ - ret = uhci_run_control(dev, first, td); + ret = uhci_run_control(dev, first, td, timeout); count = 1000; td = first; @@ -1231,7 +1236,7 @@ */ /* td points to the last td in the list, which interrupts on completion */ -static int uhci_run_bulk(struct uhci_device *dev, struct uhci_td *first, struct uhci_td *last, unsigned long *rval) +static int uhci_run_bulk(struct uhci_device *dev, struct uhci_td *first, struct uhci_td *last, unsigned long *rval, int timeout) { DECLARE_WAITQUEUE(wait, current); struct uhci_qh *qh = uhci_qh_alloc(dev); @@ -1249,7 +1254,8 @@ /* Add it into the skeleton */ uhci_insert_qh(&dev->uhci->skel_bulk_qh, qh); - schedule_timeout(HZ * 5); /* 5 seconds */ + /* wait a user specified reasonable amount of time */ + schedule_timeout(timeout); remove_wait_queue(&qh->wakeup, &wait); @@ -1272,7 +1278,7 @@ * A bulk message is only built up from * the data phase */ -static int uhci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *rval) +static int uhci_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, unsigned long *rval, int timeout) { struct uhci_device *dev = usb_to_uhci(usb_dev); struct uhci_td *first, *td, *prevtd; @@ -1334,7 +1340,7 @@ /* CHANGE DIRECTION HERE! SAVE IT SOMEWHERE IN THE ENDPOINT!!! */ /* Start it up.. */ - ret = uhci_run_bulk(dev, first, td, rval); + ret = uhci_run_bulk(dev, first, td, rval, timeout); { int count = 100; @@ -1570,6 +1576,7 @@ } while (nr < maxchild); } +#if 0 static int fixup_isoc_desc (struct uhci_td *td) { struct usb_isoc_desc *isocdesc = td->dev_id; @@ -1621,6 +1628,7 @@ return 0; } +#endif /* 0 */ static void uhci_interrupt_notify(struct uhci *uhci) { @@ -2097,7 +2105,7 @@ for (i = 0; i < 6; i++) { unsigned int io_addr = dev->resource[i].start; unsigned int io_size = - dev->resource[i].end - dev->resource[i].start; + dev->resource[i].end - dev->resource[i].start + 1; /* IO address? */ if (!(dev->resource[i].flags & 1)) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/usb-core.c linux.ac/drivers/usb/usb-core.c --- linux.vanilla/drivers/usb/usb-core.c Tue Sep 7 22:07:06 1999 +++ linux.ac/drivers/usb/usb-core.c Thu Sep 16 16:15:45 1999 @@ -31,6 +31,9 @@ int usb_init(void) { +#ifdef CONFIG_USB_PROC + proc_usb_init (); +#endif #ifndef CONFIG_USB_MODULE # ifdef CONFIG_USB_UHCI uhci_init(); @@ -68,9 +71,6 @@ # ifdef CONFIG_USB_SCSI usb_scsi_init(); # endif -#endif -#ifdef CONFIG_USB_PROC - proc_usb_init (); #endif return 0; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/usb.c linux.ac/drivers/usb/usb.c --- linux.vanilla/drivers/usb/usb.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/usb.c Sat Sep 18 01:50:54 1999 @@ -22,6 +22,11 @@ #include "usb.h" +static int usb_find_driver(struct usb_device *); +static void usb_check_support(struct usb_device *); +static void usb_driver_purge(struct usb_driver *, struct usb_device *); + + /* * We have a per-interface "registered driver" list. */ @@ -179,7 +184,8 @@ new_alloc = old_alloc + bustime; /* what new total allocated bus time would be */ - PRINTD ("usb-bandwidth-alloc: was: %ld, new: %ld, bustime = %ld us, Pipe allowed: %s", + PRINTD ("usb-bandwidth-alloc: was: %u, new: %u, " + "bustime = %ld us, Pipe allowed: %s", old_alloc, new_alloc, bustime, (new_alloc <= FRAME_TIME_MAX_USECS_ALLOC) ? "yes" : "no"); @@ -318,7 +324,6 @@ { if (atomic_dec_and_test(&dev->refcnt)) { usb_destroy_configuration(dev); - dev->bus->op->deallocate(dev); kfree(dev); } @@ -681,7 +686,7 @@ dr.index = 0; dr.length = 0; - return dev->bus->op->control_msg(dev, usb_snddefctrl(dev), &dr, NULL, 0); + return dev->bus->op->control_msg(dev, usb_snddefctrl(dev), &dr, NULL, 0, HZ); } int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size) @@ -697,7 +702,7 @@ dr.length = size; while (i--) { - if (!(result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size)) + if (!(result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size, HZ)) || result == USB_ST_STALL) break; } @@ -714,7 +719,7 @@ dr.index = langid; dr.length = size; - return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size); + return dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, buf, size, HZ); } int usb_get_device_descriptor(struct usb_device *dev) @@ -740,7 +745,7 @@ dr.index = target; dr.length = 2; - return dev->bus->op->control_msg (dev, usb_rcvctrlpipe (dev,0), &dr, data, 2); + return dev->bus->op->control_msg (dev, usb_rcvctrlpipe (dev,0), &dr, data, 2, HZ); } int usb_get_protocol(struct usb_device *dev) @@ -754,7 +759,7 @@ dr.index = 1; dr.length = 1; - if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, 1)) + if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, 1, HZ)) return -1; return buf[0]; @@ -770,7 +775,7 @@ dr.index = 1; dr.length = 0; - if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0)) + if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ)) return -1; return 0; @@ -788,7 +793,7 @@ dr.index = 1; dr.length = 0; - if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0)) + if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ)) return -1; return 0; @@ -838,7 +843,7 @@ dr.index = endp; dr.length = 0; - result = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0); + result = dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev,0), &dr, NULL, 0, HZ); /* don't clear if failed */ if (result) @@ -850,7 +855,7 @@ dr.length = 2; status = 0xffff; - result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, &status, 2); + result = dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev,0), &dr, &status, 2, HZ); if (result) return result; @@ -876,7 +881,7 @@ dr.index = interface; dr.length = 0; - if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0)) + if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ)) return -1; dev->ifnum = interface; @@ -907,7 +912,7 @@ printk(KERN_INFO "usb: selecting invalid configuration %d\n", configuration); return -1; } - if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0)) + if (dev->bus->op->control_msg(dev, usb_sndctrlpipe(dev, 0), &dr, NULL, 0, HZ)) return -1; dev->actconfig = cp; @@ -927,7 +932,7 @@ dr.index = index; dr.length = size; - if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, size)) + if (dev->bus->op->control_msg(dev, usb_rcvctrlpipe(dev, 0), &dr, buf, size, HZ)) return -1; return 0; @@ -962,9 +967,9 @@ /* We grab the first 8 bytes so we know how long the whole */ /* configuration is */ result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, buffer, 8); - if (result) + if (result < 0) return -1; - + /* Get the full buffer */ le16_to_cpus(&desc->wTotalLength); @@ -1115,7 +1120,7 @@ return 0; } -int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size) +int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout) { devrequest dr; @@ -1125,7 +1130,7 @@ dr.index = cpu_to_le16p(&index); dr.length = cpu_to_le16p(&size); - return dev->bus->op->control_msg(dev, pipe, &dr, data, size); + return dev->bus->op->control_msg(dev, pipe, &dr, data, size, timeout); } int usb_request_irq(struct usb_device *dev, unsigned int pipe, usb_device_irq handler, int period, void *dev_id, void **handle) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/usb.h linux.ac/drivers/usb/usb.h --- linux.vanilla/drivers/usb/usb.h Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/usb.h Sat Sep 18 01:50:59 1999 @@ -121,7 +121,7 @@ void *data; }; -#define USB_PROC_CONTROL _IOWR('U', 0, struct usb_proc_ctrltransfer) +#define USB_PROC_CONTROL _IOWR('U', 0, struct usb_proc_ctrltransfer) struct usb_proc_bulktransfer { unsigned int ep; @@ -129,18 +129,16 @@ void *data; }; -#define USB_PROC_BULK _IOWR('U', 2, struct usb_proc_bulktransfer) +#define USB_PROC_BULK _IOWR('U', 2, struct usb_proc_bulktransfer) -#define USB_PROC_RESETEP _IOR('U', 3, unsigned int) +#define USB_PROC_RESETEP _IOR('U', 3, unsigned int) struct usb_proc_setinterface { unsigned int interface; unsigned int altsetting; }; -#define USB_PROC_SETINTERFACE _IOR('U', 4, struct usb_proc_setinterface) - -#define USB_PROC_SETCONFIGURATION _IOR('U', 5, unsigned int) +#define USB_PROC_SETINTERFACE _IOR('U', 4, struct usb_proc_setinterface) @@ -429,8 +427,8 @@ struct usb_operations { int (*allocate)(struct usb_device *); int (*deallocate)(struct usb_device *); - int (*control_msg)(struct usb_device *, unsigned int, devrequest *, void *, int); - int (*bulk_msg)(struct usb_device *, unsigned int, void *, int,unsigned long *); + int (*control_msg)(struct usb_device *, unsigned int, devrequest *, void *, int, int); + int (*bulk_msg)(struct usb_device *, unsigned int, void *, int, unsigned long *, int); int (*request_irq)(struct usb_device *, unsigned int, usb_device_irq, int, void *, void **); int (*release_irq)(struct usb_device *, void *); void *(*request_bulk)(struct usb_device *, unsigned int, usb_device_irq, @@ -496,7 +494,7 @@ void *hcpriv; /* Host Controller private data */ void *private; /* Upper layer private data */ - + void *audiopriv; /* May be both audio and HID */ /* procfs entry */ struct proc_dir_entry *proc_entry; @@ -515,10 +513,6 @@ extern int usb_register(struct usb_driver *); extern void usb_deregister(struct usb_driver *); -int usb_find_driver(struct usb_device *); -void usb_check_support(struct usb_device *); -void usb_driver_purge(struct usb_driver *, struct usb_device *); - extern struct usb_bus *usb_alloc_bus(struct usb_operations *); extern void usb_free_bus(struct usb_bus *); extern void usb_register_bus(struct usb_bus *); @@ -529,7 +523,7 @@ extern void usb_inc_dev_use(struct usb_device *); #define usb_dec_dev_use usb_free_dev -extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size); +extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout); extern int usb_request_irq(struct usb_device *, unsigned int, usb_device_irq, int, void *, void **); extern int usb_release_irq(struct usb_device *dev, void *handle, unsigned int pipe); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/usb_scsi.c linux.ac/drivers/usb/usb_scsi.c --- linux.vanilla/drivers/usb/usb_scsi.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/usb_scsi.c Thu Sep 16 16:30:36 1999 @@ -36,7 +36,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include @@ -142,7 +146,7 @@ do { /*US_DEBUGP("Bulk xfer %x(%d)\n", (unsigned int)buf, this_xfer);*/ result = us->pusb_dev->bus->op->bulk_msg(us->pusb_dev, pipe, buf, - this_xfer, &partial); + this_xfer, &partial, HZ*5); if (result != 0 || partial != this_xfer) US_DEBUGP("bulk_msg returned %d xferred %lu/%d\n", @@ -263,7 +267,6 @@ { unsigned char cmd[12]; devrequest dr; - int result; US_DEBUGP("pop_CB_reset\n"); dr.requesttype = USB_TYPE_CLASS | USB_RT_INTERFACE; @@ -276,7 +279,7 @@ cmd[1] = 4; us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - &dr, cmd, 12); + &dr, cmd, 12, HZ); /* long wait for reset */ @@ -338,7 +341,7 @@ } result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - &dr, cmd, us->fixedlength); + &dr, cmd, us->fixedlength, HZ); 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 */ @@ -349,7 +352,7 @@ cmd[4] = 1; /* start */ result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - &dr, cmd, us->fixedlength); + &dr, cmd, us->fixedlength, HZ); wait_ms(100); retry++; continue; @@ -357,7 +360,7 @@ } else result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), - &dr, srb->cmnd, srb->cmd_len); + &dr, srb->cmnd, srb->cmd_len, HZ); if (/*result != USB_ST_STALL &&*/ result != USB_ST_TIMEOUT) return result; } @@ -389,7 +392,7 @@ dr.length = 2; result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_rcvctrlpipe(us->pusb_dev,0), - &dr, status, sizeof(status)); + &dr, status, sizeof(status), HZ); if (result != USB_ST_TIMEOUT) break; } @@ -452,7 +455,6 @@ static int pop_CBI(Scsi_Cmnd *srb) { - struct us_data *us = (struct us_data *)srb->host_scribble; int result; /* run the command */ @@ -500,7 +502,7 @@ dr.index = 0; dr.length = 0; - result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), &dr, NULL, 0); + result = us->pusb_dev->bus->op->control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0), &dr, NULL, 0, HZ); if (result) US_DEBUGP("Bulk hard reset failed %d\n", result); usb_clear_halt(us->pusb_dev, us->ep_in | 0x80); @@ -546,7 +548,7 @@ bcb.Tag, bcb.DataTransferLength, bcb.Flags, bcb.Length); result = us->pusb_dev->bus->op->bulk_msg(us->pusb_dev, usb_sndbulkpipe(us->pusb_dev, us->ep_out), &bcb, - US_BULK_CB_WRAP_LEN, &partial); + US_BULK_CB_WRAP_LEN, &partial, HZ*5); if (result) { US_DEBUGP("Bulk command result %x\n", result); return DID_ABORT << 16; @@ -570,7 +572,7 @@ do { result = us->pusb_dev->bus->op->bulk_msg(us->pusb_dev, usb_rcvbulkpipe(us->pusb_dev, us->ep_in), &bcs, - US_BULK_CS_WRAP_LEN, &partial); + US_BULK_CS_WRAP_LEN, &partial, HZ*5); if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) stall++; else @@ -1296,7 +1298,7 @@ dr.index = 0; dr.value = 0; dr.length = 0; - ss->pusb_dev->bus->op->control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0), &dr, qstat, 2); + ss->pusb_dev->bus->op->control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0), &dr, qstat, 2, HZ); US_DEBUGP("C0 status %x %x\n", qstat[0], qstat[1]); init_waitqueue_head(&ss->ip_waitq); ss->irqpipe = usb_rcvctrlpipe(ss->pusb_dev, ss->ep_int); @@ -1413,8 +1415,6 @@ void cleanup_module(void) { - unsigned int offset; - usb_deregister(&scsi_driver); } #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/usb_scsi_debug.c linux.ac/drivers/usb/usb_scsi_debug.c --- linux.vanilla/drivers/usb/usb_scsi_debug.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/usb_scsi_debug.c Thu Sep 16 16:30:36 1999 @@ -15,7 +15,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,18) #include +#else +#include +#endif #include #include "../scsi/scsi.h" diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/usb/uss720.c linux.ac/drivers/usb/uss720.c --- linux.vanilla/drivers/usb/uss720.c Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/usb/uss720.c Thu Sep 16 16:30:36 1999 @@ -71,7 +71,7 @@ dr.value = ((unsigned int)reg) << 8; dr.index = 0; dr.length = 7; - ret = usbdev->bus->op->control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), &dr, priv->reg, 7); + ret = usbdev->bus->op->control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), &dr, priv->reg, 7, HZ); if (ret) { printk(KERN_DEBUG "uss720: get_1284_register(%d) failed, status 0x%x\n", (unsigned int)reg, ret); @@ -105,7 +105,7 @@ dr.value = (((unsigned int)reg) << 8) | val; dr.index = 0; dr.length = 0; - ret = usbdev->bus->op->control_msg(usbdev, usb_sndctrlpipe(usbdev,0), &dr, NULL, 0); + ret = usbdev->bus->op->control_msg(usbdev, usb_sndctrlpipe(usbdev,0), &dr, NULL, 0, HZ); if (ret) { printk(KERN_DEBUG "uss720: set_1284_register(%u,0x%02x) failed, status 0x%x\n", (unsigned int)reg, (unsigned int)val, ret); @@ -374,7 +374,7 @@ return 0; if (change_mode(pp, ECR_EPP)) return 0; - i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buf, length, &rlen); + i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buf, length, &rlen, HZ*20); if (i) printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %u rlen %lu\n", buf, length, rlen); change_mode(pp, ECR_PS2); @@ -435,7 +435,7 @@ return 0; if (change_mode(pp, ECR_ECP)) return 0; - i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buffer, len, &rlen); + i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buffer, len, &rlen, HZ*20); if (i) printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %u rlen %lu\n", buffer, len, rlen); change_mode(pp, ECR_PS2); @@ -453,7 +453,7 @@ return 0; if (change_mode(pp, ECR_ECP)) return 0; - i = usbdev->bus->op->bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, 2), buffer, len, &rlen); + i = usbdev->bus->op->bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, 2), buffer, len, &rlen, HZ*20); if (i) printk(KERN_ERR "uss720: recvbulk ep 2 buf %p len %u rlen %lu\n", buffer, len, rlen); change_mode(pp, ECR_PS2); @@ -486,7 +486,7 @@ return 0; if (change_mode(pp, ECR_PPF)) return 0; - i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buffer, len, &rlen); + i = usbdev->bus->op->bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), buffer, len, &rlen, HZ*20); if (i) printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %u rlen %lu\n", buffer, len, rlen); change_mode(pp, ECR_PS2); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/video/Config.in linux.ac/drivers/video/Config.in --- linux.vanilla/drivers/video/Config.in Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/video/Config.in Tue Sep 14 20:48:06 1999 @@ -2,350 +2,360 @@ # Video configuration # +mainmenu_option next_comment +comment 'Frame-buffer support' + +bool 'Support for frame buffer devices (EXPERIMENTAL)' CONFIG_FB + if [ "$CONFIG_FB" = "y" ]; then - define_bool CONFIG_DUMMY_CONSOLE y - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_PCI" = "y" ]; then - tristate 'Cirrus Logic suport (experimental)' CONFIG_FB_CLGEN - tristate 'Permedia2 support (experimental)' CONFIG_FB_PM2 - if [ "$CONFIG_FB_PM2" = "y" ]; then - if [ "$CONFIG_PCI" = "y" ]; then - bool ' enable FIFO disconnect feature' CONFIG_FB_PM2_FIFO_DISCONNECT - bool ' generic Permedia2 PCI board support' CONFIG_FB_PM2_PCI - fi - if [ "$CONFIG_AMIGA" = "y" ]; then - bool ' Phase5 CVisionPPC/BVisionPPC support' CONFIG_FB_PM2_CVPPC - fi - fi - fi - fi - if [ "$CONFIG_ARCH_ACORN" = "y" ]; then - bool 'Acorn VIDC support' CONFIG_FB_ACORN - fi - if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then - tristate 'Cyber2000 support' CONFIG_FB_CYBER2000 - fi - if [ "$CONFIG_APOLLO" = "y" ]; then - define_bool CONFIG_FB_APOLLO y - fi - if [ "$CONFIG_Q40" = "y" ]; then - define_bool CONFIG_FB_Q40 y - fi - if [ "$CONFIG_AMIGA" = "y" ]; then - bool 'Amiga native chipset support' CONFIG_FB_AMIGA - if [ "$CONFIG_FB_AMIGA" != "n" ]; then - bool 'Amiga OCS chipset support' CONFIG_FB_AMIGA_OCS - bool 'Amiga ECS chipset support' CONFIG_FB_AMIGA_ECS - bool 'Amiga AGA chipset support' CONFIG_FB_AMIGA_AGA - fi - fi - if [ "$CONFIG_ZORRO" = "y" ]; then - tristate 'Amiga CyberVision support' CONFIG_FB_CYBER - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool 'Amiga CyberVision3D support (experimental)' CONFIG_FB_VIRGE - tristate 'Amiga RetinaZ3 support' CONFIG_FB_RETINAZ3 - bool 'Amiga FrameMaster II/Rainbow II support (experimental)' CONFIG_FB_FM2 - fi - fi - if [ "$CONFIG_ATARI" = "y" ]; then - bool 'Atari native chipset support' CONFIG_FB_ATARI - tristate 'ATI Mach64 display support' CONFIG_FB_ATY - fi - if [ "$CONFIG_PPC" = "y" ]; then - bool 'Open Firmware frame buffer device support' CONFIG_FB_OF - if [ "$CONFIG_FB_OF" = "y" ]; then - bool 'Apple "control" display support' CONFIG_FB_CONTROL - bool 'Apple "platinum" display support' CONFIG_FB_PLATINUM - bool 'Apple "valkyrie" display support' CONFIG_FB_VALKYRIE - tristate 'ATI Mach64 display support' CONFIG_FB_ATY - bool 'IMS Twin Turbo display support' CONFIG_FB_IMSTT - bool 'Chips 65550 display support' CONFIG_FB_CT65550 - bool 'S3 Trio display support' CONFIG_FB_S3TRIO - fi - tristate 'VGA 16-color graphics console' CONFIG_FB_VGA16 - fi - if [ "$CONFIG_MAC" = "y" ]; then - define_bool CONFIG_FB_MAC y - fi - if [ "$CONFIG_HP300" = "y" ]; then - define_bool CONFIG_FB_HP300 y - fi - if [ "$ARCH" = "alpha" ]; then - tristate 'TGA framebuffer support' CONFIG_FB_TGA - fi - if [ "$ARCH" = "i386" ]; then - bool 'VESA VGA graphics console' CONFIG_FB_VESA - tristate 'VGA 16-color graphics console' CONFIG_FB_VGA16 - define_bool CONFIG_VIDEO_SELECT y - fi - if [ "$CONFIG_VISWS" = "y" ]; then - tristate 'SGI Visual Workstation framebuffer support' CONFIG_FB_SGIVW - fi - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - if [ "$CONFIG_PCI" != "n" ]; then - tristate 'Matrox acceleration' CONFIG_FB_MATROX - if [ "$CONFIG_FB_MATROX" != "n" ]; then - bool ' Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM - bool ' Mystique support' CONFIG_FB_MATROX_MYSTIQUE - bool ' G100/G200/G400 support' CONFIG_FB_MATROX_G100 - bool ' Multihead support' CONFIG_FB_MATROX_MULTIHEAD - fi - tristate 'ATI Mach64 display support' CONFIG_FB_ATY - fi - fi - if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then - bool 'SBUS and UPA framebuffers' CONFIG_FB_SBUS - if [ "$CONFIG_FB_SBUS" != "n" ]; then - if [ "$ARCH" = "sparc64" ]; then - bool ' Creator/Creator3D support' CONFIG_FB_CREATOR - fi - bool ' CGsix (GX,TurboGX) support' CONFIG_FB_CGSIX - bool ' BWtwo support' CONFIG_FB_BWTWO - bool ' CGthree support' CONFIG_FB_CGTHREE - if [ "$ARCH" = "sparc" ]; then - bool ' TCX (SS4/SS5 only) support' CONFIG_FB_TCX - bool ' CGfourteen (SX) support' CONFIG_FB_CGFOURTEEN - bool ' P9100 (Sparcbook 3 only) support' CONFIG_FB_P9100 - fi - bool ' Leo (ZX) support' CONFIG_FB_LEO - fi - fi - if [ "$ARCH" = "sparc" ]; then - if [ "$CONFIG_PCI" != "n" ]; then - bool 'PCI framebuffers' CONFIG_FB_PCI - if [ "$CONFIG_FB_PCI" != "n" ]; then - bool ' IGA 168x display support' CONFIG_FB_IGA - fi - fi - fi - if [ "$ARCH" = "sparc64" ]; then - if [ "$CONFIG_PCI" != "n" ]; then - bool 'PCI framebuffers' CONFIG_FB_PCI - if [ "$CONFIG_FB_PCI" != "n" ]; then - tristate ' ATI Mach64 display support' CONFIG_FB_ATY - fi - fi - fi - tristate 'Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL + define_bool CONFIG_DUMMY_CONSOLE y + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + if [ "$CONFIG_AMIGA" = "y" -o "$CONFIG_PCI" = "y" ]; then + tristate ' Cirrus Logic suport (EXPERIMENTAL)' CONFIG_FB_CLGEN + tristate ' Permedia2 support (EXPERIMENTAL)' CONFIG_FB_PM2 + if [ "$CONFIG_FB_PM2" = "y" ]; then + if [ "$CONFIG_PCI" = "y" ]; then + bool ' enable FIFO disconnect feature' CONFIG_FB_PM2_FIFO_DISCONNECT + bool ' generic Permedia2 PCI board support' CONFIG_FB_PM2_PCI + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + bool ' Phase5 CVisionPPC/BVisionPPC support' CONFIG_FB_PM2_CVPPC + fi + fi + fi + fi + if [ "$CONFIG_ARCH_ACORN" = "y" ]; then + bool ' Acorn VIDC support' CONFIG_FB_ACORN + fi + if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then + tristate ' Cyber2000 support' CONFIG_FB_CYBER2000 + fi + if [ "$CONFIG_APOLLO" = "y" ]; then + define_bool CONFIG_FB_APOLLO y + fi + if [ "$CONFIG_Q40" = "y" ]; then + define_bool CONFIG_FB_Q40 y + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + bool ' Amiga native chipset support' CONFIG_FB_AMIGA + if [ "$CONFIG_FB_AMIGA" != "n" ]; then + bool ' Amiga OCS chipset support' CONFIG_FB_AMIGA_OCS + bool ' Amiga ECS chipset support' CONFIG_FB_AMIGA_ECS + bool ' Amiga AGA chipset support' CONFIG_FB_AMIGA_AGA + fi + fi + if [ "$CONFIG_ZORRO" = "y" ]; then + tristate ' Amiga CyberVision support' CONFIG_FB_CYBER + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' Amiga CyberVision3D support (EXPERIMENTAL)' CONFIG_FB_VIRGE + tristate ' Amiga RetinaZ3 support (EXPERIMENTAL)' CONFIG_FB_RETINAZ3 + bool ' Amiga FrameMaster II/Rainbow II support (EXPERIMENTAL)' CONFIG_FB_FM2 + fi + fi + if [ "$CONFIG_ATARI" = "y" ]; then + bool ' Atari native chipset support' CONFIG_FB_ATARI + tristate ' ATI Mach64 display support' CONFIG_FB_ATY + fi + if [ "$CONFIG_PPC" = "y" ]; then + bool ' Open Firmware frame buffer device support' CONFIG_FB_OF + if [ "$CONFIG_FB_OF" = "y" ]; then + bool ' Apple "control" display support' CONFIG_FB_CONTROL + bool ' Apple "platinum" display support' CONFIG_FB_PLATINUM + bool ' Apple "valkyrie" display support' CONFIG_FB_VALKYRIE + tristate ' ATI Mach64 display support' CONFIG_FB_ATY + bool ' IMS Twin Turbo display support' CONFIG_FB_IMSTT + bool ' Chips 65550 display support' CONFIG_FB_CT65550 + bool ' S3 Trio display support' CONFIG_FB_S3TRIO + fi + tristate ' VGA 16-color graphics console' CONFIG_FB_VGA16 + fi + if [ "$CONFIG_MAC" = "y" ]; then + define_bool CONFIG_FB_MAC y + fi + if [ "$CONFIG_HP300" = "y" ]; then + define_bool CONFIG_FB_HP300 y + fi + if [ "$ARCH" = "alpha" ]; then + tristate ' TGA framebuffer support' CONFIG_FB_TGA + fi + if [ "$ARCH" = "i386" ]; then + bool ' VESA VGA graphics console' CONFIG_FB_VESA + tristate ' VGA 16-color graphics console' CONFIG_FB_VGA16 + define_bool CONFIG_VIDEO_SELECT y + fi + if [ "$CONFIG_VISWS" = "y" ]; then + tristate ' SGI Visual Workstation framebuffer support' CONFIG_FB_SGIVW + define_bool CONFIG_BUS_I2C y + fi + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + if [ "$CONFIG_PCI" != "n" ]; then + tristate ' Matrox acceleration (EXPERIMENTAL)' CONFIG_FB_MATROX + if [ "$CONFIG_FB_MATROX" != "n" ]; then + bool ' Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM + bool ' Mystique support' CONFIG_FB_MATROX_MYSTIQUE + bool ' G100/G200/G400 support' CONFIG_FB_MATROX_G100 + bool ' Multihead support' CONFIG_FB_MATROX_MULTIHEAD + fi + tristate ' ATI Mach64 display support (EXPERIMENTAL)' CONFIG_FB_ATY + fi + fi + if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then + bool ' SBUS and UPA framebuffers' CONFIG_FB_SBUS + if [ "$CONFIG_FB_SBUS" != "n" ]; then + if [ "$ARCH" = "sparc64" ]; then + bool ' Creator/Creator3D support' CONFIG_FB_CREATOR + fi + bool ' CGsix (GX,TurboGX) support' CONFIG_FB_CGSIX + bool ' BWtwo support' CONFIG_FB_BWTWO + bool ' CGthree support' CONFIG_FB_CGTHREE + if [ "$ARCH" = "sparc" ]; then + bool ' TCX (SS4/SS5 only) support' CONFIG_FB_TCX + bool ' CGfourteen (SX) support' CONFIG_FB_CGFOURTEEN + bool ' P9100 (Sparcbook 3 only) support' CONFIG_FB_P9100 + fi + bool ' Leo (ZX) support' CONFIG_FB_LEO + fi + fi + if [ "$ARCH" = "sparc" ]; then + if [ "$CONFIG_PCI" != "n" ]; then + bool ' PCI framebuffers' CONFIG_FB_PCI + if [ "$CONFIG_FB_PCI" != "n" ]; then + bool ' IGA 168x display support' CONFIG_FB_IGA + fi + fi + fi + if [ "$ARCH" = "sparc64" ]; then + if [ "$CONFIG_PCI" != "n" ]; then + bool ' PCI framebuffers' CONFIG_FB_PCI + if [ "$CONFIG_FB_PCI" != "n" ]; then + tristate ' ATI Mach64 display support' CONFIG_FB_ATY + fi + fi + fi + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL + fi - bool 'Advanced low level driver options' CONFIG_FBCON_ADVANCED - if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then - tristate 'Monochrome support' CONFIG_FBCON_MFB - tristate '2 bpp packed pixels support' CONFIG_FBCON_CFB2 - tristate '4 bpp packed pixels support' CONFIG_FBCON_CFB4 - tristate '8 bpp packed pixels support' CONFIG_FBCON_CFB8 - tristate '16 bpp packed pixels support' CONFIG_FBCON_CFB16 - tristate '24 bpp packed pixels support' CONFIG_FBCON_CFB24 - tristate '32 bpp packed pixels support' CONFIG_FBCON_CFB32 - tristate 'Amiga bitplanes support' CONFIG_FBCON_AFB - tristate 'Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM - tristate 'Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2 - tristate 'Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4 - tristate 'Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8 -# tristate 'Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16 - tristate 'Mac variable bpp packed pixels support' CONFIG_FBCON_MAC - tristate 'VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES - tristate 'VGA characters/attributes support' CONFIG_FBCON_VGA - else - # Guess what we need - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \ - "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ - "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then - define_bool CONFIG_FBCON_MFB y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \ - "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then - define_bool CONFIG_FBCON_MFB m - fi - fi - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ - "$CONFIG_FB_VIRTUAL" = "y" ]; then - define_bool CONFIG_FBCON_CFB2 y - define_bool CONFIG_FBCON_CFB4 y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ - "$CONFIG_FB_VIRTUAL" = "m" ]; then - define_bool CONFIG_FBCON_CFB2 m - define_bool CONFIG_FBCON_CFB4 m - fi - fi - if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \ - "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ - "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_TGA" = "y" -o \ - "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ - "$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_CGFOURTEEN" = "y" -o "$CONFIG_FB_G364" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ - "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_P9100" = "y" -o \ - "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" ]; then - define_bool CONFIG_FBCON_CFB8 y - else - if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ - "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ - "$CONFIG_FB_OF" = "m" -o "$CONFIG_FB_TGA" = "m" -o \ - "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_CGFOURTEEN" = "m" -o "$CONFIG_FB_G364" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ - "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_P9100" = "m" -o \ - "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB8 m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ - "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ - "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \ - "$CONFIG_FB_Q40" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ - "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ - "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \ - "$CONFIG_FB_CYBER2000" = "y" ]; then - define_bool CONFIG_FBCON_CFB16 y - else - if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ - "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ - "$CONFIG_FB_VIRTUAL" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \ - "$CONFIG_FB_Q40" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ - "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ - "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "m" -o \ - "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB16 m - fi - fi - if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ - "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ - "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_CYBER2000" = "y" ]; then - define_bool CONFIG_FBCON_CFB24 y - else - if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ - "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_CYBER2000" = "m" ]; then - define_bool CONFIG_FBCON_CFB24 m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ - "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ - "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ - "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ - "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ - "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" ]; then - define_bool CONFIG_FBCON_CFB32 y - else - if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ - "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ - "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ - "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ - "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ - "$CONFIG_FB_SGIVW" = "m" ]; then - define_bool CONFIG_FBCON_CFB32 m - fi - fi - if [ "$CONFIG_FB_AMIGA" = "y" ]; then - define_bool CONFIG_FBCON_AFB y - define_bool CONFIG_FBCON_ILBM y - else - if [ "$CONFIG_FB_AMIGA" = "m" ]; then - define_bool CONFIG_FBCON_AFB m - define_bool CONFIG_FBCON_ILBM m - fi - fi - if [ "$CONFIG_FB_ATARI" = "y" ]; then - define_bool CONFIG_FBCON_IPLAN2P2 y - define_bool CONFIG_FBCON_IPLAN2P4 y - define_bool CONFIG_FBCON_IPLAN2P8 y -# define_bool CONFIG_FBCON_IPLAN2P16 y - else - if [ "$CONFIG_FB_ATARI" = "m" ]; then - define_bool CONFIG_FBCON_IPLAN2P2 m - define_bool CONFIG_FBCON_IPLAN2P4 m - define_bool CONFIG_FBCON_IPLAN2P8 m -# define_bool CONFIG_FBCON_IPLAN2P16 m - fi - fi - if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then - define_bool CONFIG_FBCON_MAC y - else - if [ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then - define_bool CONFIG_FBCON_MAC m - fi - fi - if [ "$CONFIG_FB_VGA16" = "y" ]; then - define_bool CONFIG_FBCON_VGA_PLANES y - else - if [ "$CONFIG_FB_VGA16" = "m" ]; then - define_bool CONFIG_FBCON_VGA_PLANES m - fi - fi - if [ "$CONFIG_FB_MDA" = "y" -o "$CONFIG_FB_VGA" = "y" ]; then - define_bool CONFIG_FBCON_VGA y - else - if [ "$CONFIG_FB_MDA" = "m" -o "$CONFIG_FB_VGA" = "m" ]; then - define_bool CONFIG_FBCON_VGA m - fi - fi - fi - bool 'Support only 8 pixels wide fonts' CONFIG_FBCON_FONTWIDTH8_ONLY - if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then - bool 'Sparc console 8x16 font' CONFIG_FONT_SUN8x16 - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool 'Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 - fi - bool 'Select other fonts' CONFIG_FBCON_FONTS - if [ "$CONFIG_FBCON_FONTS" = "y" ]; then - bool ' VGA 8x8 font' CONFIG_FONT_8x8 - bool ' VGA 8x16 font' CONFIG_FONT_8x16 - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 - fi - bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 - bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 - fi - else - bool 'Select compiled-in fonts' CONFIG_FBCON_FONTS - if [ "$CONFIG_FBCON_FONTS" = "y" ]; then - bool ' VGA 8x8 font' CONFIG_FONT_8x8 - bool ' VGA 8x16 font' CONFIG_FONT_8x16 + bool ' Advanced low level driver options' CONFIG_FBCON_ADVANCED + if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then + tristate ' Monochrome support' CONFIG_FBCON_MFB + tristate ' 2 bpp packed pixels support' CONFIG_FBCON_CFB2 + tristate ' 4 bpp packed pixels support' CONFIG_FBCON_CFB4 + tristate ' 8 bpp packed pixels support' CONFIG_FBCON_CFB8 + tristate ' 16 bpp packed pixels support' CONFIG_FBCON_CFB16 + tristate ' 24 bpp packed pixels support' CONFIG_FBCON_CFB24 + tristate ' 32 bpp packed pixels support' CONFIG_FBCON_CFB32 + tristate ' Amiga bitplanes support' CONFIG_FBCON_AFB + tristate ' Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM + tristate ' Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2 + tristate ' Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4 + tristate ' Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8 +# tristate ' Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16 + tristate ' Mac variable bpp packed pixels support' CONFIG_FBCON_MAC + tristate ' VGA 16-color planar support' CONFIG_FBCON_VGA_PLANES + tristate ' VGA characters/attributes support' CONFIG_FBCON_VGA + else + # Guess what we need + if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \ + "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ + "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \ + "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ + "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then + define_bool CONFIG_FBCON_MFB y + else + if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \ + "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ + "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \ + "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ + "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then + define_bool CONFIG_FBCON_MFB m + fi + fi + if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ + "$CONFIG_FB_VIRTUAL" = "y" ]; then + define_bool CONFIG_FBCON_CFB2 y + define_bool CONFIG_FBCON_CFB4 y + else + if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ + "$CONFIG_FB_VIRTUAL" = "m" ]; then + define_bool CONFIG_FBCON_CFB2 m + define_bool CONFIG_FBCON_CFB4 m + fi + fi + if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \ + "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_MAC" = "y" -o \ + "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_TGA" = "y" -o \ + "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ + "$CONFIG_FB_TCX" = "y" -o "$CONFIG_FB_CGTHREE" = "y" -o \ + "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ + "$CONFIG_FB_CGFOURTEEN" = "y" -o "$CONFIG_FB_G364" = "y" -o \ + "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ + "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ + "$CONFIG_FB_IGA" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ + "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ + "$CONFIG_FB_P9100" = "y" -o \ + "$CONFIG_FB_SGIVW" = "y" -o "$CONFIG_FB_CYBER2000" = "y" ]; then + define_bool CONFIG_FBCON_CFB8 y + else + if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \ + "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_MAC" = "m" -o \ + "$CONFIG_FB_OF" = "m" -o "$CONFIG_FB_TGA" = "m" -o \ + "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ + "$CONFIG_FB_TCX" = "m" -o "$CONFIG_FB_CGTHREE" = "m" -o \ + "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ + "$CONFIG_FB_CGFOURTEEN" = "m" -o "$CONFIG_FB_G364" = "m" -o \ + "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ + "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ + "$CONFIG_FB_IGA" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ + "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ + "$CONFIG_FB_P9100" = "m" -o \ + "$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" ]; then + define_bool CONFIG_FBCON_CFB8 m + fi + fi + if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ + "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ + "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_TBOX" = "y" -o \ + "$CONFIG_FB_Q40" = "y" -o \ + "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ + "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \ + "$CONFIG_FB_VALKYRIE" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ + "$CONFIG_FB_CT65550" = "y" -o "$CONFIG_FB_MATROX" = "y" -o \ + "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" -o \ + "$CONFIG_FB_CYBER2000" = "y" ]; then + define_bool CONFIG_FBCON_CFB16 y + else + if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ + "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ + "$CONFIG_FB_VIRTUAL" = "m" -o "$CONFIG_FB_TBOX" = "m" -o \ + "$CONFIG_FB_Q40" = "m" -o \ + "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ + "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \ + "$CONFIG_FB_VALKYRIE" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ + "$CONFIG_FB_CT65550" = "m" -o "$CONFIG_FB_MATROX" = "m" -o \ + "$CONFIG_FB_PM2" = "y" -o "$CONFIG_FB_SGIVW" = "m" -o \ + "$CONFIG_FB_CYBER2000" = "m" ]; then + define_bool CONFIG_FBCON_CFB16 m + fi + fi + if [ "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ + "$CONFIG_FB_CLGEN" = "y" -o "$CONFIG_FB_VESA" = "y" -o \ + "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ + "$CONFIG_FB_CYBER2000" = "y" ]; then + define_bool CONFIG_FBCON_CFB24 y + else + if [ "$CONFIG_FB_ATY" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ + "$CONFIG_FB_CLGEN" = "m" -o "$CONFIG_FB_VESA" = "m" -o \ + "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ + "$CONFIG_FB_CYBER2000" = "m" ]; then + define_bool CONFIG_FBCON_CFB24 m + fi + fi + if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \ + "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \ + "$CONFIG_FB_CONTROL" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \ + "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_PLATINUM" = "y" -o \ + "$CONFIG_FB_MATROX" = "y" -o "$CONFIG_FB_PM2" = "y" -o \ + "$CONFIG_FB_FM2" = "y" -o "$CONFIG_FB_SGIVW" = "y" ]; then + define_bool CONFIG_FBCON_CFB32 y + else + if [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \ + "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \ + "$CONFIG_FB_CONTROL" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \ + "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_PLATINUM" = "m" -o \ + "$CONFIG_FB_MATROX" = "m" -o "$CONFIG_FB_PM2" = "m" -o \ + "$CONFIG_FB_SGIVW" = "m" ]; then + define_bool CONFIG_FBCON_CFB32 m + fi + fi + if [ "$CONFIG_FB_AMIGA" = "y" ]; then + define_bool CONFIG_FBCON_AFB y + define_bool CONFIG_FBCON_ILBM y + else + if [ "$CONFIG_FB_AMIGA" = "m" ]; then + define_bool CONFIG_FBCON_AFB m + define_bool CONFIG_FBCON_ILBM m + fi + fi + if [ "$CONFIG_FB_ATARI" = "y" ]; then + define_bool CONFIG_FBCON_IPLAN2P2 y + define_bool CONFIG_FBCON_IPLAN2P4 y + define_bool CONFIG_FBCON_IPLAN2P8 y +# define_bool CONFIG_FBCON_IPLAN2P16 y + else + if [ "$CONFIG_FB_ATARI" = "m" ]; then + define_bool CONFIG_FBCON_IPLAN2P2 m + define_bool CONFIG_FBCON_IPLAN2P4 m + define_bool CONFIG_FBCON_IPLAN2P8 m +# define_bool CONFIG_FBCON_IPLAN2P16 m + fi + fi + if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then + define_bool CONFIG_FBCON_MAC y + else + if [ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then + define_bool CONFIG_FBCON_MAC m + fi + fi + if [ "$CONFIG_FB_VGA16" = "y" ]; then + define_bool CONFIG_FBCON_VGA_PLANES y + else + if [ "$CONFIG_FB_VGA16" = "m" ]; then + define_bool CONFIG_FBCON_VGA_PLANES m + fi + fi + if [ "$CONFIG_FB_MDA" = "y" -o "$CONFIG_FB_VGA" = "y" ]; then + define_bool CONFIG_FBCON_VGA y + else + if [ "$CONFIG_FB_MDA" = "m" -o "$CONFIG_FB_VGA" = "m" ]; then + define_bool CONFIG_FBCON_VGA m + fi + fi + fi + bool ' Support only 8 pixels wide fonts' CONFIG_FBCON_FONTWIDTH8_ONLY + if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 - bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 + bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 fi - bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 - bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 - else - define_bool CONFIG_FONT_8x8 y - define_bool CONFIG_FONT_8x16 y - if [ "$CONFIG_MAC" = "y" ]; then - if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then - define_bool CONFIG_FONT_6x11 y - fi + bool ' Select other fonts' CONFIG_FBCON_FONTS + if [ "$CONFIG_FBCON_FONTS" = "y" ]; then + bool ' VGA 8x8 font' CONFIG_FONT_8x8 + bool ' VGA 8x16 font' CONFIG_FONT_8x16 + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 + fi + bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 + bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 + fi + else + bool ' Select compiled-in fonts' CONFIG_FBCON_FONTS + if [ "$CONFIG_FBCON_FONTS" = "y" ]; then + bool ' VGA 8x8 font' CONFIG_FONT_8x8 + bool ' VGA 8x16 font' CONFIG_FONT_8x16 + bool ' Sparc console 8x16 font' CONFIG_FONT_SUN8x16 + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + bool ' Sparc console 12x22 font (not supported by all drivers)' CONFIG_FONT_SUN12x22 + bool ' Mac console 6x11 font (not supported by all drivers)' CONFIG_FONT_6x11 + fi + bool ' Pearl (old m68k) console 8x8 font' CONFIG_FONT_PEARL_8x8 + bool ' Acorn console 8x8 font' CONFIG_FONT_ACORN_8x8 + else + define_bool CONFIG_FONT_8x8 y + define_bool CONFIG_FONT_8x16 y + if [ "$CONFIG_MAC" = "y" ]; then + if [ "$CONFIG_FBCON_FONTWIDTH8_ONLY" = "n" ]; then + define_bool CONFIG_FONT_6x11 y + fi + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + define_bool CONFIG_FONT_PEARL_8x8 y + fi + if [ "$CONFIG_ARM" = "y" -a "$CONFIG_ARCH_ACORN" = "y" ]; then + define_bool CONFIG_FONT_ACORN_8x8 y + fi fi - if [ "$CONFIG_AMIGA" = "y" ]; then - define_bool CONFIG_FONT_PEARL_8x8 y - fi - if [ "$CONFIG_ARM" = "y" -a "$CONFIG_ARCH_ACORN" = "y" ]; then - define_bool CONFIG_FONT_ACORN_8x8 y - fi - fi - fi + fi fi + +endmenu diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/video/Makefile linux.ac/drivers/video/Makefile --- linux.vanilla/drivers/video/Makefile Sat Sep 11 00:54:11 1999 +++ linux.ac/drivers/video/Makefile Fri Sep 10 17:55:10 1999 @@ -150,10 +150,10 @@ endif ifeq ($(CONFIG_FB_SGIVW),y) -L_OBJS += sgivwfb.o +LX_OBJS += sgivwfb.o else ifeq ($(CONFIG_FB_SGIVW),m) - M_OBJS += sgivwfb.o + MX_OBJS += sgivwfb.o endif endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/video/p9100fb.c linux.ac/drivers/video/p9100fb.c --- linux.vanilla/drivers/video/p9100fb.c Sat Sep 11 00:54:12 1999 +++ linux.ac/drivers/video/p9100fb.c Mon Sep 13 23:44:29 1999 @@ -106,7 +106,7 @@ static char idstring[60] __initdata = { 0 }; -__initfunc(char *p9100fb_init(struct fb_info_sbusfb *fb)) +char * __init p9100fb_init(struct fb_info_sbusfb *fb) { struct fb_fix_screeninfo *fix = &fb->fix; struct display *disp = &fb->disp; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/Config.in linux.ac/fs/Config.in --- linux.vanilla/fs/Config.in Tue Sep 7 22:07:06 1999 +++ linux.ac/fs/Config.in Mon Sep 13 00:22:42 1999 @@ -4,15 +4,15 @@ mainmenu_option next_comment comment 'Filesystems' -bool 'Quota support' CONFIG_QUOTA +bool 'Quota support' CONFIG_QUOTA tristate 'Kernel automounter support' CONFIG_AUTOFS_FS if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'ADFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_ADFS_FS + tristate 'ADFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_ADFS_FS fi tristate 'Amiga FFS filesystem support' CONFIG_AFFS_FS -tristate 'Apple Macintosh filesystem support (experimental)' CONFIG_HFS_FS +tristate 'Apple Macintosh filesystem support (EXPERIMENTAL)' CONFIG_HFS_FS # msdos filesystems tristate 'DOS FAT fs support' CONFIG_FAT_FS dep_tristate ' MSDOS fs support' CONFIG_MSDOS_FS $CONFIG_FAT_FS @@ -20,48 +20,48 @@ dep_tristate ' VFAT (Windows-95) fs support' CONFIG_VFAT_FS $CONFIG_FAT_FS if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'EFS filesystem support (read only) (experimental)' CONFIG_EFS_FS + tristate 'EFS filesystem support (read only) (EXPERIMENTAL)' CONFIG_EFS_FS fi tristate 'ISO 9660 CDROM filesystem support' CONFIG_ISO9660_FS if [ "$CONFIG_ISO9660_FS" != "n" ]; then - bool 'Microsoft Joliet CDROM extensions' CONFIG_JOLIET + bool ' Microsoft Joliet CDROM extensions' CONFIG_JOLIET else - # needed by nls/Config.in - define_bool CONFIG_JOLIET n + # needed by nls/Config.in + define_bool CONFIG_JOLIET n fi -tristate 'UDF filesystem support' CONFIG_UDF_FS +tristate 'UDF filesystem support (read only)' CONFIG_UDF_FS if [ "$CONFIG_UDF_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool ' UDF read-write support (EXPERIMENTAL)' CONFIG_UDF_RW + 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 - bool ' NTFS read-write support (DANGEROUS)' CONFIG_NTFS_RW + bool ' NTFS write support (DANGEROUS)' CONFIG_NTFS_RW fi -tristate 'OS/2 HPFS filesystem support (read/write) (NEW)' CONFIG_HPFS_FS +tristate 'OS/2 HPFS filesystem support' CONFIG_HPFS_FS bool '/proc filesystem support' CONFIG_PROC_FS if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then - # It compiles as a module for testing only. It should not be used - # as a module in general. If we make this "tristate", a bunch of people - # who don't know what they are doing turn it on and complain when it - # breaks. - bool '/dev/pts filesystem for Unix98 PTYs' CONFIG_DEVPTS_FS + # It compiles as a module for testing only. It should not be used + # as a module in general. If we make this "tristate", a bunch of people + # who don't know what they are doing turn it on and complain when it + # breaks. + bool '/dev/pts filesystem for Unix98 PTYs' CONFIG_DEVPTS_FS fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'QNX filesystem support (EXPERIMENTAL)' CONFIG_QNX4FS_FS - if [ "$CONFIG_QNX4FS_FS" != "n" ]; then - bool ' QNXFS read-write support (FOR TESTING ONLY)' CONFIG_QNX4FS_RW - fi + tristate 'QNX filesystem support (read only) (EXPERIMENTAL)' CONFIG_QNX4FS_FS + if [ "$CONFIG_QNX4FS_FS" != "n" ]; then + bool ' QNXFS write support (DANGEROUS)' CONFIG_QNX4FS_RW + fi fi tristate 'ROM filesystem support' CONFIG_ROMFS_FS tristate 'Second extended fs support' CONFIG_EXT2_FS tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS -tristate 'UFS filesystem support' CONFIG_UFS_FS -if [ "$CONFIG_UFS_FS" != "n" ]; then - bool ' UFS filesystem write support (experimental)' CONFIG_UFS_FS_WRITE +tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS +if [ "$CONFIG_UFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" ]; then + bool ' UFS filesystem write support (DANGEROUS)' CONFIG_UFS_FS_WRITE fi @@ -71,35 +71,36 @@ comment 'Network File Systems' if [ "$CONFIG_INET" = "y" ]; then - tristate 'Coda filesystem support (advanced network fs)' CONFIG_CODA_FS - tristate 'NFS filesystem support' CONFIG_NFS_FS - if [ "$CONFIG_NFS_FS" = "y" -a "$CONFIG_IP_PNP" = "y" ]; then - bool ' Root file system on NFS' CONFIG_ROOT_NFS - fi - # considering that RedHat-6.0 ships with this on, I guess it's not really experimental - tristate 'NFS server support' CONFIG_NFSD - if [ "$CONFIG_NFSD" != "n" ]; then - bool ' Emulate SUN NFS server' CONFIG_NFSD_SUN - fi - if [ "$CONFIG_NFS_FS" = "y" -o "$CONFIG_NFSD" = "y" ]; then - define_bool CONFIG_SUNRPC y - define_bool CONFIG_LOCKD y - else - if [ "$CONFIG_NFS_FS" = "m" -o "$CONFIG_NFSD" = "m" ]; then - define_bool CONFIG_SUNRPC m - define_bool CONFIG_LOCKD m - else - define_bool CONFIG_SUNRPC n - define_bool CONFIG_LOCKD n - fi - fi - tristate 'SMB filesystem support (to mount WfW shares etc.)' CONFIG_SMB_FS + tristate 'Coda filesystem support (advanced network fs)' CONFIG_CODA_FS + tristate 'NFS filesystem support' CONFIG_NFS_FS + if [ "$CONFIG_NFS_FS" = "y" -a "$CONFIG_IP_PNP" = "y" ]; then + bool ' Root file system on NFS' CONFIG_ROOT_NFS + fi + if [ "$CONFIG_EXPERIMENTAL" ]; then + tristate 'NFS server support (EXPERIMENTAL)' CONFIG_NFSD + if [ "$CONFIG_NFSD" != "n" ]; then + bool ' Emulate SUN NFS server' CONFIG_NFSD_SUN + fi + fi + if [ "$CONFIG_NFS_FS" = "y" -o "$CONFIG_NFSD" = "y" ]; then + define_bool CONFIG_SUNRPC y + define_bool CONFIG_LOCKD y + else + if [ "$CONFIG_NFS_FS" = "m" -o "$CONFIG_NFSD" = "m" ]; then + define_bool CONFIG_SUNRPC m + define_bool CONFIG_LOCKD m + else + define_bool CONFIG_SUNRPC n + define_bool CONFIG_LOCKD n + fi + fi + tristate 'SMB filesystem support (to mount WfW shares etc.)' CONFIG_SMB_FS fi if [ "$CONFIG_IPX" != "n" -o "$CONFIG_INET" != "n" ]; then - tristate 'NCP filesystem support (to mount NetWare volumes)' CONFIG_NCP_FS - if [ "$CONFIG_NCP_FS" != "n" ]; then - source fs/ncpfs/Config.in - fi + tristate 'NCP filesystem support (to mount NetWare volumes)' CONFIG_NCP_FS + if [ "$CONFIG_NCP_FS" != "n" ]; then + source fs/ncpfs/Config.in + fi fi endmenu diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/binfmt_aout.c linux.ac/fs/binfmt_aout.c --- linux.vanilla/fs/binfmt_aout.c Thu Sep 2 00:48:38 1999 +++ linux.ac/fs/binfmt_aout.c Tue Sep 14 21:24:56 1999 @@ -270,6 +270,7 @@ unsigned long fd_offset; unsigned long rlim; int retval; + static unsigned long error_time=0; ex = *((struct exec *) bprm->buf); /* exec-header */ if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && @@ -283,7 +284,11 @@ #ifdef __i386__ if (N_MAGIC(ex) == ZMAGIC && fd_offset != BLOCK_SIZE) { - printk(KERN_NOTICE "N_TXTOFF != BLOCK_SIZE. See a.out.h.\n"); + if((jiffies-error_time) >5) + { + printk(KERN_NOTICE "N_TXTOFF != BLOCK_SIZE. See a.out.h.\n"); + error_time=jiffies; + } return -ENOEXEC; } @@ -291,7 +296,11 @@ bprm->dentry->d_inode->i_op && bprm->dentry->d_inode->i_op->get_block && (fd_offset < bprm->dentry->d_inode->i_sb->s_blocksize)) { - printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n"); + if((jiffies-error_time) >5) + { + printk(KERN_NOTICE "N_TXTOFF < BLOCK_SIZE. Please convert binary.\n"); + error_time=jiffies; + } return -ENOEXEC; } #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/buffer.c linux.ac/fs/buffer.c --- linux.vanilla/fs/buffer.c Tue Sep 7 22:07:06 1999 +++ linux.ac/fs/buffer.c Sat Sep 18 01:36:51 1999 @@ -114,18 +114,18 @@ each time we call refill */ int nref_dirt; /* Dirty buffer threshold for activating bdflush when trying to refill buffers. */ - int dummy1; /* unused */ + int interval; /* jiffies delay between kupdate flushes */ int age_buffer; /* Time for normal buffer to age before we flush it */ int age_super; /* Time for superblock to age before we flush it */ int dummy2; /* unused */ int dummy3; /* unused */ } b_un; unsigned int data[N_PARAM]; -} bdf_prm = {{40, 500, 64, 256, 15, 30*HZ, 5*HZ, 1884, 2}}; +} bdf_prm = {{40, 500, 64, 256, 5*HZ, 30*HZ, 5*HZ, 1884, 2}}; /* These are the min and max parameter values that we will allow to be assigned */ int bdflush_min[N_PARAM] = { 0, 10, 5, 25, 0, 1*HZ, 1*HZ, 1, 1}; -int bdflush_max[N_PARAM] = {100,50000, 20000, 20000,1000, 6000*HZ, 6000*HZ, 2047, 5}; +int bdflush_max[N_PARAM] = {100,50000, 20000, 20000,600*HZ, 6000*HZ, 6000*HZ, 2047, 5}; void wakeup_bdflush(int); @@ -1158,7 +1158,7 @@ goto try_again; } -static int create_page_buffers(int rw, struct page *page, kdev_t dev, int b[], int size, int bmap) +static int create_page_buffers(int rw, struct page *page, kdev_t dev, int b[], int size) { struct buffer_head *head, *bh, *tail; int block; @@ -1186,17 +1186,6 @@ bh->b_dev = dev; bh->b_blocknr = block; - /* - * When we use bmap, we define block zero to represent - * a hole. ll_rw_page, however, may legitimately - * access block zero, and we need to distinguish the - * two cases. - */ - if (bmap && !block) { - memset(bh->b_data, 0, size); - set_bit(BH_Uptodate, &bh->b_state); - continue; - } set_bit(BH_Mapped, &bh->b_state); } tail->b_this_page = head; @@ -1236,7 +1225,6 @@ mark_buffer_clean(bh); wait_on_buffer(bh); clear_bit(BH_Uptodate, &bh->b_state); - clear_bit(BH_Mapped, &bh->b_state); clear_bit(BH_Req, &bh->b_state); bh->b_blocknr = 0; } @@ -1247,7 +1235,7 @@ /* * subtle. We release buffer-heads only if this is - * the 'final' flushpage. We have invalidated the bmap + * the 'final' flushpage. We have invalidated the get_block * cached value unconditionally, so real IO is not * possible anymore. * @@ -1750,7 +1738,7 @@ */ int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], - kdev_t dev, unsigned long b[], int size, int bmap) + kdev_t dev, unsigned long b[], int size) { int err; int length; @@ -1873,7 +1861,7 @@ return err; error: - /* We got an error allocation the bh'es. Just free the current + /* We got an error allocating the bh'es. Just free the current buffer_heads and exit. */ spin_lock(&unused_list_lock); for (i = bhind; --i >= 0; ) { @@ -1895,7 +1883,7 @@ * FIXME: we need a swapper_inode->get_block function to remove * some of the bmap kludges and interface ugliness here. */ -int brw_page(int rw, struct page *page, kdev_t dev, int b[], int size, int bmap) +int brw_page(int rw, struct page *page, kdev_t dev, int b[], int size) { struct buffer_head *head, *bh, *arr[MAX_BUF_PER_PAGE]; int nr, fresh /* temporary debugging flag */, block; @@ -1909,7 +1897,7 @@ */ fresh = 0; if (!page->buffers) { - create_page_buffers(rw, page, dev, b, size, bmap); + create_page_buffers(rw, page, dev, b, size); fresh = 1; } if (!page->buffers) @@ -1927,16 +1915,9 @@ if (rw == READ) { if (!fresh) BUG(); - if (bmap && !block) { - if (block) - BUG(); - } else { - if (bmap && !block) - BUG(); - if (!buffer_uptodate(bh)) { - arr[nr++] = bh; - atomic_inc(&bh->b_count); - } + if (!buffer_uptodate(bh)) { + arr[nr++] = bh; + atomic_inc(&bh->b_count); } } else { /* WRITE */ if (!bh->b_blocknr) { @@ -1974,7 +1955,7 @@ /* * Generic "read page" function for block devices that have the normal - * bmap functionality. This is most of the block device filesystems. + * get_block functionality. This is most of the block device filesystems. * Reads the page asynchronously --- the unlock_buffer() and * mark_buffer_uptodate() functions propagate buffer state into the * page struct once IO has completed. @@ -2326,6 +2307,10 @@ return -EPERM; if (func == 1) { + /* do_exit directly and let kupdate to do its work alone. */ + do_exit(0); +#if 0 /* left here as it's the only example of lazy-mm-stuff used from + a syscall that doesn't care about the current mm context. */ int error; struct mm_struct *user_mm; @@ -2339,6 +2324,7 @@ error = sync_old_buffers(); end_lazy_tlb(user_mm); return error; +#endif } /* Basically func 1 means read param 1, 2 means write param 1, etc */ @@ -2457,9 +2443,70 @@ } } +/* + * This is the kernel update daemon. It used to live in userspace + * but since it is needed in order to run safely we don't want it to + * be killable by mistake. + * You don't need to change your userspace configuration since + * the userspace `update` will do_exit(0) at the first sys_bdflush(). + */ + +int kupdate(void * unused) +{ + struct task_struct * tsk = current; + int interval; + + tsk->session = 1; + tsk->pgrp = 1; + strcpy(tsk->comm, "kupdate"); + + /* sigstop and sigcont will stop and wakeup kupdate */ + spin_lock_irq(&tsk->sigmask_lock); + sigfillset(&tsk->blocked); + siginitsetinv(¤t->blocked, sigmask(SIGCONT) | sigmask(SIGSTOP)); + recalc_sigpending(tsk); + spin_unlock_irq(&tsk->sigmask_lock); + + for (;;) { + /* update interval */ + interval = bdf_prm.b_un.interval; + if (interval) + { + tsk->state = TASK_INTERRUPTIBLE; + schedule_timeout(interval); + } + else + { + stop_kupdate: + tsk->state = TASK_STOPPED; + schedule(); /* wait for SIGCONT */ + } + /* check for sigstop */ + if (signal_pending(tsk)) + { + int stopped = 0; + spin_lock_irq(&tsk->sigmask_lock); + if (sigismember(&tsk->signal, SIGSTOP)) + { + sigdelset(&tsk->signal, SIGSTOP); + stopped = 1; + } + recalc_sigpending(tsk); + spin_unlock_irq(&tsk->sigmask_lock); + if (stopped) + goto stop_kupdate; + } +#ifdef DEBUG + printk("kupdate() activated...\n"); +#endif + sync_old_buffers(); + } +} + static int __init bdflush_init(void) { kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); + kernel_thread(kupdate, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); return 0; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/exec.c linux.ac/fs/exec.c --- linux.vanilla/fs/exec.c Tue Sep 7 22:07:06 1999 +++ linux.ac/fs/exec.c Thu Sep 16 16:42:35 1999 @@ -169,7 +169,7 @@ /* * count() counts the number of arguments/envelopes */ -static int count(char ** argv) +static int count(char ** argv, int max) { int i = 0; @@ -184,7 +184,8 @@ if (!p) break; argv++; - i++; + if(++i > max) + return -E2BIG; } } return i; @@ -202,7 +203,7 @@ int len; unsigned long pos; - if (get_user(str, argv+argc) || !str || !(len = strlen_user(str))) + if (get_user(str, argv+argc) || !str || !(len = strnlen_user(str, bprm->p))) return -EFAULT; if (bprm->p < len) return -E2BIG; @@ -211,7 +212,7 @@ /* XXX: add architecture specific overflow check here. */ pos = bprm->p; - while (len) { + while (len>0) { char *pag; int offset, bytes_to_copy; @@ -274,7 +275,7 @@ mpnt->vm_ops = NULL; mpnt->vm_offset = 0; mpnt->vm_file = NULL; - mpnt->vm_private_data = NULL; + mpnt->vm_private_data = (void *) 0; insert_vm_struct(current->mm, mpnt); current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; } @@ -753,12 +754,12 @@ bprm.sh_bang = 0; bprm.loader = 0; bprm.exec = 0; - if ((bprm.argc = count(argv)) < 0) { + if ((bprm.argc = count(argv, bprm.p / sizeof(void *))) < 0) { dput(dentry); return bprm.argc; } - if ((bprm.envc = count(envp)) < 0) { + if ((bprm.envc = count(envp, bprm.p / sizeof(void *))) < 0) { dput(dentry); return bprm.envc; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/fcntl.c linux.ac/fs/fcntl.c --- linux.vanilla/fs/fcntl.c Thu Sep 2 00:48:39 1999 +++ linux.ac/fs/fcntl.c Wed Sep 15 23:56:18 1999 @@ -8,6 +8,8 @@ #include #include +#include +#include #include extern int sock_fcntl (struct file *, unsigned int cmd, unsigned long arg); @@ -255,8 +257,22 @@ return err; } +/* Table to convert sigio signal codes into poll band bitmaps */ + +static int band_table[NSIGPOLL+1] = { + ~0, + POLLIN | POLLRDNORM, /* POLL_IN */ + POLLOUT | POLLWRNORM | POLLWRBAND, /* POLL_OUT */ + POLLIN | POLLRDNORM | POLLMSG, /* POLL_MSG */ + POLLERR, /* POLL_ERR */ + POLLPRI | POLLRDBAND, /* POLL_PRI */ + POLLHUP | POLLERR /* POLL_HUP */ +}; + static void send_sigio_to_task(struct task_struct *p, - struct fown_struct *fown, struct fasync_struct *fa) + struct fown_struct *fown, + struct fasync_struct *fa, + int reason) { if ((fown->euid != 0) && (fown->euid ^ p->suid) && (fown->euid ^ p->uid) && @@ -273,9 +289,11 @@ back to SIGIO in that case. --sct */ si.si_signo = fown->signum; si.si_errno = 0; - si.si_code = SI_SIGIO; - si.si_pid = fown->pid; - si.si_uid = fown->uid; + si.si_code = reason; + if (reason < 0 || reason > NSIGPOLL) + si.si_band = ~0; + else + si.si_band = band_table[reason]; si.si_fd = fa->fa_fd; if (!send_sig_info(fown->signum, &si, p)) break; @@ -285,14 +303,15 @@ } } -static void send_sigio(struct fown_struct *fown, struct fasync_struct *fa) +static void send_sigio(struct fown_struct *fown, struct fasync_struct *fa, + int band) { struct task_struct * p; int pid = fown->pid; read_lock(&tasklist_lock); if ( (pid > 0) && (p = find_task_by_pid(pid)) ) { - send_sigio_to_task(p, fown, fa); + send_sigio_to_task(p, fown, fa, band); goto out; } for_each_task(p) { @@ -301,13 +320,13 @@ match = -p->pgrp; if (pid != match) continue; - send_sigio_to_task(p, fown, fa); + send_sigio_to_task(p, fown, fa, band); } out: read_unlock(&tasklist_lock); } -void kill_fasync(struct fasync_struct *fa, int sig) +void kill_fasync(struct fasync_struct *fa, int sig, int band) { while (fa) { struct fown_struct * fown; @@ -317,8 +336,11 @@ return; } fown = &fa->fa_file->f_owner; - if (fown->pid) - send_sigio(fown, fa); + /* Don't send SIGURG to processes which have not set a + queued signum: SIGURG has its own default signalling + mechanism. */ + if (fown->pid && !(sig == SIGURG && fown->signum == 0)) + send_sigio(fown, fa, band); fa = fa->fa_next; } } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/isofs/inode.c linux.ac/fs/isofs/inode.c --- linux.vanilla/fs/isofs/inode.c Thu Sep 2 00:48:39 1999 +++ linux.ac/fs/isofs/inode.c Wed Sep 15 23:53:22 1999 @@ -446,6 +446,14 @@ inode_fake.i_rdev=dev; init_waitqueue_head(&inode_fake.i_wait); ms_info.addr_format=CDROM_LBA; + /* If a minor device was explicitly opened, set session to the + * minor number. For instance, if /dev/hdc1 is mounted, session + * 1 on the CD-ROM is selected. CD_PART_MAX gives access to + * a max of 64 sessions on IDE. SCSI drives must still use + * the session option to mount. + */ + if ((MINOR(dev) % CD_PART_MAX) && (MAJOR(dev) != SCSI_CDROM_MAJOR)) + session = MINOR(dev) % CD_PART_MAX; set_fs(KERNEL_DS); if(session >= 0 && session <= 99) { struct cdrom_tocentry Te; @@ -1042,6 +1050,7 @@ struct buffer_head * bh = NULL; int block = 0; int i = 0; + int more_entries = 0; void *cpnt; struct iso_directory_record * raw_inode; @@ -1062,7 +1071,6 @@ goto out_noread; } pnt = ((unsigned char *) bh->b_data + offset); - raw_inode = ((struct iso_directory_record *) pnt); /* * Note: this is invariant even if the record * spans buffers and must be copied ... @@ -1074,6 +1082,7 @@ ino = (ino & ~(ISOFS_BLOCK_SIZE - 1)) + ISOFS_BLOCK_SIZE; continue; } + raw_inode = ((struct iso_directory_record *) pnt); /* Check whether the raw inode spans the buffer ... */ if (offset + reclen > bufsize){ @@ -1095,13 +1104,15 @@ inode->i_size += isonum_733 (raw_inode->size); if(i == 1) inode->u.isofs_i.i_next_section_ino = ino; + more_entries = raw_inode->flags[-high_sierra] & 0x80; + ino += reclen; if (cpnt) kfree (cpnt); i++; if(i > 100) goto out_toomany; - } while(raw_inode->flags[-high_sierra] & 0x80); + } while(more_entries); out: brelse(bh); return 0; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/namei.c linux.ac/fs/namei.c --- linux.vanilla/fs/namei.c Thu Aug 26 14:42:18 1999 +++ linux.ac/fs/namei.c Thu Sep 2 16:51:04 1999 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -548,83 +549,6 @@ return -EEXIST; return permission(dir,MAY_WRITE | MAY_EXEC); } - -static inline struct dentry *get_parent(struct dentry *dentry) -{ - return dget(dentry->d_parent); -} - -static inline void unlock_dir(struct dentry *dir) -{ - up(&dir->d_inode->i_sem); - dput(dir); -} - -/* - * 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 requied 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.. - */ -#define check_parent(dir, dentry) \ - ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_hash)) - -/* - * Locking the parent is needed to: - * - serialize directory operations - * - make sure the parent doesn't change from - * under us in the middle of an operation. - * - * NOTE! Right now we'd rather use a "struct inode" - * for this, but as I expect things to move toward - * using dentries instead for most things it is - * probably better to start with the conceptually - * better interface of relying on a path of dentries. - */ -static inline struct dentry *lock_parent(struct dentry *dentry) -{ - struct dentry *dir = dget(dentry->d_parent); - - down(&dir->d_inode->i_sem); - return dir; -} - -/* - * Whee.. Deadlock country. Happily there are only two VFS - * operations that do this.. - */ -static inline void double_lock(struct dentry *d1, struct dentry *d2) -{ - struct semaphore *s1 = &d1->d_inode->i_sem; - struct semaphore *s2 = &d2->d_inode->i_sem; - - if (s1 != s2) { - if ((unsigned long) s1 < (unsigned long) s2) { - struct semaphore *tmp = s2; - s2 = s1; s1 = tmp; - } - down(s1); - } - down(s2); -} - -static inline void double_unlock(struct dentry *d1, struct dentry *d2) -{ - struct semaphore *s1 = &d1->d_inode->i_sem; - struct semaphore *s2 = &d2->d_inode->i_sem; - - up(s1); - if (s1 != s2) - up(s2); - dput(d1); - dput(d2); -} - /* * Special case: O_CREAT|O_EXCL implies O_NOFOLLOW for security diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/ncpfs/Config.in linux.ac/fs/ncpfs/Config.in --- linux.vanilla/fs/ncpfs/Config.in Tue Apr 20 23:17:20 1999 +++ linux.ac/fs/ncpfs/Config.in Mon Sep 13 00:22:42 1999 @@ -1,15 +1,15 @@ # # NCP Filesystem configuration # -bool ' Packet signatures' CONFIG_NCPFS_PACKET_SIGNING -bool ' Proprietary file locking' CONFIG_NCPFS_IOCTL_LOCKING -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 +bool ' Packet signatures' CONFIG_NCPFS_PACKET_SIGNING +bool ' Proprietary file locking' CONFIG_NCPFS_IOCTL_LOCKING +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 + bool ' Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS fi -bool ' Allow mounting of volume subdirectories' CONFIG_NCPFS_MOUNT_SUBDIR -# bool ' NDS interserver authentication support' CONFIG_NCPFS_NDS_DOMAINS -bool ' Use Native Language Support' CONFIG_NCPFS_NLS -bool ' Enable symbolic links and execute flags' CONFIG_NCPFS_EXTRAS +bool ' Allow mounting of volume subdirectories' CONFIG_NCPFS_MOUNT_SUBDIR +# bool ' NDS interserver authentication support' CONFIG_NCPFS_NDS_DOMAINS +bool ' Use Native Language Support' CONFIG_NCPFS_NLS +bool ' Enable symbolic links and execute flags' CONFIG_NCPFS_EXTRAS diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/nfs/file.c linux.ac/fs/nfs/file.c --- linux.vanilla/fs/nfs/file.c Mon Jul 5 22:33:52 1999 +++ linux.ac/fs/nfs/file.c Sat Sep 18 18:29:10 1999 @@ -222,7 +222,7 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl) { struct inode * inode = filp->f_dentry->d_inode; - int status; + int status = 0; dprintk("NFS: nfs_lock(f=%4x/%ld, t=%x, fl=%x, r=%ld:%ld)\n", inode->i_dev, inode->i_ino, @@ -237,8 +237,11 @@ return -ENOLCK; /* Fake OK code if mounted without NLM support */ - if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) - return 0; + if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM) { + if (cmd == F_GETLK) + status = LOCK_USE_CLNT; + goto out_ok; + } /* * No BSD flocks over NFS allowed. @@ -260,11 +263,14 @@ if ((status = nlmclnt_proc(inode, cmd, fl)) < 0) return status; + else + status = 0; /* * Make sure we re-validate anything we've got cached. * This makes locking act as a cache coherency point. */ + out_ok: NFS_CACHEINV(inode); - return 0; + return status; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/nfs/inode.c linux.ac/fs/nfs/inode.c --- linux.vanilla/fs/nfs/inode.c Mon Jul 5 22:33:38 1999 +++ linux.ac/fs/nfs/inode.c Tue Sep 14 21:27:07 1999 @@ -412,6 +412,8 @@ unhashed = 0; while ((tmp = tmp->next) != head) { struct dentry *dentry = list_entry(tmp, struct dentry, d_alias); + if (!list_empty(&dentry->d_subdirs)) + shrink_dcache_parent(dentry); dprintk("nfs_free_dentries: found %s/%s, d_count=%d, hashed=%d\n", dentry->d_parent->d_name.name, dentry->d_name.name, dentry->d_count, !list_empty(&dentry->d_hash)); @@ -421,7 +423,7 @@ dput(dentry); goto restart; } - if (!list_empty(&dentry->d_hash)) + if (list_empty(&dentry->d_hash)) unhashed++; } return unhashed; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/open.c linux.ac/fs/open.c --- linux.vanilla/fs/open.c Thu Aug 26 14:42:18 1999 +++ linux.ac/fs/open.c Tue Sep 14 21:27:17 1999 @@ -526,10 +526,13 @@ * non-root user, remove the setuid bit. * 19981026 David C Niemi * + * Changed this to apply to all users, including root, to avoid + * some races. This is the behavior we had in 2.0. The check for + * non-root was definitely wrong for 2.2 anyway, as it should + * have been using CAP_FSETID rather than fsuid -- 19990830 SD. */ if ((inode->i_mode & S_ISUID) == S_ISUID && - !S_ISDIR(inode->i_mode) - && current->fsuid) + !S_ISDIR(inode->i_mode)) { newattrs.ia_mode &= ~S_ISUID; newattrs.ia_valid |= ATTR_MODE; @@ -539,9 +542,11 @@ * by a non-root user, remove the setgid bit UNLESS there is no group * execute bit (this would be a file marked for mandatory locking). * 19981026 David C Niemi + * + * Removed the fsuid check (see the comment above) -- 19990830 SD. */ if (((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) - && !S_ISDIR(inode->i_mode) && current->fsuid) + && !S_ISDIR(inode->i_mode)) { newattrs.ia_mode &= ~S_ISGID; newattrs.ia_valid |= ATTR_MODE; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/partitions/Config.in linux.ac/fs/partitions/Config.in --- linux.vanilla/fs/partitions/Config.in Tue Sep 7 22:07:06 1999 +++ linux.ac/fs/partitions/Config.in Thu Sep 16 16:26:18 1999 @@ -3,60 +3,54 @@ # bool 'Advanced partition selection' CONFIG_PARTITION_ADVANCED if [ "$CONFIG_PARTITION_ADVANCED" = "y" ]; then - bool 'Alpha OSF partition support' CONFIG_OSF_PARTITION - bool 'Macintosh partition map support' CONFIG_MAC_PARTITION - bool 'PC BIOS (MSDOS partition tables) support' CONFIG_MSDOS_PARTITION + bool ' Alpha OSF partition support' CONFIG_OSF_PARTITION + bool ' Macintosh partition map support' CONFIG_MAC_PARTITION + bool ' PC BIOS (MSDOS partition tables) support' CONFIG_MSDOS_PARTITION + bool ' SGI partition support' CONFIG_SGI_PARTITION + bool ' Sun partition tables support' CONFIG_SUN_PARTITION + bool ' Amiga partition table support' CONFIG_AMIGA_PARTITION + bool ' Atari partition table support' CONFIG_ATARI_PARTITION + bool ' Acorn partition support' CONFIG_ACORN_PARTITION + if [ "$CONFIG_ACORN_PARTITION" != "n" ]; then + bool ' Native filecore partition support' CONFIG_ACORN_PARTITION_ADFS +# bool ' Cumana partition support' CONFIG_ACORN_PARTITION_CUMANA + bool ' ICS partition support' CONFIG_ACORN_PARTITION_ICS + bool ' PowerTec partition support' CONFIG_ACORN_PARTITION_POWERTEC + bool ' RISCiX partition support' CONFIG_ACORN_PARTITION_RISCIX + fi else - if [ "$ARCH" = "alpha" ]; then - define_bool CONFIG_OSF_PARTITION y - fi - if [ "$ARCH" = "ppc" -o "$CONFIG_MAC" = "y" ]; then - define_bool CONFIG_MAC_PARTITION y - fi - if [ "$CONFIG_AMIGA" != "y" -a "$CONFIG_ATARI" != "y" -a \ - "$CONFIG_MAC" != "y" ]; then - define_bool CONFIG_MSDOS_PARTITION y - fi + if [ "$ARCH" = "alpha" ]; then + define_bool CONFIG_OSF_PARTITION y + fi + if [ "$ARCH" = "ppc" -o "$CONFIG_MAC" = "y" ]; then + define_bool CONFIG_MAC_PARTITION y + fi + if [ "$CONFIG_X86" = "y" ]; then + define_bool CONFIG_MSDOS_PARTITION y + fi + if [ "$CONFIG_SGI" = "y" ]; then + define_bool CONFIG_SGI_PARTITION y + fi + if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then + define_bool CONFIG_SUN_PARTITION y + fi + if [ "$CONFIG_AMIGA" = "y" ]; then + define_bool CONFIG_AMIGA_PARTITION y + fi + if [ "$CONFIG_ARCH_ACORN" = "y" ]; then + define_bool CONFIG_ACORN_PARTITION y + define_bool CONFIG_ACORN_PARTITION_ADFS y +# define_bool CONFIG_ACORN_PARTITION_CUMANA y + define_bool CONFIG_ACORN_PARTITION_ICS y + define_bool CONFIG_ACORN_PARTITION_POWERTEC y + define_bool CONFIG_ACORN_PARTITION_RISCIX y + fi + if [ "$CONFIG_ATARI" = "y" ]; then + define_bool CONFIG_ATARI_PARTITION y + fi fi if [ "$CONFIG_MSDOS_PARTITION" = "y" ]; then - bool ' BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL - bool ' Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION - bool ' Unixware slices support' CONFIG_UNIXWARE_DISKLABEL -fi -if [ "$CONFIG_SGI" != "y" ]; then - bool 'SGI partition support' CONFIG_SGI_PARTITION -else - define_bool CONFIG_SGI_PARTITION y -fi -if [ "$ARCH" != "sparc" -a "$ARCH" != "sparc64" ]; then - bool 'Sun partition tables support' CONFIG_SUN_PARTITION -else - define_bool CONFIG_SUN_PARTITION y -fi -if [ "$CONFIG_PARTITION_ADVANCED" = "y" ]; then - bool 'Amiga partition table support' CONFIG_AMIGA_PARTITION - bool 'Atari partition table support' CONFIG_ATARI_PARTITION - bool 'Acorn partition support' CONFIG_ACORN_PARTITION - if [ "$CONFIG_ACORN_PARTITION" != "n" ]; then - bool ' Native filecore partition support' CONFIG_ACORN_PARTITION_ADFS -# bool ' Cumana partition support' CONFIG_ACORN_PARTITION_CUMANA - bool ' ICS partition support' CONFIG_ACORN_PARTITION_ICS - bool ' PowerTec partition support' CONFIG_ACORN_PARTITION_POWERTEC - bool ' RISCiX partition support' CONFIG_ACORN_PARTITION_RISCIX - fi -else - if [ "$CONFIG_AMIGA" = "y" ]; then - define_bool CONFIG_AMIGA_PARTITION y - fi - if [ "$CONFIG_ARCH_ACORN" = "y" ]; then - define_bool CONFIG_ACORN_PARTITION y - define_bool CONFIG_ACORN_PARTITION_ADFS y -# define_bool CONFIG_ACORN_PARTITION_CUMANA y - define_bool CONFIG_ACORN_PARTITION_ICS y - define_bool CONFIG_ACORN_PARTITION_POWERTEC y - define_bool CONFIG_ACORN_PARTITION_RISCIX y - fi -fi -if [ "$CONFIG_ATARI" = "y" ]; then - define_bool CONFIG_ATARI_PARTITION y + bool 'BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL + bool 'Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION + bool 'Unixware slices support' CONFIG_UNIXWARE_DISKLABEL fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/proc/array.c linux.ac/fs/proc/array.c --- linux.vanilla/fs/proc/array.c Thu Sep 2 00:48:39 1999 +++ linux.ac/fs/proc/array.c Sat Sep 18 19:34:21 1999 @@ -38,7 +38,6 @@ * * aeb@cwi.nl : /proc/partitions * - * * Alan Cox : security fixes. * * @@ -46,6 +45,9 @@ * * Gerhard Wichert : added BIGMEM support * Siemens AG + * + * Chuck Lever : safe handling of task_struct + * */ #include @@ -67,6 +69,7 @@ #include #include #include +#include #include #include @@ -469,7 +472,7 @@ return result; } } while (addr & ~PAGE_MASK); - kunmap(addr, KM_READ); + kunmap(addr-1, KM_READ); } return result; } @@ -489,7 +492,6 @@ return mm; } - static int get_env(int pid, char * buffer) { struct mm_struct *mm = get_mm(pid); @@ -842,6 +844,9 @@ return buffer; } +/* + * These next two assume that the task's sigmask_lock is held by the caller. + */ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, sigset_t *catch) { @@ -894,53 +899,104 @@ cap_t(p->cap_effective)); } - +/* + * This is somewhat safer than it was before. However... + * + * Embedded pointers in the task structure may reference data that + * can be changed or that is no longer valid after the tasklist + * lock is released, or that isn't even protected by the tasklist + * lock. Eg. tsk->tty, tsk->sig, and tsk->p_pptr can change after + * we make our own copy of the task structure. This doesn't matter + * unless we are trying to use the pointed-to data as an address. + * So there are still a few safety issues to be addressed here. + */ static int get_status(int pid, char * buffer) { char * orig = buffer; struct task_struct *tsk; struct mm_struct *mm = NULL; + /* + * We lock the whole kernel here because p->files is still + * protected by the global kernel lock. + */ + lock_kernel(); + read_lock(&tasklist_lock); tsk = find_task_by_pid(pid); - if (tsk) + if (tsk) { mm = tsk->mm; - if (mm) - atomic_inc(&mm->mm_users); - read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */ - if (!tsk) - return 0; - buffer = task_name(tsk, buffer); - buffer = task_state(tsk, buffer); - if (mm) + if (mm) + atomic_inc(&mm->mm_users); + + buffer = task_name(tsk, buffer); + buffer = task_state(tsk, buffer); + + spin_lock_irq(&tsk->sigmask_lock); + buffer = task_sig(tsk, buffer); + spin_unlock_irq(&tsk->sigmask_lock); + + buffer = task_cap(tsk, buffer); + } + read_unlock(&tasklist_lock); + + unlock_kernel(); + + /* + * We can't hold the tasklist_lock and jiggle the mmap_sem -- + * that can result in a deadlock. + */ + if (mm) { buffer = task_mem(mm, buffer); - buffer = task_sig(tsk, buffer); - buffer = task_cap(tsk, buffer); - if (mm) mmput(mm); + } + + /* + * (buffer - orig) will be zero on an error exit. + */ return buffer - orig; } static int get_stat(int pid, char * buffer) { - struct task_struct *tsk; + struct task_struct *tsk, *p; struct mm_struct *mm = NULL; unsigned long vsize, eip, esp, wchan; long priority, nice; - int tty_pgrp; + pid_t ppid = 0; sigset_t sigign, sigcatch; char state; - int res; + int res = 0; - read_lock(&tasklist_lock); - tsk = find_task_by_pid(pid); - if (tsk) - mm = tsk->mm; - if (mm) - atomic_inc(&mm->mm_users); - read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */ + tsk = kmalloc(sizeof(struct task_struct), GFP_KERNEL); if (!tsk) - return 0; + goto out; + + /* + * Hold the tasklist_lock and extract address information + * we may need after the lock is released. We can't hold + * the tasklist_lock and jiggle the mmap_sem -- that can + * result in a deadlock. + */ + read_lock(&tasklist_lock); + p = find_task_by_pid(pid); + if (p) { + memcpy(tsk, p, sizeof(struct task_struct)); + + mm = p->mm; + if (mm) + atomic_inc(&mm->mm_users); + + ppid = p->p_pptr->pid; + + spin_lock_irq(&p->sigmask_lock); + collect_sigign_sigcatch(p, &sigign, &sigcatch); + spin_unlock_irq(&p->sigmask_lock); + } + read_unlock(&tasklist_lock); + if (!p) + goto free_out; + state = *get_task_state(tsk); vsize = eip = esp = 0; if (mm) { @@ -958,13 +1014,6 @@ wchan = get_wchan(tsk); - collect_sigign_sigcatch(tsk, &sigign, &sigcatch); - - if (tsk->tty) - tty_pgrp = tsk->tty->pgrp; - else - tty_pgrp = -1; - /* scale priority and nice values from timeslices to -20..20 */ /* to make it look like a "normal" Unix priority/nice value */ priority = tsk->counter; @@ -978,11 +1027,11 @@ pid, tsk->comm, state, - tsk->p_pptr->pid, + ppid, tsk->pgrp, tsk->session, tsk->tty ? kdev_t_to_nr(tsk->tty->device) : 0, - tty_pgrp, + tsk->tty ? tsk->tty->pgrp : -1, tsk->flags, tsk->min_flt, tsk->cmin_flt, @@ -1018,6 +1067,10 @@ tsk->cnswap, tsk->exit_signal, tsk->processor); + +free_out: + kfree(tsk); +out: if (mm) mmput(mm); return res; @@ -1168,11 +1221,12 @@ size_t count, loff_t *ppos) { struct task_struct *p; + struct mm_struct *mm = NULL; struct vm_area_struct * map, * next; char * destptr = buf, * buffer; loff_t lineno; ssize_t column, i; - int volatile_task; + int volatile_task = 0; long retval; /* @@ -1186,22 +1240,30 @@ retval = -EINVAL; read_lock(&tasklist_lock); p = find_task_by_pid(pid); - read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */ + if (p) { + mm = p->mm; + if (mm) { + atomic_inc(&mm->mm_users); + + /* Check whether the mmaps could change if we sleep */ + volatile_task = (p != current || + atomic_read(&mm->mm_users) > 2); + } + } + read_unlock(&tasklist_lock); if (!p) goto freepage_out; - if (!p->mm || count == 0) + /* nothing to map */ + if (!mm || count == 0) goto getlen_out; - /* Check whether the mmaps could change if we sleep */ - volatile_task = (p != current || atomic_read(&p->mm->mm_users) > 1); - /* decode f_pos */ lineno = *ppos >> MAPS_LINE_SHIFT; column = *ppos & (MAPS_LINE_LENGTH-1); - /* quickly go to line lineno */ - for (map = p->mm->mmap, i = 0; map && (i < lineno); map = map->vm_next, i++) + /* quickly go to line "lineno" */ + for (map = mm->mmap, i = 0; map && (i < lineno); map = map->vm_next, i++) continue; for ( ; map ; map = next ) { @@ -1283,6 +1345,7 @@ /* encode f_pos */ *ppos = (lineno << MAPS_LINE_SHIFT) + column; + mmput(mm); getlen_out: retval = destptr - buf; @@ -1295,28 +1358,28 @@ #ifdef __SMP__ static int get_pidcpu(int pid, char * buffer) { - struct task_struct * tsk = current ; - int i, len; + struct task_struct * tsk; + int i, len = 0; + /* + * Hold the tasklist_lock to guarantee that the task_struct + * address will remain valid while we examine its contents. + */ read_lock(&tasklist_lock); - if (pid != tsk->pid) - tsk = find_task_by_pid(pid); - read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */ - - if (tsk == NULL) - return 0; - - len = sprintf(buffer, - "cpu %lu %lu\n", - tsk->times.tms_utime, - tsk->times.tms_stime); + tsk = find_task_by_pid(pid); + if (tsk) { + len = sprintf(buffer, + "cpu %lu %lu\n", + tsk->times.tms_utime, + tsk->times.tms_stime); - for (i = 0 ; i < smp_num_cpus; i++) - len += sprintf(buffer + len, "cpu%d %lu %lu\n", - i, - tsk->per_cpu_utime[cpu_logical_map(i)], - tsk->per_cpu_stime[cpu_logical_map(i)]); - + for (i = 0 ; i < smp_num_cpus; i++) + len += sprintf(buffer + len, "cpu%d %lu %lu\n", + i, + tsk->per_cpu_utime[cpu_logical_map(i)], + tsk->per_cpu_stime[cpu_logical_map(i)]); + } + read_unlock(&tasklist_lock); return len; } #endif @@ -1453,12 +1516,6 @@ int ok = 0; read_lock(&tasklist_lock); - - /* - * Grab the lock, find the task, save the uid and - * check it has an mm still (ie its not dead) - */ - p = find_task_by_pid(pid); if (p) { euid=p->euid; @@ -1466,9 +1523,7 @@ if(!cap_issubset(p->cap_permitted, current->cap_permitted)) ok=0; } - read_unlock(&tasklist_lock); - if (!p) return 1; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/proc/fd.c linux.ac/fs/proc/fd.c --- linux.vanilla/fs/proc/fd.c Thu Aug 5 20:21:50 1999 +++ linux.ac/fs/proc/fd.c Tue Sep 14 21:27:25 1999 @@ -90,6 +90,7 @@ fd = 0; len = dentry->d_name.len; name = dentry->d_name.name; + if (len > 1 && *name == '0') goto out; while (len-- > 0) { c = *name - '0'; name++; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/proc/root.c linux.ac/fs/proc/root.c --- linux.vanilla/fs/proc/root.c Sat Sep 11 00:54:15 1999 +++ linux.ac/fs/proc/root.c Tue Sep 14 21:27:25 1999 @@ -676,6 +676,13 @@ 0, &proc_array_inode_operations }; #endif +#ifdef CONFIG_SGI_DS1286 +static struct proc_dir_entry proc_root_ds1286 = { + PROC_RTC, 3, "rtc", + S_IFREG | S_IRUGO, 1, 0, 0, + 0, &proc_array_inode_operations +}; +#endif static struct proc_dir_entry proc_root_locks = { PROC_LOCKS, 5, "locks", S_IFREG | S_IRUGO, 1, 0, 0, @@ -758,6 +765,9 @@ #ifdef CONFIG_RTC proc_register(&proc_root, &proc_root_rtc); #endif +#ifdef CONFIG_SGI_DS1286 + proc_register(&proc_root, &proc_root_ds1286); +#endif proc_register(&proc_root, &proc_root_locks); proc_register(&proc_root, &proc_root_mounts); @@ -898,6 +908,7 @@ } pid *= 10; pid += c; + if (!pid) break; if (pid & 0xffff0000) { pid = 0; break; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/fs/qnx4/inode.c linux.ac/fs/qnx4/inode.c --- linux.vanilla/fs/qnx4/inode.c Thu Sep 2 00:48:40 1999 +++ linux.ac/fs/qnx4/inode.c Tue Sep 14 22:54:51 1999 @@ -27,7 +27,6 @@ #define QNX4_VERSION 4 #define QNX4_BMNAME ".bitmap" -#define CHECK_BOOT_SIGNATURE 0 static struct super_operations qnx4_sops; @@ -257,9 +256,6 @@ int i, j; int found = 0; - if (s == NULL) { - return "no qnx4 filesystem (null superblock)."; - } if (*(s->u.qnx4_sb.sb->RootDir.di_fname) != '/') { return "no qnx4 filesystem (no root dir)."; } else { @@ -282,6 +278,8 @@ } } } + /* WAIT! s->u.qnx4_sb.BitMap points into bh->b_data + and now we release bh?? */ brelse(bh); if (found != 0) { break; @@ -299,9 +297,8 @@ { struct buffer_head *bh; kdev_t dev = s->s_dev; -#if CHECK_BOOT_SIGNATURE + struct inode *root; char *tmpc; -#endif const char *errmsg; MOD_INC_USE_COUNT; @@ -311,7 +308,9 @@ s->s_blocksize_bits = 9; s->s_dev = dev; -#if CHECK_BOOT_SIGNATURE + /* Check the boot signature. Since the qnx4 code is + dangerous, we should leave as quickly as possible + if we don't belong here... */ bh = bread(dev, 0, QNX4_BLOCK_SIZE); if (!bh) { printk("qnx4: unable to read the boot sector\n"); @@ -320,11 +319,12 @@ tmpc = (char *) bh->b_data; if (tmpc[4] != 'Q' || tmpc[5] != 'N' || tmpc[6] != 'X' || tmpc[7] != '4' || tmpc[8] != 'F' || tmpc[9] != 'S') { - printk("qnx4: wrong fsid in boot sector.\n"); + if (!silent) + printk("qnx4: wrong fsid in boot sector.\n"); goto out; } brelse(bh); -#endif + bh = bread(dev, 1, QNX4_BLOCK_SIZE); if (!bh) { printk("qnx4: unable to read the superblock\n"); @@ -337,23 +337,35 @@ #endif s->u.qnx4_sb.sb_buf = bh; s->u.qnx4_sb.sb = (struct qnx4_super_block *) bh->b_data; - s->s_root = - d_alloc_root(iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK)); - if (s->s_root == NULL) { - printk("qnx4: get inode failed\n"); - goto out; - } + + + /* check before allocating dentries, inodes, .. */ errmsg = qnx4_checkroot(s); if (errmsg != NULL) { - printk("qnx4: %s\n", errmsg); + if (!silent) + printk("qnx4: %s\n", errmsg); goto out; } + + /* does root not have inode number QNX4_ROOT_INO ?? */ + root = iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK); + if (!root) { + printk("qnx4: get inode failed\n"); + goto out; + } + + s->s_root = d_alloc_root(root); + if (s->s_root == NULL) + goto outi; + brelse(bh); unlock_super(s); s->s_dirt = 1; return s; + outi: + iput(root); out: brelse(bh); outnobh: diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-alpha/keyboard.h linux.ac/include/asm-alpha/keyboard.h --- linux.vanilla/include/asm-alpha/keyboard.h Mon Apr 26 18:54:25 1999 +++ linux.ac/include/asm-alpha/keyboard.h Thu Sep 16 00:13:33 1999 @@ -37,6 +37,31 @@ #define SYSRQ_KEY 0x54 +/* resource allocation */ +#define kbd_request_region() +#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ + "keyboard", NULL) + +/* How to access the keyboard macros on this platform. */ +#define kbd_read_input() inb(KBD_DATA_REG) +#define kbd_read_status() inb(KBD_STATUS_REG) +#define kbd_write_output(val) outb(val, KBD_DATA_REG) +#define kbd_write_command(val) outb(val, KBD_CNTL_REG) + +/* Some stoneage hardware needs delays after some operations. */ +#define kbd_pause() do { } while(0) + +/* + * Machine specific bits for the PS/2 driver + */ + +#define AUX_IRQ 12 + +#define aux_request_irq(hand, dev_id) \ + request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) + +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) + #endif /* __KERNEL__ */ #endif /* __ASMalpha_KEYBOARD_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-alpha/pgtable.h linux.ac/include/asm-alpha/pgtable.h --- linux.vanilla/include/asm-alpha/pgtable.h Sat Sep 11 00:54:15 1999 +++ linux.ac/include/asm-alpha/pgtable.h Thu Sep 16 00:14:22 1999 @@ -622,6 +622,6 @@ #define kern_addr_valid(addr) (1) #define io_remap_page_range(start, busaddr, size, prot) \ - remap_page_range(start, virt_to_phys(ioremap(busaddr)), size, prot) + remap_page_range(start, virt_to_phys(__ioremap(busaddr)), size, prot) #endif /* _ALPHA_PGTABLE_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-alpha/processor.h linux.ac/include/asm-alpha/processor.h --- linux.vanilla/include/asm-alpha/processor.h Tue Aug 17 17:27:39 1999 +++ linux.ac/include/asm-alpha/processor.h Thu Sep 16 00:13:33 1999 @@ -114,6 +114,8 @@ /* Do necessary setup to start up a newly executed thread. */ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); +struct task_struct; + /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-alpha/socket.h linux.ac/include/asm-alpha/socket.h --- linux.vanilla/include/asm-alpha/socket.h Mon Dec 22 01:41:24 1997 +++ linux.ac/include/asm-alpha/socket.h Thu Sep 16 00:13:33 1999 @@ -48,4 +48,18 @@ #define SO_SECURITY_ENCRYPTION_TRANSPORT 20 #define SO_SECURITY_ENCRYPTION_NETWORK 21 +#ifdef __KERNEL__ +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ +#endif + #endif /* _ASM_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-alpha/termios.h linux.ac/include/asm-alpha/termios.h --- linux.vanilla/include/asm-alpha/termios.h Wed Mar 24 19:46:00 1999 +++ linux.ac/include/asm-alpha/termios.h Mon Sep 6 16:58:03 1999 @@ -77,7 +77,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-arm/termios.h linux.ac/include/asm-arm/termios.h --- linux.vanilla/include/asm-arm/termios.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-arm/termios.h Mon Sep 6 16:58:03 1999 @@ -60,7 +60,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/dma.h linux.ac/include/asm-i386/dma.h --- linux.vanilla/include/asm-i386/dma.h Sat Sep 11 00:54:15 1999 +++ linux.ac/include/asm-i386/dma.h Sat Sep 18 02:08:11 1999 @@ -290,6 +290,7 @@ /* From PCI */ #ifdef CONFIG_PCI +#define HAS_BRIDGE_BUGGY_FUNC extern int isa_dma_bridge_buggy; #else #define isa_dma_bridge_buggy (0) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/e820.h linux.ac/include/asm-i386/e820.h --- linux.vanilla/include/asm-i386/e820.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-i386/e820.h Sat Sep 11 19:48:47 1999 @@ -16,6 +16,11 @@ #define E820MAX 32 /* number of entries in E820MAP */ #define E820NR 0x1e8 /* # entries in E820MAP */ +/* for e820map.map[].type */ +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 + #define HIGH_MEMORY (1024*1024) #ifndef __ASSEMBLY__ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/elf.h linux.ac/include/asm-i386/elf.h --- linux.vanilla/include/asm-i386/elf.h Tue Jan 26 23:21:02 1999 +++ linux.ac/include/asm-i386/elf.h Sat Sep 11 01:48:33 1999 @@ -51,7 +51,9 @@ the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ -#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) +#define ELF_ET_DYN_BASE ((TASK_SIZE & 0x80000000) \ + ? TASK_SIZE / 3 * 2 \ + : 2 * TASK_SIZE / 3) /* Wow, the "main" arch needs arch dependent functions too.. :) */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/keyboard.h linux.ac/include/asm-i386/keyboard.h --- linux.vanilla/include/asm-i386/keyboard.h Mon Apr 26 18:54:03 1999 +++ linux.ac/include/asm-i386/keyboard.h Thu Sep 16 16:58:53 1999 @@ -13,6 +13,10 @@ #ifdef __KERNEL__ +#include +#include +#include + #define KEYBOARD_IRQ 1 #define DISABLE_KBD_DURING_INTERRUPTS 0 @@ -35,6 +39,30 @@ #define SYSRQ_KEY 0x54 -#endif /* __KERNEL__ */ +/* resource allocation */ +#define kbd_request_region() +#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ + "keyboard", NULL) + +/* How to access the keyboard macros on this platform. */ +#define kbd_read_input() inb(KBD_DATA_REG) +#define kbd_read_status() inb(KBD_STATUS_REG) +#define kbd_write_output(val) outb(val, KBD_DATA_REG) +#define kbd_write_command(val) outb(val, KBD_CNTL_REG) + +/* Some stoneage hardware needs delays after some operations. */ +#define kbd_pause() do { } while(0) + +/* + * Machine specific bits for the PS/2 driver + */ -#endif /* __ASMi386_KEYBOARD_H */ +#define AUX_IRQ 12 + +#define aux_request_irq(hand, dev_id) \ + request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) + +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) + +#endif /* __KERNEL__ */ +#endif /* _I386_KEYBOARD_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/mmx.h linux.ac/include/asm-i386/mmx.h --- linux.vanilla/include/asm-i386/mmx.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/asm-i386/mmx.h Thu Sep 2 16:56:44 1999 @@ -0,0 +1,14 @@ +#ifndef _ASM_MMX_H +#define _ASM_MMX_H + +/* + * MMX 3Dnow! helper operations + */ + +#include + +extern void *_mmx_memcpy(void *to, const void *from, size_t size); +extern void mmx_clear_page(long page); +extern void mmx_copy_page(long to, long from); + +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/page.h linux.ac/include/asm-i386/page.h --- linux.vanilla/include/asm-i386/page.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-i386/page.h Sat Sep 11 01:34:25 1999 @@ -11,8 +11,26 @@ #define STRICT_MM_TYPECHECKS +#include + +#ifdef CONFIG_X86_USE_3DNOW + +#include + +#define clear_page(page) mmx_clear_page(page) +#define copy_page(to,from) mmx_copy_page(to,from) + +#else + +/* + * On older X86 processors its not a win to use MMX here it seems. + * Maybe the K6-III ? + */ + #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) + +#endif #ifdef STRICT_MM_TYPECHECKS /* diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/pgtable.h linux.ac/include/asm-i386/pgtable.h --- linux.vanilla/include/asm-i386/pgtable.h Thu Aug 26 14:42:18 1999 +++ linux.ac/include/asm-i386/pgtable.h Thu Sep 16 16:16:11 1999 @@ -44,7 +44,7 @@ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0) #ifndef CONFIG_X86_INVLPG -#define __flush_tlb_one(addr) flush_tlb() +#define __flush_tlb_one(addr) __flush_tlb() #else #define __flush_tlb_one(addr) \ __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/socket.h linux.ac/include/asm-i386/socket.h --- linux.vanilla/include/asm-i386/socket.h Mon Dec 22 01:41:24 1997 +++ linux.ac/include/asm-i386/socket.h Thu Sep 2 16:51:06 1999 @@ -39,4 +39,18 @@ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 +#ifdef __KERNEL__ +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ +#endif + #endif /* _ASM_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/softirq.h linux.ac/include/asm-i386/softirq.h --- linux.vanilla/include/asm-i386/softirq.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-i386/softirq.h Tue Sep 14 21:58:56 1999 @@ -3,6 +3,11 @@ #include #include +#include + +#ifndef NULL +#define NULL ((void *) 0) +#endif extern unsigned int local_bh_count[NR_CPUS]; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/string-486.h linux.ac/include/asm-i386/string-486.h --- linux.vanilla/include/asm-i386/string-486.h Thu Feb 27 18:57:31 1997 +++ linux.ac/include/asm-i386/string-486.h Thu Sep 16 16:12:36 1999 @@ -14,6 +14,8 @@ * 1994/03/15 by Alberto Vignani/Davide Parodi @crf.it * * Split into 2 CPU specific files by Alan Cox to keep #ifdef noise down. + * + * 99/9/15 Proper reg args for newer gcc/egcs - Petkan (petkan@spct.net) */ #define __HAVE_ARCH_STRCPY @@ -180,6 +182,7 @@ #define __HAVE_ARCH_STRRCHR extern inline char * strrchr(const char * s, int c) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" @@ -190,17 +193,19 @@ "leal -1(%%esi),%0\n" "2:\ttestb %%al,%%al\n\t" "jne 1b" - :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si"); + :"=d" (__res), "=&S" (d0), "=&a" (d1) + :"0" (0), "1" (s), "2" (c)); return __res; } #define __HAVE_ARCH_STRSPN extern inline size_t strspn(const char * cs, const char * ct) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" - "movl %4,%%edi\n\t" + "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" "notl %%ecx\n\t" @@ -209,24 +214,26 @@ "1:\tlodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" - "movl %4,%%edi\n\t" + "movl %6,%%edi\n\t" "movl %%edx,%%ecx\n\t" "repne\n\t" "scasb\n\t" "je 1b\n" "2:\tdecl %0" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); + :"=S" (__res), "=&a" (d0), "=&c" (d1) + :"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct) + :"dx", "di"); return __res-cs; } #define __HAVE_ARCH_STRCSPN extern inline size_t strcspn(const char * cs, const char * ct) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" - "movl %4,%%edi\n\t" + "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" "notl %%ecx\n\t" @@ -235,20 +242,22 @@ "1:\tlodsb\n\t" "testb %%al,%%al\n\t" "je 2f\n\t" - "movl %4,%%edi\n\t" + "movl %6,%%edi\n\t" "movl %%edx,%%ecx\n\t" "repne\n\t" "scasb\n\t" "jne 1b\n" "2:\tdecl %0" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); + :"=S" (__res), "=&a" (d0), "=&c" (d1) + :"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct) + :"dx", "di"); return __res-cs; } #define __HAVE_ARCH_STRPBRK extern inline char * strpbrk(const char * cs,const char * ct) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" @@ -270,14 +279,16 @@ "jmp 3f\n" "2:\txorl %0,%0\n" "3:" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); + :"=S" (__res), "=&a" (d0), "=&c" (d1) + :"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct) + :"dx", "di"); return __res; } #define __HAVE_ARCH_STRSTR extern inline char * strstr(const char * cs,const char * ct) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" \ @@ -299,8 +310,9 @@ "jne 1b\n\t" "xorl %%eax,%%eax\n\t" "2:" - :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) - :"cx","dx","di","si"); + :"=a" (__res), "=&c" (d0), "=&S" (d1) + :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) + :"dx", "di"); return __res; } @@ -328,6 +340,7 @@ #define __HAVE_ARCH_STRNLEN extern inline size_t strnlen(const char * s, size_t count) { +int d0; register int __res; __asm__ __volatile__( "movl %1,%0\n\t" @@ -339,9 +352,8 @@ "cmpl $-1,%2\n\t" "jne 1b\n" "3:\tsubl %1,%0" - :"=a" (__res) - :"c" (s),"d" (count) - :"dx"); + :"=a" (__res), "=&d" (d0) + :"1" (count), "c" (s)); return __res; } /* end of additional stuff */ @@ -464,6 +476,7 @@ extern inline void * __memcpy_g(void * to, const void * from, size_t n) { +int d0, d1, d2; register void *tmp = (void *)to; __asm__ __volatile__ ( "cld\n\t" @@ -475,9 +488,9 @@ "movsw\n" "2:\trep\n\t" "movsl" - : /* no output */ - :"c" (n),"D" ((long) tmp),"S" ((long) from) - :"cx","di","si","memory"); + :"=&c" (d0), "=&D" (d1), "=&S" (d2) + :"0" (n), "1" ((long) tmp), "2" ((long) from) + :"memory"); return (to); } @@ -485,29 +498,31 @@ #define __HAVE_ARCH_MEMMOVE extern inline void * memmove(void * dest,const void * src, size_t n) { +int d0, d1, d2; register void *tmp = (void *)dest; if (dest + +#ifdef CONFIG_X86_USE_3DNOW + +#include +#include +#include +#include +#include +#include +#include + +/* + * This CPU favours 3DNow strongly (eg AMD Athlon) + */ + +extern inline void * __constant_memcpy3d(void * to, const void * from, size_t len) +{ + if(len<512 || in_interrupt()) + return __constant_memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + +extern __inline__ void *__memcpy3d(void *to, const void *from, size_t len) +{ + if(len<512 || in_interrupt()) + return __memcpy(to, from, len); + return _mmx_memcpy(to, from, len); +} + +#define memcpy(t, f, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy3d((t),(f),(n)) : \ + __memcpy3d((t),(f),(n))) + +#else + +/* + * No 3D Now! + */ + #define memcpy(t, f, n) \ (__builtin_constant_p(n) ? \ __constant_memcpy((t),(f),(n)) : \ __memcpy((t),(f),(n))) + +#endif #define __HAVE_ARCH_MEMMOVE extern inline void * memmove(void * dest,const void * src, size_t n) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/termios.h linux.ac/include/asm-i386/termios.h --- linux.vanilla/include/asm-i386/termios.h Wed Mar 24 19:45:59 1999 +++ linux.ac/include/asm-i386/termios.h Mon Sep 6 16:58:03 1999 @@ -50,7 +50,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IR - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/uaccess.h linux.ac/include/asm-i386/uaccess.h --- linux.vanilla/include/asm-i386/uaccess.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-i386/uaccess.h Thu Sep 16 16:56:50 1999 @@ -597,7 +597,8 @@ long strncpy_from_user(char *dst, const char *src, long count); long __strncpy_from_user(char *dst, const char *src, long count); -long strlen_user(const char *str); +#define strlen_user(str) strnlen_user(str, ~0UL >> 1) +long strnlen_user(const char *str, long n); unsigned long clear_user(void *mem, unsigned long len); unsigned long __clear_user(void *mem, unsigned long len); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-i386/unistd.h linux.ac/include/asm-i386/unistd.h --- linux.vanilla/include/asm-i386/unistd.h Tue Aug 17 17:27:39 1999 +++ linux.ac/include/asm-i386/unistd.h Mon Sep 13 00:03:39 1999 @@ -196,7 +196,7 @@ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 -/* user-visible error numbers are in the range -1 - -122: see */ +/* user-visible error numbers are in the range -1 - -124: see */ #define __syscall_return(type, res) \ do { \ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-m68k/socket.h linux.ac/include/asm-m68k/socket.h --- linux.vanilla/include/asm-m68k/socket.h Fri Feb 13 00:30:13 1998 +++ linux.ac/include/asm-m68k/socket.h Thu Sep 2 16:51:07 1999 @@ -39,4 +39,16 @@ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + #endif /* _ASM_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-m68k/termios.h linux.ac/include/asm-m68k/termios.h --- linux.vanilla/include/asm-m68k/termios.h Wed Mar 24 19:46:00 1999 +++ linux.ac/include/asm-m68k/termios.h Mon Sep 6 16:58:03 1999 @@ -58,7 +58,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-mips/floppy.h linux.ac/include/asm-mips/floppy.h --- linux.vanilla/include/asm-mips/floppy.h Mon Oct 26 17:57:56 1998 +++ linux.ac/include/asm-mips/floppy.h Thu Sep 2 16:51:06 1999 @@ -1,4 +1,4 @@ -/* $Id: floppy.h,v 1.4 1998/05/07 18:38:41 ralf Exp $ +/* $Id: floppy.h,v 1.6.2.1 1999/06/23 22:28:38 ralf Exp $ * * Architecture specific parts of the Floppy driver * @@ -42,30 +42,30 @@ extern struct fd_ops *fd_ops; -#define fd_inb(port) fd_ops->fd_inb(port) -#define fd_outb(value,port) fd_ops->fd_outb(value,port) +#define fd_inb(port) fd_ops->fd_inb(port) +#define fd_outb(value,port) fd_ops->fd_outb(value,port) -#define fd_enable_dma(channel) fd_ops->fd_enable_dma(channel) -#define fd_disable_dma(channel) fd_ops->fd_disable_dma(channel) -#define fd_request_dma(channel) fd_ops->fd_request_dma(channel) -#define fd_free_dma(channel) fd_ops->fd_free_dma(channel) -#define fd_clear_dma_ff(channel) fd_ops->fd_clear_dma_ff(channel) -#define fd_set_dma_mode(channel, mode) fd_ops->fd_set_dma_mode(channel, mode) -#define fd_set_dma_addr(channel, addr) fd_ops->fd_set_dma_addr(channel, \ - virt_to_bus(addr)) -#define fd_set_dma_count(channel,count) fd_ops->fd_set_dma_count(channel,count) -#define fd_get_dma_residue(channel) fd_ops->fd_get_dma_residue(channel) - -#define fd_enable_irq(irq) fd_ops->fd_enable_irq(irq) -#define fd_disable_irq(irq) fd_ops->fd_disable_irq(irq) -#define fd_request_irq(irq) request_irq(irq, floppy_interrupt, \ - SA_INTERRUPT \ - | SA_SAMPLE_RANDOM, \ - "floppy", NULL) -#define fd_free_irq(irq) free_irq(irq, NULL); -#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) +#define fd_enable_dma() fd_ops->fd_enable_dma(FLOPPY_DMA) +#define fd_disable_dma() fd_ops->fd_disable_dma(FLOPPY_DMA) +#define fd_request_dma() fd_ops->fd_request_dma(FLOPPY_DMA) +#define fd_free_dma() fd_ops->fd_free_dma(FLOPPY_DMA) +#define fd_clear_dma_ff() fd_ops->fd_clear_dma_ff(FLOPPY_DMA) +#define fd_set_dma_mode(mode) fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode) +#define fd_set_dma_addr(addr) fd_ops->fd_set_dma_addr(FLOPPY_DMA, \ + virt_to_bus(addr)) +#define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count) +#define fd_get_dma_residue() fd_ops->fd_get_dma_residue(FLOPPY_DMA) + +#define fd_enable_irq() fd_ops->fd_enable_irq(FLOPPY_IRQ) +#define fd_disable_irq() fd_ops->fd_disable_irq(FLOPPY_IRQ) +#define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ + SA_INTERRUPT | SA_SAMPLE_RANDOM, \ + "floppy", NULL) +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); +#define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size) #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size) -#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_drive_type(n) fd_ops->fd_drive_type(n) +#define fd_cacheflush(addr,size) dma_cache_wback_inv(addr,size) #define MAX_BUFFER_SECTORS 24 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-mips/semaphore.h linux.ac/include/asm-mips/semaphore.h --- linux.vanilla/include/asm-mips/semaphore.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-mips/semaphore.h Fri Sep 10 17:55:35 1999 @@ -102,6 +102,94 @@ { long ret, tmp, tmp2, sub; +#ifdef __MIPSEB__ + __asm__ __volatile__(" + .set mips3 + 0: lld %1, %4 + dli %3, 0x0000000100000000 + sltu %0, %1, $0 + + bltz %1, 1f + move %3, $0 + 1: + + sltu %2, %1, $0 + and %0, %0, %2 + bnez %0, 2f + + subu %0, %3 + scd %1, %4 + + beqz %1, 0b + 2: + + .set mips0" + : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(sub) + : "m"(*sem) + : "memory"); +#endif + +#ifdef __MIPSEL__ +#error "FIXME: down_trylock doesn't support little endian machines yet." +#endif + + return ret; +} + +/* + * down_trylock returns 0 on success, 1 if we failed to get the lock. + * + * We must manipulate count and waking simultaneously and atomically. + * Do this by using ll/sc on the pair of 32-bit words. + */ +extern inline int down_trylock(struct semaphore * sem) +{ + long ret, tmp, tmp2, sub; + +#ifdef __MIPSEB__ + __asm__ __volatile__(" + .set mips3 + 0: lld %1, %4 + dli %3, 0x0000000100000000 + sltu %0, %1, $0 + + bltz %1, 1f + move %3, $0 + 1: + + sltu %2, %1, $0 + and %0, %0, %2 + bnez %0, 2f + + subu %0, %3 + scd %1, %4 + + beqz %1, 0b + 2: + + .set mips0" + : "=&r"(ret), "=&r"(tmp), "=&r"(tmp2), "=&r"(sub) + : "m"(*sem) + : "memory"); +#endif + +#ifdef __MIPSEL__ +#error "FIXME: down_trylock doesn't support little endian machines yet." +#endif + + return ret; +} + +/* + * down_trylock returns 0 on success, 1 if we failed to get the lock. + * + * We must manipulate count and waking simultaneously and atomically. + * Do this by using ll/sc on the pair of 32-bit words. + */ +extern inline int down_trylock(struct semaphore * sem) +{ + long ret, tmp, tmp2, sub; + #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-mips/socket.h linux.ac/include/asm-mips/socket.h --- linux.vanilla/include/asm-mips/socket.h Tue Oct 20 21:52:54 1998 +++ linux.ac/include/asm-mips/socket.h Thu Sep 2 16:51:06 1999 @@ -1,5 +1,5 @@ /* - * $Id: socket.h,v 1.5 1998/03/15 09:52:54 ralf Exp $ + * $Id: socket.h,v 1.5 1998/03/17 22:16:17 ralf Exp $ */ #ifndef __ASM_MIPS_SOCKET_H #define __ASM_MIPS_SOCKET_H @@ -13,6 +13,7 @@ */ #define SOL_SOCKET 0xffff + #define SO_DEBUG 0x0001 /* Record debugging information. */ #define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */ #define SO_KEEPALIVE 0x0008 /* Keep connections alive and send @@ -56,17 +57,20 @@ #define SO_ATTACH_FILTER 26 #define SO_DETACH_FILTER 27 -/* Types of sockets. */ -#define SOCK_DGRAM 1 /* Connectionless, unreliable datagrams - of fixed maximum length. */ -#define SOCK_STREAM 2 /* Sequenced, reliable, connection-based - byte streams. */ -#define SOCK_RAW 3 /* Raw protocol interface. */ -#define SOCK_RDM 4 /* Reliably-delivered messages. */ -#define SOCK_SEQPACKET 5 /* Sequenced, reliable, connection-based, - datagrams of fixed maximum length. */ -#define SOCK_PACKET 10 /* Linux specific way of getting packets at - the dev level. For writing rarp and - other similar things on the user level. */ +/* Socket types. */ + +#ifdef __KERNEL__ +#define SOCK_DGRAM 1 /* datagram (conn.less) socket */ +#define SOCK_STREAM 2 /* stream (connection) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + +#endif #endif /* __ASM_MIPS_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-mips/termios.h linux.ac/include/asm-mips/termios.h --- linux.vanilla/include/asm-mips/termios.h Wed Mar 24 19:45:59 1999 +++ linux.ac/include/asm-mips/termios.h Mon Sep 6 16:58:03 1999 @@ -96,7 +96,7 @@ #define N_MASC 8 /* Reserved fo Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/adb.h linux.ac/include/asm-ppc/adb.h --- linux.vanilla/include/asm-ppc/adb.h Thu Apr 29 20:39:01 1999 +++ linux.ac/include/asm-ppc/adb.h Thu Jan 1 01:00:00 1970 @@ -1,100 +0,0 @@ -/* - * Definitions for ADB (Apple Desktop Bus) support. - */ -#ifndef __PPC_ADB_H -#define __PPC_ADB_H - -/* ADB commands */ -#define ADB_BUSRESET 0 -#define ADB_FLUSH(id) (1 + ((id) << 4)) -#define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4)) -#define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4)) - -/* ADB default device IDs (upper 4 bits of ADB command byte) */ -#define ADB_DONGLE 1 /* "software execution control" devices */ -#define ADB_KEYBOARD 2 -#define ADB_MOUSE 3 -#define ADB_TABLET 4 -#define ADB_MODEM 5 -#define ADB_MISC 7 /* maybe a monitor */ - -#define ADB_RET_OK 0 -#define ADB_RET_TIMEOUT 3 - -/* The kind of ADB request. The controller may emulate some - of all of those CUDA/PMU packet kinds */ -#define ADB_PACKET 0 -#define CUDA_PACKET 1 -#define ERROR_PACKET 2 -#define TIMER_PACKET 3 -#define POWER_PACKET 4 -#define MACIIC_PACKET 5 -#define PMU_PACKET 6 - -#ifdef __KERNEL__ - -struct adb_request { - unsigned char data[32]; - int nbytes; - unsigned char reply[32]; - int reply_len; - unsigned char reply_expected; - unsigned char sent; - unsigned char complete; - void (*done)(struct adb_request *); - void *arg; - struct adb_request *next; -}; - -struct adb_ids { - int nids; - unsigned char id[16]; -}; - -/* Messages sent thru the client_list notifier. You should NOT stop - the operation, at least not with this version */ -enum adb_message { - ADB_MSG_POWERDOWN, /* Currently called before sleep only */ - ADB_MSG_PRE_RESET, /* Called before resetting the bus */ - ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ -}; -extern struct notifier_block *adb_client_list; - -/* Kind of ADB controller */ -enum adb_hw { - ADB_NONE, ADB_VIACUDA, ADB_VIAPMU, ADB_MACIO, ADB_UNKNOWN -}; - -/* Definition of a controller */ -extern struct adb_controller { - enum adb_hw kind; - - int (*send_request)(struct adb_request *req, int sync); - int (*autopoll)(int devs); - int (*reset_bus)(void); - void (*poll)(void); -} *adb_controller; -extern enum adb_hw adb_hardware; - -/* Values for adb_request flags */ -#define ADBREQ_REPLY 1 /* expect reply */ -#define ADBREQ_SYNC 2 /* poll until done */ - -void adb_init(void); - -int adb_request(struct adb_request *req, void (*done)(struct adb_request *), - int flags, int nbytes, ...); -int adb_register(int default_id,int handler_id,struct adb_ids *ids, - void (*handler)(unsigned char *, int, struct pt_regs *, int)); -void adb_input(unsigned char *, int, struct pt_regs *, int); - -int adb_try_handler_change(int address, int new_id); -int adb_get_infos(int address, int *original_address, int *handler_id); - -int adb_reset_bus(void); - -void adb_poll(void); - -#endif /* __KERNEL__ */ - -#endif /* __PPC_ADB_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/adb_mouse.h linux.ac/include/asm-ppc/adb_mouse.h --- linux.vanilla/include/asm-ppc/adb_mouse.h Sat May 15 23:05:37 1999 +++ linux.ac/include/asm-ppc/adb_mouse.h Thu Jan 1 01:00:00 1970 @@ -1,23 +0,0 @@ -#ifndef _LINUX_ADB_MOUSE_H -#define _LINUX_ADB_MOUSE_H - -/* - * linux/include/linux/mac_mouse.h - * header file for Macintosh ADB mouse driver - * 27-10-97 Michael Schmitz - * copied from: - * header file for Atari Mouse driver - * by Robert de Vries (robert@and.nl) on 19Jul93 - */ - -struct mouse_status { - char buttons; - short dx; - short dy; - int ready; - int active; - wait_queue_head_t wait; - struct fasync_struct *fasyncptr; -}; - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/amigappc.h linux.ac/include/asm-ppc/amigappc.h --- linux.vanilla/include/asm-ppc/amigappc.h Mon Dec 21 16:37:24 1998 +++ linux.ac/include/asm-ppc/amigappc.h Sat Sep 18 01:31:40 1999 @@ -16,30 +16,24 @@ #ifndef __ASSEMBLY__ -#ifndef iobarrier_rw /* Don't include io.h - avoid circular dependency */ -#define iobarrier_rw() eieio() -#endif +/* #include */ +#define mb() __asm__ __volatile__ ("sync" : : : "memory") #define APUS_WRITE(_a_, _v_) \ do { \ (*((volatile unsigned char *)(_a_)) = (_v_)); \ - iobarrier_rw (); \ + mb(); \ } while (0) -#define APUS_READ(_a_, _v_) \ +#define APUS_READ(_a_, _v_) \ do { \ (_v_) = (*((volatile unsigned char *)(_a_))); \ - iobarrier_rw (); \ + mb(); \ } while (0) #endif /* ndef __ASSEMBLY__ */ /* Maybe add a [#ifdef WANT_ZTWOBASE] condition to amigahw.h? */ #define zTwoBase (0x80000000) - -/* At CYBERBASEp we find the following sum: - * -KERNELBASE+CyberStormMemoryBase - */ -#define CYBERBASEp (0xfff00000) #define APUS_IPL_BASE (zTwoBase + 0x00f60000) #define APUS_REG_RESET (APUS_IPL_BASE + 0x00) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/amigayle.h linux.ac/include/asm-ppc/amigayle.h --- linux.vanilla/include/asm-ppc/amigayle.h Wed Sep 30 18:14:33 1998 +++ linux.ac/include/asm-ppc/amigayle.h Sat Sep 18 01:31:40 1999 @@ -1 +1 @@ -#include "../asm-m68k/amigayle.h" +#include diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/amipcmcia.h linux.ac/include/asm-ppc/amipcmcia.h --- linux.vanilla/include/asm-ppc/amipcmcia.h Wed Sep 30 18:14:33 1998 +++ linux.ac/include/asm-ppc/amipcmcia.h Sat Sep 18 01:31:40 1999 @@ -1 +1 @@ -#include "../asm-m68k/amipcmcia.h" +#include diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/bootx.h linux.ac/include/asm-ppc/bootx.h --- linux.vanilla/include/asm-ppc/bootx.h Thu Mar 11 05:30:32 1999 +++ linux.ac/include/asm-ppc/bootx.h Sat Sep 18 01:31:40 1999 @@ -11,6 +11,7 @@ #ifdef macintosh #include +#include "linux_type_defs.h" #endif #ifdef macintosh @@ -18,66 +19,118 @@ #pragma options align=power #endif -/* On boostrap entry: +/* On kernel entry: * - * r3 = 0x426f6f58 ('BooX') + * r3 = 0x426f6f58 ('BooX') * r4 = pointer to boot_infos * r5 = NULL + * + * Data and instruction translation disabled, interrupts + * disabled, kernel loaded at physical 0x00000000 on PCI + * machines (will be different on NuBus). + */ + +#define BOOT_INFO_VERSION 5 +#define BOOT_INFO_COMPATIBLE_VERSION 1 + +/* Bit in the architecture flag mask. More to be defined in + future versions. Note that either BOOT_ARCH_PCI or + BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are + set additionally when BOOT_ARCH_NUBUS is set. */ +#define BOOT_ARCH_PCI 0x00000001UL +#define BOOT_ARCH_NUBUS 0x00000002UL +#define BOOT_ARCH_NUBUS_PDM 0x00000010UL +#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL +#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL + +/* Maximum number of ranges in phys memory map */ +#define MAX_MEM_MAP_SIZE 26 + +/* This is the format of an element in the physical memory map. Note that + the map is optional and current BootX will only build it for pre-PCI + machines */ +typedef struct boot_info_map_entry +{ + __u32 physAddr; /* Physical starting address */ + __u32 size; /* Size in bytes */ +} boot_info_map_entry_t; -#define BOOT_INFO_VERSION 2 -#define BOOT_INFO_COMPATIBLE_VERSION 1 /* Here are the boot informations that are passed to the bootstrap * Note that the kernel arguments and the device tree are appended * at the end of this structure. */ typedef struct boot_infos { - /* Version of this structure */ - unsigned long version; - /* backward compatible down to version: */ - unsigned long compatible_version; - - /* NEW (vers. 2) this holds the current _logical_ base addr of - the frame buffer (for use by early boot message) */ - unsigned char* logicalDisplayBase; - - /* Set to 0 by current BootX */ - unsigned long unused[2]; - - /* The device tree (internal addresses relative to the beginning of the tree, - * device tree offset relative to the beginning of this structure). */ - unsigned long deviceTreeOffset; /* Device tree offset */ - unsigned long deviceTreeSize; /* Size of the device tree */ - - /* Some infos about the current MacOS display */ - unsigned long dispDeviceRect[4]; /* left,top,right,bottom */ - unsigned long dispDeviceDepth; /* (8, 16 or 32) */ - unsigned char* dispDeviceBase; /* base address (physical) */ - unsigned long dispDeviceRowBytes; /* rowbytes (in bytes) */ - unsigned long dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ - /* Optional offset in the registry to the current - * MacOS display. (Can be 0 when not detected) */ - unsigned long dispDeviceRegEntryOffset; - - /* Optional pointer to boot ramdisk (offset from this structure) */ - unsigned long ramDisk; - unsigned long ramDiskSize; /* size of ramdisk image */ - - /* Kernel command line arguments (offset from this structure) */ - unsigned long kernelParamsOffset; - + /* Version of this structure */ + __u32 version; + /* backward compatible down to version: */ + __u32 compatible_version; + + /* NEW (vers. 2) this holds the current _logical_ base addr of + the frame buffer (for use by early boot message) */ + __u8* logicalDisplayBase; + + /* NEW (vers. 4) Apple's machine identification */ + __u32 machineID; + + /* NEW (vers. 4) Detected hw architecture */ + __u32 architecture; + + /* The device tree (internal addresses relative to the beginning of the tree, + * device tree offset relative to the beginning of this structure). + * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this + * field is 0. + */ + __u32 deviceTreeOffset; /* Device tree offset */ + __u32 deviceTreeSize; /* Size of the device tree */ + + /* Some infos about the current MacOS display */ + __u32 dispDeviceRect[4]; /* left,top,right,bottom */ + __u32 dispDeviceDepth; /* (8, 16 or 32) */ + __u8* dispDeviceBase; /* base address (physical) */ + __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */ + __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */ + /* Optional offset in the registry to the current + * MacOS display. (Can be 0 when not detected) */ + __u32 dispDeviceRegEntryOffset; + + /* Optional pointer to boot ramdisk (offset from this structure) */ + __u32 ramDisk; + __u32 ramDiskSize; /* size of ramdisk image */ + + /* Kernel command line arguments (offset from this structure) */ + __u32 kernelParamsOffset; + + /* ALL BELOW NEW (vers. 4) */ + + /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag + (non-PCI) only. On PCI, memory is contiguous and it's size is in the + device-tree. */ + boot_info_map_entry_t + physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */ + __u32 physMemoryMapSize; /* How many entries in map */ + + + /* The framebuffer size (optional, currently 0) */ + __u32 frameBufferSize; /* Represents a max size, can be 0. */ + + /* NEW (vers. 5) */ + + /* Total params size (args + colormap + device tree + ramdisk) */ + __u32 totalParamsSize; + } boot_infos_t; /* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index is represented * by 3 short words containing a 16 bits (unsigned) color component. * Later versions may contain the gamma table for direct-color devices here. */ -#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) +#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL) #ifdef macintosh #pragma options align=reset #endif #endif - + \ No newline at end of file diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/bseip.h linux.ac/include/asm-ppc/bseip.h --- linux.vanilla/include/asm-ppc/bseip.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/asm-ppc/bseip.h Sat Sep 18 01:31:40 1999 @@ -0,0 +1,41 @@ + +/* + * A collection of structures, addresses, and values associated with + * the Bright Star Engineering ip-Engine board. Copied from the MBX stuff. + * + * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) + */ +#ifndef __MACH_BSEIP_DEFS +#define __MACH_BSEIP_DEFS + +/* A Board Information structure that is given to a program when + * prom starts it up. + */ +typedef struct bd_info { + unsigned int bi_memstart; /* Memory start address */ + unsigned int bi_memsize; /* Memory (end) size in bytes */ + unsigned int bi_intfreq; /* Internal Freq, in Hz */ + unsigned int bi_busfreq; /* Bus Freq, in Hz */ + unsigned char bi_enetaddr[6]; + unsigned int bi_baudrate; +} bd_t; + +extern bd_t m8xx_board_info; + +/* Memory map is configured by the PROM startup. + * All we need to get started is the IMMR. + */ +#define IMAP_ADDR ((uint)0xff000000) +#define IMAP_SIZE ((uint)(64 * 1024)) +#define PCMCIA_MEM_ADDR ((uint)0x04000000) +#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) + +/* We don't use the 8259. +*/ +#define NR_8259_INTS 0 + +/* Machine type +*/ +#define _MACH_8xx (_MACH_bseip) + +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/cuda.h linux.ac/include/asm-ppc/cuda.h --- linux.vanilla/include/asm-ppc/cuda.h Thu Apr 29 20:39:01 1999 +++ linux.ac/include/asm-ppc/cuda.h Thu Jan 1 01:00:00 1970 @@ -1,38 +0,0 @@ -/* - * Definitions for talking to the CUDA. The CUDA is a microcontroller - * which controls the ADB, system power, RTC, and various other things. - * - * Copyright (C) 1996 Paul Mackerras. - */ - -/* CUDA commands (2nd byte) */ -#define CUDA_WARM_START 0 -#define CUDA_AUTOPOLL 1 -#define CUDA_GET_6805_ADDR 2 -#define CUDA_GET_TIME 3 -#define CUDA_GET_PRAM 7 -#define CUDA_SET_6805_ADDR 8 -#define CUDA_SET_TIME 9 -#define CUDA_POWERDOWN 0xa -#define CUDA_POWERUP_TIME 0xb -#define CUDA_SET_PRAM 0xc -#define CUDA_MS_RESET 0xd -#define CUDA_SEND_DFAC 0xe -#define CUDA_RESET_SYSTEM 0x11 -#define CUDA_SET_IPL 0x12 -#define CUDA_SET_AUTO_RATE 0x14 -#define CUDA_GET_AUTO_RATE 0x16 -#define CUDA_SET_DEVICE_LIST 0x19 -#define CUDA_GET_DEVICE_LIST 0x1a -#define CUDA_GET_SET_IIC 0x22 - -#ifdef __KERNEL__ - -void find_via_cuda(void); -void via_cuda_init(void); -int cuda_request(struct adb_request *req, - void (*done)(struct adb_request *), int nbytes, ...); -void cuda_poll(void); -int cuda_present(void); - -#endif /* __KERNEL */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/feature.h linux.ac/include/asm-ppc/feature.h --- linux.vanilla/include/asm-ppc/feature.h Thu Mar 11 05:30:32 1999 +++ linux.ac/include/asm-ppc/feature.h Sat Sep 18 01:31:40 1999 @@ -36,6 +36,8 @@ FEATURE_BMac_reset, FEATURE_BMac_IO_enable, FEATURE_Modem_Reset, + FEATURE_IDE_DiskPower, + FEATURE_IDE_Reset, FEATURE_last, }; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/init.h linux.ac/include/asm-ppc/init.h --- linux.vanilla/include/asm-ppc/init.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/init.h Sat Sep 18 01:31:40 1999 @@ -11,7 +11,7 @@ __argpmac #define __prep __attribute__ ((__section__ (".text.prep"))) -#define __prepdata /* __attribute__ ((__section__ (".data.prep")))*/ +#define __prepdata __attribute__ ((__section__ (".data.prep"))) #define __prepfunc(__argprep) \ __argprep __prep; \ __argprep diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/io.h linux.ac/include/asm-ppc/io.h --- linux.vanilla/include/asm-ppc/io.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-ppc/io.h Sat Sep 18 01:31:40 1999 @@ -19,11 +19,9 @@ #define PREP_ISA_MEM_BASE 0xc0000000 #define PREP_PCI_DRAM_OFFSET 0x80000000 -#ifdef CONFIG_MBX -#define _IO_BASE 0x80000000 -#define _ISA_MEM_BASE 0 -#define PCI_DRAM_OFFSET 0x80000000 -#else /* CONFIG_MBX8xx */ +#ifdef CONFIG_8xx +#include +#else #ifdef CONFIG_APUS #define _IO_BASE 0 #define _ISA_MEM_BASE 0 @@ -36,7 +34,7 @@ #define _ISA_MEM_BASE isa_mem_base #define PCI_DRAM_OFFSET pci_dram_offset #endif /* CONFIG_APUS */ -#endif /* CONFIG_MBX8xx */ +#endif /* CONFIG_8xx */ #define readb(addr) in_8((volatile unsigned char *)(addr)) #define writeb(b,addr) out_8((volatile unsigned char *)(addr), (b)) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/irq.h linux.ac/include/asm-ppc/irq.h --- linux.vanilla/include/asm-ppc/irq.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-ppc/irq.h Sat Sep 18 01:31:40 1999 @@ -59,27 +59,42 @@ * from such devices as CPM, PCMCIA, RTC, PIT, TimeBase and Decrementer. * There are eight external interrupts (IRQs) that can be configured * as either level or edge sensitive. - * On the MBX implementation, there is also the possibility of an 8259 + * + * The 82xx can have up to 64 interrupts on the internal controller. + * + * On some implementations, there is also the possibility of an 8259 * through the PCI and PCI-ISA bridges. */ -#define NR_IRQS (16+16) /* 8259 has 16, too -- Cort */ +#ifdef CONFIG_82xx +#define NR_SIU_INTS 64 +#else +#define NR_SIU_INTS 16 +#endif + +#define NR_IRQS (NR_SIU_INTS + NR_8259_INTS) -#define SIU_IRQ0 (0+16) /* Highest priority */ -#define SIU_LEVEL0 (1+16) -#define SIU_IRQ1 (2+16) -#define SIU_LEVEL1 (3+16) -#define SIU_IRQ2 (4+16) -#define SIU_LEVEL2 (5+16) -#define SIU_IRQ3 (6+16) -#define SIU_LEVEL3 (7+16) -#define SIU_IRQ4 (8+16) -#define SIU_LEVEL4 (9+16) -#define SIU_IRQ5 (10+16) -#define SIU_LEVEL5 (11+16) -#define SIU_IRQ6 (12+16) -#define SIU_LEVEL6 (13+16) -#define SIU_IRQ7 (14+16) -#define SIU_LEVEL7 (15+16) +/* These values must be zero-based and map 1:1 with the SIU configuration. + * They are used throughout the 8xx/82xx I/O subsystem to generate + * interrupt masks, flags, and other control patterns. This is why the + * current kernel assumption of the 8259 as the base controller is such + * a pain in the butt. + */ +#define SIU_IRQ0 (0) /* Highest priority */ +#define SIU_LEVEL0 (1) +#define SIU_IRQ1 (2) +#define SIU_LEVEL1 (3) +#define SIU_IRQ2 (4) +#define SIU_LEVEL2 (5) +#define SIU_IRQ3 (6) +#define SIU_LEVEL3 (7) +#define SIU_IRQ4 (8) +#define SIU_LEVEL4 (9) +#define SIU_IRQ5 (10) +#define SIU_LEVEL5 (11) +#define SIU_IRQ6 (12) +#define SIU_LEVEL6 (13) +#define SIU_IRQ7 (14) +#define SIU_LEVEL7 (15) /* The internal interrupts we can configure as we see fit. * My personal preference is CPM at level 2, which puts it above the @@ -95,21 +110,11 @@ */ #define mk_int_int_mask(IL) (1 << (7 - (IL/2))) -#ifdef CONFIG_MBX -/* These are defined (and fixed) by the MBX hardware implementation.*/ -#define POWER_FAIL_INT SIU_IRQ0 /* Power fail */ -#define TEMP_HILO_INT SIU_IRQ1 /* Temperature sensor */ -#define QSPAN_INT SIU_IRQ2 /* PCI Bridge (DMA CTLR?) */ -#define ISA_BRIDGE_INT SIU_IRQ3 /* All those PC things */ -#define COMM_L_INT SIU_IRQ6 /* MBX Comm expansion connector pin */ -#define STOP_ABRT_INT SIU_IRQ7 /* Stop/Abort header pin */ -#endif /* CONFIG_MBX */ - -#ifdef CONFIG_FADS -#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */ -#endif +/* Now include the board configuration specific associations. +*/ +#include -/* always the same on MBX -- Cort */ +/* always the same on 8xx -- Cort */ static __inline__ int irq_cannonicalize(int irq) { return irq; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/irq_control.h linux.ac/include/asm-ppc/irq_control.h --- linux.vanilla/include/asm-ppc/irq_control.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-ppc/irq_control.h Sat Sep 18 01:31:40 1999 @@ -1,5 +1,5 @@ /* - * $Id: irq_control.h,v 1.2 1999/07/17 20:23:58 cort Exp $ + * $Id: irq_control.h,v 1.8 1999/09/15 23:58:48 cort Exp $ * * Copyright (C) 1999 Cort Dougan */ @@ -11,74 +11,52 @@ #include #include -extern void do_lost_interrupts(unsigned long); -extern atomic_t ppc_n_lost_interrupts; +/* Structure describing interrupts */ +struct hw_interrupt_type { + const char * typename; + void (*startup)(unsigned int irq); + void (*shutdown)(unsigned int irq); + void (*enable)(unsigned int irq); + void (*disable)(unsigned int irq); + void (*mask_and_ack)(unsigned int irq); + int irq_offset; +}; + +struct irqdesc { + struct irqaction *action; + struct hw_interrupt_type *ctl; +}; -#define __no_use_save_flags(flags) \ - ({__asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); }) - -extern __inline__ void __no_use_restore_flags(unsigned long flags) -{ - if ((flags & MSR_EE) && atomic_read(&ppc_n_lost_interrupts) != 0) { - do_lost_interrupts(flags); - } else { - __asm__ __volatile__ ("sync; mtmsr %0; isync" - : : "r" (flags) : "memory"); - } -} +extern struct irqdesc irq_desc[NR_IRQS]; -extern __inline__ void __no_use_sti(void) +struct int_control_struct { - unsigned long flags; + void (*int_cli)(void); + void (*int_sti)(void); + void (*int_restore_flags)(unsigned long); + void (*int_save_flags)(unsigned long *); +}; +extern struct int_control_struct int_control; +extern unsigned long timer_interrupt_intercept; +extern unsigned long do_IRQ_intercept; +void timer_interrupt(struct pt_regs *); + +extern void __no_use_sti(void); +extern void __no_use_cli(void); +extern void __no_use_restore_flags(unsigned long); +extern void __no_use_save_flags(unsigned long *); + +#define __cli() int_control.int_cli() +#define __sti() int_control.int_sti() +#define __save_flags(flags) int_control.int_save_flags(&flags) +#define __restore_flags(flags) int_control.int_restore_flags(flags) +#define __save_and_cli(flags) ({__save_flags(flags);__cli();}) - __asm__ __volatile__ ("mfmsr %0": "=r" (flags)); - flags |= MSR_EE; - if ( atomic_read(&ppc_n_lost_interrupts) ) - do_lost_interrupts(flags); - __asm__ __volatile__ ("sync; mtmsr %0; isync":: "r" (flags)); -} - -extern __inline__ void __no_use_cli(void) -{ - unsigned long flags; - __asm__ __volatile__ ("mfmsr %0": "=r" (flags)); - flags &= ~MSR_EE; - __asm__ __volatile__ ("sync; mtmsr %0; isync":: "r" (flags)); -} - -#define __no_use_mask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->disable) irq_desc[irq].ctl->disable(irq);}) -#define __no_use_unmask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->enable) irq_desc[irq].ctl->enable(irq);}) -#define __no_use_mask_and_ack_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->mask_and_ack) irq_desc[irq].ctl->mask_and_ack(irq);}) - -#ifdef CONFIG_RTL - -/* the rtl system provides these -- Cort */ -extern void __sti(void); -extern void __cli(void); -extern void __restore_flags(unsigned int); -extern unsigned int __return_flags(void); -#define __save_flags(flags) (flags = __return_flags()) - -#define rtl_hard_cli __no_use_cli -#define rtl_hard_sti __no_use_sti -#define rtl_hard_save_flags(flags) __no_use_save_flags(flags) -#define rtl_hard_restore_flags(flags) __no_use_restore_flags(flags) - -#define rtl_hard_mask_irq(irq) __no_use_mask_irq(irq) -#define rtl_hard_unmask_irq(irq) __no_use_unmask_irq(irq) -#define rtl_hard_mask_and_ack_irq(irq) __no_use_mask_and_ack_irq(irq) - -#else /* CONFIG_RTL */ - -#define __cli __no_use_cli -#define __sti __no_use_sti -#define __save_flags(flags) __no_use_save_flags(flags) -#define __restore_flags(flags) __no_use_restore_flags(flags) - -#define mask_irq(irq) __no_use_mask_irq(irq) -#define unmask_irq(irq) __no_use_unmask_irq(irq) -#define mask_and_ack_irq(irq) __no_use_mask_and_ack_irq(irq) +extern void do_lost_interrupts(unsigned long); +extern atomic_t ppc_n_lost_interrupts; -#endif /* CONFIG_RTL */ +#define mask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->disable) irq_desc[irq].ctl->disable(irq);}) +#define unmask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->enable) irq_desc[irq].ctl->enable(irq);}) +#define mask_and_ack_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->mask_and_ack) irq_desc[irq].ctl->mask_and_ack(irq);}) #endif /* _PPC_IRQ_CONTROL_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/keyboard.h linux.ac/include/asm-ppc/keyboard.h --- linux.vanilla/include/asm-ppc/keyboard.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/keyboard.h Sat Sep 18 01:31:40 1999 @@ -16,7 +16,7 @@ #ifdef __KERNEL__ #include -#include +#include #include #ifdef CONFIG_APUS #include diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/linux_logo.h linux.ac/include/asm-ppc/linux_logo.h --- linux.vanilla/include/asm-ppc/linux_logo.h Wed Sep 30 18:14:33 1998 +++ linux.ac/include/asm-ppc/linux_logo.h Sat Sep 18 01:31:40 1999 @@ -12,14 +12,6 @@ */ #include -#ifdef CONFIG_APUS -#include - -#undef linux_logo_banner -#define linux_logo_banner "Linux/PPC version " UTS_RELEASE - -#else - #include #define linux_logo_banner "Linux/PPC version " UTS_RELEASE @@ -48,4 +40,3 @@ extern unsigned char linux_logo16[]; #endif -#endif /* CONFIG_APUS */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/machdep.h linux.ac/include/asm-ppc/machdep.h --- linux.vanilla/include/asm-ppc/machdep.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/machdep.h Sat Sep 18 01:31:40 1999 @@ -9,6 +9,7 @@ #endif struct pt_regs; +struct pci_bus; struct machdep_calls { void (*setup_arch)(unsigned long * memory_start_p, @@ -20,8 +21,9 @@ /* Optional, may be NULL. */ unsigned int (*irq_cannonicalize)(unsigned int irq); void (*init_IRQ)(void); - void (*do_IRQ)(struct pt_regs *regs, int cpu, int isfake); - + int (*get_irq)(struct pt_regs *); + void (*post_irq)( int ); + /* A general init function, called by ppc_init in init/main.c. May be NULL. */ void (*init)(void); @@ -72,8 +74,9 @@ int (*pcibios_write_config_dword)(unsigned char bus, unsigned char dev_fn, unsigned char offset, unsigned int val); void (*pcibios_fixup)(void); -struct pci_bus; void (*pcibios_fixup_bus)(struct pci_bus *); + /* this is for modules, since _machine can be a define -- Cort */ + int ppc_machine; }; extern struct machdep_calls ppc_md; @@ -89,7 +92,7 @@ unsigned long magic_start; char cmd_line[256]; char boot_loader[128]; - int _machine; + int _machine_type; unsigned long initrd_start, initrd_size; unsigned long systemmap_start, systemmap_size; unsigned long prom_entry; @@ -97,4 +100,14 @@ unsigned long magic_end; }; struct boot_info *binfo; + +/* + * Power macintoshes have either a CUDA or a PMU controlling + * system reset, power, NVRAM, RTC. + */ +enum sys_ctrler_kind { + SYS_CTRLER_CUDA = 1, + SYS_CTRLER_PMU = 2, +} sys_ctrler; + #endif /* _PPC_MACHDEP_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/mbx.h linux.ac/include/asm-ppc/mbx.h --- linux.vanilla/include/asm-ppc/mbx.h Wed Sep 30 18:14:33 1998 +++ linux.ac/include/asm-ppc/mbx.h Sat Sep 18 01:31:40 1999 @@ -39,9 +39,10 @@ * NVRAM, Status/Control registers, CPM Dual Port RAM, and the PCI * Bridge CSRs 1:1 into the kernel address space. */ -#define PCI_ISA_IO_ADDR ((uint)0x80000000) +#define PCI_ISA_IO_ADDR ((unsigned)0x80000000) #define PCI_ISA_IO_SIZE ((uint)(512 * 1024 * 1024)) -#define PCI_ISA_MEM_ADDR ((uint)0xc0000000) +#define PCI_IDE_ADDR ((unsigned)0x81000000) +#define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000) #define PCI_ISA_MEM_SIZE ((uint)(512 * 1024 * 1024)) #define PCMCIA_MEM_ADDR ((uint)0xe0000000) #define PCMCIA_MEM_SIZE ((uint)(64 * 1024 * 1024)) @@ -59,4 +60,29 @@ #define IMAP_SIZE ((uint)(64 * 1024)) #define PCI_CSR_ADDR ((uint)0xfa210000) #define PCI_CSR_SIZE ((uint)(64 * 1024)) + +/* Map additional physical space into well known virtual addresses. Due + * to virtual address mapping, these physical addresses are not accessible + * in a 1:1 virtual to physical mapping. + */ +#define ISA_IO_VIRT_ADDR ((uint)0xfa220000) +#define ISA_IO_VIRT_SIZE ((uint)64 * 1024) + +/* Interrupt assignments. + * These are defined (and fixed) by the MBX hardware implementation. + */ +#define POWER_FAIL_INT SIU_IRQ0 /* Power fail */ +#define TEMP_HILO_INT SIU_IRQ1 /* Temperature sensor */ +#define QSPAN_INT SIU_IRQ2 /* PCI Bridge (DMA CTLR?) */ +#define ISA_BRIDGE_INT SIU_IRQ3 /* All those PC things */ +#define COMM_L_INT SIU_IRQ6 /* MBX Comm expansion connector pin */ +#define STOP_ABRT_INT SIU_IRQ7 /* Stop/Abort header pin */ + +/* The MBX uses the 8259. +*/ +#define NR_8259_INTS 16 + +/* Generic 8xx type +*/ +#define _MACH_8xx (_MACH_mbx) #endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/mpc8xx.h linux.ac/include/asm-ppc/mpc8xx.h --- linux.vanilla/include/asm-ppc/mpc8xx.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/asm-ppc/mpc8xx.h Sat Sep 18 01:31:40 1999 @@ -0,0 +1,66 @@ + +/* This is the single file included by all MPC8xx build options. + * Since there are many different boards and no standard configuration, + * we have a unique include file for each. Rather than change every + * file that has to include MPC8xx configuration, they all include + * this one and the configuration switching is done here. + */ +#ifndef __CONFIG_8xx_DEFS +#define __CONFIG_8xx_DEFS + +#ifdef CONFIG_8xx + +#ifdef CONFIG_MBX +#include +#endif + +#ifdef CONFIG_FADS +#include +#endif + +#ifdef CONFIG_RPXLITE +#include +#endif + +#ifdef CONFIG_BSEIP +#include +#endif + +#ifdef CONFIG_RPXCLASSIC +#include +#endif + +/* I need this to get pt_regs....... +*/ +#include + +/* Currently, all 8xx boards that support a processor to PCI/ISA bridge + * use the same memory map. + */ +#if 0 +#if defined(CONFIG_PCI) && defined(PCI_ISA_IO_ADDR) +#define _IO_BASE PCI_ISA_IO_ADDR +#define _ISA_MEM_BASE PCI_ISA_MEM_ADDR +#define PCI_DRAM_OFFSET 0x80000000 +#else +#define _IO_BASE 0 +#define _ISA_MEM_BASE 0 +#define PCI_DRAM_OFFSET 0 +#endif +#else +#define _IO_BASE 0 +#define _ISA_MEM_BASE 0 +#define PCI_DRAM_OFFSET 0 +#endif + +extern unsigned long isa_io_base; +extern unsigned long isa_mem_base; +extern unsigned long pci_dram_offset; + +extern int request_8xxirq(unsigned int irq, + void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, + const char *device, + void *dev_id); +#endif /* CONFIG_8xx */ +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/ohare.h linux.ac/include/asm-ppc/ohare.h --- linux.vanilla/include/asm-ppc/ohare.h Thu Mar 11 05:30:32 1999 +++ linux.ac/include/asm-ppc/ohare.h Sat Sep 18 01:31:40 1999 @@ -18,7 +18,9 @@ #define OH_BAY_IDE_ENABLE 8 #define OH_BAY_FLOPPY_ENABLE 0x10 #define OH_IDE_ENABLE 0x20 +#define OH_IDE_POWER 0x40 /* a guess */ #define OH_BAY_ENABLE 0x80 +#define OH_IDE_RESET 0x100 /* 0-based, a guess */ #define OH_SCC_ENABLE 0x200 #define OH_MESH_ENABLE 0x400 #define OH_FLOPPY_ENABLE 0x800 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/pgtable.h linux.ac/include/asm-ppc/pgtable.h --- linux.vanilla/include/asm-ppc/pgtable.h Thu Sep 2 00:48:41 1999 +++ linux.ac/include/asm-ppc/pgtable.h Sat Sep 18 01:31:40 1999 @@ -9,11 +9,28 @@ #include #include +#ifndef CONFIG_8xx extern void local_flush_tlb_all(void); extern void local_flush_tlb_mm(struct mm_struct *mm); extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); extern void local_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end); +#else /* CONFIG_8xx */ +#define __tlbia() asm volatile ("tlbia" : : ) + +extern inline void local_flush_tlb_all(void) + { __tlbia(); } +extern inline void local_flush_tlb_mm(struct mm_struct *mm) + { __tlbia(); } +extern inline void local_flush_tlb_page(struct vm_area_struct *vma, + unsigned long vmaddr) + { __tlbia(); } +extern inline void local_flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) + { __tlbia(); } +extern inline void flush_hash_page(unsigned context, unsigned long va) + { } +#endif #define flush_tlb_all local_flush_tlb_all #define flush_tlb_mm local_flush_tlb_mm @@ -636,22 +653,6 @@ #define io_remap_page_range remap_page_range -#ifdef CONFIG_8xx -#define __tlbia() asm volatile ("tlbia" : : ) - -extern inline void local_flush_tlb_all(void) - { __tlbia(); } -extern inline void local_flush_tlb_mm(struct mm_struct *mm) - { __tlbia(); } -extern inline void local_flush_tlb_page(struct vm_area_struct *vma, - unsigned long vmaddr) - { __tlbia(); } -extern inline void local_flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) - { __tlbia(); } -extern inline void flush_hash_page(unsigned context, unsigned long va) - { } -#endif #endif __ASSEMBLY__ #endif /* _PPC_PGTABLE_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/pmu.h linux.ac/include/asm-ppc/pmu.h --- linux.vanilla/include/asm-ppc/pmu.h Tue Sep 7 22:07:08 1999 +++ linux.ac/include/asm-ppc/pmu.h Thu Jan 1 01:00:00 1970 @@ -1,97 +0,0 @@ -/* - * Definitions for talking to the PMU. The PMU is a microcontroller - * which controls battery charging and system power on PowerBook 3400 - * and 2400 models as well as the RTC and various other things. - * - * Copyright (C) 1998 Paul Mackerras. - */ - -/* - * PMU commands - */ -#define PMU_POWER_CTRL 0x11 /* control power of some devices */ -#define PMU_ADB_CMD 0x20 /* send ADB packet */ -#define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */ -#define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */ -#define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */ -#define PMU_SET_RTC 0x30 /* set real-time clock */ -#define PMU_READ_RTC 0x38 /* read real-time clock */ -#define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */ -#define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */ -#define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */ -#define PMU_PCEJECT 0x4c /* eject PC-card from slot */ -#define PMU_BATTERY_STATE 0x6b /* report battery state etc. */ -#define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */ -#define PMU_INT_ACK 0x78 /* read interrupt bits */ -#define PMU_SHUTDOWN 0x7e /* turn power off */ -#define PMU_SLEEP 0x7f /* put CPU to sleep */ -#define PMU_RESET 0xd0 /* reset CPU */ -#define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */ -#define PMU_GET_COVER 0xdc /* report cover open/closed */ - -/* Bits to use with the PMU_POWER_CTRL command */ -#define PMU_POW_ON 0x80 /* OR this to power ON the device */ -#define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ -#define PMU_POW_BACKLIGHT 0x01 /* backlight power */ -#define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) ??? */ - -/* Bits in PMU interrupt and interrupt mask bytes */ -#define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ -#define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */ -#define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */ -#define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */ -#define PMU_INT_TICK 0x80 /* 1-second tick interrupt */ - -/* Kind of PMU (model) */ -enum { - PMU_UNKNOWN, - PMU_OHARE_BASED, - PMU_HEATHROW_BASED -}; - -/* - * Ioctl commands for the /dev/pmu device - */ -#include - -/* no param */ -#define PMU_IOC_SLEEP _IO('B', 0) -/* out param: u32* backlight value: 0 to 31 */ -#define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, sizeof(__u32*)) -/* in param: u32 backlight value: 0 to 31 */ -#define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, sizeof(__u32)) -/* out param: u32* backlight value: 0 to 31 */ -#define PMU_IOC_GET_MODEL _IOR('B', 3, sizeof(__u32*)) - -#ifdef __KERNEL__ - -void find_via_pmu(void); -void via_pmu_init(void); - -int pmu_request(struct adb_request *req, - void (*done)(struct adb_request *), int nbytes, ...); -void pmu_poll(void); - -void pmu_enable_backlight(int on); -void pmu_set_brightness(int level); - -void pmu_enable_irled(int on); - -void pmu_restart(void); -void pmu_shutdown(void); - -int pmu_present(void); -int pmu_get_model(void); - -/* - * Stuff for putting the powerbook to sleep and waking it again. - */ -#include - -extern struct notifier_block *sleep_notifier_list; - -/* code values for calling sleep/wakeup handlers */ -#define PBOOK_SLEEP 1 -#define PBOOK_WAKE 2 - -#endif /* __KERNEL */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/processor.h linux.ac/include/asm-ppc/processor.h --- linux.vanilla/include/asm-ppc/processor.h Thu Sep 2 00:48:42 1999 +++ linux.ac/include/asm-ppc/processor.h Sat Sep 18 01:31:40 1999 @@ -34,7 +34,7 @@ #define MSR_RI (1<<1) /* Recoverable Exception */ #define MSR_LE (1<<0) /* Little-Endian enable */ -#ifdef CONFIG_APUS +#ifdef CONFIG_APUS_FAST_EXCEPT #define MSR_ MSR_ME|MSR_IP|MSR_RI #else #define MSR_ MSR_ME|MSR_RI @@ -104,6 +104,7 @@ #define _MACH_bseip 128 /* Bright Star Engineering ip-Engine */ #define _MACH_yk 256 /* Motorola Yellowknife */ #define _MACH_gemini 512 /* Synergy Microsystems gemini board */ +#define _MACH_classic 1024 /* RPCG RPX-Classic 8xx board */ /* see residual.h for these */ #define _PREP_Motorola 0x01 /* motorola prep */ @@ -212,13 +213,12 @@ #define SR15 15 #ifndef __ASSEMBLY__ +#ifndef CONFIG_MACH_SPECIFIC extern int _machine; - -/* Temporary hacks until we can clean things up better - Corey */ extern int have_of; -extern int is_prep; extern int is_chrp; extern int is_powerplus; +#endif /* CONFIG_MACH_SPECIFIC */ /* what kind of prep workstation we are */ extern int _prep_type; @@ -331,5 +331,28 @@ #endif /* ndef ASSEMBLY*/ - +#ifdef CONFIG_MACH_SPECIFIC +#if defined(CONFIG_PREP) +#define _machine _MACH_prep +#define have_of 0 +#elif defined(CONFIG_CHRP) +#define _machine _MACH_chrp +#define have_of 1 +#elif defined(CONFIG_PMAC) +#define _machine _MACH_Pmac +#define have_of 1 +#elif defined(CONFIG_8xx) +#define _machine _MACH_8xx +#define have_of 0 +#elif defined(CONFIG_APUS) +#define _machine _MACH_apus +#define have_of 0 +#elif defined(CONFIG_GEMINI) +#define _machine _MACH_gemini +#define have_of 0 +#else +#error "Machine not defined correctly" +#endif +#endif /* CONFIG_MACH_SPECIFIC */ + #endif /* __ASM_PPC_PROCESSOR_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/prom.h linux.ac/include/asm-ppc/prom.h --- linux.vanilla/include/asm-ppc/prom.h Sun Nov 15 18:51:50 1998 +++ linux.ac/include/asm-ppc/prom.h Sat Sep 18 01:31:40 1999 @@ -65,6 +65,7 @@ extern void abort(void); extern void prom_init(int, int, prom_entry); extern void prom_print(const char *msg); +extern void relocate_nodes(void); extern void finish_device_tree(void); extern struct device_node *find_devices(const char *name); extern struct device_node *find_type_devices(const char *type); @@ -72,7 +73,8 @@ extern struct device_node *find_compatible_devices(const char *type, const char *compat); extern struct device_node *find_phandle(phandle); -extern int device_is_compatible(struct device_node *device, const char* compat); +extern int device_is_compatible(struct device_node *device, const char *); +extern int machine_is_compatible(const char *compat); extern unsigned char *get_property(struct device_node *node, const char *name, int *lenp); extern void print_properties(struct device_node *node); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/rpxclassic.h linux.ac/include/asm-ppc/rpxclassic.h --- linux.vanilla/include/asm-ppc/rpxclassic.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/asm-ppc/rpxclassic.h Sat Sep 18 01:31:40 1999 @@ -0,0 +1,67 @@ + +/* + * A collection of structures, addresses, and values associated with + * the RPCG RPX-Classic board. Copied from the RPX-Lite stuff. + * + * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) + */ +#ifndef __MACH_RPX_DEFS +#define __MACH_RPX_DEFS + +/* A Board Information structure that is given to a program when + * prom starts it up. + */ +typedef struct bd_info { + unsigned int bi_memstart; /* Memory start address */ + unsigned int bi_memsize; /* Memory (end) size in bytes */ + unsigned int bi_intfreq; /* Internal Freq, in Hz */ + unsigned int bi_busfreq; /* Bus Freq, in Hz */ + unsigned char bi_enetaddr[6]; + unsigned int bi_baudrate; +} bd_t; + +extern bd_t m8xx_board_info; + +/* Memory map is configured by the PROM startup. + * We just map a few things we need. The CSR is actually 4 byte-wide + * registers that can be accessed as 8-, 16-, or 32-bit values. + */ +#define PCMCIA_MEM_ADDR ((uint)0x04000000) +#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) +#define PCI_ISA_IO_ADDR ((unsigned)0x80000000) +#define PCI_ISA_IO_SIZE ((uint)(512 * 1024 * 1024)) +#define PCI_ISA_MEM_ADDR ((unsigned)0xc0000000) +#define PCI_ISA_MEM_SIZE ((uint)(512 * 1024 * 1024)) +#define RPX_CSR_ADDR ((uint)0xfa400000) +#define RPX_CSR_SIZE ((uint)(4 * 1024)) +#define IMAP_ADDR ((uint)0xfa200000) +#define IMAP_SIZE ((uint)(64 * 1024)) +#define PCI_CSR_ADDR ((uint)0x80000000) +#define PCI_CSR_SIZE ((uint)(64 * 1024)) + +/* Things of interest in the CSR. +*/ +#define BCSR0_ETHEN ((uint)0x80000000) +#define BCSR0_ETHLPBK ((uint)0x40000000) +#define BCSR0_COLTESTDIS ((uint)0x20000000) +#define BCSR0_FULLDPLXDIS ((uint)0x10000000) +#define BCSR0_ENFLSHSEL ((uint)0x04000000) +#define BCSR0_FLASH_SEL ((uint)0x02000000) +#define BCSR0_ENMONXCVR ((uint)0x01000000) + +#define BCSR2_EN232XCVR ((uint)0x00008000) +#define BCSR2_QSPACESEL ((uint)0x00004000) + +/* Interrupt level assignments. +*/ +#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */ + +/* We don't use the 8259. +*/ +#define NR_8259_INTS 0 + +/* Machine type +*/ +#define _MACH_8xx (_MACH_rpxclassic) + +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/rpxlite.h linux.ac/include/asm-ppc/rpxlite.h --- linux.vanilla/include/asm-ppc/rpxlite.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/asm-ppc/rpxlite.h Sat Sep 18 01:31:40 1999 @@ -0,0 +1,67 @@ + +/* + * A collection of structures, addresses, and values associated with + * the RPCG RPX-Lite board. Copied from the MBX stuff. + * + * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) + */ +#ifndef __MACH_RPX_DEFS +#define __MACH_RPX_DEFS + +/* A Board Information structure that is given to a program when + * prom starts it up. + */ +typedef struct bd_info { + unsigned int bi_memstart; /* Memory start address */ + unsigned int bi_memsize; /* Memory (end) size in bytes */ + unsigned int bi_intfreq; /* Internal Freq, in Hz */ + unsigned int bi_busfreq; /* Bus Freq, in Hz */ + unsigned char bi_enetaddr[6]; + unsigned int bi_baudrate; +} bd_t; + +extern bd_t m8xx_board_info; + +/* Memory map is configured by the PROM startup. + * We just map a few things we need. The CSR is actually 4 byte-wide + * registers that can be accessed as 8-, 16-, or 32-bit values. + */ +#define RPX_CSR_ADDR ((uint)0xfa400000) +#define RPX_CSR_SIZE ((uint)(4 * 1024)) +#define IMAP_ADDR ((uint)0xfa200000) +#define IMAP_SIZE ((uint)(64 * 1024)) +#define HIOX_CSR_ADDR ((uint)0xfac00000) +#define HIOX_CSR_SIZE ((uint)(4 * 1024)) +#define PCMCIA_MEM_ADDR ((uint)0x04000000) +#define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) +#define PCMCIA_IO_ADDR ((uint)0x04400000) +#define PCMCIA_IO_SIZE ((uint)(4 * 1024)) + +/* Things of interest in the CSR. +*/ +#define BCSR0_ETHEN ((uint)0x80000000) +#define BCSR0_ETHLPBK ((uint)0x40000000) +#define BCSR0_COLTESTDIS ((uint)0x20000000) +#define BCSR0_FULLDPLXDIS ((uint)0x10000000) +#define BCSR0_LEDOFF ((uint)0x08000000) +#define BCSR0_USBDISABLE ((uint)0x04000000) +#define BCSR0_USBHISPEED ((uint)0x02000000) +#define BCSR0_USBPWREN ((uint)0x01000000) +#define BCSR0_PCMCIAVOLT ((uint)0x000f0000) +#define BCSR0_PCMCIA3VOLT ((uint)0x000a0000) +#define BCSR0_PCMCIA5VOLT ((uint)0x00060000) + +/* HIO Expansion card. +*/ +#define HIOX_CSR_ENAUDIO ((uint)0x00000200) +#define HIOX_CSR_RSTAUDIO ((uint)0x00000100) /* 0 == reset */ + +/* We don't use the 8259. +*/ +#define NR_8259_INTS 0 + +/* Machine type +*/ +#define _MACH_8xx (_MACH_rpxlite) + +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/serial.h linux.ac/include/asm-ppc/serial.h --- linux.vanilla/include/asm-ppc/serial.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/serial.h Sat Sep 18 01:31:40 1999 @@ -20,20 +20,18 @@ */ #define BASE_BAUD ( 1843200 / 16 ) -#ifdef CONFIG_PMAC -/* - * Auto-probing will cause machine checks on powermacs. - */ -#define SERIAL_PORT_DFNS - #ifdef CONFIG_SERIAL_MANY_PORTS #define RS_TABLE_SIZE 64 #else #define RS_TABLE_SIZE 4 #endif -#else +#ifdef CONFIG_PMAC +/* + * Auto-probing will cause machine checks on powermacs. + */ #define SERIAL_PORT_DFNS +#else /* * PReP, CHRP, etc. */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/shmparam.h linux.ac/include/asm-ppc/shmparam.h --- linux.vanilla/include/asm-ppc/shmparam.h Sat Nov 25 17:49:06 1995 +++ linux.ac/include/asm-ppc/shmparam.h Sat Sep 18 01:31:40 1999 @@ -33,7 +33,7 @@ * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). */ -#define SHMMAX 0x3fa000 /* max shared seg size (bytes) */ +#define SHMMAX 0x2000000 /* max shared seg size (bytes) */ #define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */ #define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */ #define SHMALL /* max shm system wide (pages) */ \ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/smp.h linux.ac/include/asm-ppc/smp.h --- linux.vanilla/include/asm-ppc/smp.h Thu Sep 2 00:48:42 1999 +++ linux.ac/include/asm-ppc/smp.h Sat Sep 18 01:31:40 1999 @@ -21,7 +21,6 @@ }; extern struct cpuinfo_PPC cpu_data[NR_CPUS]; -extern int first_cpu_booted; extern unsigned long smp_proc_in_lock[NR_CPUS]; extern void smp_message_pass(int target, int msg, unsigned long data, int wait); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/spinlock.h linux.ac/include/asm-ppc/spinlock.h --- linux.vanilla/include/asm-ppc/spinlock.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/spinlock.h Sat Sep 18 01:31:40 1999 @@ -1,10 +1,8 @@ #ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H -/* Simple spin lock operations. There are two variants, one clears IRQ's - * on the local processor, one does not. - * - * We make no fairness assumptions. They have a cost. +/* + * Simple spin lock operations. */ typedef struct { @@ -23,19 +21,6 @@ #define spin_lock(lp) _spin_lock(lp) #define spin_unlock(lp) _spin_unlock(lp) - -#define spin_lock_irq(lock) \ - do { __cli(); spin_lock(lock); } while (0) -#define spin_lock_bh(___lk) do { local_bh_disable(); spin_lock(___lk); } while(0) - -#define spin_unlock_irq(lock) \ - do { spin_unlock(lock); __sti(); } while (0) -#define spin_unlock_bh(___lk) do { spin_unlock(___lk); local_bh_enable(); } while(0) - -#define spin_lock_irqsave(lock, flags) \ - do { __save_flags(flags); __cli(); spin_lock(lock); } while (0) -#define spin_unlock_irqrestore(lock, flags) \ - do { spin_unlock(lock); __restore_flags(flags); } while (0) extern unsigned long __spin_trylock(volatile unsigned long *lock); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-ppc/system.h linux.ac/include/asm-ppc/system.h --- linux.vanilla/include/asm-ppc/system.h Sat Sep 11 00:54:16 1999 +++ linux.ac/include/asm-ppc/system.h Sat Sep 18 01:31:40 1999 @@ -1,5 +1,5 @@ /* - * $Id: system.h,v 1.48 1999/09/05 11:56:40 paulus Exp $ + * $Id: system.h,v 1.49 1999/09/11 18:37:54 cort Exp $ * * Copyright (C) 1999 Cort Dougan */ @@ -103,6 +103,11 @@ #define restore_flags(x) __global_restore_flags(x) #endif /* !__SMP__ */ + +#define local_irq_disable() __cli() +#define local_irq_enable() __sti() +#define local_irq_save(flags) __save_and_cli(flags) +#define local_irq_restore(flags) __restore_flags(flags) #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-sparc/keyboard.h linux.ac/include/asm-sparc/keyboard.h --- linux.vanilla/include/asm-sparc/keyboard.h Wed Apr 28 16:47:39 1999 +++ linux.ac/include/asm-sparc/keyboard.h Thu Sep 2 16:51:08 1999 @@ -13,6 +13,9 @@ #ifdef __KERNEL__ +#include +#include + #define KEYBOARD_IRQ 13 #define DISABLE_KBD_DURING_INTERRUPTS 0 @@ -44,6 +47,31 @@ /* #define SYSRQ_KEY 0x54 */ /* sparc64 */ #define SYSRQ_KEY 0x63 /* sparc */ + +/* resource allocation */ +#define kbd_request_region() request_region(0x60, 16, "keyboard") +#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ + "keyboard", NULL) + +/* How to access the keyboard macros on this platform. */ +#define kbd_read_input() inb(KBD_DATA_REG) +#define kbd_read_status() inb(KBD_STATUS_REG) +#define kbd_write_output(val) outb(val, KBD_DATA_REG) +#define kbd_write_command(val) outb(val, KBD_CNTL_REG) + +/* Some stoneage hardware needs delays after some operations. */ +#define kbd_pause() do { } while(0) + +/* + * Machine specific bits for the PS/2 driver + */ + +#define AUX_IRQ 12 + +#define aux_request_irq(hand, dev_id) \ + request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) + +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) #endif /* __KERNEL__ */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-sparc/socket.h linux.ac/include/asm-sparc/socket.h --- linux.vanilla/include/asm-sparc/socket.h Wed Aug 5 00:03:35 1998 +++ linux.ac/include/asm-sparc/socket.h Thu Sep 2 16:51:07 1999 @@ -45,4 +45,18 @@ #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 #define SO_SECURITY_ENCRYPTION_NETWORK 0x5004 +/* Socket types. */ +#ifdef __KERNEL__ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ +#endif + #endif /* _ASM_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-sparc/termios.h linux.ac/include/asm-sparc/termios.h --- linux.vanilla/include/asm-sparc/termios.h Thu Mar 25 17:23:34 1999 +++ linux.ac/include/asm-sparc/termios.h Mon Sep 6 16:58:03 1999 @@ -66,7 +66,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-sparc64/socket.h linux.ac/include/asm-sparc64/socket.h --- linux.vanilla/include/asm-sparc64/socket.h Wed Aug 5 00:03:35 1998 +++ linux.ac/include/asm-sparc64/socket.h Thu Sep 2 16:51:08 1999 @@ -45,4 +45,16 @@ #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 #define SO_SECURITY_ENCRYPTION_NETWORK 0x5004 +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + #endif /* _ASM_SOCKET_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/asm-sparc64/termios.h linux.ac/include/asm-sparc64/termios.h --- linux.vanilla/include/asm-sparc64/termios.h Thu Mar 25 17:23:34 1999 +++ linux.ac/include/asm-sparc64/termios.h Mon Sep 6 16:58:03 1999 @@ -66,7 +66,7 @@ #define N_MASC 8 /* Reserved for Mobitex module */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_IRDA 11 /* Reserved for IrDA async (SIR) mode */ #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #define N_HDLC 13 /* synchronous HDLC */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/blk.h linux.ac/include/linux/blk.h --- linux.vanilla/include/linux/blk.h Sat Sep 11 00:54:17 1999 +++ linux.ac/include/linux/blk.h Thu Sep 16 16:56:44 1999 @@ -346,6 +346,15 @@ #define DEVICE_ON(device) #define DEVICE_OFF(device) +#elif (MAJOR_NR == MFM_ACORN_MAJOR) + +#define DEVICE_NAME "mfm disk" +#define DEVICE_INTR do_mfm +#define DEVICE_REQUEST do_mfm_request +#define DEVICE_NR(device) (MINOR(device) >> 6) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == NBD_MAJOR) #define DEVICE_NAME "nbd" diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/cdrom.h linux.ac/include/linux/cdrom.h --- linux.vanilla/include/linux/cdrom.h Thu Sep 2 00:48:46 1999 +++ linux.ac/include/linux/cdrom.h Wed Sep 15 23:53:22 1999 @@ -147,9 +147,9 @@ /* Address in MSF format */ struct cdrom_msf0 { - u_char minute; - u_char second; - u_char frame; + __u8 minute; + __u8 second; + __u8 frame; }; /* Address in either MSF or logical format */ @@ -162,48 +162,48 @@ /* This struct is used by the CDROMPLAYMSF ioctl */ struct cdrom_msf { - u_char cdmsf_min0; /* start minute */ - u_char cdmsf_sec0; /* start second */ - u_char cdmsf_frame0; /* start frame */ - u_char cdmsf_min1; /* end minute */ - u_char cdmsf_sec1; /* end second */ - u_char cdmsf_frame1; /* end frame */ + __u8 cdmsf_min0; /* start minute */ + __u8 cdmsf_sec0; /* start second */ + __u8 cdmsf_frame0; /* start frame */ + __u8 cdmsf_min1; /* end minute */ + __u8 cdmsf_sec1; /* end second */ + __u8 cdmsf_frame1; /* end frame */ }; /* This struct is used by the CDROMPLAYTRKIND ioctl */ struct cdrom_ti { - u_char cdti_trk0; /* start track */ - u_char cdti_ind0; /* start index */ - u_char cdti_trk1; /* end track */ - u_char cdti_ind1; /* end index */ + __u8 cdti_trk0; /* start track */ + __u8 cdti_ind0; /* start index */ + __u8 cdti_trk1; /* end track */ + __u8 cdti_ind1; /* end index */ }; /* This struct is used by the CDROMREADTOCHDR ioctl */ struct cdrom_tochdr { - u_char cdth_trk0; /* start track */ - u_char cdth_trk1; /* end track */ + __u8 cdth_trk0; /* start track */ + __u8 cdth_trk1; /* end track */ }; /* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ struct cdrom_volctrl { - u_char channel0; - u_char channel1; - u_char channel2; - u_char channel3; + __u8 channel0; + __u8 channel1; + __u8 channel2; + __u8 channel3; }; /* This struct is used by the CDROMSUBCHNL ioctl */ struct cdrom_subchnl { - u_char cdsc_format; - u_char cdsc_audiostatus; - u_char cdsc_adr: 4; - u_char cdsc_ctrl: 4; - u_char cdsc_trk; - u_char cdsc_ind; + __u8 cdsc_format; + __u8 cdsc_audiostatus; + __u8 cdsc_adr: 4; + __u8 cdsc_ctrl: 4; + __u8 cdsc_trk; + __u8 cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr; }; @@ -212,12 +212,12 @@ /* This struct is used by the CDROMREADTOCENTRY ioctl */ struct cdrom_tocentry { - u_char cdte_track; - u_char cdte_adr :4; - u_char cdte_ctrl :4; - u_char cdte_format; + __u8 cdte_track; + __u8 cdte_adr :4; + __u8 cdte_ctrl :4; + __u8 cdte_format; union cdrom_addr cdte_addr; - u_char cdte_datamode; + __u8 cdte_datamode; }; /* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ @@ -232,9 +232,9 @@ struct cdrom_read_audio { union cdrom_addr addr; /* frame address */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ int nframes; /* number of 2352-byte-frames to read at once */ - u_char *buf; /* frame buffer (size: nframes*2352 bytes) */ + __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */ }; /* This struct is used with the CDROMMULTISESSION ioctl */ @@ -243,8 +243,8 @@ union cdrom_addr addr; /* frame address: start-of-last-session (not the new "frame 16"!). Only valid if the "xa_flag" is true. */ - u_char xa_flag; /* 1: "is XA disk" */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ + __u8 xa_flag; /* 1: "is XA disk" */ + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ }; /* This struct is used with the CDROM_GET_MCN ioctl. @@ -254,7 +254,7 @@ */ struct cdrom_mcn { - u_char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ + __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ }; /* This is used by the CDROMPLAYBLK ioctl */ @@ -400,6 +400,14 @@ #define CDSL_NONE ((int) (~0U>>1)-1) #define CDSL_CURRENT ((int) (~0U>>1)) +/* For partition based multisession access. IDE can handle 64 partitions + * per drive - SCSI CD-ROM's use minors to differentiate between the + * various drives, so we can't do multisessions the same way there. + * Use the -o session=x option to mount on them. + */ +#define CD_PART_MAX 64 +#define CD_PART_MASK (CD_PART_MAX - 1) + /********************************************************************* * Generic Packet commands, MMC commands, and such *********************************************************************/ @@ -495,59 +503,59 @@ #define DVD_STRUCT_MANUFACT 0x04 struct dvd_layer { - u_char book_version : 4; - u_char book_type : 4; - u_char min_rate : 4; - u_char disc_size : 4; - u_char layer_type : 4; - u_char track_path : 1; - u_char nlayers : 2; - u_char track_density : 4; - u_char linear_density : 4; - u_char bca : 1; - u_char start_sector; - u_char end_sector; - u_char end_sector_l0; + __u8 book_version : 4; + __u8 book_type : 4; + __u8 min_rate : 4; + __u8 disc_size : 4; + __u8 layer_type : 4; + __u8 track_path : 1; + __u8 nlayers : 2; + __u8 track_density : 4; + __u8 linear_density : 4; + __u8 bca : 1; + __u8 start_sector; + __u8 end_sector; + __u8 end_sector_l0; }; struct dvd_physical { - u_char type; - u_char layer_num; + __u8 type; + __u8 layer_num; struct dvd_layer layer[4]; }; struct dvd_copyright { - u_char type; + __u8 type; - u_char layer_num; - u_char cpst; - u_char rmi; + __u8 layer_num; + __u8 cpst; + __u8 rmi; }; struct dvd_disckey { - u_char type; + __u8 type; unsigned agid : 2; - u_char value[2048]; + __u8 value[2048]; }; struct dvd_bca { - u_char type; + __u8 type; int len; - u_char value[188]; + __u8 value[188]; }; struct dvd_manufact { - u_char type; + __u8 type; - u_char layer_num; + __u8 layer_num; int len; - u_char value[2048]; + __u8 value[2048]; }; typedef union { - u_char type; + __u8 type; struct dvd_physical physical; struct dvd_copyright copyright; @@ -577,30 +585,30 @@ #define DVD_INVALIDATE_AGID 9 /* State data */ -typedef u_char dvd_key[5]; /* 40-bit value, MSB is first elem. */ -typedef u_char dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ +typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ +typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ struct dvd_lu_send_agid { - u_char type; + __u8 type; unsigned agid : 2; }; struct dvd_host_send_challenge { - u_char type; + __u8 type; unsigned agid : 2; dvd_challenge chal; }; struct dvd_send_key { - u_char type; + __u8 type; unsigned agid : 2; dvd_key key; }; struct dvd_lu_send_challenge { - u_char type; + __u8 type; unsigned agid : 2; dvd_challenge chal; @@ -617,7 +625,7 @@ #define DVD_CGMS_RESTRICTED 3 struct dvd_lu_send_title_key { - u_char type; + __u8 type; unsigned agid : 2; dvd_key title_key; @@ -628,14 +636,14 @@ }; struct dvd_lu_send_asf { - u_char type; + __u8 type; unsigned agid : 2; unsigned asf : 1; }; typedef union { - u_char type; + __u8 type; struct dvd_lu_send_agid lsa; struct dvd_host_send_challenge hsc; @@ -658,11 +666,13 @@ int speed; /* maximum speed for reading data */ int capacity; /* number of discs in jukebox */ /* device-related storage */ - int options : 30; /* options flags */ - unsigned mc_flags : 2; /* media change buffer flags */ + int options : 30; /* options flags */ + unsigned mc_flags : 2; /* media change buffer flags */ int use_count; /* number of times device opened */ char name[20]; /* name of the device type */ - +/* per-device flags */ + __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ + __u8 reserved : 6; /* not used yet */ }; struct cdrom_device_ops { @@ -699,6 +709,7 @@ extern int register_cdrom(struct cdrom_device_info *cdi); extern int unregister_cdrom(struct cdrom_device_info *cdi); + typedef struct { int data; int audio; @@ -706,9 +717,19 @@ int xa; long error; } tracktype; + extern void cdrom_count_tracks(struct cdrom_device_info *cdi,tracktype* tracks); extern int cdrom_get_next_writable(kdev_t dev, long *next_writable); extern int cdrom_get_last_written(kdev_t dev, long *last_written); +extern int cdrom_number_of_slots(struct cdrom_device_info *cdi); +extern int cdrom_select_disc(struct cdrom_device_info *cdi, int slot); +extern int cdrom_mode_select(struct cdrom_device_info *cdi, + struct cdrom_generic_command *cgc); +extern int cdrom_mode_sense(struct cdrom_device_info *cdi, + struct cdrom_generic_command *cgc, + int page_code, int page_control); +extern void init_cdrom_command(struct cdrom_generic_command *cgc, + void *buffer, int len); typedef struct { __u16 disc_information_length; @@ -795,6 +816,61 @@ __u32 track_size; __u32 last_rec_address; } track_information; + +/* The SCSI spec says there could be 256 slots. */ +#define CDROM_MAX_SLOTS 256 + +struct cdrom_mechstat_header { +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 fault : 1; + __u8 changer_state : 2; + __u8 curslot : 5; + __u8 mech_state : 3; + __u8 door_open : 1; + __u8 reserved1 : 4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 curslot : 5; + __u8 changer_state : 2; + __u8 fault : 1; + __u8 reserved1 : 4; + __u8 door_open : 1; + __u8 mech_state : 3; +#else +#error "Please fix " +#endif + __u8 curlba[3]; + __u8 nslots; + __u8 short slot_tablelen; +}; + + +struct cdrom_slot { +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 disc_present : 1; + __u8 reserved1 : 6; + __u8 change : 1; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 change : 1; + __u8 reserved1 : 6; + __u8 disc_present : 1; +#else +#error "Please fix " +#endif + __u8 reserved2[3]; +}; + +struct cdrom_changer_info { + struct cdrom_mechstat_header hdr; + struct cdrom_slot slots[CDROM_MAX_SLOTS]; +}; + +typedef enum { + mechtype_caddy = 0, + mechtype_tray = 1, + mechtype_popup = 2, + mechtype_individual_changer = 4, + mechtype_cartridge_changer = 5 +} mechtype_t; #endif /* End of kernel only stuff */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/console.h linux.ac/include/linux/console.h --- linux.vanilla/include/linux/console.h Thu Feb 25 18:02:12 1999 +++ linux.ac/include/linux/console.h Thu Sep 2 16:51:05 1999 @@ -51,6 +51,7 @@ extern struct consw dummy_con; /* dummy console buffer */ extern struct consw fb_con; /* frame buffer based console */ extern struct consw vga_con; /* VGA text console */ +extern struct consw newport_con; /* SGI Newport console */ extern struct consw prom_con; /* SPARC PROM console */ void take_over_console(struct consw *sw, int first, int last, int deflt); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/dcache_func.h linux.ac/include/linux/dcache_func.h --- linux.vanilla/include/linux/dcache_func.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/linux/dcache_func.h Tue Sep 14 22:01:41 1999 @@ -0,0 +1,91 @@ +#ifndef __LINUX_DCACHE_FUNC_H +#define __LINUX_DCACHE_FUNC_H + +/* + * Common dentry functions for inclusion in the VFS + * or in other stackable file systems. Some of these + * functions were in linux/fs/ C (VFS) files. + */ +#ifdef __KERNEL__ +#include +#include + +/* + * 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.. + */ +#define check_parent(dir, dentry) \ + ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_hash)) + +/* + * Locking the parent is needed to: + * - serialize directory operations + * - make sure the parent doesn't change from + * under us in the middle of an operation. + * + * NOTE! Right now we'd rather use a "struct inode" + * for this, but as I expect things to move toward + * using dentries instead for most things it is + * probably better to start with the conceptually + * better interface of relying on a path of dentries. + */ +static inline struct dentry *lock_parent(struct dentry *dentry) +{ + struct dentry *dir = dget(dentry->d_parent); + + down(&dir->d_inode->i_sem); + return dir; +} + +static inline struct dentry *get_parent(struct dentry *dentry) +{ + return dget(dentry->d_parent); +} + +static inline void unlock_dir(struct dentry *dir) +{ + up(&dir->d_inode->i_sem); + dput(dir); +} + +/* + * Whee.. Deadlock country. Happily there are only two VFS + * operations that does this.. + */ +static inline void double_lock(struct dentry *d1, struct dentry *d2) +{ + struct semaphore *s1 = &d1->d_inode->i_sem; + struct semaphore *s2 = &d2->d_inode->i_sem; + + if (s1 != s2) { + if ((unsigned long) s1 < (unsigned long) s2) { + struct semaphore *tmp = s2; + s2 = s1; s1 = tmp; + } + down(s1); + } + down(s2); +} + +static inline void double_unlock(struct dentry *d1, struct dentry *d2) +{ + struct semaphore *s1 = &d1->d_inode->i_sem; + struct semaphore *s2 = &d2->d_inode->i_sem; + + up(s1); + if (s1 != s2) + up(s2); + dput(d1); + dput(d2); +} + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_DCACHE_FUNC_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/dmaram.h linux.ac/include/linux/dmaram.h --- linux.vanilla/include/linux/dmaram.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/linux/dmaram.h Thu Sep 2 16:51:06 1999 @@ -0,0 +1,13 @@ +#ifndef __LINUX_DMARAM_H +#define __LINUX_DMARAM_H + +struct dma_info +{ + unsigned long size; + unsigned long phys; +}; + +#define DMAIOCSET _IOR('D',1,long) +#define DMAIOCGET _IOW('D',2,struct dma_info) + +#endif \ No newline at end of file diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/elf.h linux.ac/include/linux/elf.h --- linux.vanilla/include/linux/elf.h Thu Sep 2 00:48:46 1999 +++ linux.ac/include/linux/elf.h Sat Sep 11 01:48:33 1999 @@ -29,6 +29,13 @@ #define PT_PHDR 6 #define PT_LOPROC 0x70000000 #define PT_HIPROC 0x7fffffff +#define PT_MIPS_REGINFO 0x70000000 + +/* Flags in the e_flags field of the header */ +#define EF_MIPS_NOREORDER 0x00000001 +#define EF_MIPS_PIC 0x00000002 +#define EF_MIPS_CPIC 0x00000004 +#define EF_MIPS_ARCH 0xf0000000 /* These constants define the different elf file types */ #define ET_NONE 0 @@ -36,8 +43,8 @@ #define ET_EXEC 2 #define ET_DYN 3 #define ET_CORE 4 -#define ET_LOPROC 5 -#define ET_HIPROC 6 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff /* These constants define the various ELF target machines */ #define EM_NONE 0 @@ -99,6 +106,25 @@ #define DT_JMPREL 23 #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff +#define DT_MIPS_RLD_VERSION 0x70000001 +#define DT_MIPS_TIME_STAMP 0x70000002 +#define DT_MIPS_ICHECKSUM 0x70000003 +#define DT_MIPS_IVERSION 0x70000004 +#define DT_MIPS_FLAGS 0x70000005 + #define RHF_NONE 0 + #define RHF_HARDWAY 1 + #define RHF_NOTPOT 2 +#define DT_MIPS_BASE_ADDRESS 0x70000006 +#define DT_MIPS_CONFLICT 0x70000008 +#define DT_MIPS_LIBLIST 0x70000009 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_CONFLICTNO 0x7000000b +#define DT_MIPS_LIBLISTNO 0x70000010 +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_UNREFEXTNO 0x70000012 +#define DT_MIPS_GOTSYM 0x70000013 +#define DT_MIPS_HIPAGENO 0x70000014 +#define DT_MIPS_RLD_MAP 0x70000016 /* This info is needed when parsing the symbol table */ #define STB_LOCAL 0 @@ -167,6 +193,55 @@ #define R_386_GOTPC 10 #define R_386_NUM 11 +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 +#define R_MIPS_LITERAL 8 +#define R_MIPS_GOT16 9 +#define R_MIPS_PC16 10 +#define R_MIPS_CALL16 11 +#define R_MIPS_GPREL32 12 +/* The remaining relocs are defined on Irix, although they are not + in the MIPS ELF ABI. */ +#define R_MIPS_UNUSED1 13 +#define R_MIPS_UNUSED2 14 +#define R_MIPS_UNUSED3 15 +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +/* + * The following two relocation types are specified in the the MIPS ABI + * conformance guide version 1.2 but not yet in the psABI. + */ +#define R_MIPS_GOTHI16 22 +#define R_MIPS_GOTLO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +/* + * The following two relocation types are specified in the the MIPS ABI + * conformance guide version 1.2 but not yet in the psABI. + */ +#define R_MIPS_CALLHI16 30 +#define R_MIPS_CALLLO16 31 +/* + * This range is reserved for vendor specific relocations. + */ +#define R_MIPS_LOVENDOR 100 +#define R_MIPS_HIVENDOR 127 + + /* * Sparc ELF relocation types */ @@ -404,12 +479,17 @@ #define SHT_HIPROC 0x7fffffff #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff +#define SHT_MIPS_LIST 0x70000000 +#define SHT_MIPS_CONFLICT 0x70000002 +#define SHT_MIPS_GPTAB 0x70000003 +#define SHT_MIPS_UCODE 0x70000004 /* sh_flags */ #define SHF_WRITE 0x1 #define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 #define SHF_MASKPROC 0xf0000000 +#define SHF_MIPS_GPREL 0x10000000 /* special section indexes */ #define SHN_UNDEF 0 @@ -419,6 +499,7 @@ #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff +#define SHN_MIPS_ACCOMON 0xff00 typedef struct { Elf32_Word sh_name; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/fs.h linux.ac/include/linux/fs.h --- linux.vanilla/include/linux/fs.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/linux/fs.h Tue Sep 14 21:58:56 1999 @@ -724,7 +724,7 @@ #define __getname() ((char *) __get_free_page(GFP_KERNEL)) #define putname(name) free_page((unsigned long)(name)) -extern void kill_fasync(struct fasync_struct *, int); +extern void kill_fasync(struct fasync_struct *, int, int); extern int register_blkdev(unsigned int, const char *, struct file_operations *); extern int unregister_blkdev(unsigned int, const char *); extern int blkdev_open(struct inode *, struct file *); @@ -913,7 +913,7 @@ extern struct buffer_head * bread(kdev_t, int, int); extern struct buffer_head * breada(kdev_t, int, int, unsigned int, unsigned int); -extern int brw_page(int, struct page *, kdev_t, int [], int, int); +extern int brw_page(int, struct page *, kdev_t, int [], int); typedef int (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *); @@ -928,6 +928,7 @@ extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *); extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t); extern void do_generic_file_read(struct file * filp, loff_t *ppos, read_descriptor_t * desc, read_actor_t actor); +extern loff_t default_llseek(struct file *file, loff_t offset, int origin); extern struct super_block *get_super(kdev_t); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/genhd.h linux.ac/include/linux/genhd.h --- linux.vanilla/include/linux/genhd.h Mon Aug 23 15:12:17 1999 +++ linux.ac/include/linux/genhd.h Mon Sep 13 00:42:42 1999 @@ -11,6 +11,7 @@ #include #include +#include /* These three have identical behaviour; use the second one if DOS fdisk gets confused about extended/logical partitions starting past cylinder 1023. */ @@ -18,7 +19,9 @@ #define LINUX_EXTENDED_PARTITION 0x85 #define WIN98_EXTENDED_PARTITION 0x0f -#define LINUX_SWAP_PARTITION 0x82 +#define LINUX_SWAP_PARTITION 0x82 +#define LINUX_RAID_PARTITION 0xfd /* autodetect RAID partition */ +#define LINUX_OLD_RAID_PARTITION 0x86 #ifdef CONFIG_SOLARIS_X86_PARTITION #define SOLARIS_X86_PARTITION LINUX_SWAP_PARTITION @@ -29,6 +32,7 @@ #define DM6_AUX1PARTITION 0x51 /* no DDO: use xlated geom */ #define DM6_AUX3PARTITION 0x53 /* no DDO: use xlated geom */ + struct partition { unsigned char boot_ind; /* 0x80 - active */ unsigned char head; /* starting head */ @@ -45,7 +49,31 @@ struct hd_struct { long start_sect; long nr_sects; + int type; /* RAID or normal */ }; + +/* + * partition types Linux cares about. + * + * currently there are 'normal' and RAID types. + */ + +static inline unsigned int ptype (unsigned char raw_type) +{ + switch (raw_type) { + case LINUX_OLD_RAID_PARTITION: + return LINUX_OLD_RAID_PARTITION; + case LINUX_RAID_PARTITION: + return LINUX_RAID_PARTITION; + default: + } + return 0; +} + +/* + * the maximum length a given partition name can take (eg. "scd11") + */ +#define MAX_DISKNAME_LEN 32 struct gendisk { int major; /* major number of driver */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/i2c.h linux.ac/include/linux/i2c.h --- linux.vanilla/include/linux/i2c.h Thu Aug 5 19:11:40 1999 +++ linux.ac/include/linux/i2c.h Sun Sep 19 17:53:55 1999 @@ -41,6 +41,8 @@ #define I2C_BUSID_BT848 1 /* I2C bus on a BT848 */ #define I2C_BUSID_PARPORT 2 /* Bit banging on a parallel port */ #define I2C_BUSID_BUZ 3 +#define I2C_BUSID_ZORAN 4 + /* * struct for a driver for a i2c chip (tuner, soundprocessor, * videotext, ... ). diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/iobuf.h linux.ac/include/linux/iobuf.h --- linux.vanilla/include/linux/iobuf.h Thu Aug 5 20:30:24 1999 +++ linux.ac/include/linux/iobuf.h Sat Sep 18 01:36:52 1999 @@ -75,6 +75,6 @@ /* fs/buffer.c */ int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], - kdev_t dev, unsigned long b[], int size, int bmap); + kdev_t dev, unsigned long b[], int size); #endif /* __LINUX_IOBUF_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/lp.h linux.ac/include/linux/lp.h --- linux.vanilla/include/linux/lp.h Thu Aug 5 19:11:40 1999 +++ linux.ac/include/linux/lp.h Sat Sep 18 01:44:16 1999 @@ -5,6 +5,7 @@ * usr/include/linux/lp.h c.1991-1992 James Wiegand * many modifications copyright (C) 1992 Michael K. Johnson * Interrupt support added 1993 Nigel Gamble + * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti */ /* @@ -28,6 +29,17 @@ #define LP_HAVE_PORT_BIT 12 /* (0x1000) Port is claimed. */ #define LP_PORT_BUSY (1<<13) /* Reading or writing. */ +/* + * bit defines for 8255 status port + * base + 1 + * accessed with LP_S(minor), which gets the byte... + */ +#define LP_PBUSY 0x80 /* inverted input, active high */ +#define LP_PACK 0x40 /* unchanged input, active low */ +#define LP_POUTPA 0x20 /* unchanged input, active high */ +#define LP_PSELECD 0x10 /* unchanged input, active high */ +#define LP_PERRORP 0x08 /* unchanged input, active low */ + /* timeout for each character. This is relative to bus cycles -- it * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you * have extremely slow printing, or if the machine seems to slow down @@ -143,16 +155,6 @@ * gets inverted, but it is also active low. */ -/* - * bit defines for 8255 status port - * base + 1 - * accessed with LP_S(minor), which gets the byte... - */ -#define LP_PBUSY 0x80 /* inverted input, active high */ -#define LP_PACK 0x40 /* unchanged input, active low */ -#define LP_POUTPA 0x20 /* unchanged input, active high */ -#define LP_PSELECD 0x10 /* unchanged input, active high */ -#define LP_PERRORP 0x08 /* unchanged input, active low */ /* * defines for 8255 control port diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/mm.h linux.ac/include/linux/mm.h --- linux.vanilla/include/linux/mm.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/linux/mm.h Thu Sep 16 16:56:44 1999 @@ -349,6 +349,14 @@ extern void truncate_inode_pages(struct inode *, unsigned long); extern unsigned long get_cached_page(struct inode *, unsigned long, int); extern void put_cached_page(unsigned long); +/* generic vm_area_ops exported for stackable file systems */ +extern int filemap_swapout(struct vm_area_struct * vma, struct page * page); +extern pte_t filemap_swapin(struct vm_area_struct * vma, + unsigned long offset, unsigned long entry); +extern int filemap_sync(struct vm_area_struct * vma, unsigned long address, + size_t size, unsigned int flags); +extern unsigned long filemap_nopage(struct vm_area_struct * area, + unsigned long address, int no_share); /* * GFP bitmasks.. @@ -393,10 +401,11 @@ address &= PAGE_MASK; grow = vma->vm_start - address; - if (vma->vm_end - address - > (unsigned long) current->rlim[RLIMIT_STACK].rlim_cur || - (vma->vm_mm->total_vm << PAGE_SHIFT) + grow - > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur) + if ((vma->vm_end - address + > current->rlim[RLIMIT_STACK].rlim_cur) || + ((current->rlim[RLIMIT_AS].rlim_cur < RLIM_INFINITY) && + ((vma->vm_mm->total_vm << PAGE_SHIFT) + grow + > current->rlim[RLIMIT_AS].rlim_cur))) return -ENOMEM; vma->vm_start = address; vma->vm_offset -= grow; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/module.h linux.ac/include/linux/module.h --- linux.vanilla/include/linux/module.h Tue Aug 17 17:27:42 1999 +++ linux.ac/include/linux/module.h Sun Sep 19 17:53:28 1999 @@ -8,6 +8,7 @@ #define _LINUX_MODULE_H #include +#include #ifdef __GENKSYMS__ # define _set_ver(sym) sym @@ -207,11 +208,17 @@ #endif #else /* MODULE */ - +extern int parse_parameters(void *var, char *type, char *str); #define MODULE_AUTHOR(name) #define MODULE_DESCRIPTION(desc) #define MODULE_SUPPORTED_DEVICE(name) -#define MODULE_PARM(var,type) +#define MODULE_PARM(var,type) \ +static char *modparm##var##_setup_type __initdata = type;\ +static int __init modparm##var##_setup(char *str)\ +{\ + return parse_parameters((void *)&var, modparm##var##_setup_type, str);\ +}\ +__setup(MODULE_NAME #var "=", modparm##var##_setup); #define MODULE_PARM_DESC(var,desc) #ifndef __GENKSYMS__ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/net.h linux.ac/include/linux/net.h --- linux.vanilla/include/linux/net.h Thu Aug 26 14:42:19 1999 +++ linux.ac/include/linux/net.h Tue Sep 14 21:58:56 1999 @@ -126,7 +126,7 @@ void (*init_func)(struct net_proto *); /* Bootstrap */ }; -extern int sock_wake_async(struct socket *sk, int how); +extern int sock_wake_async(struct socket *sk, int how, int band); extern int sock_register(struct net_proto_family *fam); extern int sock_unregister(int family); extern struct socket *sock_alloc(void); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/pagemap.h linux.ac/include/linux/pagemap.h --- linux.vanilla/include/linux/pagemap.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/linux/pagemap.h Thu Sep 16 16:56:44 1999 @@ -103,7 +103,6 @@ static inline void wait_on_page(struct page * page) { - if (PageLocked(page)) ___wait_on_page(page); } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/pc_keyb.h linux.ac/include/linux/pc_keyb.h --- linux.vanilla/include/linux/pc_keyb.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/linux/pc_keyb.h Thu Sep 2 16:51:06 1999 @@ -0,0 +1,130 @@ +/* + * include/linux/pc_keyb.h + * + * PC Keyboard And Keyboard Controller + * + * (c) 1997 Martin Mares + */ + +/* + * Configuration Switches + */ + +#undef KBD_REPORT_ERR /* Report keyboard errors */ +#define KBD_REPORT_UNKN /* Report unknown scan codes */ +#define KBD_REPORT_TIMEOUTS /* Report keyboard timeouts */ +#undef KBD_IS_FOCUS_9000 /* We have the brain-damaged FOCUS-9000 keyboard */ +#undef INITIALIZE_MOUSE /* Define if your PS/2 mouse needs initialization. */ + + + +#define KBD_INIT_TIMEOUT 1000 /* Timeout in ms for initializing the keyboard */ +#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ +#define KBD_TIMEOUT 1000 /* Timeout in ms for keyboard command acknowledge */ + +/* + * Internal variables of the driver + */ + +extern unsigned char pckbd_read_mask; +extern unsigned char aux_device_present; + +/* + * Keyboard Controller Registers on normal PCs. + */ + +#define KBD_STATUS_REG 0x64 /* Status register (R) */ +#define KBD_CNTL_REG 0x64 /* Controller command register (W) */ +#define KBD_DATA_REG 0x60 /* Keyboard data register (R/W) */ + +/* + * Keyboard Controller Commands + */ + +#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */ +#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */ +#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */ +#define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */ +#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */ +#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */ +#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */ +#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ +#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ +#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ +#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if + initiated by the auxiliary device */ +#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ + +/* + * Keyboard Commands + */ + +#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ +#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ +#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ +#define KBD_CMD_DISABLE 0xF5 /* Disable scanning */ +#define KBD_CMD_RESET 0xFF /* Reset */ + +/* + * Keyboard Replies + */ + +#define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ACK 0xFA /* Command ACK */ +#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ + +/* + * Status Register Bits + */ + +#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */ +#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */ +#define KBD_STAT_SELFTEST 0x04 /* Self test successful */ +#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */ +#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */ +#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */ +#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */ +#define KBD_STAT_PERR 0x80 /* Parity error */ + +#define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF) + +/* + * Controller Mode Register Bits + */ + +#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */ +#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */ +#define KBD_MODE_SYS 0x04 /* The system flag (?) */ +#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */ +#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */ +#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */ +#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */ +#define KBD_MODE_RFU 0x80 + +/* + * Mouse Commands + */ + +#define AUX_SET_RES 0xE8 /* Set resolution */ +#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ +#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */ +#define AUX_GET_SCALE 0xE9 /* Get scaling factor */ +#define AUX_SET_STREAM 0xEA /* Set stream mode */ +#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */ +#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */ +#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */ +#define AUX_RESET 0xFF /* Reset aux device */ +#define AUX_ACK 0xFA /* Command byte ACK. */ + +#define AUX_BUF_SIZE 2048 /* This might be better divisible by + three to make overruns stay in sync + but then the read function would need + a lock etc - ick */ + +struct aux_queue { + unsigned long head; + unsigned long tail; + wait_queue_head_t proc_list; + struct fasync_struct *fasync; + unsigned char buf[AUX_BUF_SIZE]; +}; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/pci.h linux.ac/include/linux/pci.h --- linux.vanilla/include/linux/pci.h Sat Sep 11 00:54:17 1999 +++ linux.ac/include/linux/pci.h Tue Sep 14 21:30:53 1999 @@ -1179,8 +1179,8 @@ #define PCI_VENDOR_ID_LAVA 0x1407 #define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8001 /* The Lava Dual Parallel is */ -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8002 /* two PCI devices on a card */ +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ #define PCI_VENDOR_ID_PANACOM 0x14d4 #define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/pci_scan.h linux.ac/include/linux/pci_scan.h --- linux.vanilla/include/linux/pci_scan.h Thu Jan 1 01:00:00 1970 +++ linux.ac/include/linux/pci_scan.h Thu Sep 16 01:06:17 1999 @@ -0,0 +1,86 @@ +#ifndef _PCI_NETIF_H +#define _PCI_NETIF_H +/* + version 0.04 $Date: 1999/08/31 16:05:30 $ + Copyright 1999 Donald Becker / Scyld Computing Corporation + This software is part of the Linux kernel. It may be used and + distributed according to the terms of the GNU Public License, + incorporated herein by reference. +*/ + +/* + These are the structures in the table that drives the PCI probe routines. + Note the matching code uses a bitmask: more specific table entries should + be placed before "catch-all" entries. + + The table must be zero terminated. +*/ +enum pci_id_flags_bits { + /* Set PCI command register bits before calling probe1(). */ + PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, + /* Read and map the single following PCI BAR. */ + PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4, + PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400, +}; + +struct pci_id_info { + const char *name; + struct match_info { + int pci, pci_mask, subsystem, subsystem_mask; + int revision, revision_mask; /* Only 8 bits. */ + } id; + enum pci_id_flags_bits pci_flags; + int io_size; /* Needed for I/O region check or ioremap(). */ + int drv_flags; /* Driver use, intended as capability flags. */ +}; + +enum drv_id_flags { + PCI_HOTSWAP=1, /* Leave module loaded for Cardbus-like chips. */ +}; +enum drv_pwr_action { + DRV_NOOP, DRV_SUSPEND, DRV_RESUME, DRV_DETACH, DRV_PWRDOWN }; + +struct drv_id_info { + const char *name; /* Single-word driver name. */ + int flags; + int pci_class; /* Typically PCI_CLASS_NETWORK_ETHERNET<<8. */ + struct pci_id_info *pci_dev_tbl; + void *(*probe1)(struct pci_dev *pdev, void *dev_ptr, + long ioaddr, int irq, int table_idx, int fnd_cnt); + /* Optional, called for suspend, resume and detach. */ + int (*pwr_event)(void *dev, int event); +#if 0 + /* Internal values. */ + struct drv_id_info *next; + void *cb_ops; +#endif +}; + +/* PCI scan and activate. + Scan PCI-like hardware, calling probe1(..,dev,..) on devices that match. + Returns -ENODEV, a negative number, if no cards are found. */ + +extern int pci_drv_register(struct drv_id_info *drv_id, void *initial_device); +extern void pci_drv_unregister(struct drv_id_info *drv_id); + + +/* ACPI routines. + Wake (change to ACPI D0 state) or set the ACPI power level of a sleeping + ACPI device. Returns the old power state. */ + +extern int acpi_wake(struct pci_dev *pdev); +enum acpi_pwr_state {ACPI_D0, ACPI_D1, ACPI_D2, ACPI_D3}; +extern int acpi_set_pwr_state(struct pci_dev *pdev, enum acpi_pwr_state state); + +extern int (*register_cb_hook)(struct drv_id_info *did); +extern void (*unregister_cb_hook)(struct drv_id_info *did); + + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/prctl.h linux.ac/include/linux/prctl.h --- linux.vanilla/include/linux/prctl.h Thu Aug 26 14:42:19 1999 +++ linux.ac/include/linux/prctl.h Thu Sep 2 16:51:06 1999 @@ -6,5 +6,8 @@ #define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ #define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ +/* Get/set current->dumpable */ +#define PR_GET_DUMPABLE 3 +#define PR_SET_DUMPABLE 4 #endif /* _LINUX_PRCTL_H */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/resource.h linux.ac/include/linux/resource.h --- linux.vanilla/include/linux/resource.h Mon Dec 28 06:18:28 1998 +++ linux.ac/include/linux/resource.h Mon Sep 6 16:57:05 1999 @@ -38,10 +38,14 @@ }; #define RLIM_INFINITY ((long)(~0UL>>1)) +#define RLIM_SAVED_CUR RLIM_INFINITY +#define RLIM_SAVED_MAX RLIM_INFINITY + +typedef unsigned long rlim_t; struct rlimit { - long rlim_cur; - long rlim_max; + rlim_t rlim_cur; + rlim_t rlim_max; }; #define PRIO_MIN (-20) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/sched.h linux.ac/include/linux/sched.h --- linux.vanilla/include/linux/sched.h Sat Sep 11 00:54:17 1999 +++ linux.ac/include/linux/sched.h Thu Sep 16 16:56:44 1999 @@ -646,6 +646,10 @@ /* Remove the current tasks stale references to the old mm_struct */ extern void mm_release(void); +/* flush all the user space tied resources of a thread */ + +extern void daemonize(void); + /* * Routines for handling the fd arrays */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/socket.h linux.ac/include/linux/socket.h --- linux.vanilla/include/linux/socket.h Sat Sep 11 00:54:17 1999 +++ linux.ac/include/linux/socket.h Fri Sep 10 17:56:17 1999 @@ -128,18 +128,6 @@ __u32 gid; }; -/* Socket types. */ - -#define SOCK_STREAM 1 /* stream (connection) socket */ -#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ -#define SOCK_RAW 3 /* raw socket */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequential packet socket */ -#define SOCK_PACKET 10 /* linux specific way of */ - /* getting packets at the dev */ - /* level. For writing rarp and */ - /* other similar things on the */ - /* user level. */ /* Supported address families. */ #define AF_UNSPEC 0 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/synclink.h linux.ac/include/linux/synclink.h --- linux.vanilla/include/linux/synclink.h Mon Jul 5 22:33:39 1999 +++ linux.ac/include/linux/synclink.h Tue Sep 14 20:50:01 1999 @@ -1,7 +1,7 @@ /* * SyncLink Multiprotocol Serial Adapter Driver * - * ==FILEDATE 19990523== + * ==FILEDATE 19990810== * * Copyright (C) 1998 by Microgate Corporation * @@ -50,8 +50,9 @@ #define BIT31 0x80000000 -#define HDLC_MAX_FRAME_SIZE 4096 +#define HDLC_MAX_FRAME_SIZE 65535 #define MAX_ASYNC_TRANSMIT 4096 +#define MAX_ASYNC_BUFFER_SIZE 4096 #define ASYNC_PARITY_NONE 0 #define ASYNC_PARITY_EVEN 1 @@ -68,12 +69,12 @@ #define HDLC_FLAG_AUTO_RTS 0x0080 #define HDLC_FLAG_RXC_DPLL 0x0100 #define HDLC_FLAG_RXC_BRG 0x0200 -#define HDLC_FLAG_RXC_TXCPIN 0x8000 -#define HDLC_FLAG_RXC_RXCPIN 0x0000 +#define HDLC_FLAG_RXC_TXCPIN 0x8000 +#define HDLC_FLAG_RXC_RXCPIN 0x0000 #define HDLC_FLAG_TXC_DPLL 0x0400 #define HDLC_FLAG_TXC_BRG 0x0800 -#define HDLC_FLAG_TXC_TXCPIN 0x0000 -#define HDLC_FLAG_TXC_RXCPIN 0x0008 +#define HDLC_FLAG_TXC_TXCPIN 0x0000 +#define HDLC_FLAG_TXC_RXCPIN 0x0008 #define HDLC_FLAG_DPLL_DIV8 0x1000 #define HDLC_FLAG_DPLL_DIV16 0x2000 #define HDLC_FLAG_DPLL_DIV32 0x0000 @@ -81,6 +82,7 @@ #define HDLC_CRC_NONE 0 #define HDLC_CRC_16_CCITT 1 +#define HDLC_CRC_32_CCITT 2 #define HDLC_TXIDLE_FLAGS 0 #define HDLC_TXIDLE_ALT_ZEROS_ONES 1 @@ -132,7 +134,7 @@ unsigned char encoding; /* NRZ, NRZI, etc. */ unsigned long clock_speed; /* external clock speed in bits per second */ unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */ - unsigned short crc_type; /* None, CRC16 or CRC16-CCITT */ + unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */ unsigned char preamble_length; unsigned char preamble; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/sysctl.h linux.ac/include/linux/sysctl.h --- linux.vanilla/include/linux/sysctl.h Sat Sep 11 00:54:17 1999 +++ linux.ac/include/linux/sysctl.h Thu Sep 16 00:05:37 1999 @@ -103,7 +103,8 @@ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ KERN_SYSRQ=38, /* int: Sysreq enable */ KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */ - KERN_RANDOM=40 /* Random driver */ + KERN_RANDOM=40, /* Random driver */ + KERN_SHMALL=41 /* int: Maximum size of shared memory */ }; @@ -629,7 +630,7 @@ int ctl_name; /* Binary ID */ const char *procname; /* Text ID for /proc/sys, or zero */ void *data; - int maxlen; + size_t maxlen; mode_t mode; ctl_table *child; proc_handler *proc_handler; /* Callback for text formatting */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/tty.h linux.ac/include/linux/tty.h --- linux.vanilla/include/linux/tty.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/linux/tty.h Tue Sep 14 21:58:56 1999 @@ -118,6 +118,9 @@ #define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ +#define VIDEO_TYPE_SGI 0x70 /* Various SGI graphics hardware */ +#define VIDEO_TYPE_MIPS_G364 0x71 /* MIPS Magnum 4000 G364 video */ + /* * This character is the same as _POSIX_VDISABLE: it cannot be used as * a c_cc[] character, but indicates that a particular special character @@ -326,6 +329,7 @@ #define TTY_HW_COOK_OUT 14 #define TTY_HW_COOK_IN 15 #define TTY_PTY_LOCK 16 +#define TTY_NO_WRITE_SPLIT 17 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/linux/videodev.h linux.ac/include/linux/videodev.h --- linux.vanilla/include/linux/videodev.h Thu Aug 5 19:11:40 1999 +++ linux.ac/include/linux/videodev.h Sun Sep 19 17:57:36 1999 @@ -278,8 +278,9 @@ #define VID_HARDWARE_TYPHOON 19 #define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */ #define VID_HARDWARE_CADET 21 /* Cadet radio */ -#define VID_HARDWARE_CPIA 22 +#define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ +#define VID_HARDWARE_CPIA 24 /* * Initialiser list diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/ircomm_tty.h linux.ac/include/net/irda/ircomm_tty.h --- linux.vanilla/include/net/irda/ircomm_tty.h Thu Sep 2 00:48:46 1999 +++ linux.ac/include/net/irda/ircomm_tty.h Sat Sep 18 01:41:42 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Jun 6 23:24:22 1999 - * Modified at: Fri Aug 13 07:31:35 1999 + * Modified at: Tue Aug 31 10:22:02 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -83,8 +83,12 @@ struct termios callout_termios; wait_queue_head_t open_wait; + wait_queue_head_t close_wait; struct timer_list watchdog_timer; struct tq_struct tqueue; + + unsigned short close_delay; + unsigned short closing_wait; /* time to wait before closing */ long pgrp; /* pgrp of opening process */ int open_count; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/ircomm_tty_attach.h linux.ac/include/net/irda/ircomm_tty_attach.h --- linux.vanilla/include/net/irda/ircomm_tty_attach.h Thu Sep 2 00:48:46 1999 +++ linux.ac/include/net/irda/ircomm_tty_attach.h Sat Sep 18 01:41:42 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Wed Jun 9 15:55:18 1999 - * Modified at: Mon Jul 5 12:56:56 1999 + * Modified at: Thu Sep 2 10:29:30 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -52,6 +52,8 @@ IRCOMM_TTY_DISCOVERY_INDICATION, IRCOMM_TTY_CONNECT_CONFIRM, IRCOMM_TTY_CONNECT_INDICATION, + IRCOMM_TTY_DISCONNECT_REQUEST, + IRCOMM_TTY_DISCONNECT_INDICATION, IRCOMM_TTY_WD_TIMER_EXPIRED, IRCOMM_TTY_GOT_PARAMETERS, IRCOMM_TTY_GOT_LSAPSEL, @@ -66,6 +68,7 @@ extern char *ircomm_state[]; extern char *ircomm_event[]; +extern char *ircomm_tty_state[]; int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, struct sk_buff *skb, struct ircomm_tty_info *info); @@ -79,6 +82,9 @@ __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); +void ircomm_tty_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *skb); void ircomm_tty_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irlpt_cli.h linux.ac/include/net/irda/irlpt_cli.h --- linux.vanilla/include/net/irda/irlpt_cli.h Mon Aug 23 15:12:18 1999 +++ linux.ac/include/net/irda/irlpt_cli.h Thu Jan 1 01:00:00 1970 @@ -1,49 +0,0 @@ -/********************************************************************* - * - * Filename: irlpt_cli.h - * Version: 0.1 - * Description: - * Status: Experimental. - * Author: Dag Brattli - * Created at: Sat Feb 21 18:54:38 1998 - * Modified at: Wed Apr 21 16:46:26 1999 - * Modified by: Dag Brattli - * - * Copyright (c) 1998, Thomas Davis, - * Copyright (c) 1998, Dag Brattli, - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. This - * material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLPT_CLIENT_H -#define IRLPT_CLIENT_H - -/* Debug function */ - -/* int client_init( struct net_device *dev); */ - -/* - * if it's static, it doesn't go in here. - */ - -void irlpt_client_get_value_confirm(int result, __u16 obj_id, - struct ias_value *value, - void *priv); -void irlpt_client_connect_indication( void *instance, - void *sap, - struct qos_info *qos, - int max_seg_size, - struct sk_buff *skb); -void irlpt_client_connect_request( struct irlpt_cb *self); - -extern hashbin_t *irlpt_clients; - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irlpt_cli_fsm.h linux.ac/include/net/irda/irlpt_cli_fsm.h --- linux.vanilla/include/net/irda/irlpt_cli_fsm.h Sun Mar 7 23:26:43 1999 +++ linux.ac/include/net/irda/irlpt_cli_fsm.h Thu Jan 1 01:00:00 1970 @@ -1,36 +0,0 @@ -/********************************************************************* - * - * Filename: irlpt_cli_fsm.h - * Version: 0.1 - * Sources: irlan_event.h - * - * Copyright (c) 1997 Dag Brattli , - * All Rights Reserved. - * Copyright (c) 1998, Thomas Davis, , - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLPT_EVENT_H -#define IRLPT_EVENT_H - -#include -#include - -extern void irlpt_client_do_event( struct irlpt_cb *self, - IRLPT_EVENT event, - struct sk_buff *skb, - struct irlpt_info *info); -extern void irlpt_client_next_state( struct irlpt_cb *self, - IRLPT_CLIENT_STATE state); - -#endif - diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irlpt_common.h linux.ac/include/net/irda/irlpt_common.h --- linux.vanilla/include/net/irda/irlpt_common.h Sun May 30 18:27:04 1999 +++ linux.ac/include/net/irda/irlpt_common.h Thu Jan 1 01:00:00 1970 @@ -1,190 +0,0 @@ -/********************************************************************* - * - * Filename: irlpt_common.h - * Version: - * Description: - * Status: Experimental. - * Author: Thomas Davis, - * Created at: Sat Feb 21 18:54:38 1998 - * Modified at: Sun Mar 8 23:44:19 1998 - * Modified by: Dag Brattli - * Sources: irlan.c - * - * Copyright (c) 1998, Thomas Davis, , - * Dag Brattli, - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLPT_COMMON_H -#define IRLPT_COMMON_H - -#include -#include - -#include -#include -#include -#include -#include - -#include - -extern char *irlpt_service_type[]; -extern char *irlpt_port_type[]; -extern char *irlpt_connected[]; -extern char *irlpt_reasons[]; -extern char *irlpt_client_fsm_state[]; -extern char *irlpt_server_fsm_state[]; -extern char *irlpt_fsm_event[]; - -extern wait_queue_head_t lpt_wait; - -extern struct irlpt_cb *irlpt_find_handle(unsigned int minor); -extern void irlpt_flow_control(struct sk_buff *skb); - -extern ssize_t irlpt_read( struct file *file, char *buffer, - size_t count, loff_t *noidea); -extern ssize_t irlpt_write(struct file *file, const char *buffer, - size_t count, loff_t *noidea); -extern loff_t irlpt_seek(struct file *, loff_t, int); -extern int irlpt_open(struct inode * inode, struct file *file); -extern int irlpt_close(struct inode *inode, struct file *file); -extern u_int irlpt_poll(struct file *file, poll_table *wait); - -/* FSM definitions */ - -typedef enum { - IRLPT_CLIENT_IDLE, - IRLPT_CLIENT_QUERY, - IRLPT_CLIENT_READY, - IRLPT_CLIENT_WAITI, - IRLPT_CLIENT_CONN, -} IRLPT_CLIENT_STATE; - -typedef enum { - IRLPT_SERVER_IDLE, - IRLPT_SERVER_CONN, -} IRLPT_SERVER_STATE; - -/* IrLPT Events */ - -typedef enum { - QUERY_REMOTE_IAS, - IAS_PROVIDER_AVAIL, - IAS_PROVIDER_NOT_AVAIL, - LAP_DISCONNECT, - LMP_CONNECT, - LMP_DISCONNECT, - LMP_CONNECT_INDICATION, - LMP_DISCONNECT_INDICATION, - IRLPT_DISCOVERY_INDICATION, - IRLPT_CONNECT_REQUEST, - IRLPT_DISCONNECT_REQUEST, - CLIENT_DATA_INDICATION, -} IRLPT_EVENT; - -struct irlpt_info { - struct lsap_cb *lsap; - __u8 dlsap_sel; - __u32 daddr; - __u32 saddr; -}; - -/* Command packet types */ - -#define IRLPT_MAX_PACKET 1024 -#define IRLPT_MAX_HEADER LMP_MAX_HEADER -#define IRLPT_MAX_DEVICES 3 -#define IRLPT_MAGIC 0x0755 - -typedef enum { - IRLPT_DISCONNECTED, - IRLPT_WAITING, - IRLPT_CONNECTED, - IRLPT_FLUSHED, -} IRLPT_SERVER_STATUS; - -#define IRLPT_LSAP 0x09 - -#define PI_SERVICE_TYPE 0x00 - -#define IRLPT_UNKNOWN 0x00 /* not defined yet. */ -#define IRLPT_THREE_WIRE_RAW 0x01 /* bit 0 */ -#define IRLPT_THREE_WIRE 0x02 /* bit 1 */ -#define IRLPT_NINE_WIRE 0x04 /* bit 2 */ -#define IRLPT_CENTRONICS 0x08 /* bit 3 */ -#define IRLPT_SERVER_MODE 0xFF /* our own flag */ - -#define PI_PORT_TYPE 0x01 - -#define IRLPT_SERIAL 0x01 /* bit 0 */ -#define IRLPT_PARALLEL 0x02 /* bit 1 */ - -#define PI_PORT_NAME 0x02 - -#define PI_CRITICAL 0x80 - -struct irlpt_cb { - QUEUE queue; /* must be first. */ - - int magic; /* magic used to detect corruption of - the struct */ - __u32 daddr; /* address of remote printer */ - __u32 saddr; /* my local address. */ - - struct timer_list retry_timer; - - int volatile state; /* Current state of IrCOMM layer */ - int open_retries; - int in_use; /* flag to prevent re-use */ - char ifname[16]; /* name of the allocated instance, - and registered device. */ - struct lsap_cb *lsap; /* lmp handle */ - - __u8 dlsap_sel; /* remote LSAP selector address */ - __u8 slsap_sel; /* local LSAP selectoraddress */ - __u8 servicetype; /* Type of remote service, ie THREE_WIRE_RAW */ - __u8 porttype; /* type of remote port. */ - - struct miscdevice ir_dev; /* used to register the misc device. */ - - int count; /* open count */ - int max_data_size; /* max frame size we can send */ - int max_header_size; /* how much header space is needed */ - int pkt_count; /* how many packets are queued up */ - - wait_queue_head_t read_wait; /* wait queues */ - wait_queue_head_t write_wait; - wait_queue_head_t ex_wait; - - /* this is used to remove the printer when it's gone */ - struct timer_list lpt_timer; - void (*timeout) (unsigned long data); - - void (*do_event) (struct irlpt_cb *self, IRLPT_EVENT event, - struct sk_buff *skb, - struct irlpt_info *info); - - /* this is used by the server side of the system */ - - IRLPT_SERVER_STATE connected; - - int eof; - int service_LSAP; - - struct sk_buff_head rx_queue; /* read buffer queue */ -}; - -/* Debug function */ -void irlpt_dump_buffer(struct sk_buff *); - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irlpt_server.h linux.ac/include/net/irda/irlpt_server.h --- linux.vanilla/include/net/irda/irlpt_server.h Mon Aug 23 15:12:18 1999 +++ linux.ac/include/net/irda/irlpt_server.h Thu Jan 1 01:00:00 1970 @@ -1,42 +0,0 @@ -/********************************************************************* - * - * Filename: irlpt_server.h - * Version: 0.1 - * Description: - * Status: Experimental. - * Author: Dag Brattli - * Created at: Sat Feb 21 18:54:38 1998 - * Modified at: Tue Sep 22 11:41:42 1998 - * Modified by: Dag Brattli - * - * Copyright (c) 1998, Thomas Davis, - * Copyright (c) 1998, Dag Brattli, - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. This - * material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLPT_SERVER_H -#define IRLPT_SERVER_H - -#include "qos.h" -#include "irmod.h" - -#include -#include -#include -#include -#include - -/* int server_init( struct net_device *dev); */ - -extern struct irlpt_cb *irlpt_server; - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irlpt_server_fsm.h linux.ac/include/net/irda/irlpt_server_fsm.h --- linux.vanilla/include/net/irda/irlpt_server_fsm.h Sun Mar 7 23:26:43 1999 +++ linux.ac/include/net/irda/irlpt_server_fsm.h Thu Jan 1 01:00:00 1970 @@ -1,35 +0,0 @@ -/********************************************************************* - * - * Filename: server_server_fsm.h - * Version: 0.1 - * Sources: irlan_event.h - * - * Copyright (c) 1997 Dag Brattli , - * All Rights Reserved. - * Copyright (c) 1998, Thomas Davis, , - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Thomas Davis, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRLPT_EVENT_H -#define IRLPT_EVENT_H - -#include -#include - -void irlpt_server_do_event( struct irlpt_cb *self, - IRLPT_EVENT event, - struct sk_buff *skb, - struct irlpt_info *info); -void irlpt_server_next_state( struct irlpt_cb *self, - IRLPT_SERVER_STATE state); - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/irvtd.h linux.ac/include/net/irda/irvtd.h --- linux.vanilla/include/net/irda/irvtd.h Thu Jun 10 12:57:41 1999 +++ linux.ac/include/net/irda/irvtd.h Thu Jan 1 01:00:00 1970 @@ -1,95 +0,0 @@ -/********************************************************************* - * - * Filename: irvtd.h - * Version: 0.1 - * Sources: irlpt.h - * - * Copyright (c) 1998, Takahide Higuchi , - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * I, Takahide Higuchi, provide no warranty for any of this software. - * This material is provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRVTD_H -#define IRVTD_H - -#include -#include -#include -#include - -#include -#include -#include - - -#define IRVTD_MAGIC 0xff545943 /* random */ -#define COMM_MAX_TTY 1 -#define IRVTD_RX_QUEUE_HIGH 10 -#define IRVTD_RX_QUEUE_LOW 2 - -#define IRCOMM_MAJOR 60; /* Zero means automatic allocation - 60,61,62,and 63 is reserved for experiment */ -#define IRVTD_MINOR 64 - - - -struct irvtd_cb { - - int magic; /* magic used to detect corruption of the struct */ - - /* if daddr is NULL, remote device have not been discovered yet */ - - int tx_disable; - int rx_disable; - struct sk_buff *txbuff; - struct sk_buff_head rxbuff; - struct ircomm_cb *comm; /* ircomm instance */ - - __u32 tx_max_sdu_size; - __u32 max_header_size; - /* - * These members are used for compatibility with usual serial device. - * See linux/serial.h - */ - - int flags; - struct tty_struct *tty; - - int line; - int count; /* open count */ - int blocked_open; - wait_queue_head_t open_wait; - wait_queue_head_t close_wait; - wait_queue_head_t delta_msr_wait; - wait_queue_head_t tx_wait; - - struct timer_list tx_timer; - struct timer_list rx_timer; - - long pgrp; - long session; - unsigned short closing_wait; /* time to wait before closing */ - unsigned short close_delay; - - int custom_divisor; - int mcr; - int msr; - int cts_stoptx; - int ttp_stoptx; - int ttp_stoprx; - int disconnect_pend; - struct serial_icounter_struct icount; - int read_status_mask; - int ignore_status_mask; -}; - - -#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/irda/toshoboe.h linux.ac/include/net/irda/toshoboe.h --- linux.vanilla/include/net/irda/toshoboe.h Sun May 30 18:27:04 1999 +++ linux.ac/include/net/irda/toshoboe.h Mon Sep 6 16:57:45 1999 @@ -25,6 +25,12 @@ /* * $Log: toshoboe.h,v $ + * Revision 1.4 1999/06/29 13:46:42 root + * ls + * + * Revision 1.3 1999/06/29 12:31:03 root + * *** empty log message *** + * * Revision 1.2 1999/05/09 01:43:08 root * *** empty log message *** * @@ -157,6 +163,8 @@ struct OboeTaskFile *taskfile; /*The taskfile */ void *xmit_bufs[TX_SLOTS]; /*The buffers */ void *recv_bufs[RX_SLOTS]; + int open; + int stopped; /*Stopped by some or other APM stuff*/ }; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/pcmcia/bus_ops.h linux.ac/include/pcmcia/bus_ops.h --- linux.vanilla/include/pcmcia/bus_ops.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/pcmcia/bus_ops.h Wed Sep 15 23:57:59 1999 @@ -1,5 +1,5 @@ /* - * bus_ops.h 1.6 1999/08/28 04:12:33 + * bus_ops.h 1.7 1999/09/10 06:22:33 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in @@ -30,6 +30,8 @@ #ifndef _LINUX_BUS_OPS_H #define _LINUX_BUS_OPS_H +#ifdef CONFIG_VIRTUAL_BUS + typedef struct bus_operations { void *priv; u32 (*b_in)(void *bus, u32 port, s32 sz); @@ -51,8 +53,6 @@ void *dev_id); void (*b_free_irq)(void *bus, u_int irq, void *dev_id); } bus_operations; - -#ifdef CONFIG_VIRTUAL_BUS #define bus_inb(b,p) (b)->b_in((b),(p),0) #define bus_inw(b,p) (b)->b_in((b),(p),1) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/pcmcia/mem_op.h linux.ac/include/pcmcia/mem_op.h --- linux.vanilla/include/pcmcia/mem_op.h Tue Sep 7 22:07:13 1999 +++ linux.ac/include/pcmcia/mem_op.h Wed Sep 15 23:57:59 1999 @@ -1,5 +1,5 @@ /* - * mem_op.h 1.10 1999/08/28 04:12:33 + * mem_op.h 1.11 1999/09/15 07:14:03 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in @@ -49,7 +49,7 @@ size_t odd = (n & 3); n -= odd; while (n) { - put_user(readl_ns(from), (int *)to); + put_user(__raw_readl(from), (int *)to); (char *)from += 4; (char *)to += 4; n -= 4; } while (odd--) @@ -64,7 +64,7 @@ n -= odd; while (n) { get_user(l, (int *)from); - writel_ns(l, to); + __raw_writel(l, to); (char *)to += 4; (char *)from += 4; n -= 4; } while (odd--) { diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/scsi/sg.h linux.ac/include/scsi/sg.h --- linux.vanilla/include/scsi/sg.h Thu Jun 10 12:57:41 1999 +++ linux.ac/include/scsi/sg.h Sat Sep 11 01:12:19 1999 @@ -12,10 +12,16 @@ * Copyright (C) 1998, 1999 Douglas Gilbert - Version: 2.1.34 (990603) - This version for later 2.1.x and 2.2.x series kernels - D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au) - + Version: 2.3.35 (990708) + This version for 2.3 series kernels. It only differs from sg version + 2.1.35 used in the 2.2 series kernels by changes to wait_queue. This + in an internal kernel interface and should not effect users. + D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au) + + Changes since 2.1.34 (990603) + - add queuing info into struct sg_scsi_id + - block negative timeout values + - add back write() wait on previous read() when no cmd queuing Changes since 2.1.33 (990521) - implement SG_SET_RESERVED_SIZE and associated memory re-org. - add SG_NEXT_CMD_LEN to override SCSI command lengths @@ -144,9 +150,10 @@ int scsi_id; /* scsi id of target device */ int lun; int scsi_type; /* TYPE_... defined in scsi/scsi.h */ + short h_cmd_per_lun;/* host (adapter) maximum commands per lun */ + short d_queue_depth;/* device (or adapter) maximum queue length */ int unused1; /* probably find a good use, set 0 for now */ int unused2; /* ditto */ - int unused3; } Sg_scsi_id; /* IOCTLs: ( _GET_s yield result via 'int *' 3rd argument unless @@ -204,6 +211,10 @@ #define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ #define SG_NEXT_CMD_LEN 0x2283 /* override SCSI command length with given number on the next write() on this file descriptor */ + +/* Returns -EBUSY if occupied else takes as input: 0 -> do nothing, + 1 -> device reset or 2 -> bus reset (may not be activated yet) */ +#define SG_SCSI_RESET 0x2284 #define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/init/main.c linux.ac/init/main.c --- linux.vanilla/init/main.c Tue Sep 7 22:07:13 1999 +++ linux.ac/init/main.c Wed Sep 15 23:57:59 1999 @@ -84,7 +84,7 @@ extern void sysctl_init(void); extern void filescache_init(void); extern void signals_init(void); -extern int pcmcia_init(void); +extern int init_pcmcia_ds(void); extern void free_initmem(void); extern void filesystem_setup(void); @@ -659,7 +659,7 @@ irda_device_init(); /* Must be done after protocol initialization */ #endif #ifdef CONFIG_PCMCIA - pcmcia_init(); /* Do this last */ + init_pcmcia_ds(); /* Do this last */ #endif /* Mount the root filesystem.. */ mount_root(); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/exit.c linux.ac/kernel/exit.c --- linux.vanilla/kernel/exit.c Thu Aug 26 14:42:20 1999 +++ linux.ac/kernel/exit.c Thu Sep 16 16:58:25 1999 @@ -288,7 +288,7 @@ */ static void exit_notify(void) { - struct task_struct * p; + struct task_struct * p, *t; forget_original_parent(current); /* @@ -300,15 +300,30 @@ * and we were the only connection outside, so our pgrp * is about to become orphaned. */ - if ((current->p_pptr->pgrp != current->pgrp) && - (current->p_pptr->session == current->session) && + + t = current->p_pptr; + + if ((t->pgrp != current->pgrp) && + (t->session == current->session) && will_become_orphaned_pgrp(current->pgrp, current) && has_stopped_jobs(current->pgrp)) { kill_pg(current->pgrp,SIGHUP,1); kill_pg(current->pgrp,SIGCONT,1); } - /* Let father know we died */ + /* Let father know we died + * + * Thread signals are configurable, but you aren't going to use + * that to send signals to arbitary processes. + * That stops right now. + */ + + if(current->exit_signal != SIGCHLD && + (current->euid ^ t->suid) && (current->euid ^ t->uid) + && (current->uid ^ t->suid) && (current->uid ^ t->uid) + && !capable(CAP_KILL)) + current->exit_signal = SIGCHLD; + notify_parent(current, current->exit_signal); /* diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/fork.c linux.ac/kernel/fork.c --- linux.vanilla/kernel/fork.c Tue Aug 17 17:27:43 1999 +++ linux.ac/kernel/fork.c Tue Sep 14 21:33:27 1999 @@ -592,6 +592,13 @@ struct task_struct *p; DECLARE_MUTEX_LOCKED(sem); + if(clone_flags & CLONE_PID) + { + /* This is only allowed from the boot up thread */ + if(current->pid) + return -EPERM; + } + current->vfork_sem = &sem; p = alloc_task_struct(); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/ksyms.c linux.ac/kernel/ksyms.c --- linux.vanilla/kernel/ksyms.c Tue Sep 7 22:07:13 1999 +++ linux.ac/kernel/ksyms.c Sat Sep 11 19:39:06 1999 @@ -201,7 +201,17 @@ EXPORT_SYMBOL(add_to_page_cache_unique); EXPORT_SYMBOL(__find_get_page); EXPORT_SYMBOL(__find_lock_page); - + +/* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */ +EXPORT_SYMBOL(___wait_on_page); +EXPORT_SYMBOL(add_to_page_cache); +EXPORT_SYMBOL(default_llseek); +EXPORT_SYMBOL(filemap_nopage); +EXPORT_SYMBOL(filemap_swapout); +EXPORT_SYMBOL(filemap_sync); +EXPORT_SYMBOL(remove_inode_page); +EXPORT_SYMBOL(swap_free); + #if !defined(CONFIG_NFSD) && defined(CONFIG_NFSD_MODULE) EXPORT_SYMBOL(do_nfsservctl); #endif @@ -364,6 +374,7 @@ EXPORT_SYMBOL(get_random_bytes); EXPORT_SYMBOL(securebits); EXPORT_SYMBOL(cap_bset); +EXPORT_SYMBOL(daemonize); /* Program loader interfaces */ EXPORT_SYMBOL(setup_arg_pages); @@ -423,3 +434,6 @@ /* library functions */ EXPORT_SYMBOL(strnicmp); + +/* init task, for moving kthread roots - ought to export a function ?? */ +EXPORT_SYMBOL(init_task_union); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/ptrace.c linux.ac/kernel/ptrace.c --- linux.vanilla/kernel/ptrace.c Thu Sep 2 00:48:48 1999 +++ linux.ac/kernel/ptrace.c Thu Sep 16 00:06:42 1999 @@ -89,7 +89,7 @@ copied = 0; for (;;) { unsigned long offset = addr & ~PAGE_MASK; - int this_len = PAGE_SIZE - offset; + size_t this_len = PAGE_SIZE - offset; int retval; if (this_len > len) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/sched.c linux.ac/kernel/sched.c --- linux.vanilla/kernel/sched.c Thu Aug 26 14:42:20 1999 +++ linux.ac/kernel/sched.c Thu Sep 16 00:07:27 1999 @@ -1181,7 +1181,7 @@ static inline void do_process_times(struct task_struct *p, unsigned long user, unsigned long system) { - long psecs; + unsigned long psecs; psecs = (p->times.tms_utime += user); psecs += (p->times.tms_stime += system); @@ -1806,6 +1806,35 @@ for_each_task(p) show_task(p); read_unlock(&tasklist_lock); +} + +/* + * Put all the gunge required to become a kernel thread without + * attached user resources in one place where it belongs. + */ + +void daemonize(void) +{ + struct fs_struct *fs; + + + /* + * If we were started as result of loading a module, close all of the + * user space pages. We don't need them, and if we didn't close them + * they would be locked into memory. + */ + exit_mm(current); + + current->session = 1; + current->pgrp = 1; + + /* Become as one with the init task */ + + exit_fs(current); /* current->fs->count--; */ + fs = init_task.fs; + current->fs = fs; + atomic_inc(&fs->count); + } void __init init_idle(void) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/signal.c linux.ac/kernel/signal.c --- linux.vanilla/kernel/signal.c Thu Aug 26 14:42:20 1999 +++ linux.ac/kernel/signal.c Wed Sep 15 23:56:18 1999 @@ -353,13 +353,9 @@ break; } } else { - /* If this was sent by a rt mechanism, try again. */ - if (info->si_code < 0) { - ret = -EAGAIN; - goto out; - } - /* Otherwise, mention that the signal is pending, - but don't queue the info. */ + /* Queue overflow, we have to abort. */ + ret = -EAGAIN; + goto out; } } @@ -792,6 +788,8 @@ { struct siginfo info; + memset(&info, 0, sizeof(info)); + info.si_signo = sig; info.si_errno = 0; info.si_code = SI_USER; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/sys.c linux.ac/kernel/sys.c --- linux.vanilla/kernel/sys.c Tue Sep 7 22:07:13 1999 +++ linux.ac/kernel/sys.c Tue Sep 7 23:43:18 1999 @@ -997,6 +997,17 @@ case PR_GET_PDEATHSIG: error = put_user(current->pdeath_signal, (int *)arg2); break; + case PR_GET_DUMPABLE: + if (current->dumpable) + error = 1; + break; + case PR_SET_DUMPABLE: + if (arg2 != 0 && arg2 != 1) { + error = -EINVAL; + break; + } + current->dumpable = arg2; + break; default: error = -EINVAL; break; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/kernel/sysctl.c linux.ac/kernel/sysctl.c --- linux.vanilla/kernel/sysctl.c Thu Sep 2 00:48:48 1999 +++ linux.ac/kernel/sysctl.c Thu Sep 16 00:10:25 1999 @@ -635,7 +635,7 @@ int proc_dostring(ctl_table *table, int write, struct file *filp, void *buffer, size_t *lenp) { - int len; + size_t len; char *p, c; if (!table->data || !table->maxlen || !*lenp || @@ -1185,7 +1185,7 @@ void *newval, size_t newlen, void **context) { if (oldval) { - size_t olen; + int olen; if (oldlenp) { if (get_user(olen, oldlenp)) return -EFAULT; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/lib/Makefile linux.ac/lib/Makefile --- linux.vanilla/lib/Makefile Mon Nov 27 13:54:00 1995 +++ linux.ac/lib/Makefile Mon Sep 13 00:04:31 1999 @@ -7,6 +7,6 @@ # L_TARGET := lib.a -L_OBJS := errno.o ctype.o string.o vsprintf.o +L_OBJS := errno.o ctype.o string.o vsprintf.o parse.o include $(TOPDIR)/Rules.make diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/lib/parse.c linux.ac/lib/parse.c --- linux.vanilla/lib/parse.c Thu Jan 1 01:00:00 1970 +++ linux.ac/lib/parse.c Mon Sep 13 01:57:36 1999 @@ -0,0 +1,119 @@ +/* + * linux/lib/parse.c + * + * (C) Richard Guenther + * + * Heavily based on parts of modutil's insmod.c which is + * + * Copyright 1996, 1997 Linux International. + * + * New implementation contributed by Richard Henderson + * Based on original work by Bjorn Eckwall + * + * This file is part of the Linux modutils. + * + * 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. + * + * Fixes: + * Alan Cox Make it get non arrays right. + */ + +#include +#include +#include + +/* parse module parameters like insmod */ +int parse_parameters(void *var, char *type, char *str) +{ + char *p, t; + long min, max, val, cnt; + int array = 0; + + p = type; + if (isdigit(*p)) { + min = simple_strtoul(p, &p, 0); + if (*p == '-') + { + max = simple_strtoul(p+1, &p, 0); + array=1; + } + else + max = min; + } else + min = max = 1; + t = *p; + + /* + * We are passed a pointer to the object. Now the object + * could be an array, in which case we have a pointer to + * a pointer. It might be a direct value in which case + * we have a pointer the value to write. + * + * For an array we want to the array base, for a non array + * pass, we want the value + * + * Alan. + */ + + if(array) + var=*(void **)var; + + p = str; + cnt = 0; + do { + if (*p == ',') { + p++; + cnt++; + continue; + } + switch (t) { + case 'b': + val = simple_strtol(p, &p, 0); + ((char *)var)[cnt] = (char)val; + break; + case 'h': + val = simple_strtol(p, &p, 0); + ((short *)var)[cnt] = (short)val; + break; + case 'i': + val = simple_strtol(p, &p, 0); + ((int *)var)[cnt] = (int)val; + break; + case 'l': + val = simple_strtol(p, &p, 0); + ((long *)var)[cnt] = (long)val; + break; + case 's': + /* complex quoting is not possible, as parse_options() + * just searches for ' ', so we can safely just leech + * the whole string (multiple strings are impossible, too) + * - where do we check for overflows?? */ + strcpy((char *)(var), p); + break; + default: + printk(KERN_INFO "error in parsing arguments \"%s\" using format %s\n", str, type); + return 0; + } + if (*p == ',') + p++; + cnt++; + } while (*p && cnt < max); + + return 1; +} + + + + diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/mm/filemap.c linux.ac/mm/filemap.c --- linux.vanilla/mm/filemap.c Tue Sep 7 22:07:13 1999 +++ linux.ac/mm/filemap.c Thu Sep 16 16:28:32 1999 @@ -530,7 +530,7 @@ * This adds the requested page to the page cache if it isn't already there, * and schedules an I/O to read in its contents from disk. */ -static inline void page_cache_read(struct file * file, unsigned long offset) +static inline int page_cache_read(struct file * file, unsigned long offset) { unsigned long new_page; struct inode *inode = file->f_dentry->d_inode; @@ -541,17 +541,20 @@ page = __find_page_nolock(inode, offset, *hash); spin_unlock(&pagecache_lock); if (page) - return; + return 0; new_page = page_cache_alloc(); if (!new_page) - return; + return -ENOMEM; page = page_cache_entry(new_page); if (!add_to_page_cache_unique(page, inode, offset, hash)) { - inode->i_op->readpage(file, page); + int error; + + error = inode->i_op->readpage(file, page); + page_cache_release(page); - return; + return error; } /* @@ -559,26 +562,34 @@ * raced with us and added our page to the cache first. */ page_cache_free(new_page); - return; + return 0; } /* * Read in an entire cluster at once. A cluster is usually a 64k- * aligned block that includes the address requested in "offset." */ -static void read_cluster_nonblocking(struct file * file, +static int read_cluster_nonblocking(struct file * file, unsigned long offset) { + int error = 0; off_t filesize = file->f_dentry->d_inode->i_size; + unsigned long pg_offset = CLUSTER_OFFSET(offset); unsigned long pages = CLUSTER_PAGES; - offset = CLUSTER_OFFSET(offset); - while ((pages-- > 0) && (offset < filesize)) { - page_cache_read(file, offset); - offset += PAGE_CACHE_SIZE; + while ((pages-- > 0) && (pg_offset < filesize)) { + error = page_cache_read(file, pg_offset); + if (!error) { + pg_offset += PAGE_CACHE_SIZE; + continue; + } + + if (pg_offset > offset) + error = 0; + break; } - return; + return error; } /* @@ -1292,13 +1303,12 @@ * The goto's are kind of ugly, but this streamlines the normal case of having * it in the page cache, and handles the special cases reasonably without * having a lot of duplicated code. - * - * XXX - at some point, this should return unique values to indicate to - * the caller whether this is EIO, OOM, or SIGBUS. */ -static unsigned long filemap_nopage(struct vm_area_struct * area, + +unsigned long filemap_nopage(struct vm_area_struct * area, unsigned long address, int no_share) { + int error; struct file * file = area->vm_file; struct dentry * dentry = file->f_dentry; struct inode * inode = dentry->d_inode; @@ -1345,7 +1355,9 @@ if (new_page) { copy_page(new_page, old_page); flush_page_to_ram(new_page); - } + } else + new_page = -1; + page_cache_release(page); return new_page; } @@ -1362,16 +1374,26 @@ * so we need to map a zero page. */ if (offset < inode->i_size) - read_cluster_nonblocking(file, offset); + error = read_cluster_nonblocking(file, offset); else - page_cache_read(file, offset); + error = page_cache_read(file, offset); /* * The page we want has now been added to the page cache. * In the unlikely event that someone removed it in the * meantime, we'll just come back here and read it again. */ - goto retry_find; + if (!error) + goto retry_find; + + /* + * An error return from page_cache_read can result if the + * system is low on memory, or a problem occurs while trying + * to schedule I/O. + */ + if (error == -ENOMEM) + return -1; + return 0; page_not_uptodate: lock_page(page); @@ -1584,7 +1606,7 @@ return error; } -static int filemap_sync(struct vm_area_struct * vma, unsigned long address, +int filemap_sync(struct vm_area_struct * vma, unsigned long address, size_t size, unsigned int flags) { pgd_t * dir; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/mm/mlock.c linux.ac/mm/mlock.c --- linux.vanilla/mm/mlock.c Thu Aug 26 14:42:20 1999 +++ linux.ac/mm/mlock.c Thu Sep 2 16:51:05 1999 @@ -186,11 +186,13 @@ locked += current->mm->locked_vm; lock_limit = current->rlim[RLIMIT_MEMLOCK].rlim_cur; - lock_limit >>= PAGE_SHIFT; + if (lock_limit < RLIM_INFINITY) { + lock_limit >>= PAGE_SHIFT; - /* check against resource limits */ - if (locked > lock_limit) - goto out; + /* check against resource limits */ + if (locked > lock_limit) + goto out; + } /* we may lock at most half of physical memory... */ /* (this check is pretty bogus, but doesn't hurt) */ @@ -253,12 +255,14 @@ if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE))) goto out; + ret = -ENOMEM; lock_limit = current->rlim[RLIMIT_MEMLOCK].rlim_cur; - lock_limit >>= PAGE_SHIFT; + if (lock_limit < RLIM_INFINITY) { + lock_limit >>= PAGE_SHIFT; - ret = -ENOMEM; - if (current->mm->total_vm > lock_limit) - goto out; + if (current->mm->total_vm > lock_limit) + goto out; + } /* we may lock at most half of physical memory... */ /* (this check is pretty bogus, but doesn't hurt) */ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/mm/mremap.c linux.ac/mm/mremap.c --- linux.vanilla/mm/mremap.c Thu Aug 5 20:21:52 1999 +++ linux.ac/mm/mremap.c Thu Sep 2 16:51:05 1999 @@ -198,12 +198,14 @@ unsigned long locked = current->mm->locked_vm << PAGE_SHIFT; locked += new_len - old_len; ret = -EAGAIN; - if (locked > current->rlim[RLIMIT_MEMLOCK].rlim_cur) + if ((current->rlim[RLIMIT_MEMLOCK].rlim_cur < RLIM_INFINITY) && + (locked > current->rlim[RLIMIT_MEMLOCK].rlim_cur)) goto out; } ret = -ENOMEM; - if ((current->mm->total_vm << PAGE_SHIFT) + (new_len - old_len) - > current->rlim[RLIMIT_AS].rlim_cur) + if ((current->rlim[RLIMIT_AS].rlim_cur < RLIM_INFINITY) && + ((current->mm->total_vm << PAGE_SHIFT) + (new_len - old_len) + > current->rlim[RLIMIT_AS].rlim_cur)) goto out; /* Private writable mapping? Check memory availability.. */ if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE && diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/mm/page_io.c linux.ac/mm/page_io.c --- linux.vanilla/mm/page_io.c Thu Sep 2 00:48:48 1999 +++ linux.ac/mm/page_io.c Thu Sep 2 16:51:05 1999 @@ -118,7 +118,7 @@ } /* block_size == PAGE_SIZE/zones_used */ - brw_page(rw, page, dev, zones, block_size, 0); + brw_page(rw, page, dev, zones, block_size); /* Note! For consistency we do all of the logic, * decrementing the page count, and unlocking the page in the diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/mm/swap_state.c linux.ac/mm/swap_state.c --- linux.vanilla/mm/swap_state.c Thu Sep 2 00:48:48 1999 +++ linux.ac/mm/swap_state.c Sat Sep 18 19:28:22 1999 @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -234,7 +235,9 @@ page_address(page), page_count(page), entry); #endif remove_from_swap_cache (page); + lock_kernel(); swap_free (entry); + unlock_kernel(); } static void delete_from_swap_cache_nolock(struct page *page) diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/Config.in linux.ac/net/Config.in --- linux.vanilla/net/Config.in Sat Sep 11 00:54:17 1999 +++ linux.ac/net/Config.in Mon Sep 13 00:22:42 1999 @@ -5,85 +5,84 @@ comment 'Networking options' tristate 'Packet socket' CONFIG_PACKET if [ "$CONFIG_PACKET" != "n" ]; then - bool 'Packet socket: mmapped IO' CONFIG_PACKET_MMAP + bool ' Packet socket: mmapped IO' CONFIG_PACKET_MMAP fi bool 'Kernel/User netlink socket' CONFIG_NETLINK if [ "$CONFIG_NETLINK" = "y" ]; then - bool 'Routing messages' CONFIG_RTNETLINK - tristate 'Netlink device emulation' CONFIG_NETLINK_DEV + bool ' Routing messages' CONFIG_RTNETLINK + tristate ' Netlink device emulation' CONFIG_NETLINK_DEV fi bool 'Network packet filtering (replaces ipchains)' CONFIG_NETFILTER if [ "$CONFIG_NETFILTER" = "y" ]; then - bool 'Network packet filtering debugging' CONFIG_NETFILTER_DEBUG + bool ' Network packet filtering debugging' CONFIG_NETFILTER_DEBUG fi bool 'Socket Filtering' CONFIG_FILTER tristate 'Unix domain sockets' CONFIG_UNIX bool 'TCP/IP networking' CONFIG_INET if [ "$CONFIG_INET" = "y" ]; then - source net/ipv4/Config.in - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then -# Sorry, but IPv6 as module is still invalid. - tristate 'The IPv6 protocol (EXPERIMENTAL)' CONFIG_IPV6 -# bool 'The IPv6 protocol (EXPERIMENTAL)' CONFIG_IPV6 - if [ "$CONFIG_IPV6" != "n" ]; then - source net/ipv6/Config.in - fi - fi - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - source net/khttpd/Config.in - fi + source net/ipv4/Config.in + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then +# IPv6 as module will cause a CRASH if you try to unload it + tristate ' The IPv6 protocol (EXPERIMENTAL)' CONFIG_IPV6 + if [ "$CONFIG_IPV6" != "n" ]; then + source net/ipv6/Config.in + fi + fi + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + source net/khttpd/Config.in + fi fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - bool 'Asynchronous Transfer Mode (ATM, EXPERIMENTAL)' CONFIG_ATM y - if [ "$CONFIG_ATM" = "y" ]; then - if [ "$CONFIG_INET" = "y" ]; then - bool ' Classical IP over ATM' CONFIG_ATM_CLIP y - if [ "$CONFIG_ATM_CLIP" = "y" ]; then - bool ' Do NOT send ICMP if no neighbour' CONFIG_ATM_CLIP_NO_ICMP n + bool 'Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)' CONFIG_ATM y + if [ "$CONFIG_ATM" = "y" ]; then + if [ "$CONFIG_INET" = "y" ]; then + bool ' Classical IP over ATM' CONFIG_ATM_CLIP y + if [ "$CONFIG_ATM_CLIP" = "y" ]; then + bool ' Do NOT send ICMP if no neighbour' CONFIG_ATM_CLIP_NO_ICMP n + fi + fi + tristate ' LAN Emulation (LANE) support' CONFIG_ATM_LANE y + if [ "$CONFIG_INET" = "y" -a "$CONFIG_ATM_LANE" != "n" ]; then + tristate ' Multi-Protocol Over ATM (MPOA) support' CONFIG_ATM_MPOA y fi - fi - tristate ' LAN Emulation (LANE) support' CONFIG_ATM_LANE y - if [ "$CONFIG_INET" = "y" -a "$CONFIG_ATM_LANE" != "n" ]; then - tristate ' Multi-Protocol Over ATM (MPOA) support' CONFIG_ATM_MPOA y - fi - fi + fi fi comment ' ' tristate 'The IPX protocol' CONFIG_IPX if [ "$CONFIG_IPX" != "n" ]; then - source net/ipx/Config.in + source net/ipx/Config.in fi tristate 'Appletalk DDP' CONFIG_ATALK if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'DECnet Support (EXPERIMENTAL)' CONFIG_DECNET - if [ "$CONFIG_DECNET" != "n" ]; then - source net/decnet/Config.in - fi - tristate 'CCITT X.25 Packet Layer (EXPERIMENTAL)' CONFIG_X25 - tristate 'LAPB Data Link Driver (EXPERIMENTAL)' CONFIG_LAPB - bool 'Bridging (EXPERIMENTAL)' CONFIG_BRIDGE - bool '802.2 LLC (EXPERIMENTAL)' CONFIG_LLC -# if [ "$CONFIG_LLC" = "y" ]; then -# bool 'Netbeui (EXPERIMENTAL)' CONFIG_NETBEUI -# fi - tristate 'Acorn Econet/AUN protocols (EXPERIMENTAL)' CONFIG_ECONET - if [ "$CONFIG_ECONET" != "n" ]; then - bool ' AUN over UDP' CONFIG_ECONET_AUNUDP - bool ' Native Econet' CONFIG_ECONET_NATIVE - fi - tristate 'WAN router' CONFIG_WAN_ROUTER - bool 'Fast switching (read help!)' CONFIG_NET_FASTROUTE - bool 'Forwarding between high speed interfaces' CONFIG_NET_HW_FLOWCONTROL - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - mainmenu_option next_comment - comment 'QoS and/or fair queueing' - bool 'QoS and/or fair queueing' CONFIG_NET_SCHED - if [ "$CONFIG_NET_SCHED" = "y" ]; then - source net/sched/Config.in - fi -# bool 'Network code profiler' CONFIG_NET_PROFILE - endmenu - fi + tristate 'DECnet Support (EXPERIMENTAL)' CONFIG_DECNET + if [ "$CONFIG_DECNET" != "n" ]; then + source net/decnet/Config.in + fi + tristate 'CCITT X.25 Packet Layer (EXPERIMENTAL)' CONFIG_X25 + tristate 'LAPB Data Link Driver (EXPERIMENTAL)' CONFIG_LAPB + bool 'Bridging (EXPERIMENTAL)' CONFIG_BRIDGE + bool '802.2 LLC (EXPERIMENTAL)' CONFIG_LLC +# if [ "$CONFIG_LLC" = "y" ]; then +# bool ' Netbeui (EXPERIMENTAL)' CONFIG_NETBEUI +# fi + tristate 'Acorn Econet/AUN protocols (EXPERIMENTAL)' CONFIG_ECONET + if [ "$CONFIG_ECONET" != "n" ]; then + bool ' AUN over UDP' CONFIG_ECONET_AUNUDP + bool ' Native Econet' CONFIG_ECONET_NATIVE + fi + tristate 'WAN router' CONFIG_WAN_ROUTER + bool 'Fast switching (read help!)' CONFIG_NET_FASTROUTE + bool 'Forwarding between high speed interfaces' CONFIG_NET_HW_FLOWCONTROL + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + mainmenu_option next_comment + comment 'QoS and/or fair queueing' + bool 'QoS and/or fair queueing (EXPERIMENTAL)' CONFIG_NET_SCHED + if [ "$CONFIG_NET_SCHED" = "y" ]; then + source net/sched/Config.in + fi +# bool 'Network code profiler' CONFIG_NET_PROFILE + endmenu + fi fi endmenu diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ax25/Config.in linux.ac/net/ax25/Config.in --- linux.vanilla/net/ax25/Config.in Tue Aug 17 17:27:43 1999 +++ linux.ac/net/ax25/Config.in Mon Sep 13 00:22:42 1999 @@ -10,21 +10,26 @@ comment 'Amateur Radio support' bool 'Amateur Radio support' CONFIG_HAMRADIO -if [ "$CONFIG_HAMRADIO" != "n" ] ; then - if [ "$CONFIG_NET" != "n" ] ; then - comment 'Packet Radio protocols' - tristate 'Amateur Radio AX.25 Level 2 protocol' CONFIG_AX25 - if [ "$CONFIG_AX25" != "n" ]; then - bool ' AX.25 DAMA Slave support' CONFIG_AX25_DAMA_SLAVE -# bool ' AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER - dep_tristate ' Amateur Radio NET/ROM protocol' CONFIG_NETROM $CONFIG_AX25 - dep_tristate ' Amateur Radio X.25 PLP (Rose)' CONFIG_ROSE $CONFIG_AX25 - fi +if [ "$CONFIG_HAMRADIO" != "n" ]; then + if [ "$CONFIG_NET" != "n" ]; then + comment 'Packet Radio protocols' + tristate ' Amateur Radio AX.25 Level 2 protocol' CONFIG_AX25 + if [ "$CONFIG_AX25" != "n" ]; then + bool ' AX.25 DAMA Slave support' CONFIG_AX25_DAMA_SLAVE +# bool ' AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER + dep_tristate ' Amateur Radio NET/ROM protocol' CONFIG_NETROM $CONFIG_AX25 + dep_tristate ' Amateur Radio X.25 PLP (Rose)' CONFIG_ROSE $CONFIG_AX25 + fi - if [ "$CONFIG_AX25" != "n" ]; then - source drivers/net/hamradio/Config.in - fi - fi + if [ "$CONFIG_AX25" != "n" ]; then + mainmenu_option next_comment + comment 'AX.25 network device drivers' + + source drivers/net/hamradio/Config.in + + endmenu + fi + fi fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/core/datagram.c linux.ac/net/core/datagram.c --- linux.vanilla/net/core/datagram.c Thu Sep 2 00:48:49 1999 +++ linux.ac/net/core/datagram.c Thu Sep 16 00:13:33 1999 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/core/dev.c linux.ac/net/core/dev.c --- linux.vanilla/net/core/dev.c Thu Sep 2 00:48:49 1999 +++ linux.ac/net/core/dev.c Mon Sep 13 00:00:36 1999 @@ -1327,7 +1327,7 @@ stats->qual.level, stats->qual.updated & 2 ? '.' : ' ', stats->qual.noise, - stats->qual.updated & 3 ? '.' : ' ', + stats->qual.updated & 4 ? '.' : ' ', stats->discard.nwid, stats->discard.code, stats->discard.misc); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/core/sock.c linux.ac/net/core/sock.c --- linux.vanilla/net/core/sock.c Sat Sep 11 00:54:18 1999 +++ linux.ac/net/core/sock.c Fri Sep 10 17:56:44 1999 @@ -1013,7 +1013,7 @@ read_lock(&sk->callback_lock); if (!sk->dead) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket,0); + sock_wake_async(sk->socket,0,POLL_ERR); } read_unlock(&sk->callback_lock); } @@ -1023,7 +1023,7 @@ read_lock(&sk->callback_lock); if(!sk->dead) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket,1); + sock_wake_async(sk->socket,1,POLL_IN); } read_unlock(&sk->callback_lock); } @@ -1041,7 +1041,7 @@ /* Should agree with poll, otherwise some programs break */ if (sock_writeable(sk)) - sock_wake_async(sk->socket, 2); + sock_wake_async(sk->socket, 2, POLL_OUT); } read_unlock(&sk->callback_lock); } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/decnet/Config.in linux.ac/net/decnet/Config.in --- linux.vanilla/net/decnet/Config.in Thu Aug 26 14:42:27 1999 +++ linux.ac/net/decnet/Config.in Mon Sep 13 00:22:42 1999 @@ -1,6 +1,8 @@ # # DECnet configuration # -bool 'DECnet: SIOCGIFCONF support' CONFIG_DECNET_SIOCGIFCONF -bool 'DECnet: router support (VERY VERY EXPERIMENTAL)' CONFIG_DECNET_ROUTER -bool 'DECnet: raw socket support' CONFIG_DECNET_RAW +bool ' DECnet: SIOCGIFCONF support' CONFIG_DECNET_SIOCGIFCONF +if [ "$CONFIG_EXPERIMENTAL" ]; then + bool ' DECnet: router support (EXPERIMENTAL)' CONFIG_DECNET_ROUTER +fi +bool ' DECnet: raw socket support' CONFIG_DECNET_RAW diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/decnet/dn_nsp_in.c linux.ac/net/decnet/dn_nsp_in.c --- linux.vanilla/net/decnet/dn_nsp_in.c Thu Sep 2 00:48:49 1999 +++ linux.ac/net/decnet/dn_nsp_in.c Wed Sep 15 23:56:18 1999 @@ -431,7 +431,8 @@ struct socket *sock = sk->socket; wake_up_interruptible(sk->sleep); if (!(sock->flags & SO_WAITDATA) && sock->fasync_list) - kill_fasync(sock->fasync_list, sig); + kill_fasync(sock->fasync_list, sig, + (sig == SIGURG) ? POLL_PRI : POLL_IN); } read_unlock_irqrestore(&sk->callback_lock, flags); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/Config.in linux.ac/net/ipv4/Config.in --- linux.vanilla/net/ipv4/Config.in Thu Aug 26 14:42:27 1999 +++ linux.ac/net/ipv4/Config.in Thu Sep 16 16:25:26 1999 @@ -1,56 +1,55 @@ # # IP configuration # -bool 'IP: multicasting' CONFIG_IP_MULTICAST -bool 'IP: advanced router' CONFIG_IP_ADVANCED_ROUTER +bool ' IP: multicasting' CONFIG_IP_MULTICAST +bool ' IP: advanced router' CONFIG_IP_ADVANCED_ROUTER if [ "$CONFIG_IP_ADVANCED_ROUTER" = "y" ]; then - define_bool CONFIG_RTNETLINK y - define_bool CONFIG_NETLINK y - bool 'IP: policy routing' CONFIG_IP_MULTIPLE_TABLES - bool 'IP: equal cost multipath' CONFIG_IP_ROUTE_MULTIPATH - bool 'IP: use TOS value as routing key' CONFIG_IP_ROUTE_TOS - bool 'IP: verbose route monitoring' CONFIG_IP_ROUTE_VERBOSE - bool 'IP: large routing tables' CONFIG_IP_ROUTE_LARGE_TABLES - if [ "$CONFIG_IP_MULTIPLE_TABLES" = "y" ]; then - bool 'IP: fast network address translation' CONFIG_IP_ROUTE_NAT - fi + define_bool CONFIG_RTNETLINK y + define_bool CONFIG_NETLINK y + bool ' IP: policy routing' CONFIG_IP_MULTIPLE_TABLES + if [ "$CONFIG_IP_MULTIPLE_TABLES" = "y" ]; then + bool ' IP: use FWMARK value as routing key' CONFIG_IP_ROUTE_FWMARK + fi + bool ' IP: equal cost multipath' CONFIG_IP_ROUTE_MULTIPATH + bool ' IP: use TOS value as routing key' CONFIG_IP_ROUTE_TOS + bool ' IP: verbose route monitoring' CONFIG_IP_ROUTE_VERBOSE + bool ' IP: large routing tables' CONFIG_IP_ROUTE_LARGE_TABLES + if [ "$CONFIG_IP_MULTIPLE_TABLES" = "y" ]; then + bool ' IP: fast network address translation' CONFIG_IP_ROUTE_NAT + fi fi -if [ "$CONFIG_IP_MULTIPLE_TABLES" = "y" ]; then - bool 'IP: use FWMARK value as routing key' CONFIG_IP_ROUTE_FWMARK -fi -bool 'IP: kernel level autoconfiguration' CONFIG_IP_PNP +bool ' IP: kernel level autoconfiguration' CONFIG_IP_PNP if [ "$CONFIG_IP_PNP" = "y" ]; then - bool ' BOOTP support' CONFIG_IP_PNP_BOOTP - bool ' RARP support' CONFIG_IP_PNP_RARP + bool ' BOOTP support' CONFIG_IP_PNP_BOOTP + bool ' RARP support' CONFIG_IP_PNP_RARP # not yet ready.. -# bool ' ARP support' CONFIG_IP_PNP_ARP +# bool ' ARP support' CONFIG_IP_PNP_ARP fi -bool 'IP: optimize as router not host' CONFIG_IP_ROUTER -tristate 'IP: tunneling' CONFIG_NET_IPIP -tristate 'IP: GRE tunnels over IP' CONFIG_NET_IPGRE +bool ' IP: optimize as router not host' CONFIG_IP_ROUTER +tristate ' IP: tunneling' CONFIG_NET_IPIP +tristate ' IP: GRE tunnels over IP' CONFIG_NET_IPGRE if [ "$CONFIG_IP_MULTICAST" = "y" ]; then - if [ "$CONFIG_NET_IPGRE" != "n" ]; then - bool 'IP: broadcast GRE over IP' CONFIG_NET_IPGRE_BROADCAST - fi - bool 'IP: multicast routing' CONFIG_IP_MROUTE - if [ "$CONFIG_IP_MROUTE" = "y" ]; then - bool 'IP: PIM-SM version 1 support' CONFIG_IP_PIMSM_V1 - bool 'IP: PIM-SM version 2 support' CONFIG_IP_PIMSM_V2 - fi + if [ "$CONFIG_NET_IPGRE" != "n" ]; then + bool ' IP: broadcast GRE over IP' CONFIG_NET_IPGRE_BROADCAST + fi + bool ' IP: multicast routing' CONFIG_IP_MROUTE + if [ "$CONFIG_IP_MROUTE" = "y" ]; then + bool ' IP: PIM-SM version 1 support' CONFIG_IP_PIMSM_V1 + bool ' IP: PIM-SM version 2 support' CONFIG_IP_PIMSM_V2 + fi fi -bool 'IP: aliasing support' CONFIG_IP_ALIAS +bool ' IP: aliasing support' CONFIG_IP_ALIAS if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - if [ "$CONFIG_RTNETLINK" = "y" ]; then - bool 'IP: ARP daemon support (EXPERIMENTAL)' CONFIG_ARPD - fi + if [ "$CONFIG_RTNETLINK" = "y" ]; then + bool ' IP: ARP daemon support (EXPERIMENTAL)' CONFIG_ARPD + fi fi -bool 'IP: TCP syncookie support (not enabled per default)' CONFIG_SYN_COOKIES +bool ' IP: TCP syncookie support (disabled per default)' CONFIG_SYN_COOKIES comment '(it is safe to leave these untouched)' -#bool 'IP: PC/TCP compatibility mode' CONFIG_INET_PCTCP -#bool 'IP: Path MTU Discovery (normally enabled)' CONFIG_PATH_MTU_DISCOVERY -#bool 'IP: Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF -bool 'IP: Allow large windows (not recommended if <16Mb of memory)' CONFIG_SKB_LARGE +#bool ' IP: PC/TCP compatibility mode' CONFIG_INET_PCTCP +#bool ' IP: Path MTU Discovery (normally enabled)' CONFIG_PATH_MTU_DISCOVERY +#bool ' IP: Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF +bool ' IP: Allow large windows (not recommended if <16Mb of memory)' CONFIG_SKB_LARGE #if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then -#bool 'IP: support experimental checksum copy to user for UDP' CONFIG_UDP_DELAY_CSUM +# bool ' IP: support checksum copy to user for UDP (EXPERIMENTAL)' CONFIG_UDP_DELAY_CSUM #fi - diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/tcp.c linux.ac/net/ipv4/tcp.c --- linux.vanilla/net/ipv4/tcp.c Sat Sep 11 00:54:18 1999 +++ linux.ac/net/ipv4/tcp.c Fri Sep 10 17:56:45 1999 @@ -626,7 +626,7 @@ wake_up_interruptible(sk->sleep); if (sock_wspace(sk) >= tcp_min_write_space(sk)) - sock_wake_async(sk->socket, 2); + sock_wake_async(sk->socket, 2, POLL_OUT); } read_unlock(&sk->callback_lock); } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/tcp_input.c linux.ac/net/ipv4/tcp_input.c --- linux.vanilla/net/ipv4/tcp_input.c Sat Sep 11 00:54:18 1999 +++ linux.ac/net/ipv4/tcp_input.c Wed Sep 15 23:56:18 1999 @@ -1403,7 +1403,7 @@ if (!sk->dead) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket, 1); + sock_wake_async(sk->socket, 1, POLL_HUP); } switch(sk->state) { @@ -1806,7 +1806,7 @@ */ if (!sk->dead) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket,1); + sock_wake_async(sk->socket,1, POLL_IN); } return(1); } @@ -1965,6 +1965,7 @@ kill_proc(sk->proc, SIGURG, 1); else kill_pg(-sk->proc, SIGURG, 1); + sock_wake_async(sk->socket, 3, POLL_PRI); } /* We may be adding urgent data when the last byte read was @@ -2201,7 +2202,7 @@ * this frame, the pred_flags won't match up. -DaveM */ wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket,1); + sock_wake_async(sk->socket,1, POLL_IN); tcp_delack_estimator(tp); tcp_remember_ack(tp, th, skb); @@ -2760,7 +2761,7 @@ if(!sk->dead) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket, 0); + sock_wake_async(sk->socket, 0, POLL_IN); } return -1; } @@ -3017,7 +3018,7 @@ */ if (!sk->dead && sk->sleep) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket, 1); + sock_wake_async(sk->socket,0,POLL_OUT); } tp->snd_una = TCP_SKB_CB(skb)->ack_seq; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv6/Config.in linux.ac/net/ipv6/Config.in --- linux.vanilla/net/ipv6/Config.in Thu Feb 19 22:46:16 1998 +++ linux.ac/net/ipv6/Config.in Mon Sep 13 00:22:42 1999 @@ -1,14 +1,14 @@ # # IPv6 configuration # -bool 'IPv6: enable EUI-64 token format' CONFIG_IPV6_EUI64 +bool ' IPv6: enable EUI-64 token format' CONFIG_IPV6_EUI64 if [ "$CONFIG_IPV6_EUI64" = "y" ]; then - bool 'IPv6: disable provider based addresses' CONFIG_IPV6_NO_PB + bool ' IPv6: disable provider based addresses' CONFIG_IPV6_NO_PB fi if [ "$CONFIG_NETLINK" = "y" ]; then - if [ "$CONFIG_RTNETLINK" = "n" ]; then - bool 'IPv6: routing messages via old netlink' CONFIG_IPV6_NETLINK - fi + if [ "$CONFIG_RTNETLINK" = "n" ]; then + bool ' IPv6: routing messages via old netlink' CONFIG_IPV6_NETLINK + fi fi -#bool 'IPv6: flow policy support' CONFIG_RT6_POLICY -#bool 'IPv6: firewall support' CONFIG_IPV6_FIREWALL +#bool ' IPv6: flow policy support' CONFIG_RT6_POLICY +#bool ' IPv6: firewall support' CONFIG_IPV6_FIREWALL diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipx/Config.in linux.ac/net/ipx/Config.in --- linux.vanilla/net/ipx/Config.in Sun Apr 12 01:18:16 1998 +++ linux.ac/net/ipx/Config.in Mon Sep 13 00:22:42 1999 @@ -2,7 +2,7 @@ # IPX configuration # -bool 'IPX: Full internal IPX network' CONFIG_IPX_INTERN +bool ' IPX: Full internal IPX network' CONFIG_IPX_INTERN if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - dep_tristate 'IPX: SPX networking (EXPERIMENTAL)' CONFIG_SPX $CONFIG_IPX + dep_tristate ' IPX: SPX networking (EXPERIMENTAL)' CONFIG_SPX $CONFIG_IPX fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/Config.in linux.ac/net/irda/Config.in --- linux.vanilla/net/irda/Config.in Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/Config.in Mon Sep 13 00:22:42 1999 @@ -2,30 +2,30 @@ # IrDA protocol configuration # -if [ "$CONFIG_NET" != "n" ] ; then +if [ "$CONFIG_NET" != "n" ]; then - mainmenu_option next_comment - comment 'IrDA (infrared) support' - dep_tristate 'IrDA subsystem support' CONFIG_IRDA $CONFIG_NET + mainmenu_option next_comment + comment 'IrDA (infrared) support' + dep_tristate 'IrDA subsystem support' CONFIG_IRDA $CONFIG_NET - if [ "$CONFIG_IRDA" != "n" ] ; then - comment 'IrDA protocols' - source net/irda/irlan/Config.in - source net/irda/ircomm/Config.in + if [ "$CONFIG_IRDA" != "n" ]; then + comment 'IrDA protocols' + source net/irda/irlan/Config.in + source net/irda/ircomm/Config.in - bool 'IrDA protocol options' CONFIG_IRDA_OPTIONS - if [ "$CONFIG_IRDA_OPTIONS" != "n" ] ; then - comment ' IrDA options' - bool ' Cache last LSAP' CONFIG_IRDA_CACHE_LAST_LSAP - bool ' Fast RRs' CONFIG_IRDA_FAST_RR - bool ' Debug information' CONFIG_IRDA_DEBUG - fi - fi + bool ' IrDA protocol options' CONFIG_IRDA_OPTIONS + if [ "$CONFIG_IRDA_OPTIONS" != "n" ]; then + comment ' IrDA options' + bool ' Cache last LSAP' CONFIG_IRDA_CACHE_LAST_LSAP + bool ' Fast RRs' CONFIG_IRDA_FAST_RR + bool ' Debug information' CONFIG_IRDA_DEBUG + fi + fi - if [ "$CONFIG_IRDA" != "n" ] ; then - source net/irda/compressors/Config.in - source drivers/net/irda/Config.in - fi - endmenu + if [ "$CONFIG_IRDA" != "n" ]; then + source net/irda/compressors/Config.in + source drivers/net/irda/Config.in + fi + endmenu fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/af_irda.c linux.ac/net/irda/af_irda.c --- linux.vanilla/net/irda/af_irda.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/af_irda.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun May 31 10:12:43 1998 - * Modified at: Mon Aug 23 09:44:37 1999 + * Modified at: Wed Sep 8 09:01:34 1999 * Modified by: Dag Brattli * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. * @@ -47,6 +47,8 @@ extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, struct packet_type *); +static int irda_create(struct socket *sock, int protocol); + static struct proto_ops irda_stream_ops; static struct proto_ops irda_dgram_ops; static hashbin_t *cachelog = NULL; @@ -66,8 +68,6 @@ struct sock *sk; int err; - DEBUG(1, __FUNCTION__ "()\n"); - self = (struct irda_sock *) instance; ASSERT(self != NULL, return -1;); @@ -428,8 +428,6 @@ { struct sock *sk = sock->sk; - DEBUG(1, __FUNCTION__ "()\n"); - if (sk->type == SOCK_STREAM && sk->state != TCP_LISTEN) { sk->max_ack_backlog = backlog; sk->state = TCP_LISTEN; @@ -1171,8 +1169,7 @@ case SIOCSIFNETMASK: case SIOCGIFMETRIC: case SIOCSIFMETRIC: - return -EINVAL; - + return -EINVAL; default: DEBUG(1, __FUNCTION__ "(), doing device ioctl!\n"); return dev_ioctl(cmd, (void *) arg); @@ -1212,7 +1209,7 @@ DEBUG(0, __FUNCTION__ "(), sorry not impl. yet!\n"); return 0; case IRTTP_MAX_SDU_SIZE: - DEBUG(0, __FUNCTION__ "(), setting max_sdu_size = %d\n", opt); + DEBUG(2, __FUNCTION__ "(), setting max_sdu_size = %d\n", opt); self->max_sdu_size_rx = opt; break; default: @@ -1290,7 +1287,7 @@ len = sizeof(struct irda_device_list) + sizeof(struct irda_device_info) * i; - DEBUG(1, __FUNCTION__ "(), len=%d, i=%d\n", len, i); + DEBUG(2, __FUNCTION__ "(), len=%d, i=%d\n", len, i); if (put_user(len, optlen)) return -EFAULT; @@ -1300,7 +1297,7 @@ break; case IRTTP_MAX_SDU_SIZE: val = self->max_data_size; - DEBUG(0, __FUNCTION__ "(), getting max_sdu_size = %d\n", val); + DEBUG(2, __FUNCTION__ "(), getting max_sdu_size = %d\n", val); len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/compressors/Config.in linux.ac/net/irda/compressors/Config.in --- linux.vanilla/net/irda/compressors/Config.in Thu Dec 17 17:01:03 1998 +++ linux.ac/net/irda/compressors/Config.in Mon Sep 13 00:22:42 1999 @@ -1,9 +1,11 @@ -bool 'IrLAP compression' CONFIG_IRDA_COMPRESSION +bool ' IrLAP compression' CONFIG_IRDA_COMPRESSION -if [ "$CONFIG_IRDA_COMPRESSION" != "n" ] ; then - comment ' IrDA compressors' - dep_tristate ' Deflate compression (experimental)' CONFIG_IRDA_DEFLATE $CONFIG_IRDA -# tristate ' BZIP2 compression' CONFIG_IRDA_BZIP2 -# tristate ' BSD compression' CONFIG_IRDA_BSD +if [ "$CONFIG_IRDA_COMPRESSION" != "n" ]; then + comment ' IrDA compressors' + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Deflate compression (EXPERIMENTAL)' CONFIG_IRDA_DEFLATE $CONFIG_IRDA + fi +# tristate ' BZIP2 compression' CONFIG_IRDA_BZIP2 +# tristate ' BSD compression' CONFIG_IRDA_BSD fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/Config.in linux.ac/net/irda/ircomm/Config.in --- linux.vanilla/net/irda/ircomm/Config.in Thu Dec 17 17:01:03 1998 +++ linux.ac/net/irda/ircomm/Config.in Mon Sep 13 00:22:42 1999 @@ -1,3 +1,3 @@ -dep_tristate 'IrCOMM protocol' CONFIG_IRCOMM $CONFIG_IRDA +dep_tristate ' IrCOMM protocol' CONFIG_IRCOMM $CONFIG_IRDA diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/Makefile linux.ac/net/irda/ircomm/Makefile --- linux.vanilla/net/irda/ircomm/Makefile Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/Makefile Sat Sep 18 01:41:43 1999 @@ -8,7 +8,7 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := ircomm_and_tty.o -O_OBJS := ircomm_param.o ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.c +O_OBJS := ircomm_param.o ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o M_OBJS := ircomm.o ircomm-tty.o MI_OBJS := ircomm_param.o ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/ircomm_event.c linux.ac/net/irda/ircomm/ircomm_event.c --- linux.vanilla/net/irda/ircomm/ircomm_event.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/ircomm_event.c Sat Sep 18 01:41:43 1999 @@ -1,12 +1,12 @@ /********************************************************************* * * Filename: ircomm_event.c - * Version: - * Description: + * Version: 1.0 + * Description: IrCOMM layer state machine * Status: Experimental. * Author: Dag Brattli * Created at: Sun Jun 6 20:33:11 1999 - * Modified at: Wed Aug 25 12:58:27 1999 + * Modified at: Thu Sep 2 10:09:25 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -161,18 +161,15 @@ ircomm_next_state(self, IRCOMM_CONN); ret = self->issue.connect_response(self, skb); break; - case IRCOMM_DISCONNECT_REQUEST: ircomm_next_state(self, IRCOMM_IDLE); ret = self->issue.disconnect_request(self, skb, info); break; - case IRCOMM_TTP_DISCONNECT_INDICATION: case IRCOMM_LMP_DISCONNECT_INDICATION: ircomm_next_state(self, IRCOMM_IDLE); ircomm_disconnect_indication(self, skb, info); break; - default: DEBUG(0, __FUNCTION__ "(), unknown event = %s\n", ircomm_event[event]); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/ircomm_param.c linux.ac/net/irda/ircomm/ircomm_param.c --- linux.vanilla/net/irda/ircomm/ircomm_param.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/ircomm_param.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Mon Jun 7 10:25:11 1999 - * Modified at: Wed Aug 25 13:48:14 1999 + * Modified at: Fri Sep 3 09:28:20 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -102,6 +102,7 @@ */ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) { + unsigned long flags; struct sk_buff *skb; int count; @@ -119,12 +120,16 @@ if (self->service_type == IRCOMM_3_WIRE_RAW) return 0; - skb = self->ctrl_skb; - + save_flags(flags); + cli(); + + skb = self->ctrl_skb; if (!skb) { skb = dev_alloc_skb(256); - if (!skb) - return -1; + if (!skb) { + restore_flags(flags); + return -ENOMEM; + } skb_reserve(skb, self->max_header_size); @@ -136,8 +141,13 @@ */ count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), &ircomm_param_info); - if (count > 0) - skb_put(skb, count); + if (count < 0) { + DEBUG(0, __FUNCTION__ "(), no room for parameter!\n"); + restore_flags(flags); + return -1; + } + skb_put(skb, count); + restore_flags(flags); if (flush) { ircomm_control_request(self->ircomm, skb); @@ -201,13 +211,25 @@ /* * Function ircomm_param_port_type (self, param) * - * - * + * The port type parameter tells if the devices are serial or parallel. + * Since we only advertise serial service, this parameter should only + * be equal to IRCOMM_SERIAL. */ static int ircomm_param_port_type(void *instance, param_t *param, int get) { - DEBUG(0, __FUNCTION__ "(), not impl.\n"); + struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; + + ASSERT(self != NULL, return -1;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); + + if (get) + param->pv.b = IRCOMM_SERIAL; + else { + self->session.port_type = param->pv.b; + DEBUG(0, __FUNCTION__ "(), port type=%d\n", + self->session.port_type); + } return 0; } @@ -223,11 +245,13 @@ ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - - if (get) + + if (get) { DEBUG(0, __FUNCTION__ "(), not imp!\n"); - else + } else { DEBUG(0, __FUNCTION__ "(), port-name=%s\n", param->pv.c); + strncpy(self->session.port_name, param->pv.c, 32); + } return 0; } @@ -273,8 +297,6 @@ else self->session.data_format = param->pv.b; - DEBUG(1, __FUNCTION__ "(), data format = 0x%02x\n", param->pv.b); - return 0; } @@ -359,9 +381,6 @@ else { dte = param->pv.b; - /* Null modem cable emulator */ - self->session.null_modem = TRUE; - if (dte & IRCOMM_DELTA_DTR) self->session.dce |= (IRCOMM_DELTA_DSR| IRCOMM_DELTA_RI | @@ -379,14 +398,9 @@ /* Take appropriate actions */ ircomm_tty_check_modem_status(self); - /* - * Send reply, and remember not to set delta values for the - * initial parameters - */ - self->session.dte = (IRCOMM_DTR| IRCOMM_RTS); - ircomm_param_request(self, IRCOMM_DTE, TRUE); + /* Null modem cable emulator */ + self->session.null_modem = TRUE; } - DEBUG(1, __FUNCTION__ "(), dte = 0x%02x\n", param->pv.b); return 0; } @@ -426,18 +440,24 @@ /* * Function ircomm_param_poll (instance, param) * - * + * Called when the peer device is polling for the line settings * */ static int ircomm_param_poll(void *instance, param_t *param, int get) { - DEBUG(0, __FUNCTION__ "(), not impl.\n"); - - return 0; -} + struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; + ASSERT(self != NULL, return -1;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); + /* Poll parameters are always of lenght 0 (just a signal) */ + if (!get) { + /* Respond with DTE line settings */ + ircomm_param_request(self, IRCOMM_DTE, TRUE); + } + return 0; +} diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/ircomm_tty.c linux.ac/net/irda/ircomm/ircomm_tty.c --- linux.vanilla/net/irda/ircomm/ircomm_tty.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/ircomm_tty.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Jun 6 21:00:56 1999 - * Modified at: Wed Aug 25 15:12:18 1999 + * Modified at: Thu Sep 9 17:27:17 1999 * Modified by: Dag Brattli * Sources: serial.c and previous IrCOMM work by Takahide Higuchi * @@ -60,11 +60,8 @@ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch); static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout); static void ircomm_tty_hangup(struct tty_struct *tty); -static void ircomm_tty_break(struct tty_struct *tty, int break_state); static void ircomm_tty_do_softint(void *private_); -static void ircomm_tty_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *skb); + static int ircomm_tty_data_indication(void *instance, void *sap, struct sk_buff *skb); static int ircomm_tty_control_indication(void *instance, void *sap, @@ -127,7 +124,6 @@ driver.stop = ircomm_tty_stop; driver.start = ircomm_tty_start; driver.hangup = ircomm_tty_hangup; - driver.break_ctl = ircomm_tty_break; driver.wait_until_sent = ircomm_tty_wait_until_sent; driver.read_proc = ircomm_tty_read_proc; @@ -170,9 +166,12 @@ notify_t notify; int ret; + ASSERT(self != NULL, return -1;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); + /* Already open */ if (self->flags & ASYNC_INITIALIZED) { - DEBUG(0, __FUNCTION__ "(), already open so break out!\n"); + DEBUG(2, __FUNCTION__ "(), already open so break out!\n"); return 0; } @@ -181,10 +180,10 @@ /* These callbacks we must handle ourselves */ notify.data_indication = ircomm_tty_data_indication; notify.udata_indication = ircomm_tty_control_indication; - notify.disconnect_indication = ircomm_tty_disconnect_indication; notify.flow_indication = ircomm_tty_flow_indication; /* Use the ircomm_tty interface for these ones */ + notify.disconnect_indication = ircomm_tty_disconnect_indication; notify.connect_confirm = ircomm_tty_connect_confirm; notify.connect_indication = ircomm_tty_connect_indication; strncpy(notify.name, "ircomm_tty", NOTIFY_MAX_NAME); @@ -201,7 +200,7 @@ /* Connect IrCOMM link with remote device */ ret = ircomm_tty_attach_cable(self); if (ret < 0) { - DEBUG(0, __FUNCTION__ "(), error attaching cable!\n"); + ERROR(__FUNCTION__ "(), error attaching cable!\n"); return ret; } @@ -227,7 +226,7 @@ tty = self->tty; - DEBUG(1, __FUNCTION__ "()\n"); + DEBUG(2, __FUNCTION__ "()\n"); if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { /* this is a callout device */ @@ -283,7 +282,7 @@ retval = 0; add_wait_queue(&self->open_wait, &wait); - DEBUG(1, "%s(%d):block_til_ready before block on %s open_count=%d\n", + DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", __FILE__,__LINE__, tty->driver.name, self->open_count ); save_flags(flags); cli(); @@ -391,16 +390,25 @@ self->tqueue.routine = ircomm_tty_do_softint; self->tqueue.data = self; self->max_header_size = 5; - self->max_data_size = 2048-self->max_header_size; + self->max_data_size = 64-self->max_header_size; + self->close_delay = 5*HZ/10; + self->closing_wait = 30*HZ; /* Init some important stuff */ init_timer(&self->watchdog_timer); init_waitqueue_head(&self->open_wait); - skb_queue_head_init(&self->tx_queue); + init_waitqueue_head(&self->close_wait); + + /* + * Force TTY into raw mode by default which is usually what + * we want for IrCOMM and IrLPT. This way applications will + * not have to twiddle with printcap etc. + */ + tty->termios->c_iflag = 0; + tty->termios->c_oflag = 0; /* Insert into hash */ hashbin_insert(ircomm_tty, (QUEUE *) self, line, NULL); - } self->open_count++; @@ -413,12 +421,28 @@ /* Not really used by us, but lets do it anyway */ self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + /* + * If the port is the middle of closing, bail out now + */ + if (tty_hung_up_p(filp) || + (self->flags & ASYNC_CLOSING)) { + if (self->flags & ASYNC_CLOSING) + interruptible_sleep_on(&self->close_wait); + /* MOD_DEC_USE_COUNT; "info->tty" will cause this? */ +#ifdef SERIAL_DO_RESTART + return ((self->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS); +#else + return -EAGAIN; +#endif + } + /* Check if this is a "normal" ircomm device, or an irlpt device */ if (line < 0x10) { self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE; - DEBUG(0, __FUNCTION__ "(), IrCOMM device\n"); + DEBUG(2, __FUNCTION__ "(), IrCOMM device\n"); } else { - DEBUG(0, __FUNCTION__ "(), IrLPT device\n"); + DEBUG(2, __FUNCTION__ "(), IrLPT device\n"); self->service_type = IRCOMM_3_WIRE_RAW; } @@ -452,7 +476,6 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - struct sk_buff *skb; unsigned long flags; DEBUG(2, __FUNCTION__ "()\n"); @@ -484,7 +507,7 @@ MOD_DEC_USE_COUNT; restore_flags(flags); - DEBUG(2, __FUNCTION__ "(), returning 2\n"); + DEBUG(2, __FUNCTION__ "(), open count > 0\n"); return; } self->flags |= ASYNC_CLOSING; @@ -494,6 +517,10 @@ * the line discipline to only process XON/XOFF characters. */ tty->closing = 1; + if (self->closing_wait != ASYNC_CLOSING_WAIT_NONE) + tty_wait_until_sent(tty, self->closing_wait); + + self->flags &= ~ASYNC_INITIALIZED; if (tty->driver.flush_buffer) tty->driver.flush_buffer(tty); @@ -503,35 +530,47 @@ tty->closing = 0; self->tty = 0; - wake_up_interruptible(&self->open_wait); - + if (self->blocked_open) { + if (self->close_delay) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(self->close_delay); + } + wake_up_interruptible(&self->open_wait); + } + self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| ASYNC_CLOSING); + wake_up_interruptible(&self->close_wait); MOD_DEC_USE_COUNT; - restore_flags(flags); del_timer(&self->watchdog_timer); - /* Free frames queued for transmission */ - while ((skb = skb_dequeue(&self->tx_queue)) != NULL) - dev_kfree_skb(skb); - /* Free parameter buffer */ if (self->ctrl_skb) { dev_kfree_skb(self->ctrl_skb); self->ctrl_skb = NULL; } + /* Free transmit buffer */ + if (self->tx_skb) { + dev_kfree_skb(self->tx_skb); + self->tx_skb = NULL; + } + ircomm_tty_detach_cable(self); ircomm_close(self->ircomm); - self->ircomm = NULL; + + restore_flags(flags); + +#if IRCOMM_TTY_CLOSE_WILL_DEALLOC self->magic = 0; hashbin_remove(ircomm_tty, self->line, NULL); kfree(self); +#endif } /* @@ -544,18 +583,15 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__ "()\n"); - ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - /* Flush transmit buffer if any */ - if ((self->tx_skb) && (!tty->hw_stopped)) { - DEBUG(0, __FUNCTION__ "(), flushing!\n"); - ircomm_tty_do_event(self, IRCOMM_TTY_DATA_REQUEST, - self->tx_skb, NULL); - self->tx_skb = NULL; - } + /* + * Let do_softint() do this to avoid race condition with + * do_softint() ;-) + */ + queue_task(&self->tqueue, &tq_immediate); + mark_bh(IMMEDIATE_BH); } /* @@ -569,28 +605,31 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) private_; struct tty_struct *tty; + unsigned long flags; + struct sk_buff *skb; - DEBUG(2, __FUNCTION__ "()\n"); - - ASSERT(self != NULL, return;); - ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); + if (!self || self->magic != IRCOMM_TTY_MAGIC) + return; tty = self->tty; if (!tty) return; - if (tty->hw_stopped) { - DEBUG(2, __FUNCTION__ "(), hw stopped!\n"); + if (tty->hw_stopped) return; - } + + /* Unlink transmit buffer */ + save_flags(flags); + cli(); + + skb = self->tx_skb; + self->tx_skb = NULL; + + restore_flags(flags); /* Flush transmit buffer if any */ - if (self->tx_skb) { - DEBUG(1, __FUNCTION__ "(), flushing!\n"); - ircomm_tty_do_event(self, IRCOMM_TTY_DATA_REQUEST, - self->tx_skb, NULL); - self->tx_skb = NULL; - } + if (skb) + ircomm_tty_do_event(self, IRCOMM_TTY_DATA_REQUEST, skb, NULL); /* Check if user (still) wants to be waken up */ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && @@ -625,9 +664,9 @@ ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); -/* save_flags(flags); + save_flags(flags); cli(); -*/ + /* Fetch current transmit buffer */ skb = self->tx_skb; @@ -637,20 +676,19 @@ * max data size. The normal case however is just the opposite, and * this function may be called multiple times, and will then actually * defragment the data and send it out as one packet as soon as - * possible, but at a safer point in time + * possible, but at a safer point in time */ - while (count && !tty->hw_stopped) { + while (count) { size = count; /* Adjust data size to the max data size */ - if (size > self->max_data_size) { - DEBUG(1, __FUNCTION__ - "(), size %d to big, clipping to %d!\n", - size, self->max_data_size); + if (size > self->max_data_size) size = self->max_data_size; - } - /* Do we already have a buffer ready for transmit? */ + /* + * Do we already have a buffer ready for transmit, or do + * we need to allocate a new frame + */ if (skb) { /* * Any room for more data at the end of the current @@ -663,25 +701,18 @@ if (size > tailroom) size = tailroom; } else { - /* Current transmit frame is full */ - DEBUG(1, __FUNCTION__ "(), flushing!\n"); - ircomm_tty_do_event(self, - IRCOMM_TTY_DATA_REQUEST, - skb, NULL); - skb = self->tx_skb = NULL; + /* + * Current transmit frame is full, so break + * out, so we can send it as soon as possible + */ + break; } - } - - /* Check if we need to allocate a new frame */ - if (!skb) { - DEBUG(3, __FUNCTION__ - "(), allocating new buffer of size %d!\n", - self->max_data_size+self->max_header_size); + } else { /* Prepare a full sized frame */ skb = dev_alloc_skb(self->max_data_size+ self->max_header_size); if (!skb) { - /*restore_flags(flags);*/ + restore_flags(flags); return -ENOBUFS; } skb_reserve(skb, self->max_header_size); @@ -694,12 +725,12 @@ else memcpy(skb_put(skb,size), buf+len, size); - DEBUG(1, __FUNCTION__ "(), size=%d\n", size); - count -= size; len += size; } + restore_flags(flags); + /* * Schedule a new thread which will transmit the frame as soon * as possible, but at a safe point in time. We do this so the @@ -710,8 +741,6 @@ queue_task(&self->tqueue, &tq_immediate); mark_bh(IMMEDIATE_BH); - /*restore_flags(flags);*/ - return len; } @@ -725,6 +754,7 @@ static int ircomm_tty_write_room(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; + unsigned long flags; int ret; ASSERT(self != NULL, return -1;); @@ -734,10 +764,13 @@ if (tty->hw_stopped) ret = 0; else { + save_flags(flags); + cli(); if (self->tx_skb) ret = self->max_data_size - self->tx_skb->len; else ret = self->max_data_size; + restore_flags(flags); } DEBUG(2, __FUNCTION__ "(), ret=%d\n", ret); @@ -753,8 +786,27 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; + unsigned long orig_jiffies, poll_time; + + DEBUG(0, __FUNCTION__ "()\n"); - DEBUG(2, __FUNCTION__ "(), not impl\n"); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); + + orig_jiffies = jiffies; + + /* Set poll time to 200 ms */ + poll_time = MIN(timeout, MSECS_TO_JIFFIES(200)); + + while (self->tx_skb && self->tx_skb->len) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(poll_time); + if (signal_pending(current)) + break; + if (timeout && time_after(jiffies, orig_jiffies + timeout)) + break; + } + current->state = TASK_RUNNING; } /* @@ -785,7 +837,6 @@ ircomm_param_request(self, IRCOMM_DTE, TRUE); } - DEBUG(1, __FUNCTION__"(), FLOW_STOP\n"); ircomm_flow_request(self->ircomm, FLOW_STOP); } @@ -829,10 +880,21 @@ static int ircomm_tty_chars_in_buffer(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; + unsigned long flags; + int len = 0; - DEBUG(4, __FUNCTION__ "()\n"); + ASSERT(self != NULL, return -1;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); + + save_flags(flags); + cli(); + + if (self->tx_skb) + len = self->tx_skb->len; - return 0; /* We don't have any "buffer" */ + restore_flags(flags); + + return len; } /* @@ -846,7 +908,10 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(0, __FUNCTION__"()\n"); + DEBUG(2, __FUNCTION__"()\n"); + + ASSERT(self != NULL, return;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); if (!tty) return; @@ -889,8 +954,6 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__"()\n"); - ircomm_flow_request(self->ircomm, FLOW_START); } @@ -904,25 +967,13 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__"()\n"); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); ircomm_flow_request(self->ircomm, FLOW_STOP); } /* - * Function ircomm_tty_break (tty, break_state) - * - * - * - */ -static void ircomm_tty_break(struct tty_struct *tty, int break_state) -{ - struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - - DEBUG(0, __FUNCTION__"(), not impl\n"); -} - -/* * Function ircomm_check_modem_status (self) * * Check for any changes in the DCE's line settings. This function should @@ -934,8 +985,6 @@ struct tty_struct *tty; int status; - DEBUG(4, __FUNCTION__ "()\n"); - ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -967,13 +1016,9 @@ DEBUG(2, __FUNCTION__ "(), CTS tx start...\n"); tty->hw_stopped = 0; - - if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) - && tty->ldisc.write_wakeup) - { - (tty->ldisc.write_wakeup)(tty); - } - wake_up_interruptible(&tty->write_wait); + + queue_task(&self->tqueue, &tq_immediate); + mark_bh(IMMEDIATE_BH); return; } } else { @@ -1045,35 +1090,6 @@ } /* - * Function ircomm_tty_disconnect_indication (instance, sap, reason, skb) - * - * Link disconnected - * - */ -static void ircomm_tty_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *skb) -{ - struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - - DEBUG(2, __FUNCTION__ "()\n"); - - ASSERT(self != NULL, return;); - ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); - - if (!self->tty) - return; - - /* Drop carrier */ - self->session.dce = IRCOMM_DELTA_CD; - ircomm_tty_check_modem_status(self); -#if 0 - /* Disconnect */ - tty_hangup(self->tty); -#endif -} - -/* * Function ircomm_tty_flow_indication (instance, sap, cmd) * * This function is called by IrTTP when it wants us to slow down the @@ -1093,7 +1109,7 @@ switch (cmd) { case FLOW_START: - DEBUG(1, __FUNCTION__ "(), hw start!\n"); + DEBUG(2, __FUNCTION__ "(), hw start!\n"); tty->hw_stopped = 0; if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) @@ -1104,7 +1120,7 @@ default: /* If we get here, something is very wrong, better stop */ case FLOW_STOP: - DEBUG(1, __FUNCTION__ "(), hw stopped!\n"); + DEBUG(2, __FUNCTION__ "(), hw stopped!\n"); tty->hw_stopped = 1; break; } @@ -1114,6 +1130,8 @@ { int ret=0; + ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]); + ret += sprintf(buf+ret, "Service type: "); if (self->service_type & IRCOMM_9_WIRE) ret += sprintf(buf+ret, "9_WIRE"); @@ -1125,12 +1143,15 @@ ret += sprintf(buf+ret, "No common service type!\n"); ret += sprintf(buf+ret, "\n"); + ret += sprintf(buf+ret, "Port name: %s\n", self->session.port_name); + ret += sprintf(buf+ret, "DTE status: "); if (self->session.dte & IRCOMM_RTS) ret += sprintf(buf+ret, "RTS|"); if (self->session.dte & IRCOMM_DTR) ret += sprintf(buf+ret, "DTR|"); - ret--; /* remove the last | */ + if (self->session.dte) + ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "DCE status: "); @@ -1142,7 +1163,8 @@ ret += sprintf(buf+ret, "CD|"); if (self->session.dce & IRCOMM_RI) ret += sprintf(buf+ret, "RI|"); - ret--; /* remove the last | */ + if (self->session.dce) + ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Configuration: "); @@ -1171,7 +1193,8 @@ ret += sprintf(buf+ret, "ENQ_ACK_IN|"); if (self->session.flow_control & IRCOMM_ENQ_ACK_OUT) ret += sprintf(buf+ret, "ENQ_ACK_OUT|"); - ret--; /* remove the last | */ + if (self->session.flow_control) + ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Flags: "); @@ -1189,7 +1212,8 @@ ret += sprintf(buf+ret, "ASYNC_NORMAL_ACTIVE|"); if (self->flags & ASYNC_CALLOUT_ACTIVE) ret += sprintf(buf+ret, "ASYNC_CALLOUT_ACTIVE|"); - ret--; /* remove the last | */ + if (self->flags) + ret--; /* remove the last | */ ret += sprintf(buf+ret, "\n"); ret += sprintf(buf+ret, "Open count: %d\n", self->open_count); @@ -1197,7 +1221,6 @@ ret += sprintf(buf+ret, "Hardware: %s\n", self->tty->hw_stopped ? "Stopped" : "Running"); - exit: ret += sprintf(buf+ret, "\n"); return ret; } @@ -1213,7 +1236,7 @@ int *eof, void *unused) { struct ircomm_tty_cb *self; - int i, count = 0, l; + int count = 0, l; off_t begin = 0; self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/ircomm_tty_attach.c linux.ac/net/irda/ircomm/ircomm_tty_attach.c --- linux.vanilla/net/irda/ircomm/ircomm_tty_attach.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/ircomm_tty_attach.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Jun 5 17:42:00 1999 - * Modified at: Wed Aug 25 13:32:00 1999 + * Modified at: Wed Sep 8 11:54:27 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -96,6 +96,8 @@ "IRCOMM_TTY_DISCOVERY_INDICATION", "IRCOMM_TTY_CONNECT_CONFIRM", "IRCOMM_TTY_CONNECT_INDICATION", + "IRCOMM_TTY_DISCONNECT_REQUEST", + "IRCOMM_TTY_DISCONNECT_INDICATION", "IRCOMM_TTY_WD_TIMER_EXPIRED", "IRCOMM_TTY_GOT_PARAMETERS", "IRCOMM_TTY_GOT_LSAPSEL", @@ -167,8 +169,10 @@ irlmp_unregister_service(self->skey); /* Remove LM-IAS object */ - if (self->obj) + if (self->obj) { irias_delete_object(self->obj); + self->obj = NULL; + } ircomm_tty_do_event(self, IRCOMM_TTY_DETACH_CABLE, NULL, NULL); @@ -204,7 +208,8 @@ irias_insert_object(self->obj); } else { hints = irlmp_service_to_hint(S_COMM); - + hints |= irlmp_service_to_hint(S_TELEPHONY); + /* Register IrCOMM with LM-IAS */ self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID); irias_add_integer_attrib(self->obj, "IrDA:TinyTP:LsapSel", @@ -257,8 +262,8 @@ } /* Only 9-wire service types continue here */ -#if 0 ircomm_param_request(self, IRCOMM_FLOW_CONTROL, FALSE); +#if 0 ircomm_param_request(self, IRCOMM_XON_XOFF, FALSE); ircomm_param_request(self, IRCOMM_ENQ_ACK, FALSE); #endif @@ -297,6 +302,30 @@ } /* + * Function ircomm_tty_disconnect_indication (instance, sap, reason, skb) + * + * Link disconnected + * + */ +void ircomm_tty_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *skb) +{ + struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; + + DEBUG(2, __FUNCTION__ "()\n"); + + ASSERT(self != NULL, return;); + ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); + + if (!self->tty) + return; + + ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, + NULL); +} + +/* * Function ircomm_tty_getvalue_confirm (result, obj_id, value, priv) * * Got result from the IAS query we make @@ -315,7 +344,7 @@ /* Check if request succeeded */ if (result != IAS_SUCCESS) { - DEBUG(0, __FUNCTION__ "(), got NULL value!\n"); + DEBUG(4, __FUNCTION__ "(), got NULL value!\n"); return; } @@ -421,29 +450,35 @@ /* * IrCOMM link is now up, and if we are not using hardware - * flow-control, then declare the hardware as running + * flow-control, then declare the hardware as running. Otherwise + * the client will have to wait for the CD to be set. */ if (!(self->flags & ASYNC_CTS_FLOW)) { DEBUG(2, __FUNCTION__ "(), starting hardware!\n"); if (!self->tty) return; self->tty->hw_stopped = 0; - - /* Kick client */ - ircomm_tty_do_softint(self); } + /* Wake up processes blocked on open */ + wake_up_interruptible(&self->open_wait); + + /* + * Wake up processes blocked on write, or waiting for a write + * wakeup notification + */ + queue_task(&self->tqueue, &tq_immediate); + mark_bh(IMMEDIATE_BH); } /* * Function irlan_start_watchdog_timer (self, timeout) * - * - * + * Start the watchdog timer. This timer is used to make sure that any + * connection attempt is successful, and if not, we will retry after + * the timeout */ void ircomm_tty_start_watchdog_timer(struct ircomm_tty_cb *self, int timeout) { - DEBUG(4, __FUNCTION__ "()\n"); - irda_start_timer(&self->watchdog_timer, timeout, (void *) self, ircomm_tty_watchdog_timer_expired); } @@ -458,7 +493,7 @@ { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data; - DEBUG(1, __FUNCTION__ "()\n"); + DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -479,7 +514,7 @@ { int ret = 0; - DEBUG(1, __FUNCTION__": state=%s, event=%s\n", + DEBUG(2, __FUNCTION__": state=%s, event=%s\n", ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { @@ -507,9 +542,11 @@ /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); - - ircomm_tty_link_established(self); ircomm_tty_next_state(self, IRCOMM_TTY_READY); + + /* Init connection */ + ircomm_tty_send_initial_parameters(self); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_WD_TIMER_EXPIRED: /* Just stay idle */ @@ -518,7 +555,7 @@ ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -538,7 +575,7 @@ { int ret = 0; - DEBUG(1, __FUNCTION__": state=%s, event=%s\n", + DEBUG(2, __FUNCTION__": state=%s, event=%s\n", ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { @@ -568,8 +605,11 @@ /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); - ircomm_tty_link_established(self); ircomm_tty_next_state(self, IRCOMM_TTY_READY); + + /* Init connection */ + ircomm_tty_send_initial_parameters(self); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_WD_TIMER_EXPIRED: /* Try to discover any remote devices */ @@ -580,7 +620,7 @@ ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -600,7 +640,7 @@ { int ret = 0; - DEBUG(1, __FUNCTION__": state=%s, event=%s\n", + DEBUG(2, __FUNCTION__": state=%s, event=%s\n", ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { @@ -624,14 +664,17 @@ /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); - ircomm_tty_link_established(self); ircomm_tty_next_state(self, IRCOMM_TTY_READY); + + /* Init connection */ + ircomm_tty_send_initial_parameters(self); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_DETACH_CABLE: ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -651,7 +694,7 @@ { int ret = 0; - DEBUG(1, __FUNCTION__": state=%s, event=%s\n", + DEBUG(2, __FUNCTION__": state=%s, event=%s\n", ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { @@ -673,14 +716,17 @@ /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); - ircomm_tty_link_established(self); ircomm_tty_next_state(self, IRCOMM_TTY_READY); + + /* Init connection */ + ircomm_tty_send_initial_parameters(self); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_DETACH_CABLE: ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -700,38 +746,20 @@ { int ret = 0; - DEBUG(1, __FUNCTION__": state=%s, event=%s\n", + DEBUG(2, __FUNCTION__": state=%s, event=%s\n", ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_CONNECT_CONFIRM: - ircomm_tty_link_established(self); + del_timer(&self->watchdog_timer); ircomm_tty_next_state(self, IRCOMM_TTY_READY); - + /* * Send initial parameters. This will also send out queued * parameters waiting for the connection to come up */ ircomm_tty_send_initial_parameters(self); - - ASSERT(self->tty != NULL, return -1;); - - /* Send queued frames */ - while ((skb = skb_dequeue(&self->tx_queue))) { - ret = ircomm_data_request(self->ircomm, skb); - if (ret < 0) - break; - } - - /* Wake up processes blocked on open */ - wake_up_interruptible(&self->open_wait); - - /* - * Wake up processes blocked on write, or waiting for a write - * wakeup notification - */ - queue_task(&self->tqueue, &tq_immediate); - mark_bh(IMMEDIATE_BH); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_CONNECT_INDICATION: del_timer(&self->watchdog_timer); @@ -739,6 +767,10 @@ /* Accept connection */ ircomm_connect_response(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_READY); + + /* Init connection */ + ircomm_tty_send_initial_parameters(self); + ircomm_tty_link_established(self); break; case IRCOMM_TTY_WD_TIMER_EXPIRED: /* Go back to search mode */ @@ -750,7 +782,7 @@ ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -774,14 +806,20 @@ case IRCOMM_TTY_DATA_REQUEST: ret = ircomm_data_request(self->ircomm, skb); break; - case IRCOMM_TTY_DATA_INDICATION: - break; case IRCOMM_TTY_DETACH_CABLE: ircomm_disconnect_request(self->ircomm, NULL); ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; + case IRCOMM_TTY_DISCONNECT_INDICATION: + ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); + ircomm_tty_start_watchdog_timer(self, 3*HZ); + + /* Drop carrier */ + self->session.dce = IRCOMM_DELTA_CD; + ircomm_tty_check_modem_status(self); + break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + DEBUG(2, __FUNCTION__"(), unknown event: %s\n", ircomm_tty_event[event]); return -EINVAL; } @@ -813,7 +851,7 @@ { self->state = state; - DEBUG(1, __FUNCTION__": next state=%s, service type=%d\n", + DEBUG(2, __FUNCTION__": next state=%s, service type=%d\n", ircomm_tty_state[self->state], self->service_type); } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/ircomm/ircomm_tty_ioctl.c linux.ac/net/irda/ircomm/ircomm_tty_ioctl.c --- linux.vanilla/net/irda/ircomm/ircomm_tty_ioctl.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/ircomm/ircomm_tty_ioctl.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Thu Jun 10 14:39:09 1999 - * Modified at: Wed Aug 25 14:11:02 1999 + * Modified at: Tue Aug 31 10:29:36 1999 * Modified by: Dag Brattli * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -196,12 +196,12 @@ DEBUG(1, __FUNCTION__ "()\n"); - result = ((self->session.dte & IRCOMM_RTS) ? TIOCM_RTS : 0) - | ((self->session.dte & IRCOMM_DTR) ? TIOCM_DTR : 0) - | ((self->session.dce & IRCOMM_DELTA_CD) ? TIOCM_CAR : 0) - | ((self->session.dce & IRCOMM_DELTA_RI) ? TIOCM_RNG : 0) - | ((self->session.dce & IRCOMM_DELTA_DSR) ? TIOCM_DSR : 0) - | ((self->session.dce & IRCOMM_DELTA_CTS) ? TIOCM_CTS : 0); + result = ((self->session.dte & IRCOMM_RTS) ? TIOCM_RTS : 0) + | ((self->session.dte & IRCOMM_DTR) ? TIOCM_DTR : 0) + | ((self->session.dce & IRCOMM_CD) ? TIOCM_CAR : 0) + | ((self->session.dce & IRCOMM_RI) ? TIOCM_RNG : 0) + | ((self->session.dce & IRCOMM_DSR) ? TIOCM_DSR : 0) + | ((self->session.dce & IRCOMM_CTS) ? TIOCM_CTS : 0); return put_user(result, value); } @@ -286,21 +286,19 @@ memset(&info, 0, sizeof(info)); info.line = self->line; - /* info.flags = self->flags; */ + info.flags = self->flags; info.baud_base = self->session.data_rate; -#if 0 - info.close_delay = driver->close_delay; - info.closing_wait = driver->closing_wait; -#endif + info.close_delay = self->close_delay; + info.closing_wait = self->closing_wait; + /* For compatibility */ info.type = PORT_16550A; info.port = 0; info.irq = 0; info.xmit_fifo_size = 0; info.hub6 = 0; -#if 0 - info.custom_divisor = driver->custom_divisor; -#endif + info.custom_divisor = 0; + if (copy_to_user(retinfo, &info, sizeof(*retinfo))) return -EFAULT; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irda_device.c linux.ac/net/irda/irda_device.c --- linux.vanilla/net/irda/irda_device.c Sat Sep 11 00:54:18 1999 +++ linux.ac/net/irda/irda_device.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Wed Sep 2 20:22:08 1998 - * Modified at: Tue Aug 24 14:31:13 1999 + * Modified at: Thu Sep 9 12:55:02 1999 * Modified by: Dag Brattli * Modified at: Fri May 28 3:11 CST 1999 * Modified by: Horst von Brand @@ -155,16 +155,16 @@ /* Allocate memory if needed */ if (self->rx_buff.truesize > 0) { - self->rx_buff.head = ( __u8 *) kmalloc(self->rx_buff.truesize, - self->rx_buff.flags); + self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize, + self->rx_buff.flags); if (self->rx_buff.head == NULL) return -ENOMEM; memset(self->rx_buff.head, 0, self->rx_buff.truesize); } if (self->tx_buff.truesize > 0) { - self->tx_buff.head = ( __u8 *) kmalloc(self->tx_buff.truesize, - self->tx_buff.flags); + self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, + self->tx_buff.flags); if (self->tx_buff.head == NULL) { kfree(self->rx_buff.head); return -ENOMEM; @@ -191,14 +191,15 @@ /* Initialize IrDA net device */ do { sprintf(self->name, "%s%d", "irda", i++); - } while (dev_get(self->name) != NULL); + } while (dev_get(self->name)); self->netdev.name = self->name; self->netdev.priv = (void *) self; self->netdev.next = NULL; - - if ((result = register_netdev(&self->netdev)) != 0) { - DEBUG(0, __FUNCTION__ "(), register_netdev() failed!\n"); + + result = register_netdev(&self->netdev); + if (result) { + ERROR(__FUNCTION__ "(), register_netdev() failed!\n"); return -1; } @@ -214,7 +215,7 @@ hashbin_insert(irda_device, (QUEUE *) self, (int) self, NULL); /* Open network device */ - dev_open(&self->netdev); + /*dev_open(&self->netdev);*/ MESSAGE("IrDA: Registered device %s\n", self->name); @@ -238,7 +239,7 @@ /* We do this test to know if the device has been registered at all */ if (self->netdev.type == ARPHRD_IRDA) { - dev_close(&self->netdev); + /*dev_close(&self->netdev);*/ /* Remove netdevice */ unregister_netdev(&self->netdev); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlan/Config.in linux.ac/net/irda/irlan/Config.in --- linux.vanilla/net/irda/irlan/Config.in Sun Mar 7 23:26:44 1999 +++ linux.ac/net/irda/irlan/Config.in Mon Sep 13 00:22:42 1999 @@ -1 +1 @@ -dep_tristate 'IrLAN protocol' CONFIG_IRLAN $CONFIG_IRDA +dep_tristate ' IrLAN protocol' CONFIG_IRLAN $CONFIG_IRDA diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlan/irlan_common.c linux.ac/net/irda/irlan/irlan_common.c --- linux.vanilla/net/irda/irlan/irlan_common.c Thu Sep 2 00:48:51 1999 +++ linux.ac/net/irda/irlan/irlan_common.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Tue Aug 17 15:30:40 1999 + * Modified at: Thu Sep 9 11:39:43 1999 * Modified by: Dag Brattli * * Copyright (c) 1997, 1999 Dag Brattli , @@ -237,7 +237,7 @@ /* Get the first free irlan name */ do { sprintf(self->ifname, "%s%d", "irlan", i++); - } while (dev_get(self->ifname) != NULL); + } while (dev_get(self->ifname)); } self->dev.name = self->ifname; @@ -615,7 +615,7 @@ irias_add_string_attrib(obj, "DeviceID", "HWP19F0"); irias_add_integer_attrib(obj, "CompCnt", 1); if (self->provider.access_type == ACCESS_PEER) - irias_add_string_attrib(obj, "Comp#02", "PNP8389"); + irias_add_string_attrib(obj, "Comp#01", "PNP8389"); else irias_add_string_attrib(obj, "Comp#01", "PNP8294"); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlap_event.c linux.ac/net/irda/irlap_event.c --- linux.vanilla/net/irda/irlap_event.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/irda/irlap_event.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sat Aug 16 00:59:29 1997 - * Modified at: Wed Aug 25 14:49:47 1999 + * Modified at: Thu Sep 9 11:37:00 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -310,8 +310,6 @@ discovery_t *discovery_rsp; int ret = 0; - DEBUG(4, __FUNCTION__ "()\n"); - ASSERT(self != NULL, return -1;); ASSERT(self->magic == LAP_MAGIC, return -1;); @@ -337,16 +335,21 @@ irlap_next_state(self, LAP_SETUP); } break; - case RECV_SNRM_CMD: - self->daddr = info->daddr; - self->caddr = info->caddr; - - irlap_next_state(self, LAP_CONN); - - irlap_connect_indication(self, skb); + /* Check if the frame contains and I field */ + if (info) { + self->daddr = info->daddr; + self->caddr = info->caddr; + + irlap_next_state(self, LAP_CONN); + + irlap_connect_indication(self, skb); + } else { + DEBUG(0, __FUNCTION__ "(), SNRM frame does not contain" + " and I field!\n"); + dev_kfree_skb(skb); + } break; - case DISCOVERY_REQUEST: ASSERT(info != NULL, return -1;); @@ -422,6 +425,10 @@ default: DEBUG(2, __FUNCTION__ "(), Unknown event %s\n", irlap_event[event]); + + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -499,7 +506,7 @@ irlap_event[event]); if (skb) - dev_kfree_skb( skb); + dev_kfree_skb(skb); ret = -1; break; @@ -615,27 +622,21 @@ irlap_start_wd_timer(self, self->wd_timeout); irlap_next_state( self, LAP_NRM_S); break; - - case RECV_SNRM_CMD: - DEBUG( 3, __FUNCTION__ "(), event RECV_SNRM_CMD!\n"); -#if 0 - irlap_next_state( self, LAP_NDM); -#endif - break; - case RECV_DISCOVERY_XID_CMD: DEBUG( 3, __FUNCTION__ "(), event RECV_DISCOVER_XID_CMD!\n"); irlap_next_state( self, LAP_NDM); - break; - + break; case DISCONNECT_REQUEST: irlap_send_dm_frame( self); irlap_next_state( self, LAP_CONN); break; - default: DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, irlap_event[event]); + + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -694,7 +695,7 @@ * The device with the largest device address wins the battle * (both have sent a SNRM command!) */ - if (info->daddr > self->saddr) { + if (info &&(info->daddr > self->saddr)) { del_timer(&self->final_timer); irlap_initiate_connection_state(self); @@ -718,6 +719,7 @@ irlap_next_state(self, LAP_NRM_S); } else { /* We just ignore the other device! */ + dev_kfree_skb(skb); irlap_next_state(self, LAP_SETUP); } break; @@ -756,10 +758,14 @@ irlap_disconnect_indication(self, LAP_DISC_INDICATION); break; - /* DM handled in irlap_frame.c, irlap_input() */ - + /* DM handled in irlap_frame.c, irlap_driver_rcv() */ default: - DEBUG( 4, "irlap_state_setup: Unknown event"); + DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event, + irlap_event[event]); + + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -931,6 +937,10 @@ break; default: DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event); + + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -1373,6 +1383,9 @@ default: DEBUG(1, __FUNCTION__ "(), Unknown event %s\n", irlap_event[event]); + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -1443,17 +1456,31 @@ } break; case RECV_SNRM_CMD: - DEBUG(3, __FUNCTION__ "(), RECV_SNRM_CMD\n"); - irlap_initiate_connection_state(self); - irlap_wait_min_turn_around(self, &self->qos_tx); - irlap_send_ua_response_frame(self, &self->qos_rx); - irlap_reset_confirm(); - irlap_start_wd_timer(self, self->wd_timeout); - irlap_next_state(self, LAP_NDM); + /* + * SNRM frame is not allowed to contain an I-field in this + * state + */ + if (!info) { + DEBUG(3, __FUNCTION__ "(), RECV_SNRM_CMD\n"); + irlap_initiate_connection_state(self); + irlap_wait_min_turn_around(self, &self->qos_tx); + irlap_send_ua_response_frame(self, &self->qos_rx); + irlap_reset_confirm(); + irlap_start_wd_timer(self, self->wd_timeout); + irlap_next_state(self, LAP_NDM); + } else { + DEBUG(0, __FUNCTION__ "(), SNRM frame contained an I " + "field!\n"); + dev_kfree_skb(skb); + } break; default: DEBUG(1, __FUNCTION__ "(), Unknown event %s\n", irlap_event[event]); + + if (skb) + dev_kfree_skb(skb); + ret = -1; break; } @@ -1531,6 +1558,9 @@ default: DEBUG(1, __FUNCTION__ "(), Unknown event %s\n", irlap_event[event]); + if (skb) + dev_kfree_skb(skb); + ret = -EINVAL; break; } @@ -1785,11 +1815,18 @@ break; case RECV_SNRM_CMD: - del_timer(&self->wd_timer); - DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n"); - irlap_next_state(self, LAP_RESET_CHECK); - - irlap_reset_indication(self); + /* SNRM frame is not allowed to contain an I-field */ + if (!info) { + del_timer(&self->wd_timer); + DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n"); + irlap_next_state(self, LAP_RESET_CHECK); + + irlap_reset_indication(self); + } else { + DEBUG(0, __FUNCTION__ "(), SNRM frame contained an " + "I-field!\n"); + dev_kfree_skb(skb); + } break; case WD_TIMER_EXPIRED: DEBUG( 4, "WD_TIMER_EXPIRED: %ld\n", jiffies); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlap_frame.c linux.ac/net/irda/irlap_frame.c --- linux.vanilla/net/irda/irlap_frame.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/irda/irlap_frame.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Aug 19 10:27:26 1997 - * Modified at: Wed Aug 25 13:15:53 1999 + * Modified at: Thu Sep 9 11:23:49 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -161,27 +161,33 @@ { struct snrm_frame *frame; - DEBUG(3, __FUNCTION__ "()\n"); - - ASSERT(skb != NULL, return;); - ASSERT(info != NULL, return;); - frame = (struct snrm_frame *) skb->data; - - /* Copy peer device address */ - info->daddr = le32_to_cpu(frame->saddr); - - /* Copy connection address */ - info->caddr = frame->ncaddr; - - /* Check if connection address has got a valid value */ - if ((info->caddr == 0x00) || (info->caddr == 0xfe)) { - DEBUG(3, __FUNCTION__ "(), invalid connection address!\n"); - dev_kfree_skb(skb); - return; - } - - irlap_do_event(self, RECV_SNRM_CMD, skb, info); + + if (skb->len >= sizeof(struct snrm_frame)) { + /* Copy the new connection address */ + info->caddr = frame->ncaddr; + + /* Check if the new connection address is valid */ + if ((info->caddr == 0x00) || (info->caddr == 0xfe)) { + DEBUG(3, __FUNCTION__ + "(), invalid connection address!\n"); + dev_kfree_skb(skb); + return; + } + + /* Copy peer device address */ + info->daddr = le32_to_cpu(frame->saddr); + info->saddr = le32_to_cpu(frame->saddr); + + /* Only accept if addressed directly to us */ + if (info->saddr != self->saddr) { + dev_kfree_skb(skb); + return; + } + irlap_do_event(self, RECV_SNRM_CMD, skb, info); + } else + /* Signal that this SNRM frame does not contain and I-field */ + irlap_do_event(self, RECV_SNRM_CMD, skb, NULL); } /* @@ -318,7 +324,7 @@ skb_put(skb, 14); frame = (struct xid_frame *) skb->data; - if ( command) { + if (command) { frame->caddr = CBROADCAST | CMD_FRAME; frame->control = XID_CMD | PF_BIT; } else { @@ -334,7 +340,7 @@ else frame->daddr = cpu_to_le32(discovery->daddr); - switch(S) { + switch (S) { case 1: frame->flags = 0x00; break; @@ -402,18 +408,24 @@ ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); + xid = (struct xid_frame *) skb->data; + + info->daddr = le32_to_cpu(xid->saddr); + info->saddr = le32_to_cpu(xid->daddr); + + /* Make sure frame is addressed to us */ + if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) { + dev_kfree_skb(skb); + DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n"); + return; + } + if ((discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) { - DEBUG(0, __FUNCTION__ "(), kmalloc failed!\n"); + WARNING(__FUNCTION__ "(), kmalloc failed!\n"); return; } memset(discovery, 0, sizeof(discovery_t)); - xid = (struct xid_frame *) skb->data; - - /* - * Copy peer device address and set the source address - */ - info->daddr = le32_to_cpu(xid->saddr); discovery->daddr = info->daddr; discovery->saddr = self->saddr; discovery->timestamp = jiffies; @@ -462,17 +474,17 @@ __u8 *discovery_info; char *text; - DEBUG(4, __FUNCTION__ "()\n"); - - ASSERT(self != NULL, return;); - ASSERT(self->magic == LAP_MAGIC, return;); - ASSERT(skb != NULL, return;); - ASSERT(info != NULL, return;); - xid = (struct xid_frame *) skb->data; - - /* Copy peer device address */ + info->daddr = le32_to_cpu(xid->saddr); + info->saddr = le32_to_cpu(xid->daddr); + + /* Make sure frame is addressed to us */ + if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) { + DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n"); + dev_kfree_skb(skb); + return; + } switch (xid->flags & 0x03) { case 0x00: @@ -567,7 +579,7 @@ * * Received RR (Receive Ready) frame from peer station, no harm in * making it inline since its called only from one single place - * (irlap_input). + * (irlap_driver_rcv). */ static inline void irlap_recv_rr_frame(struct irlap_cb *self, struct sk_buff *skb, @@ -642,21 +654,16 @@ static void irlap_recv_ua_frame(struct irlap_cb *self, struct sk_buff *skb, struct irlap_info *info) { - DEBUG(4, __FUNCTION__ "(), <%ld>\n", jiffies); - - ASSERT(skb != NULL, return;); - ASSERT(info != NULL, return;); - irlap_do_event(self, RECV_UA_RSP, skb, info); } /* * Function irlap_send_data_primary(self, skb) * - * + * Send I-frames as the primary station but without the poll bit set * */ -void irlap_send_data_primary( struct irlap_cb *self, struct sk_buff *skb) +void irlap_send_data_primary(struct irlap_cb *self, struct sk_buff *skb) { struct sk_buff *tx_skb; @@ -784,7 +791,7 @@ ASSERT( skb != NULL, return;); /* Is this reliable or unreliable data? */ - if ( skb->data[1] == I_FRAME) { + if (skb->data[1] == I_FRAME) { /* * Insert frame sequence number (Vs) in control field before @@ -792,17 +799,17 @@ */ skb->data[1] = I_FRAME | (self->vs << 1); - tx_skb = skb_clone( skb, GFP_ATOMIC); - if ( tx_skb == NULL) { - dev_kfree_skb( skb); + tx_skb = skb_clone(skb, GFP_ATOMIC); + if (tx_skb == NULL) { + dev_kfree_skb(skb); return; } if (skb->sk != NULL) - skb_set_owner_w( tx_skb, skb->sk); + skb_set_owner_w(tx_skb, skb->sk); /* Insert frame in store */ - skb_queue_tail( &self->wx_list, skb); + skb_queue_tail(&self->wx_list, skb); tx_skb->data[1] |= PF_BIT; @@ -810,21 +817,21 @@ self->window = self->window_size; self->ack_required = FALSE; - irlap_start_wd_timer( self, self->wd_timeout); + irlap_start_wd_timer(self, self->wd_timeout); - irlap_send_i_frame( self, tx_skb, RSP_FRAME); + irlap_send_i_frame(self, tx_skb, RSP_FRAME); } else { - if ( self->ack_required) { - irlap_send_ui_frame( self, skb, RSP_FRAME); - irlap_send_rr_frame( self, RSP_FRAME); + if (self->ack_required) { + irlap_send_ui_frame(self, skb, RSP_FRAME); + irlap_send_rr_frame(self, RSP_FRAME); self->ack_required = FALSE; } else { skb->data[1] |= PF_BIT; - irlap_send_ui_frame( self, skb, RSP_FRAME); + irlap_send_ui_frame(self, skb, RSP_FRAME); } self->window = self->window_size; - irlap_start_wd_timer( self, self->wd_timeout); + irlap_start_wd_timer(self, self->wd_timeout); } } @@ -834,16 +841,12 @@ * Send I(nformation) frame as secondary without final bit set * */ -void irlap_send_data_secondary( struct irlap_cb *self, struct sk_buff *skb) +void irlap_send_data_secondary(struct irlap_cb *self, struct sk_buff *skb) { struct sk_buff *tx_skb = NULL; - ASSERT( self != NULL, return;); - ASSERT( self->magic == LAP_MAGIC, return;); - ASSERT( skb != NULL, return;); - /* Is this reliable or unreliable data? */ - if ( skb->data[1] == I_FRAME) { + if (skb->data[1] == I_FRAME) { /* * Insert frame sequence number (Vs) in control field before @@ -851,25 +854,25 @@ */ skb->data[1] = I_FRAME | (self->vs << 1); - tx_skb = skb_clone( skb, GFP_ATOMIC); - if ( tx_skb == NULL) { - dev_kfree_skb( skb); + tx_skb = skb_clone(skb, GFP_ATOMIC); + if (tx_skb == NULL) { + dev_kfree_skb(skb); return; } if (skb->sk != NULL) - skb_set_owner_w( tx_skb, skb->sk); + skb_set_owner_w(tx_skb, skb->sk); /* Insert frame in store */ - skb_queue_tail( &self->wx_list, skb); + skb_queue_tail(&self->wx_list, skb); self->vs = (self->vs + 1) % 8; self->ack_required = FALSE; self->window -= 1; - irlap_send_i_frame( self, tx_skb, RSP_FRAME); + irlap_send_i_frame(self, tx_skb, RSP_FRAME); } else { - irlap_send_ui_frame( self, skb, RSP_FRAME); + irlap_send_ui_frame(self, skb, RSP_FRAME); self->window -= 1; } } @@ -883,16 +886,14 @@ * * FIXME: It is not safe to traverse a this list without locking it! */ -void irlap_resend_rejected_frames( struct irlap_cb *self, int command) +void irlap_resend_rejected_frames(struct irlap_cb *self, int command) { struct sk_buff *tx_skb; struct sk_buff *skb; int count; - ASSERT( self != NULL, return;); - ASSERT( self->magic == LAP_MAGIC, return;); - - DEBUG(2, __FUNCTION__ "(), retry_count=%d\n", self->retry_count); + ASSERT(self != NULL, return;); + ASSERT(self->magic == LAP_MAGIC, return;); /* Initialize variables */ skb = tx_skb = NULL; @@ -900,22 +901,22 @@ /* * Resend all unacknowledged frames */ - count = skb_queue_len( &self->wx_list); - skb = skb_peek( &self->wx_list); - while ( skb != NULL) { - irlap_wait_min_turn_around( self, &self->qos_tx); + count = skb_queue_len(&self->wx_list); + skb = skb_peek(&self->wx_list); + while (skb != NULL) { + irlap_wait_min_turn_around(self, &self->qos_tx); /* We copy the skb to be retransmitted since we will have to * modify it. Cloning will confuse packet sniffers */ /* tx_skb = skb_clone( skb, GFP_ATOMIC); */ tx_skb = skb_copy(skb, GFP_ATOMIC); - if ( tx_skb == NULL) { + if (tx_skb == NULL) { /* Unlink tx_skb from list */ tx_skb->next = tx_skb->prev = NULL; tx_skb->list = NULL; - dev_kfree_skb( skb); + dev_kfree_skb(skb); return; } /* Unlink tx_skb from list */ @@ -925,8 +926,8 @@ /* * make sure the skb->sk accounting of memory usage is sane */ - if ( skb->sk != NULL) - skb_set_owner_w( tx_skb, skb->sk); + if (skb->sk != NULL) + skb_set_owner_w(tx_skb, skb->sk); /* Clear old Nr field + poll bit */ tx_skb->data[1] &= 0x0f; @@ -934,18 +935,18 @@ /* * Set poll bit on the last frame retransmitted */ - if ( count-- == 1) + if (count-- == 1) tx_skb->data[1] |= PF_BIT; /* Set p/f bit */ else tx_skb->data[1] &= ~PF_BIT; /* Clear p/f bit */ - irlap_send_i_frame( self, tx_skb, command); + irlap_send_i_frame(self, tx_skb, command); /* * If our skb is the last buffer in the list, then * we are finished, if not, move to the next sk-buffer */ - if ( skb == skb_peek_tail( &self->wx_list)) + if (skb == skb_peek_tail( &self->wx_list)) skb = NULL; else skb = skb->next; @@ -955,13 +956,13 @@ */ return; /* Skip this for now, DB */ - while ( skb_queue_len( &self->tx_list) > 0) { + while (skb_queue_len( &self->tx_list) > 0) { - DEBUG( 0, __FUNCTION__ "(), sending additional frames!\n"); - if (( skb_queue_len( &self->tx_list) > 0) && - ( self->window > 0)) { + DEBUG(0, __FUNCTION__ "(), sending additional frames!\n"); + if ((skb_queue_len( &self->tx_list) > 0) && + (self->window > 0)) { skb = skb_dequeue( &self->tx_list); - ASSERT( skb != NULL, return;); + ASSERT(skb != NULL, return;); /* * If send window > 1 then send frame with pf @@ -989,11 +990,11 @@ { __u8 *frame; - DEBUG( 4, __FUNCTION__ "()\n"); + DEBUG(4, __FUNCTION__ "()\n"); - ASSERT( self != NULL, return;); - ASSERT( self->magic == LAP_MAGIC, return;); - ASSERT( skb != NULL, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == LAP_MAGIC, return;); + ASSERT(skb != NULL, return;); frame = skb->data; @@ -1012,16 +1013,12 @@ void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb, int command) { - __u8 *frame; - - frame = skb->data; - /* Insert connection address */ - frame[0] = self->caddr; - frame[0] |= (command) ? CMD_FRAME : 0; + skb->data[0] = self->caddr; + skb->data[0] |= (command) ? CMD_FRAME : 0; /* Insert next to receive (Vr) */ - frame[1] |= (self->vr << 5); /* insert nr */ + skb->data[1] |= (self->vr << 5); /* insert nr */ irlap_queue_xmit(self, skb); } @@ -1030,7 +1027,7 @@ * Function irlap_recv_i_frame (skb, frame) * * Receive and parse an I (Information) frame, no harm in making it inline - * since it's called only from one single place (irlap_input). + * since it's called only from one single place (irlap_driver_rcv). */ static inline void irlap_recv_i_frame(struct irlap_cb *self, struct sk_buff *skb, @@ -1079,12 +1076,12 @@ __u8 *frame; int w, x, y, z; - DEBUG( 0, __FUNCTION__ "()\n"); + DEBUG(0, __FUNCTION__ "()\n"); - ASSERT( self != NULL, return;); - ASSERT( self->magic == LAP_MAGIC, return;); - ASSERT( skb != NULL, return;); - ASSERT( info != NULL, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == LAP_MAGIC, return;); + ASSERT(skb != NULL, return;); + ASSERT(info != NULL, return;); frame = skb->data; @@ -1183,6 +1180,12 @@ info->daddr = le32_to_cpu(frame->saddr); info->saddr = le32_to_cpu(frame->daddr); + /* Make sure frame is addressed to us */ + if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) { + dev_kfree_skb(skb); + return; + } + if (command) irlap_do_event(self, RECV_TEST_CMD, skb, info); else @@ -1208,7 +1211,12 @@ idev = (struct irda_device *) dev->priv; self = idev->irlap; - ASSERT(skb->len > 1, return -1;); + /* Check if frame is large enough for parsing */ + if (skb->len < 2) { + DEBUG(0, __FUNCTION__ "(), frame to short!\n"); + dev_kfree_skb(skb); + return -1; + } command = skb->data[0] & CMD_FRAME; info.caddr = skb->data[0] & CBROADCAST; @@ -1218,10 +1226,9 @@ control = info.control; - /* First check if this frame addressed to us */ + /* First we check if this frame has a valid connection address */ if ((info.caddr != self->caddr) && (info.caddr != CBROADCAST)) { - DEBUG(2, __FUNCTION__ "(), Received frame is not for us!\n"); - + DEBUG(0, __FUNCTION__ "(), wrong connection address!\n"); dev_kfree_skb(skb); return 0; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlmp.c linux.ac/net/irda/irlmp.c --- linux.vanilla/net/irda/irlmp.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/irda/irlmp.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Stable. * Author: Dag Brattli * Created at: Sun Aug 17 20:54:32 1997 - * Modified at: Mon Aug 23 09:30:56 1999 + * Modified at: Wed Sep 8 12:08:07 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -1117,6 +1117,10 @@ case S_OBEX: hint.byte[0] |= HINT_EXTENSION; hint.byte[1] |= HINT_OBEX; + break; + case S_TELEPHONY: + hint.byte[0] |= HINT_EXTENSION; + hint.byte[1] |= HINT_TELEPHONY; break; case S_ANY: hint.word = 0xffff; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irlmp_event.c linux.ac/net/irda/irlmp_event.c --- linux.vanilla/net/irda/irlmp_event.c Tue Sep 7 22:07:14 1999 +++ linux.ac/net/irda/irlmp_event.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Wed Aug 25 14:38:49 1999 + * Modified at: Sun Sep 5 18:30:06 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -638,7 +638,20 @@ irlmp_connect_confirm(self, skb); break; case LM_DISCONNECT_INDICATION: - DEBUG(0, __FUNCTION__ "(), this should never happen!!\n"); + irlmp_next_lsap_state(self, LSAP_DISCONNECTED); + + ASSERT(self->lap != NULL, return -1;); + ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;); + + ASSERT(skb != NULL, return -1;); + ASSERT(skb->len > 3, return -1;); + reason = skb->data[3]; + + /* Try to close the LAP connection */ + DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n"); + irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL); + + irlmp_disconnect_indication(self, reason, skb); break; case LM_LAP_DISCONNECT_INDICATION: irlmp_next_lsap_state(self, LSAP_DISCONNECTED); diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/irttp.c linux.ac/net/irda/irttp.c --- linux.vanilla/net/irda/irttp.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/irda/irttp.c Sat Sep 18 01:41:43 1999 @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 31 20:14:31 1997 - * Modified at: Thu Jul 8 21:25:31 1999 + * Modified at: Tue Aug 31 14:55:24 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -797,7 +797,7 @@ DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n", self->send_credit, self->avail_credit, self->remote_credit); - DEBUG(0, __FUNCTION__ "(), MaxSduSize=%d\n", self->tx_max_sdu_size); + DEBUG(2, __FUNCTION__ "(), MaxSduSize=%d\n", self->tx_max_sdu_size); if (self->notify.connect_confirm) { self->notify.connect_confirm(self->notify.instance, self, qos, @@ -869,8 +869,6 @@ /* Remove parameters */ skb_pull(skb, MIN(skb->len, plen+1)); } - - DEBUG(4, __FUNCTION__ "(), initial send_credit=%d\n", n); if (self->notify.connect_indication) { self->notify.connect_indication(self->notify.instance, self, diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/irda/qos.c linux.ac/net/irda/qos.c --- linux.vanilla/net/irda/qos.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/irda/qos.c Sat Sep 18 01:41:43 1999 @@ -7,7 +7,7 @@ * Status: Experimental. * Author: Dag Brattli * Created at: Tue Sep 9 00:00:26 1997 - * Modified at: Tue Aug 17 10:25:21 1999 + * Modified at: Wed Sep 1 09:14:55 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , @@ -278,7 +278,7 @@ if (get) { param->pv.i = self->qos_rx.baud_rate.bits; - DEBUG(0, __FUNCTION__ "(), baud rate = 0x%02x\n", param->pv.i); + DEBUG(2, __FUNCTION__ "(), baud rate = 0x%02x\n", param->pv.i); } else { /* * Stations must agree on baud rate, so calculate diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/khttpd/Config.in linux.ac/net/khttpd/Config.in --- linux.vanilla/net/khttpd/Config.in Mon Aug 23 15:12:20 1999 +++ linux.ac/net/khttpd/Config.in Mon Sep 13 00:22:42 1999 @@ -1,4 +1,4 @@ # # kHTTPd # -tristate 'Kernel httpd acceleration (experimental)' CONFIG_KHTTPD +tristate ' Kernel httpd acceleration (EXPERIMENTAL)' CONFIG_KHTTPD diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/netsyms.c linux.ac/net/netsyms.c --- linux.vanilla/net/netsyms.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/netsyms.c Sun Sep 5 15:14:43 1999 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,8 @@ #endif +extern int netdev_finish_unregister(struct net_device *dev); + #include #if defined(CONFIG_ULTRA) || defined(CONFIG_WD80x3) || \ @@ -447,6 +450,12 @@ EXPORT_SYMBOL(tr_freedev); #endif +#ifdef CONFIG_NET_FC +EXPORT_SYMBOL(register_fcdev); +EXPORT_SYMBOL(unregister_fcdev); +EXPORT_SYMBOL(init_fcdev); +#endif + /* Device callback registration */ EXPORT_SYMBOL(register_netdevice_notifier); EXPORT_SYMBOL(unregister_netdevice_notifier); @@ -515,8 +524,10 @@ EXPORT_SYMBOL(unregister_hipdev); #endif +#ifdef CONFIG_SYSCTL EXPORT_SYMBOL(sysctl_wmem_max); EXPORT_SYMBOL(sysctl_rmem_max); +#endif #if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) #include diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/sched/Config.in linux.ac/net/sched/Config.in --- linux.vanilla/net/sched/Config.in Thu Aug 26 14:42:29 1999 +++ linux.ac/net/sched/Config.in Mon Sep 13 00:22:42 1999 @@ -8,7 +8,7 @@ #tristate 'H-PFQ packet scheduler' CONFIG_NET_SCH_HPFQ #tristate 'H-FSC packet scheduler' CONFIG_NET_SCH_HFCS if [ "$CONFIG_ATM" = "y" ]; then - bool 'ATM pseudo-scheduler' CONFIG_NET_SCH_ATM + bool 'ATM pseudo-scheduler' CONFIG_NET_SCH_ATM fi tristate 'The simplest PRIO pseudoscheduler' CONFIG_NET_SCH_PRIO tristate 'RED queue' CONFIG_NET_SCH_RED @@ -17,20 +17,20 @@ tristate 'TBF queue' CONFIG_NET_SCH_TBF bool 'QoS support' CONFIG_NET_QOS if [ "$CONFIG_NET_QOS" = "y" ]; then - bool 'Rate estimator' CONFIG_NET_ESTIMATOR + bool ' Rate estimator' CONFIG_NET_ESTIMATOR fi bool 'Packet classifier API' CONFIG_NET_CLS if [ "$CONFIG_NET_CLS" = "y" ]; then - tristate 'Routing table based classifier' CONFIG_NET_CLS_ROUTE4 - if [ "$CONFIG_NET_CLS_ROUTE4" != "n" ]; then - define_bool CONFIG_NET_CLS_ROUTE y - fi - tristate 'Firewall based classifier' CONFIG_NET_CLS_FW - tristate 'U32 classifier' CONFIG_NET_CLS_U32 - if [ "$CONFIG_NET_QOS" = "y" ]; then - tristate 'Special RSVP classifier' CONFIG_NET_CLS_RSVP - tristate 'Special RSVP classifier for IPv6' CONFIG_NET_CLS_RSVP6 - bool 'Ingres traffic policing' CONFIG_NET_CLS_POLICE - fi + tristate ' Routing table based classifier' CONFIG_NET_CLS_ROUTE4 + if [ "$CONFIG_NET_CLS_ROUTE4" != "n" ]; then + define_bool CONFIG_NET_CLS_ROUTE y + fi + tristate ' Firewall based classifier' CONFIG_NET_CLS_FW + tristate ' U32 classifier' CONFIG_NET_CLS_U32 + if [ "$CONFIG_NET_QOS" = "y" ]; then + tristate ' Special RSVP classifier' CONFIG_NET_CLS_RSVP + tristate ' Special RSVP classifier for IPv6' CONFIG_NET_CLS_RSVP6 + bool ' Ingres traffic policing' CONFIG_NET_CLS_POLICE + fi fi diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/socket.c linux.ac/net/socket.c --- linux.vanilla/net/socket.c Tue Sep 7 22:07:14 1999 +++ linux.ac/net/socket.c Wed Sep 15 23:56:18 1999 @@ -670,7 +670,7 @@ /* This function may be called only under socket lock or callback_lock */ -int sock_wake_async(struct socket *sock, int how) +int sock_wake_async(struct socket *sock, int how, int band) { if (!sock || !sock->fasync_list) return -1; @@ -689,9 +689,11 @@ call_kill: /* read_lock(&sock->sk->callback_lock); */ if(sock->fasync_list != NULL) - kill_fasync(sock->fasync_list, SIGIO); + kill_fasync(sock->fasync_list, SIGIO, band); /* read_unlock(&sock->sk->callback_lock); */ break; + case 3: + kill_fasync(sock->fasync_list, SIGURG, band); } return 0; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/unix/af_unix.c linux.ac/net/unix/af_unix.c --- linux.vanilla/net/unix/af_unix.c Sat Sep 11 00:54:18 1999 +++ linux.ac/net/unix/af_unix.c Fri Sep 10 17:56:53 1999 @@ -299,7 +299,7 @@ read_lock(&sk->callback_lock); if (!sk->dead && unix_writable(sk)) { wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket, 2); + sock_wake_async(sk->socket, 2, POLL_OUT); } read_unlock(&sk->callback_lock); } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/wanrouter/wanmain.c linux.ac/net/wanrouter/wanmain.c --- linux.vanilla/net/wanrouter/wanmain.c Thu Sep 2 00:48:52 1999 +++ linux.ac/net/wanrouter/wanmain.c Sun Sep 19 17:41:01 1999 @@ -11,6 +11,8 @@ * * Author: Gene Kozin * +* Fixes: Arnaldo Carvalho de Melo +* * Copyright: (c) 1995-1997 Sangoma Technologies Inc. * * This program is free software; you can redistribute it and/or diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/x25/x25_in.c linux.ac/net/x25/x25_in.c --- linux.vanilla/net/x25/x25_in.c Mon Jul 27 07:35:58 1998 +++ linux.ac/net/x25/x25_in.c Wed Sep 15 23:56:18 1999 @@ -278,6 +278,7 @@ kill_proc(sk->proc, SIGURG, 1); else kill_pg(-sk->proc, SIGURG, 1); + sock_wake_async(sk, 3, POLL_PRI); } x25_write_internal(sk, X25_INTERRUPT_CONFIRMATION); break; diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/Configure linux.ac/scripts/Configure --- linux.vanilla/scripts/Configure Mon Feb 1 20:03:20 1999 +++ linux.ac/scripts/Configure Tue Sep 14 20:59:14 1999 @@ -143,6 +143,10 @@ # define_bool define value # function define_bool () { + define_tristate $1 $2 +} + +function define_tristate () { case "$2" in "y") echo "$1=y" >>$CONFIG @@ -213,11 +217,11 @@ while :; do readln "$1 ($2) [$defprompt] " "$def" "$old" case "$ans" in - [yY] | [yY]es ) define_bool "$2" "y" + [yY] | [yY]es ) define_tristate "$2" "y" break ;; - [nN] | [nN]o ) define_bool "$2" "n" + [nN] | [nN]o ) define_tristate "$2" "n" break ;; - [mM] ) define_bool "$2" "m" + [mM] ) define_tristate "$2" "m" break ;; * ) help "$2" ;; @@ -246,7 +250,7 @@ while [ $# -gt 0 ]; do case "$1" in n) - define_bool "$var" "n" + define_tristate "$var" "n" return ;; m) @@ -268,9 +272,9 @@ while :; do readln "$ques ($var) [$defprompt] " "$def" "$old" case "$ans" in - [nN] | [nN]o ) define_bool "$var" "n" + [nN] | [nN]o ) define_tristate "$var" "n" break ;; - [mM] ) define_bool "$var" "m" + [mM] ) define_tristate "$var" "m" break ;; [yY] | [yY]es ) echo echo " This answer is not allowed, because it is not consistent with" @@ -288,6 +292,23 @@ else tristate "$ques" "$var" fi +} + +function dep_bool () { + ques=$1 + var=$2 + shift 2 + while [ $# -gt 0 ]; do + case "$1" in + m | n) + define_bool "$var" "n" + return + ;; + esac + shift + done + + bool "$ques" "$var" } # diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/Menuconfig linux.ac/scripts/Menuconfig --- linux.vanilla/scripts/Menuconfig Sun May 2 17:51:16 1999 +++ linux.ac/scripts/Menuconfig Wed Sep 15 23:59:04 1999 @@ -68,6 +68,12 @@ # # 24 January 1999, Michael Elizabeth Chastain, # - Improve the exit message (Jeff Ronne). +# +# 06 July 1999, Andrzej M. Krzysztofowicz, +# - Support for multiple conditions in dep_tristate(). +# - Implemented new functions: define_tristate(), define_int(), define_hex(), +# define_string(), dep_bool(). +# # @@ -132,6 +138,22 @@ eval $1=$2 } +function define_tristate () { + eval $1=$2 +} + +function define_hex () { + eval $1=$2 +} + +function define_int () { + eval $1=$2 +} + +function define_string () { + eval $1="$2" +} + # # Create a boolean (Yes/No) function for our current menu # which calls our local bool function. @@ -188,13 +210,52 @@ # else in the kernel. # function dep_tristate () { - if [ "$3" = "y" ]; then - tristate "$1" "$2" - else if [ "$3" = "m" ]; then - mod_bool "$1" "$2" + ques="$1" + var="$2" + dep=y + shift 2 + while [ $# -gt 0 ]; do + if [ "$1" = y ]; then + shift + elif [ "$1" = m ]; then + dep=m + shift + else + dep=n + shift $# + fi + done + if [ "$dep" = y ]; then + tristate "$ques" "$var" + elif [ "$dep" = m ]; then + mod_bool "$ques" "$var" + else + define_tristate "$var" n + fi +} + +# +# Same as above, but now only Y and N are allowed as dependency +# (i.e. third and next arguments). +# +function dep_bool () { + ques="$1" + var="$2" + dep=y + shift 2 + while [ $# -gt 0 ]; do + if [ "$1" = y ]; then + shift + else + dep=n + shift $# + fi + done + if [ "$dep" = y ]; then + bool "$ques" "$var" else - define_bool "$2" n - fi; fi + define_bool "$var" n + fi } # @@ -633,12 +694,13 @@ printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu + newmenu = sprintf("MCmenu%d", menu_no); printf( "function MCmenu%s () {\n"\ "default=$1\n"\ "menu_name %s\n",\ - menu_no, $0) >"MCmenu"menu_no + menu_no, $0) >newmenu - parser(ifile, "MCmenu"menu_no) + parser(ifile, newmenu) } else if ($1 ~ "endmenu") { printf("}\n") >>menu @@ -988,13 +1050,37 @@ function tristate () { set_x_info "$2" "n" - eval define_bool "$2" "$x" + eval define_tristate "$2" "$x" } function dep_tristate () { set_x_info "$2" "n" - if [ "$3" = "m" -a "$x" = "y" ]; then x="m"; fi - define_bool "$2" "$x" + var="$2" + shift 2 + while [ $# -gt 0 ]; do + if [ "$1" = y ]; then + shift + elif [ "$1" = m -a "$x" != n ]; then + x=m; shift + else + x=n; shift $# + fi + done + define_tristate "$var" "$x" + } + + function dep_bool () { + set_x_info "$2" "n" + var="$2" + shift 2 + while [ $# -gt 0 ]; do + if [ "$1" = y ]; then + shift + else + x=n; shift $# + fi + done + define_bool "$var" "$x" } function int () { @@ -1015,7 +1101,29 @@ echo "#define $2 \"$x\"" >>$CONFIG_H } + function define_hex () { + eval $1="$2" + echo "$1=$2" >>$CONFIG + echo "#define $1 0x${2##*[x,X]}" >>$CONFIG_H + } + + function define_int () { + eval $1="$2" + echo "$1=$2" >>$CONFIG + echo "#define $1 ($2)" >>$CONFIG_H + } + + function define_string () { + eval $1="$2" + echo "$1=\"$2\"" >>$CONFIG + echo "#define $1 \"$2\"" >>$CONFIG_H + } + function define_bool () { + define_tristate "$1" "$2" + } + + function define_tristate () { eval $1="$2" case "$2" in diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/header.tk linux.ac/scripts/header.tk --- linux.vanilla/scripts/header.tk Mon Feb 1 20:03:20 1999 +++ linux.ac/scripts/header.tk Tue Sep 14 20:59:14 1999 @@ -32,7 +32,7 @@ proc vfix { var } { global $var if [ catch {eval concat $$var} ] { - set $var 0 + set $var 4 } } @@ -42,6 +42,7 @@ set CONSTANT_Y 1 set CONSTANT_M 2 set CONSTANT_N 0 +set CONSTANT_E 4 # # Create a "reference" object to steal colors from. @@ -67,9 +68,11 @@ proc menu_option { w menu_num text } { global menus_per_column - if { $menu_num <= $menus_per_column } then { + global processed_top_level + set processed_top_level [expr $processed_top_level + 1] + if { $processed_top_level <= $menus_per_column } then { set myframe left - } elseif { $menu_num <= [expr 2 * $menus_per_column] } then { + } elseif { $processed_top_level <= [expr 2 * $menus_per_column] } then { set myframe middle } else { set myframe right @@ -211,7 +214,7 @@ } close $file1 update_choices - update_mainmenu .rdupd + update_mainmenu } proc write_comment { file1 file2 text } { puts $file1 "" @@ -223,17 +226,49 @@ puts $file2 " */" } -proc write_tristate { file1 file2 varname variable dep } { - if { $variable == 0 } \ - then { puts $file1 "# $varname is not set"; \ - puts $file2 "#undef $varname"} \ - elseif { $variable == 2 || ($dep == 2 && $variable == 1) } \ +proc effective_dep { deplist } { + global CONFIG_MODULES + set depend 1 + foreach i $deplist { + if {$i == 0} then {set depend 0} + if {$i == 2 && $depend == 1} then {set depend 2} + } + if {$depend == 2 && $CONFIG_MODULES == 0} then {set depend 0} + return $depend +} + +proc sync_tristate { var dep } { + global CONFIG_MODULES + if {$dep == 0 && ($var == 1 || $var == 2)} then { + set var 0 + } elseif {$dep == 2 && $var == 1} then { + set var 2 + } elseif {$var == 2 && $CONFIG_MODULES == 0} then { + if {$dep == 1} then {set var 1} else {set var 0} + } + return $var +} + +proc sync_bool { var dep } { + set var [sync_tristate $var $dep] + if {$dep == 2} then { + set var 0 + } + return $var +} + +proc write_tristate { file1 file2 varname variable deplist } { + set variable [sync_tristate $variable [effective_dep $deplist]] + if { $variable == 1 }\ + then { puts $file1 "$varname=y"; \ + puts $file2 "#define $varname 1" } \ + elseif { $variable == 2 } \ then { puts $file1 "$varname=m"; \ puts $file2 "#undef $varname"; \ puts $file2 "#define ${varname}_MODULE 1" } \ - elseif { $variable == 1 && $dep != 2 } \ - then { puts $file1 "$varname=y"; \ - puts $file2 "#define $varname 1" } \ + elseif { $variable == 0 } \ + then { puts $file1 "# $varname is not set"; \ + puts $file2 "#undef $varname"} \ else { \ puts stdout "ERROR - Attempting to write value for unconfigured variable ($varname)." \ } @@ -245,7 +280,7 @@ puts $file2 "#undef $varname"} \ else { puts $file1 "$varname=$variable"; \ - puts $file2 "#define $varname $variable"; \ + puts $file2 "#define $varname ($variable)"; \ } } @@ -255,7 +290,8 @@ puts $file2 "#undef $varname"} \ else { puts $file1 "$varname=$variable"; \ - puts $file2 "#define $varname 0x$variable"; \ + puts -nonewline $file2 "#define $varname 0x"; \ + puts $file2 [exec echo $variable | sed s/^0\[xX\]//]; \ } } @@ -282,11 +318,11 @@ proc toggle_switch2 {w mnum line text variable} { frame $w.x$line -relief sunken radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" radiobutton $w.x$line.m -text "-" -variable $variable -value 2 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" radiobutton $w.x$line.n -text "n" -variable $variable -value 0 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" option_name $w $mnum $line $text $variable @@ -296,11 +332,11 @@ proc toggle_switch3 {w mnum line text variable} { frame $w.x$line -relief sunken radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" radiobutton $w.x$line.m -text "m" -variable $variable -value 2 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" radiobutton $w.x$line.n -text "n" -variable $variable -value 0 \ - -relief groove -width 2 -command "update_menu$mnum .menu$mnum" + -relief groove -width 2 -command "update_active" option_name $w $mnum $line $text $variable @@ -322,10 +358,14 @@ pack $w.x$line -anchor w -fill both -expand on } -proc dep_tristate {w mnum line text variable depend } { +proc dep_tristate {w mnum line text variable } { tristate $w $mnum $line $text $variable } +proc dep_bool {w mnum line text variable } { + bool $w $mnum $line $text $variable +} + proc int { w mnum line text variable } { frame $w.x$line entry $w.x$line.x -width 18 -relief sunken -borderwidth 2 \ @@ -358,6 +398,18 @@ pack $w.x$line -anchor w -fill both -expand on } +proc submenu { w mnum line text subnum } { + frame $w.x$line + button $w.x$line.l -text "" -width 15 -relief groove + $w.x$line.l configure -activefore [cget $w.x$line.l -fg] \ + -activeback [cget $w.x$line.l -bg] -state disabled + button $w.x$line.m -text "$text" -relief raised -anchor w \ + -command "catch {destroy .menu$subnum}; menu$subnum .menu$subnum \"$text\"" + pack $w.x$line.l -side left -fill both + pack $w.x$line.m -anchor w -side right -fill both -expand on + pack $w.x$line -anchor w -fill both -expand on +} + proc comment {w line text } { #nothing done for comments now. } @@ -417,7 +469,7 @@ # frame $w.f2 button $w.f2.ok -text "OK" \ - -width 10 -command "destroy $w; focus $oldFocus" + -width 10 -command "destroy $w; catch {focus $oldFocus}" pack $w.f2.ok -side bottom -pady 6 -anchor n pack $w.f2 -side bottom -padx 10 -anchor s @@ -458,6 +510,55 @@ } +proc unregister_active {num} { + global active_menus + set index [lsearch -exact $active_menus $num] + if {$index != -1} then {set active_menus [lreplace $active_menus $index $index]} +} + +proc update_active {} { + global active_menus total_menus + set max 0 + if {[llength $active_menus] > 0} then { + set max [lindex $active_menus end] + update_define [toplevel_menu [lindex $active_menus 0]] $max 0 + } + foreach i $active_menus { + if {[winfo exists .menu$i] == 0} then { + unregister_active $i + } else { + update_menu$i + } + } + update_define [expr $max + 1] $total_menus 1 + update_mainmenu +} + +proc configure_entry {w option items} { + foreach i $items { + $w.$i configure -state $option + } +} + +proc validate_int {name val default} { + if {([exec echo $val | sed s/^-//g | tr -d \[:digit:\] ] != "")} then { + global $name; set $name $default + } +} + +proc validate_hex {name val default} { + if {([exec echo $val | tr -d \[:xdigit:\] ] != "")} then { + global $name; set $name $default + } +} + +proc update_define {first last allow_update} { + for {set i $first} {$i <= $last} {incr i} { + update_define_menu$i + if {$allow_update == 1} then update + } +} + # # Next set up the particulars for the top level menu, and define a few # buttons which we will stick down at the bottom. @@ -468,3 +569,5 @@ frame .f0.middle frame .f0.right +set active_menus [list] +set processed_top_level 0 diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/lxdialog/Makefile linux.ac/scripts/lxdialog/Makefile --- linux.vanilla/scripts/lxdialog/Makefile Mon Jul 20 18:05:16 1998 +++ linux.ac/scripts/lxdialog/Makefile Wed Sep 15 23:56:54 1999 @@ -30,8 +30,11 @@ lxdialog: $(OBJS) ncurses: - @x=`find /lib/ /usr/lib/ /usr/local/lib/ -maxdepth 1 -name 'libncurses.*'` ;\ - if [ ! "$$x" ]; then \ + @echo "main() {}" > lxtemp.c + @if $(CC) -lncurses lxtemp.c ; then \ + rm -f lxtemp.c a.out; \ + else \ + rm -f lxtemp.c; \ echo -e "\007" ;\ echo ">> Unable to find the Ncurses libraries." ;\ echo ">>" ;\ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/tail.tk linux.ac/scripts/tail.tk --- linux.vanilla/scripts/tail.tk Fri Jan 15 22:36:20 1999 +++ linux.ac/scripts/tail.tk Tue Sep 14 20:59:14 1999 @@ -29,10 +29,12 @@ read_config $defaults } -update_mainmenu .f0 +update_define 1 $total_menus 0 +update_mainmenu button .f0.right.save -anchor w -text "Save and Exit" \ - -command { writeconfig .config include/linux/autoconf.h; wrapup .wrap } + -command { catch {exec cp -f .config .config.old}; \ + writeconfig .config include/linux/autoconf.h; wrapup .wrap } button .f0.right.quit -anchor w -text "Quit Without Saving" \ -command { maybe_exit .maybe } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/tkcond.c linux.ac/scripts/tkcond.c --- linux.vanilla/scripts/tkcond.c Wed Jan 20 18:05:49 1999 +++ linux.ac/scripts/tkcond.c Tue Sep 14 20:59:14 1999 @@ -14,6 +14,12 @@ * every architecture and comparing it character-for-character against * the output of the old tkparse. * + * 07 July 1999, Andrzej M. Krzysztofowicz + * - kvariables removed; all variables are stored in a single table now + * - some elimination of options non-valid for current architecture + * implemented. + * - negation (!) eliminated from conditions + * * TO DO: * - xconfig is at the end of its life cycle. Contact if * you are interested in working on the replacement. @@ -28,73 +34,88 @@ /* - * Transform op_variable to op_kvariable. - * - * This works, but it's gross, speed-wise. It would benefit greatly - * from a simple hash table that maps names to cfg. - * - * Note well: this is actually better than the loop structure xconfig - * has been staggering along with for three years, which performs - * this whole procedure inside *another* loop on active conditionals. + * Mark variables which are defined anywhere. */ -void transform_to_kvariable( struct kconfig * scfg ) +static void mark_variables( struct kconfig * scfg ) { struct kconfig * cfg; + int i; + for ( i = 1; i <= max_varnum; i++ ) + vartable[i].defined = 0; for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) { - struct condition * cond; - - for ( cond = cfg->cond; cond != NULL; cond = cond->next ) + if ( cfg->token == token_bool + || cfg->token == token_choice_item + || cfg->token == token_define_bool + || cfg->token == token_define_hex + || cfg->token == token_define_int + || cfg->token == token_define_string + || cfg->token == token_define_tristate + || cfg->token == token_dep_bool + || cfg->token == token_dep_tristate + || cfg->token == token_hex + || cfg->token == token_int + || cfg->token == token_string + || cfg->token == token_tristate + || cfg->token == token_unset ) { - if ( cond->op == op_variable ) + if ( cfg->nameindex > 0 ) /* paranoid */ { - /* Here's where it gets DISGUSTING. */ - struct kconfig * cfg1; + vartable[cfg->nameindex].defined = 1; + } + } + } +} + + + +static void free_cond( struct condition *cond ) +{ + struct condition *tmp, *tmp1; + for ( tmp = cond; tmp; tmp = tmp1 ) + { + tmp1 = tmp->next; + free( (void*)tmp ); + } +} + - for ( cfg1 = scfg; cfg1 != NULL; cfg1 = cfg1->next ) + +/* + * Remove the bang operator from a condition to avoid priority problems. + * "!" has different priorities as "test" command argument and in + * a tk script. + */ +static struct condition * remove_bang( struct condition * condition ) +{ + struct condition * conda, * condb, * prev = NULL; + + for ( conda = condition; conda; conda = conda->next ) + { + if ( conda->op == op_bang && conda->next && + ( condb = conda->next->next ) ) + { + if ( condb->op == op_eq || condb->op == op_neq ) + { + condb->op = (condb->op == op_eq) ? op_neq : op_eq; + conda->op = op_nuked; + if ( prev ) { - if ( cfg1->token == token_bool - || cfg1->token == token_choice_item - || cfg1->token == token_dep_tristate - || cfg1->token == token_hex - || cfg1->token == token_int - || cfg1->token == token_string - || cfg1->token == token_tristate ) - { - if ( strcmp( cond->str, cfg1->optionname ) == 0 ) - { - cond->op = op_kvariable; - cond->str = NULL; - cond->cfg = cfg1; - break; - } - } + prev->next = conda->next; } - } - -#if 0 - /* - * Maybe someday this will be useful, but right now it - * gives a lot of false positives on files like - * drivers/video/Config.in that are meant for more - * than one architecture. Turn it on if you want to play - * with it though; it does work. -- mec - */ - if ( cond->op == op_variable ) - { - if ( strcmp( cond->str, "ARCH" ) != 0 - && strcmp( cond->str, "CONSTANT_Y" ) != 0 - && strcmp( cond->str, "CONSTANT_M" ) != 0 - && strcmp( cond->str, "CONSTANT_N" ) != 0 ) + else { - fprintf( stderr, "warning: $%s used but not defined\n", - cond->str ); + condition = conda->next; } + conda->next = NULL; + free_cond( conda ); + conda = condb; } -#endif } + prev = conda; } + return condition; } @@ -103,27 +124,65 @@ * Make a new condition chain by joining the current condition stack with * the "&&" operator for glue. */ -struct condition * join_condition_stack( struct condition * conditions [], +static struct condition * join_condition_stack( struct condition * conditions [], int depth ) { struct condition * cond_list; struct condition * cond_last; - int i; + int i, is_first = 1; cond_list = cond_last = NULL; + + for ( i = 0; i < depth; i++ ) + { + if ( conditions[i]->op == op_false ) + { + struct condition * cnew; + + /* It is always false condition */ + cnew = malloc( sizeof(*cnew) ); + memset( cnew, 0, sizeof(*cnew) ); + cnew->op = op_false; + cond_list = cond_last = cnew; + goto join_done; + } + } for ( i = 0; i < depth; i++ ) { struct condition * cond; struct condition * cnew; + int add_paren; + + /* omit always true conditions */ + if ( conditions[i]->op == op_true ) + continue; + + /* if i have another condition, add an '&&' operator */ + if ( !is_first ) + { + cnew = malloc( sizeof(*cnew) ); + memset( cnew, 0, sizeof(*cnew) ); + cnew->op = op_and; + cond_last->next = cnew; + cond_last = cnew; + } - /* add a '(' */ - cnew = malloc( sizeof(*cnew) ); - memset( cnew, 0, sizeof(*cnew) ); - cnew->op = op_lparen; - if ( cond_last == NULL ) - { cond_list = cond_last = cnew; } + if ( conditions[i]->op != op_lparen ) + { + /* add a '(' */ + add_paren = 1; + cnew = malloc( sizeof(*cnew) ); + memset( cnew, 0, sizeof(*cnew) ); + cnew->op = op_lparen; + if ( cond_last == NULL ) + { cond_list = cond_last = cnew; } + else + { cond_last->next = cnew; cond_last = cnew; } + } else - { cond_last->next = cnew; cond_last = cnew; } + { + add_paren = 0; + } /* duplicate the chain */ for ( cond = conditions [i]; cond != NULL; cond = cond->next ) @@ -132,27 +191,23 @@ cnew->next = NULL; cnew->op = cond->op; cnew->str = cond->str ? strdup( cond->str ) : NULL; - cnew->cfg = cond->cfg; - cond_last->next = cnew; - cond_last = cnew; + cnew->nameindex = cond->nameindex; + if ( cond_last == NULL ) + { cond_list = cond_last = cnew; } + else + { cond_last->next = cnew; cond_last = cnew; } } - /* add a ')' */ - cnew = malloc( sizeof(*cnew) ); - memset( cnew, 0, sizeof(*cnew) ); - cnew->op = op_rparen; - cond_last->next = cnew; - cond_last = cnew; - - /* if i have another condition, add an '&&' operator */ - if ( i < depth - 1 ) + if ( add_paren ) { + /* add a ')' */ cnew = malloc( sizeof(*cnew) ); memset( cnew, 0, sizeof(*cnew) ); - cnew->op = op_and; + cnew->op = op_rparen; cond_last->next = cnew; cond_last = cnew; } + is_first = 0; } /* @@ -171,7 +226,7 @@ cond1e = cond1d->next; if ( cond1e == NULL ) break; cond1f = cond1e->next; if ( cond1f == NULL ) break; - if ( cond1b->op == op_kvariable + if ( cond1b->op == op_variable && ( cond1c->op == op_eq || cond1c->op == op_neq ) && cond1d->op == op_constant && cond1e->op == op_rparen ) @@ -189,8 +244,8 @@ cond2f = cond2e->next; /* look for match */ - if ( cond2b->op == op_kvariable - && cond2b->cfg == cond1b->cfg + if ( cond2b->op == op_variable + && cond2b->nameindex == cond1b->nameindex && cond2c->op == cond1c->op && cond2d->op == op_constant && strcmp( cond2d->str, cond1d->str ) == 0 @@ -219,64 +274,159 @@ } } +join_done: return cond_list; } +static char * current_arch = NULL; + /* - * This is the main transformation function. + * Eliminating conditions with ARCH = . */ -void fix_conditionals( struct kconfig * scfg ) +static struct condition *eliminate_other_arch( struct condition *list ) { - struct kconfig * cfg; - - /* - * Transform op_variable to op_kvariable. - */ - transform_to_kvariable( scfg ); - - /* - * Transform conditions that use variables from "choice" statements. - * Choice values appear to the user as a collection of booleans, and the - * script can test the individual booleans. But internally, all I have is - * the N-way value of an unnamed temporary for the whole statement. So I - * have to tranform '"$CONFIG_M386" != "y"' - * into '"$tmpvar_N" != "CONFIG_M386"'. - */ - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) + struct condition *cond1a = list, *cond1b = NULL, *cond1c = NULL, *cond1d = NULL; + if ( current_arch == NULL ) + current_arch = getenv( "ARCH" ); + if ( current_arch == NULL ) { - struct condition * cond; - - for ( cond = cfg->cond; cond != NULL; cond = cond->next ) + fprintf( stderr, "error: ARCH undefined\n" ); + exit( 1 ); + } + if ( cond1a->op == op_variable + && ! strcmp( vartable[cond1a->nameindex].name, "ARCH" ) ) + { + cond1b = cond1a->next; if ( cond1b == NULL ) goto done; + cond1c = cond1b->next; if ( cond1c == NULL ) goto done; + cond1d = cond1c->next; + if ( cond1c->op == op_constant && cond1d == NULL ) { - if ( cond->op == op_kvariable && cond->cfg->token == token_choice_item ) + if ( (cond1b->op == op_eq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_neq && ! strcmp( cond1c->str, current_arch )) ) { - /* - * Look two more tokens down for the comparison token. - * It has to be "y" for this trick to work. - * - * If you get this error, don't even think about relaxing the - * strcmp test. You will produce incorrect TK code. Instead, - * look for the place in your Config.in script where you are - * comparing a 'choice' variable to a value other than 'y', - * and rewrite the comparison to be '= "y"' or '!= "y"'. - */ - struct condition * cond2 = cond->next->next; - const char * label; - - if ( strcmp( cond2->str, "y" ) != 0 ) + /* This is for another architecture */ + cond1a->op = op_false; + cond1a->next = NULL; + free_cond( cond1b ); + return cond1a; + } + else if ( (cond1b->op == op_neq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_eq && ! strcmp( cond1c->str, current_arch )) ) + { + /* This is for current architecture */ + cond1a->op = op_true; + cond1a->next = NULL; + free_cond( cond1b ); + return cond1a; + } + } + else if ( cond1c->op == op_constant && cond1d->op == op_or ) + { + if ( (cond1b->op == op_eq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_neq && ! strcmp( cond1c->str, current_arch )) ) + { + /* This is for another architecture */ + cond1b = cond1d->next; + cond1d->next = NULL; + free_cond( cond1a ); + return eliminate_other_arch( cond1b ); + } + else if ( (cond1b->op == op_neq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_eq && ! strcmp( cond1c->str, current_arch )) ) + { + /* This is for current architecture */ + cond1a->op = op_true; + cond1a->next = NULL; + free_cond( cond1b ); + return cond1a; + } + } + else if ( cond1c->op == op_constant && cond1d->op == op_and ) + { + if ( (cond1b->op == op_eq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_neq && ! strcmp( cond1c->str, current_arch )) ) + { + /* This is for another architecture */ + int l_par = 0; + + for ( cond1c = cond1d->next; cond1c; cond1c = cond1c->next ) { - fprintf( stderr, "tkparse choked in fix_choice_cond\n" ); - exit( 1 ); + if ( cond1c->op == op_lparen ) + l_par++; + else if ( cond1c->op == op_rparen ) + l_par--; + else if ( cond1c->op == op_or && l_par == 0 ) + /* Expression too complex - don't touch */ + return cond1a; + else if ( l_par < 0 ) + { + fprintf( stderr, "incorrect condition: programming error ?\n" ); + exit( 1 ); + } } + cond1a->op = op_false; + cond1a->next = NULL; + free_cond( cond1b ); + return cond1a; + } + else if ( (cond1b->op == op_neq && strcmp( cond1c->str, current_arch )) + || (cond1b->op == op_eq && ! strcmp( cond1c->str, current_arch )) ) + { + /* This is for current architecture */ + cond1b = cond1d->next; + cond1d->next = NULL; + free_cond( cond1a ); + return eliminate_other_arch( cond1b ); + } + } + } + if ( cond1a->op == op_variable && ! vartable[cond1a->nameindex].defined ) + { + cond1b = cond1a->next; if ( cond1b == NULL ) goto done; + cond1c = cond1b->next; if ( cond1c == NULL ) goto done; + cond1d = cond1c->next; - label = cond->cfg->label; - cond->cfg = cond->cfg->cfg_parent; - cond2->str = strdup( label ); + if ( cond1c->op == op_constant + && ( cond1d == NULL || cond1d->op == op_and ) ) /*???*/ + { + if ( cond1b->op == op_eq && strcmp( cond1c->str, "" ) ) + { + cond1a->op = op_false; + cond1a->next = NULL; + free_cond( cond1b ); + return cond1a; + } + } + else if ( cond1c->op == op_constant && cond1d->op == op_or ) + { + if ( cond1b->op == op_eq && strcmp( cond1c->str, "" ) ) + { + cond1b = cond1d->next; + cond1d->next = NULL; + free_cond( cond1a ); + return eliminate_other_arch( cond1b ); } } } +done: + return list; +} + + + +/* + * This is the main transformation function. + */ +void fix_conditionals( struct kconfig * scfg ) +{ + struct kconfig * cfg; + + /* + * Transform op_variable to op_kvariable. + */ + mark_variables( scfg ); /* * Walk the statement list, maintaining a stack of current conditions. @@ -290,16 +440,19 @@ { struct condition * cond_stack [32]; int depth = 0; + struct kconfig * prev = NULL; for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) { + int good = 1; switch ( cfg->token ) { default: break; case token_if: - cond_stack [depth++] = cfg->cond; + cond_stack [depth++] = + remove_bang( eliminate_other_arch( cfg->cond ) ); cfg->cond = NULL; break; @@ -325,6 +478,8 @@ case op_or: cond->op = op_and1; break; case op_neq: cond->op = op_eq; break; case op_eq: cond->op = op_neq; break; + case op_true: cond->op = op_false;break; + case op_false:cond->op = op_true; break; } } } @@ -336,25 +491,109 @@ case token_bool: case token_choice_item: + case token_choice_header: case token_comment: case token_define_bool: + case token_define_hex: + case token_define_int: + case token_define_string: + case token_define_tristate: case token_hex: case token_int: case token_mainmenu_option: case token_string: case token_tristate: + case token_unset: cfg->cond = join_condition_stack( cond_stack, depth ); + if ( cfg->cond && cfg->cond->op == op_false ) + { + good = 0; + if ( prev ) + prev->next = cfg->next; + else + scfg = cfg->next; + } break; + case token_dep_bool: case token_dep_tristate: /* * Same as the other simple statements, plus an additional * condition for the dependency. */ - cond_stack [depth] = cfg->cond; - cfg->cond = join_condition_stack( cond_stack, depth+1 ); + if ( cfg->cond ) + { + cond_stack [depth] = eliminate_other_arch( cfg->cond ); + cfg->cond = join_condition_stack( cond_stack, depth+1 ); + } + else + { + cfg->cond = join_condition_stack( cond_stack, depth ); + } + if ( cfg->cond && cfg->cond->op == op_false ) + { + good = 0; + if ( prev ) + prev->next = cfg->next; + else + scfg = cfg->next; + } break; } + if ( good ) + prev = cfg; } } } + + + +#if 0 +void dump_condition( struct condition *list ) +{ + struct condition *tmp; + for ( tmp = list; tmp; tmp = tmp->next ) + { + switch (tmp->op) + { + default: + break; + case op_variable: + printf( " %s", vartable[tmp->nameindex].name ); + break; + case op_constant: + printf( " %s", tmp->str ); + break; + case op_eq: + printf( " =" ); + break; + case op_bang: + printf( " !" ); + break; + case op_neq: + printf( " !=" ); + break; + case op_and: + case op_and1: + printf( " -a" ); + break; + case op_or: + printf( " -o" ); + break; + case op_true: + printf( " TRUE" ); + break; + case op_false: + printf( " FALSE" ); + break; + case op_lparen: + printf( " (" ); + break; + case op_rparen: + printf( " )" ); + break; + } + } + printf( "\n" ); +} +#endif diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/tkgen.c linux.ac/scripts/tkgen.c --- linux.vanilla/scripts/tkgen.c Sun May 2 17:51:16 1999 +++ linux.ac/scripts/tkgen.c Tue Sep 14 20:59:14 1999 @@ -92,33 +92,58 @@ * * 23 January 1999, Michael Elizabeth Chastain * - Remove bug-compatible code. + * + * 07 July 1999, Andrzej M. Krzysztofowicz + * Some bugfixes, including + * - disabling "m" options when CONFIG_MODULES is set to "n" as well as "y" + * option in dep_tristate when dependency is set to "m", + * - deactivating choices which should not be available, + * - basic validation for int and hex introduced if the entered one is not + * valid, + * - updates of all opened menus instead of the active only. I was afraid + * that it would slow down updates, but I don't even see any speed difference + * on my machine. If it slows you can still work with only a single menu + * opened, + * - fixed error when focussing non-existent window (especially Help windows), + * Higher level submenus implemented. */ #include +#include #include +#include #include "tkparse.h" - /* * Total number of menus. */ static int tot_menu_num = 0; - +/* + * Pointers to mainmenu_option and endmenu of each menu. + */ +struct kconfig * menu_first [100]; +struct kconfig * menu_last [100]; /* * Generate portion of wish script for the beginning of a submenu. * The guts get filled in with the various options. */ -static void start_proc( char * label, int menu_num, int flag ) +static void start_proc( char * label, int menu_num, int toplevel ) { - if ( flag ) + if ( toplevel ) printf( "menu_option menu%d %d \"%s\"\n", menu_num, menu_num, label ); printf( "proc menu%d {w title} {\n", menu_num ); - printf( "\tcatch {destroy $w}\n" ); + printf( "\tset oldFocus [focus]\n" ); + if ( menu_first[menu_num]->menu_number != 0 ) + printf( "\tcatch {focus .menu%d}\n", + menu_first[menu_num]->menu_number ); + printf( "\tcatch {destroy $w; unregister_active %d}\n", menu_num ); printf( "\ttoplevel $w -class Dialog\n" ); printf( "\twm withdraw $w\n" ); + printf( "\tglobal active_menus\n" ); + printf( "\tset active_menus [lsort -integer [linsert $active_menus end %d]]\n", menu_num ); printf( "\tmessage $w.m -width 400 -aspect 300 -text \\\n" ); printf( "\t\t\"%s\" -relief raised\n", label ); printf( "\tpack $w.m -pady 10 -side top -padx 10\n" ); @@ -127,16 +152,41 @@ /* * Attach the "Prev", "Next" and "OK" buttons at the end of the window. */ - printf( "\tset oldFocus [focus]\n" ); printf( "\tframe $w.f\n" ); - printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" ); - printf( "\t\t-width 15 -command \"destroy $w; focus $oldFocus; update_mainmenu $w\"\n" ); + if ( toplevel ) + printf( "\tbutton $w.f.back -text \"Main Menu\" \\\n" ); + else + printf( "\tbutton $w.f.back -text \"OK\" \\\n" ); + printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d\"\n", + menu_num ); printf( "\tbutton $w.f.next -text \"Next\" \\\n" ); - printf( "\t\t-width 15 -command \" destroy $w; focus $oldFocus; menu%d .menu%d \\\"$title\\\"\"\n", menu_num+1, menu_num+1 ); + printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; " ); + /* + * We are checking which windows should be destroyed and which are + * common parrents with the next one. Remember that menu_num field + * in mainmenu_option record reports number of its *parent* menu. + */ + if ( menu_num < tot_menu_num + && menu_first[menu_num + 1]->menu_number != menu_num ) + { + int to_destr; + + printf( "destroy $w; unregister_active %d; ", menu_num ); + to_destr = menu_first[menu_num]->menu_number; + while ( to_destr > 0 && menu_first[menu_num + 1]->menu_number != to_destr ) + { + printf( "catch {destroy .menu%d}; unregister_active %d; ", + to_destr, to_destr ); + to_destr = menu_first[to_destr]->menu_number; + } + } + printf( "menu%d .menu%d \\\"$title\\\"\"\n", + menu_num+1, menu_num+1 ); if ( menu_num == tot_menu_num ) printf( "\t$w.f.next configure -state disabled\n" ); printf( "\tbutton $w.f.prev -text \"Prev\" \\\n" ); - printf( "\t\t-width 15 -command \" destroy $w; focus $oldFocus; menu%d .menu%d \\\"$title\\\"\"\n", menu_num-1, menu_num-1 ); + printf( "\t\t-width 15 -command \"catch {focus $oldFocus}; destroy $w; unregister_active %d; menu%d .menu%d \\\"$title\\\"\"\n", + menu_num, menu_num-1, menu_num-1 ); if ( menu_num == 1 ) printf( "\t$w.f.prev configure -state disabled\n" ); printf( "\tpack $w.f.back $w.f.next $w.f.prev -side left -expand on\n" ); @@ -177,12 +227,11 @@ * a global declaration so we know whether we need to insert one for a * given function or not. */ -void clear_globalflags( struct kconfig * scfg ) +static void clear_globalflags(void) { - struct kconfig * cfg; - - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) - cfg->global_written = 0; + int i; + for ( i = 1; i <= max_varnum; i++ ) + vartable[i].global_written = 0; } @@ -194,7 +243,7 @@ */ void global( const char *var ) { - printf( "\tglobal %s; vfix %s\n", var, var ); + printf( "\tglobal %s\n", var ); } @@ -207,6 +256,22 @@ int menu_num, int line_num ) { struct condition * cond; + struct dependency * tmp; + struct kconfig * cfg1; + +if ( cfg->token == token_mainmenu_option ) + if ( line_num >= -1 ) + { + if ( cfg->token == token_define_bool || cfg->token == token_define_hex + || cfg->token == token_define_int || cfg->token == token_define_string + || cfg->token == token_define_tristate || cfg->token == token_unset ) + return; + } + else + { + if ( cfg->token == token_string || cfg->token == token_mainmenu_option ) + return; + } /* * First write any global declarations we need for this conditional. @@ -219,14 +284,10 @@ break; case op_variable: - global( cond->str ); - break; - - case op_kvariable: - if ( ! cond->cfg->global_written ) + if ( ! vartable[cond->nameindex].global_written ) { - cond->cfg->global_written = 1; - global( cond->cfg->optionname ); + vartable[cond->nameindex].global_written = 1; + global( vartable[cond->nameindex].name ); } break; } @@ -235,10 +296,10 @@ /* * Now write this option. */ - if ( ! cfg->global_written && cfg->optionname != NULL ) + if ( cfg->nameindex > 0 && ! vartable[cfg->nameindex].global_written ) { - cfg->global_written = 1; - global( cfg->optionname ); + vartable[cfg->nameindex].global_written = 1; + global( vartable[cfg->nameindex].name ); } /* @@ -262,156 +323,310 @@ case op_rparen: printf( ")" ); break; case op_variable: - printf( "$%s", cond->str ); - break; - - case op_kvariable: - printf( "$%s", cond->cfg->optionname ); + printf( "$%s", vartable[cond->nameindex].name ); break; case op_constant: if ( strcmp( cond->str, "y" ) == 0 ) printf( "1" ); else if ( strcmp( cond->str, "n" ) == 0 ) printf( "0" ); else if ( strcmp( cond->str, "m" ) == 0 ) printf( "2" ); + else if ( strcmp( cond->str, "" ) == 0 ) printf( "4" ); else printf( "\"%s\"", cond->str ); break; } } - printf( "} then { " ); + printf( "} then {" ); /* * Generate a procedure call to write the value. * This code depends on procedures in header.tk. */ - switch ( cfg->token ) + if ( line_num >= -1 ) { - default: - printf( " }\n" ); - break; - - case token_bool: - printf( ".menu%d.config.f.x%d.y configure -state normal;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.n configure -state normal;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.l configure -state normal;", - menu_num, line_num ); - printf( "set %s [expr $%s&15];", - cfg->optionname, cfg->optionname ); - printf( "} else { "); - printf( ".menu%d.config.f.x%d.y configure -state disabled;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.n configure -state disabled;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.l configure -state disabled;", - menu_num, line_num ); - printf( "set %s [expr $%s|16];}\n", - cfg->optionname, cfg->optionname ); - break; + switch ( cfg->token ) + { + default: + printf( " }\n" ); + break; - case token_choice_header: - fprintf( stderr, "Internal error on token_choice_header\n" ); - exit( 1 ); + case token_dep_bool: + printf( "\n" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + if ( ! vartable[get_varnum( tmp->name )].global_written ) + { + global( tmp->name ); + } + printf( "\tset tmpvar_dep [effective_dep [list" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + printf( " $%s", tmp->name ); + printf( "]];set %s [sync_bool $%s $tmpvar_dep];", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + printf( "if {$tmpvar_dep != 1} then {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {y};", + menu_num, line_num ); + printf( "} else {" ); + printf( "configure_entry .menu%d.config.f.x%d normal {y};", + menu_num, line_num ); + printf( "}; " ); + case token_bool: + if ( cfg->token == token_bool ) + printf( "\n\t" ); + printf( "configure_entry .menu%d.config.f.x%d normal {n l", + menu_num, line_num ); + if ( cfg->token == token_bool ) + printf( " y" ); + printf( "}" ); + printf( "} else {"); + printf( "configure_entry .menu%d.config.f.x%d disabled {y n l}}\n", + menu_num, line_num ); + break; - case token_choice_item: - fprintf( stderr, "Internal error on token_choice_item\n" ); - exit( 1 ); + case token_choice_header: + printf( "configure_entry .menu%d.config.f.x%d normal {x l}", + menu_num, line_num ); + printf( "} else {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {x l}", + menu_num, line_num ); + printf( "}\n" ); + break; - case token_define_bool: - printf( "set %s %s } \n", - cfg->optionname, cfg->value ); - break; + case token_choice_item: + fprintf( stderr, "Internal error on token_choice_item\n" ); + exit( 1 ); - case token_dep_tristate: - case token_tristate: - if ( cfg->token == token_dep_tristate ) - { - global( cfg->depend ); - printf( "if { $%s != 1 && $%s != 0 } then {", - cfg->depend, cfg->depend ); - printf( ".menu%d.config.f.x%d.y configure -state disabled;", + case token_dep_tristate: + printf( "\n" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + if ( ! vartable[get_varnum( tmp->name )].global_written ) + { + global( tmp->name ); + } + printf( "\tset tmpvar_dep [effective_dep [list" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + printf( " $%s", tmp->name ); + printf( "]];set %s [sync_tristate $%s $tmpvar_dep];", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + printf( "\tif {$tmpvar_dep != 1} then {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {y}", + menu_num, line_num ); + printf( "} else {" ); + printf( "configure_entry .menu%d.config.f.x%d normal {y}", + menu_num, line_num ); + printf( "}; " ); + printf( "if {$tmpvar_dep == 0} then {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {m}", menu_num, line_num ); printf( "} else {" ); - printf( ".menu%d.config.f.x%d.y configure -state normal;", - menu_num, line_num); + printf( "configure_entry .menu%d.config.f.x%d normal {m}", + menu_num, line_num ); printf( "}; " ); - } - else - { - printf( ".menu%d.config.f.x%d.y configure -state normal;", + case token_tristate: + if ( cfg->token == token_tristate ) + { + printf( "\n\tconfigure_entry .menu%d.config.f.x%d normal {y}; ", + menu_num, line_num ); + } + printf( "if {($CONFIG_MODULES == 1)} then {" ); + printf( "configure_entry .menu%d.config.f.x%d normal {m}} else {", + menu_num, line_num ); + printf( "configure_entry .menu%d.config.f.x%d disabled {m}}; ", + menu_num, line_num ); + printf( "configure_entry .menu%d.config.f.x%d normal {n l}", + menu_num, line_num ); + + /* + * Or in a bit to the variable - this causes all of the radiobuttons + * to be deselected (i.e. not be red). + */ + printf( "} else {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {y n m l}}\n", + menu_num, line_num ); + break; + + case token_hex: + case token_int: + case token_string: + printf( ".menu%d.config.f.x%d.x configure -state normal -foreground [ cget .ref -foreground ]; ", + menu_num, line_num ); + printf( ".menu%d.config.f.x%d.l configure -state normal; ", + menu_num, line_num ); + printf( "} else {" ); + printf( ".menu%d.config.f.x%d.x configure -state disabled -foreground [ cget .ref -disabledforeground ]; ", + menu_num, line_num ); + printf( ".menu%d.config.f.x%d.l configure -state disabled}\n", menu_num, line_num ); + break; + + case token_mainmenu_option: + if ( line_num >= 0 ) + { + printf( "configure_entry .menu%d.config.f.x%d normal {m}", + menu_num, line_num ); + printf( "} else {" ); + printf( "configure_entry .menu%d.config.f.x%d disabled {m}}\n", + menu_num, line_num ); + } + else + printf( ".f0.x%d configure -state normal } else { .f0.x%d configure -state disabled }\n", + menu_num, menu_num ); + break; } + } + else + { + switch ( cfg->token ) + { + default: + printf( " }\n" ); + break; + + case token_dep_bool: + printf( "\n" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + if ( ! vartable[get_varnum( tmp->name )].global_written ) + { + global( tmp->name ); + } + printf( "\tset tmpvar_dep [effective_dep [list" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + printf( " $%s", tmp->name ); + printf( "]];set %s [sync_bool $%s $tmpvar_dep];", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + case token_bool: + if ( cfg->token == token_bool ) + printf( "\n\t" ); + printf( "set %s [expr $%s&15]", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + printf( "} else {"); + printf( "set %s [expr $%s|16]}\n", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + break; + + case token_choice_header: + printf( "} else {" ); + for ( cfg1 = cfg->next; + cfg1 != NULL && cfg1->token == token_choice_item; + cfg1 = cfg1->next ) + printf( "set %s 4;", vartable[cfg1->nameindex].name ); + printf( "}\n" ); + break; + + case token_choice_item: + fprintf( stderr, "Internal error on token_choice_item\n" ); + exit( 1 ); + + case token_define_bool: + case token_define_tristate: + if ( ! vartable[get_varnum( cfg->value )].global_written ) + { + global( cfg->value ); + } + printf( "set %s $%s }\n", + vartable[cfg->nameindex].name, cfg->value ); + break; + + case token_define_hex: + case token_define_int: + printf( "set %s %s }\n", + vartable[cfg->nameindex].name, cfg->value ); + break; - printf( ".menu%d.config.f.x%d.n configure -state normal;", - menu_num, line_num ); - printf( "global CONFIG_MODULES; if {($CONFIG_MODULES == 1)} then { .menu%d.config.f.x%d.m configure -state normal };", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.l configure -state normal;", - menu_num, line_num ); + case token_define_string: + printf( "set %s \"%s\" }\n", + vartable[cfg->nameindex].name, cfg->value ); + break; + case token_dep_tristate: + printf( "\n" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + if ( ! vartable[get_varnum( tmp->name )].global_written ) + { + global( tmp->name ); + } + printf( "\tset tmpvar_dep [effective_dep [list" ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + printf( " $%s", tmp->name ); + printf( "]]; set %s [sync_tristate $%s $tmpvar_dep]; ", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + case token_tristate: + if ( cfg->token == token_tristate ) + printf( "if {($CONFIG_MODULES == 0) && ($%s == 2)} then {set %s 1}; ", + vartable[cfg->nameindex].name, + vartable[cfg->nameindex].name ); /* * Or in a bit to the variable - this causes all of the radiobuttons * to be deselected (i.e. not be red). */ - printf( "set %s [expr $%s&15];", - cfg->optionname, cfg->optionname ); - printf( "} else { " ); - printf( ".menu%d.config.f.x%d.y configure -state disabled;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.n configure -state disabled;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.m configure -state disabled;", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.l configure -state disabled;", - menu_num, line_num ); + printf( "set %s [expr $%s&15]", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + printf( "} else {" ); /* * Clear the disable bit to enable the correct radiobutton. */ - printf( "set %s [expr $%s|16];}\n", - cfg->optionname, cfg->optionname ); - break; + printf( "set %s [expr $%s|16]}\n", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + break; - case token_hex: - case token_int: - case token_string: - printf( ".menu%d.config.f.x%d.x configure -state normal -foreground [ cget .ref -foreground ]; ", - menu_num, line_num); - printf( ".menu%d.config.f.x%d.l configure -state normal; ", - menu_num, line_num); - printf( "} else { " ); - printf( ".menu%d.config.f.x%d.x configure -state disabled -foreground [ cget .ref -disabledforeground ];", - menu_num, line_num ); - printf( ".menu%d.config.f.x%d.l configure -state disabled;}\n", - menu_num, line_num ); - break; + case token_hex: + case token_int: + if ( cfg->value && *cfg->value == '$' ) + { + int index = get_varnum( cfg->value+1 ); + printf( "\n" ); + if ( ! vartable[index].global_written ) + { + global( vartable[index].name ); + } + printf( "\t" ); + } + if ( cfg->token == token_hex ) + printf( "validate_hex " ); + else if ( cfg->token == token_int ) + printf( "validate_int " ); + printf( "%s \"$%s\" %s}\n", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name, + cfg->value ); + break; - case token_mainmenu_option: - printf( ".f0.x%d configure -state normal } else { .f0.x%d configure -state disabled }\n", - menu_num, menu_num ); - break; + case token_unset: + printf( "set %s 4}\n", vartable[cfg->nameindex].name ); + break; + } } } - /* * Generate a line that writes a variable to the output file. */ void generate_writeconfig( struct kconfig * cfg ) { struct condition * cond; - + struct dependency * tmp; + /* * Generate global declaration for this symbol. */ if ( cfg->token != token_comment ) { - if ( ! cfg->global_written ) + if ( cfg->nameindex > 0 && ! vartable[cfg->nameindex].global_written ) + { + vartable[cfg->nameindex].global_written = 1; + global( vartable[cfg->nameindex].name ); + } + if ( cfg->token == token_define_tristate || cfg->token == token_define_bool ) + { + if ( ! vartable[get_varnum( cfg->value )].global_written ) + { + vartable[get_varnum( cfg->value )].global_written = 1; + global( cfg->value ); + } + } + else if ( cfg->nameindex <= 0 && cfg->token == token_choice_header ) { - cfg->global_written = 1; - printf( "\tglobal %s\n", cfg->optionname ); + printf( "\tglobal tmpvar_%d\n", -(cfg->nameindex) ); } } @@ -426,14 +641,10 @@ break; case op_variable: - global( cond->str ); - break; - - case op_kvariable: - if ( ! cond->cfg->global_written ) + if ( ! vartable[cond->nameindex].global_written ) { - cond->cfg->global_written = 1; - global( cond->cfg->optionname ); + vartable[cond->nameindex].global_written = 1; + global( vartable[cond->nameindex].name ); } break; } @@ -442,7 +653,6 @@ /* * Generate indentation. */ - if ( cfg->token != token_choice_header ) printf( "\t" ); /* @@ -466,17 +676,14 @@ case op_rparen: printf( ")" ); break; case op_variable: - printf( "$%s", cond->str ); - break; - - case op_kvariable: - printf( "$%s", cond->cfg->optionname ); + printf( "$%s", vartable[cond->nameindex].name ); break; case op_constant: if ( strcmp( cond->str, "n" ) == 0 ) printf( "0" ); else if ( strcmp( cond->str, "y" ) == 0 ) printf( "1" ); else if ( strcmp( cond->str, "m" ) == 0 ) printf( "2" ); + else if ( strcmp( cond->str, "" ) == 0 ) printf( "4" ); else printf( "\"%s\"", cond->str ); break; @@ -499,10 +706,8 @@ case token_bool: case token_tristate: - if ( cfg->cond ) - printf( " " ); - printf( "write_tristate $cfg $autocfg %s $%s $notmod", - cfg->optionname, cfg->optionname ); + printf( "write_tristate $cfg $autocfg %s $%s [list $notmod]", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); if ( cfg->cond != NULL ) printf( " }" ); printf( "\n" ); @@ -520,12 +725,15 @@ cfg1 != NULL && cfg1->token == token_choice_item; cfg1 = cfg1->next ) { - printf("\tif { $%s == \"%s\" } then { write_tristate $cfg $autocfg %s 1 $notmod } else { write_tristate $cfg $autocfg %s 0 $notmod }\n", - cfg->optionname, cfg1->label, - cfg1->optionname, - cfg1->optionname ); + printf("\n\tif { $tmpvar_%d == \"%s\" } then { write_tristate $cfg $autocfg %s 1 [list $notmod] } else { write_tristate $cfg $autocfg %s 0 [list $notmod] }", + -(cfg->nameindex), cfg1->label, + vartable[cfg1->nameindex].name, + vartable[cfg1->nameindex].name ); } } + if ( cfg->cond != NULL ) + printf( "}" ); + printf( "\n" ); break; case token_choice_item: @@ -541,53 +749,74 @@ break; case token_define_bool: + case token_define_tristate: if ( cfg->cond == NULL ) { - printf( "write_tristate $cfg $autocfg %s $%s $notmod\n", - cfg->optionname, cfg->optionname ); + printf( "write_tristate $cfg $autocfg %s $%s [list $notmod]\n", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); } else { - printf( "write_tristate $cfg $autocfg %s %s $notmod }\n", - cfg->optionname, cfg->value ); + printf( "write_tristate $cfg $autocfg %s $%s [list $notmod] }\n", + vartable[cfg->nameindex].name, cfg->value ); } break; + case token_dep_bool: case token_dep_tristate: - if ( cfg->cond ) - printf( " " ); - printf( "write_tristate $cfg $autocfg %s $%s $%s", - cfg->optionname, cfg->optionname, cfg->depend ); + printf( "write_tristate $cfg $autocfg %s $%s [list", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + for ( tmp = cfg->depend; tmp; tmp = tmp->next ) + printf( " $%s", tmp->name ); + printf( "]" ); if ( cfg->cond != NULL ) printf( " }" ); - printf( " \n" ); + printf( "\n" ); break; - case token_hex: + case token_define_hex: + printf( "write_hex $cfg $autocfg %s %s $notmod", + vartable[cfg->nameindex].name, cfg->value ); + if ( cfg->cond != NULL ) + printf( " }" ); + printf( "\n" ); + break; + + case token_define_int: + printf( "write_int $cfg $autocfg %s %s $notmod", + vartable[cfg->nameindex].name, cfg->value ); + if ( cfg->cond != NULL ) + printf( " }" ); + printf( "\n" ); + break; + + case token_define_string: + printf( "write_string $cfg $autocfg %s \"%s\" $notmod", + vartable[cfg->nameindex].name, cfg->value ); if ( cfg->cond != NULL ) - printf( " " ); + printf( " }" ); + printf( "\n" ); + break; + + case token_hex: printf( "write_hex $cfg $autocfg %s $%s $notmod", - cfg->optionname, cfg->optionname ); + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); if ( cfg->cond != NULL ) printf( " }" ); printf( "\n" ); break; case token_int: - if ( cfg->cond != NULL ) - printf( " " ); printf( "write_int $cfg $autocfg %s $%s $notmod", - cfg->optionname, cfg->optionname ); + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); if ( cfg->cond != NULL ) printf( " }" ); printf( "\n" ); break; case token_string: - if ( cfg->cond != NULL ) - printf( " " ); - printf( "write_string $cfg $autocfg %s $%s $notmod", - cfg->optionname, cfg->optionname ); + printf( "write_string $cfg $autocfg %s \"$%s\" $notmod", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); if ( cfg->cond != NULL ) printf( " }" ); printf( "\n" ); @@ -595,6 +824,108 @@ } } +static void generate_update_var( struct kconfig * scfg, int menu_num ) +{ + struct kconfig * cfg; + + if ( menu_num>0 ) + printf( "proc update_define_menu%d {} {\n", menu_num ); + clear_globalflags(); + global( "CONFIG_MODULES" ); + vartable[ get_varnum( "CONFIG_MODULES" ) ].global_written = 1; + for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) + { + if ( cfg->menu_number == menu_num && (cfg->token == token_define_bool || cfg->token == token_define_tristate + || cfg->token == token_define_hex || cfg->token == token_define_int + || cfg->token == token_define_string || cfg->token == token_unset + || cfg->token == token_tristate) ) + { + if ( ! vartable[cfg->nameindex].global_written ) + { + vartable[cfg->nameindex].global_written = 1; + global( vartable[cfg->nameindex].name ); + } + } + } + + for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) + { + char tmp[20]; + struct kconfig * cfg1; + + if ( cfg->menu_number == menu_num ) + { + switch ( cfg->token ) + { + default: + case token_choice_item: + break; + case token_choice_header: + sprintf( tmp, "tmpvar_%d", -(cfg->nameindex) ); + global( tmp ); + for ( cfg1 = cfg->next; + cfg1 != NULL && cfg1->token == token_choice_item; + cfg1 = cfg1->next ) + { + vartable[cfg1->nameindex].global_written = 1; + global( vartable[cfg1->nameindex].name ); + printf( "\tif {$tmpvar_%d == \"%s\"} then {set %s 1} else {set %s 0}\n", + -(cfg->nameindex), cfg1->label, + vartable[cfg1->nameindex].name, + vartable[cfg1->nameindex].name ); + } + break; + case token_bool: + case token_define_bool: + case token_define_tristate: + case token_define_hex: + case token_define_int: + case token_define_string: + case token_dep_bool: + case token_dep_tristate: + case token_int: + case token_hex: + case token_mainmenu_option: + case token_tristate: + case token_unset: + if ( cfg->cond != NULL ) + generate_if( cfg, cfg->cond, menu_num, -2 ); + else switch ( cfg->token ) + { + case token_tristate: + printf( "\n\tif {($CONFIG_MODULES == 0)} then {if {($%s == 2)} then {set %s 1}}\n", + vartable[cfg->nameindex].name, vartable[cfg->nameindex].name ); + break; + case token_define_bool: + case token_define_tristate: + if ( ! vartable[get_varnum( cfg->value )].global_written ) + { + vartable[get_varnum( cfg->value )].global_written = 1; + global( cfg->value ); + } + printf( "\tset %s $%s\n", vartable[cfg->nameindex].name, + cfg->value ); + break; + case token_define_hex: + case token_define_int: + printf( "\tset %s %s\n", vartable[cfg->nameindex].name, + cfg->value ); + break; + case token_define_string: + printf( "\tset %s \"%s\"\n", vartable[cfg->nameindex].name, + cfg->value ); + break; + case token_unset: + printf( "\tset %s 4\n", vartable[cfg->nameindex].name ); + default: + break; + } + } + } + } + if ( menu_num>0 ) + printf( "}\n\n\n" ); +} /* @@ -603,13 +934,24 @@ static void end_proc( struct kconfig * scfg, int menu_num ) { struct kconfig * cfg; + int i; printf( "\n\n\n" ); printf( "\tfocus $w\n" ); - printf( "\tupdate_menu%d $w.config.f\n", - menu_num ); + printf( "\tupdate_active\n" ); printf( "\tglobal winx; global winy\n" ); - printf( "\tset winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]\n" ); + if ( menu_first[menu_num]->menu_number != 0 ) + { + printf( "\tif {[winfo exists .menu%d] == 0} then ", + menu_first[menu_num]->menu_number ); + printf( "{menu%d .menu%d \"%s\"}\n", + menu_first[menu_num]->menu_number, menu_first[menu_num]->menu_number, + menu_first[menu_first[menu_num]->menu_number]->label ); + printf( "\tset winx [expr [winfo x .menu%d]+30]; set winy [expr [winfo y .menu%d]+30]\n", + menu_first[menu_num]->menu_number, menu_first[menu_num]->menu_number ); + } + else + printf( "\tset winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]\n" ); printf( "\twm geometry $w +$winx+$winy\n" ); /* @@ -660,27 +1002,12 @@ * widgets, and will be called first when the window is mapped, * and each time one of the buttons in the window are clicked. */ - printf( "proc update_menu%d {w} {\n", menu_num ); - printf( "\tupdate_define\n" ); + printf( "proc update_menu%d {} {\n", menu_num ); /* * Clear all of the booleans that are defined in this menu. */ - clear_globalflags( scfg ); - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) - { - if ( cfg->menu_number == menu_num && cfg->token == token_define_bool - && cfg->optionname != NULL ) - { - if ( ! cfg->global_written ) - { - cfg->global_written = 1; - printf( "\tglobal %s\n", cfg->optionname ); - printf( "\tset %s 0\n", cfg->optionname ); - } - } - } - + clear_globalflags(); for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) { if ( cfg->menu_number == menu_num @@ -688,28 +1015,47 @@ && cfg->token != token_choice_item ) { if ( cfg->cond != NULL ) + { + int i; + if ( (cfg->token == token_tristate || cfg->token == token_dep_tristate) + && ! vartable[i = get_varnum( "CONFIG_MODULES" )].global_written ) + { + global( "CONFIG_MODULES" ); + vartable[i].global_written = 1; + } generate_if( cfg, cfg->cond, cfg->menu_number, cfg->menu_line ); + } else { - /* - * Treat tristate like conditional here. - */ - if ( cfg->token == token_dep_tristate ) + if ( cfg->token == token_tristate ) { - global( cfg->depend ); - printf( "\tif {$%s != 1 && $%s != 0 } then { .menu%d.config.f.x%d.y configure -state disabled } else { .menu%d.config.f.x%d.y configure -state normal}\n", - cfg->depend, cfg->depend, + if ( ! vartable[cfg->nameindex].global_written ) + { + vartable[cfg->nameindex].global_written = 1; + printf( "\tglobal %s\n", vartable[cfg->nameindex].name ); + } + if ( ! vartable[i = get_varnum( "CONFIG_MODULES" )].global_written ) + { + global( "CONFIG_MODULES" ); + vartable[i].global_written = 1; + } + printf( "\n\tif {($CONFIG_MODULES == 1)} then {configure_entry .menu%d.config.f.x%d normal {m}} else {configure_entry .menu%d.config.f.x%d disabled {m}}\n", menu_num, cfg->menu_line, menu_num, cfg->menu_line ); } } } + else if ( cfg->token == token_mainmenu_option + && cfg->menu_number == menu_num + && cfg->cond != NULL ) + { + generate_if( cfg, cfg->cond, menu_num, cfg->menu_line ); + } } - printf("}\n\n\n"); -} - + generate_update_var( scfg, menu_num ); +} /* * This is the top level function for generating the tk script. @@ -718,18 +1064,20 @@ { int menu_depth; int menu_num [64]; - struct kconfig * menu_first [256]; - struct kconfig * menu_last [256]; - int imenu; + int imenu, i; + int top_level_num = 0; struct kconfig * cfg; struct kconfig * cfg1 = NULL; const char * name = "No Name"; /* - * Thread the menu pointers so I can walk each menu separately. - */ + * Mark begin and end of each menu so I can omit submenus when walking + * over a parent menu. + */ tot_menu_num = 0; menu_depth = 0; + menu_num [0] = 0; + for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) { switch ( cfg->token ) @@ -744,14 +1092,22 @@ case token_mainmenu_option: if ( ++menu_depth >= 64 ) { fprintf( stderr, "menus too deep\n" ); exit( 1 ); } - if ( ++tot_menu_num >= 256 ) + if ( ++tot_menu_num >= 100 ) { fprintf( stderr, "too many menus\n" ); exit( 1 ); } menu_num [menu_depth] = tot_menu_num; menu_first [tot_menu_num] = cfg; menu_last [tot_menu_num] = cfg; + /* + * Note, that menu_number is set to the number of parent + * (upper level) menu. + */ + cfg->menu_number = menu_num[menu_depth - 1]; + if ( menu_depth == 1 ) + ++top_level_num; break; case token_endmenu: + menu_last [menu_num [menu_depth]] = cfg; /* flatten menus with proper scoping */ if ( --menu_depth < 0 ) { fprintf( stderr, "unmatched endmenu\n" ); exit( 1 ); } @@ -760,19 +1116,24 @@ case token_bool: case token_choice_header: case token_choice_item: + case token_dep_bool: case token_dep_tristate: case token_hex: case token_int: case token_string: case token_tristate: + cfg->menu_number = menu_num[menu_depth]; if ( menu_depth == 0 ) { fprintf( stderr, "statement not in menu\n" ); exit( 1 ); } - menu_last [menu_num [menu_depth]]->menu_next = cfg; - menu_last [menu_num [menu_depth]] = cfg; - cfg->menu_next = NULL; break; case token_define_bool: + case token_define_hex: + case token_define_int: + case token_define_string: + case token_define_tristate: + case token_unset: + cfg->menu_number = menu_num[menu_depth]; break; } } @@ -784,7 +1145,21 @@ * one blank button * add two to round up for division */ - printf( "set menus_per_column %d\n\n", (tot_menu_num + 4 + 1 + 2) / 3 ); + printf( "set menus_per_column %d\n", (top_level_num + 4 + 1 + 2) / 3 ); + printf( "set total_menus %d\n\n", tot_menu_num ); + + printf( "proc toplevel_menu {num} {\n" ); + for ( imenu = 1; imenu <= tot_menu_num; ++imenu ) + { + int parent = 1; + + if ( menu_first[imenu]->menu_number == 0 ) + parent = menu_first[imenu]->menu_number; + else + printf( "\tif {$num == %d} then {return %d}\n", + imenu, menu_first[imenu]->menu_number ); + } + printf( "\treturn $num\n}\n\n" ); /* * Generate the menus. @@ -793,24 +1168,33 @@ for ( imenu = 1; imenu <= tot_menu_num; ++imenu ) { int menu_line = 0; + int nr_submenu = imenu; - clear_globalflags( scfg ); - start_proc( menu_first[imenu]->label, imenu, 1 ); + clear_globalflags(); + start_proc( menu_first[imenu]->label, imenu, + !menu_first[imenu]->menu_number ); - for ( cfg = menu_first[imenu]; cfg != NULL; cfg = cfg->menu_next ) + for ( cfg = menu_first[imenu]->next; cfg != NULL && cfg != menu_last[imenu]; cfg = cfg->next ) { - cfg->menu_number = imenu; - switch ( cfg->token ) { default: break; + case token_mainmenu_option: + while ( menu_first[++nr_submenu]->menu_number > imenu ) + ; + cfg->menu_line = menu_line++; + printf( "\tsubmenu $w.config.f %d %d \"%s\" %d\n", + cfg->menu_number, cfg->menu_line, cfg->label, nr_submenu ); + cfg = menu_last[nr_submenu]; + break; + case token_bool: cfg->menu_line = menu_line++; printf( "\tbool $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname ); + vartable[cfg->nameindex].name ); break; case token_choice_header: @@ -819,54 +1203,61 @@ * help text from Documentation/Configure.help. */ cfg->menu_line = menu_line++; - printf( "\tglobal %s\n", cfg->optionname ); - printf( "\tminimenu $w.config.f %d %d \"%s\" %s %s\n", + printf( "\tglobal tmpvar_%d\n", -(cfg->nameindex) ); + printf( "\tminimenu $w.config.f %d %d \"%s\" tmpvar_%d %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname, cfg->next->optionname ); + -(cfg->nameindex), vartable[cfg->next->nameindex].name ); printf( "\tmenu $w.config.f.x%d.x.menu\n", cfg->menu_line ); cfg1 = cfg; break; case token_choice_item: /* note: no menu line; uses choice header menu line */ - printf( "\t$w.config.f.x%d.x.menu add radiobutton -label \"%s\" -variable %s -value \"%s\" -command \"update_menu%d .menu%d.config.f\"\n", - cfg1->menu_line, cfg->label, cfg1->optionname, - cfg->label, cfg1->menu_number, cfg1->menu_number ); + printf( "\t$w.config.f.x%d.x.menu add radiobutton -label \"%s\" -variable tmpvar_%d -value \"%s\" -command \"update_active\"\n", + cfg1->menu_line, cfg->label, -(cfg1->nameindex), + cfg->label ); + break; + + case token_dep_bool: + cfg->menu_line = menu_line++; + printf( "\tdep_bool $w.config.f %d %d \"%s\" %s\n", + cfg->menu_number, cfg->menu_line, cfg->label, + vartable[cfg->nameindex].name ); break; case token_dep_tristate: cfg->menu_line = menu_line++; - printf( "\tdep_tristate $w.config.f %d %d \"%s\" %s %s\n", + printf( "\tdep_tristate $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname, cfg->depend ); + vartable[cfg->nameindex].name ); break; case token_hex: cfg->menu_line = menu_line++; printf( "\thex $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname ); + vartable[cfg->nameindex].name ); break; case token_int: cfg->menu_line = menu_line++; printf( "\tint $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname ); + vartable[cfg->nameindex].name ); break; case token_string: cfg->menu_line = menu_line++; printf( "\tistring $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname ); + vartable[cfg->nameindex].name ); break; case token_tristate: cfg->menu_line = menu_line++; printf( "\ttristate $w.config.f %d %d \"%s\" %s\n", cfg->menu_number, cfg->menu_line, cfg->label, - cfg->optionname ); + vartable[cfg->nameindex].name ); break; } } @@ -880,31 +1271,16 @@ * the top level menu, and this procedure will ensure that things are * correct. */ - clear_globalflags( scfg ); - printf( "proc update_mainmenu {w} {\n" ); - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) + clear_globalflags(); + printf( "proc update_mainmenu {} {\n" ); + for ( imenu = 1; imenu <= tot_menu_num; imenu++ ) { - if ( cfg->token == token_mainmenu_option && cfg->cond != NULL ) - generate_if( cfg, cfg->cond, cfg->menu_number, cfg->menu_line ); + if ( menu_first[imenu]->cond != NULL && menu_first[imenu]->menu_number == 0 ) + generate_if( menu_first[imenu], menu_first[imenu]->cond, imenu, -1 ); } printf( "}\n\n\n" ); -#if 0 - /* - * Generate code to set the variables that are "defined". - */ - for ( cfg = config; cfg != NULL; cfg = cfg->next ) - { - if ( cfg->token == token_define_bool ) - { - if ( cfg->cond != NULL ) - generate_if( cfg, cfg->cond, menu_num, cfg->menu_line ); - else - printf( "\twrite_define %s %s\n", cfg->optionname, cfg->value ); - } - } - #endif - + clear_globalflags(); /* * Generate code to load the default settings into the variables. * The script in tail.tk will attempt to load .config, @@ -919,27 +1295,50 @@ case token_bool: case token_choice_item: + case token_dep_bool: case token_dep_tristate: case token_tristate: - printf( "set %s 0\n", cfg->optionname ); + if ( ! vartable[cfg->nameindex].global_written ) + { + printf( "set %s 0\n", vartable[cfg->nameindex].name ); + vartable[cfg->nameindex].global_written = 1; + } break; case token_choice_header: - printf( "set %s \"(not set)\"\n", cfg->optionname ); + printf( "set tmpvar_%d \"(not set)\"\n", -(cfg->nameindex) ); break; case token_hex: case token_int: - printf( "set %s %s\n", cfg->optionname, cfg->value ? cfg->value : "0"); + if ( ! vartable[cfg->nameindex].global_written ) + { + printf( "set %s %s\n", vartable[cfg->nameindex].name, cfg->value ? cfg->value : "0" ); + vartable[cfg->nameindex].global_written = 1; + } break; case token_string: - printf( "set %s \"%s\"\n", cfg->optionname, cfg->value ? cfg->value : ""); + if ( ! vartable[cfg->nameindex].global_written ) + { + printf( "set %s \"%s\"\n", vartable[cfg->nameindex].name, cfg->value ); + vartable[cfg->nameindex].global_written = 1; + } break; } } /* + * Define to an empty value all other variables (which are never defined) + */ + for ( i = 1; i <= max_varnum; i++ ) + { + if ( ! vartable[i].global_written + && strncmp( vartable[i].name, "CONSTANT_", 9 ) ) + printf( "set %s 4\n", vartable[i].name ); + } + + /* * Generate a function to write all of the variables to a file. */ printf( "proc writeconfig {file1 file2} {\n" ); @@ -956,7 +1355,7 @@ printf( "\tputs $autocfg \" */\"\n" ); printf( "\tputs $autocfg \"#define AUTOCONF_INCLUDED\"\n" ); - clear_globalflags( scfg ); + clear_globalflags(); for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) { switch ( cfg->token ) @@ -968,6 +1367,11 @@ case token_choice_header: case token_comment: case token_define_bool: + case token_define_hex: + case token_define_int: + case token_define_string: + case token_define_tristate: + case token_dep_bool: case token_dep_tristate: case token_hex: case token_int: @@ -996,7 +1400,8 @@ cfg1 = cfg1->next ) { printf( "\tglobal %s; set %s 0\n", - cfg1->optionname, cfg1->optionname ); + vartable[cfg1->nameindex].name, + vartable[cfg1->nameindex].name ); } } } @@ -1007,41 +1412,28 @@ { if ( cfg->token == token_choice_header ) { - printf( "\tglobal %s\n", cfg->optionname ); + printf( "\tglobal tmpvar_%d\n", -(cfg->nameindex) ); + printf("\tset tmpvar_%d \"%s\"\n", -(cfg->nameindex), cfg->value); for ( cfg1 = cfg->next; cfg1 != NULL && cfg1->token == token_choice_item; cfg1 = cfg1->next ) { - printf( "\tglobal %s\n", cfg1->optionname ); - printf( "\tif { $%s == 1 } then { set %s \"%s\" }\n", - cfg1->optionname, cfg->optionname, cfg1->label ); + printf( "\tglobal %s\n", vartable[cfg1->nameindex].name ); + printf( "\tif { $%s == 1 } then { set tmpvar_%d \"%s\" }\n", + vartable[cfg1->nameindex].name, + -(cfg->nameindex), cfg1->label ); } } } printf( "}\n\n\n" ); - printf( "proc update_define { } {\n" ); - clear_globalflags( scfg ); - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) +/* printf( "proc update_define {} {\n" ); + generate_update_var( scfg, 0 ); + for ( i = 1; i <= tot_menu_num; i++ ) { - if ( cfg->token == token_define_bool ) - { - cfg->global_written = 1; - printf( "\tglobal %s\n", cfg->optionname ); - } + printf( "\tupdate_define_menu%d; if { update\n", i ); } - - for ( cfg = scfg; cfg != NULL; cfg = cfg->next ) - { - if( cfg->token == token_define_bool ) - { - if ( cfg->cond == NULL ) - printf( "\tset %s %s\n", cfg->optionname, cfg->value ); - else - generate_if( cfg, cfg->cond, -1, 0 ); - } - } - printf( "}\n\n\n" ); + printf( "}\n\n\n" );*/ /* * That's it. We are done. The output of this file will have header.tk Binary files linux.vanilla/scripts/tkparse and linux.ac/scripts/tkparse differ diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/tkparse.c linux.ac/scripts/tkparse.c --- linux.vanilla/scripts/tkparse.c Sun May 2 17:51:16 1999 +++ linux.ac/scripts/tkparse.c Tue Sep 14 20:59:14 1999 @@ -29,6 +29,17 @@ * 23 January 1999, Michael Elizabeth Chastain, * - Remove bug-compatible code. * + * 07 July 1999, Andrzej M. Krzysztofowicz, + * - Submenus implemented, + * - plenty of option updating/displaying fixes, + * - dep_bool, define_hex, define_int, define_string, define_tristate and + * undef implemented, + * - dep_tristate fixed to support multiple dependencies, + * - handling of variables with an empty value implemented, + * - value checking for int and hex fields, + * - more checking during condition parsing; choice variables are treated as + * all others now, + * * TO DO: * - xconfig is at the end of its life cycle. Contact if * you are interested in working on the replacement. @@ -51,8 +62,6 @@ int my_strcmp( const char * s1, const char * s2 ) { return strcmp( s1, s2 ); } #define strcmp my_strcmp - - /* * Report a syntax error. */ @@ -65,6 +74,30 @@ /* + * Find index of a specyfic variable in the symbol table. + * Create a new entry if it does not exist yet. + */ +#define VARTABLE_SIZE 2048 +struct variable vartable[VARTABLE_SIZE]; +int max_varnum = 0; + +int get_varnum( char * name ) +{ + int i; + + for ( i = 1; i <= max_varnum; i++ ) + if ( strcmp( vartable[i].name, name ) == 0 ) + return i; + if (max_varnum > VARTABLE_SIZE-1) + syntax_error( "Too many variables defined." ); + vartable[++max_varnum].name = malloc( strlen( name )+1 ); + strcpy( vartable[max_varnum].name, name ); + return max_varnum; +} + + + +/* * Get a string. */ static const char * get_string( const char * pnt, char ** label ) @@ -138,6 +171,7 @@ } + /* * Tokenize an 'if' statement condition. */ @@ -145,6 +179,7 @@ { struct condition * list; struct condition * last; + struct condition * prev; /* eat the open bracket */ while ( *pnt == ' ' || *pnt == '\t' ) @@ -170,30 +205,53 @@ cond = malloc( sizeof(*cond) ); memset( cond, 0, sizeof(*cond) ); if ( last == NULL ) - { list = last = cond; } + { list = last = cond; prev = NULL; } else - { last->next = cond; last = cond; } + { prev = last; last->next = cond; last = cond; } /* determine the token value */ if ( *pnt == '-' && pnt[1] == 'a' ) - { cond->op = op_and; pnt += 2; continue; } + { + if ( ! prev || ( prev->op != op_variable && prev->op != op_constant ) ) + syntax_error( "incorrect argument" ); + cond->op = op_and; pnt += 2; continue; + } if ( *pnt == '-' && pnt[1] == 'o' ) - { cond->op = op_or; pnt += 2; continue; } + { + if ( ! prev || ( prev->op != op_variable && prev->op != op_constant ) ) + syntax_error( "incorrect argument" ); + cond->op = op_or; pnt += 2; continue; + } if ( *pnt == '!' && pnt[1] == '=' ) - { cond->op = op_neq; pnt += 2; continue; } + { + if ( ! prev || ( prev->op != op_variable && prev->op != op_constant ) ) + syntax_error( "incorrect argument" ); + cond->op = op_neq; pnt += 2; continue; + } if ( *pnt == '=' ) - { cond->op = op_eq; pnt += 1; continue; } + { + if ( ! prev || ( prev->op != op_variable && prev->op != op_constant ) ) + syntax_error( "incorrect argument" ); + cond->op = op_eq; pnt += 1; continue; + } if ( *pnt == '!' ) - { cond->op = op_bang; pnt += 1; continue; } + { + if ( prev && ( prev->op != op_and && prev->op != op_or + && prev->op != op_bang ) ) + syntax_error( "incorrect argument" ); + cond->op = op_bang; pnt += 1; continue; + } if ( *pnt == '"' ) { const char * word; + if ( prev && ( prev->op == op_variable || prev->op == op_constant ) ) + syntax_error( "incorrect argument" ); /* advance to the word */ pnt++; if ( *pnt == '$' ) @@ -217,7 +275,15 @@ char * str = malloc( pnt - word + 1 ); memcpy( str, word, pnt - word ); str [pnt - word] = '\0'; - cond->str = str; + if ( cond->op == op_variable ) + { + cond->nameindex = get_varnum( str ); + free( str ); + } + else /* op_constant */ + { + cond->str = str; + } } pnt++; @@ -241,6 +307,7 @@ for ( ; ; ) { struct kconfig * cfg; + char * buffer = malloc( 64 ); /* skip whitespace */ while ( *pnt == ' ' || *pnt == '\t' ) @@ -262,7 +329,8 @@ pnt = get_string( pnt, &cfg->label ); while ( *pnt == ' ' || *pnt == '\t' ) pnt++; - pnt = get_string( pnt, &cfg->optionname ); + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); } return pnt; @@ -270,8 +338,6 @@ - - /* * Tokenize one line. */ @@ -280,6 +346,8 @@ static struct kconfig * last_menuoption = NULL; enum e_token token; struct kconfig * cfg; + struct dependency ** dep_ptr; + char * buffer = malloc( 64 ); /* skip white space */ while ( *pnt == ' ' || *pnt == '\t' ) @@ -313,6 +381,11 @@ case 'd': match_token( token_define_bool, "define_bool" ); + match_token( token_define_hex, "define_hex" ); + match_token( token_define_int, "define_int" ); + match_token( token_define_string, "define_string" ); + match_token( token_define_tristate, "define_tristate" ); + match_token( token_dep_bool, "dep_bool" ); match_token( token_dep_tristate, "dep_tristate" ); break; @@ -371,11 +444,13 @@ syntax_error( "bogus 'then'" ); } +#if 0 if ( token == token_unset ) { fprintf( stderr, "Ignoring 'unset' command\n" ); return; } +#endif if ( token == token_UNKNOWN ) syntax_error( "unknown command" ); @@ -404,8 +479,9 @@ case token_bool: case token_tristate: - pnt = get_qstring ( pnt, &cfg->label ); - pnt = get_string ( pnt, &cfg->optionname ); + pnt = get_qstring ( pnt, &cfg->label ); + pnt = get_string ( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); break; case token_choice_header: @@ -417,9 +493,7 @@ pnt = get_qstring ( pnt, &choice_list ); pnt = get_string ( pnt, &cfg->value ); - cfg->optionname = malloc( 32 ); - sprintf( cfg->optionname, "tmpvar_%d", choose_number++ ); - + cfg->nameindex = -(choose_number++); tokenize_choices( cfg, choice_list ); free( choice_list ); } @@ -436,56 +510,133 @@ break; case token_define_bool: - pnt = get_string( pnt, &cfg->optionname ); + case token_define_tristate: + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); while ( *pnt == ' ' || *pnt == '\t' ) pnt++; - if ( *pnt == 'n' || *pnt == 'N' ) cfg->value = "0"; - else if ( *pnt == 'y' || *pnt == 'Y' ) cfg->value = "1"; - else if ( *pnt == 'm' || *pnt == 'M' ) cfg->value = "2"; + if ( ( pnt[0] == 'Y' || pnt[0] == 'M' || pnt[0] == 'N' + || pnt[0] == 'y' || pnt[0] == 'm' || pnt[0] == 'n' ) + && ( pnt[1] == '\0' || pnt[1] == ' ' || pnt[1] == '\t' ) ) + { + if ( *pnt == 'n' || *pnt == 'N' ) cfg->value = strdup( "CONSTANT_N" ); + else if ( *pnt == 'y' || *pnt == 'Y' ) cfg->value = strdup( "CONSTANT_Y" ); + else if ( *pnt == 'm' || *pnt == 'M' ) cfg->value = strdup( "CONSTANT_M" ); + } + else if ( *pnt == '$' ) + { + pnt++; + pnt = get_string( pnt, &cfg->value ); + } else { syntax_error( "unknown define_bool value" ); } + get_varnum( cfg->value ); + break; + + case token_define_hex: + case token_define_int: + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + pnt = get_string( pnt, &cfg->value ); break; + case token_define_string: + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + pnt = get_qstring( pnt, &cfg->value ); + break; + + case token_dep_bool: case token_dep_tristate: - pnt = get_qstring ( pnt, &cfg->label ); - pnt = get_string ( pnt, &cfg->optionname ); + pnt = get_qstring ( pnt, &cfg->label ); + pnt = get_string ( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); while ( *pnt == ' ' || *pnt == '\t' ) pnt++; - if ( ( pnt[0] == 'Y' || pnt[0] == 'M' || pnt[0] == 'N' - || pnt[0] == 'y' || pnt[0] == 'm' || pnt[0] == 'n' ) - && ( pnt[1] == '\0' || pnt[1] == ' ' || pnt[1] == '\t' ) ) - { - /* dep_tristate 'foo' CONFIG_FOO m */ - if ( pnt[0] == 'Y' || pnt[0] == 'y' ) - cfg->depend = strdup( "CONSTANT_Y" ); - else if ( pnt[0] == 'M' || pnt[0] == 'm' ) - cfg->depend = strdup( "CONSTANT_M" ); + dep_ptr = &(cfg->depend); + + do { + *dep_ptr = (struct dependency *) malloc( sizeof( struct dependency ) ); + (*dep_ptr)->next = NULL; + + if ( ( pnt[0] == 'Y' || pnt[0] == 'M' || pnt[0] == 'N' + || pnt[0] == 'y' || pnt[0] == 'm' || pnt[0] == 'n' ) + && ( pnt[1] == '\0' || pnt[1] == ' ' || pnt[1] == '\t' ) ) + { + /* dep_tristate 'foo' CONFIG_FOO m */ + if ( pnt[0] == 'Y' || pnt[0] == 'y' ) + (*dep_ptr)->name = strdup( "CONSTANT_Y" ); + else if ( pnt[0] == 'N' || pnt[0] == 'n' ) + (*dep_ptr)->name = strdup( "CONSTANT_N" ); + else + (*dep_ptr)->name = strdup( "CONSTANT_M" ); + pnt++; + get_varnum( (*dep_ptr)->name ); + } + else if ( *pnt == '$' ) + { + pnt++; + pnt = get_string( pnt, &(*dep_ptr)->name ); + get_varnum( (*dep_ptr)->name ); + } else - cfg->depend = strdup( "CONSTANT_N" ); - pnt++; - } - else if ( *pnt == '$' ) - { - pnt++; - pnt = get_string( pnt, &cfg->depend ); - } - else - { - syntax_error( "can't handle dep_tristate condition" ); - } + { + syntax_error( "can't handle dep_bool/dep_tristate condition" ); + } + dep_ptr = &(*dep_ptr)->next; + while ( *pnt == ' ' || *pnt == '\t' ) + pnt++; + } while ( *pnt ); /* - * Create a conditional for this object's dependency. + * Create a conditional for this object's dependencies. */ { char fake_if [1024]; - sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"m\" ]; then", - cfg->depend, cfg->depend ); - cfg->cond = tokenize_if( fake_if ); + struct dependency * dep; + struct condition ** cond_ptr; + int first = 1; + + cond_ptr = &(cfg->cond); + for ( dep = cfg->depend; dep; dep = dep->next ) + { + if ( token == token_dep_tristate + && ! strcmp( dep->name, "CONSTANT_M" ) ) + { + continue; + } + if ( first ) + { + first = 0; + } + else + { + *cond_ptr = malloc( sizeof(struct condition) ); + memset( *cond_ptr, 0, sizeof(struct condition) ); + (*cond_ptr)->op = op_and; + cond_ptr = &(*cond_ptr)->next; + } + *cond_ptr = malloc( sizeof(struct condition) ); + memset( *cond_ptr, 0, sizeof(struct condition) ); + (*cond_ptr)->op = op_lparen; + if ( token == token_dep_tristate ) + sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"m\" -o \"$%s\" = \"\" ]; then", + dep->name, dep->name, dep->name ); + else + sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"\" ]; then", + dep->name, dep->name ); + (*cond_ptr)->next = tokenize_if( fake_if ); + while ( *cond_ptr ) + cond_ptr = &(*cond_ptr)->next; + *cond_ptr = malloc( sizeof(struct condition) ); + memset( *cond_ptr, 0, sizeof(struct condition) ); + (*cond_ptr)->op = op_rparen; + cond_ptr = &(*cond_ptr)->next; + } } break; @@ -496,15 +647,17 @@ case token_hex: case token_int: - pnt = get_qstring ( pnt, &cfg->label ); - pnt = get_string ( pnt, &cfg->optionname ); - pnt = get_string ( pnt, &cfg->value ); + pnt = get_qstring ( pnt, &cfg->label ); + pnt = get_string ( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + pnt = get_string ( pnt, &cfg->value ); break; case token_string: - pnt = get_qstring ( pnt, &cfg->label ); - pnt = get_string ( pnt, &cfg->optionname ); - pnt = get_qstring ( pnt, &cfg->value ); + pnt = get_qstring ( pnt, &cfg->label ); + pnt = get_string ( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + pnt = get_qstring ( pnt, &cfg->value ); break; case token_if: @@ -521,8 +674,25 @@ else pnt = get_qstring( pnt, &cfg->label ); break; - } + case token_unset: + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + while ( *pnt == ' ' || *pnt == '\t' ) + pnt++; + while (*pnt) + { + cfg->next = (struct kconfig *) malloc( sizeof(struct kconfig) ); + memset( cfg->next, 0, sizeof(struct kconfig) ); + cfg = cfg->next; + cfg->token = token_unset; + pnt = get_string( pnt, &buffer ); + cfg->nameindex = get_varnum( buffer ); + while ( *pnt == ' ' || *pnt == '\t' ) + pnt++; + } + break; + } return; } diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/scripts/tkparse.h linux.ac/scripts/tkparse.h --- linux.vanilla/scripts/tkparse.h Mon Feb 1 20:03:19 1999 +++ linux.ac/scripts/tkparse.h Tue Sep 14 20:59:14 1999 @@ -14,6 +14,11 @@ token_choice_item, token_comment, token_define_bool, + token_define_hex, + token_define_int, + token_define_string, + token_define_tristate, + token_dep_bool, token_dep_tristate, token_else, token_endmenu, @@ -46,7 +51,8 @@ op_rparen, op_constant, op_variable, - op_kvariable, + op_true, + op_false, op_nuked }; @@ -55,21 +61,29 @@ * Some operators take strings: * * op_constant "foo" - * op_variable "$ARCH", "$CONFIG_PMAC" - * op_kvariable "$CONFIG_EXPERIMENTAL" + * op_variable "$ARCH", "$CONFIG_PMAC", "$CONFIG_EXPERIMENTAL" * * Most "$..." constructs refer to a variable which is defined somewhere - * in the script, so they become op_kvariable's instead. Note that it - * is legal to test variables which are never defined, such as variables - * that are meaningful only on other architectures. + * in the script. Note that it is legal to test variables which are never + * defined, such as variables that are meaningful only on other architectures. */ struct condition { - struct condition * next; - enum operator op; - const char * str; /* op_constant, op_variable */ - struct kconfig * cfg; /* op_kvariable */ + struct condition * next; + enum operator op; + const char * str; /* op_constant */ + int nameindex; /* op_variable */ +}; + +/* + * Dependency list for dep_bool, dep_tristate + */ + +struct dependency +{ + char * name; + struct dependency * next; }; /* @@ -80,21 +94,28 @@ { struct kconfig * next; enum e_token token; - char * optionname; + int nameindex; char * label; char * value; struct condition * cond; - char * depend; /* token_dep_tristate */ + struct dependency * depend; /* token_dep_tristate */ struct kconfig * cfg_parent; /* token_choice_item */ /* used only in tkgen.c */ - char global_written; int menu_number; int menu_line; struct kconfig * menu_next; }; +struct variable +{ + char * name; + char defined; + char global_written; +}; +extern struct variable vartable[]; +extern int max_varnum; /* * Prototypes @@ -102,3 +123,4 @@ extern void fix_conditionals ( struct kconfig * scfg ); /* tkcond.c */ extern void dump_tk_script ( struct kconfig * scfg ); /* tkgen.c */ +extern int get_varnum ( char * name ); /* tkparse.c */