diff -u --recursive --new-file v2.4.0-test8/linux/CREDITS linux/CREDITS --- v2.4.0-test8/linux/CREDITS Fri Sep 8 12:38:00 2000 +++ linux/CREDITS Mon Sep 18 14:57:01 2000 @@ -485,7 +485,7 @@ S: USA N: Juan Jose Ciarlante -W: http://juanjox.linuxhq.com/ +W: http://juanjox.kernelnotes.org/ E: jjciarla@raiz.uncu.edu.ar E: jjo@mendoza.gov.ar D: Network driver alias support @@ -1728,7 +1728,7 @@ S: Germany N: Mark W. McClelland -E: mmcclelland@delphi.com +E: mwm@i.am E: mark@alpha.dyndns.org W: http://alpha.dyndns.org/ov511/ D: OV511 driver diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/Configure.help linux/Documentation/Configure.help --- v2.4.0-test8/linux/Documentation/Configure.help Tue Sep 5 12:57:51 2000 +++ linux/Documentation/Configure.help Mon Sep 18 15:23:30 2000 @@ -1088,22 +1088,25 @@ Support for PowerMac IDE devices (must also enable IDE) CONFIG_BLK_DEV_IDE_PMAC - No help for CONFIG_BLK_DEV_IDE_PMAC + This driver provides support for the built-in IDE controller on most + of the recent Apple Power Macintoshes and PowerBooks. + If unsure, say Y. PowerMac IDE DMA support CONFIG_BLK_DEV_IDEDMA_PMAC - No help for CONFIG_BLK_DEV_IDEDMA_PMAC + This option allows the driver for the built-in IDE controller on + Power Macintoshes and PowerBooks to use DMA (direct memory access) + to transfer data to and from memory. Saying Y is safe and improves + performance. Use DMA by default -CONFIG_IDEDMA_PMAC_AUTO - Prior to kernel version 2.1.112, Linux used to automatically use - DMA for IDE drives and chipsets which support it. Due to concerns - about a couple of cases where buggy hardware may have caused damage, - the default is now to NOT use DMA automatically. To revert to the - previous behaviour, say Y to this question. - - If you suspect your hardware is at all flakey, say N here. - Do NOT email the IDE kernel people regarding this issue! +CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO + This option allows the driver for the built-in IDE controller on + Power Macintoshes and PowerBooks to use DMA automatically, without + it having to be explicitly enabled. This option is provided because + of concerns about a couple of cases where using DMA on buggy PC + hardware may have caused damage. Saying Y should be safe on all + Apple machines. Macintosh Quadra/Powerbook IDE interface support CONFIG_BLK_DEV_MAC_IDE @@ -5358,9 +5361,10 @@ IBM ServeRAID Support CONFIG_SCSI_IPS This is support for the IBM ServeRAID hardware RAID controllers. - - Please consult the SCSI-HOWTO, available from - http://www.linuxdoc.org/docs.html#howto . + See http://www.developer.ibm.com/welcome/netfinity/serveraid.html + for more information. If this driver does not work correctly + without modification please contact the author by email at + ipslinux@us.ibm.com. You can build this driver as a module ( = code which can be inserted in and removed from the running kernel whenever you want), @@ -7864,6 +7868,9 @@ and using COMX interfaces. Further info on these cards can be found at http://www.itc.hu or . + You must say Y to "/proc file system support" (CONFIG_PROC_FS) to + use this driver. + If you want to compile this as a module, say M and read Documentation/modules.txt. The module will be called comx.o. @@ -8276,6 +8283,11 @@ - SK-9844 (dual link 1000Base-SX) - SK-9821 (single link 1000Base-T) - SK-9822 (dual link 1000Base-T) + - SK-9861 (single link Volition connector) + - SK-9862 (dual link Volition connector) + The driver also supports the following adapters from Allied Telesyn: + - AT2970... + The dual link adapters support a link-failover feature. Read Documentation/networking/sk98lin.txt for information about optional driver parameters. @@ -9979,10 +9991,24 @@ The module will be called wmforce.o. If you want to compile it as a module, say M here and read Documentation/modules.txt. +Use input layer for ADB devices +CONFIG_INPUT_ADBHID + Say Y here if you want to have ADB (Apple Desktop Bus) HID devices + such as keyboards, mice, joysticks, or graphic tablets handled by the + input layer. If you say Y here, make sure to say Y to the + corresponding drivers "Keyboard support" (CONFIG_INPUT_KEYBDEV), + "Mouse Support" (CONFIG_INPUT_MOUSEDEV) and "Event interface support" + (CONFIG_INPUT_EVDEV) as well. + + If you say N here, you still have the option of using the old ADB + keyboard and mouse drivers. + + If unsure, say Y. + Keyboard support CONFIG_INPUT_KEYBDEV - Say Y here if you want your USB HID keyboard to be able to serve as - a system keyboard. + Say Y here if you want your USB HID keyboard (or an ADB keyboard + handled by the input layer) to be able to serve as a system keyboard. This driver is also available as a module ( = code which can be inserted in and removed from the running kernel whenever you want). @@ -9991,10 +10017,11 @@ Mouse support CONFIG_INPUT_MOUSEDEV - Say Y here if you want your USB HID mouse to be accessible as - char devices 13:32+ - /dev/input/mouseX and 13:63 - /dev/input/mice - as an emulated PS/2 mouse. That way, all user space programs will - be able to use your mouse. + Say Y here if you want your USB HID mouse (or ADB mouse handled by + the input layer) to be accessible as char devices 13:32+ - + /dev/input/mouseX and 13:63 - /dev/input/mice as an emulated ImPS/2 + mouse. That way, all user space programs will be able to use your + mouse. If unsure, say Y. @@ -10029,8 +10056,8 @@ Event interface support CONFIG_INPUT_EVDEV - Say Y here if you want your USB HID device events be accessible - under char device 13:64+ - /dev/inputX in a generic way. + Say Y here if you want your USB or ADB HID device events be accessible + under char device 13:64+ - /dev/input/eventX in a generic way. This is the future ... USB Scanner support @@ -10245,7 +10272,8 @@ CONFIG_USB_PEGASUS Say Y if you want to use your USB ethernet device. Supported cards until now are: - ADMtek AN986 (eval. board) + ADMtek AN986 Pegasus (eval. board) + ADMtek ADM8511 Pegasus II (eval. board) Accton 10/100 Billington USB-100 Corega FEter USB-TX @@ -10255,6 +10283,8 @@ LANEED Ethernet LD-USB/TX SMC 202 SOHOware NUB Ethernet + + Any Pegasus II based board also are supported. If you have devices with vendor IDs other than noted above you should add them in the driver code and send a message to me (petkan@dce.bg) for update. @@ -15425,6 +15455,42 @@ have it autoloaded. The act of removing the module shuts down the sound hardware for more power savings. +Mac-on-Linux support +CONFIG_MOL + This option enables low-level support for Mac-on-Linux. + MOL lets you run MacOS and Linux simultaneously. Please + visit for more information. + If unsure, say Y. + +ADB raw keycode support +CONFIG_MAC_ADBKEYCODES + This provides support for sending raw ADB keycodes to console + devices. This is the default up to 2.4.0, but in future this may be + phased out in favor of generic Linux keycodes. If you say Y here, you + can dynamically switch via the + /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes + sysctl and with the "keyboard_sends_linux_keycodes=" kernel argument. + + If unsure, say Y here. + +Mouse button 2+3 emulation support +CONFIG_MAC_EMUMOUSEBTN + This provides generic support for emulating the 2nd and 3rd mouse + button with keypresses. If you say Y here, the emulation is still + disabled by default. The emulation is controlled by these sysctl entries: + /proc/sys/dev/mac_hid/mouse_button_emulation + /proc/sys/dev/mac_hid/mouse_button2_keycode + /proc/sys/dev/mac_hid/mouse_button3_keycode + +Enhanced Real Time Clock Support +CONFIG_PPC_RTC + If you say Y here and create a character special file /dev/rtc with + major number 10 and minor number 135 using mknod ("man mknod"), you + will get access to the real time clock (or hardware clock) built + into your computer. + + If unsure, say Y here. + Support for Open Firmware device tree in /proc CONFIG_PROC_DEVICETREE This option adds a device-tree directory under /proc which contains @@ -15915,12 +15981,18 @@ # ARM options # ARM System type -CONFIG_ARCH_ARC +CONFIG_ARCH_ARCA5K This selects what ARM system you wish to build the kernel for. It also selects to some extent the CPU type. If you are unsure what to set this option to, please consult any information supplied with your system. +2MB physical memory +CONFIG_PAGESIZE_16 + Say Y here if your Archimedes or A5000 system has only 2MB of + memory, otherwise say N. The resulting kernel will not run on a + machine with 4MB of memory. + Include support for the CATS CONFIG_ARCH_CATS Say Y here if you intend to run this kernel on the CATS. @@ -16020,6 +16092,27 @@ http://www.visuaide.com/pagevictor.en.html for information on this system. +Support ARM610 processor +CONFIG_CPU_ARM6 + Say Y here if you wish to include support for the ARM610 processor. + +Support ARM710 processor +CONFIG_CPU_ARM7 + Say Y here if you wish to include support for the ARM710 processor. + +Support StrongARM(R) SA-110 processor +CONFIG_CPU_SA110 + Say Y here if you wish to include support for the Intel(R) + StrongARM(R) SA-110 processor. + +Support ARM720 processor +CONFIG_CPU_ARM720 + Say Y here if you wish to include support for the ARM720 processor. + +Support ARM920 +CONFIG_CPU_ARM920 + Say Y here if you wish to include support for the ARM920 processor. + Math emulation CONFIG_NWFPE Say Y to include the NWFPE floating point emulator in the kernel. @@ -16134,8 +16227,8 @@ 21285 serial port support CONFIG_SERIAL_21285 - If you have a machine based on a 21285 (Footbridge) StrongARM/PCI - bridge you can enable its onboard serial port by enabling this + If you have a machine based on a 21285 (Footbridge) StrongARM(R)/ + PCI bridge you can enable its onboard serial port by enabling this option. The device has major ID 4, minor 64. Console on 21285 serial port diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/arm/README linux/Documentation/arm/README --- v2.4.0-test8/linux/Documentation/arm/README Mon Jun 19 17:59:33 2000 +++ linux/Documentation/arm/README Mon Sep 18 15:15:24 2000 @@ -52,6 +52,36 @@ the problem, what you were doing, etc. +Include files +------------- + + Several new include directories have been created under include/asm-arm, + which are there to reduce the clutter in the top-level directory. These + directories, and their purpose is listed below: + + arch-* machine/platform specific header files + hardware driver-internal ARM specific data structures/definitions + mach descriptions of generic ARM to specific machine interfaces + proc-* processor dependent header files (currently only two + categories) + + +Machine/Platform support +------------------------ + + The ARM tree contains support for a lot of different machine types. To + continue supporting these differences, it has become necessary to split + machine-specific parts by directory. For this, the machine category is + used to select which directories and files get included (we will use + $(MACHINE) to refer to the category) + + To this end, we now have arch/arm/mach-$(MACHINE) directories which are + designed to house the non-driver files for a particular machine (eg, PCI, + memory management, architecture definitions etc). For all future + machines, there should be a corresponding include/asm-arm/arch-$(MACHINE) + directory. + + Modules ------- diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/cpqarray.txt linux/Documentation/cpqarray.txt --- v2.4.0-test8/linux/Documentation/cpqarray.txt Fri Jul 28 12:50:51 2000 +++ linux/Documentation/cpqarray.txt Mon Sep 18 14:57:01 2000 @@ -17,6 +17,7 @@ * SA 4200 * SA 4250ES * SA 431 + * RAID LC2 Controller It should also work with some really old Disk array adapters, but I am unable to test against these cards: diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/fb/sa1100fb.txt linux/Documentation/fb/sa1100fb.txt --- v2.4.0-test8/linux/Documentation/fb/sa1100fb.txt Wed Dec 31 16:00:00 1969 +++ linux/Documentation/fb/sa1100fb.txt Mon Sep 18 15:15:24 2000 @@ -0,0 +1,39 @@ +[This file is cloned from VesaFB/matroxfb] + +What is sa1100fb? +================= + +This is a driver for a graphic framebuffer for the SA-1100 LCD +controller. + +Configuration +============== + +For most common passive displays, giving the option + +video=sa1100:bpp:,lccr0:,lccr1:,lccr2:,lccr3: + +on the kernel command line should be enough to configure the +controller. The bits per pixel (bpp) value should be 4, 8, 12, or +16. LCCR values are display-specific and should be computed as +documented in the SA-1100 Developer's Manual, Section 11.7. Dual-panel +displays are supported as long as the SDS bit is set in LCCR0; GPIO<9:2> +are used for the lower panel. + +For active displays or displays requiring additional configuration +(controlling backlights, powering on the LCD, etc.), the command line +options may not be enough to configure the display. Adding sections to +sa1100fb_init_fbinfo(), sa1100fb_activate_var(), +sa1100fb_disable_lcd_controller(), and sa1100fb_enable_lcd_controller() +will probably be necessary. + +Accepted options: + +bpp: Configure for bits per pixel +lccr0: Configure LCD control register 0 (11.7.3) +lccr1: Configure LCD control register 1 (11.7.4) +lccr2: Configure LCD control register 2 (11.7.5) +lccr3: Configure LCD control register 3 (11.7.6) + +-- +Mark Huang diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/filesystems/proc.txt linux/Documentation/filesystems/proc.txt --- v2.4.0-test8/linux/Documentation/filesystems/proc.txt Fri Jul 28 12:50:51 2000 +++ linux/Documentation/filesystems/proc.txt Mon Sep 18 14:57:02 2000 @@ -619,11 +619,6 @@ 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 unfortunately -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 kernel source tree. Finally, -change the definition of NR_OPEN and recompile the kernel. - inode-state, inode-nr and inode-max ----------------------------------- diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/kbuild/00-INDEX linux/Documentation/kbuild/00-INDEX --- v2.4.0-test8/linux/Documentation/kbuild/00-INDEX Mon Feb 1 12:03:20 1999 +++ linux/Documentation/kbuild/00-INDEX Sun Sep 17 09:45:06 2000 @@ -6,3 +6,5 @@ - overview of kbuild commands config-language.txt - specification of Config Language, the language in Config.in files +makefiles.txt + - developer information for linux kernel makefiles diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/kbuild/makefiles.txt linux/Documentation/kbuild/makefiles.txt --- v2.4.0-test8/linux/Documentation/kbuild/makefiles.txt Wed Dec 31 16:00:00 1969 +++ linux/Documentation/kbuild/makefiles.txt Sun Sep 17 09:45:06 2000 @@ -0,0 +1,1086 @@ +Linux Kernel Makefiles +16 August 2000 +Michael Elizabeth Chastain, + + + +=== Introduction + +This document describes the Linux kernel Makefiles. + +The Makefiles have five parts: + + Makefile: the top Makefile. + .config: the kernel configuration file. + arch/*/Makefile: the arch Makefiles. + Subdirectory Makefiles: there are about 300 of these. + Rules.make: the common rules for all subdirectory Makefiles. + +The top Makefile reads the .config file, which comes from the +kernel configuration process. + +The top Makefile is responsible for building two major products: vmlinux +(the resident kernel image) and modules (any module files). It builds +these targets by recursively descending into the subdirectories of the +kernel source tree. The list of subdirectories which are visited depends +upon the kernel configuration. + +The top Makefile textually includes an arch Makefile with the name +arch/$(ARCH)/Makefile. The arch Makefile supplies architecture-specific +information to the top Makefile. + +Each subdirectory has a Makefile which carries out the commands passed +down from above. The subdirectory Makefile uses information from the +.config file to construct various file lists, and then it textually +includes the common rules in Rules.make. + +Rules.make defines rules which are common to all the subdirectory +Makefiles. It has a public interface in the form of certain variable +lists. It then declares rules based on those lists. + + + +=== Who does what + +People have four different relationships with the kernel Makefiles. + +*Users* are people who build kernels. These people type commands such as +"make menuconfig" or "make bzImage". They usually do not read or edit +any kernel Makefiles (or any other source files). + +*Normal developers* are people who work on features such as device +drivers, file systems, and network protocols. These people need to +maintain the subdirectory Makefiles for the subsystem that they are +working on. In order to do this effectively, they need some overall +knowledge about the kernel Makefiles, plus detailed knowledge about the +public interface for Rules.make. + +*Arch developers* are people who work on an entire architecture, such +as sparc or ia64. Arch developers need to know about the arch Makefiles +as well as subdirectory Makefiles. + +*Kbuild developers* are people who work on the kernel build system itself. +These people need to know about all aspects of the kernel Makefiles. + +This document is aimed towards normal developers and arch developers. + + + +=== Makefile language + +The kernel Makefiles are designed to run with Gnu Make. The Makefiles +use only the documented features of Gnu Make, but they do use many +Gnu extensions. + +Gnu Make supports elementary list-processing functions. The kernel +Makefiles use a novel style of list building and manipulation with few +"if" statements. + +Gnu Make has two assignment operators, ":=" and "=". ":=" performs +immediate evaluation of the right-hand side and stores an actual string +into the left-hand side. "=" is like a formula definition; it stores the +right-hand side in an unevaluated form and then evaluates this form each +time the left-hand side is used. + +There are some cases where "=" is appropriate. Usually, though, ":=" +is the right choice. + +All of the examples in this document were drawn from actual kernel +sources. The examples have been reformatted (white space changed, lines +split), but are otherwise exactly the same. + + + +=== Variables passed down from the top + +The top Makefile exports the following variables: + + VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION + + These variables define the current kernel version. A few arch + Makefiles actually use these values directly; they should use + $(KERNELRELEASE) instead. + + $(VERSION), $(PATCHLEVEL), and $(SUBLEVEL) define the basic + three-part version number, such as "2", "4", and "0". These three + values are always numeric. + + $(EXTRAVERSION) defines an even tinier sublevel for pre-patches + or additional patches. It is usually some non-numeric string + such as "-pre4", and is often blank. + + KERNELRELEASE + + $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable + for constructing installation directory names or showing in + version strings. Some arch Makefiles use it for this purpose. + + ARCH + + This variable defines the target architecture, such as "i386", + "arm", or "sparc". Many subdirectory Makefiles test $(ARCH) + to determine which files to compile. + + By default, the top Makefile sets $(ARCH) to be the same as the + host system system architecture. For a cross build, a user may + override the value of $(ARCH) on the command line: + + make ARCH=m68k ... + + TOPDIR, HPATH + + $(TOPDIR) is the path to the top of the kernel source tree. + Subdirectory Makefiles need this so that they can include + $(TOPDIR)/Rules.make. + + $(HPATH) is equal to $(TOPDIR)/include. A few arch Makefiles + need to use this to do special things using include files. + + SUBDIRS + + $(SUBDIRS) is a list of directories which the top Makefile + enters in order to build either vmlinux or modules. The actual + directories in $(SUBDIRS) depend on the kernel configuration. + The top Makefile defines this variable, and the arch Makefile + extends it. + + HEAD, CORE_FILES, NETWORKS, DRIVERS, LIBS + LINKFLAGS + + $(HEAD), $(CORE_FILES), $(NETWORKS), $(DRIVERS), and $(LIBS) + specify lists of object files and libraries to be linked into + vmlinux. + + The files in $(HEAD) are linked first in vmlinux. + + $(LINKFLAGS) specifies the flags to build vmlinux. + + The top Makefile and the arch Makefile jointly define these + variables. The top Makefile defines $(CORE_FILES), $(NETWORKS), + $(DRIVERS), and $(LIBS). The arch Makefile defines $(HEAD) + and $(LINKFLAGS), and extends $(CORE_FILES) and $(LIBS). + + Note: there are more names here than necessary. $(NETWORKS), + $(DRIVERS), and even $(LIBS) could be subsumed into $(CORE_FILES). + + CPP, CC, AS, LD, AR, NM, STRIP, OBJCOPY, OBJDUMP + CPPFLAGS, CFLAGS, CFLAGS_KERNEL, MODFLAGS, AFLAGS, LDFLAGS + PERL + GENKSYMS + + These variables specify the commands and flags that Rules.make + uses to build target files from source files. + + $(CFLAGS_KERNEL) contains extra C compiler flags used to compile + resident kernel code. + + $(MODFLAGS) contains extra C compiler flags used to compile code + for loadable kernel modules. In the future, this flag may be + renamed to the more regular name $(CFLAGS_MODULE). + + $(AFLAGS) contains assembler flags. + + $(GENKSYMS) contains the command used to generate kernel symbol + signatures when CONFIG_MODVERSIONS is enabled. The genksyms + command comes from the modutils package. + + CROSS_COMPILE + + This variable is a prefix path for other variables such as $(CC), + $(AS), and $(LD). The arch Makefiles sometimes use and set this + variable explicitly. Subdirectory Makefiles don't need to worry + about it. + + The user may override $(CROSS_COMPILE) on the command line if + desired. + + HOSTCC, HOSTCFLAGS + + These variables define the C compiler and C compiler flags to + be used for compiling host side programs. These are separate + variables because the target architecture can be different from + the host architecture. + + If your Makefile compiles and runs a program that is executed + during the course of building the kernel, then it should use + $(HOSTCC) and $(HOSTCFLAGS). + + For example, the subdirectory drivers/pci has a helper program + named gen-devlist.c. This program reads a list of PCI ID's and + generates C code in the output files classlist.h and devlist.h. + + Suppose that a user has an i386 computer and wants to build a + kernel for an ia64 machine. Then the user would use an ia64 + cross-compiler for most of the compilation, but would use a + native i386 host compiler to compile drivers/pci/gen-devlist.c. + + For another example, kbuild helper programs such as + scripts/mkdep.c and scripts/lxdialog/*.c are compiled with + $(HOSTCC) rather than $(CC). + + ROOT_DEV, SVGA_MODE, RAMDISK + + End users edit these variables to specify certain information + about the configuration of their kernel. These variables + are ancient! They are also specific to the i386 architecture. + They really should be replaced with CONFIG_* options. + + MAKEBOOT + + This variable is defined and used only inside the main arch + Makefiles. The top Makefile should not export it. + + INSTALL_PATH + + This variable defines a place for the arch Makefiles to install + the resident kernel image and System.map file. + + INSTALL_MOD_PATH, MODLIB + + $(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module + installation. This variable is not defined in the Makefile but + may be passed in by the user if desired. + + $(MODLIB) specifies the directory for module installation. + The top Makefile defines $(MODLIB) to + $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE). The user may + override this value on the command line if desired. + + CONFIG_SHELL + + This variable is private between Makefile and Rules.make. + Arch makefiles and subdirectory Makefiles should never use this. + + MODVERFILE + + An internal variable. This doesn't need to be exported, as it + is never used outside of the top Makefile. + + MAKE, MAKEFILES + + Some variables internal to Gnu Make. + + $(MAKEFILES) in particular is used to force the arch Makefiles + and subdirectory Makefiles to read $(TOPDIR)/.config without + including it explicitly. (This was an implementation hack and + could be fixed). + + + +=== The structure of an arch Makefile + +The top Makefile includes one arch Makefile file, arch/$(ARCH)/Makefile. +This section describes the functions of the arch Makefile. + +An arch Makefile extends some of the top Makefile's variables with +architecture-specific values. + + SUBDIRS + + The top Makefile defines $(SUBDIRS). The arch Makefile extends + $(SUBDIRS) with a list of architecture-specific directories. + + Example: + + # arch/alpha/Makefile + + SUBDIRS := $(SUBDIRS) arch/alpha/kernel arch/alpha/mm \ + arch/alpha/lib arch/alpha/math-emu + + This list may depend on the configuration: + + # arch/arm/Makefile + + ifeq ($(CONFIG_ARCH_ACORN),y) + SUBDIRS += drivers/acorn + ... + endif + + CPP, CC, AS, LD, AR, NM, STRIP, OBJCOPY, OBJDUMP + CPPFLAGS, CFLAGS, CFLAGS_KERNEL, MODFLAGS, AFLAGS, LDFLAGS + + The top Makefile defines these variables, and the arch Makefile + extends them. + + Many arch Makefiles dynamically run the target C compiler to + probe what options it supports: + + # arch/i386/Makefile + + # only work around strength reduction bug(s) on older gcc versions + CFLAGS += $(shell if ! $(CC) -march=i486 -S -o /dev/null \ + -xc /dev/null >/dev/null 2>&1; \ + then echo "-fno-strength-reduce"; fi) + + # prevent gcc from keeping the stack 16 byte aligned + CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 \ + -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ + then echo "-mpreferred-stack-boundary=2"; fi) + + And, of course, $(CFLAGS) can depend on the configuration: + + # arch/i386/Makefile + + ifdef CONFIG_M386 + CFLAGS += $(shell if $(CC) -march=i386 -S -o /dev/null \ + -xc /dev/null >/dev/null 2>&1; \ + then echo "-march=i386"; else echo "-m386"; fi) + endif + + ifdef CONFIG_M486 + CFLAGS += $(shell if $(CC) -march=i486 -S -o /dev/null \ + -xc /dev/null >/dev/null 2>&1; \ + then echo "-march=i486"; else echo "-m486"; fi) + endif + + ifdef CONFIG_M586 + CFLAGS += $(shell if $(CC) -march=i586 -S -o /dev/null \ + -xc /dev/null >/dev/null 2>&1; \ + then echo "-march=i586"; fi) + endif + + Some arch Makefiles redefine the compilation commands in order + to add architecture-specific flags: + + # arch/s390/Makefile + + LD=$(CROSS_COMPILE)ld -m elf_s390 + OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S + +An arch Makefile co-operates with the top Makefile to define variables +which specify how to build the vmlinux file. Note that there is no +corresponding arch-specific section for modules; the module-building +machinery is all architecture-independent. + + HEAD, CORE_FILES, LIBS + LINKFLAGS + + The top Makefile defines the architecture-independent core of + thse variables, and the arch Makefile extends them. Note that the + arch Makefile defines (not just extends) $(HEAD) and $(LINKFLAGS). + + Example: + + # arch/m68k/Makefile + + ifndef CONFIG_SUN3 + LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux.lds + else + LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux-sun3.lds -N + endif + + ... + + ifndef CONFIG_SUN3 + HEAD := arch/m68k/kernel/head.o + else + HEAD := arch/m68k/kernel/sun3-head.o + endif + + SUBDIRS += arch/m68k/kernel arch/m68k/mm arch/m68k/lib + CORE_FILES := arch/m68k/kernel/kernel.o arch/m68k/mm/mm.o $(CORE_FILES) + LIBS += arch/m68k/lib/lib.a + +An arch Makefile specifies targets that take the vmlinux file, compress +it, wrap it in bootstrapping code, and copy the resulting files somewhere. +This includes various kinds of installation commands. + +These post-vmlinux targets are not standardized across different +architectures. Here is a list of these targets and the architectures +that support each of them (as of kernel version 2.4.0-test6-pre5): + + balo mips + bootimage alpha + bootpfile alpha, ia64 + bzImage i386, m68k + bzdisk i386 + bzlilo i386 + compressed i386, m68k, mips, mips64, sh + dasdfmt s390 + Image arm + image s390 + install arm, i386 + lilo m68k + msb alpha, ia64 + my-special-boot alpha, ia64 + orionboot mips + rawboot alpha + silo s390 + srmboot alpha + tftpboot.img sparc, sparc64 + vmlinux.64 mips64 + vmlinux.aout sparc64 + zImage arm, i386, m68k, mips, mips64, ppc, sh + zImage.initrd ppc + zdisk i386, mips, mips64, sh + zinstall arm + zlilo i386 + znetboot.initrd ppc + +An arch Makefile must define the following auxiliary targets. These +targets provide arch-specific actions for the corresponding targets +in the top Makefile: + + archclean clean + archdep dep + archmrproper mrproper + + + +=== The structure of a subdirectory Makefile + +A subdirectory Makefile has five sections. + +The first section is a comment header. Just write what you would +write if you were editing a C source file, but use "# ..." instead of +"/* ... */". Historically, many anonymous people have edited kernel +Makefiles without leaving any change histories in the header; comments +from them would have been valuable. + +The second section is a bunch of definitions that are the heart of the +subdirectory Makefile. These lines define the files to be built, any +special compilation options, and any subdirectories to be recursively +entered. The declarations in these lines depend heavily on the kernel +configuration variables (CONFIG_* symbols). + +In some Makefiles ("old-style Makefiles"), the second section looks +like this: + + # drivers/parport/Makefile + ifeq ($(CONFIG_PARPORT_PC),y) + LX_OBJS += parport_pc.o + else + ifeq ($(CONFIG_PARPORT_PC),m) + MX_OBJS += parport_pc.o + endif + endif + +In most Makefiles ("new-style Makefiles"), the second section looks +like this: + + # drivers/block/Makefile + obj-$(CONFIG_MAC_FLOPPY) += swim3.o + obj-$(CONFIG_BLK_DEV_FD) += floppy.o + obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o + obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o + +The new-style Makefiles are more compact and easier to get correct +for certain features (such as CONFIG_* options that enable more than +one file). If you have a choice, please write a new-style Makefile. + +The third section is an adapter section. In old-style Makefiles, this +third section is not present. In new-style Makefiles, the third section +contains boilerplate code which converts from new-style variables to +old-style variables. This is because Rules.make processes only the +old-style variables. + +The fourth section is the single line: + + include $(TOPDIR)/Rules.make + +The fifth section contains any special Makefile rules needed that are +not available through the common rules in Rules.make. + + + +=== Rules.make variables + +The public interface of Rules.make consists of the following variables: + + ALL_SUB_DIRS, SUB_DIRS, MOD_IN_SUB_DIRS, MOD_SUB_DIRS + + $(ALL_SUB_DIRS) is an unconditional list of *all* the + subdirectories in a given directory. This list should not depend + on the kernel configuration. + + $(SUB_DIRS) is a list of subdirectories which may contribute code + to vmlinux. This list may depend on the kernel configuration. + + $(MOD_SUB_DIRS) and $(MOD_IN_SUB_DIRS) are lists of subdirectories + which may build kernel modules. Both names have exactly the + same meaning. (In version 2.2 and earlier kernels, these + variables had different meanings -- hence the different names). + + For new code, $(MOD_SUB_DIRS) is recommended and $(MOD_IN_SUB_DIRS) + is deprecated. + + Example: + + # fs/Makefile + ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs \ + umsdos ntfs hpfs sysv smbfs ncpfs ufs efs affs \ + romfs autofs hfs lockd nfsd nls devpts devfs \ + adfs partitions qnx4 udf bfs cramfs openpromfs \ + autofs4 ramfs jffs + SUB_DIRS := + + ... + + ifeq ($(CONFIG_EXT2_FS),y) + SUB_DIRS += ext2 + else + ifeq ($(CONFIG_EXT2_FS),m) + MOD_SUB_DIRS += ext2 + endif + endif + + ifeq ($(CONFIG_CRAMFS),y) + SUB_DIRS += cramfs + else + ifeq ($(CONFIG_CRAMFS),m) + MOD_SUB_DIRS += cramfs + endif + endif + + Example: + + # drivers/net/Makefile + SUB_DIRS := + MOD_SUB_DIRS := + MOD_IN_SUB_DIRS := + ALL_SUB_DIRS := $(SUB_DIRS) fc hamradio irda pcmcia tokenring \ + wan sk98lin arcnet skfp tulip appletalk + + ... + + ifeq ($(CONFIG_IRDA),y) + SUB_DIRS += irda + MOD_IN_SUB_DIRS += irda + else + ifeq ($(CONFIG_IRDA),m) + MOD_IN_SUB_DIRS += irda + endif + endif + + ifeq ($(CONFIG_TR),y) + SUB_DIRS += tokenring + MOD_IN_SUB_DIRS += tokenring + else + ifeq ($(CONFIG_TR),m) + MOD_IN_SUB_DIRS += tokenring + endif + endif + + O_TARGET, O_OBJS, OX_OBJS + + The subdirectory Makefile specifies object files for vmlinux in + the lists $(O_OBJS) and $(OX_OBJS). These lists depend on the + kernel configuration. + + The "X" in "OX_OBJS" stands for "eXport". Files in $(OX_OBJS) + may use the EXPORT_SYMBOL macro to define public symbols which + loadable kernel modules can see. Files in $(O_OBJS) may not use + EXPORT_SYMBOL (and you will get a funky error message if you try). + + [Yes, it's kludgy to do this by hand. Yes, you can define all + your objects as $(OX_OBJS) whether they define symbols or not; + but then you will notice a lot of extra compiles when you edit + any source file. Blame CONFIG_MODVERSIONS for this.] + + Rules.make compiles all the $(O_OBJS) and $(OX_OBJS) files. + It then calls "$(LD) -r" to merge these files into one .o file + with the name $(O_TARGET). This $(O_TARGET) name also appears + in the top Makefile. + + The order of files in $(O_OBJS) and $(OX_OBJS) is significant. + All $(OX_OBJS) files come first, in the order listed, followed by + all $(O_OBJS) files, in the order listed. Duplicates in the lists + are allowed: the first instance will be linked into $(O_TARGET) + and succeeding instances will be ignored. (Note: Rules.make may + emit warning messages for duplicates, but this is harmless). + + Example: + + # arch/alpha/kernel/Makefile + O_TARGET := kernel.o + O_OBJS := entry.o traps.o process.o osf_sys.o irq.o \ + irq_alpha.o signal.o setup.o ptrace.o time.o \ + semaphore.o + OX_OBJS := alpha_ksyms.o + + ifdef CONFIG_SMP + O_OBJS += smp.o irq_smp.o + endif + + ifdef CONFIG_PCI + O_OBJS += pci.o pci_iommu.o + endif + + Even if a subdirectory Makefile has an $(O_TARGET), the .config + options still control whether or not its $(O_TARGET) goes into + vmlinux. See the $(M_OBJS) example below. + + + + L_TARGET, L_OBJS, LX_OBJS + + These names are similar to the O_* names. Once again, $(L_OBJS) + and $(LX_OBJS) specify object files for the resident kernel; + once again, the lists depend on the current configuration; and + once again, the files that call EXPORT_SYMBOL go on the "X" list. + + The difference is that "L" stands for "Library". After making + $(L_OBJS) and $(LX_OBJS), Rules.make uses the "$(AR) rcs" command + to put these files into an archive file (a library) with the + name $(L_TARGET). This name also appears in the top Makefile. + + Example: + + # arch/i386/lib/Makefile + L_TARGET = lib.a + L_OBJS = checksum.o old-checksum.o delay.o \ + usercopy.o getuser.o putuser.o iodebug.o + + ifdef CONFIG_X86_USE_3DNOW + L_OBJS += mmx.o + endif + + ifdef CONFIG_HAVE_DEC_LOCK + L_OBJS += dec_and_lock.o + endif + + The order of files in $(L_OBJS) and $(LX_OBJS) is not significant. + Duplicates in the lists are allowed. (Note: Rules.make may emit + warning messages for duplicates, but this is harmless). + + A subdirectory Makefile can specify either an $(O_TARGET), + an $(L_TARGET), or both. Here is a discussion of the differences. + + All of the files in an $(O_TARGET) are guaranteed to appear in + the resident vmlinux image. In an $(L_TARGET), only the files + that satisfy undefined symbol references from other files will + appear in vmlinux. + + In a conventional link process, the linker processes some + object files and creates a list of unresolved external symbols. + The linker then looks in a set of libraries to resolve these + symbols. Indeed, the Linux kernel used to be linked this way, + with the bulk of the code stored in libraries. + + But vmlinux contains two types of object files that cannot be + fetched out of libraries this way: + + (1) object files that are purely EXPORT_SYMBOL definitions + (2) object files that use module_init or __initcall initializers + (instead of an initialization routine called externally) + + These files contain autonomous initializer sections which provide + code and data without being explicitly called. If these files + were stored in $(L_TARGET) libraries, the linker would fail + to include them in vmlinux. Thus, most subdirectory Makefiles + specify an $(O_TARGET) and do not use $(L_TARGET). + + Other considerations: $(O_TARGET) leads to faster re-link times + during development activity, but $(L_TARGET) gives better error + messages for unresolved symbols. + + M_OBJS, MX_OBJS + + $(M_OBJS) and $(MX_OBJS) specify object files which are built + as loadable kernel modules. As usual, the "X" in $(MX_OBJS) + stands for "eXport"; source files that use EXPORT_SYMBOL must + appear on an $(MX_OBJS) list. + + A module may be built from one source file or several source + files. In the case of one source file, the subdirectory + Makefile simply adds the file to either $(M_OBJS) or $(MX_OBJS), + as appropriate. + + Example: + + # drivers/net/irda/Makefile + ifeq ($(CONFIG_IRTTY_SIR),y) + L_OBJS += irtty.o + else + ifeq ($(CONFIG_IRTTY_SIR),m) + M_OBJS += irtty.o + endif + endif + + ifeq ($(CONFIG_IRPORT_SIR),y) + LX_OBJS += irport.o + else + ifeq ($(CONFIG_IRPORT_SIR),m) + MX_OBJS += irport.o + endif + endif + + If a kernel module is built from several source files, there + are two ways to specify the set of source files. One way is to + build a single module for the entire subdirectory. This way is + popular in the file system and network protocol stacks. + + Example: + + # fs/ext2/Makefile + O_TARGET := ext2.o + O_OBJS := acl.o balloc.o bitmap.o dir.o file.o fsync.o \ + ialloc.o inode.o ioctl.o namei.o super.o symlink.o \ + truncate.o + M_OBJS := $(O_TARGET) + + In this example, the module name will be ext2.o. Because this + file has the same name has $(O_TARGET), Rules.make will use + the $(O_TARGET) rule to build ext2.o: it will run "$(LD) -r" + on the list of $(O_OBJS) files. + + Note that this subdirectory Makefile defines both an $(O_TARGET) + and an $(M_OBJS). The control code, up in fs/Makefile, will + select between these two. If CONFIG_EXT2_FS=y, then fs/Makefile + will build $(O_TARGET); and if CONFIG_EXT_FS=m, then fs/Makefile + will build $(M_OBJS) instead. (Yes, this is a little delicate + and a little confusing). + + MI_OBJS, MIX_OBJS + + Some kernel modules are composed of several object files + linked together, but do not include every object file in their + subdirectory. $(MI_OBJS) and $(MIX_OBJS) are for this case. + + "M" stands for Module. + "I" stands for Intermediate. + "X", as usual, stands for "eXport symbol". + + Example: + + # drivers/sound/Makefile + gus-objs := gus_card.o gus_midi.o gus_vol.o gus_wave.o ics2101.o + pas2-objs := pas2_card.o pas2_midi.o pas2_mixer.o pas2_pcm.o + sb-objs := sb_card.o + + gus.o: $(gus-objs) + $(LD) -r -o $@ $(gus-objs) + + pas2.o: $(pas2-objs) + $(LD) -r -o $@ $(pas2-objs) + + sb.o: $(sb-objs) + $(LD) -r -o $@ $(sb-objs) + + The kernel modules gus.o, pas2.o, and sb.o are the *composite + files*. The object files gus_card.o, gus_midi.o, gus_vol.o, + gus_wave.o, ics2101.o, pas2_card.o, pas2_midi.o, pas2_mixer.o, + pas2_pcm.o, and sb_card.o are *component files*. The component + files are also called *intermediate files*. + + In another part of drivers/sound/Makefile (not shown), all of + the component files are split out. For the resident drivers: + the component object files go onto $(O_OBJS) and $(OX_OBJS) + lists, depending on whether they export symbols or not; and the + composite files are never built. For the kernel modules: the + component object files go onto $(MI_OBJS) and $(MIX_OBJS); + the composite files go onto $(M_OBJS). + + The subdirectory Makefile must also specify the linking rule + for a multi-object-file module: + + # drivers/sound/Makefile + + gus.o: $(gus-objs) + $(LD) -r -o $@ $(gus-objs) + + pas2.o: $(pas2-objs) + $(LD) -r -o $@ $(pas2-objs) + + sb.o: $(sb-objs) + $(LD) -r -o $@ $(sb-objs) + + IGNORE_FLAGS_OBJS + + $(IGNORE_FLAGS_OBJS) is a list of object files which will not have + their flag dependencies automatically tracked. This is a hackish + feature, used to kludge around a problem in the implementation + of flag dependencies. (The problem is that flag dependencies + assume that a %.o file is built from a matching %.S or %.c file. + This is sometimes not true). + + EXTRA_CFLAGS, EXTRA_AFLAGS, EXTRA_LDFLAGS, EXTRA_ARFLAGS + + $(EXTRA_CFLAGS) specifies options for compiling C files with + $(CC). The options in this variable apply to all $(CC) commands + for files in the current directory. + + Example: + + # drivers/sound/emu10k1/Makefile + EXTRA_CFLAGS += -I. + ifdef DEBUG + EXTRA_CFLAGS += -DEMU10K1_DEBUG + endif + + $(EXTRA_CFLAGS) does not apply to subdirectories of the current + directory. Also, it does not apply to files compiled with + $(HOSTCC). + + This variable is necessary because the top Makefile owns the + variable $(CFLAGS) and uses it for compilation flags for the + entire tree. + + $(EXTRA_AFLAGS) is a similar string for per-directory options + when compiling assembly language source. + + Example: at the time of writing, there were no examples of + $(EXTRA_AFLAGS) in the kernel corpus. + + $(EXTRA_LDFLAGS) and $(EXTRA_ARFLAGS) are similar strings for + per-directory options to $(LD) and $(AR). + + Example: at the time of writing, there were no examples of + $(EXTRA_LDFLAGS) or $(EXTRA_ARFLAGS) in the kernel corpus. + + CFLAGS_$@, AFLAGS_$@ + + $(CFLAGS_$@) specifies per-file options for $(CC). The $@ + part has a literal value which specifies the file that it's for. + + Example: + + # drivers/scsi/Makefile + CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF + CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \ + -DGDTH_STATISTICS + CFLAGS_seagate.o = -DARBITRATE -DPARITY -DSEAGATE_USE_ASM + + These three lines specify compilation flags for aha152x.o, + gdth.o, and seagate.o + + $(AFLAGS_$@) is a similar feature for source files in assembly + languages. + + Example: + + # arch/arm/kernel/Makefile + AFLAGS_head-armv.o := -DTEXTADDR=$(TEXTADDR) -traditional + AFLAGS_head-armo.o := -DTEXTADDR=$(TEXTADDR) -traditional + + Rules.make has a feature where an object file depends on the + value of $(CFLAGS_$@) that was used to compile it. (It also + depends on the values of $(CFLAGS) and $(EXTRA_CFLAGS)). Thus, + if you change the value of $(CFLAGS_$@) for a file, either by + editing the Makefile or overriding the value some other way, + Rules.make will do the right thing and re-compile your source + file with the new options. + + Note: because of a deficiency in Rules.make, assembly language + files do not have flag dependencies. If you edit $(AFLAGS_$@) + for such a file, you will have to remove the object file in order + to re-build from source. + + USE_STANDARD_AS_RULE + + This is a transition variable. If $(USE_STANDARD_AS_RULE) + is defined, then Rules.make will provide standard rules for + assembling %.S files into %.o files or %.s files (%.s files + are useful only to developers). + + If $(USE_STANDARD_AS_RULE) is not defined, then Rules.make + will not provide these standard rules. In this case, the + subdirectory Makefile must provide its own private rules for + assembling %.S files. + + In the past, all Makefiles provided private %.S rules. Newer + Makefiles should define USE_STANDARD_AS_RULE and use the standard + Rules.make rules. As soon as all the Makefiles across all + architectures have been converted to USE_STANDARD_AS_RULE, then + Rules.make can drop the conditional test on USE_STANDARD_AS_RULE. + After that, all the other Makefiles can drop the definition of + USE_STANDARD_AS_RULE. + + + +=== New-style variables + +The "new-style variables" are simpler and more powerful than the +"old-style variables". As a result, many subdirectory Makefiles shrank +more than 60%. This author hopes that, in time, all arch Makefiles and +subdirectory Makefiles will convert to the new style. + +Rules.make does not understand new-style variables. Thus, each new-style +Makefile has a section of boilerplate code that converts the new-style +variables into old-style variables. There is also some mixing, where +people define most variables using "new style" but then fall back to +"old style" for a few lines. + + obj-y obj-m obj-n obj- + + These variables replace $(O_OBJS), $(OX_OBJS), $(M_OBJS), + and $(MX_OBJS). + + Example: + + # drivers/block/Makefile + obj-$(CONFIG_MAC_FLOPPY) += swim3.o + obj-$(CONFIG_BLK_DEV_FD) += floppy.o + obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o + obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o + + Notice the use of $(CONFIG_...) substitutions on the left hand + side of an assignment operator. This gives Gnu Make the power + of associative indexing! Each of these assignments replaces + eight lines of code in an old-style Makefile. + + After executing all of the assignments, the subdirectory + Makefile has built up four lists: $(obj-y), $(obj-m), $(obj-n), + and $(obj-). + + $(obj-y) is a list of files to include in vmlinux. + $(obj-m) is a list of files to build as single-file modules. + $(obj-n) and $(obj-) are ignored. + + Each list may contain duplicates items; duplicates are + automatically removed later. Also, if a file appears in both + $(obj-y) and $(obj-m), it will automatically be removed from + the $(obj-m) list. + + Example: + + # drivers/net/Makefile + + ... + obj-$(CONFIG_OAKNET) += oaknet.o 8390.o + ... + obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o + ... + obj-$(CONFIG_STNIC) += stnic.o 8390.o + ... + obj-$(CONFIG_MAC8390) += daynaport.o 8390.o + ... + + In this example, four different drivers require the code in + 8390.o. If one or more of these four drivers are built into + vmlinux, then 8390.o will also be built into vmlinux, and will + *not* be built as a module -- even if another driver which needs + 8390.o is built as a module. (The modular driver is able to + use services of the 8390.o code in the resident vmlinux image). + + export-objs + + $(export-objs) is a list of all the files in the subdirectory + which potentially export symbols. The canonical way to construct + this list is: + + grep -l EXPORT_SYMBOL *.c + + (but watch out for sneaky files that call EXPORT_SYMBOL from an + included header file!) + + This is a potential list, independent of the kernel configuration. + All files that export symbols go into $(export-objs). The + boilerplate code then uses the $(export-objs) list to separate + the real file lists into $(*_OBJS) and $(*X_OBJS). + + Experience has shown that maintaining the proper X's in an + old-style Makefile is difficult and error-prone. Maintaining the + $(export-objs) list in a new-style Makefile is simpler and easier + to audit. + + list-multi + $(foo)-objs + + Some kernel modules are composed of multiple object files linked + together. $(list-multi) is a list of such kernel modules. + This is a static list; it does not depend on the configuration. + + For each kernel module in $(list-multi) there is another list + of all the object files which make up that module. For a kernel + module named foo.o, its object file list is foo-objs. + + Example: + + # drivers/scsi/Makefile + list-multi := scsi_mod.o sr_mod.o initio.o a100u2w.o + + ... + + scsi_mod-objs := hosts.o scsi.o scsi_ioctl.o constants.o \ + scsicam.o scsi_proc.o scsi_error.o \ + scsi_obsolete.o scsi_queue.o scsi_lib.o \ + scsi_merge.o scsi_dma.o scsi_scan.o \ + scsi_syms.o + sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o + initio-objs := ini9100u.o i91uscsi.o + a100u2w-objs := inia100.o i60uscsi.o + + The subdirectory Makefile puts the modules onto obj-* lists in + the usual configuration-dependent way: + + obj-$(CONFIG_SCSI) += scsi_mod.o + obj-$(CONFIG_BLK_DEV_SR) += sr_mod.o + obj-$(CONFIG_SCSI_INITIO) += initio.o + obj-$(CONFIG_SCSI_INIA100) += a100u2w.o + + Suppose that CONFIG_SCSI=y. Then vmlinux needs to link in all + 14 components of scsi_mod.o, so these components will go onto + $(O_OBJS) and $(OX_OBJS). The composite file scsi_mod.o will + never be created. The boilerplate conversion code produces this + result with a few lines of list processing commands. + + Suppose that CONFIG_BLK_DEV_SR=m. Then the 3 components + of sr_mod.o will linked together with "$(LD) -r" to make the + kernel module sr_mod.o, so these 3 components need to go onto + the $(MI_OBJS) and $(MIX_OBJS) lists; the composite file sr_mod.o + goes onto $(M_OBJS). The boilerplate conversion code takes care + of this, too. + + And suppose CONFIG_SCSI_INITIO=n. Then initio.o goes onto the + $(obj-n) list and that's the end of it. Its component files + are not compiled, and the composite file is not created. + + Finally, the subdirectory Makefile needs to define rules to + build each multi-object kernel module from its component list. + Example: + + # drivers/scsi/Makefile + + scsi_mod.o: $(scsi_mod-objs) + $(LD) -r -o $@ $(scsi_mod-objs) + + sr_mod.o: $(sr_mod-objs) + $(LD) -r -o $@ $(sr_mod-objs) + + initio.o: $(initio-objs) + $(LD) -r -o $@ $(initio-objs) + + a100u2w.o: $(a100u2w-objs) + $(LD) -r -o $@ $(a100u2w-objs) + + These rules are very regular; it would be nice for the boilerplate + code or Rules.make to synthesize these rules automatically. + But until that happens, the subdirectory Makefile needs to define + these rules explicitly. + + + +=== Compatibility with Linux Kernel 2.2 + +Most of the information in this document also applies to 2.2, although +there is no indication of which things have changed when. Here are some +hints for writing subdirectory Makefiles that are compatible with Linux +kernel 2.2. + +You can write either an old-style Makefile or a new-style Makefile +with a boilerplate adapter section. See the 2.2 version of +drivers/sound/Makefile for a copy of the boilerplate code. + +In 2.2, Rules.make makes a distinction between $(MOD_SUB_DIRS) +and $(MOD_IN_SUB_DIRS). If you have a single directory with no +subdirectories, this will not matter to you. If you have a whole +tree, then you need to know the difference between $(MOD_SUB_DIRS) +and $(MOD_IN_SUB_DIRS). For example code: $(MOD_SUB_DIRS) is used +extensively in fs/Makefile; $(MOD_IN_SUB_DIRS) is used extensively in +drivers/net/Makefile. + +If you are already using MOD_LIST_NAME, go ahead and keep using it. +If you don't already have a MOD_LIST_NAME, go ahead and keep not using +one; your module will be a 'misc' module in 2.2. + +Assembly language rules were a mess in 2.2. If you have assembly language +files, this author recommends that you write your own explicit rules +for each file by name. + + + +=== Credits + +Thanks to the members of the linux-kbuild mailing list for reviewing +drafts of this document, with particular thanks to Peter Samuelson. diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/8139too.txt linux/Documentation/networking/8139too.txt --- v2.4.0-test8/linux/Documentation/networking/8139too.txt Fri Sep 8 12:37:34 2000 +++ linux/Documentation/networking/8139too.txt Sun Sep 17 09:41:28 2000 @@ -1,6 +1,6 @@ "8139too" Fast Ethernet driver for Linux - Improved support for RTL-8139 Fast Ethernet adapters + Improved support for RTL-8139 10/100 Fast Ethernet adapters Copyright 2000 Jeff Garzik @@ -8,6 +8,7 @@ Architectures supported (all PCI platforms): x86, Alpha AXP, PowerPC, Sparc64 + Kernel versions supported: 2.4.x @@ -130,6 +131,8 @@ And thanks to every supporter free software. +(see top of 8139too.c for further credits and kudos) + Submitting Bug Reports @@ -156,38 +159,50 @@ 1) Work with Donald to merge fixes and updates into his driver. -2) 2.2.x COMPATIBILITY SUPPORT IS BROKEN. DO NOT USE IT. -It is included only for enterprising hackers willing to help fix it. +2) ethtool support -3) PPC platform has stability problems. +3) PPC platform has stability problems. (XXX: verify this is still true) 4) Sparc64 platform not tested at all. -5) Identify and fix "rx wedge" when ping flooded. (WIP) - -7) N-Way auto-negotiation is known to fail in some cases. This problem -also occurs in the rtl8139 driver in kernels 2.2.x/2.3.x. Solution: -Following technique in sunhme and sunbmac, use a kernel timer to -manually perform autonegotiation in case the network or card cannot do -it automatically. (patches welcome) - 8) Much improved command line / module parameter setup. (patches and suggestions welcome) (WIP) 9) Better documentation. (patches welcome) -10) (rtl8139-diag modified from Becker version, DONE) -User-mode (or maybe optional /proc) diagnostics program. - 11) RTL8139C support untested. -12) 10base-T support flaky or slow +12) 10base-T support flaky or slow (todo: verify this is still true) Change History -------------- + +Version 0.9.10 - September 12, 2000 + +* Never wrap an Rx packet (faster Rx interrupt handling) +* Clear all TxAborted conditions (bug fix) +* Correct copyright +* More credits +* Update NWay doc URL +* Clean up commonly used ifdef switches +* Reorg info displayed at bootup/modprobe time +* Remove some unneeded spinlocks +* Misc cosmetic code cleanup +* Always print interrupt status for abnormal interrupts +* Use RealTek-recommended FIFO and DMA burst settings (1024 bytes) + + +Version 0.9.9 - September 9, 2000 + +* Fix oops-able bug in Rx ring wrap calculation (David Ford) +* Use PIO instead of MMIO when USE_IO_OPS is defined +* Move Rx error handling out of Rx interrupt handler, resulting in + tighter Rx interrupt processing + + Version 0.9.8 - September 7, 2000 * Propagate request_irq error value (andrew morton) diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/cs89x0.txt linux/Documentation/networking/cs89x0.txt --- v2.4.0-test8/linux/Documentation/networking/cs89x0.txt Fri Jul 28 12:50:51 2000 +++ linux/Documentation/networking/cs89x0.txt Mon Sep 18 14:58:17 2000 @@ -1,666 +1,688 @@ - -NOTE ----- - -This document was contributed by Cirrus Logic for kernel 2.2.5. This version -has been updated for 2.3.48 by Andrew Morton - -Cirrus make a copy of this driver available at their website, as -described below. In general, you should use the driver version which -comes with your Linux distribution. - - - -CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS -Linux Network Interface Driver ver. 2.00 -=============================================================================== - - -TABLE OF CONTENTS - -1.0 CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS - 1.1 Product Overview - 1.2 Driver Description - 1.2.1 Driver Name - 1.2.2 File in the Driver Package - 1.3 System Requirements - 1.4 Licensing Information - -2.0 ADAPTER INSTALLATION and CONFIGURATION - 2.1 CS8900-based Adapter Configuration - 2.2 CS8920-based Adapter Configuration - -3.0 LOADING THE DRIVER AS A MODULE - -4.0 COMPILING THE DRIVER - 4.1 Compiling the Driver as a Loadable Module - 4.2 Compiling the driver to support memory mode - 4.3 Compiling the driver to support Rx DMA - 4.4 Compiling the Driver into the Kernel - -5.0 TESTING AND TROUBLESHOOTING - 5.1 Known Defects and Limitations - 5.2 Testing the Adapter - 5.2.1 Diagnostic Self-Test - 5.2.2 Diagnostic Network Test - 5.3 Using the Adapter's LEDs - 5.4 Resolving I/O Conflicts - -6.0 TECHNICAL SUPPORT - 6.1 Contacting Cirrus Logic's Technical Support - 6.2 Information Required Before Contacting Technical Support - 6.3 Obtaining the Latest Driver Version - 6.4 Current maintainer - - - -1.0 CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS -=============================================================================== - - -1.1 PRODUCT OVERVIEW - -The CS8900-based ISA Ethernet Adapters from Cirrus Logic follow -IEEE 802.3 standards and support half or full-duplex operation in ISA bus -computers on 10 Mbps Ethernet networks. The adapters are designed for operation -in 16-bit ISA or EISA bus expansion slots and are available in -10BaseT-only or 3-media configurations (10BaseT, 10Base2, and AUI for 10Base-5 -or fiber networks). - -CS8920-based adapters are similar to the CS8900-based adapter with additional -features for Plug and Play (PnP) support and Wakeup Frame recognition. As -such, the configuration procedures differ somewhat between the two types of -adapters. Refer to the "Adapter Configuration" section for details on -configuring both types of adapters. - - -1.2 DRIVER DESCRIPTION - -The CS8900/CS8920 Ethernet Adapter driver for Linux supports the Linux -v2.3.48 or greater kernel. It can be compiled directly into the kernel -or loaded at run-time as a device driver module. - -1.2.1 Driver Name: cs89x0 - -1.2.2 Files in the Driver Archive: - -The files in the driver at Cirrus' website include: - - readme.txt - this file - build - batch file to compile cs89x0.c. - cs89x0.c - driver C code - cs89x0.h - driver header file - cs89x0.o - pre-compiled module (for v2.2.5 kernel) - config/Config.in - sample file to include cs89x0 driver in the kernel. - config/Makefile - sample file to include cs89x0 driver in the kernel. - config/Space.c - sample file to include cs89x0 driver in the kernel. - - - -1.3 SYSTEM REQUIREMENTS - -The following hardware is required: - - * Cirrus Logic LAN (CS8900/20-based) Ethernet ISA Adapter - - * IBM or IBM-compatible PC with: - * An 80386 or higher processor - * 16 bytes of contiguous IO space available between 210h - 370h - * One available IRQ (5,10,11,or 12 for the CS8900, 3-7,9-15 for CS8920). - - * Appropriate cable (and connector for AUI, 10BASE-2) for your network - topology. - -The following software is required: - -* LINUX kernel version 2.3.48 or higher - - * CS8900/20 Setup Utility (DOS-based) - - * LINUX kernel sources for your kernel (if compiling into kernel) - - * GNU Toolkit (gcc and make) v2.6 or above (if compiling into kernel - or a module) - - - -1.4 LICENSING INFORMATION - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation, version 1. - -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. - -For a full copy of the GNU General Public License, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - - -2.0 ADAPTER INSTALLATION and CONFIGURATION -=============================================================================== - -Both the CS8900 and CS8920-based adapters can be configured using parameters -stored in an on-board EEPROM. You must use the DOS-based CS8900/20 Setup -Utility if you want to change the adapter's configuration in EEPROM. - -When loading the driver as a module, you can specify many of the adapter's -configuration parameters on the command-line to override the EEPROM's settings -or for interface configuration when an EEPROM is not used. (CS8920-based -adapters must use an EEPROM.) See Section 3.0 LOADING THE DRIVER AS A MODULE. - -Since the CS8900/20 Setup Utility is a DOS-based application, you must install -and configure the adapter in a DOS-based system using the CS8900/20 Setup -Utility before installation in the target LINUX system. (Not required if -installing a CS8900-based adapter and the default configuration is acceptable.) - - -2.1 CS8900-BASED ADAPTER CONFIGURATION - -CS8900-based adapters shipped from Cirrus Logic have been configured -with the following "default" settings: - - Operation Mode: Memory Mode - IRQ: 10 - Base I/O Address: 300 - Memory Base Address: D0000 - Optimization: DOS Client - Transmission Mode: Half-duplex - BootProm: None - Media Type: Autodetect (3-media cards) or - 10BASE-T (10BASE-T only adapter) - -You should only change the default configuration settings if conflicts with -another adapter exists. To change the adapter's configuration, run the -CS8900/20 Setup Utility. - - -2.2 CS8920-BASED ADAPTER CONFIGURATION - -CS8920-based adapters are shipped from Cirrus Logic configured as Plug -and Play (PnP) enabled. However, since the cs89x0 driver does NOT -support PnP, you must install the CS8920 adapter in a DOS-based PC and -run the CS8900/20 Setup Utility to disable PnP and configure the -adapter before installation in the target Linux system. Failure to do -this will leave the adapter inactive and the driver will be unable to -communicate with the adapter. - - - **************************************************************** - * CS8920-BASED ADAPTERS: * - * * - * CS8920-BASED ADAPTERS ARE PLUG and PLAY ENABLED BY DEFAULT. * - * THE CS89X0 DRIVER DOES NOT SUPPORT PnP. THEREFORE, YOU MUST * - * RUN THE CS8900/20 SETUP UTILITY TO DISABLE PnP SUPPORT AND * - * TO ACTIVATE THE ADAPTER. * - **************************************************************** - - - - -3.0 LOADING THE DRIVER AS A MODULE -=============================================================================== - -If the driver is compiled as a loadable module, you can load the driver module -with the 'modprobe' command. Many of the adapter's configuration parameters can -be specified as command-line arguments to the load command. This facility -provides a means to override the EEPROM's settings or for interface -configuration when an EEPROM is not used. - -Example: - - insmod cs89x0.o io=0x200 irq=0xA media=aui - -This example loads the module and configures the adapter to use an IO port base -address of 200h, interrupt 10, and use the AUI media connection. The following -configuration options are available on the command line: - -* io=### - specify IO address (200h-360h) -* irq=## - specify interrupt level -* use_dma=1 - Enable DMA -* dma=# - specify dma channel (Driver is compiled to support - Rx DMA only) -* dmasize=# (16 or 64) - DMA size 16K or 64K. Default value is set to 16. -* media=rj45 - specify media type - or media=bnc - or media=aui - or medai=auto -* duplex=full - specify forced half/full/autonegotiate duplex - or duplex=half - or duplex=auto -* debug=# - debug level (only available if the driver was compiled - for debugging) - -NOTES: - -a) If an EEPROM is present, any specified command-line parameter - will override the corresponding configuration value stored in - EEPROM. - -b) The "io" parameter must be specified on the command-line. - -c) In case you can not re-load the driver because Linux system - returns the "device or resource busy" message, try to re-load it by - increment the IO port address by one. The driver will write - commands to the IO base addresses to reset the data port pointer. - You can specify an I/O address with an address value one greater - than the configured address. Example, to scan for an adapter - located at IO base 0x300, specify an IO address of 0x301. - -d) The "duplex=auto" parameter is only supported for the CS8920. - -e) The minimum command-line configuration required if an EEPROM is - not present is: - - io - irq - media type (no autodetect) - -f) The following additional parameters are CS89XX defaults (values - used with no EEPROM or command-line argument). - - * DMA Burst = enabled - * IOCHRDY Enabled = enabled - * UseSA = enabled - * CS8900 defaults to half-duplex if not specified on command-line - * CS8920 defaults to autoneg if not specified on command-line - * Use reset defaults for other config parameters - * dma_mode = 0 - -g) You can use ifconfig to set the adapter's Ethernet address. - -h) Many Linux distributions use the 'modprobe' command to load - modules. This program uses the '/etc/conf.modules' file to - determine configuration information which is passed to a driver - module when it is loaded. All the configuration options which are - described above may be placed within /etc/conf.modules. - - For example: - - > cat /etc/conf.modules - ... - alias eth0 cs89x0 - options cs89x0 io=0x0200 dma=5 use_dma=1 - ... - - In this example we are telling the module system that the - ethernet driver for this machine should use the cs89x0 driver. We - are asking 'modprobe' to pass the 'io', 'dma' and 'use_dma' - arguments to the driver when it is loaded. - -i) Cirrus recommend that the cs89x0 use the ISA DMA channels 5, 6 or - 7. You will probably find that other DMA channels will not work. - -j) The cs89x0 supports DMA for receiving only. DMA mode is - significantly more efficient. Flooding a 400 MHz Celeron machine - with large ping packets consumes 82% of its CPU capacity in non-DMA - mode. With DMA this is reduced to 45%. - -k) If your Linux kernel was compiled with inbuilt plug-and-play - support you will be able to find information about the cs89x0 card - with the command - - cat /proc/isapnp - -l) If during DMA operation you find erratic behavior or network data - corruption you should use your PC's BIOS to slow the EISA bus clock. - - -4.0 COMPILING THE DRIVER -=============================================================================== - -The cs89x0 driver can be compiled directly into the kernel or compiled into -a loadable device driver module. - - -4.1 COMPILING THE DRIVER AS A LOADABLE MODULE - -To compile the driver into a loadable module, use the following command -(single command line, without quotes): - -"gcc -D__KERNEL__ -I/usr/src/linux/include -I/usr/src/linux/net/inet -Wall --Wstrict-prototypes -O2 -fomit-frame-pointer -DMODULE -DCONFIG_MODVERSIONS --c cs89x0.c" - -4.2 COMPILING THE DRIVER TO SUPPORT MEMORY MODE - -Support for memory mode was not carried over into the 2.3 series kernels. - -4.3 COMPILING THE DRIVER TO SUPPORT Rx DMA - -The compile-time optionality for DMA was removed in the 2.3 kernel -series. DMA support is now unconditionally part of the driver. It is -enabled by the 'use_dma=1' module option. - -4.4 COMPILING THE DRIVER INTO THE KERNEL - -If your Linux distribution already has support for the cs89x0 driver -then simply copy the source file to the /usr/src/linux/drivers/net -directory to replace the original ones and run the make utility to -rebuild the kernel. See Step 3 for rebuilding the kernel. - -If your Linux does not include the cs89x0 driver, you need to edit three -configuration files, copy the source file to the /usr/src/linux/drivers/net -directory, and then run the make utility to rebuild the kernel. - -1. Edit the following configuration files by adding the statements as -indicated. (When possible, try to locate the added text to the section of the -file containing similar statements). - - -a.) In /usr/src/linux/drivers/net/Config.in, add: - -tristate 'CS89x0 support' CONFIG_CS89x0 - -Example: - - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'ICL EtherTeam 16i/32 support' CONFIG_ETH16I - fi - - tristate 'CS89x0 support' CONFIG_CS89x0 - - tristate 'NE2000/NE1000 support' CONFIG_NE2000 - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'NI5210 support' CONFIG_NI52 - - -b.) In /usr/src/linux/drivers/net/Makefile, add the following lines: - -ifeq ($(CONFIG_CS89x0),y) -L_OBJS += cs89x0.o -else - ifeq ($(CONFIG_CS89x0),m) - M_OBJS += cs89x0.o - endif -endif - - -c.) In /linux/drivers/net/Space.c file, add the line: - -extern int cs89x0_probe(struct device *dev); - - -Example: - - extern int ultra_probe(struct device *dev); - extern int wd_probe(struct device *dev); - extern int el2_probe(struct device *dev); - - extern int cs89x0_probe(struct device *dev); - - extern int ne_probe(struct device *dev); - extern int hp_probe(struct device *dev); - extern int hp_plus_probe(struct device *dev); - - -Also add: - - #ifdef CONFIG_CS89x0 - { cs89x0_probe,0 }, - #endif - - -2.) Copy the driver source files (cs89x0.c and cs89x0.h) -into the /usr/src/linux/drivers/net directory. - - -3.) Go to /usr/src/linux directory and run 'make config' followed by 'make dep' -and finally 'make' (or make bzImage) to rebuild the kernel. - -4.) Use the DOS 'setup' utility to disable plug and play on the NIC. - - -5.0 TESTING AND TROUBLESHOOTING -=============================================================================== - -5.1 KNOWN DEFECTS and LIMITATIONS - -Refer to the RELEASE.TXT file distributed as part of this archive for a list of -known defects, driver limitations, and work arounds. - - -5.2 TESTING THE ADAPTER - -Once the adapter has been installed and configured, the diagnostic option of -the CS8900/20 Setup Utility can be used to test the functionality of the -adapter and its network connection. Use the diagnostics 'Self Test' option to -test the functionality of the adapter with the hardware configuration you have -assigned. You can use the diagnostics 'Network Test' to test the ability of the -adapter to communicate across the Ethernet with another PC equipped with a -CS8900/20-based adapter card (it must also be running the CS8900/20 Setup -Utility). - - NOTE: The Setup Utility's diagnostics are designed to run in a - DOS-only operating system environment. DO NOT run the diagnostics - from a DOS or command prompt session under Windows 95, Windows NT, - OS/2, or other operating system. - -To run the diagnostics tests on the CS8900/20 adapter: - - 1.) Boot DOS on the PC and start the CS8900/20 Setup Utility. - - 2.) The adapter's current configuration is displayed. Hit the ENTER key to - get to the main menu. - - 4.) Select 'Diagnostics' (ALT-G) from the main menu. - * Select 'Self-Test' to test the adapter's basic functionality. - * Select 'Network Test' to test the network connection and cabling. - - -5.2.1 DIAGNOSTIC SELF-TEST - -The diagnostic self-test checks the adapter's basic functionality as well as -its ability to communicate across the ISA bus based on the system resources -assigned during hardware configuration. The following tests are performed: - - * IO Register Read/Write Test - The IO Register Read/Write test insures that the CS8900/20 can be - accessed in IO mode, and that the IO base address is correct. - - * Shared Memory Test - The Shared Memory test insures the CS8900/20 can be accessed in memory - mode and that the range of memory addresses assigned does not conflict - with other devices in the system. - - * Interrupt Test - The Interrupt test insures there are no conflicts with the assigned IRQ - signal. - - * EEPROM Test - The EEPROM test insures the EEPROM can be read. - - * Chip RAM Test - The Chip RAM test insures the 4K of memory internal to the CS8900/20 is - working properly. - - * Internal Loop-back Test - The Internal Loop Back test insures the adapter's transmitter and - receiver are operating properly. If this test fails, make sure the - adapter's cable is connected to the network (check for LED activity for - example). - - * Boot PROM Test - The Boot PROM test insures the Boot PROM is present, and can be read. - Failure indicates the Boot PROM was not successfully read due to a - hardware problem or due to a conflicts on the Boot PROM address - assignment. (Test only applies if the adapter is configured to use the - Boot PROM option.) - -Failure of a test item indicates a possible system resource conflict with -another device on the ISA bus. In this case, you should use the Manual Setup -option to reconfigure the adapter by selecting a different value for the system -resource that failed. - - -5.2.2 DIAGNOSTIC NETWORK TEST - -The Diagnostic Network Test verifies a working network connection by -transferring data between two CS8900/20 adapters installed in different PCs -on the same network. (Note: the diagnostic network test should not be run -between two nodes across a router.) - -This test requires that each of the two PCs have a CS8900/20-based adapter -installed and have the CS8900/20 Setup Utility running. The first PC is -configured as a Responder and the other PC is configured as an Initiator. -Once the Initiator is started, it sends data frames to the Responder which -returns the frames to the Initiator. - -The total number of frames received and transmitted are displayed on the -Initiator's display, along with a count of the number of frames received and -transmitted OK or in error. The test can be terminated anytime by the user at -either PC. - -To setup the Diagnostic Network Test: - - 1.) Select a PC with a CS8900/20-based adapter and a known working network - connection to act as the Responder. Run the CS8900/20 Setup Utility - and select 'Diagnostics -> Network Test -> Responder' from the main - menu. Hit ENTER to start the Responder. - - 2.) Return to the PC with the CS8900/20-based adapter you want to test and - start the CS8900/20 Setup Utility. - - 3.) From the main menu, Select 'Diagnostic -> Network Test -> Initiator'. - Hit ENTER to start the test. - -You may stop the test on the Initiator at any time while allowing the Responder -to continue running. In this manner, you can move to additional PCs and test -them by starting the Initiator on another PC without having to stop/start the -Responder. - - - -5.3 USING THE ADAPTER'S LEDs - -The 2 and 3-media adapters have two LEDs visible on the back end of the board -located near the 10Base-T connector. - -Link Integrity LED: A "steady" ON of the green LED indicates a valid 10Base-T -connection. (Only applies to 10Base-T. The green LED has no significance for -a 10Base-2 or AUI connection.) - -TX/RX LED: The yellow LED lights briefly each time the adapter transmits or -receives data. (The yellow LED will appear to "flicker" on a typical network.) - - -5.4 RESOLVING I/O CONFLICTS - -An IO conflict occurs when two or more adapter use the same ISA resource (IO -address, memory address or IRQ). You can usually detect an IO conflict in one -of four ways after installing and or configuring the CS8900/20-based adapter: - - 1.) The system does not boot properly (or at all). - - 2.) The driver can not communicate with the adapter, reporting an "Adapter - not found" error message. - - 3.) You cannot connect to the network or the driver will not load. - - 4.) If you have configured the adapter to run in memory mode but the driver - reports it is using IO mode when loading, this is an indication of a - memory address conflict. - -If an IO conflict occurs, run the CS8900/20 Setup Utility and perform a -diagnostic self-test. Normally, the ISA resource in conflict will fail the -self-test. If so, reconfigure the adapter selecting another choice for the -resource in conflict. Run the diagnostics again to check for further IO -conflicts. - -In some cases, such as when the PC will not boot, it may be necessary to remove -the adapter and reconfigure it by installing it in another PC to run the -CS8900/20 Setup Utility. Once reinstalled in the target system, run the -diagnostics self-test to ensure the new configuration is free of conflicts -before loading the driver again. - -When manually configuring the adapter, keep in mind the typical ISA system -resource usage as indicated in the tables below. - -I/O Address Device IRQ Device ------------ -------- --- -------- - 200-20F Game I/O adapter 3 COM2, Bus Mouse - 230-23F Bus Mouse 4 COM1 - 270-27F LPT3: third parallel port 5 LPT2 - 2F0-2FF COM2: second serial port 6 Floppy Disk controller - 320-32F Fixed disk controller 7 LPT1 - 8 Real-time Clock - 9 EGA/VGA display adapter - 12 Mouse (PS/2) -Memory Address Device 13 Math Coprocessor --------------- --------------------- 14 Hard Disk controller -A000-BFFF EGA Graphics Adpater -A000-C7FF VGA Graphics Adpater -B000-BFFF Mono Graphics Adapter -B800-BFFF Color Graphics Adapter -E000-FFFF AT BIOS - - - - -6.0 TECHNICAL SUPPORT -=============================================================================== - -6.1 CONTACTING CIRRUS LOGIC'S TECHNICAL SUPPORT - -Cirrus Logic's CS89XX Technical Application Support can be reached at: - -Telephone :(800) 888-5016 (from inside U.S. and Canada) - :(512) 442-7555 (from outside the U.S. and Canada) -Fax :(512) 912-3871 -Email :ethernet@crystal.cirrus.com -WWW :http://www.cirrus.com - - -6.2 INFORMATION REQUIRED BEFORE CONTACTING TECHNICAL SUPPORT - -Before contacting Cirrus Logic for technical support, be prepared to provide as -Much of the following information as possible. - -1.) Adapter type (CRD8900, CDB8900, CDB8920, etc.) - -2.) Adapter configuration - - * IO Base, Memory Base, IO or memory mode enabled, IRQ, DMA channel - * Plug and Play enabled/disabled (CS8920-based adapters only) - * Configured for media auto-detect or specific media type (which type). - -3.) PC System's Configuration - - * Plug and Play system (yes/no) - * BIOS (make and version) - * System make and model - * CPU (type and speed) - * System RAM - * SCSI Adapter - -4.) Software - - * CS89XX driver and version - * Your network operating system and version - * Your system's OS version - * Version of all protocol support files - -5.) Any Error Message displayed. - - - -6.3 OBTAINING THE LATEST DRIVER VERSION - -You can obtain the latest CS89XX drivers and support software from Cirrus Logic's -Web site. You can also contact Cirrus Logic's Technical Support (email: -ethernet@crystal.cirrus.com) and request that you be registered for automatic -software-update notification. - -Cirrus Logic maintains a web page at http://www.cirrus.com with the -the latest drivers and technical publications. - - -6.4 Current maintainer - -In February 2000 the maintenance of this driver was assumed by Andrew -Morton - - + +NOTE +---- + +This document was contributed by Cirrus Logic for kernel 2.2.5. This version +has been updated for 2.3.48 by Andrew Morton + +Cirrus make a copy of this driver available at their website, as +described below. In general, you should use the driver version which +comes with your Linux distribution. + + + +CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS +Linux Network Interface Driver ver. 2.00 +=============================================================================== + + +TABLE OF CONTENTS + +1.0 CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS + 1.1 Product Overview + 1.2 Driver Description + 1.2.1 Driver Name + 1.2.2 File in the Driver Package + 1.3 System Requirements + 1.4 Licensing Information + +2.0 ADAPTER INSTALLATION and CONFIGURATION + 2.1 CS8900-based Adapter Configuration + 2.2 CS8920-based Adapter Configuration + +3.0 LOADING THE DRIVER AS A MODULE + +4.0 COMPILING THE DRIVER + 4.1 Compiling the Driver as a Loadable Module + 4.2 Compiling the driver to support memory mode + 4.3 Compiling the driver to support Rx DMA + 4.4 Compiling the Driver into the Kernel + +5.0 TESTING AND TROUBLESHOOTING + 5.1 Known Defects and Limitations + 5.2 Testing the Adapter + 5.2.1 Diagnostic Self-Test + 5.2.2 Diagnostic Network Test + 5.3 Using the Adapter's LEDs + 5.4 Resolving I/O Conflicts + +6.0 TECHNICAL SUPPORT + 6.1 Contacting Cirrus Logic's Technical Support + 6.2 Information Required Before Contacting Technical Support + 6.3 Obtaining the Latest Driver Version + 6.4 Current maintainer + + + +1.0 CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS +=============================================================================== + + +1.1 PRODUCT OVERVIEW + +The CS8900-based ISA Ethernet Adapters from Cirrus Logic follow +IEEE 802.3 standards and support half or full-duplex operation in ISA bus +computers on 10 Mbps Ethernet networks. The adapters are designed for operation +in 16-bit ISA or EISA bus expansion slots and are available in +10BaseT-only or 3-media configurations (10BaseT, 10Base2, and AUI for 10Base-5 +or fiber networks). + +CS8920-based adapters are similar to the CS8900-based adapter with additional +features for Plug and Play (PnP) support and Wakeup Frame recognition. As +such, the configuration procedures differ somewhat between the two types of +adapters. Refer to the "Adapter Configuration" section for details on +configuring both types of adapters. + + +1.2 DRIVER DESCRIPTION + +The CS8900/CS8920 Ethernet Adapter driver for Linux supports the Linux +v2.3.48 or greater kernel. It can be compiled directly into the kernel +or loaded at run-time as a device driver module. + +1.2.1 Driver Name: cs89x0 + +1.2.2 Files in the Driver Archive: + +The files in the driver at Cirrus' website include: + + readme.txt - this file + build - batch file to compile cs89x0.c. + cs89x0.c - driver C code + cs89x0.h - driver header file + cs89x0.o - pre-compiled module (for v2.2.5 kernel) + config/Config.in - sample file to include cs89x0 driver in the kernel. + config/Makefile - sample file to include cs89x0 driver in the kernel. + config/Space.c - sample file to include cs89x0 driver in the kernel. + + + +1.3 SYSTEM REQUIREMENTS + +The following hardware is required: + + * Cirrus Logic LAN (CS8900/20-based) Ethernet ISA Adapter + + * IBM or IBM-compatible PC with: + * An 80386 or higher processor + * 16 bytes of contiguous IO space available between 210h - 370h + * One available IRQ (5,10,11,or 12 for the CS8900, 3-7,9-15 for CS8920). + + * Appropriate cable (and connector for AUI, 10BASE-2) for your network + topology. + +The following software is required: + +* LINUX kernel version 2.3.48 or higher + + * CS8900/20 Setup Utility (DOS-based) + + * LINUX kernel sources for your kernel (if compiling into kernel) + + * GNU Toolkit (gcc and make) v2.6 or above (if compiling into kernel + or a module) + + + +1.4 LICENSING INFORMATION + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, version 1. + +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. + +For a full copy of the GNU General Public License, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + + +2.0 ADAPTER INSTALLATION and CONFIGURATION +=============================================================================== + +Both the CS8900 and CS8920-based adapters can be configured using parameters +stored in an on-board EEPROM. You must use the DOS-based CS8900/20 Setup +Utility if you want to change the adapter's configuration in EEPROM. + +When loading the driver as a module, you can specify many of the adapter's +configuration parameters on the command-line to override the EEPROM's settings +or for interface configuration when an EEPROM is not used. (CS8920-based +adapters must use an EEPROM.) See Section 3.0 LOADING THE DRIVER AS A MODULE. + +Since the CS8900/20 Setup Utility is a DOS-based application, you must install +and configure the adapter in a DOS-based system using the CS8900/20 Setup +Utility before installation in the target LINUX system. (Not required if +installing a CS8900-based adapter and the default configuration is acceptable.) + + +2.1 CS8900-BASED ADAPTER CONFIGURATION + +CS8900-based adapters shipped from Cirrus Logic have been configured +with the following "default" settings: + + Operation Mode: Memory Mode + IRQ: 10 + Base I/O Address: 300 + Memory Base Address: D0000 + Optimization: DOS Client + Transmission Mode: Half-duplex + BootProm: None + Media Type: Autodetect (3-media cards) or + 10BASE-T (10BASE-T only adapter) + +You should only change the default configuration settings if conflicts with +another adapter exists. To change the adapter's configuration, run the +CS8900/20 Setup Utility. + + +2.2 CS8920-BASED ADAPTER CONFIGURATION + +CS8920-based adapters are shipped from Cirrus Logic configured as Plug +and Play (PnP) enabled. However, since the cs89x0 driver does NOT +support PnP, you must install the CS8920 adapter in a DOS-based PC and +run the CS8900/20 Setup Utility to disable PnP and configure the +adapter before installation in the target Linux system. Failure to do +this will leave the adapter inactive and the driver will be unable to +communicate with the adapter. + + + **************************************************************** + * CS8920-BASED ADAPTERS: * + * * + * CS8920-BASED ADAPTERS ARE PLUG and PLAY ENABLED BY DEFAULT. * + * THE CS89X0 DRIVER DOES NOT SUPPORT PnP. THEREFORE, YOU MUST * + * RUN THE CS8900/20 SETUP UTILITY TO DISABLE PnP SUPPORT AND * + * TO ACTIVATE THE ADAPTER. * + **************************************************************** + + + + +3.0 LOADING THE DRIVER AS A MODULE +=============================================================================== + +If the driver is compiled as a loadable module, you can load the driver module +with the 'modprobe' command. Many of the adapter's configuration parameters can +be specified as command-line arguments to the load command. This facility +provides a means to override the EEPROM's settings or for interface +configuration when an EEPROM is not used. + +Example: + + insmod cs89x0.o io=0x200 irq=0xA media=aui + +This example loads the module and configures the adapter to use an IO port base +address of 200h, interrupt 10, and use the AUI media connection. The following +configuration options are available on the command line: + +* io=### - specify IO address (200h-360h) +* irq=## - specify interrupt level +* use_dma=1 - Enable DMA +* dma=# - specify dma channel (Driver is compiled to support + Rx DMA only) +* dmasize=# (16 or 64) - DMA size 16K or 64K. Default value is set to 16. +* media=rj45 - specify media type + or media=bnc + or media=aui + or medai=auto +* duplex=full - specify forced half/full/autonegotiate duplex + or duplex=half + or duplex=auto +* debug=# - debug level (only available if the driver was compiled + for debugging) + +NOTES: + +a) If an EEPROM is present, any specified command-line parameter + will override the corresponding configuration value stored in + EEPROM. + +b) The "io" parameter must be specified on the command-line. + +c) In case you can not re-load the driver because Linux system + returns the "device or resource busy" message, try to re-load it by + increment the IO port address by one. The driver will write + commands to the IO base addresses to reset the data port pointer. + You can specify an I/O address with an address value one greater + than the configured address. Example, to scan for an adapter + located at IO base 0x300, specify an IO address of 0x301. + +d) The "duplex=auto" parameter is only supported for the CS8920. + +e) The minimum command-line configuration required if an EEPROM is + not present is: + + io + irq + media type (no autodetect) + +f) The following additional parameters are CS89XX defaults (values + used with no EEPROM or command-line argument). + + * DMA Burst = enabled + * IOCHRDY Enabled = enabled + * UseSA = enabled + * CS8900 defaults to half-duplex if not specified on command-line + * CS8920 defaults to autoneg if not specified on command-line + * Use reset defaults for other config parameters + * dma_mode = 0 + +g) You can use ifconfig to set the adapter's Ethernet address. + +h) Many Linux distributions use the 'modprobe' command to load + modules. This program uses the '/etc/conf.modules' file to + determine configuration information which is passed to a driver + module when it is loaded. All the configuration options which are + described above may be placed within /etc/conf.modules. + + For example: + + > cat /etc/conf.modules + ... + alias eth0 cs89x0 + options cs89x0 io=0x0200 dma=5 use_dma=1 + ... + + In this example we are telling the module system that the + ethernet driver for this machine should use the cs89x0 driver. We + are asking 'modprobe' to pass the 'io', 'dma' and 'use_dma' + arguments to the driver when it is loaded. + +i) Cirrus recommend that the cs89x0 use the ISA DMA channels 5, 6 or + 7. You will probably find that other DMA channels will not work. + +j) The cs89x0 supports DMA for receiving only. DMA mode is + significantly more efficient. Flooding a 400 MHz Celeron machine + with large ping packets consumes 82% of its CPU capacity in non-DMA + mode. With DMA this is reduced to 45%. + +k) If your Linux kernel was compiled with inbuilt plug-and-play + support you will be able to find information about the cs89x0 card + with the command + + cat /proc/isapnp + +l) If during DMA operation you find erratic behavior or network data + corruption you should use your PC's BIOS to slow the EISA bus clock. + +m) If the cs89x0 driver is compiled directly into the kernel + (non-modular) then its I/O address is automatically determined by + ISA bus probing. The IRQ number, media options, etc are determined + from the card's EEPROM. + +n) If the cs89x0 driver is compiled directly into the kernel, DMA + mode may be selected by providing the kernel with a boot option + 'cs89x0_dma=N' where 'N' is the desired DMA channel number (5, 6 or 7). + + Kernel boot options may be provided on the LILO command line: + + LILO boot: linux cs89x0_dma=5 + + or they may be placed in /etc/lilo.conf: + + image=/boot/bzImage-2.3.48 + append="cs89x0_dma=5" + label=linux + root=/dev/hda5 + read-only + + The DMA Rx buffer size is hardwired to 16 kbytes in this mode. + (64k mode is not available). + + +4.0 COMPILING THE DRIVER +=============================================================================== + +The cs89x0 driver can be compiled directly into the kernel or compiled into +a loadable device driver module. + + +4.1 COMPILING THE DRIVER AS A LOADABLE MODULE + +To compile the driver into a loadable module, use the following command +(single command line, without quotes): + +"gcc -D__KERNEL__ -I/usr/src/linux/include -I/usr/src/linux/net/inet -Wall +-Wstrict-prototypes -O2 -fomit-frame-pointer -DMODULE -DCONFIG_MODVERSIONS +-c cs89x0.c" + +4.2 COMPILING THE DRIVER TO SUPPORT MEMORY MODE + +Support for memory mode was not carried over into the 2.3 series kernels. + +4.3 COMPILING THE DRIVER TO SUPPORT Rx DMA + +The compile-time optionality for DMA was removed in the 2.3 kernel +series. DMA support is now unconditionally part of the driver. It is +enabled by the 'use_dma=1' module option. + +4.4 COMPILING THE DRIVER INTO THE KERNEL + +If your Linux distribution already has support for the cs89x0 driver +then simply copy the source file to the /usr/src/linux/drivers/net +directory to replace the original ones and run the make utility to +rebuild the kernel. See Step 3 for rebuilding the kernel. + +If your Linux does not include the cs89x0 driver, you need to edit three +configuration files, copy the source file to the /usr/src/linux/drivers/net +directory, and then run the make utility to rebuild the kernel. + +1. Edit the following configuration files by adding the statements as +indicated. (When possible, try to locate the added text to the section of the +file containing similar statements). + + +a.) In /usr/src/linux/drivers/net/Config.in, add: + +tristate 'CS89x0 support' CONFIG_CS89x0 + +Example: + + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate 'ICL EtherTeam 16i/32 support' CONFIG_ETH16I + fi + + tristate 'CS89x0 support' CONFIG_CS89x0 + + tristate 'NE2000/NE1000 support' CONFIG_NE2000 + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate 'NI5210 support' CONFIG_NI52 + + +b.) In /usr/src/linux/drivers/net/Makefile, add the following lines: + +ifeq ($(CONFIG_CS89x0),y) +L_OBJS += cs89x0.o +else + ifeq ($(CONFIG_CS89x0),m) + M_OBJS += cs89x0.o + endif +endif + + +c.) In /linux/drivers/net/Space.c file, add the line: + +extern int cs89x0_probe(struct device *dev); + + +Example: + + extern int ultra_probe(struct device *dev); + extern int wd_probe(struct device *dev); + extern int el2_probe(struct device *dev); + + extern int cs89x0_probe(struct device *dev); + + extern int ne_probe(struct device *dev); + extern int hp_probe(struct device *dev); + extern int hp_plus_probe(struct device *dev); + + +Also add: + + #ifdef CONFIG_CS89x0 + { cs89x0_probe,0 }, + #endif + + +2.) Copy the driver source files (cs89x0.c and cs89x0.h) +into the /usr/src/linux/drivers/net directory. + + +3.) Go to /usr/src/linux directory and run 'make config' followed by 'make dep' +and finally 'make' (or make bzImage) to rebuild the kernel. + +4.) Use the DOS 'setup' utility to disable plug and play on the NIC. + + +5.0 TESTING AND TROUBLESHOOTING +=============================================================================== + +5.1 KNOWN DEFECTS and LIMITATIONS + +Refer to the RELEASE.TXT file distributed as part of this archive for a list of +known defects, driver limitations, and work arounds. + + +5.2 TESTING THE ADAPTER + +Once the adapter has been installed and configured, the diagnostic option of +the CS8900/20 Setup Utility can be used to test the functionality of the +adapter and its network connection. Use the diagnostics 'Self Test' option to +test the functionality of the adapter with the hardware configuration you have +assigned. You can use the diagnostics 'Network Test' to test the ability of the +adapter to communicate across the Ethernet with another PC equipped with a +CS8900/20-based adapter card (it must also be running the CS8900/20 Setup +Utility). + + NOTE: The Setup Utility's diagnostics are designed to run in a + DOS-only operating system environment. DO NOT run the diagnostics + from a DOS or command prompt session under Windows 95, Windows NT, + OS/2, or other operating system. + +To run the diagnostics tests on the CS8900/20 adapter: + + 1.) Boot DOS on the PC and start the CS8900/20 Setup Utility. + + 2.) The adapter's current configuration is displayed. Hit the ENTER key to + get to the main menu. + + 4.) Select 'Diagnostics' (ALT-G) from the main menu. + * Select 'Self-Test' to test the adapter's basic functionality. + * Select 'Network Test' to test the network connection and cabling. + + +5.2.1 DIAGNOSTIC SELF-TEST + +The diagnostic self-test checks the adapter's basic functionality as well as +its ability to communicate across the ISA bus based on the system resources +assigned during hardware configuration. The following tests are performed: + + * IO Register Read/Write Test + The IO Register Read/Write test insures that the CS8900/20 can be + accessed in IO mode, and that the IO base address is correct. + + * Shared Memory Test + The Shared Memory test insures the CS8900/20 can be accessed in memory + mode and that the range of memory addresses assigned does not conflict + with other devices in the system. + + * Interrupt Test + The Interrupt test insures there are no conflicts with the assigned IRQ + signal. + + * EEPROM Test + The EEPROM test insures the EEPROM can be read. + + * Chip RAM Test + The Chip RAM test insures the 4K of memory internal to the CS8900/20 is + working properly. + + * Internal Loop-back Test + The Internal Loop Back test insures the adapter's transmitter and + receiver are operating properly. If this test fails, make sure the + adapter's cable is connected to the network (check for LED activity for + example). + + * Boot PROM Test + The Boot PROM test insures the Boot PROM is present, and can be read. + Failure indicates the Boot PROM was not successfully read due to a + hardware problem or due to a conflicts on the Boot PROM address + assignment. (Test only applies if the adapter is configured to use the + Boot PROM option.) + +Failure of a test item indicates a possible system resource conflict with +another device on the ISA bus. In this case, you should use the Manual Setup +option to reconfigure the adapter by selecting a different value for the system +resource that failed. + + +5.2.2 DIAGNOSTIC NETWORK TEST + +The Diagnostic Network Test verifies a working network connection by +transferring data between two CS8900/20 adapters installed in different PCs +on the same network. (Note: the diagnostic network test should not be run +between two nodes across a router.) + +This test requires that each of the two PCs have a CS8900/20-based adapter +installed and have the CS8900/20 Setup Utility running. The first PC is +configured as a Responder and the other PC is configured as an Initiator. +Once the Initiator is started, it sends data frames to the Responder which +returns the frames to the Initiator. + +The total number of frames received and transmitted are displayed on the +Initiator's display, along with a count of the number of frames received and +transmitted OK or in error. The test can be terminated anytime by the user at +either PC. + +To setup the Diagnostic Network Test: + + 1.) Select a PC with a CS8900/20-based adapter and a known working network + connection to act as the Responder. Run the CS8900/20 Setup Utility + and select 'Diagnostics -> Network Test -> Responder' from the main + menu. Hit ENTER to start the Responder. + + 2.) Return to the PC with the CS8900/20-based adapter you want to test and + start the CS8900/20 Setup Utility. + + 3.) From the main menu, Select 'Diagnostic -> Network Test -> Initiator'. + Hit ENTER to start the test. + +You may stop the test on the Initiator at any time while allowing the Responder +to continue running. In this manner, you can move to additional PCs and test +them by starting the Initiator on another PC without having to stop/start the +Responder. + + + +5.3 USING THE ADAPTER'S LEDs + +The 2 and 3-media adapters have two LEDs visible on the back end of the board +located near the 10Base-T connector. + +Link Integrity LED: A "steady" ON of the green LED indicates a valid 10Base-T +connection. (Only applies to 10Base-T. The green LED has no significance for +a 10Base-2 or AUI connection.) + +TX/RX LED: The yellow LED lights briefly each time the adapter transmits or +receives data. (The yellow LED will appear to "flicker" on a typical network.) + + +5.4 RESOLVING I/O CONFLICTS + +An IO conflict occurs when two or more adapter use the same ISA resource (IO +address, memory address or IRQ). You can usually detect an IO conflict in one +of four ways after installing and or configuring the CS8900/20-based adapter: + + 1.) The system does not boot properly (or at all). + + 2.) The driver can not communicate with the adapter, reporting an "Adapter + not found" error message. + + 3.) You cannot connect to the network or the driver will not load. + + 4.) If you have configured the adapter to run in memory mode but the driver + reports it is using IO mode when loading, this is an indication of a + memory address conflict. + +If an IO conflict occurs, run the CS8900/20 Setup Utility and perform a +diagnostic self-test. Normally, the ISA resource in conflict will fail the +self-test. If so, reconfigure the adapter selecting another choice for the +resource in conflict. Run the diagnostics again to check for further IO +conflicts. + +In some cases, such as when the PC will not boot, it may be necessary to remove +the adapter and reconfigure it by installing it in another PC to run the +CS8900/20 Setup Utility. Once reinstalled in the target system, run the +diagnostics self-test to ensure the new configuration is free of conflicts +before loading the driver again. + +When manually configuring the adapter, keep in mind the typical ISA system +resource usage as indicated in the tables below. + +I/O Address Device IRQ Device +----------- -------- --- -------- + 200-20F Game I/O adapter 3 COM2, Bus Mouse + 230-23F Bus Mouse 4 COM1 + 270-27F LPT3: third parallel port 5 LPT2 + 2F0-2FF COM2: second serial port 6 Floppy Disk controller + 320-32F Fixed disk controller 7 LPT1 + 8 Real-time Clock + 9 EGA/VGA display adapter + 12 Mouse (PS/2) +Memory Address Device 13 Math Coprocessor +-------------- --------------------- 14 Hard Disk controller +A000-BFFF EGA Graphics Adpater +A000-C7FF VGA Graphics Adpater +B000-BFFF Mono Graphics Adapter +B800-BFFF Color Graphics Adapter +E000-FFFF AT BIOS + + + + +6.0 TECHNICAL SUPPORT +=============================================================================== + +6.1 CONTACTING CIRRUS LOGIC'S TECHNICAL SUPPORT + +Cirrus Logic's CS89XX Technical Application Support can be reached at: + +Telephone :(800) 888-5016 (from inside U.S. and Canada) + :(512) 442-7555 (from outside the U.S. and Canada) +Fax :(512) 912-3871 +Email :ethernet@crystal.cirrus.com +WWW :http://www.cirrus.com + + +6.2 INFORMATION REQUIRED BEFORE CONTACTING TECHNICAL SUPPORT + +Before contacting Cirrus Logic for technical support, be prepared to provide as +Much of the following information as possible. + +1.) Adapter type (CRD8900, CDB8900, CDB8920, etc.) + +2.) Adapter configuration + + * IO Base, Memory Base, IO or memory mode enabled, IRQ, DMA channel + * Plug and Play enabled/disabled (CS8920-based adapters only) + * Configured for media auto-detect or specific media type (which type). + +3.) PC System's Configuration + + * Plug and Play system (yes/no) + * BIOS (make and version) + * System make and model + * CPU (type and speed) + * System RAM + * SCSI Adapter + +4.) Software + + * CS89XX driver and version + * Your network operating system and version + * Your system's OS version + * Version of all protocol support files + +5.) Any Error Message displayed. + + + +6.3 OBTAINING THE LATEST DRIVER VERSION + +You can obtain the latest CS89XX drivers and support software from Cirrus Logic's +Web site. You can also contact Cirrus Logic's Technical Support (email: +ethernet@crystal.cirrus.com) and request that you be registered for automatic +software-update notification. + +Cirrus Logic maintains a web page at http://www.cirrus.com with the +the latest drivers and technical publications. + + +6.4 Current maintainer + +In February 2000 the maintenance of this driver was assumed by Andrew +Morton diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/sk98lin.txt linux/Documentation/networking/sk98lin.txt --- v2.4.0-test8/linux/Documentation/networking/sk98lin.txt Fri Jul 28 12:50:52 2000 +++ linux/Documentation/networking/sk98lin.txt Fri Sep 15 14:34:19 2000 @@ -1,9 +1,9 @@ -(C)Copyright 1999 SysKonnect. +(C)Copyright 1999-2000 SysKonnect. =========================================================================== -sk98lin.txt created 11-Nov-1999 +sk98lin.txt created 12-Sept-2000 -Readme File for sk98lin.o v3.04 +Readme File for sk98lin.o v3.05 SK-NET Gigabit Ethernet Adapter SK-98xx Driver for Linux This file contains @@ -372,6 +372,12 @@ (8) HISTORY =========== + +VERSION 3.05 (In-Kernel version) +Problems fixed: +- Failed for multiple adapters in kernel 2.4.0 +New features: +- New versions of several common modules VERSION 3.04 (In-Kernel version) Problems fixed: diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/networking/vortex.txt linux/Documentation/networking/vortex.txt --- v2.4.0-test8/linux/Documentation/networking/vortex.txt Mon Aug 21 08:57:35 2000 +++ linux/Documentation/networking/vortex.txt Fri Sep 15 16:28:25 2000 @@ -166,8 +166,9 @@ Sets the time duration (in milliseconds) after which the kernel decides that the transmitter has become stuck and needs to be reset. - This is mainly for debugging purposes. The default value is 400 (0.4 - seconds). + This is mainly for debugging purposes, although it may be advantageous + to increase this value on LANs which have very high collision rates. + The default value is 400 (0.4 seconds). Additional resources -------------------- diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/pci.txt linux/Documentation/pci.txt --- v2.4.0-test8/linux/Documentation/pci.txt Mon May 15 12:13:10 2000 +++ linux/Documentation/pci.txt Sun Sep 17 09:45:06 2000 @@ -188,6 +188,11 @@ list. pci_module_init() Inline helper function for ensuring correct pci_driver initialization and error handling. +pci_resource_start() Returns bus start address for a given PCI region +pci_resource_end() Returns bus end address for a given PCI region +pci_resource_len() Returns the byte length of a PCI region +pci_set_drvdata() Set private driver data pointer for a pci_dev +pci_get_drvdata() Return private driver data pointer for a pci_dev 7. Miscellaneous hints diff -u --recursive --new-file v2.4.0-test8/linux/Documentation/sound/PSS-updates linux/Documentation/sound/PSS-updates --- v2.4.0-test8/linux/Documentation/sound/PSS-updates Wed Dec 31 16:00:00 1969 +++ linux/Documentation/sound/PSS-updates Mon Sep 18 15:02:02 2000 @@ -0,0 +1,88 @@ + This file contains notes for users of PSS sound cards who wish to use the +newly added features of the newest version of this driver. + + The major enhancements present in this new revision of this driver is the +addition of two new module parameters that allow you to take full advantage of +all the features present on your PSS sound card. These features include the +ability to enable both the builtin CDROM and joystick ports. + +pss_enable_joystick + + This parameter is basically a flag. A 0 will leave the joystick port +disabled, while a non-zero value would enable the joystick port. The default +setting is pss_enable_joystick=0 as this keeps this driver fully compatable +with systems that were using previous versions of this driver. If you wish to +enable the joystick port you will have to add pss_enable_joystick=1 as an +argument to the driver. To actually use the joystick port you will then have +to load the joystick driver itself. Just remember to load the joystick driver +AFTER the pss sound driver. + +pss_cdrom_port + + This parameter takes a port address as its parameter. Any available port +address can be specified to enable the CDROM port, except for 0x0 and -1 as +these values would leave the port disabled. Like the joystick port, the cdrom +port will require that an appropiate CDROM driver be loaded before you can make +use of the newly enabled CDROM port. Like the joystick port option above, +remember to load the CDROM driver AFTER the pss sound driver. While it may +differ on some PSS sound cards, all the PSS sound cards that I have seen have a +builtin Wearnes CDROM port. If this is the case with your PSS sound card you +should load aztcd with the appropiate port option that matches the port you +assigned to the CDROM port when you loaded your pss sound driver. (ex. +modprobe pss pss_cdrom_port=0x340 && modprobe aztcd aztcd=0x340) The default +setting of this parameter leaves the CDROM port disabled to maintain full +compatability with systems using previous versions of this driver. + + Other options have also been added for the added convenience and utility +of the user. These options are only available if this driver is loaded as a +module. + +pss_no_sound + + This module parameter is a flag that can be used to tell the driver to +just configure non-sound components. 0 configures all components, a non-0 +value will only attept to configure the CDROM and joystick ports. This +parameter can be used by a user who only wished to use the builtin joystick +and/or CDROM port(s) of his PSS sound card. If this driver is loaded with this +parameter and with the paramter below set to true then a user can safely unload +this driver with the following command "rmmod pss && rmmod ad1848 && rmmod +mpu401 && rmmod sound && rmmod soundcore" and retain the full functionality of +his CDROM and/or joystick port(s) while gaining back the memory previously used +by the sound drivers. This default setting of this parameter is 0 to retain +full behavioral compatability with previous versions of this driver. + +pss_keep_settings + + This parameter can be used to specify whether you want the driver to reset +all emulations whenever its unloaded. This can be useful for those who are +sharing resources (io ports, IRQ's, DMA's) between different ISA cards. This +flag can also be useful in that future versions of this driver may reset all +emulations by default on the driver's unloading (as it probably should), so +specifying it now will ensure that all future versions of this driver will +continue to work as expected. The default value of this parameter is 1 to +retain full behavioral compatability with previous versions of this driver. + +pss_firmware + + This parameter can be used to specify the file containing the firmware +code so that a user could tell the driver where that file is located instead +of having to put it in a predefined location with a predefined name. The +default setting of this parameter is "/etc/sound/pss_synth" as this was the +path and filename the hardcoded value in the previous versions of this driver. + +Examples: + +# Normal PSS sound card system, loading of drivers. +# Should be specified in an rc file (ex. Slackware uses /etc/rc.d/rc.modules). + +/sbin/modprobe pss pss_io=0x220 mpu_io=0x338 mpu_irq=9 mss_io=0x530 mss_irq=10 mss_dma=1 pss_cdrom_port=0x340 pss_enable_joystick=1 +/sbin/modprobe aztcd aztcd=0x340 +/sbin/modprobe joystick + +# System using the PSS sound card just for its CDROM and joystick ports. +# Should be specified in an rc file (ex. Slackware uses /etc/rc.d/rc.modules). + +/sbin/modprobe pss pss_io=0x220 pss_cdrom_port=0x340 pss_enable_joystick=1 pss_no_sound=1 +/sbin/rmmod pss && /sbin/rmmod ad1848 && /sbin/rmmod mpu401 && /sbin/rmmod sound && /sbin/rmmod soundcore # This line not needed, but saves memory. +/sbin/modprobe aztcd aztcd=0x340 +/sbin/modprobe joystick diff -u --recursive --new-file v2.4.0-test8/linux/MAINTAINERS linux/MAINTAINERS --- v2.4.0-test8/linux/MAINTAINERS Tue Sep 5 13:46:15 2000 +++ linux/MAINTAINERS Fri Sep 15 16:43:40 2000 @@ -1152,6 +1152,13 @@ L: linux-tulip@cesdis.gsfc.nasa.gov S: Maintained +TUN/TAP driver +P: Maxim Krasnyansky +M: maxk@qualcomm.com, max_mk@yahoo.com +L: vtun@office.satix.net +W: http://vtun.sourceforge.net/tun +S: Maintained + U14-34F SCSI DRIVER P: Dario Ballabio M: dario@milano.europe.dg.com @@ -1228,7 +1235,7 @@ USB OV511 DRIVER P: Mark McClelland -M: mmcclelland@delphi.com +M: mwm@i.am L: linux-usb-users@lists.sourceforge.net L: linux-usb-devel@lists.sourceforge.net W: http://alpha.dyndns.org/ov511/ diff -u --recursive --new-file v2.4.0-test8/linux/Makefile linux/Makefile --- v2.4.0-test8/linux/Makefile Wed Aug 23 18:36:46 2000 +++ linux/Makefile Sun Sep 17 09:48:04 2000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 0 -EXTRAVERSION = -test8 +EXTRAVERSION = -test9 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -161,7 +161,7 @@ DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus.a DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/zorro.a DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a -DRIVERS-$(CONFIG_PPC) += drivers/macintosh/macintosh.o +DRIVERS-$(CONFIG_ALL_PPC) += drivers/macintosh/macintosh.o DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/sgi.a @@ -174,7 +174,7 @@ DRIVERS-$(CONFIG_I2O) += drivers/i2o/i2o.o DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o -DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.a +DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.o DRIVERS-$(CONFIG_ACPI_INTERPRETER) += drivers/acpi/acpi.o DRIVERS += $(DRIVERS-y) diff -u --recursive --new-file v2.4.0-test8/linux/Rules.make linux/Rules.make --- v2.4.0-test8/linux/Rules.make Sun Aug 13 09:55:51 2000 +++ linux/Rules.make Mon Sep 18 14:59:23 2000 @@ -73,6 +73,9 @@ endif +%.lst: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< + $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP) # # # diff -u --recursive --new-file v2.4.0-test8/linux/arch/alpha/kernel/time.c linux/arch/alpha/kernel/time.c --- v2.4.0-test8/linux/arch/alpha/kernel/time.c Mon Aug 21 07:52:34 2000 +++ linux/arch/alpha/kernel/time.c Mon Sep 11 08:39:47 2000 @@ -135,38 +135,6 @@ write_unlock(&xtime_lock); } -/* - * Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void common_init_rtc(void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/alpha/mm/fault.c linux/arch/alpha/mm/fault.c --- v2.4.0-test8/linux/arch/alpha/mm/fault.c Mon Jun 19 17:59:33 2000 +++ linux/arch/alpha/mm/fault.c Mon Sep 18 14:57:02 2000 @@ -167,7 +167,7 @@ if ((fixup = search_exception_table(regs->pc, regs->gp)) != 0) { unsigned long newpc; newpc = fixup_exception(dpf_reg, fixup, regs->pc); -#if 1 +#if 0 printk("%s: Exception at [<%lx>] (%lx) handled successfully\n", current->comm, regs->pc, newpc); #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/Makefile linux/arch/arm/Makefile --- v2.4.0-test8/linux/arch/arm/Makefile Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/Makefile Mon Sep 18 15:15:24 2000 @@ -10,7 +10,7 @@ # License. See the file "COPYING" in the main directory of this archive # for more details. # -# Copyright (C) 1995-1999 by Russell King +# Copyright (C) 1995-2000 by Russell King OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S CPP := $(CC) -E @@ -51,21 +51,11 @@ CFLAGS_PROC_CPU_26 := -mcpu=arm3 -mapcs-26 -Os CFLAGS_PROC_CPU_32v3 := -march=armv3 CFLAGS_PROC_CPU_32v4 := -march=armv4 -CFLAGS_ARM6 := -mtune=arm6 -CFLAGS_ARM7 := -mtune=arm7 -CFLAGS_ARM720 := -mtune=arm7tdmi -CFLAGS_ARM920 := -mtune=arm9tdmi -CFLAGS_SA110 := -mtune=strongarm110 else CFLAGS += -DNO_TEXT_SECTIONS CFLAGS_PROC_CPU_26 := -m3 -CFLAGS_PROC_CPU_32v3 := -CFLAGS_PROC_CPU_32v4 := -CFLAGS_ARM6 := -m6 -CFLAGS_ARM7 := -m6 -CFLAGS_ARM720 := -m6 -CFLAGS_ARM920 := -m6 -CFLAGS_SA110 := -m6 +CFLAGS_PROC_CPU_32v3 := -m6 +CFLAGS_PROC_CPU_32v4 := -m6 endif # @@ -88,31 +78,16 @@ CFLAGS += $(CFLAGS_PROC_CPU_32v3) AFLAGS += -mapcs-32 -marmv3m endif - # - # Exactly one of the following must be selected - # - ifeq ($(CONFIG_CPU_ARM6),y) - CFLAGS += $(CFLAGS_ARM6) - else - ifeq ($(CONFIG_CPU_ARM7),y) - CFLAGS += $(CFLAGS_ARM7) - else - ifeq ($(CONFIG_CPU_ARM720),y) - CFLAGS += $(CFLAGS_ARM720) - else - ifeq ($(CONFIG_CPU_ARM920),y) - CFLAGS += $(CFLAGS_ARM920) - else - ifeq ($(CONFIG_CPU_SA110),y) - CFLAGS += $(CFLAGS_SA110) - else - ifeq ($(CONFIG_CPU_SA1100),y) - CFLAGS += $(CFLAGS_SA110) - endif - endif - endif - endif - endif + + opt-$(CONFIG_CPU_ARM6) := -mtune=arm6 + opt-$(CONFIG_CPU_ARM7) := -mtune=arm7 + opt-$(CONFIG_CPU_ARM720) := -mtune=arm7tdmi + opt-$(CONFIG_CPU_ARM920) := -mtune=arm9tdmi + opt-$(CONFIG_CPU_SA110) := -mtune=strongarm110 + opt-$(CONFIG_CPU_SA1100) := -mtune=strongarm110 + + ifneq ($(NEW_GCC),0) + CFLAGS += $(opt-y) endif endif @@ -169,7 +144,10 @@ endif # Only set INCDIR if its not already defined above -INCDIR ?= $(MACHINE) +# Grr, ?= doesn't work as all the other assignment operators do. Make bug? +ifeq ($(origin INCDIR), undefined) +INCDIR := $(MACHINE) +endif # If we have a machine-specific directory, then include it in the build. MACHDIR := arch/arm/mach-$(MACHINE) diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/Makefile linux/arch/arm/boot/Makefile --- v2.4.0-test8/linux/arch/arm/boot/Makefile Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/boot/Makefile Mon Sep 18 15:15:24 2000 @@ -42,6 +42,13 @@ INITRD_VIRT = 0xc0800000 endif +ifeq ($(CONFIG_ARCH_INTEGRATOR),y) +ZTEXTADDR = 0x00008000 +PARAMS = 0x00000100 +INITRD_PHYS = 0x00800000 +INITRD_VIRT = 0xc0800000 +endif + ifeq ($(CONFIG_ARCH_NEXUSPCI),y) ZTEXTADDR = 0x40200000 ZRELADDR = 0x40008000 diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/bootp/bootp.lds linux/arch/arm/boot/bootp/bootp.lds --- v2.4.0-test8/linux/arch/arm/boot/bootp/bootp.lds Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/boot/bootp/bootp.lds Mon Sep 18 15:15:24 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/boot/bootp/bootp.lds + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/bootp/init.S linux/arch/arm/boot/bootp/init.S --- v2.4.0-test8/linux/arch/arm/boot/bootp/init.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/boot/bootp/init.S Mon Sep 18 15:15:24 2000 @@ -1,6 +1,14 @@ /* - * Header file for splitting kernel + initrd. Note that we pass - * r0 through to r3 straight through. + * linux/arch/arm/boot/bootp/init.S + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Header file for splitting kernel + initrd. Note that we pass + * r0 through to r3 straight through. */ .section .start,#alloc,#execinstr .type _entry, #function diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/Makefile linux/arch/arm/boot/compressed/Makefile --- v2.4.0-test8/linux/arch/arm/boot/compressed/Makefile Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/boot/compressed/Makefile Mon Sep 18 15:15:24 2000 @@ -24,6 +24,10 @@ OBJS += head-netwinder.o endif +ifeq ($(CONFIG_ARCH_INTEGRATOR),y) +OBJS += head-netwinder.o +endif + ifeq ($(CONFIG_ARCH_NEXUSPCI),y) HEAD = head-nexuspci.o endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/head-netwinder.S linux/arch/arm/boot/compressed/head-netwinder.S --- v2.4.0-test8/linux/arch/arm/boot/compressed/head-netwinder.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/boot/compressed/head-netwinder.S Mon Sep 18 15:15:24 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/boot/compressed/head-netwinder.S + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #define K(a,b,c) ((a) << 24 | (b) << 12 | (c)) .section ".start", #alloc, #execinstr diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/head.S linux/arch/arm/boot/compressed/head.S --- v2.4.0-test8/linux/arch/arm/boot/compressed/head.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/boot/compressed/head.S Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/boot/compressed/head.S + * linux/arch/arm/boot/compressed/head.S * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/ll_char_wr.S linux/arch/arm/boot/compressed/ll_char_wr.S --- v2.4.0-test8/linux/arch/arm/boot/compressed/ll_char_wr.S Thu Jun 17 01:11:35 1999 +++ linux/arch/arm/boot/compressed/ll_char_wr.S Mon Sep 18 15:15:24 2000 @@ -1,12 +1,16 @@ /* - * linux/arch/arm/lib/ll_char_wr.S + * linux/arch/arm/lib/ll_char_wr.S * - * Copyright (C) 1995, 1996 Russell King. + * Copyright (C) 1995, 1996 Russell King. * - * Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * 10-04-96 RMK Various cleanups & reduced register usage. - * 08-04-98 RMK Shifts re-ordered + * Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King. + * + * 10-04-96 RMK Various cleanups & reduced register usage. + * 08-04-98 RMK Shifts re-ordered */ @ Regs: [] = corruptible diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/setup-sa1100.S linux/arch/arm/boot/compressed/setup-sa1100.S --- v2.4.0-test8/linux/arch/arm/boot/compressed/setup-sa1100.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/boot/compressed/setup-sa1100.S Mon Sep 18 15:15:24 2000 @@ -51,12 +51,6 @@ * This is called from decompress_kernel() with the arch_decomp_setup() macro. */ -/* - * void sa1100_setup( int arch_id ); - * - * This is called from decompress_kernel() with the arch_decomp_setup() macro. - */ - ENTRY(sa1100_setup) mov r3, r0 @ keep machine type in r3 diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/boot/compressed/vmlinux.lds.in linux/arch/arm/boot/compressed/vmlinux.lds.in --- v2.4.0-test8/linux/arch/arm/boot/compressed/vmlinux.lds.in Wed Oct 20 16:29:08 1999 +++ linux/arch/arm/boot/compressed/vmlinux.lds.in Mon Sep 18 15:15:24 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/boot/compressed/vmlinux.lds.in + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/config.in linux/arch/arm/config.in --- v2.4.0-test8/linux/arch/arm/config.in Tue Aug 22 11:41:14 2000 +++ linux/arch/arm/config.in Mon Sep 18 15:15:24 2000 @@ -15,6 +15,7 @@ bool 'Prompt for obsolete code/drivers' CONFIG_OBSOLETE endmenu + mainmenu_option next_comment comment 'Loadable module support' bool 'Enable loadable module support' CONFIG_MODULES @@ -24,6 +25,7 @@ fi endmenu + mainmenu_option next_comment comment 'System Type' @@ -33,49 +35,60 @@ Co-EBSA285 CONFIG_ARCH_CO285 \ EBSA-110 CONFIG_ARCH_EBSA110 \ FootBridge CONFIG_ARCH_FOOTBRIDGE \ + Integrator CONFIG_ARCH_INTEGRATOR \ RiscPC CONFIG_ARCH_RPC \ SA1100-based CONFIG_ARCH_SA1100" RiscPC # the following are placeholders for when they are fully integrated -# Cirrus CL-PS7500FE CONFIG_ARCH_CLPS7500 \ # LinkUp-L7200 CONFIG_ARCH_L7200 +mainmenu_option next_comment +comment 'Archimedes/A5000 Implementations' if [ "$CONFIG_ARCH_ARCA5K" = "y" ]; then # These architectures will be combined. However, until this # is complete... Note that the ARC will take precidence over # A5K comment 'Archimedes/A5000 Implementations (select only ONE)' - bool ' Archimedes support' CONFIG_ARCH_ARC - bool ' A5000 support' CONFIG_ARCH_A5K + + bool ' Archimedes' CONFIG_ARCH_ARC + bool ' A5000' CONFIG_ARCH_A5K fi +endmenu + +mainmenu_option next_comment +comment 'Footbridge Implementations' if [ "$CONFIG_ARCH_FOOTBRIDGE" = "y" ]; then - comment 'Footbridge Implementations' - bool ' CATS support' CONFIG_ARCH_CATS - bool ' Compaq Personal Server support' CONFIG_ARCH_PERSONAL_SERVER - bool ' EBSA285 (addin mode) support' CONFIG_ARCH_EBSA285_ADDIN - bool ' EBSA285 (host mode) support' CONFIG_ARCH_EBSA285_HOST - bool ' NetWinder support' CONFIG_ARCH_NETWINDER + bool ' CATS' CONFIG_ARCH_CATS + bool ' Compaq Personal Server' CONFIG_ARCH_PERSONAL_SERVER + bool ' EBSA285 (addin mode)' CONFIG_ARCH_EBSA285_ADDIN + bool ' EBSA285 (host mode)' CONFIG_ARCH_EBSA285_HOST + bool ' NetWinder' CONFIG_ARCH_NETWINDER fi +endmenu + +mainmenu_option next_comment +comment 'SA11x0 Implementations' if [ "$CONFIG_ARCH_SA1100" = "y" ]; then - comment 'SA11x0 Implementations' - bool ' Include support for Assabet' CONFIG_SA1100_ASSABET + + bool ' Assabet' CONFIG_SA1100_ASSABET if [ "$CONFIG_SA1100_ASSABET" = "y" ]; then - bool ' Include support for Neponset' CONFIG_ASSABET_NEPONSET + bool ' Include support for Neponset' CONFIG_ASSABET_NEPONSET fi - bool ' Include support for Brutus' CONFIG_SA1100_BRUTUS - bool ' Include support for CerfBoard' CONFIG_SA1100_CERF - bool ' Include support for Compaq iPAQ H3600 (Bitsy)' CONFIG_SA1100_BITSY -# bool ' Include support for Empeg' CONFIG_SA1100_EMPEG -# bool ' Include support for Itsy' CONFIG_SA1100_ITSY - bool ' Include support for LART' CONFIG_SA1100_LART -# bool ' Include support for PLEB' CONFIG_SA1100_PLEB - bool ' Include support for ThinClient' CONFIG_SA1100_THINCLIENT - bool ' Include support for GraphicsClient' CONFIG_SA1100_GRAPHICSCLIENT - bool ' Include support for nanoEngine' CONFIG_SA1100_NANOENGINE - bool ' Include support for Victor' CONFIG_SA1100_VICTOR -# bool ' Include support for Tifon' CONFIG_SA1100_TIFON - bool ' Include support for XP860' CONFIG_SA1100_XP860 + bool ' Brutus' CONFIG_SA1100_BRUTUS + bool ' CerfBoard' CONFIG_SA1100_CERF + bool ' Compaq iPAQ H3600 (Bitsy)' CONFIG_SA1100_BITSY +# bool ' Empeg' CONFIG_SA1100_EMPEG +# bool ' Itsy' CONFIG_SA1100_ITSY + bool ' LART' CONFIG_SA1100_LART +# bool ' PLEB' CONFIG_SA1100_PLEB + bool ' ThinClient' CONFIG_SA1100_THINCLIENT + bool ' GraphicsClient' CONFIG_SA1100_GRAPHICSCLIENT + bool ' nanoEngine' CONFIG_SA1100_NANOENGINE + bool ' Victor' CONFIG_SA1100_VICTOR +# bool ' Tifon' CONFIG_SA1100_TIFON + bool ' XP860' CONFIG_SA1100_XP860 + # Someday, we'll support this as a general option. bool ' Load kernel using Angel Debug Monitor' CONFIG_ANGELBOOT # Determine if SA1111 support is required @@ -84,6 +97,7 @@ define_bool CONFIG_SA1111 y fi fi +endmenu # Definitions to make life easier if [ "$CONFIG_ARCH_ARCA5K" = "y" -o \ @@ -129,12 +143,14 @@ define_bool CONFIG_CPU_26 n fi +comment 'Processor Type' + # Select CPU and optimisation dependent on architecture if [ "$CONFIG_ARCH_RPC" = "y" ]; then define_bool CONFIG_CPU_32v3 y - bool 'Support ARM610' CONFIG_CPU_ARM6 - bool 'Support ARM710' CONFIG_CPU_ARM7 - bool 'Support StrongARM110' CONFIG_CPU_SA110 + bool 'Support ARM610 processor' CONFIG_CPU_ARM6 + bool 'Support ARM710 processor' CONFIG_CPU_ARM7 + bool 'Support StrongARM(R) SA-110 processor' CONFIG_CPU_SA110 fi if [ "$CONFIG_ARCH_EBSA110" = "y" -o \ "$CONFIG_FOOTBRIDGE" = "y" -o \ @@ -152,11 +168,33 @@ define_bool CONFIG_CPU_32v4 y define_bool CONFIG_CPU_ARM720 y fi +if [ "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then + define_bool CONFIG_CPU_32v4 y + bool 'Support ARM720 processor' CONFIG_CPU_ARM720 + bool 'Support ARM920 processor' CONFIG_CPU_ARM920 +# bool 'Support ARM10 processor' CONFIG_CPU_ARM10 +fi if [ "$CONFIG_ARCH_SA1100" = "y" ]; then define_bool CONFIG_CPU_32v4 y define_bool CONFIG_CPU_SA1100 y fi +if [ "$CONFIG_CPU_ARM920" = "y" ]; then + bool ' ARM920 CPU idle' CONFIG_CPU_ARM920_CPU_IDLE + bool ' ARM920 I-Cache on' CONFIG_CPU_ARM920_I_CACHE_ON + bool ' ARM920 D-Cache on' CONFIG_CPU_ARM920_D_CACHE_ON + if [ "$CONFIG_CPU_ARM920_D_CACHE_ON" = "y" ] ; then + bool ' Force write through caches on ARM920' CONFIG_CPU_ARM920_WRITETHROUGH + fi +fi +#if [ "$CONFIG_CPU_ARM10" = "y" ]; then +# bool ' ARM10 I-Cache on' CONFIG_CPU_ARM10_I_CACHE_ON +# bool ' ARM10 D-Cache on' CONFIG_CPU_ARM10_D_CACHE_ON +# if [ "$CONFIG_CPU_ARM10_D_CACHE_ON" = "y" ] ; then +# bool ' Force write through caches on ARM10' CONFIG_CPU_ARM10_FORCE_WRITE_THROUGH +# fi +#fi + # Select various configuration options depending on the machine type if [ "$CONFIG_ARCH_SA1100" = "y" ]; then define_bool CONFIG_DISCONTIGMEM y @@ -164,12 +202,21 @@ define_bool CONFIG_DISCONTIGMEM n fi +endmenu + +mainmenu_option next_comment +comment 'General setup' + # Now handle the bus types if [ "$CONFIG_ARCH_NEXUSPCI" = "y" -o \ "$CONFIG_FOOTBRIDGE_HOST" = "y" ]; then define_bool CONFIG_PCI y else - define_bool CONFIG_PCI n + if [ "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then + bool 'PCI support' CONFIG_PCI + else + define_bool CONFIG_PCI n + fi fi if [ "$CONFIG_FOOTBRIDGE_HOST" = "y" -o \ @@ -189,10 +236,7 @@ if [ "$CONFIG_SA1100_ASSABET" = "y" ]; then define_bool CONFIG_PC_KEYMAP y fi -endmenu -mainmenu_option next_comment -comment 'General setup' source drivers/pci/Config.in bool 'Support hot-pluggable devices' CONFIG_HOTPLUG if [ "$CONFIG_HOTPLUG" = "y" ]; then @@ -223,20 +267,23 @@ "$CONFIG_ARCH_SA1100" = "y" -o \ "$CONFIG_ARCH_CLPS7500" = "y" -o \ "$CONFIG_ARCH_PERSONAL_SERVER" = "y" -o \ - "$CONFIG_ARCH_CATS" = "y" ]; then + "$CONFIG_ARCH_CATS" = "y" -o \ + "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then string 'Default kernel command string' CONFIG_CMDLINE "" fi if [ "$CONFIG_ARCH_NETWINDER" = "y" -o \ "$CONFIG_ARCH_EBSA110" = "y" -o \ "$CONFIG_ARCH_EBSA285" = "y" -o \ "$CONFIG_ARCH_CO285" = "y" -o \ - "$CONFIG_ARCH_SA1100" = "y" ]; then + "$CONFIG_ARCH_SA1100" = "y" -o \ + "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then bool 'Timer and CPU usage LEDs' CONFIG_LEDS if [ "$CONFIG_LEDS" = "y" ]; then if [ "$CONFIG_ARCH_NETWINDER" = "y" -o \ "$CONFIG_ARCH_EBSA285" = "y" -o \ "$CONFIG_ARCH_CO285" = "y" -o \ - "$CONFIG_ARCH_SA1100" = "y" ]; then + "$CONFIG_ARCH_SA1100" = "y" -o \ + "$CONFIG_ARCH_INTEGRATOR" = "y" ]; then bool ' Timer LED' CONFIG_LEDS_TIMER bool ' CPU usage LED' CONFIG_LEDS_CPU fi @@ -322,10 +369,6 @@ fi fi -#source drivers/misc/Config.in - -source drivers/media/Config.in - source fs/Config.in if [ "$CONFIG_VT" = "y" ]; then @@ -354,7 +397,6 @@ fi source drivers/usb/Config.in -source drivers/input/Config.in mainmenu_option next_comment diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/assabet linux/arch/arm/def-configs/assabet --- v2.4.0-test8/linux/arch/arm/def-configs/assabet Mon Jun 19 17:59:33 2000 +++ linux/arch/arm/def-configs/assabet Mon Sep 18 15:15:24 2000 @@ -2,20 +2,23 @@ # Automatically generated make config: don't edit # CONFIG_ARM=y +# CONFIG_SBUS is not set CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y +# CONFIG_OBSOLETE is not set # -# System and Processor Type +# System Type # # CONFIG_ARCH_ARC is not set # CONFIG_ARCH_A5K is not set +# CONFIG_ARCH_CO285 is not set # CONFIG_ARCH_EBSA110 is not set -# CONFIG_FOOTBRIDGE is not set +# CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_RPC is not set CONFIG_ARCH_SA1100=y @@ -24,25 +27,27 @@ # CONFIG_SA1100_ASSABET=y # CONFIG_ASSABET_NEPONSET is not set -# CONFIG_SA1100_BITSY is not set # CONFIG_SA1100_BRUTUS is not set +# CONFIG_SA1100_BITSY is not set # CONFIG_SA1100_LART is not set # CONFIG_SA1100_THINCLIENT is not set # CONFIG_SA1100_GRAPHICSCLIENT is not set # CONFIG_SA1100_VICTOR is not set -CONFIG_DISCONTIGMEM=y -CONFIG_SA1100_FREQUENCY_SCALE=y +CONFIG_ANGELBOOT=y +# CONFIG_SA1100_FREQUENCY_SCALE is not set # CONFIG_SA1100_VOLTAGE_SCALE is not set -# CONFIG_ARCH_ACORN is not set CONFIG_CPU_32=y # CONFIG_CPU_26 is not set CONFIG_CPU_32v4=y CONFIG_CPU_SA1100=y +# CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set +CONFIG_DISCONTIGMEM=y # CONFIG_PCI is not set # CONFIG_ISA is not set # CONFIG_ISA_DMA is not set -# CONFIG_SBUS is not set -CONFIG_ALIGNMENT_TRAP=y # # Loadable module support @@ -54,6 +59,15 @@ # # General setup # +CONFIG_HOTPLUG=y + +# +# PC Card support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +CONFIG_SA1100_PCMCIA=y +CONFIG_VIRTUAL_BUS=y CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set @@ -64,34 +78,23 @@ # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set # CONFIG_ARTHUR is not set - -# -# Parallel port support -# -# CONFIG_PARPORT is not set -CONFIG_CMDLINE="" +CONFIG_CMDLINE="keepinitrd" CONFIG_LEDS=y CONFIG_LEDS_TIMER=y CONFIG_LEDS_CPU=y -CONFIG_HOTPLUG=y +CONFIG_ALIGNMENT_TRAP=y # -# PC Card support +# Parallel port support # -CONFIG_PCMCIA=y -# CONFIG_PCMCIA_DEBUG is not set -CONFIG_SA1100_PCMCIA=y -CONFIG_VIRTUAL_BUS=y +# CONFIG_PARPORT is not set # -# I2O device support +# Memory Technology Devices (MTD) # -# CONFIG_I2O is not set -# CONFIG_I2O_BLOCK is not set -# CONFIG_I2O_LAN is not set -# CONFIG_I2O_SCSI is not set -# CONFIG_I2O_PROC is not set +# CONFIG_MTD is not set # # Plug and Play configuration @@ -113,92 +116,14 @@ # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_RAID0 is not set -# CONFIG_RAID15_DANGEROUS is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # CONFIG_BLK_DEV_FLASH is not set # -# Character devices -# -CONFIG_VT=y -# CONFIG_VT_CONSOLE is not set -CONFIG_SERIAL_SA1100=y -CONFIG_SERIAL_SA1100_CONSOLE=y -# CONFIG_SERIAL is not set -# CONFIG_SERIAL_EXTENDED is not set -# CONFIG_SERIAL_NONSTANDARD is not set -CONFIG_UNIX98_PTYS=y -CONFIG_UNIX98_PTY_COUNT=32 - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# Mice -# -# CONFIG_BUSMOUSE is not set -# CONFIG_MOUSE is not set - -# -# Joysticks -# -# CONFIG_JOYSTICK is not set -# CONFIG_QIC02_TAPE is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set -# CONFIG_PCMCIA_SERIAL is not set -# CONFIG_AGP is not set - -# -# Console drivers -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_FB=y - -# -# Frame-buffer support -# -CONFIG_FB=y -CONFIG_DUMMY_CONSOLE=y -CONFIG_FB_SA1100=y -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FBCON_ADVANCED is not set -CONFIG_FBCON_CFB2=y -CONFIG_FBCON_CFB4=y -CONFIG_FBCON_CFB8=y -CONFIG_FBCON_CFB16=y -CONFIG_FBCON_FONTWIDTH8_ONLY=y -CONFIG_FBCON_FONTS=y -CONFIG_FONT_8x8=y -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set - -# # Networking options # # CONFIG_PACKET is not set @@ -230,9 +155,9 @@ # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -245,16 +170,6 @@ # CONFIG_NET_SCHED is not set # -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# # Network device support # CONFIG_NETDEVICES=y @@ -329,6 +244,16 @@ CONFIG_PCMCIA_NETCARD=y # +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# # ATA/IDE/MFM/RLL support # CONFIG_IDE=y @@ -368,6 +293,7 @@ # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_IDE_CHIPSETS is not set # CONFIG_IDEDMA_AUTO is not set +# CONFIG_DMA_NONPCI is not set # CONFIG_BLK_DEV_IDE_MODES is not set # @@ -376,22 +302,75 @@ # CONFIG_SCSI is not set # -# Sound +# I2O device support # -CONFIG_SOUND=y -CONFIG_SOUND_UDA1341=y -# CONFIG_SOUND_CMPCI is not set -# CONFIG_SOUND_EMU10K1 is not set -# CONFIG_SOUND_ES1370 is not set -# CONFIG_SOUND_ES1371 is not set -# CONFIG_SOUND_ESSSOLO1 is not set -# CONFIG_SOUND_MAESTRO is not set -# CONFIG_SOUND_SONICVIBES is not set -# CONFIG_SOUND_TRIDENT is not set -# CONFIG_SOUND_MSNDCLAS is not set -# CONFIG_SOUND_MSNDPIN is not set -# CONFIG_SOUND_VIA82CXXX is not set -# CONFIG_SOUND_OSS is not set +# CONFIG_I2O is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_LAN is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Character devices +# +CONFIG_VT=y +# CONFIG_VT_CONSOLE is not set +CONFIG_SERIAL_SA1100=y +CONFIG_SERIAL_SA1100_CONSOLE=y +# CONFIG_TOUCHSCREEN_SA1100 is not set +# CONFIG_TOUCHSCREEN_BITSY is not set +# CONFIG_SERIAL is not set +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX98_PTY_COUNT=32 + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_JOYSTICK is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set + +# +# Video For Linux +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_DRM is not set +# CONFIG_DRM_TDFX is not set +# CONFIG_PCMCIA_SERIAL is not set +# CONFIG_AGP is not set # # File systems @@ -409,6 +388,7 @@ # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set @@ -507,6 +487,51 @@ # CONFIG_NLS_KOI8_R is not set # +# Console drivers +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_FB=y + +# +# Frame-buffer support +# +CONFIG_FB=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_FB_SA1100=y +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FBCON_ADVANCED is not set +CONFIG_FBCON_CFB2=y +CONFIG_FBCON_CFB4=y +CONFIG_FBCON_CFB8=y +CONFIG_FBCON_CFB16=y +CONFIG_FBCON_FONTWIDTH8_ONLY=y +CONFIG_FBCON_FONTS=y +CONFIG_FONT_8x8=y +# CONFIG_FONT_8x16 is not set +# CONFIG_FONT_SUN8x16 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_ACORN_8x8 is not set + +# +# Sound +# +CONFIG_SOUND=y +CONFIG_SOUND_UDA1341=y +# CONFIG_SOUND_CMPCI is not set +# CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_ES1370 is not set +# CONFIG_SOUND_ES1371 is not set +# CONFIG_SOUND_ESSSOLO1 is not set +# CONFIG_SOUND_MAESTRO is not set +# CONFIG_SOUND_SONICVIBES is not set +# CONFIG_SOUND_TRIDENT is not set +# CONFIG_SOUND_MSNDCLAS is not set +# CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_VIA82CXXX is not set +# CONFIG_SOUND_OSS is not set +# CONFIG_SOUND_TVMIXER is not set + +# # USB support # # CONFIG_USB is not set @@ -517,6 +542,6 @@ CONFIG_FRAME_POINTER=y CONFIG_DEBUG_ERRORS=y CONFIG_DEBUG_USER=y -CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO is not set # CONFIG_MAGIC_SYSRQ is not set # CONFIG_DEBUG_LL is not set diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/brutus linux/arch/arm/def-configs/brutus --- v2.4.0-test8/linux/arch/arm/def-configs/brutus Mon Jun 19 17:59:33 2000 +++ linux/arch/arm/def-configs/brutus Mon Sep 18 15:15:24 2000 @@ -2,45 +2,51 @@ # Automatically generated make config: don't edit # CONFIG_ARM=y +# CONFIG_SBUS is not set CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y +# CONFIG_OBSOLETE is not set # -# System and processor type +# System Type # # CONFIG_ARCH_ARC is not set # CONFIG_ARCH_A5K is not set -# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_CO285 is not set # CONFIG_ARCH_EBSA110 is not set -# CONFIG_FOOTBRIDGE is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_RPC is not set CONFIG_ARCH_SA1100=y + +# +# SA11x0 Implementations +# # CONFIG_SA1100_ASSABET is not set CONFIG_SA1100_BRUTUS=y -# CONFIG_SA1100_EMPEG is not set -# CONFIG_SA1100_ITSY is not set # CONFIG_SA1100_BITSY is not set # CONFIG_SA1100_LART is not set -# CONFIG_SA1100_PLEB is not set # CONFIG_SA1100_THINCLIENT is not set # CONFIG_SA1100_GRAPHICSCLIENT is not set # CONFIG_SA1100_VICTOR is not set -# CONFIG_SA1100_TIFON is not set -CONFIG_DISCONTIGMEM=y -# CONFIG_ARCH_ACORN is not set +CONFIG_ANGELBOOT=y +# CONFIG_SA1100_FREQUENCY_SCALE is not set +# CONFIG_SA1100_VOLTAGE_SCALE is not set CONFIG_CPU_32=y # CONFIG_CPU_26 is not set CONFIG_CPU_32v4=y CONFIG_CPU_SA1100=y +# CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set +CONFIG_DISCONTIGMEM=y # CONFIG_PCI is not set # CONFIG_ISA is not set # CONFIG_ISA_DMA is not set -# CONFIG_SBUS is not set -# CONFIG_PCMCIA is not set -# CONFIG_ALIGNMENT_TRAP is not set # # Loadable module support @@ -52,34 +58,35 @@ # # General setup # +# CONFIG_HOTPLUG is not set +# CONFIG_PCMCIA is not set # CONFIG_NET is not set CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_SYSCTL is not set +CONFIG_SYSCTL=y CONFIG_NWFPE=y CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set # CONFIG_ARTHUR is not set +CONFIG_CMDLINE="keepinitrd" +CONFIG_LEDS=y +CONFIG_LEDS_TIMER=y +CONFIG_LEDS_CPU=y +# CONFIG_ALIGNMENT_TRAP is not set # # Parallel port support # # CONFIG_PARPORT is not set -CONFIG_CMDLINE="" -CONFIG_LEDS=y -CONFIG_LEDS_TIMER=y -CONFIG_LEDS_CPU=y # -# I2O device support +# Memory Technology Devices (MTD) # -# CONFIG_I2O is not set -# CONFIG_I2O_BLOCK is not set -# CONFIG_I2O_SCSI is not set -# CONFIG_I2O_PROC is not set +# CONFIG_MTD is not set # # Plug and Play configuration @@ -100,18 +107,48 @@ # CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set -# CONFIG_MD_STRIPED is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # CONFIG_BLK_DEV_FLASH is not set # +# ATA/IDE/MFM/RLL support +# +# CONFIG_IDE is not set +# CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# I2O device support +# +# CONFIG_I2O is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# # Character devices # CONFIG_VT=y # CONFIG_VT_CONSOLE is not set CONFIG_SERIAL_SA1100=y CONFIG_SERIAL_SA1100_CONSOLE=y +# CONFIG_TOUCHSCREEN_SA1100 is not set +# CONFIG_TOUCHSCREEN_BITSY is not set # CONFIG_SERIAL is not set # CONFIG_SERIAL_EXTENDED is not set # CONFIG_SERIAL_NONSTANDARD is not set @@ -139,6 +176,7 @@ # Watchdog Cards # # CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set # CONFIG_NVRAM is not set # CONFIG_RTC is not set @@ -159,43 +197,6 @@ # CONFIG_AGP is not set # -# Console drivers -# -# CONFIG_VGA_CONSOLE is not set -CONFIG_FB=y - -# -# Frame-buffer support -# -CONFIG_FB=y -CONFIG_DUMMY_CONSOLE=y -CONFIG_FB_SA1100=y -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FBCON_ADVANCED is not set -CONFIG_FBCON_CFB2=y -CONFIG_FBCON_CFB4=y -CONFIG_FBCON_CFB8=y -CONFIG_FBCON_FONTWIDTH8_ONLY=y -CONFIG_FBCON_FONTS=y -CONFIG_FONT_8x8=y -# CONFIG_FONT_8x16 is not set -# CONFIG_FONT_SUN8x16 is not set -# CONFIG_FONT_PEARL_8x8 is not set -# CONFIG_FONT_ACORN_8x8 is not set - -# -# ATA/IDE/MFM/RLL support -# -# CONFIG_IDE is not set -# CONFIG_BLK_DEV_IDE_MODES is not set -# CONFIG_BLK_DEV_HD is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set - -# # File systems # # CONFIG_QUOTA is not set @@ -211,6 +212,7 @@ # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set @@ -242,6 +244,37 @@ # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y # CONFIG_NLS is not set + +# +# Console drivers +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_FB=y + +# +# Frame-buffer support +# +CONFIG_FB=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_FB_SA1100=y +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FBCON_ADVANCED is not set +CONFIG_FBCON_CFB2=y +CONFIG_FBCON_CFB4=y +CONFIG_FBCON_CFB8=y +CONFIG_FBCON_CFB16=y +CONFIG_FBCON_FONTWIDTH8_ONLY=y +CONFIG_FBCON_FONTS=y +CONFIG_FONT_8x8=y +# CONFIG_FONT_8x16 is not set +# CONFIG_FONT_SUN8x16 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_ACORN_8x8 is not set + +# +# Sound +# +# CONFIG_SOUND is not set # # USB support diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/cerf linux/arch/arm/def-configs/cerf --- v2.4.0-test8/linux/arch/arm/def-configs/cerf Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/def-configs/cerf Mon Sep 18 15:15:24 2000 @@ -0,0 +1,423 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_ARM=y +# CONFIG_SBUS is not set +CONFIG_UID16=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_OBSOLETE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +# CONFIG_MODVERSIONS is not set +# CONFIG_KMOD is not set + +# +# System Type +# +# CONFIG_ARCH_ARC is not set +# CONFIG_ARCH_A5K is not set +# CONFIG_ARCH_CO285 is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_RPC is not set +CONFIG_ARCH_SA1100=y + +# +# SA11x0 Implementations +# +# CONFIG_SA1100_ASSABET is not set +# CONFIG_SA1100_BRUTUS is not set +CONFIG_SA1100_CERF=y +# CONFIG_SA1100_BITSY is not set +# CONFIG_SA1100_LART is not set +# CONFIG_SA1100_THINCLIENT is not set +# CONFIG_SA1100_GRAPHICSCLIENT is not set +# CONFIG_SA1100_VICTOR is not set +# CONFIG_ANGELBOOT is not set +# CONFIG_SA1100_FREQUENCY_SCALE is not set +# CONFIG_SA1100_VOLTAGE_SCALE is not set +CONFIG_CPU_32=y +# CONFIG_CPU_26 is not set +CONFIG_CPU_32v4=y +CONFIG_CPU_SA1100=y +# CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set +CONFIG_DISCONTIGMEM=y +# CONFIG_PCI is not set +# CONFIG_ISA is not set +# CONFIG_ISA_DMA is not set + +# +# General setup +# +CONFIG_HOTPLUG=y + +# +# PC Card support +# +CONFIG_PCMCIA=y +# CONFIG_PCMCIA_DEBUG is not set +CONFIG_SA1100_PCMCIA=y +CONFIG_VIRTUAL_BUS=y +CONFIG_NET=y +CONFIG_SYSVIPC=y +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +CONFIG_NWFPE=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set +# CONFIG_ARTHUR is not set +CONFIG_CMDLINE="keepinitrd" +CONFIG_LEDS=y +CONFIG_LEDS_TIMER=y +CONFIG_LEDS_CPU=y +CONFIG_ALIGNMENT_TRAP=y + +# +# Parallel port support +# +# CONFIG_PARPORT is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set +# CONFIG_BLK_DEV_MD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_INITRD=y +CONFIG_BLK_DEV_FLASH=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_MMAP is not set +# CONFIG_NETLINK is not set +# CONFIG_NETFILTER is not set +# CONFIG_FILTER is not set +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_IP_ROUTER is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_ALIAS is not set +# CONFIG_INET_ECN is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_IPV6 is not set +# CONFIG_KHTTPD is not set +# CONFIG_ATM is not set + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_LLC is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# ARCnet devices +# +# CONFIG_ARCNET is not set +# CONFIG_DUMMY is not set +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_SB1000 is not set + +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +CONFIG_CERF_CS8900A=y +# CONFIG_ARM_AM79C961A is not set +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_PCI is not set +# CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_YELLOWFIN is not set +# CONFIG_ACENIC is not set +# CONFIG_SK98LIN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set + +# +# Wireless LAN (non-hamradio) +# +# CONFIG_NET_RADIO is not set + +# +# Token Ring devices +# +# CONFIG_TR is not set +# CONFIG_NET_FC is not set +# CONFIG_RCPCI is not set +# CONFIG_SHAPER is not set + +# +# Wan interfaces +# +# CONFIG_WAN is not set + +# +# PCMCIA network device support +# +# CONFIG_NET_PCMCIA is not set + +# +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# +# ATA/IDE/MFM/RLL support +# +CONFIG_IDE=y + +# +# IDE, ATA and ATAPI Block devices +# +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_HD is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set +# CONFIG_BLK_DEV_COMMERIAL is not set +CONFIG_BLK_DEV_IDECS=y +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set + +# +# IDE chipset support/bugfixes +# +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_IDE_CHIPSETS is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_DMA_NONPCI is not set +# CONFIG_BLK_DEV_IDE_MODES is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# I2O device support +# +# CONFIG_I2O is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Character devices +# +# CONFIG_VT is not set +CONFIG_SERIAL_SA1100=y +CONFIG_SERIAL_SA1100_CONSOLE=y +# CONFIG_TOUCHSCREEN_UCB1200 is not set +# CONFIG_TOUCHSCREEN_BITSY is not set +# CONFIG_SERIAL is not set +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX98_PTY_COUNT=32 + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_JOYSTICK is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set + +# +# Video For Linux +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_DRM is not set +# CONFIG_PCMCIA_SERIAL is not set +# CONFIG_AGP is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_FAT_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_RAMFS is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set +CONFIG_DEVPTS_FS=y +# CONFIG_QNX4FS_FS is not set +# CONFIG_ROMFS_FS is not set +CONFIG_EXT2_FS=y +# CONFIG_SYSV_FS is not set +# CONFIG_UDF_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +# CONFIG_CODA_FS is not set +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +# CONFIG_NFSD is not set +CONFIG_SUNRPC=y +CONFIG_LOCKD=y +# CONFIG_SMB_FS is not set +# CONFIG_NCP_FS is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_MAC_PARTITION is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_NLS is not set + +# +# Sound +# +CONFIG_SOUND=y +# CONFIG_SOUND_CMPCI is not set +# CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_ES1370 is not set +# CONFIG_SOUND_ES1371 is not set +# CONFIG_SOUND_ESSSOLO1 is not set +# CONFIG_SOUND_MAESTRO is not set +# CONFIG_SOUND_SONICVIBES is not set +# CONFIG_SOUND_TRIDENT is not set +# CONFIG_SOUND_MSNDCLAS is not set +# CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_OSS is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Kernel hacking +# +CONFIG_FRAME_POINTER=y +CONFIG_DEBUG_ERRORS=y +CONFIG_DEBUG_USER=y +# CONFIG_DEBUG_INFO is not set +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_DEBUG_LL is not set diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/clps7500 linux/arch/arm/def-configs/clps7500 --- v2.4.0-test8/linux/arch/arm/def-configs/clps7500 Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/def-configs/clps7500 Mon Sep 18 15:15:24 2000 @@ -0,0 +1,490 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_ARM=y +# CONFIG_SBUS is not set +CONFIG_UID16=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +CONFIG_OBSOLETE=y + +# +# Loadable module support +# +# CONFIG_MODULES is not set + +# +# System Type +# +# CONFIG_ARCH_ARCA5K is not set +CONFIG_ARCH_CLPS7500=y +# CONFIG_ARCH_CO285 is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_FTVPCI is not set +# CONFIG_ARCH_TBOX is not set +# CONFIG_ARCH_SHARK is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set +CONFIG_CPU_32=y +# CONFIG_CPU_26 is not set +CONFIG_CPU_32v3=y +CONFIG_CPU_ARM7=y +# CONFIG_DISCONTIGMEM is not set +# CONFIG_PCI is not set +# CONFIG_ISA is not set +# CONFIG_ISA_DMA is not set + +# +# General setup +# +# CONFIG_HOTPLUG is not set +# CONFIG_PCMCIA is not set +CONFIG_NET=y +CONFIG_SYSVIPC=y +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_SYSCTL is not set +CONFIG_NWFPE=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set +# CONFIG_ARTHUR is not set +CONFIG_CMDLINE="root=/dev/nfs rw" +# CONFIG_ALIGNMENT_TRAP is not set + +# +# Parallel port support +# +CONFIG_PARPORT=y +CONFIG_PARPORT_PC=y +CONFIG_PARPORT_PC_FIFO=y +# CONFIG_PARPORT_PC_SUPERIO is not set +# CONFIG_PARPORT_AMIGA is not set +# CONFIG_PARPORT_MFC3 is not set +# CONFIG_PARPORT_ATARI is not set +# CONFIG_PARPORT_SUNBPP is not set +# CONFIG_PARPORT_OTHER is not set +CONFIG_PARPORT_1284=y + +# +# Memory Technology Devices (MTD) +# +CONFIG_MTD=y +# CONFIG_MTD_DOC1000 is not set +# CONFIG_MTD_DOC2000 is not set +# CONFIG_MTD_DOC2001 is not set +# CONFIG_MTD_DOCPROBE is not set +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PMC551 is not set +# CONFIG_MTD_MTDRAM is not set + +# +# MTD drivers for mapped chips +# +# CONFIG_MTD_CFI is not set +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_CFI_AMDSTD is not set +# CONFIG_MTD_JEDEC is not set +# CONFIG_MTD_RAM is not set +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_PHYSMAP is not set + +# +# Drivers for chip mappings +# +# CONFIG_MTD_MIXMEM is not set +# CONFIG_MTD_NORA is not set +# CONFIG_MTD_OCTAGON is not set +# CONFIG_MTD_PNC2000 is not set +# CONFIG_MTD_RPXLITE is not set +# CONFIG_MTD_VMAX is not set + +# +# User modules and translation layers for MTD devices +# +# CONFIG_MTD_CHAR is not set +# CONFIG_MTD_BLOCK is not set +# CONFIG_FTL is not set +# CONFIG_NFTL is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set +# CONFIG_ISAPNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_PARIDE is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set +# CONFIG_BLK_DEV_MD is not set +# CONFIG_MD_LINEAR is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_FLD7500=y + +# +# Networking options +# +# CONFIG_PACKET is not set +# CONFIG_NETLINK is not set +# CONFIG_NETFILTER is not set +# CONFIG_FILTER is not set +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_IP_ROUTER is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_ALIAS is not set +# CONFIG_INET_ECN is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_IPV6 is not set +# CONFIG_KHTTPD is not set +# CONFIG_ATM is not set + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_LLC is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# ARCnet devices +# +# CONFIG_ARCNET is not set +CONFIG_DUMMY=y +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_SB1000 is not set + +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_PCI is not set +# CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_YELLOWFIN is not set +# CONFIG_ACENIC is not set +# CONFIG_SK98LIN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PLIP is not set +CONFIG_PPP=y +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_ASYNC is not set +# CONFIG_PPP_SYNC_TTY is not set +# CONFIG_PPP_DEFLATE is not set +# CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPPOE is not set +CONFIG_SLIP=y +CONFIG_SLIP_COMPRESSED=y +# CONFIG_SLIP_SMART is not set +# CONFIG_SLIP_MODE_SLIP6 is not set + +# +# Wireless LAN (non-hamradio) +# +# CONFIG_NET_RADIO is not set + +# +# Token Ring devices +# +# CONFIG_TR is not set +# CONFIG_NET_FC is not set +# CONFIG_RCPCI is not set +# CONFIG_SHAPER is not set + +# +# Wan interfaces +# +# CONFIG_WAN is not set +# CONFIG_ASH is not set + +# +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# +# ATA/IDE/MFM/RLL support +# +# CONFIG_IDE is not set +# CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# I2O device support +# +# CONFIG_I2O is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_LAN is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_SERIAL=y +# CONFIG_SERIAL_CONSOLE is not set +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +CONFIG_UNIX98_PTYS=y +CONFIG_UNIX98_PTY_COUNT=256 +CONFIG_PRINTER=y +CONFIG_LP_CONSOLE=y +# CONFIG_PPDEV is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +# CONFIG_I2C_PHILIPSPAR is not set +# CONFIG_I2C_ELV is not set +# CONFIG_I2C_VELLEMAN is not set +# CONFIG_I2C_ALGOPCF is not set +# CONFIG_I2C_CHARDEV is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +CONFIG_MOUSE=y +CONFIG_PSMOUSE=y +# CONFIG_82C710_MOUSE is not set +# CONFIG_PC110_PAD is not set + +# +# Joysticks +# +# CONFIG_JOYSTICK is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +CONFIG_CLPS7500_FLASH=y +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set + +# +# Video For Linux +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_ADFS_FS_RW is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_FAT_FS is not set +# CONFIG_MSDOS_FS is not set +# CONFIG_UMSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set +# CONFIG_CRAMFS is not set +# CONFIG_RAMFS is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_JOLIET is not set +CONFIG_MINIX_FS=y +# CONFIG_NTFS_FS is not set +# CONFIG_NTFS_RW is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set +# CONFIG_DEVFS_DEBUG is not set +# CONFIG_DEVPTS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX4FS_RW is not set +# CONFIG_ROMFS_FS is not set +CONFIG_EXT2_FS=y +# CONFIG_SYSV_FS is not set +# CONFIG_SYSV_FS_WRITE is not set +# CONFIG_UDF_FS is not set +# CONFIG_UDF_RW is not set +# CONFIG_UFS_FS is not set +# CONFIG_UFS_FS_WRITE is not set + +# +# Network File Systems +# +# CONFIG_CODA_FS is not set +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFSD is not set +# CONFIG_NFSD_V3 is not set +CONFIG_SUNRPC=y +CONFIG_LOCKD=y +# CONFIG_SMB_FS is not set +# CONFIG_NCP_FS is not set +# CONFIG_NCPFS_PACKET_SIGNING is not set +# CONFIG_NCPFS_IOCTL_LOCKING is not set +# CONFIG_NCPFS_STRONG is not set +# CONFIG_NCPFS_NFS_NS is not set +# CONFIG_NCPFS_OS2_NS is not set +# CONFIG_NCPFS_SMALLDOS is not set +# CONFIG_NCPFS_MOUNT_SUBDIR is not set +# CONFIG_NCPFS_NDS_DOMAINS is not set +# CONFIG_NCPFS_NLS is not set +# CONFIG_NCPFS_EXTRAS is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_MAC_PARTITION is not set +# CONFIG_MSDOS_PARTITION is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +# CONFIG_NLS is not set + +# +# Console drivers +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_FB=y + +# +# Frame-buffer support +# +CONFIG_FB=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_FB_ACORN=y +# CONFIG_CHRONTEL_7003 is not set +# CONFIG_FB_CYBER2000 is not set +# CONFIG_FB_VIRTUAL is not set +CONFIG_FBCON_ADVANCED=y +# CONFIG_FBCON_MFB is not set +# CONFIG_FBCON_CFB2 is not set +# CONFIG_FBCON_CFB4 is not set +CONFIG_FBCON_CFB8=y +# CONFIG_FBCON_CFB16 is not set +# CONFIG_FBCON_CFB24 is not set +# CONFIG_FBCON_CFB32 is not set +# CONFIG_FBCON_AFB is not set +# CONFIG_FBCON_ILBM is not set +# CONFIG_FBCON_IPLAN2P2 is not set +# CONFIG_FBCON_IPLAN2P4 is not set +# CONFIG_FBCON_IPLAN2P8 is not set +# CONFIG_FBCON_MAC is not set +# CONFIG_FBCON_VGA_PLANES is not set +# CONFIG_FBCON_VGA is not set +# CONFIG_FBCON_HGA is not set +# CONFIG_FBCON_FONTWIDTH8_ONLY is not set +# CONFIG_FBCON_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Kernel hacking +# +# CONFIG_FRAME_POINTER is not set +# CONFIG_DEBUG_ERRORS is not set +# CONFIG_DEBUG_USER is not set +# CONFIG_DEBUG_INFO is not set +CONFIG_MAGIC_SYSRQ=y +# CONFIG_DEBUG_LL is not set diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/lart linux/arch/arm/def-configs/lart --- v2.4.0-test8/linux/arch/arm/def-configs/lart Mon Jun 19 17:59:33 2000 +++ linux/arch/arm/def-configs/lart Mon Sep 18 15:15:24 2000 @@ -2,53 +2,62 @@ # Automatically generated by make menuconfig: don't edit # CONFIG_ARM=y +# CONFIG_SBUS is not set CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y +# CONFIG_OBSOLETE is not set # -# System and Processor Type +# Loadable module support # -# CONFIG_ARCH_ARC is not set -# CONFIG_ARCH_A5K is not set +CONFIG_MODULES=y +CONFIG_MODVERSIONS=y +# CONFIG_KMOD is not set + +# +# System Type +# +# CONFIG_ARCH_ARCA5K is not set +# CONFIG_ARCH_CLPS7500 is not set +# CONFIG_ARCH_CO285 is not set # CONFIG_ARCH_EBSA110 is not set -# CONFIG_FOOTBRIDGE is not set +# CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_RPC is not set CONFIG_ARCH_SA1100=y # CONFIG_SA1100_ASSABET is not set -# CONFIG_SA1100_BITSY is not set # CONFIG_SA1100_BRUTUS is not set +# CONFIG_SA1100_CERF is not set +# CONFIG_SA1100_BITSY is not set CONFIG_SA1100_LART=y # CONFIG_SA1100_THINCLIENT is not set # CONFIG_SA1100_GRAPHICSCLIENT is not set +# CONFIG_SA1100_NANOENGINE is not set # CONFIG_SA1100_VICTOR is not set -CONFIG_DISCONTIGMEM=y +# CONFIG_ANGELBOOT is not set CONFIG_SA1100_FREQUENCY_SCALE=m CONFIG_SA1100_VOLTAGE_SCALE=y # CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set CONFIG_CPU_32=y # CONFIG_CPU_26 is not set CONFIG_CPU_32v4=y CONFIG_CPU_SA1100=y +CONFIG_DISCONTIGMEM=y # CONFIG_PCI is not set # CONFIG_ISA is not set # CONFIG_ISA_DMA is not set -# CONFIG_SBUS is not set -CONFIG_ALIGNMENT_TRAP=y - -# -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODVERSIONS=y -# CONFIG_KMOD is not set # # General setup # +# CONFIG_HOTPLUG is not set +# CONFIG_PCMCIA is not set CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set @@ -59,26 +68,23 @@ CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set +CONFIG_PM=y # CONFIG_ARTHUR is not set +CONFIG_CMDLINE="console=ttyS0,9600" +CONFIG_LEDS=y +# CONFIG_LEDS_TIMER is not set +CONFIG_LEDS_CPU=y +CONFIG_ALIGNMENT_TRAP=y # # Parallel port support # # CONFIG_PARPORT is not set -CONFIG_CMDLINE="console=ttyS0,9600" -CONFIG_LEDS=y -# CONFIG_LEDS_TIMER is not set -CONFIG_LEDS_CPU=y -# CONFIG_HOTPLUG is not set # -# I2O device support +# Memory Technology Devices (MTD) # -# CONFIG_I2O is not set -# CONFIG_I2O_BLOCK is not set -# CONFIG_I2O_LAN is not set -# CONFIG_I2O_SCSI is not set -# CONFIG_I2O_PROC is not set +# CONFIG_MTD is not set # # Plug and Play configuration @@ -100,66 +106,18 @@ # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_RAID0 is not set -# CONFIG_RAID15_DANGEROUS is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y -# CONFIG_BLK_DEV_FLASH is not set - -# -# Character devices -# -# CONFIG_VT is not set -CONFIG_SERIAL_SA1100=y -CONFIG_SERIAL_SA1100_CONSOLE=y -# CONFIG_SERIAL is not set -# CONFIG_SERIAL_EXTENDED is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_UNIX98_PTYS is not set - -# -# I2C support -# -# CONFIG_I2C is not set - -# -# Mice -# -# CONFIG_BUSMOUSE is not set -# CONFIG_MOUSE is not set - -# -# Joysticks -# -# CONFIG_JOYSTICK is not set -# CONFIG_QIC02_TAPE is not set - -# -# Watchdog Cards -# -# CONFIG_WATCHDOG is not set -# CONFIG_NVRAM is not set -# CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set -# CONFIG_DTLK is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set - -# -# Ftape, the floppy tape device driver -# -# CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set -# CONFIG_AGP is not set +CONFIG_BLK_DEV_FLASH=m # # Networking options # -# CONFIG_PACKET is not set +CONFIG_PACKET=m +# CONFIG_PACKET_MMAP is not set # CONFIG_NETLINK is not set # CONFIG_NETFILTER is not set # CONFIG_FILTER is not set @@ -172,17 +130,17 @@ # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_ALIAS is not set +# CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set -# CONFIG_SKB_LARGE is not set # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -195,16 +153,6 @@ # CONFIG_NET_SCHED is not set # -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set - -# -# IrDA (infrared) support -# -# CONFIG_IRDA is not set - -# # Network device support # CONFIG_NETDEVICES=y @@ -221,7 +169,37 @@ # # Ethernet (10 or 100Mbit) # -# CONFIG_NET_ETHERNET is not set +CONFIG_NET_ETHERNET=y +# CONFIG_ARM_AM79C961A is not set +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set +# CONFIG_NET_ISA is not set +CONFIG_NET_PCI=y +# CONFIG_PCNET32 is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_AC3200 is not set +# CONFIG_APRICOT is not set +CONFIG_CS89x0=m +# CONFIG_DE4X5 is not set +# CONFIG_TULIP is not set +# CONFIG_DGRS is not set +# CONFIG_DM9102 is not set +# CONFIG_EEPRO100 is not set +# CONFIG_LNE390 is not set +# CONFIG_NE3210 is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_RTL8129 is not set +# CONFIG_8139TOO is not set +# CONFIG_SIS900 is not set +# CONFIG_TLAN is not set +# CONFIG_VIA_RHINE is not set +# CONFIG_ES3210 is not set +# CONFIG_EPIC100 is not set +# CONFIG_NET_POCKET is not set # # Ethernet (1000 Mbit) @@ -262,11 +240,49 @@ # CONFIG_WAN is not set # +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# # ATA/IDE/MFM/RLL support # -# CONFIG_IDE is not set -# CONFIG_BLK_DEV_IDE_MODES is not set +CONFIG_IDE=m + +# +# IDE, ATA and ATAPI Block devices +# +CONFIG_BLK_DEV_IDE=m +# CONFIG_BLK_DEV_HD_IDE is not set # CONFIG_BLK_DEV_HD is not set +CONFIG_BLK_DEV_IDEDISK=m +# CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set +# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set +# CONFIG_BLK_DEV_IDEDISK_IBM is not set +# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set +# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set +# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set +# CONFIG_BLK_DEV_IDEDISK_WD is not set +# CONFIG_BLK_DEV_COMMERIAL is not set +# CONFIG_BLK_DEV_TIVO is not set +# CONFIG_BLK_DEV_IDECS is not set +CONFIG_BLK_DEV_IDECD=m +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDEFLOPPY is not set +# CONFIG_BLK_DEV_IDESCSI is not set +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_CMD640_ENHANCED is not set +# CONFIG_BLK_DEV_ISAPNP is not set +# CONFIG_IDE_CHIPSETS is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_DMA_NONPCI is not set +# CONFIG_BLK_DEV_IDE_MODES is not set # # SCSI support @@ -274,54 +290,71 @@ # CONFIG_SCSI is not set # -# Sound +# I2O device support # -CONFIG_SOUND=m -# CONFIG_SOUND_CMPCI is not set -# CONFIG_SOUND_EMU10K1 is not set -# CONFIG_SOUND_ES1370 is not set -# CONFIG_SOUND_ES1371 is not set -# CONFIG_SOUND_ESSSOLO1 is not set -# CONFIG_SOUND_MAESTRO is not set -# CONFIG_SOUND_SONICVIBES is not set -# CONFIG_SOUND_TRIDENT is not set -# CONFIG_SOUND_MSNDCLAS is not set -# CONFIG_SOUND_MSNDPIN is not set -# CONFIG_SOUND_VIA82CXXX is not set -CONFIG_SOUND_OSS=m -CONFIG_SOUND_TRACEINIT=y -# CONFIG_SOUND_DMAP is not set -# CONFIG_SOUND_AD1816 is not set -# CONFIG_SOUND_SGALAXY is not set -# CONFIG_SOUND_ADLIB is not set -# CONFIG_SOUND_ACI_MIXER is not set -# CONFIG_SOUND_CS4232 is not set -# CONFIG_SOUND_SSCAPE is not set -# CONFIG_SOUND_GUS is not set -# CONFIG_SOUND_ICH is not set -# CONFIG_SOUND_VMIDI is not set -# CONFIG_SOUND_TRIX is not set -# CONFIG_SOUND_MSS is not set -# CONFIG_SOUND_MPU401 is not set -# CONFIG_SOUND_NM256 is not set -# CONFIG_SOUND_MAD16 is not set -# CONFIG_SOUND_PAS is not set -# CONFIG_PAS_JOYSTICK is not set -# CONFIG_SOUND_PSS is not set -# CONFIG_SOUND_SOFTOSS is not set -# CONFIG_SOUND_SB is not set -# CONFIG_SOUND_AWE32_SYNTH is not set -# CONFIG_SOUND_WAVEFRONT is not set -# CONFIG_SOUND_MAUI is not set -# CONFIG_SOUND_YM3812 is not set -# CONFIG_SOUND_OPL3SA1 is not set -# CONFIG_SOUND_OPL3SA2 is not set -# CONFIG_SOUND_YMPCI is not set -# CONFIG_SOUND_UART6850 is not set -# CONFIG_SOUND_AEDSP16 is not set -# CONFIG_SOUND_VIDC is not set -# CONFIG_SOUND_WAVEARTIST is not set -CONFIG_SOUND_SA1100_SSP=m +# CONFIG_I2O is not set +# CONFIG_I2O_BLOCK is not set +# CONFIG_I2O_LAN is not set +# CONFIG_I2O_SCSI is not set +# CONFIG_I2O_PROC is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Character devices +# +# CONFIG_VT is not set +CONFIG_SERIAL_SA1100=y +CONFIG_SERIAL_SA1100_CONSOLE=y +CONFIG_TOUCHSCREEN_UCB1200=m +# CONFIG_TOUCHSCREEN_BITSY is not set +# CONFIG_SERIAL is not set +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_UNIX98_PTYS is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +# CONFIG_MOUSE is not set + +# +# Joysticks +# +# CONFIG_JOYSTICK is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set + +# +# Video For Linux +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set # # File systems @@ -339,6 +372,7 @@ # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set @@ -367,13 +401,13 @@ # Network File Systems # # CONFIG_CODA_FS is not set -# CONFIG_NFS_FS is not set +CONFIG_NFS_FS=m # CONFIG_NFS_V3 is not set # CONFIG_ROOT_NFS is not set # CONFIG_NFSD is not set # CONFIG_NFSD_V3 is not set -# CONFIG_SUNRPC is not set -# CONFIG_LOCKD is not set +CONFIG_SUNRPC=m +CONFIG_LOCKD=m # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # CONFIG_NCPFS_PACKET_SIGNING is not set @@ -395,6 +429,57 @@ # CONFIG_NLS is not set # +# Sound +# +CONFIG_SOUND=m +# CONFIG_SOUND_CMPCI is not set +# CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_ES1370 is not set +# CONFIG_SOUND_ES1371 is not set +# CONFIG_SOUND_ESSSOLO1 is not set +# CONFIG_SOUND_MAESTRO is not set +# CONFIG_SOUND_SONICVIBES is not set +# CONFIG_SOUND_TRIDENT is not set +# CONFIG_SOUND_MSNDCLAS is not set +# CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_VIA82CXXX is not set +CONFIG_SOUND_OSS=m +CONFIG_SOUND_TRACEINIT=y +# CONFIG_SOUND_DMAP is not set +# CONFIG_SOUND_AD1816 is not set +# CONFIG_SOUND_SGALAXY is not set +# CONFIG_SOUND_ADLIB is not set +# CONFIG_SOUND_ACI_MIXER is not set +# CONFIG_SOUND_CS4232 is not set +# CONFIG_SOUND_SSCAPE is not set +# CONFIG_SOUND_GUS is not set +# CONFIG_SOUND_ICH is not set +# CONFIG_SOUND_VMIDI is not set +# CONFIG_SOUND_TRIX is not set +# CONFIG_SOUND_MSS is not set +# CONFIG_SOUND_MPU401 is not set +# CONFIG_SOUND_NM256 is not set +# CONFIG_SOUND_MAD16 is not set +# CONFIG_SOUND_PAS is not set +# CONFIG_PAS_JOYSTICK is not set +# CONFIG_SOUND_PSS is not set +# CONFIG_SOUND_SOFTOSS is not set +# CONFIG_SOUND_SB is not set +# CONFIG_SOUND_AWE32_SYNTH is not set +# CONFIG_SOUND_WAVEFRONT is not set +# CONFIG_SOUND_MAUI is not set +# CONFIG_SOUND_YM3812 is not set +# CONFIG_SOUND_OPL3SA1 is not set +# CONFIG_SOUND_OPL3SA2 is not set +# CONFIG_SOUND_YMPCI is not set +# CONFIG_SOUND_UART6850 is not set +# CONFIG_SOUND_AEDSP16 is not set +# CONFIG_SOUND_VIDC is not set +# CONFIG_SOUND_WAVEARTIST is not set +CONFIG_SOUND_SA1100_SSP=m +# CONFIG_SOUND_TVMIXER is not set + +# # USB support # # CONFIG_USB is not set @@ -406,5 +491,5 @@ CONFIG_DEBUG_ERRORS=y CONFIG_DEBUG_USER=y # CONFIG_DEBUG_INFO is not set -# CONFIG_MAGIC_SYSRQ is not set +CONFIG_MAGIC_SYSRQ=y CONFIG_DEBUG_LL=y diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/def-configs/shark linux/arch/arm/def-configs/shark --- v2.4.0-test8/linux/arch/arm/def-configs/shark Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/def-configs/shark Mon Sep 18 15:15:24 2000 @@ -0,0 +1,655 @@ +# +# Automatically generated make config: don't edit +# +CONFIG_ARM=y +# CONFIG_SBUS is not set +CONFIG_UID16=y + +# +# Code maturity level options +# +CONFIG_EXPERIMENTAL=y +# CONFIG_OBSOLETE is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +# CONFIG_MODVERSIONS is not set +CONFIG_KMOD=y + +# +# System Type +# +# CONFIG_ARCH_ARCA5K is not set +# CONFIG_ARCH_CLPS7500 is not set +# CONFIG_ARCH_CO285 is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_FTVPCI is not set +# CONFIG_ARCH_TBOX is not set +CONFIG_ARCH_SHARK=y +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_INTEGRATOR is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_ACORN is not set +# CONFIG_FOOTBRIDGE is not set +# CONFIG_FOOTBRIDGE_HOST is not set +# CONFIG_FOOTBRIDGE_ADDIN is not set +CONFIG_CPU_32=y +# CONFIG_CPU_26 is not set +CONFIG_CPU_32v4=y +CONFIG_CPU_SA110=y +# CONFIG_DISCONTIGMEM is not set +CONFIG_PCI=y +CONFIG_ISA=y +CONFIG_ISA_DMA=y +CONFIG_PC_KEYB=y +CONFIG_PC_KEYMAP=y + +# +# General setup +# +# CONFIG_PCI_NAMES is not set +# CONFIG_HOTPLUG is not set +# CONFIG_PCMCIA is not set +CONFIG_NET=y +CONFIG_SYSVIPC=y +# CONFIG_BSD_PROCESS_ACCT is not set +CONFIG_SYSCTL=y +CONFIG_NWFPE=y +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set +# CONFIG_BINFMT_AOUT is not set +CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_MISC is not set +# CONFIG_PM is not set +# CONFIG_ARTHUR is not set +CONFIG_LEDS=y +CONFIG_LEDS_TIMER=y +# CONFIG_LEDS_CPU is not set +# CONFIG_ALIGNMENT_TRAP is not set + +# +# Parallel port support +# +CONFIG_PARPORT=y +CONFIG_PARPORT_PC=y +# CONFIG_PARPORT_PC_FIFO is not set +# CONFIG_PARPORT_PC_SUPERIO is not set +# CONFIG_PARPORT_AMIGA is not set +# CONFIG_PARPORT_MFC3 is not set +# CONFIG_PARPORT_ATARI is not set +# CONFIG_PARPORT_SUNBPP is not set +# CONFIG_PARPORT_OTHER is not set +# CONFIG_PARPORT_1284 is not set + +# +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# +# Plug and Play configuration +# +# CONFIG_PNP is not set + +# +# Block devices +# +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_PARIDE is not set +# CONFIG_BLK_CPQ_DA is not set +# CONFIG_BLK_DEV_DAC960 is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set +# CONFIG_BLK_DEV_MD is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 +# CONFIG_BLK_DEV_INITRD is not set + +# +# Networking options +# +# CONFIG_PACKET is not set +# CONFIG_NETLINK is not set +# CONFIG_NETFILTER is not set +# CONFIG_FILTER is not set +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_IP_ROUTER is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE is not set +# CONFIG_IP_ALIAS is not set +# CONFIG_INET_ECN is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_IPV6 is not set +# CONFIG_KHTTPD is not set +# CONFIG_ATM is not set + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_LLC is not set +# CONFIG_ECONET is not set +# CONFIG_WAN_ROUTER is not set +# CONFIG_NET_FASTROUTE is not set +# CONFIG_NET_HW_FLOWCONTROL is not set + +# +# QoS and/or fair queueing +# +# CONFIG_NET_SCHED is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y + +# +# ARCnet devices +# +# CONFIG_ARCNET is not set +# CONFIG_DUMMY is not set +# CONFIG_BONDING is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_SB1000 is not set + +# +# Ethernet (10 or 100Mbit) +# +CONFIG_NET_ETHERNET=y +# CONFIG_ARM_AM79C961A is not set +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_VENDOR_RACAL is not set +# CONFIG_AT1700 is not set +# CONFIG_DEPCA is not set +# CONFIG_NET_ISA is not set +CONFIG_NET_PCI=y +# CONFIG_PCNET32 is not set +# CONFIG_ADAPTEC_STARFIRE is not set +# CONFIG_AC3200 is not set +# CONFIG_APRICOT is not set +CONFIG_CS89x0=y +# CONFIG_DE4X5 is not set +# CONFIG_TULIP is not set +# CONFIG_DGRS is not set +# CONFIG_DM9102 is not set +# CONFIG_EEPRO100 is not set +# CONFIG_LNE390 is not set +# CONFIG_NE3210 is not set +# CONFIG_NE2K_PCI is not set +# CONFIG_RTL8129 is not set +# CONFIG_8139TOO is not set +# CONFIG_SIS900 is not set +# CONFIG_TLAN is not set +# CONFIG_VIA_RHINE is not set +# CONFIG_ES3210 is not set +# CONFIG_EPIC100 is not set +# CONFIG_NET_POCKET is not set + +# +# Ethernet (1000 Mbit) +# +# CONFIG_YELLOWFIN is not set +# CONFIG_ACENIC is not set +# CONFIG_SK98LIN is not set +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +# CONFIG_PLIP is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set + +# +# Wireless LAN (non-hamradio) +# +# CONFIG_NET_RADIO is not set + +# +# Token Ring devices +# +# CONFIG_TR is not set +# CONFIG_NET_FC is not set +# CONFIG_RCPCI is not set +# CONFIG_SHAPER is not set + +# +# Wan interfaces +# +# CONFIG_WAN is not set +# CONFIG_ASH is not set + +# +# Amateur Radio support +# +# CONFIG_HAMRADIO is not set + +# +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# +# ATA/IDE/MFM/RLL support +# +CONFIG_IDE=y + +# +# IDE, ATA and ATAPI Block devices +# +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_HD is not set +CONFIG_BLK_DEV_IDEDISK=y +# CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set +# CONFIG_BLK_DEV_COMMERIAL is not set +CONFIG_BLK_DEV_IDECD=y +# CONFIG_BLK_DEV_IDETAPE is not set +CONFIG_BLK_DEV_IDEFLOPPY=y +# CONFIG_BLK_DEV_IDESCSI is not set + +# +# IDE chipset support/bugfixes +# +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_BLK_DEV_RZ1000 is not set +# CONFIG_BLK_DEV_IDEPCI is not set +# CONFIG_BLK_DEV_SL82C105 is not set +# CONFIG_IDE_CHIPSETS is not set +# CONFIG_IDEDMA_AUTO is not set +# CONFIG_DMA_NONPCI is not set +# CONFIG_BLK_DEV_IDE_MODES is not set + +# +# SCSI support +# +CONFIG_SCSI=m + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=m +CONFIG_SD_EXTRA_DEVS=40 +CONFIG_CHR_DEV_ST=m +CONFIG_BLK_DEV_SR=m +# CONFIG_BLK_DEV_SR_VENDOR is not set +CONFIG_SR_EXTRA_DEVS=2 +CONFIG_CHR_DEV_SG=m + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +# CONFIG_SCSI_DEBUG_QUEUES is not set +# CONFIG_SCSI_MULTI_LUN is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set + +# +# SCSI low-level drivers +# +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set +# CONFIG_SCSI_7000FASST is not set +# CONFIG_SCSI_ACARD is not set +# CONFIG_SCSI_AHA152X is not set +# CONFIG_SCSI_AHA1542 is not set +# CONFIG_SCSI_AHA1740 is not set +# CONFIG_SCSI_AIC7XXX is not set +# CONFIG_SCSI_ADVANSYS is not set +# CONFIG_SCSI_IN2000 is not set +# CONFIG_SCSI_AM53C974 is not set +# CONFIG_SCSI_MEGARAID is not set +# CONFIG_SCSI_BUSLOGIC is not set +# CONFIG_SCSI_DMX3191D is not set +# CONFIG_SCSI_DTC3280 is not set +# CONFIG_SCSI_EATA is not set +# CONFIG_SCSI_EATA_DMA is not set +# CONFIG_SCSI_EATA_PIO is not set +# CONFIG_SCSI_FUTURE_DOMAIN is not set +# CONFIG_SCSI_GDTH is not set +# CONFIG_SCSI_GENERIC_NCR5380 is not set +# CONFIG_SCSI_INITIO is not set +# CONFIG_SCSI_INIA100 is not set +# CONFIG_SCSI_PPA is not set +# CONFIG_SCSI_IMM is not set +# CONFIG_SCSI_NCR53C406A is not set +# CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SIM710 is not set +# CONFIG_SCSI_NCR53C7xx is not set +# CONFIG_SCSI_NCR53C8XX is not set +# CONFIG_SCSI_SYM53C8XX is not set +# CONFIG_SCSI_PAS16 is not set +# CONFIG_SCSI_PCI2000 is not set +# CONFIG_SCSI_PCI2220I is not set +# CONFIG_SCSI_PSI240I is not set +# CONFIG_SCSI_QLOGIC_FAS is not set +# CONFIG_SCSI_QLOGIC_ISP is not set +# CONFIG_SCSI_QLOGIC_FC is not set +# CONFIG_SCSI_QLOGIC_1280 is not set +# CONFIG_SCSI_DC390T is not set +# CONFIG_SCSI_T128 is not set +# CONFIG_SCSI_U14_34F is not set +# CONFIG_SCSI_DEBUG is not set + +# +# IEEE 1394 (FireWire) support +# +# CONFIG_IEEE1394 is not set + +# +# I2O device support +# +# CONFIG_I2O is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_SERIAL_CONSOLE=y +# CONFIG_SERIAL_EXTENDED is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_UNIX98_PTYS is not set +CONFIG_PRINTER=m +# CONFIG_LP_CONSOLE is not set +# CONFIG_PPDEV is not set + +# +# I2C support +# +# CONFIG_I2C is not set + +# +# Mice +# +# CONFIG_BUSMOUSE is not set +CONFIG_MOUSE=y +CONFIG_PSMOUSE=y +# CONFIG_82C710_MOUSE is not set +# CONFIG_PC110_PAD is not set + +# +# Joysticks +# +CONFIG_JOYSTICK=y +CONFIG_INPUT_JOYDEV=y + +# +# Game port support +# +# CONFIG_INPUT_NS558 is not set +# CONFIG_INPUT_LIGHTNING is not set +# CONFIG_INPUT_PCIGAME is not set + +# +# Gameport joysticks +# +# CONFIG_INPUT_ANALOG is not set +# CONFIG_INPUT_A3D is not set +# CONFIG_INPUT_ADI is not set +# CONFIG_INPUT_COBRA is not set +# CONFIG_INPUT_GF2K is not set +# CONFIG_INPUT_GRIP is not set +# CONFIG_INPUT_INTERACT is not set +# CONFIG_INPUT_TMDC is not set +# CONFIG_INPUT_SIDEWINDER is not set + +# +# Serial port support +# +# CONFIG_INPUT_SERPORT is not set + +# +# Serial port joysticks +# +# CONFIG_INPUT_WARRIOR is not set +# CONFIG_INPUT_MAGELLAN is not set +# CONFIG_INPUT_SPACEORB is not set +# CONFIG_INPUT_SPACEBALL is not set +# CONFIG_INPUT_IFORCE_232 is not set + +# +# Parallel port joysticks +# +# CONFIG_INPUT_DB9 is not set +# CONFIG_INPUT_GAMECON is not set +# CONFIG_INPUT_TURBOGRAFX is not set +# CONFIG_QIC02_TAPE is not set + +# +# Watchdog Cards +# +# CONFIG_WATCHDOG is not set +# CONFIG_NVRAM is not set +CONFIG_RTC=y + +# +# Video For Linux +# +# CONFIG_VIDEO_DEV is not set +# CONFIG_DTLK is not set +# CONFIG_R3964 is not set +# CONFIG_APPLICOM is not set + +# +# Ftape, the floppy tape device driver +# +# CONFIG_FTAPE is not set +# CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# File systems +# +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_BFS_FS is not set +CONFIG_FAT_FS=y +CONFIG_MSDOS_FS=y +# CONFIG_UMSDOS_FS is not set +CONFIG_VFAT_FS=y +# CONFIG_EFS_FS is not set +CONFIG_JFFS_FS_VERBOSE=0 +# CONFIG_CRAMFS is not set +# CONFIG_RAMFS is not set +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +# CONFIG_MINIX_FS is not set +# CONFIG_NTFS_FS is not set +# CONFIG_HPFS_FS is not set +CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_ROMFS_FS is not set +CONFIG_EXT2_FS=y +# CONFIG_SYSV_FS is not set +# CONFIG_UDF_FS is not set +# CONFIG_UFS_FS is not set + +# +# Network File Systems +# +# CONFIG_CODA_FS is not set +CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set +# CONFIG_NFSD is not set +CONFIG_SUNRPC=y +CONFIG_LOCKD=y +# CONFIG_SMB_FS is not set +# CONFIG_NCP_FS is not set + +# +# Partition Types +# +CONFIG_PARTITION_ADVANCED=y +# CONFIG_ACORN_PARTITION is not set +# CONFIG_OSF_PARTITION is not set +# CONFIG_AMIGA_PARTITION is not set +# CONFIG_ATARI_PARTITION is not set +# CONFIG_MAC_PARTITION is not set +CONFIG_MSDOS_PARTITION=y +# CONFIG_BSD_DISKLABEL is not set +# CONFIG_SOLARIS_X86_PARTITION is not set +# CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set +# CONFIG_SUN_PARTITION is not set +CONFIG_NLS=y + +# +# Native Language Support +# +CONFIG_NLS_DEFAULT="iso8859-1" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +CONFIG_NLS_CODEPAGE_850=y +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_UTF8 is not set + +# +# Console drivers +# +# CONFIG_VGA_CONSOLE is not set +CONFIG_FB=y + +# +# Frame-buffer support +# +CONFIG_FB=y +CONFIG_DUMMY_CONSOLE=y +# CONFIG_FB_RIVA is not set +# CONFIG_FB_CLGEN is not set +# CONFIG_FB_PM2 is not set +CONFIG_FB_CYBER2000=y +# CONFIG_FB_MATROX is not set +# CONFIG_FB_ATY is not set +# CONFIG_FB_ATY128 is not set +# CONFIG_FB_3DFX is not set +# CONFIG_FB_SIS is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FBCON_ADVANCED is not set +CONFIG_FBCON_CFB8=y +CONFIG_FBCON_CFB16=y +CONFIG_FBCON_CFB24=y +# CONFIG_FBCON_FONTWIDTH8_ONLY is not set +# CONFIG_FBCON_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y + +# +# Sound +# +CONFIG_SOUND=m +# CONFIG_SOUND_CMPCI is not set +# CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_ES1370 is not set +# CONFIG_SOUND_ES1371 is not set +# CONFIG_SOUND_ESSSOLO1 is not set +# CONFIG_SOUND_MAESTRO is not set +# CONFIG_SOUND_SONICVIBES is not set +# CONFIG_SOUND_TRIDENT is not set +# CONFIG_SOUND_MSNDCLAS is not set +# CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_VIA82CXXX is not set +CONFIG_SOUND_OSS=m +# CONFIG_SOUND_TRACEINIT is not set +# CONFIG_SOUND_DMAP is not set +# CONFIG_SOUND_AD1816 is not set +# CONFIG_SOUND_SGALAXY is not set +# CONFIG_SOUND_ADLIB is not set +# CONFIG_SOUND_ACI_MIXER is not set +# CONFIG_SOUND_CS4232 is not set +# CONFIG_SOUND_SSCAPE is not set +# CONFIG_SOUND_GUS is not set +# CONFIG_SOUND_ICH is not set +# CONFIG_SOUND_VMIDI is not set +# CONFIG_SOUND_TRIX is not set +# CONFIG_SOUND_MSS is not set +# CONFIG_SOUND_MPU401 is not set +# CONFIG_SOUND_NM256 is not set +# CONFIG_SOUND_MAD16 is not set +# CONFIG_SOUND_PAS is not set +# CONFIG_SOUND_PSS is not set +# CONFIG_SOUND_SOFTOSS is not set +CONFIG_SOUND_SB=m +# CONFIG_SOUND_AWE32_SYNTH is not set +# CONFIG_SOUND_WAVEFRONT is not set +# CONFIG_SOUND_MAUI is not set +# CONFIG_SOUND_YM3812 is not set +# CONFIG_SOUND_OPL3SA1 is not set +# CONFIG_SOUND_OPL3SA2 is not set +# CONFIG_SOUND_YMPCI is not set +# CONFIG_SOUND_UART6850 is not set +# CONFIG_SOUND_AEDSP16 is not set +# CONFIG_SOUND_VIDC is not set +# CONFIG_SOUND_WAVEARTIST is not set + +# +# USB support +# +# CONFIG_USB is not set + +# +# Kernel hacking +# +# CONFIG_FRAME_POINTER is not set +CONFIG_DEBUG_ERRORS=y +CONFIG_DEBUG_USER=y +# CONFIG_DEBUG_INFO is not set +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_DEBUG_LL=y diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/Makefile linux/arch/arm/kernel/Makefile --- v2.4.0-test8/linux/arch/arm/kernel/Makefile Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/Makefile Mon Sep 18 15:15:24 2000 @@ -15,10 +15,18 @@ O_OBJS_arc = dma-arc.o oldlatches.o O_OBJS_rpc = dma-rpc.o -O_OBJS_footbridge = dma-footbridge.o hw-footbridge.o isa.o -O_OBJS_sa1100 = hw-sa1100.o +O_OBJS_footbridge = dma-footbridge.o isa.o O_OBJS_l7200 = fiq.o +leds-ebsa110 = leds-ebsa110.o + +pci-nexuspci = plx90x0.o +pci-footbridge = dec21285.o +pci-shark = via82c505.o + +pci-$(CONFIG_ARCH_NEXUSPCI) += ftv-pci.o + + O_TARGET := kernel.o # Object file lists. @@ -30,21 +38,18 @@ obj-n := obj- := -export-objs := armksyms.o dma.o ecard.o hw-footbridge.o \ - hw-sa1100.o leds-$(MACHINE).o oldlatches.o +export-objs := armksyms.o dma.o ecard.o \ + $(leds-$(MACHINE)) oldlatches.o \ + time.o obj-$(CONFIG_ARCH_ACORN) += ecard.o fiq.o time-acorn.o obj-$(CONFIG_DEBUG_LL) += debug-$(PROCESSOR).o obj-$(CONFIG_MODULES) += armksyms.o -obj-$(CONFIG_LEDS) += leds-$(MACHINE).o +obj-$(CONFIG_LEDS) += $(leds-$(MACHINE)) obj-$(CONFIG_ARTHUR) += arthur.o obj-$(CONFIG_ISA_DMA) += dma-isa.o -ifeq ($(MACHINE),nexuspci) - obj-$(CONFIG_PCI) += plx9080.o -else - obj-$(CONFIG_PCI) += bios32.o dec21285.o -endif +obj-$(CONFIG_PCI) += bios32.o $(pci-$(MACHINE)) $(pci-y) # Files that are both resident and modular; remove from modular. diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/arch.c linux/arch/arm/kernel/arch.c --- v2.4.0-test8/linux/arch/arm/kernel/arch.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/arch.c Mon Sep 18 15:15:24 2000 @@ -1,10 +1,10 @@ /* - * linux/arch/arm/kernel/arch.c + * linux/arch/arm/kernel/arch.c * - * Architecture specific fixups. This is where any - * parameters in the params struct are fixed up, or - * any additional architecture specific information - * is pulled from the params struct. + * Architecture specific fixups. This is where any + * parameters in the params struct are fixed up, or + * any additional architecture specific information + * is pulled from the params struct. */ #include #include @@ -12,12 +12,12 @@ #include #include -#include #include #include #include -#include "arch.h" +#include +#include unsigned int vram_size; @@ -69,6 +69,8 @@ } #ifdef CONFIG_ARCH_RPC +extern void __init rpc_map_io(void); + MACHINE_START(RISCPC, "Acorn-RiscPC") MAINTAINER("Russell King") BOOT_MEM(0x10000000, 0x03000000, 0xe0000000) @@ -76,6 +78,7 @@ DISABLE_PARPORT(0) DISABLE_PARPORT(1) FIXUP(fixup_acorn) + MAPIO(rpc_map_io) MACHINE_END #endif #ifdef CONFIG_ARCH_ARC @@ -94,379 +97,6 @@ #endif #endif -#ifdef CONFIG_ARCH_EBSA285 - -static void __init -fixup_ebsa285(struct machine_desc *desc, struct param_struct *params, - char **cmdline, struct meminfo *mi) -{ - ORIG_X = params->u1.s.video_x; - ORIG_Y = params->u1.s.video_y; - ORIG_VIDEO_COLS = params->u1.s.video_num_cols; - ORIG_VIDEO_LINES = params->u1.s.video_num_rows; -} - -MACHINE_START(EBSA285, "EBSA285") - MAINTAINER("Russell King") - BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) - BOOT_PARAMS(0x00000100) - VIDEO(0x000a0000, 0x000bffff) - FIXUP(fixup_ebsa285) -MACHINE_END -#endif - -#ifdef CONFIG_ARCH_NETWINDER -/* - * Older NeTTroms either do not provide a parameters - * page, or they don't supply correct information in - * the parameter page. - */ -static void __init -fixup_netwinder(struct machine_desc *desc, struct param_struct *params, - char **cmdline, struct meminfo *mi) -{ -#ifdef CONFIG_ISAPNP - extern int isapnp_disable; - - /* - * We must not use the kernels ISAPnP code - * on the NetWinder - it will reset the settings - * for the WaveArtist chip and render it inoperable. - */ - isapnp_disable = 1; -#endif - - if (params->u1.s.nr_pages != 0x02000 && - params->u1.s.nr_pages != 0x04000 && - params->u1.s.nr_pages != 0x08000 && - params->u1.s.nr_pages != 0x10000) { - printk(KERN_WARNING "Warning: bad NeTTrom parameters " - "detected, using defaults\n"); - - params->u1.s.nr_pages = 0x2000; /* 32MB */ - params->u1.s.ramdisk_size = 0; - params->u1.s.flags = FLAG_READONLY; - params->u1.s.initrd_start = 0; - params->u1.s.initrd_size = 0; - params->u1.s.rd_start = 0; - } -} - -MACHINE_START(NETWINDER, "Rebel-NetWinder") - MAINTAINER("Russell King/Rebel.com") - BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) - BOOT_PARAMS(0x00000100) - VIDEO(0x000a0000, 0x000bffff) - DISABLE_PARPORT(0) - DISABLE_PARPORT(2) - FIXUP(fixup_netwinder) -MACHINE_END -#endif - -#ifdef CONFIG_ARCH_CATS -/* - * CATS uses soft-reboot by default, since - * hard reboots fail on early boards. - */ -static void __init -fixup_cats(struct machine_desc *desc, struct param_struct *params, - char **cmdline, struct meminfo *mi) -{ - ORIG_VIDEO_LINES = 25; - ORIG_VIDEO_POINTS = 16; - ORIG_Y = 24; -} - -MACHINE_START(CATS, "Chalice-CATS") - MAINTAINER("Philip Blundell") - BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) - SOFT_REBOOT - FIXUP(fixup_cats) -MACHINE_END -#endif - -#ifdef CONFIG_ARCH_CO285 - -static void __init -fixup_coebsa285(struct machine_desc *desc, struct param_struct *params, - char **cmdline, struct meminfo *mi) -{ - extern unsigned long boot_memory_end; - extern char boot_command_line[]; - - mi->nr_banks = 1; - mi->bank[0].start = PHYS_OFFSET; - mi->bank[0].size = boot_memory_end; - mi->bank[0].node = 0; - - *cmdline = boot_command_line; -} - -MACHINE_START(CO285, "co-EBSA285") - MAINTAINER("Mark van Doesburg") - BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0x7cf00000) - FIXUP(fixup_coebsa285) -MACHINE_END -#endif - -#ifdef CONFIG_ARCH_SA1100 - -static void victor_power_off(void) -{ - /* switch off power supply */ - mdelay(2000); - GPCR = GPIO_GPIO23; - while (1); -} - - -static void xp860_power_off(void) -{ - GPDR |= GPIO_GPIO20; - GPSR = GPIO_GPIO20; - mdelay(1000); - GPCR = GPIO_GPIO20; - while(1); -} - - -extern void select_sa1100_io_desc(void); -#define SET_BANK(__nr,__start,__size) \ - mi->bank[__nr].start = (__start), \ - mi->bank[__nr].size = (__size), \ - mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) -static void __init -fixup_sa1100(struct machine_desc *desc, struct param_struct *params, - char **cmdline, struct meminfo *mi) -{ - select_sa1100_io_desc(); - - if (machine_is_assabet()) { - /* - * On Assabet, we must probe for the Neponset board *before* - * paging_init() has occured to actually determine the amount - * of RAM available. - */ - extern void map_sa1100_gpio_regs(void); - extern void get_assabet_scr(void); - map_sa1100_gpio_regs(); - get_assabet_scr(); - - SET_BANK( 0, 0xc0000000, 32*1024*1024 ); - mi->nr_banks = 1; - - if (machine_has_neponset()) { - printk("Neponset expansion board detected\n"); - /* - * Note that Neponset RAM is slower... - * and still untested. - * This would be a candidate for - * _real_ NUMA support. - */ - //SET_BANK( 1, 0xd0000000, 32*1024*1024 ); - //mi->nr_banks = 2; - } - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk( 1, 0, 0, 8192 ); - setup_initrd( 0xc0800000, 3*1024*1024 ); - } - - else if (machine_is_brutus()) { - SET_BANK( 0, 0xc0000000, 4*1024*1024 ); - SET_BANK( 1, 0xc8000000, 4*1024*1024 ); - SET_BANK( 2, 0xd0000000, 4*1024*1024 ); - SET_BANK( 3, 0xd8000000, 4*1024*1024 ); - mi->nr_banks = 4; - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk( 1, 0, 0, 8192 ); - setup_initrd( __phys_to_virt(0xd8000000), 3*1024*1024 ); - } - - else if (machine_is_cerf()) { - // 16Meg Ram. - SET_BANK( 0, 0xc0000000, 8*1024*1024 ); - SET_BANK( 1, 0xc8000000, 8*1024*1024 ); // comment this out for 8MB Cerfs - mi->nr_banks = 2; - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk(1, 0, 0, 8192); - // Save 2Meg for RAMDisk - setup_initrd(0xc0500000, 3*1024*1024); - } - - else if (machine_is_empeg()) { - SET_BANK( 0, 0xc0000000, 4*1024*1024 ); - SET_BANK( 1, 0xc8000000, 4*1024*1024 ); - mi->nr_banks = 2; - - ROOT_DEV = MKDEV( 3, 1 ); /* /dev/hda1 */ - setup_ramdisk( 1, 0, 0, 4096 ); - setup_initrd( 0xd0000000+((1024-320)*1024), (320*1024) ); - } - - else if (machine_is_lart()) { - /* - * Note that LART is a special case - it doesn't use physical - * address line A23 on the DRAM, so we effectively have 4 * 8MB - * in two SA1100 banks. - */ - SET_BANK( 0, 0xc0000000, 8*1024*1024 ); - SET_BANK( 1, 0xc1000000, 8*1024*1024 ); - SET_BANK( 2, 0xc8000000, 8*1024*1024 ); - SET_BANK( 3, 0xc9000000, 8*1024*1024 ); - mi->nr_banks = 4; - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk(1, 0, 0, 8192); - setup_initrd(0xc0400000, 4*1024*1024); - } - - else if (machine_is_thinclient() || machine_is_graphicsclient()) { - SET_BANK( 0, 0xc0000000, 16*1024*1024 ); - mi->nr_banks = 1; - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk( 1, 0, 0, 8192 ); - setup_initrd( __phys_to_virt(0xc0800000), 4*1024*1024 ); - } - - else if (machine_is_nanoengine()) { - SET_BANK( 0, 0xc0000000, 32*1024*1024 ); - mi->nr_banks = 1; - - ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); - setup_ramdisk( 1, 0, 0, 8192 ); - setup_initrd( __phys_to_virt(0xc0800000), 4*1024*1024 ); - - /* Get command line parameters passed from the loader (if any) */ - if( *((char*)0xc0000100) ) - *cmdline = ((char *)0xc0000100); - } - else if (machine_is_tifon()) { - SET_BANK( 0, 0xc0000000, 16*1024*1024 ); - SET_BANK( 1, 0xc8000000, 16*1024*1024 ); - mi->nr_banks = 2; - - ROOT_DEV = MKDEV(UNNAMED_MAJOR, 0); - setup_ramdisk(1, 0, 0, 4096); - setup_initrd( 0xd0000000 + 0x1100004, 0x140000 ); - } - - else if (machine_is_victor()) { - SET_BANK( 0, 0xc0000000, 4*1024*1024 ); - mi->nr_banks = 1; - - ROOT_DEV = MKDEV( 60, 2 ); - - /* Get command line parameters passed from the loader (if any) */ - if( *((char*)0xc0000000) ) - strcpy( *cmdline, ((char *)0xc0000000) ); - - /* power off if any problem */ - strcat( *cmdline, " panic=1" ); - - pm_power_off = victor_power_off; - } - - else if (machine_is_xp860()) { - SET_BANK( 0, 0xc0000000, 32*1024*1024 ); - mi->nr_banks = 1; - - pm_power_off = xp860_power_off; - } -} - -#ifdef CONFIG_SA1100_ASSABET -MACHINE_START(ASSABET, "Intel-Assabet") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_BITSY -MACHINE_START(BITSY, "Compaq Bitsy") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - BOOT_PARAMS(0xc0000100) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_BRUTUS -MACHINE_START(BRUTUS, "Intel Brutus (SA1100 eval board)") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_CERF -MACHINE_START(CERF, "Intrinsyc CerfBoard") - MAINTAINER("Pieter Truter") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_EMPEG -MACHINE_START(EMPEG, "empeg MP3 Car Audio Player") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_GRAPHICSCLIENT -MACHINE_START(GRAPHICSCLIENT, "ADS GraphicsClient") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_ITSY -MACHINE_START(ITSY, "Compaq Itsy") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - BOOT_PARAMS(0xc0000100 - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_LART -MACHINE_START(LART, "LART") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_NANOENGINE -MACHINE_START(NANOENGINE, "BSE nanoEngine") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_PLEB -MACHINE_START(PLEB, "PLEB") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_THINCLIENT -MACHINE_START(THINCLIENT, "ADS ThinClient") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_TIFON -MACHINE_START(TIFON, "Tifon") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_VICTOR -MACHINE_START(VICTOR, "VisuAide Victor") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#ifdef CONFIG_SA1100_XP860 -MACHINE_START(XP860, "XP860") - BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) - FIXUP(fixup_sa1100) -MACHINE_END -#endif -#endif - #ifdef CONFIG_ARCH_L7200 static void __init @@ -483,14 +113,20 @@ setup_initrd( __phys_to_virt(0xf1000000), 0x00162b0d); } +extern void __init l7200_map_io(void); + MACHINE_START(L7200, "LinkUp Systems L7200SDB") MAINTAINER("Steve Hill") BOOT_MEM(0xf0000000, 0x80040000, 0xd0000000) FIXUP(fixup_l7200) + MAPIO(l7200_map_io) MACHINE_END #endif #ifdef CONFIG_ARCH_EBSA110 + +extern void __init ebsa110_map_io(void); + MACHINE_START(EBSA110, "EBSA110") MAINTAINER("Russell King") BOOT_MEM(0x00000000, 0xe0000000, 0xe0000000) @@ -498,18 +134,27 @@ DISABLE_PARPORT(0) DISABLE_PARPORT(2) SOFT_REBOOT + MAPIO(ebsa110_map_io) MACHINE_END #endif #ifdef CONFIG_ARCH_NEXUSPCI + +extern void __init nexuspci_map_io(void); + MACHINE_START(NEXUSPCI, "FTV/PCI") MAINTAINER("Philip Blundell") BOOT_MEM(0x40000000, 0x10000000, 0xe0000000) + MAPIO(nexuspci_map_io) MACHINE_END #endif #ifdef CONFIG_ARCH_TBOX + +extern void __init tbox_map_io(void); + MACHINE_START(TBOX, "unknown-TBOX") MAINTAINER("Philip Blundell") BOOT_MEM(0x80000000, 0x00400000, 0xe0000000) + MAPIO(tbox_map_io) MACHINE_END #endif #ifdef CONFIG_ARCH_CLPS7110 @@ -528,22 +173,12 @@ MACHINE_END #endif #ifdef CONFIG_ARCH_CLPS7500 + +extern void __init clps7500_map_io(void); + MACHINE_START(CLPS7500, "CL-PS7500") MAINTAINER("Philip Blundell") BOOT_MEM(0x10000000, 0x03000000, 0xe0000000) -MACHINE_END -#endif -#ifdef CONFIG_ARCH_SHARK -MACHINE_START(SHARK, "Shark") - MAINTAINER("Alexander Schulz") - BOOT_MEM(0x08000000, 0x40000000, 0xe0000000) - VIDEO(0x06000000, 0x061fffff) -MACHINE_END -#endif -#ifdef CONFIG_ARCH_PERSONAL_SERVER -MACHINE_START(PERSONAL_SERVER, "Compaq Personal Server") - MAINTAINER("Jamey Hicks / George France") - BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000) - BOOT_PARAMS(0x00000100) + MAPIO(clps7500_map_io) MACHINE_END #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/arch.h linux/arch/arm/kernel/arch.h --- v2.4.0-test8/linux/arch/arm/kernel/arch.h Fri May 12 11:21:20 2000 +++ linux/arch/arm/kernel/arch.h Wed Dec 31 16:00:00 1969 @@ -1,74 +0,0 @@ -/* - * The size of struct machine_desc - * (for assembler code) - */ -#define SIZEOF_MACHINE_DESC 40 - -#ifndef __ASSEMBLY__ - -struct machine_desc { - /* - * Note! The first four elements are used - * by assembler code in head-armv.S - */ - unsigned int nr; /* architecture number */ - unsigned int phys_ram; /* start of physical ram */ - unsigned int phys_io; /* start of physical io */ - unsigned int virt_io; /* start of virtual io */ - - const char *name; /* architecture name */ - unsigned int param_offset; /* parameter page */ - - unsigned int video_start; /* start of video RAM */ - unsigned int video_end; /* end of video RAM */ - - unsigned int reserve_lp0 :1; /* never has lp0 */ - unsigned int reserve_lp1 :1; /* never has lp1 */ - unsigned int reserve_lp2 :1; /* never has lp2 */ - unsigned int broken_hlt :1; /* hlt is broken */ - unsigned int soft_reboot :1; /* soft reboot */ - void (*fixup)(struct machine_desc *, - struct param_struct *, char **, - struct meminfo *); -}; - -/* - * Set of macros to define architecture features. This is built into - * a table by the linker. - */ -#define MACHINE_START(_type,_name) \ -const struct machine_desc __mach_desc_##_type \ - __attribute__((__section__(".arch.info"))) = { \ - nr: MACH_TYPE_##_type##, \ - name: _name, - -#define MAINTAINER(n) - -#define BOOT_MEM(_pram,_pio,_vio) \ - phys_ram: _pram, \ - phys_io: _pio, \ - virt_io: _vio, - -#define BOOT_PARAMS(_params) \ - param_offset: _params, - -#define VIDEO(_start,_end) \ - video_start: _start, \ - video_end: _end, - -#define DISABLE_PARPORT(_n) \ - reserve_lp##_n##: 1, - -#define BROKEN_HLT \ - broken_hlt: 1, - -#define SOFT_REBOOT \ - soft_reboot: 1, - -#define FIXUP(_func) \ - fixup: _func, - -#define MACHINE_END \ -}; - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/armksyms.c linux/arch/arm/kernel/armksyms.c --- v2.4.0-test8/linux/arch/arm/kernel/armksyms.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/armksyms.c Mon Sep 18 15:15:24 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/kernel/armksyms.c + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #include #include #include @@ -110,23 +119,6 @@ EXPORT_SYMBOL(pm_power_off); /* processor dependencies */ -#ifdef MULTI_CPU -EXPORT_SYMBOL(processor); -#else -EXPORT_SYMBOL(cpu_flush_cache_all); -EXPORT_SYMBOL(cpu_flush_cache_area); -EXPORT_SYMBOL(cpu_flush_cache_entry); -EXPORT_SYMBOL(cpu_clean_cache_area); -EXPORT_SYMBOL(cpu_flush_ram_page); -EXPORT_SYMBOL(cpu_flush_tlb_all); -EXPORT_SYMBOL(cpu_flush_tlb_area); -EXPORT_SYMBOL(cpu_set_pgd); -EXPORT_SYMBOL(cpu_set_pmd); -EXPORT_SYMBOL(cpu_set_pte); -EXPORT_SYMBOL(cpu_flush_icache_area); -EXPORT_SYMBOL(cpu_cache_wback_area); -EXPORT_SYMBOL(cpu_cache_purge_area); -#endif EXPORT_SYMBOL(__machine_arch_type); /* networking */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/arthur.c linux/arch/arm/kernel/arthur.c --- v2.4.0-test8/linux/arch/arm/kernel/arthur.c Mon Jun 26 12:04:00 2000 +++ linux/arch/arm/kernel/arthur.c Mon Sep 18 15:15:24 2000 @@ -1,6 +1,14 @@ /* * Arthur personality - * Copyright (C) 1998-1999 Philip Blundell + * + * Copyright (C) 1998, 1999, 2000 Philip Blundell + */ + +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. */ #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/bios32.c linux/arch/arm/kernel/bios32.c --- v2.4.0-test8/linux/arch/arm/kernel/bios32.c Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/kernel/bios32.c Mon Sep 18 15:15:24 2000 @@ -1,9 +1,9 @@ /* - * arch/arm/kernel/bios32.c + * linux/arch/arm/kernel/bios32.c * - * PCI bios-type initialisation for PCI machines + * PCI bios-type initialisation for PCI machines * - * Bits taken from various places. + * Bits taken from various places. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/calls.S linux/arch/arm/kernel/calls.S --- v2.4.0-test8/linux/arch/arm/kernel/calls.S Fri Aug 11 14:29:05 2000 +++ linux/arch/arm/kernel/calls.S Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/calls.h + * linux/arch/arm/lib/calls.h * - * Copyright (C) 1995-1998 Russell King + * Copyright (C) 1995-1998 Russell King * - * This file is included twice in entry-common.S + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file is included twice in entry-common.S */ #ifndef NR_syscalls #define NR_syscalls 256 diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/debug-armo.S linux/arch/arm/kernel/debug-armo.S --- v2.4.0-test8/linux/arch/arm/kernel/debug-armo.S Wed Oct 20 16:29:08 1999 +++ linux/arch/arm/kernel/debug-armo.S Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/kernel/debug-armo.S + * linux/arch/arm/kernel/debug-armo.S * - * Copyright (C) 1999 Russell King + * Copyright (C) 1999 Russell King * - * 26-bit debugging code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 26-bit debugging code */ #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/debug-armv.S linux/arch/arm/kernel/debug-armv.S --- v2.4.0-test8/linux/arch/arm/kernel/debug-armv.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/debug-armv.S Mon Sep 18 15:15:24 2000 @@ -1,14 +1,18 @@ /* - * linux/arch/arm/kernel/debug-armv.S + * linux/arch/arm/kernel/debug-armv.S * - * Copyright (C) 1994-1999 Russell King + * Copyright (C) 1994-1999 Russell King * - * 32-bit debugging code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 32-bit debugging code */ #include #include #include -#include +#include .text @@ -29,10 +33,10 @@ .endm .macro busyuart,rd,rx -1002: ldrb \rd, [\rx, #0x14] +1001: ldrb \rd, [\rx, #0x14] and \rd, \rd, #0x60 teq \rd, #0x60 - bne 1002b + bne 1001b .endm .macro waituart,rd,rx @@ -189,6 +193,38 @@ tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy bne 1001b .endm + +#elif defined(CONFIG_ARCH_INTEGRATOR) + +#include + + .equ io_virt, 0xf0000000 + (0x16000000 >> 4) + .equ io_phys, 0x16000000 + + .macro addruart,rx + mrc p15, 0, \rx, c1, c0 + tst \rx, #1 @ MMU enabled? + moveq \rx, #0x16000000 @ physical base address + movne \rx, #0xf0000000 @ virtual base + addne \rx, \rx, #0x16000000 >> 4 + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #AMBA_UARTDR] + .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #0x18] @ UARTFLG + tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full + bne 1001b + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, #0x18] @ UARTFLG + tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy + bne 1001b + .endm + #else #error Unknown architecture #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dec21285.c linux/arch/arm/kernel/dec21285.c --- v2.4.0-test8/linux/arch/arm/kernel/dec21285.c Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/kernel/dec21285.c Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * arch/arm/kernel/dec21285.c: PCI functions for DC21285 + * linux/arch/arm/kernel/dec21285.c: PCI functions for DC21285 * - * Copyright (C) 1998-2000 Russell King, Phil Blundell + * Copyright (C) 1998-2000 Russell King, Phil Blundell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include @@ -12,12 +16,11 @@ #include #include -#include #include #include #include - #include +#include #define MAX_SLOTS 21 diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma-arc.c linux/arch/arm/kernel/dma-arc.c --- v2.4.0-test8/linux/arch/arm/kernel/dma-arc.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/dma-arc.c Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * arch/arm/kernel/dma-arc.c + * linux/arch/arm/kernel/dma-arc.c * - * Copyright (C) 1998-1999 Dave Gilbert / Russell King + * Copyright (C) 1998-1999 Dave Gilbert / Russell King * - * DMA functions specific to Archimedes and A5000 architecture + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * DMA functions specific to Archimedes and A5000 architecture */ #include #include @@ -11,11 +15,12 @@ #include #include +#include #include #include #include -#include "dma.h" +#include #define DPRINTK(x...) printk(KERN_DEBUG x) @@ -30,11 +35,11 @@ unsigned long flags; DPRINTK("enable_dma fdc1772 data read\n"); save_flags(flags); - cliIF(); + clf(); memcpy ((void *)0x1c, (void *)&fdc1772_dma_read, &fdc1772_dma_read_end - &fdc1772_dma_read); - fdc1772_setupdma(dma->buf.length, __bus_to_virt(dma->buf.address)); /* Sets data pointer up */ + fdc1772_setupdma(dma->buf.length, dma->buf.address); /* Sets data pointer up */ enable_irq (64); restore_flags(flags); } @@ -46,10 +51,10 @@ unsigned long flags; DPRINTK("enable_dma fdc1772 data write\n"); save_flags(flags); - cliIF(); + clf(); memcpy ((void *)0x1c, (void *)&fdc1772_dma_write, &fdc1772_dma_write_end - &fdc1772_dma_write); - fdc1772_setupdma(dma->buf.length, __bus_to_virt(dma->buf.address)); /* Sets data pointer up */ + fdc1772_setupdma(dma->buf.length, dma->buf.address); /* Sets data pointer up */ enable_irq (64); restore_flags(flags); @@ -77,7 +82,7 @@ DPRINTK("arc_floppy_cmdend_enable_dma\n"); /*printk("enable_dma fdc1772 command end FIQ\n");*/ save_flags(flags); - cliIF(); + clf(); /* B fdc1772_comendhandler */ *((unsigned int *)0x1c)=0xea000000 | @@ -150,7 +155,7 @@ } memcpy((void *)0x1c, fiqhandler_start, fiqhandler_length); regs.ARM_r9 = dma->buf.length; - regs.ARM_r10 = __bus_to_virt(dma->buf.address); + regs.ARM_r10 = dma->buf.address; regs.ARM_fp = (int)PCIO_FLOPPYDMABASE; set_fiq_regs(®s); enable_irq(dma->dma_irq); @@ -173,7 +178,7 @@ /* * This is virtual DMA - we don't need anything here */ -static int sound_enable_disable_dma(dmach_t channel, dma_t *dma) +static void sound_enable_disable_dma(dmach_t channel, dma_t *dma) { } @@ -195,8 +200,8 @@ #endif #ifdef CONFIG_ARCH_A5K if (machine_is_a5k()) { - dma[DMA_VIRTUAL_FLOPPY].dma_irq = 64; - dma[DMA_VIRTUAL_FLOPPY].d_ops = &a5k_floppy_dma_ops; + dma[DMA_VIRTUAL_FLOPPY0].dma_irq = 64; + dma[DMA_VIRTUAL_FLOPPY0].d_ops = &a5k_floppy_dma_ops; } #endif dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops; diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma-footbridge.c linux/arch/arm/kernel/dma-footbridge.c --- v2.4.0-test8/linux/arch/arm/kernel/dma-footbridge.c Tue Jul 18 22:43:24 2000 +++ linux/arch/arm/kernel/dma-footbridge.c Mon Sep 18 15:15:24 2000 @@ -1,27 +1,24 @@ /* - * arch/arm/kernel/dma-ebsa285.c + * linux/arch/arm/kernel/dma-ebsa285.c * - * Copyright (C) 1998 Phil Blundell + * Copyright (C) 1998 Phil Blundell * * DMA functions specific to EBSA-285/CATS architectures * - * Changelog: - * 09-Nov-1998 RMK Split out ISA DMA functions to dma-isa.c - * 17-Mar-1999 RMK Allow any EBSA285-like architecture to have + * Changelog: + * 09-Nov-1998 RMK Split out ISA DMA functions to dma-isa.c + * 17-Mar-1999 RMK Allow any EBSA285-like architecture to have * ISA DMA controllers. */ - #include #include #include -#include #include #include -#include "dma.h" - -extern void isa_init_dma(dma_t *dma); +#include +#include #if 0 static int fb_dma_request(dmach_t channel, dma_t *dma) diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma-isa.c linux/arch/arm/kernel/dma-isa.c --- v2.4.0-test8/linux/arch/arm/kernel/dma-isa.c Tue Jul 18 22:43:24 2000 +++ linux/arch/arm/kernel/dma-isa.c Mon Sep 18 15:15:24 2000 @@ -1,24 +1,30 @@ /* - * arch/arm/kernel/dma-isa.c: ISA DMA primitives + * linux/arch/arm/kernel/dma-isa.c * - * Copyright (C) 1999-2000 Russell King + * Copyright (C) 1999-2000 Russell King * - * Taken from various sources, including: - * linux/include/asm/dma.h: Defines for using and allocating dma channels. - * Written by Hennus Bergman, 1992. - * High DMA channel support & info by Hannu Savolainen and John Boyd, - * Nov. 1992. - * arch/arm/kernel/dma-ebsa285.c - * Copyright (C) 1998 Phil Blundell + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ISA DMA primitives + * Taken from various sources, including: + * linux/include/asm/dma.h: Defines for using and allocating dma channels. + * Written by Hennus Bergman, 1992. + * High DMA channel support & info by Hannu Savolainen and John Boyd, + * Nov. 1992. + * arch/arm/kernel/dma-ebsa285.c + * Copyright (C) 1998 Phil Blundell */ #include #include #include +#include #include #include -#include "dma.h" +#include #define ISA_DMA_MODE_READ 0x44 #define ISA_DMA_MODE_WRITE 0x48 @@ -60,47 +66,57 @@ { if (dma->invalid) { unsigned long address, length; - unsigned int mode; - - address = dma->buf.address; - length = dma->buf.length - 1; - - outb(address >> 16, isa_dma_port[channel][ISA_DMA_PGLO]); - outb(address >> 24, isa_dma_port[channel][ISA_DMA_PGHI]); - - if (channel >= 4) { - address >>= 1; - length >>= 1; - } - - outb(0, isa_dma_port[channel][ISA_DMA_CLRFF]); - - outb(address, isa_dma_port[channel][ISA_DMA_ADDR]); - outb(address >> 8, isa_dma_port[channel][ISA_DMA_ADDR]); - - outb(length, isa_dma_port[channel][ISA_DMA_COUNT]); - outb(length >> 8, isa_dma_port[channel][ISA_DMA_COUNT]); + unsigned int mode, direction; mode = channel & 3; - switch (dma->dma_mode & DMA_MODE_MASK) { case DMA_MODE_READ: mode |= ISA_DMA_MODE_READ; - dma_cache_inv(__bus_to_virt(dma->buf.address), dma->buf.length); + direction = PCI_DMA_FROMDEVICE; break; case DMA_MODE_WRITE: mode |= ISA_DMA_MODE_WRITE; - dma_cache_wback(__bus_to_virt(dma->buf.address), dma->buf.length); + direction = PCI_DMA_TODEVICE; break; case DMA_MODE_CASCADE: mode |= ISA_DMA_MODE_CASCADE; + direction = PCI_DMA_BIDIRECTIONAL; break; default: break; } + + if (!dma->using_sg) { + /* + * Cope with ISA-style drivers which expect cache + * coherence. + */ + dma->buf.dma_address = pci_map_single(NULL, + dma->buf.address, dma->buf.length, + direction); + } + + address = dma->buf.dma_address; + length = dma->buf.length - 1; + + outb(address >> 16, isa_dma_port[channel][ISA_DMA_PGLO]); + outb(address >> 24, isa_dma_port[channel][ISA_DMA_PGHI]); + + if (channel >= 4) { + address >>= 1; + length >>= 1; + } + + outb(0, isa_dma_port[channel][ISA_DMA_CLRFF]); + + outb(address, isa_dma_port[channel][ISA_DMA_ADDR]); + outb(address >> 8, isa_dma_port[channel][ISA_DMA_ADDR]); + + outb(length, isa_dma_port[channel][ISA_DMA_COUNT]); + outb(length >> 8, isa_dma_port[channel][ISA_DMA_COUNT]); if (dma->dma_mode & DMA_AUTOINIT) mode |= ISA_DMA_AUTOINIT; diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma-rpc.c linux/arch/arm/kernel/dma-rpc.c --- v2.4.0-test8/linux/arch/arm/kernel/dma-rpc.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/dma-rpc.c Mon Sep 18 15:15:24 2000 @@ -1,25 +1,30 @@ /* - * arch/arm/kernel/dma-rpc.c + * linux/arch/arm/kernel/dma-rpc.c * - * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Russell King * - * DMA functions specific to RiscPC architecture + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * DMA functions specific to RiscPC architecture */ #include #include #include #include +#include #include #include #include #include -#include #include #include #include -#include "dma.h" +#include +#include #if 0 typedef enum { @@ -47,13 +52,13 @@ #define state_wait_a 1 #define state_wait_b 2 -static void iomd_get_next_sg(dmasg_t *sg, dma_t *dma) +static void iomd_get_next_sg(struct scatterlist *sg, dma_t *dma) { unsigned long end, offset, flags = 0; if (dma->sg) { - sg->address = dma->sg->address; - offset = sg->address & ~PAGE_MASK; + sg->dma_address = dma->sg->dma_address; + offset = sg->dma_address & ~PAGE_MASK; end = offset + dma->sg->length; @@ -66,7 +71,7 @@ sg->length = end - TRANSFER_SIZE; dma->sg->length -= end - offset; - dma->sg->address += end - offset; + dma->sg->dma_address += end - offset; if (dma->sg->length == 0) { if (dma->sgcount > 1) { @@ -79,22 +84,22 @@ } } else { flags = DMA_END_S | DMA_END_L; - sg->address = 0; + sg->dma_address = 0; sg->length = 0; } sg->length |= flags; } -static inline void iomd_setup_dma_a(dmasg_t *sg, dma_t *dma) +static inline void iomd_setup_dma_a(struct scatterlist *sg, dma_t *dma) { - outl_t(sg->address, dma->dma_base + CURA); + outl_t(sg->dma_address, dma->dma_base + CURA); outl_t(sg->length, dma->dma_base + ENDA); } -static inline void iomd_setup_dma_b(dmasg_t *sg, dma_t *dma) +static inline void iomd_setup_dma_b(struct scatterlist *sg, dma_t *dma) { - outl_t(sg->address, dma->dma_base + CURB); + outl_t(sg->dma_address, dma->dma_base + CURB); outl_t(sg->length, dma->dma_base + ENDB); } @@ -160,17 +165,8 @@ static int iomd_request_dma(dmach_t channel, dma_t *dma) { - unsigned long flags; - int ret; - - save_flags_cli(flags); - ret = request_irq(dma->dma_irq, iomd_dma_handle, - SA_INTERRUPT, dma->device_id, dma); - if (!ret) - disable_irq(dma->dma_irq); - restore_flags(flags); - - return ret; + return request_irq(dma->dma_irq, iomd_dma_handle, + SA_INTERRUPT, dma->device_id, dma); } static void iomd_free_dma(dmach_t channel, dma_t *dma) @@ -186,6 +182,17 @@ if (dma->invalid) { dma->invalid = 0; + /* + * Cope with ISA-style drivers which expect cache + * coherence. + */ + if (!dma->using_sg) { + dma->buf.dma_address = pci_map_single(NULL, + dma->buf.address, dma->buf.length, + dma->dma_mode == DMA_MODE_READ ? + PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); + } + outb_t(DMA_CR_C, dma_base + CR); dma->state = state_prog_a; } @@ -279,8 +286,8 @@ } regs.ARM_r9 = dma->buf.length; - regs.ARM_r10 = __bus_to_virt(dma->buf.address); - regs.ARM_fp = (int)PCIO_FLOPPYDMABASE; + regs.ARM_r10 = (unsigned long)dma->buf.address; + regs.ARM_fp = (unsigned long)PCIO_FLOPPYDMABASE; if (claim_fiq(&fh)) { printk("floppydma: couldn't claim FIQ.\n"); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma.c linux/arch/arm/kernel/dma.c --- v2.4.0-test8/linux/arch/arm/kernel/dma.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/dma.c Mon Sep 18 15:15:24 2000 @@ -1,11 +1,15 @@ /* - * linux/arch/arm/kernel/dma.c + * linux/arch/arm/kernel/dma.c * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King * - * Front-end to the DMA handling. This handles the allocation/freeing - * of DMA channels, and provides a unified interface to the machines - * DMA facilities. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Front-end to the DMA handling. This handles the allocation/freeing + * of DMA channels, and provides a unified interface to the machines + * DMA facilities. */ #include #include @@ -16,7 +20,7 @@ #include -#include "dma.h" +#include spinlock_t dma_spin_lock = SPIN_LOCK_UNLOCKED; @@ -111,12 +115,13 @@ /* Set DMA Scatter-Gather list */ -void set_dma_sg (dmach_t channel, dmasg_t *sg, int nr_sg) +void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg) { dma_t *dma = dma_chan + channel; dma->sg = sg; dma->sgcount = nr_sg; + dma->using_sg = 1; dma->invalid = 1; } @@ -134,7 +139,8 @@ dma->sg = &dma->buf; dma->sgcount = 1; - dma->buf.address = physaddr; + dma->buf.address = bus_to_virt(physaddr); + dma->using_sg = 0; dma->invalid = 1; } @@ -153,6 +159,7 @@ dma->sg = &dma->buf; dma->sgcount = 1; dma->buf.length = count; + dma->using_sg = 0; dma->invalid = 1; } diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/dma.h linux/arch/arm/kernel/dma.h --- v2.4.0-test8/linux/arch/arm/kernel/dma.h Tue Jul 18 22:43:24 2000 +++ linux/arch/arm/kernel/dma.h Wed Dec 31 16:00:00 1969 @@ -1,48 +0,0 @@ -/* - * linux/arch/arm/kernel/dma.h - * - * Copyright (C) 1998-2000 Russell King - * - * This header file describes the interface between the generic DMA handler - * (dma.c) and the architecture-specific DMA backends (dma-*.c) - */ - -struct dma_struct; -typedef struct dma_struct dma_t; - -struct dma_ops { - int (*request)(dmach_t, dma_t *); /* optional */ - void (*free)(dmach_t, dma_t *); /* optional */ - void (*enable)(dmach_t, dma_t *); /* mandatory */ - void (*disable)(dmach_t, dma_t *); /* mandatory */ - int (*residue)(dmach_t, dma_t *); /* optional */ - int (*setspeed)(dmach_t, dma_t *, int); /* optional */ - char *type; -}; - -struct dma_struct { - dmasg_t buf; /* single DMA */ - int sgcount; /* number of DMA SG */ - dmasg_t *sg; /* DMA Scatter-Gather List */ - - unsigned int active:1; /* Transfer active */ - unsigned int invalid:1; /* Address/Count changed */ - dmamode_t dma_mode; /* DMA mode */ - int speed; /* DMA speed */ - - unsigned int lock; /* Device is allocated */ - const char *device_id; /* Device name */ - - unsigned int dma_base; /* Controller base address */ - int dma_irq; /* Controller IRQ */ - int state; /* Controller state */ - dmasg_t cur_sg; /* Current controller buffer */ - - struct dma_ops *d_ops; -}; - -/* Prototype: void arch_dma_init(dma) - * Purpose : Initialise architecture specific DMA - * Params : dma - pointer to array of DMA structures - */ -void arch_dma_init(dma_t *dma); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/ecard.c linux/arch/arm/kernel/ecard.c --- v2.4.0-test8/linux/arch/arm/kernel/ecard.c Sun Sep 3 11:52:27 2000 +++ linux/arch/arm/kernel/ecard.c Mon Sep 18 15:15:24 2000 @@ -1,27 +1,30 @@ /* - * linux/arch/arm/kernel/ecard.c + * linux/arch/arm/kernel/ecard.c * - * Find all installed expansion cards, and handle interrupts from them. + * Copyright 1995-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Copyright 1995-1998 Russell King + * Find all installed expansion cards, and handle interrupts from them. * - * Created from information from Acorns RiscOS3 PRMs + * Created from information from Acorns RiscOS3 PRMs * - * 08-Dec-1996 RMK Added code for the 9'th expansion card - the ether + * 08-Dec-1996 RMK Added code for the 9'th expansion card - the ether * podule slot. - * 06-May-1997 RMK Added blacklist for cards whose loader doesn't work. - * 12-Sep-1997 RMK Created new handling of interrupt enables/disables + * 06-May-1997 RMK Added blacklist for cards whose loader doesn't work. + * 12-Sep-1997 RMK Created new handling of interrupt enables/disables * - cards can now register their own routine to control * interrupts (recommended). - * 29-Sep-1997 RMK Expansion card interrupt hardware not being re-enabled + * 29-Sep-1997 RMK Expansion card interrupt hardware not being re-enabled * on reset from Linux. (Caused cards not to respond * under RiscOS without hard reset). - * 15-Feb-1998 RMK Added DMA support - * 12-Sep-1998 RMK Added EASI support - * 10-Jan-1999 RMK Run loaders in a simulated RISC OS environment. - * 17-Apr-1999 RMK Support for EASI Type C cycles. + * 15-Feb-1998 RMK Added DMA support + * 12-Sep-1998 RMK Added EASI support + * 10-Jan-1999 RMK Run loaders in a simulated RISC OS environment. + * 17-Apr-1999 RMK Support for EASI Type C cycles. */ - #define ECARD_C #define __KERNEL_SYSCALLS__ @@ -137,15 +140,10 @@ if (req->ec == NULL) { ecard_t *ec; - for (ec = cards; ec; ec = ec->next) { - printk(KERN_DEBUG "Resetting card %d\n", - ec->slot_no); - + for (ec = cards; ec; ec = ec->next) if (ec->loader) ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader); - } - printk(KERN_DEBUG "All cards reset\n"); } else if (req->ec->loader) ecard_loader_reset(POD_INT_ADDR(req->ec->podaddr), req->ec->loader); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/entry-armo.S linux/arch/arm/kernel/entry-armo.S --- v2.4.0-test8/linux/arch/arm/kernel/entry-armo.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/entry-armo.S Mon Sep 18 15:15:24 2000 @@ -1,25 +1,29 @@ /* - * linux/arch/arm/kernel/entry-armo.S + * linux/arch/arm/kernel/entry-armo.S * - * Copyright (C) 1995,1996,1997,1998 Russell King. + * Copyright (C) 1995,1996,1997,1998 Russell King. * - * Low-level vector interface routines + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Design issues: - * - We have several modes that each vector can be called from, - * each with its own set of registers. On entry to any vector, - * we *must* save the registers used in *that* mode. + * Low-level vector interface routines * - * - This code must be as fast as possible. + * Design issues: + * - We have several modes that each vector can be called from, + * each with its own set of registers. On entry to any vector, + * we *must* save the registers used in *that* mode. * - * There are a few restrictions on the vectors: - * - the SWI vector cannot be called from *any* non-user mode + * - This code must be as fast as possible. * - * - the FP emulator is *never* called from *any* non-user mode undefined - * instruction. + * There are a few restrictions on the vectors: + * - the SWI vector cannot be called from *any* non-user mode * - * Ok, so this file may be a mess, but its as efficient as possible while - * adhering to the above criteria. + * - the FP emulator is *never* called from *any* non-user mode undefined + * instruction. + * + * Ok, so this file may be a mess, but its as efficient as possible while + * adhering to the above criteria. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/entry-armv.S linux/arch/arm/kernel/entry-armv.S --- v2.4.0-test8/linux/arch/arm/kernel/entry-armv.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/entry-armv.S Mon Sep 18 15:15:25 2000 @@ -1,13 +1,17 @@ /* - * linux/arch/arm/kernel/entry-armv.S + * linux/arch/arm/kernel/entry-armv.S * - * Copyright (C) 1996,1997,1998 Russell King. - * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) + * Copyright (C) 1996,1997,1998 Russell King. + * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) * - * Low-level vector interface routines + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes - * it to save wrong values... Be aware! + * Low-level vector interface routines + * + * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes + * it to save wrong values... Be aware! */ #include /* for CONFIG_ARCH_xxxx */ #include @@ -68,7 +72,7 @@ #ifdef IOC_BASE /* IOC / IOMD based hardware */ -#include +#include .equ ioc_base_high, IOC_BASE & 0xff000000 .equ ioc_base_low, IOC_BASE & 0x00ff0000 @@ -226,7 +230,7 @@ .endm #elif defined(CONFIG_FOOTBRIDGE) -#include +#include .macro disable_fiq .endm @@ -425,9 +429,9 @@ .endm .macro get_irqnr_and_base, irqnr, irqstat, base - mov r4, #irq_base_addr @ Virt addr IRQ regs - add r4, r4, #0x00001000 @ Status reg - ldr \irqstat, [r4] @ get interrupts + mov \irqstat, #irq_base_addr @ Virt addr IRQ regs + add \irqstat, \irqstat, #0x00001000 @ Status reg + ldr \irqstat, [\irqstat, #0] @ get interrupts mov \irqnr, #0 1001: tst \irqstat, #1 addeq \irqnr, \irqnr, #1 @@ -438,6 +442,32 @@ .endm .macro irq_prio_table + .endm + +#elif defined(CONFIG_ARCH_INTEGRATOR) + + .macro disable_fiq + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base +/* FIXME: should not be using soo many LDRs here */ + ldr \irqnr, =IO_ADDRESS(INTEGRATOR_IC_BASE) + ldr \irqstat, [\irqnr, #IRQ_STATUS] @ get masked status + ldr \irqnr, =IO_ADDRESS(INTEGRATOR_HDR_BASE) + ldr \irqnr, [\irqnr, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)] + orr \irqstat, \irqstat, \irqnr, lsl #INTEGRATOR_CM_INT0 + + mov \irqnr, #0 +1001: tst \irqstat, #1 + bne 1002f + add \irqnr, \irqnr, #1 + mov \irqstat, \irqstat, lsr #1 + cmp \irqnr, #22 + bcc 1001b +1002: /* EQ will be set if we reach 22 */ + .endm + + .macro irq_prio_table .endm #else diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/entry-common.S linux/arch/arm/kernel/entry-common.S --- v2.4.0-test8/linux/arch/arm/kernel/entry-common.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/entry-common.S Mon Sep 18 15:15:25 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/kernel/entry-common.S + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #include #define PT_TRACESYS 0x00000002 diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/ftv-pci.c linux/arch/arm/kernel/ftv-pci.c --- v2.4.0-test8/linux/arch/arm/kernel/ftv-pci.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/kernel/ftv-pci.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,51 @@ +/* + * linux/arch/arm/kernel/ftv-pci.c + * + * PCI bios-type initialisation for PCI machines + * + * Bits taken from various places. + */ +#include +#include +#include + +#include +#include + +/* + * Owing to a PCB cockup, issue A backplanes are wired thus: + * + * Slot 1 2 3 4 5 Bridge S1 S2 S3 S4 + * IRQ D C B A A C B A D + * A D C B B D C B A + * B A D C C A D C B + * C B A D D B A D C + * + * ID A31 A30 A29 A28 A27 A26 DEV4 DEV5 DEV6 DEV7 + * + * Actually, this isn't too bad, because with the processor card + * in slot 5 on the primary bus, the IRQs rotate on both sides + * as you'd expect. + */ + +static int irqmap_ftv[] __initdata = { IRQ_PCI_D, IRQ_PCI_C, IRQ_PCI_B, IRQ_PCI_A }; + +static int __init ftv_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +{ + if (slot > 0x10) + slot--; + return irqmap_ftv[(slot - pin) & 3]; +} + +static u8 __init ftv_swizzle(struct pci_dev *dev, u8 *pin) +{ + return PCI_SLOT(dev->devfn); +} + +/* ftv host-specific stuff */ +struct hw_pci ftv_pci __initdata = { + init: plx90x0_init, + swizzle: ftv_swizzle, + map_irq: ftv_map_irq, +}; + diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/head-armo.S linux/arch/arm/kernel/head-armo.S --- v2.4.0-test8/linux/arch/arm/kernel/head-armo.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/kernel/head-armo.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/kernel/head-armo.S + * linux/arch/arm/kernel/head-armo.S * - * Copyright (C) 1994-2000 Russell King + * Copyright (C) 1994-2000 Russell King * - * 26-bit kernel startup code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 26-bit kernel startup code */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/head-armv.S linux/arch/arm/kernel/head-armv.S --- v2.4.0-test8/linux/arch/arm/kernel/head-armv.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/head-armv.S Mon Sep 18 15:15:25 2000 @@ -1,26 +1,36 @@ /* - * linux/arch/arm/kernel/head-armv.S + * linux/arch/arm/kernel/head-armv.S * - * Copyright (C) 1994-1999 Russell King + * Copyright (C) 1994-1999 Russell King * - * 32-bit kernel startup code for all architectures + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 32-bit kernel startup code for all architectures */ #include #include #include -#include -#include - -#include "arch.h" +#include +#include #if (TEXTADDR & 0xffff) != 0x8000 #error TEXTADDR must start at 0xXXXX8000 #endif -#define SWAPPER_PGDIR_OFFSET 0x4000 #define K(a,b,c) ((a) << 24 | (b) << 12 | (c)) +/* + * swapper_pg_dir is the virtual address of the "init_task" page tables. + * SWAPPER_PGDIR_OFFSET is the offset from the start of memory of the + * page tables. + * + * Note that at the moment, we assume TEXTADDR is the virtual equivalent + * of start of memory + 0x8000 + */ +#define SWAPPER_PGDIR_OFFSET 0x4000 .globl SYMBOL_NAME(swapper_pg_dir) .equ SYMBOL_NAME(swapper_pg_dir), TEXTADDR - 0x8000 + SWAPPER_PGDIR_OFFSET @@ -50,7 +60,7 @@ * ideal, but in this case, it should ONLY set r0 and r1 to the * appropriate value. */ -#ifdef CONFIG_ARCH_NETWINDER +#if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_INTEGRATOR) /* * Compatability cruft for old NetWinder NeTTroms. This * code is currently scheduled for destruction in 2.5.xx @@ -85,18 +95,23 @@ mov r5, #0 movne pc, r0 - mov r1, #5 @ (will go in 2.5) - mov r12, #2 << 24 @ scheduled for removal in 2.5.xx + mov r1, #MACH_TYPE_NETWINDER @ (will go in 2.5) + mov r12, #2 << 24 @ scheduled for removal in 2.5.xx orr r12, r12, #5 << 12 +__entry: #endif -#ifdef CONFIG_ARCH_L7200 +#if defined(CONFIG_ARCH_L7200) /* * FIXME - No bootloader, so manually set 'r1' with our architecture number. */ - mov r1, #19 + mov r1, #MACH_TYPE_L7200 +#elif defined(CONFIG_ARCH_INTEGRATOR) + mov r1, #MACH_TYPE_INTEGRATOR #endif -__entry: bl __lookup_processor_type + mov r0, #F_BIT | I_BIT | MODE_SVC @ make sure svc mode + msr cpsr_c, r0 @ and all irqs diabled + bl __lookup_processor_type teq r10, #0 @ invalid processor? moveq r0, #'p' @ yes, error 'p' beq __error @@ -140,7 +155,7 @@ @ sp = stack pointer str r12, [r2] - mov fp, #0 @ Clear BSS + mov fp, #0 @ Clear BSS (and zero fp) 1: cmp r4, r5 strcc fp, [r4],#4 bcc 1b @@ -182,17 +197,19 @@ bne 1b /* * Create identity mapping for first MB of kernel. - * map in four sections (4MB) for kernel. - * these are marked cacheable and bufferable. + * This is marked cacheable and bufferable. * * The identity mapping will be removed by paging_init() */ - mov r3, #0x0c @ cacheable, bufferable - orr r3, r3, r8 @ | pagetable flags - add r3, r3, r5 @ + start of RAM + add r3, r8, r5 @ mmuflags + start of RAM add r0, r4, r5, lsr #18 str r3, [r0] @ identity mapping - add r0, r4, #(TEXTADDR - 0x8000) >> 18 @ start of kernel + /* + * Now setup the pagetables for our kernel direct + * mapped region. We round TEXTADDR down to the + * nearest megabyte boundary. + */ + add r0, r4, #(TEXTADDR & 0xfff00000) >> 18 @ start of kernel str r3, [r0], #4 @ PAGE_OFFSET + 0MB add r3, r3, #1 << 20 str r3, [r0], #4 @ PAGE_OFFSET + 1MB @@ -200,6 +217,9 @@ str r3, [r0], #4 @ PAGE_OFFSET + 2MB add r3, r3, #1 << 20 str r3, [r0], #4 @ PAGE_OFFSET + 3MB + + bic r8, r8, #0x0c @ turn off cacheable + @ and bufferable bits #ifdef CONFIG_DEBUG_LL /* * Map in IO space for serial debugging. diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/hw-footbridge.c linux/arch/arm/kernel/hw-footbridge.c --- v2.4.0-test8/linux/arch/arm/kernel/hw-footbridge.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/hw-footbridge.c Wed Dec 31 16:00:00 1969 @@ -1,692 +0,0 @@ -/* - * arch/arm/kernel/hw-footbridge.c - * - * Footbridge-dependent machine fixup - * - * Copyright (C) 1998, 1999 Russell King, Phil Blundell - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define IRDA_IO_BASE 0x180 -#define GP1_IO_BASE 0x338 -#define GP2_IO_BASE 0x33a - - -#ifdef CONFIG_LEDS -#define DEFAULT_LEDS 0 -#else -#define DEFAULT_LEDS GPIO_GREEN_LED -#endif - -/* - * Netwinder stuff - */ -#ifdef CONFIG_ARCH_NETWINDER - -/* - * Winbond WB83977F accessibility stuff - */ -static inline void wb977_open(void) -{ - outb(0x87, 0x370); - outb(0x87, 0x370); -} - -static inline void wb977_close(void) -{ - outb(0xaa, 0x370); -} - -static inline void wb977_wb(int reg, int val) -{ - outb(reg, 0x370); - outb(val, 0x371); -} - -static inline void wb977_ww(int reg, int val) -{ - outb(reg, 0x370); - outb(val >> 8, 0x371); - outb(reg + 1, 0x370); - outb(val, 0x371); -} - -#define wb977_device_select(dev) wb977_wb(0x07, dev) -#define wb977_device_disable() wb977_wb(0x30, 0x00) -#define wb977_device_enable() wb977_wb(0x30, 0x01) - -/* - * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE - */ -spinlock_t gpio_lock = SPIN_LOCK_UNLOCKED; - -static unsigned int current_gpio_op = 0; -static unsigned int current_gpio_io = 0; -static unsigned int current_cpld = 0; - -void gpio_modify_op(int mask, int set) -{ - unsigned int new_gpio, changed; - - new_gpio = (current_gpio_op & ~mask) | set; - changed = new_gpio ^ current_gpio_op; - current_gpio_op = new_gpio; - - if (changed & 0xff) - outb(new_gpio, GP1_IO_BASE); - if (changed & 0xff00) - outb(new_gpio >> 8, GP2_IO_BASE); -} - -static inline void __gpio_modify_io(int mask, int in) -{ - unsigned int new_gpio, changed; - int port; - - new_gpio = (current_gpio_io & ~mask) | in; - changed = new_gpio ^ current_gpio_io; - current_gpio_io = new_gpio; - - changed >>= 1; - new_gpio >>= 1; - - wb977_device_select(7); - - for (port = 0xe1; changed && port < 0xe8; changed >>= 1) { - wb977_wb(port, new_gpio & 1); - - port += 1; - new_gpio >>= 1; - } - - wb977_device_select(8); - - for (port = 0xe8; changed && port < 0xec; changed >>= 1) { - wb977_wb(port, new_gpio & 1); - - port += 1; - new_gpio >>= 1; - } -} - -void gpio_modify_io(int mask, int in) -{ - /* Open up the SuperIO chip */ - wb977_open(); - - __gpio_modify_io(mask, in); - - /* Close up the EFER gate */ - wb977_close(); -} - -int gpio_read(void) -{ - return inb(GP1_IO_BASE) | inb(GP2_IO_BASE) << 8; -} - -/* - * Initialise the Winbond W83977F global registers - */ -static inline void wb977_init_global(void) -{ - /* - * Enable R/W config registers - */ - wb977_wb(0x26, 0x40); - - /* - * Power down FDC (not used) - */ - wb977_wb(0x22, 0xfe); - - /* - * GP12, GP11, CIRRX, IRRXH, GP10 - */ - wb977_wb(0x2a, 0xc1); - - /* - * GP23, GP22, GP21, GP20, GP13 - */ - wb977_wb(0x2b, 0x6b); - - /* - * GP17, GP16, GP15, GP14 - */ - wb977_wb(0x2c, 0x55); -} - -/* - * Initialise the Winbond W83977F printer port - */ -static inline void wb977_init_printer(void) -{ - wb977_device_select(1); - - /* - * mode 1 == EPP - */ - wb977_wb(0xf0, 0x01); -} - -/* - * Initialise the Winbond W83977F keyboard controller - */ -static inline void wb977_init_keyboard(void) -{ - wb977_device_select(5); - - /* - * Keyboard controller address - */ - wb977_ww(0x60, 0x0060); - wb977_ww(0x62, 0x0064); - - /* - * Keyboard IRQ 1, active high, edge trigger - */ - wb977_wb(0x70, 1); - wb977_wb(0x71, 0x02); - - /* - * Mouse IRQ 5, active high, edge trigger - */ - wb977_wb(0x72, 5); - wb977_wb(0x73, 0x02); - - /* - * KBC 8MHz - */ - wb977_wb(0xf0, 0x40); - - /* - * Enable device - */ - wb977_device_enable(); -} - -/* - * Initialise the Winbond W83977F Infra-Red device - */ -static inline void wb977_init_irda(void) -{ - wb977_device_select(6); - - /* - * IR base address - */ - wb977_ww(0x60, IRDA_IO_BASE); - - /* - * IRDA IRQ 6, active high, edge trigger - */ - wb977_wb(0x70, 6); - wb977_wb(0x71, 0x02); - - /* - * RX DMA - ISA DMA 0 - */ - wb977_wb(0x74, 0x00); - - /* - * TX DMA - Disable Tx DMA - */ - wb977_wb(0x75, 0x04); - - /* - * Append CRC, Enable bank selection - */ - wb977_wb(0xf0, 0x03); - - /* - * Enable device - */ - wb977_device_enable(); -} - -/* - * Initialise Winbond W83977F general purpose IO - */ -static inline void wb977_init_gpio(void) -{ - unsigned long flags; - - /* - * Set up initial I/O definitions - */ - current_gpio_io = -1; - __gpio_modify_io(-1, GPIO_DONE | GPIO_WDTIMER); - - wb977_device_select(7); - - /* - * Group1 base address - */ - wb977_ww(0x60, GP1_IO_BASE); - wb977_ww(0x62, 0); - wb977_ww(0x64, 0); - - /* - * GP10 (Orage button) IRQ 10, active high, edge trigger - */ - wb977_wb(0x70, 10); - wb977_wb(0x71, 0x02); - - /* - * GP10: Debounce filter enabled, IRQ, input - */ - wb977_wb(0xe0, 0x19); - - /* - * Enable Group1 - */ - wb977_device_enable(); - - wb977_device_select(8); - - /* - * Group2 base address - */ - wb977_ww(0x60, GP2_IO_BASE); - - /* - * Clear watchdog timer regs - * - timer disable - */ - wb977_wb(0xf2, 0x00); - - /* - * - disable LED, no mouse nor keyboard IRQ - */ - wb977_wb(0xf3, 0x00); - - /* - * - timer counting, disable power LED, disable timeouot - */ - wb977_wb(0xf4, 0x00); - - /* - * Enable group2 - */ - wb977_device_enable(); - - /* - * Set Group1/Group2 outputs - */ - spin_lock_irqsave(&gpio_lock, flags); - gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN); - spin_unlock_irqrestore(&gpio_loc, flags); -} - -/* - * Initialise the Winbond W83977F chip. - */ -static void __init wb977_init(void) -{ - request_region(0x370, 2, "W83977AF configuration"); - - /* - * Open up the SuperIO chip - */ - wb977_open(); - - /* - * Initialise the global registers - */ - wb977_init_global(); - - /* - * Initialise the various devices in - * the multi-IO chip. - */ - wb977_init_printer(); - wb977_init_keyboard(); - wb977_init_irda(); - wb977_init_gpio(); - - /* - * Close up the EFER gate - */ - wb977_close(); -} - -void cpld_modify(int mask, int set) -{ - int msk; - - current_cpld = (current_cpld & ~mask) | set; - - gpio_modify_io(GPIO_DATA | GPIO_IOCLK | GPIO_IOLOAD, 0); - gpio_modify_op(GPIO_IOLOAD, 0); - - for (msk = 8; msk; msk >>= 1) { - int bit = current_cpld & msk; - - gpio_modify_op(GPIO_DATA | GPIO_IOCLK, bit ? GPIO_DATA : 0); - gpio_modify_op(GPIO_IOCLK, GPIO_IOCLK); - } - - gpio_modify_op(GPIO_IOCLK|GPIO_DATA, 0); - gpio_modify_op(GPIO_IOLOAD|GPIO_DSCLK, GPIO_IOLOAD|GPIO_DSCLK); - gpio_modify_op(GPIO_IOLOAD, 0); -} - -static void __init cpld_init(void) -{ - unsigned long flags; - - spin_lock_irqsave(&gpio_lock, flags); - cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE); - spin_unlock_irqrestore(&gpio_lock, flags); -} - -static unsigned char rwa_unlock[] __initdata = -{ 0x00, 0x00, 0x6a, 0xb5, 0xda, 0xed, 0xf6, 0xfb, 0x7d, 0xbe, 0xdf, 0x6f, 0x37, 0x1b, - 0x0d, 0x86, 0xc3, 0x61, 0xb0, 0x58, 0x2c, 0x16, 0x8b, 0x45, 0xa2, 0xd1, 0xe8, 0x74, - 0x3a, 0x9d, 0xce, 0xe7, 0x73, 0x39 }; - -#ifndef DEBUG -#define dprintk(x...) -#else -#define dprintk(x...) printk(x) -#endif - -#define WRITE_RWA(r,v) do { outb((r), 0x279); udelay(10); outb((v), 0xa79); } while (0) - -static inline void rwa010_unlock(void) -{ - int i; - - WRITE_RWA(2, 2); - mdelay(10); - - for (i = 0; i < sizeof(rwa_unlock); i++) { - outb(rwa_unlock[i], 0x279); - udelay(10); - } -} - -static inline void rwa010_read_ident(void) -{ - unsigned char si[9]; - int i, j; - - WRITE_RWA(3, 0); - WRITE_RWA(0, 128); - - outb(1, 0x279); - - mdelay(1); - - dprintk("Identifier: "); - for (i = 0; i < 9; i++) { - si[i] = 0; - for (j = 0; j < 8; j++) { - int bit; - udelay(250); - inb(0x203); - udelay(250); - bit = inb(0x203); - dprintk("%02X ", bit); - bit = (bit == 0xaa) ? 1 : 0; - si[i] |= bit << j; - } - dprintk("(%02X) ", si[i]); - } - dprintk("\n"); -} - -static inline void rwa010_global_init(void) -{ - WRITE_RWA(6, 2); // Assign a card no = 2 - - dprintk("Card no = %d\n", inb(0x203)); - - /* disable the modem section of the chip */ - WRITE_RWA(7, 3); - WRITE_RWA(0x30, 0); - - /* disable the cdrom section of the chip */ - WRITE_RWA(7, 4); - WRITE_RWA(0x30, 0); - - /* disable the MPU-401 section of the chip */ - WRITE_RWA(7, 2); - WRITE_RWA(0x30, 0); -} - -static inline void rwa010_game_port_init(void) -{ - int i; - - WRITE_RWA(7, 5); - - dprintk("Slider base: "); - WRITE_RWA(0x61, 1); - i = inb(0x203); - - WRITE_RWA(0x60, 2); - dprintk("%02X%02X (201)\n", inb(0x203), i); - - WRITE_RWA(0x30, 1); -} - -static inline void rwa010_waveartist_init(int base, int irq, int dma) -{ - int i; - - WRITE_RWA(7, 0); - - dprintk("WaveArtist base: "); - WRITE_RWA(0x61, base); - i = inb(0x203); - - WRITE_RWA(0x60, base >> 8); - dprintk("%02X%02X (%X),", inb(0x203), i, base); - - WRITE_RWA(0x70, irq); - dprintk(" irq: %d (%d),", inb(0x203), irq); - - WRITE_RWA(0x74, dma); - dprintk(" dma: %d (%d)\n", inb(0x203), dma); - - WRITE_RWA(0x30, 1); -} - -static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, int dma) -{ - int i; - - WRITE_RWA(7, 1); - - dprintk("SoundBlaster base: "); - WRITE_RWA(0x61, sb_base); - i = inb(0x203); - - WRITE_RWA(0x60, sb_base >> 8); - dprintk("%02X%02X (%X),", inb(0x203), i, sb_base); - - dprintk(" irq: "); - WRITE_RWA(0x70, irq); - dprintk("%d (%d),", inb(0x203), irq); - - dprintk(" 8-bit DMA: "); - WRITE_RWA(0x74, dma); - dprintk("%d (%d)\n", inb(0x203), dma); - - dprintk("AdLib base: "); - WRITE_RWA(0x63, al_base); - i = inb(0x203); - - WRITE_RWA(0x62, al_base >> 8); - dprintk("%02X%02X (%X)\n", inb(0x203), i, al_base); - - WRITE_RWA(0x30, 1); -} - -static void rwa010_soundblaster_reset(void) -{ - int i; - - outb(1, 0x226); - udelay(3); - outb(0, 0x226); - - for (i = 0; i < 5; i++) { - if (inb(0x22e) & 0x80) - break; - mdelay(1); - } - if (i == 5) - printk("SoundBlaster: DSP reset failed\n"); - - dprintk("SoundBlaster DSP reset: %02X (AA)\n", inb(0x22a)); - - for (i = 0; i < 5; i++) { - if ((inb(0x22c) & 0x80) == 0) - break; - mdelay(1); - } - - if (i == 5) - printk("SoundBlaster: DSP not ready\n"); - else { - outb(0xe1, 0x22c); - - dprintk("SoundBlaster DSP id: "); - i = inb(0x22a); - udelay(1); - i |= inb(0x22a) << 8; - dprintk("%04X\n", i); - - for (i = 0; i < 5; i++) { - if ((inb(0x22c) & 0x80) == 0) - break; - mdelay(1); - } - - if (i == 5) - printk("SoundBlaster: could not turn speaker off\n"); - - outb(0xd3, 0x22c); - } - - /* turn on OPL3 */ - outb(5, 0x38a); - outb(1, 0x38b); -} - -static void __init rwa010_init(void) -{ - rwa010_unlock(); - rwa010_read_ident(); - rwa010_global_init(); - rwa010_game_port_init(); - rwa010_waveartist_init(0x250, 3, 7); - rwa010_soundblaster_init(0x220, 0x388, 3, 1); - rwa010_soundblaster_reset(); -} - -EXPORT_SYMBOL(gpio_lock); -EXPORT_SYMBOL(gpio_modify_op); -EXPORT_SYMBOL(gpio_modify_io); -EXPORT_SYMBOL(cpld_modify); - -/* - * Initialise any other hardware after we've got the PCI bus - * initialised. We may need the PCI bus to talk to this other - * hardware. - */ -static int __init nw_hw_init(void) -{ - /* - * this ought to have a better home... - * Since this calls the above routines, which are - * compiled only if CONFIG_ARCH_NETWINDER is set, - * these should only be parsed by the compiler - * in the same circumstance. - */ - if (machine_is_netwinder()) { - unsigned long flags; - - wb977_init(); - cpld_init(); - rwa010_init(); - - spin_lock_irqsave(&gpio_lock, flags); - gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS); - spin_unlock_irqrestore(&gpio_lock, flags); - } - return 0; -} - -__initcall(nw_hw_init); -#endif - -/* - * CATS stuff - */ -#ifdef CONFIG_ARCH_CATS - -#define CONFIG_PORT 0x370 -#define INDEX_PORT (CONFIG_PORT) -#define DATA_PORT (CONFIG_PORT + 1) - -static int __init cats_hw_init(void) -{ - if (machine_is_cats()) { - /* Set Aladdin to CONFIGURE mode */ - outb(0x51, CONFIG_PORT); - outb(0x23, CONFIG_PORT); - - /* Select logical device 3 */ - outb(0x07, INDEX_PORT); - outb(0x03, DATA_PORT); - - /* Set parallel port to DMA channel 3, ECP+EPP1.9, - enable EPP timeout */ - outb(0x74, INDEX_PORT); - outb(0x03, DATA_PORT); - - outb(0xf0, INDEX_PORT); - outb(0x0f, DATA_PORT); - - outb(0xf1, INDEX_PORT); - outb(0x07, DATA_PORT); - - /* Select logical device 4 */ - outb(0x07, INDEX_PORT); - outb(0x04, DATA_PORT); - - /* UART1 high speed mode */ - outb(0xf0, INDEX_PORT); - outb(0x02, DATA_PORT); - - /* Select logical device 5 */ - outb(0x07, INDEX_PORT); - outb(0x05, DATA_PORT); - - /* UART2 high speed mode */ - outb(0xf0, INDEX_PORT); - outb(0x02, DATA_PORT); - - /* Set Aladdin to RUN mode */ - outb(0xbb, CONFIG_PORT); - } - - return 0; -} - -__initcall(cats_hw_init); -#endif - diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/hw-sa1100.c linux/arch/arm/kernel/hw-sa1100.c --- v2.4.0-test8/linux/arch/arm/kernel/hw-sa1100.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/hw-sa1100.c Wed Dec 31 16:00:00 1969 @@ -1,184 +0,0 @@ -/* - * arch/arm/kernel/hw-sa1100.c - * - * SA1100-dependent machine specifics - * - * Copyright (C) 2000 Nicolas Pitre - * - * This will certainly contain more stuff with time... like power management, - * special hardware autodetection, etc. - * - */ -#include -#include -#include -#include -#include - -#include -#include -#include - -/* - * SA1100 GPIO edge detection for IRQs: - * IRQs are generated on Falling-Edge, Rising-Edge, or both. - * This must be called *before* the appropriate IRQ is registered. - * Use this instead of directly setting GRER/GFER. - */ - -int GPIO_IRQ_rising_edge; -int GPIO_IRQ_falling_edge; - -void set_GPIO_IRQ_edge( int gpio_mask, int edge ) -{ - if( edge & GPIO_FALLING_EDGE ) - GPIO_IRQ_falling_edge |= gpio_mask; - else - GPIO_IRQ_falling_edge &= ~gpio_mask; - if( edge & GPIO_RISING_EDGE ) - GPIO_IRQ_rising_edge |= gpio_mask; - else - GPIO_IRQ_rising_edge &= ~gpio_mask; -} - -EXPORT_SYMBOL(set_GPIO_IRQ_edge); - - -#ifdef CONFIG_SA1100_ASSABET - -unsigned long BCR_value = BCR_DB1110; -unsigned long SCR_value = SCR_INIT; -EXPORT_SYMBOL(BCR_value); -EXPORT_SYMBOL(SCR_value); - -/* - * Read System Configuration "Register" - * (taken from "Intel StrongARM SA-1110 Microprocessor Development Board - * User's Guide", section 4.4.1) - * - * This same scan is performed in arch/arm/boot/compressed/head-sa1100.S - * to set up the serial port for decompression status messages. We - * repeat it here because the kernel may not be loaded as a zImage, and - * also because it's a hassle to communicate the SCR value to the kernel - * from the decompressor. - */ - -void __init get_assabet_scr(void) -{ - unsigned long flags, scr, i; - - save_flags_cli(flags); - GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */ - GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */ - GPDR &= ~(0x3fc); /* Configure GPIO 9:2 as inputs */ - for(i = 100; i--; scr = GPLR); /* Read GPIO 9:2 */ - GPDR |= 0x3fc; /* restore correct pin direction */ - restore_flags(flags); - scr &= 0x3fc; /* save as system configuration byte. */ - - SCR_value = scr; -} - -#endif /* CONFIG_SA1100_ASSABET */ - -/* - * Bitsy has extended, write-only memory-mapped GPIO's - */ -#if defined(CONFIG_SA1100_BITSY) -static int bitsy_egpio = EGPIO_BITSY_RS232_ON; -void clr_bitsy_egpio(unsigned long x) -{ - bitsy_egpio &= ~x; - *(volatile int *)0xdc000000 = bitsy_egpio; -} -void set_bitsy_egpio(unsigned long x) -{ - bitsy_egpio |= x; - *(volatile int *)0xdc000000 = bitsy_egpio; -} -EXPORT_SYMBOL(clr_bitsy_egpio); -EXPORT_SYMBOL(set_bitsy_egpio); -#endif - -#ifdef CONFIG_SA1111 - -void __init sa1111_init(void){ - unsigned long id=SKID; - - if((id & SKID_ID_MASK) == SKID_SA1111_ID) - printk(KERN_INFO "SA-1111 Microprocessor Companion Chip: " - "silicon revision %x, metal revision %x\n", - (id & SKID_SIREV_MASK)>>4, (id & SKID_MTREV_MASK)); - else { - printk(KERN_ERR "Could not detect SA-1111!\n"); - return; - } - - /* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: - * (SA-1110 Developer's Manual, section 9.1.2.1) - */ - GAFR |= GPIO_GPIO27; - GPDR |= GPIO_GPIO27; - TUCR = TUCR_3_6864MHz; - - /* Now, set up the PLL and RCLK in the SA-1111: */ - SKCR = SKCR_PLL_BYPASS | SKCR_RDYEN | SKCR_OE_EN; - udelay(100); - SKCR = SKCR_PLL_BYPASS | SKCR_RCLKEN | SKCR_RDYEN | SKCR_OE_EN; - - /* SA-1111 Register Access Bus should now be available. Clocks for - * any other SA-1111 functional blocks must be enabled separately - * using the SKPCR. - */ - - { - /* - * SA1111 DMA bus master setup - */ - int cas; - - /* SA1111 side */ - switch ( (MDCNFG>>12) & 0x03 ) { - case 0x02: - cas = 0; break; - case 0x03: - cas = 1; break; - default: - cas = 1; break; - } - SMCR = 1 /* 1: memory is SDRAM */ - | ( 1 << 1 ) /* 1:MBGNT is enable */ - | ( ((MDCNFG >> 4) & 0x07) << 2 ) /* row address lines */ - | ( cas << 5 ); /* CAS latency */ - - /* SA1110 side */ - GPDR |= 1<<21; - GPDR &= ~(1<<22); - GAFR |= ( (1<<21) | (1<<22) ); - - TUCR |= (1<<10); - } -} - -#endif - - -static int __init hw_sa1100_init(void) -{ - if( machine_is_assabet() ){ - if(machine_has_neponset()){ -#ifdef CONFIG_ASSABET_NEPONSET - LEDS = WHOAMI; - sa1111_init(); -#else - printk( "Warning: Neponset detected but full support " - "hasn't been configured in the kernel\n" ); -#endif - } - } else if (machine_is_xp860()) { - sa1111_init(); - } - return 0; -} - -module_init(hw_sa1100_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/init_task.c linux/arch/arm/kernel/init_task.c --- v2.4.0-test8/linux/arch/arm/kernel/init_task.c Wed Oct 20 16:29:08 1999 +++ linux/arch/arm/kernel/init_task.c Mon Sep 18 15:15:25 2000 @@ -1,6 +1,10 @@ +/* + * linux/arch/arm/kernel/init_task.c + */ #include #include #include +#include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/irq.c linux/arch/arm/kernel/irq.c --- v2.4.0-test8/linux/arch/arm/kernel/irq.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/irq.c Mon Sep 18 15:15:25 2000 @@ -4,16 +4,18 @@ * Copyright (C) 1992 Linus Torvalds * Modifications for ARM processor Copyright (C) 1995-1998 Russell King. * - * This file contains the code used by various IRQ handling routines: - * asking for different IRQ's should be done through these routines - * instead of just grabbing them. Thus setups with different IRQ numbers - * shouldn't result in any weird surprises, and installing new handlers - * should be easier. - */ - -/* - * IRQ's are in fact implemented a bit like signal handlers for the kernel. - * Naturally it's not a 1:1 relation, but there are similarities. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains the code used by various IRQ handling routines: + * asking for different IRQ's should be done through these routines + * instead of just grabbing them. Thus setups with different IRQ numbers + * shouldn't result in any weird surprises, and installing new handlers + * should be easier. + * + * IRQ's are in fact implemented a bit like signal handlers for the kernel. + * Naturally it's not a 1:1 relation, but there are similarities. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/isa.c linux/arch/arm/kernel/isa.c --- v2.4.0-test8/linux/arch/arm/kernel/isa.c Mon Jun 26 12:04:01 2000 +++ linux/arch/arm/kernel/isa.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,16 @@ /* - * arch/arm/kernel/isa.c + * linux/arch/arm/kernel/isa.c * - * ISA shared memory and I/O port support + * Copyright (C) 1999 Phil Blundell * - * Copyright (C) 1999 Phil Blundell + * ISA shared memory and I/O port support + */ + +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/leds-ebsa110.c linux/arch/arm/kernel/leds-ebsa110.c --- v2.4.0-test8/linux/arch/arm/kernel/leds-ebsa110.c Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/kernel/leds-ebsa110.c Mon Sep 18 15:15:25 2000 @@ -1,23 +1,32 @@ /* - * arch/arm/kernel/leds-ebsa110.c + * linux/arch/arm/kernel/leds-ebsa110.c * - * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Russell King * - * EBSA-110 LED control routines. We use the led as follows: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * - Red - toggles state every 50 timer interrupts + * EBSA-110 LED control routines. We use the led as follows: + * + * - Red - toggles state every 50 timer interrupts */ #include +#include +#include #include #include #include +#include + +static spinlock_t leds_lock; static void ebsa110_leds_event(led_event_t ledevt) { unsigned long flags; - save_flags_cli(flags); + spin_lock_irqsave(&leds_lock, flags); switch(ledevt) { case led_timer: @@ -28,9 +37,15 @@ break; } - restore_flags(flags); + spin_unlock_irqrestore(&leds_lock, flags); } -void (*leds_event)(led_event_t) = ebsa110_leds_event; +static int __init leds_init(void) +{ + if (machine_is_ebsa110()) + leds_event = ebsa110_leds_event; + + return 0; +} -EXPORT_SYMBOL(leds_event); +__initcall(leds_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/leds-footbridge.c linux/arch/arm/kernel/leds-footbridge.c --- v2.4.0-test8/linux/arch/arm/kernel/leds-footbridge.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/leds-footbridge.c Wed Dec 31 16:00:00 1969 @@ -1,257 +0,0 @@ -/* - * arch/arm/kernel/leds-footbridge.c - * - * Copyright (C) 1998-1999 Russell King - * - * EBSA-285 and NetWinder LED control routines. - * - * The EBSA-285 uses the leds as follows: - * - Green - toggles state every 50 timer interrupts - * - Amber - On if system is not idle - * - Red - currently unused - * - * The Netwinder uses the leds as follows: - * - Green - toggles state every 50 timer interrupts - * - Red - On if the system is not idle - * - * Changelog: - * 02-05-1999 RMK Various cleanups - */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define LED_STATE_ENABLED 1 -#define LED_STATE_CLAIMED 2 -static char led_state; -static char hw_led_state; - -static spinlock_t leds_lock = SPIN_LOCK_UNLOCKED; -extern spinlock_t gpio_lock; - -#if defined(CONFIG_ARCH_EBSA285) || defined(CONFIG_ARCH_CO285) - -static void ebsa285_leds_event(led_event_t evt) -{ - unsigned long flags; - - spin_lock_irqsave(&leds_lock, flags); - - switch (evt) { - case led_start: - hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN; -#ifndef CONFIG_LEDS_CPU - hw_led_state |= XBUS_LED_AMBER; -#endif - led_state |= LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= XBUS_LED_GREEN; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= XBUS_LED_AMBER; - break; - - case led_idle_end: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~XBUS_LED_AMBER; - break; -#endif - - case led_halted: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~XBUS_LED_RED; - break; - - case led_green_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~XBUS_LED_GREEN; - break; - - case led_green_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= XBUS_LED_GREEN; - break; - - case led_amber_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~XBUS_LED_AMBER; - break; - - case led_amber_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= XBUS_LED_AMBER; - break; - - case led_red_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~XBUS_LED_RED; - break; - - case led_red_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= XBUS_LED_RED; - break; - - default: - break; - } - - if (led_state & LED_STATE_ENABLED) - *XBUS_LEDS = hw_led_state; - - spin_unlock_irqrestore(&leds_lock, flags); -} - -#endif - -#ifdef CONFIG_ARCH_NETWINDER - -static void netwinder_leds_event(led_event_t evt) -{ - unsigned long flags; - - spin_lock_irqsave(&leds_lock, flags); - - switch (evt) { - case led_start: - led_state |= LED_STATE_ENABLED; - hw_led_state = GPIO_GREEN_LED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = 0; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = 0; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= GPIO_GREEN_LED; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~GPIO_RED_LED; - break; - - case led_idle_end: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= GPIO_RED_LED; - break; -#endif - - case led_halted: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= GPIO_RED_LED; - break; - - case led_green_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= GPIO_GREEN_LED; - break; - - case led_green_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~GPIO_GREEN_LED; - break; - - case led_amber_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= GPIO_GREEN_LED | GPIO_RED_LED; - break; - - case led_amber_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~(GPIO_GREEN_LED | GPIO_RED_LED); - break; - - case led_red_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= GPIO_RED_LED; - break; - - case led_red_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~GPIO_RED_LED; - break; - - default: - break; - } - - spin_unlock_irqrestore(&leds_lock, flags); - - if (led_state & LED_STATE_ENABLED) { - spin_lock_irqsave(&gpio_lock, flags); - gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state); - spin_unlock_irqrestore(&gpio_lock, flags); - } -} - -#endif - -static void dummy_leds_event(led_event_t evt) -{ -} - -void (*leds_event)(led_event_t) = dummy_leds_event; - -EXPORT_SYMBOL(leds_event); - -static int __init leds_init(void) -{ -#if defined(CONFIG_ARCH_EBSA285) || defined(CONFIG_ARCH_CO285) - if (machine_is_ebsa285() || machine_is_co285()) - leds_event = ebsa285_leds_event; -#endif -#ifdef CONFIG_ARCH_NETWINDER - if (machine_is_netwinder()) - leds_event = netwinder_leds_event; -#endif - - leds_event(led_start); - - return 0; -} - -__initcall(leds_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/leds-ftvpci.c linux/arch/arm/kernel/leds-ftvpci.c --- v2.4.0-test8/linux/arch/arm/kernel/leds-ftvpci.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/kernel/leds-ftvpci.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,31 @@ +/* + * linux/arch/arm/kernel/leds-ftvpci.c + * + * Copyright (C) 1999 FutureTV Labs Ltd + */ + +#include + +#include +#include +#include +#include + +static void ftvpci_leds_event(led_event_t ledevt) +{ + static int led_state = 0; + + switch(ledevt) { + case led_timer: + led_state ^= 1; + raw_writeb(0x1a | led_state, INTCONT_BASE); + break; + + default: + break; + } +} + +void (*leds_event)(led_event_t) = ftvpci_leds_event; + +EXPORT_SYMBOL(leds_event); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/leds-sa1100.c linux/arch/arm/kernel/leds-sa1100.c --- v2.4.0-test8/linux/arch/arm/kernel/leds-sa1100.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/leds-sa1100.c Wed Dec 31 16:00:00 1969 @@ -1,437 +0,0 @@ -/* - * linux/arch/arm/kernel/leds-sa1100.c - * - * Copyright (C) 2000 John Dorsey - * - * Original (leds-footbridge.c) by Russell King - * - * Added Brutus LEDs support - * Nicolas Pitre, Mar 19, 2000 - * - * Added LART LED support - * Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000 - * - * - * Assabet uses the LEDs as follows: - * - Green - toggles state every 50 timer interrupts - * - Red - on if system is not idle - * - * Brutus uses the LEDs as follows: - * - D3 (Green, GPIO9) - toggles state every 50 timer interrupts - * - D17 (Red, GPIO20) - on if system is not idle - * - D4 (Green, GPIO8) - misc function - * - * LART uses the LED as follows: - * - GPIO23 is the LED, on if system is not idle - * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same - * time, but in that case the timer events will still dictate the - * pace of the LED. - * - */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -#define LED_STATE_ENABLED 1 -#define LED_STATE_CLAIMED 2 - -static unsigned int led_state; -static unsigned int hw_led_state; - - -#ifdef CONFIG_SA1100_ASSABET - -#define BCR_LED_MASK (BCR_LED_GREEN | BCR_LED_RED) - -static void assabet_leds_event(led_event_t evt) -{ - unsigned long flags; - - save_flags_cli(flags); - - switch (evt) { - case led_start: - hw_led_state = BCR_LED_RED | BCR_LED_GREEN; - led_state = LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = BCR_LED_RED | BCR_LED_GREEN; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = BCR_LED_RED | BCR_LED_GREEN; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= BCR_LED_GREEN; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= BCR_LED_RED; - break; - - case led_idle_end: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~BCR_LED_RED; - break; -#endif - - case led_halted: - break; - - case led_green_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~BCR_LED_GREEN; - break; - - case led_green_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= BCR_LED_GREEN; - break; - - case led_amber_on: - break; - - case led_amber_off: - break; - - case led_red_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~BCR_LED_RED; - break; - - case led_red_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= BCR_LED_RED; - break; - - default: - break; - } - - if (led_state & LED_STATE_ENABLED) - BCR = BCR_value = (BCR_value & ~BCR_LED_MASK) | hw_led_state; - - restore_flags(flags); -} - -#endif /* CONFIG_SA1100_ASSABET */ - -#ifdef CONFIG_SA1100_BRUTUS - -#define LED_D3 GPIO_GPIO(9) -#define LED_D4 GPIO_GPIO(8) -#define LED_D17 GPIO_GPIO(20) -#define LED_MASK (LED_D3|LED_D4|LED_D17) - -static void brutus_leds_event(led_event_t evt) -{ - unsigned long flags; - - save_flags_cli(flags); - - switch (evt) { - case led_start: - hw_led_state = LED_MASK; - led_state = LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= LED_D3; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_D17; - break; - - case led_idle_end: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_D17; - break; -#endif - - case led_green_on: - hw_led_state &= ~LED_D4; - break; - - case led_green_off: - hw_led_state |= LED_D4; - break; - - case led_amber_on: - break; - - case led_amber_off: - break; - - case led_red_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~LED_D17; - break; - - case led_red_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= LED_D17; - break; - - default: - break; - } - - if (led_state & LED_STATE_ENABLED) { - GPSR = hw_led_state; - GPCR = hw_led_state ^ LED_MASK; - } - - restore_flags(flags); -} - -#endif /* CONFIG_SA1100_BRUTUS */ - -#ifdef CONFIG_SA1100_LART - -#define LED_23 GPIO_GPIO23 -#define LED_MASK (LED_23) - - -static void lart_leds_event(led_event_t evt) -{ - unsigned long flags; - - save_flags_cli(flags); - - switch(evt) { - case led_start: - hw_led_state = LED_MASK; - led_state = LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= LED_23; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - /* The LART people like the LED to be off when the - system is idle... */ - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_23; - break; - - case led_idle_end: - /* ... and on if the system is not idle */ - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_23; - break; -#endif - - case led_red_on: - if (led_state & LED_STATE_CLAIMED) - hw_led_state &= ~LED_23; - break; - - case led_red_off: - if (led_state & LED_STATE_CLAIMED) - hw_led_state |= LED_23; - break; - - default: - break; - } - - /* Now set the GPIO state, or nothing will happen at all */ - if (led_state & LED_STATE_ENABLED) { - GPSR = hw_led_state; - GPCR = hw_led_state ^ LED_MASK; - } - - restore_flags(flags); -} - -#endif /* CONFIG_SA1100_LART */ - -#ifdef CONFIG_SA1100_CERF -#define LED_D0 GPIO_GPIO(0) -#define LED_D1 GPIO_GPIO(1) -#define LED_D2 GPIO_GPIO(2) -#define LED_D3 GPIO_GPIO(3) -#define LED_MASK (LED_D0|LED_D1|LED_D2|LED_D3) - -static void cerf_leds_event(led_event_t evt) -{ - unsigned long flags; - - save_flags_cli(flags); - - switch (evt) { - case led_start: - hw_led_state = LED_MASK; - led_state = LED_STATE_ENABLED; - break; - - case led_stop: - led_state &= ~LED_STATE_ENABLED; - break; - - case led_claim: - led_state |= LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - case led_release: - led_state &= ~LED_STATE_CLAIMED; - hw_led_state = LED_MASK; - break; - -#ifdef CONFIG_LEDS_TIMER - case led_timer: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state ^= LED_D0; - break; -#endif - -#ifdef CONFIG_LEDS_CPU - case led_idle_start: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_D1; - break; - - case led_idle_end: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_D1; - break; -#endif - case led_green_on: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_D2; - break; - - case led_green_off: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_D2; - break; - - case led_amber_on: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_D3; - break; - - case led_amber_off: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_D3; - break; - - case led_red_on: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state &= ~LED_D1; - break; - - case led_red_off: - if (!(led_state & LED_STATE_CLAIMED)) - hw_led_state |= LED_D1; - break; - - default: - break; - } - - if (led_state & LED_STATE_ENABLED) { - GPSR = hw_led_state; - GPCR = hw_led_state ^ LED_MASK; - } - - restore_flags(flags); -} - -#endif /* CONFIG_SA1100_CERF */ - -static void dummy_leds_event(led_event_t evt) -{ -} - -void (*leds_event)(led_event_t) = dummy_leds_event; - -EXPORT_SYMBOL(leds_event); - -static int __init -sa1100_leds_init(void) -{ -#ifdef CONFIG_SA1100_ASSABET - if (machine_is_assabet()) - leds_event = assabet_leds_event; -#endif -#ifdef CONFIG_SA1100_BRUTUS - if (machine_is_brutus()) - leds_event = brutus_leds_event; -#endif -#ifdef CONFIG_SA1100_LART - if (machine_is_lart()) - leds_event = lart_leds_event; -#endif -#ifdef CONFIG_SA1100_CERF - if (machine_is_cerf()) - { - //GPDR |= 0x0000000F; - leds_event = cerf_leds_event; - } -#endif - leds_event(led_start); - return 0; -} - -__initcall(sa1100_leds_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/oldlatches.c linux/arch/arm/kernel/oldlatches.c --- v2.4.0-test8/linux/arch/arm/kernel/oldlatches.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/oldlatches.c Mon Sep 18 15:15:25 2000 @@ -1,7 +1,14 @@ -/* Support for the latches on the old Archimedes which control the floppy, - * hard disc and printer +/* + * linux/arch/arm/kernel/oldlatches.c * - * (c) David Alan Gilbert 1995/1996,2000 + * Copyright (C) David Alan Gilbert 1995/1996,2000 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Support for the latches on the old Archimedes which control the floppy, + * hard disc and printer */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/plx90x0.c linux/arch/arm/kernel/plx90x0.c --- v2.4.0-test8/linux/arch/arm/kernel/plx90x0.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/kernel/plx90x0.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,198 @@ +/* + * Driver for PLX Technology PCI9000-series host bridge. + * + * Copyright (C) 1997, 1998, 1999, 2000 FutureTV Labs Ltd + */ + +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* + * Since the following functions are all very similar, the common parts + * are pulled out into these macros. + */ + +#define PLX_CLEAR_CONFIG \ + __raw_writel(0, PLX_BASE + 0xac); \ + local_irq_restore(flags); } + +#define PLX_SET_CONFIG \ + { unsigned long flags; \ + local_irq_save(flags); \ + __raw_writel((1<<31 | (dev->bus->number << 16) \ + | (dev->devfn << 8) | (where & ~3) \ + | ((dev->bus->number == 0)?0:1)), PLX_BASE + 0xac); \ + +#define PLX_CONFIG_WRITE(size) \ + PLX_SET_CONFIG \ + __raw_write##size(value, PCIO_BASE + (where & 3)); \ + if (__raw_readw(PLX_BASE + 0x6) & 0x2000) \ + __raw_writew(0x2000, PLX_BASE + 0x6); \ + PLX_CLEAR_CONFIG \ + return PCIBIOS_SUCCESSFUL; + +#define PLX_CONFIG_READ(size) \ + PLX_SET_CONFIG \ + *value = __raw_read##size(PCIO_BASE + (where & 3)); \ + if (__raw_readw(PLX_BASE + 0x6) & 0x2000) { \ + __raw_writew(0x2000, PLX_BASE + 0x6); \ + *value = 0xffffffffUL; \ + } \ + PLX_CLEAR_CONFIG \ + return PCIBIOS_SUCCESSFUL; + +/* Configuration space access routines */ + +static int +plx90x0_read_config_byte (struct pci_dev *dev, + int where, u8 *value) +{ + PLX_CONFIG_READ(b) +} + +static int +plx90x0_read_config_word (struct pci_dev *dev, + int where, u16 *value) +{ + PLX_CONFIG_READ(w) +} + +static int +plx90x0_read_config_dword (struct pci_dev *dev, + int where, u32 *value) +{ + PLX_CONFIG_READ(l) +} + +static int +plx90x0_write_config_byte (struct pci_dev *dev, + int where, u8 value) +{ + PLX_CONFIG_WRITE(b) +} + +static int +plx90x0_write_config_word (struct pci_dev *dev, + int where, u16 value) +{ + PLX_CONFIG_WRITE(w) +} + +static int +plx90x0_write_config_dword (struct pci_dev *dev, + int where, u32 value) +{ + PLX_CONFIG_WRITE(l) +} + +static void +plx_syserr_handler(int irq, void *handle, struct pt_regs *regs) +{ + printk("PLX90x0: machine check %04x (pc=%08lx)\n", + readw(PLX_BASE + 6), regs->ARM_pc); + __raw_writew(0xf000, PLX_BASE + 6); +} + +static struct pci_ops +plx90x0_ops = +{ + plx90x0_read_config_byte, + plx90x0_read_config_word, + plx90x0_read_config_dword, + plx90x0_write_config_byte, + plx90x0_write_config_word, + plx90x0_write_config_dword, +}; + +/* + * Initialise the PCI system. + */ + +void __init +plx90x0_init(struct arm_sysdata *sysdata) +{ + static const unsigned long int base = PLX_BASE; + char *what; + unsigned long bar = (unsigned long)virt_to_bus((void *)PAGE_OFFSET); + unsigned int pci_cmd = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | + PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; + + /* Have a sniff around and see which PLX device is present. */ + unsigned long id = __raw_readl(base + 0xf0); + +#if 0 + /* This check was a good idea, but can fail. The PLX9060 puts no + default value in these registers unless NB# is asserted (which it + isn't on these cards). */ + if ((id & 0xffff) != PCI_VENDOR_ID_PLX) + return; /* Nothing found */ +#endif + + /* Found one - now work out what it is. */ + switch (id >> 16) { + case 0: /* PCI_DEVICE_ID_PLX_9060 */ + what = "PCI9060"; + break; + case PCI_DEVICE_ID_PLX_9060ES: + what = "PCI9060ES"; + break; + case PCI_DEVICE_ID_PLX_9060SD: + what = "PCI9060SD"; /* uhuhh.. */ + break; + case PCI_DEVICE_ID_PLX_9080: + what = "PCI9080"; + break; + default: + printk("PCI: Unknown PLX device %04lx found -- ignored.\n", + id >> 16); + return; + } + + printk("PCI: PLX Technology %s host bridge found.\n", what); + + /* Now set it up for both master and slave accesses. */ + __raw_writel(0xffff0147, base + 0x4); + __raw_writeb(32, base + 0xd); + __raw_writel(0x8 | bar, base + 0x18); + __raw_writel(0xf8000008, base + 0x80); + __raw_writel(0x40000001, base + 0x84); + __raw_writel(0, base + 0x88); + __raw_writel(0, base + 0x8c); + __raw_writel(0x11, base + 0x94); + __raw_writel(0xC3 + (4 << 28) + + (8 << 11) + (1 << 10) + + (1 << 24), base + 0x98); + __raw_writel(0xC0000000, base + 0x9c); + __raw_writel(PLX_MEM_START, base + 0xa0); + __raw_writel(PLX_IO_START, base + 0xa4); + __raw_writel(0x3, base + 0xa8); + __raw_writel(0, base + 0xac); + __raw_writel(0x10001, base + 0xe8); + __raw_writel(0x8000767e, base + 0xec); + + request_irq(IRQ_SYSERR, plx_syserr_handler, 0, + "system error", NULL); + + pci_scan_bus(0, &plx90x0_ops, sysdata); + + pci_cmd |= sysdata->bus[0].features; + + printk("PCI: Fast back to back transfers %sabled\n", + (sysdata->bus[0].features & PCI_COMMAND_FAST_BACK) ? + "en" : "dis"); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/process.c linux/arch/arm/kernel/process.c --- v2.4.0-test8/linux/arch/arm/kernel/process.c Tue Sep 5 13:50:01 2000 +++ linux/arch/arm/kernel/process.c Mon Sep 18 15:15:25 2000 @@ -3,8 +3,11 @@ * * Copyright (C) 1996-2000 Russell King - Converted to ARM. * Origional Copyright (C) 1995 Linus Torvalds + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include @@ -173,10 +176,11 @@ flags & CC_Z_BIT ? 'Z' : 'z', flags & CC_C_BIT ? 'C' : 'c', flags & CC_V_BIT ? 'V' : 'v'); - printk(" IRQs %s FIQs %s Mode %s Segment %s\n", + printk(" IRQs %s FIQs %s Mode %s%s Segment %s\n", interrupts_enabled(regs) ? "on" : "off", fast_interrupts_enabled(regs) ? "on" : "off", processor_modes[processor_mode(regs)], + thumb_mode(regs) ? " (T)" : "", get_fs() == get_ds() ? "kernel" : "user"); #if defined(CONFIG_CPU_32) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/ptrace.c linux/arch/arm/kernel/ptrace.c --- v2.4.0-test8/linux/arch/arm/kernel/ptrace.c Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/kernel/ptrace.c Mon Sep 18 15:15:25 2000 @@ -1,8 +1,14 @@ -/* ptrace.c */ -/* By Ross Biro 1/23/92 */ -/* edited by Linus Torvalds */ -/* edited for ARM by Russell King */ - +/* + * linux/arch/arm/kernel/ptrace.c + * + * By Ross Biro 1/23/92 + * edited by Linus Torvalds + * ARM modifications Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/ptrace.h linux/arch/arm/kernel/ptrace.h --- v2.4.0-test8/linux/arch/arm/kernel/ptrace.h Mon Jun 26 12:04:01 2000 +++ linux/arch/arm/kernel/ptrace.h Mon Sep 18 15:15:25 2000 @@ -1,3 +1,12 @@ +/* + * linux/arch/arm/kernel/ptrace.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ extern void __ptrace_cancel_bpt(struct task_struct *); extern int ptrace_set_bpt(struct task_struct *); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/semaphore.c linux/arch/arm/kernel/semaphore.c --- v2.4.0-test8/linux/arch/arm/kernel/semaphore.c Mon Aug 14 13:09:07 2000 +++ linux/arch/arm/kernel/semaphore.c Mon Sep 18 15:15:25 2000 @@ -1,11 +1,15 @@ /* - * ARM semaphore implementation, taken from + * ARM semaphore implementation, taken from * - * i386 semaphore implementation. + * i386 semaphore implementation. * - * (C) Copyright 1999 Linus Torvalds + * (C) Copyright 1999 Linus Torvalds * - * Modified for ARM by Russell King + * Modified for ARM by Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/setup.c linux/arch/arm/kernel/setup.c --- v2.4.0-test8/linux/arch/arm/kernel/setup.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/setup.c Mon Sep 18 15:15:25 2000 @@ -2,6 +2,10 @@ * linux/arch/arm/kernel/setup.c * * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include @@ -21,7 +25,7 @@ #include #include -#include "arch.h" +#include #ifndef MEM_SIZE #define MEM_SIZE (16*1024*1024) @@ -31,7 +35,7 @@ #define CONFIG_CMDLINE "" #endif -extern void paging_init(struct meminfo *); +extern void paging_init(struct meminfo *, struct machine_desc *desc); extern void bootmem_init(struct meminfo *); extern void reboot_setup(char *str); extern void disable_hlt(void); @@ -163,7 +167,7 @@ printk("Architecture: %s\n", list->name); if (compat) - printk(KERN_WARNING "Using compatability code " + printk(KERN_WARNING "Using compatibility code " "scheduled for removal in v%d.%d.%d\n", compat >> 24, (compat >> 12) & 0x3ff, compat & 0x3ff); @@ -378,7 +382,7 @@ saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; parse_cmdline(&meminfo, cmdline_p, from); bootmem_init(&meminfo); - paging_init(&meminfo); + paging_init(&meminfo, mdesc); request_standard_resources(&meminfo, mdesc); #ifdef CONFIG_VT diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/signal.c linux/arch/arm/kernel/signal.c --- v2.4.0-test8/linux/arch/arm/kernel/signal.c Sun Sep 3 11:53:42 2000 +++ linux/arch/arm/kernel/signal.c Mon Sep 18 15:15:25 2000 @@ -2,8 +2,11 @@ * linux/arch/arm/kernel/signal.c * * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c --- v2.4.0-test8/linux/arch/arm/kernel/sys_arm.c Tue Sep 5 13:50:01 2000 +++ linux/arch/arm/kernel/sys_arm.c Mon Sep 18 15:15:25 2000 @@ -1,14 +1,17 @@ /* - * linux/arch/arm/kernel/sys_arm.c + * linux/arch/arm/kernel/sys_arm.c * - * Copyright (C) People who wrote linux/arch/i386/kernel/sys_i386.c - * Copyright (C) 1995, 1996 Russell King. - * - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/arm - * platform. + * Copyright (C) People who wrote linux/arch/i386/kernel/sys_i386.c + * Copyright (C) 1995, 1996 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains various random system calls that + * have a non-standard calling sequence on the Linux/arm + * platform. */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/time-acorn.c linux/arch/arm/kernel/time-acorn.c --- v2.4.0-test8/linux/arch/arm/kernel/time-acorn.c Sun Feb 6 17:45:25 2000 +++ linux/arch/arm/kernel/time-acorn.c Mon Sep 18 15:15:25 2000 @@ -1,12 +1,16 @@ /* - * linux/arch/arm/kernel/time-acorn.c + * linux/arch/arm/kernel/time-acorn.c * - * Copyright (c) 1996-2000 Russell King. + * Copyright (c) 1996-2000 Russell King. * - * Changelog: - * 24-Sep-1996 RMK Created - * 10-Oct-1996 RMK Brought up to date with arch-sa110eval - * 04-Dec-1997 RMK Updated for new arch/arm/time.c + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 24-Sep-1996 RMK Created + * 10-Oct-1996 RMK Brought up to date with arch-sa110eval + * 04-Dec-1997 RMK Updated for new arch/arm/time.c */ #include #include @@ -14,8 +18,8 @@ #include #include -#include #include +#include extern unsigned long (*gettimeoffset)(void); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/time.c linux/arch/arm/kernel/time.c --- v2.4.0-test8/linux/arch/arm/kernel/time.c Tue Jul 18 22:43:24 2000 +++ linux/arch/arm/kernel/time.c Mon Sep 18 15:15:25 2000 @@ -4,15 +4,20 @@ * Copyright (C) 1991, 1992, 1995 Linus Torvalds * Modifications for ARM (C) 1994, 1995, 1996,1997 Russell King * - * This file contains the ARM-specific time handling details: - * reading the RTC at bootup, etc... + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * 1994-07-02 Alan Modra - * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime - * 1998-12-20 Updated NTP code according to technical memorandum Jan '96 - * "A Kernel Model for Precision Timekeeping" by Dave Mills + * This file contains the ARM-specific time handling details: + * reading the RTC at bootup, etc... + * + * 1994-07-02 Alan Modra + * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime + * 1998-12-20 Updated NTP code according to technical memorandum Jan '96 + * "A Kernel Model for Precision Timekeeping" by Dave Mills */ #include +#include #include #include #include @@ -64,37 +69,6 @@ */ unsigned long (*gettimeoffset)(void) = dummy_gettimeoffset; -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -unsigned long -mktime(unsigned int year, unsigned int mon, unsigned int day, - unsigned int hour, unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* * Handle kernel profile stuff... */ @@ -151,6 +125,16 @@ #include +static void dummy_leds_event(led_event_t evt) +{ +} + +void (*leds_event)(led_event_t) = dummy_leds_event; + +#ifdef CONFIG_MODULES +EXPORT_SYMBOL(leds_event); +#endif + static void do_leds(void) { #ifdef CONFIG_LEDS_CPU @@ -234,7 +218,7 @@ } static struct irqaction timer_irq = { - NULL, 0, 0, "timer", NULL, NULL + name: "timer", }; /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/traps.c linux/arch/arm/kernel/traps.c --- v2.4.0-test8/linux/arch/arm/kernel/traps.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/kernel/traps.c Mon Sep 18 15:15:25 2000 @@ -3,12 +3,14 @@ * * Copyright (C) 1995, 1996 Russell King * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds - */ - -/* - * 'traps.c' handles hardware exceptions after we have saved some state in - * 'linux/arch/arm/lib/traps.S'. Mostly a debugging aid, but will probably - * kill the offending process. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 'traps.c' handles hardware exceptions after we have saved some state in + * 'linux/arch/arm/lib/traps.S'. Mostly a debugging aid, but will probably + * kill the offending process. */ #include #include @@ -314,7 +316,7 @@ case 2: /* sys_cacheflush */ #ifdef CONFIG_CPU_32 /* r0 = start, r1 = end, r2 = flags */ - cpu_flush_cache_area(regs->ARM_r0, regs->ARM_r1, 1); + cpu_cache_clean_invalidate_range(regs->ARM_r0, regs->ARM_r1, 1); #endif break; diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/kernel/via82c505.c linux/arch/arm/kernel/via82c505.c --- v2.4.0-test8/linux/arch/arm/kernel/via82c505.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/kernel/via82c505.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,185 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define MAX_SLOTS 7 + +#define CONFIG_CMD(dev, where) (0x80000000 | (dev->bus->number << 16) | (dev->devfn << 8) | (where & ~3)) + +static int +via82c505_read_config_byte(struct pci_dev *dev, int where, u8 *value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + *value=inb(0xCFC + (where&3)); + return PCIBIOS_SUCCESSFUL; +} + +static int +via82c505_read_config_word(struct pci_dev *dev, int where, u16 *value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + *value=inw(0xCFC + (where&2)); + return PCIBIOS_SUCCESSFUL; +} + +static int +via82c505_read_config_dword(struct pci_dev *dev, int where, u32 *value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + *value=inl(0xCFC); + return PCIBIOS_SUCCESSFUL; +} + +static int +via82c505_write_config_byte(struct pci_dev *dev, int where, u8 value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + outb(value, 0xCFC + (where&3)); + return PCIBIOS_SUCCESSFUL; +} + +static int +via82c505_write_config_word(struct pci_dev *dev, int where, u16 value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + outw(value, 0xCFC + (where&2)); + return PCIBIOS_SUCCESSFUL; +} + +static int +via82c505_write_config_dword(struct pci_dev *dev, int where, u32 value) +{ + outl(CONFIG_CMD(dev,where),0xCF8); + outl(value, 0xCFC); + return PCIBIOS_SUCCESSFUL; +} + +static struct pci_ops via82c505_ops = { + via82c505_read_config_byte, + via82c505_read_config_word, + via82c505_read_config_dword, + via82c505_write_config_byte, + via82c505_write_config_word, + via82c505_write_config_dword, +}; + +#ifdef CONFIG_ARCH_SHARK + +static char size_wanted = 0; + +static int +dummy_read_config_byte(struct pci_dev *dev, int where, u8 *value) +{ + *value=0; + return PCIBIOS_SUCCESSFUL; +} + +static int +dummy_read_config_word(struct pci_dev *dev, int where, u16 *value) +{ + *value=0; + return PCIBIOS_SUCCESSFUL; +} + +static int +dummy_read_config_dword(struct pci_dev *dev, int where, u32 *value) +{ + if (dev->devfn != 0) *value = 0; + else + switch(where) { + case PCI_VENDOR_ID: + *value = PCI_VENDOR_ID_INTERG | PCI_DEVICE_ID_INTERG_2010 << 16; + break; + case PCI_CLASS_REVISION: + *value = PCI_CLASS_DISPLAY_VGA << 16; + break; + case PCI_BASE_ADDRESS_0: + if (size_wanted) { + /* 0x00900000 bytes long */ + *value = 0xff700000; + size_wanted = 0; + } else { + *value = FB_START; + } + break; + case PCI_INTERRUPT_LINE: + *value = 6; + break; + default: + *value=0; + } + return PCIBIOS_SUCCESSFUL; +} + +static int +dummy_write_config_byte(struct pci_dev *dev, int where, u8 value) +{ + return PCIBIOS_SUCCESSFUL; +} + +static int +dummy_write_config_word(struct pci_dev *dev, int where, u16 value) +{ + return PCIBIOS_SUCCESSFUL; +} + +static int +dummy_write_config_dword(struct pci_dev *dev, int where, u32 value) +{ + if ((dev->devfn == 0) && (where == PCI_BASE_ADDRESS_0) && (value == 0xffffffff)) + size_wanted = 1; + return PCIBIOS_SUCCESSFUL; +} + +static struct pci_ops dummy_ops = { + dummy_read_config_byte, + dummy_read_config_word, + dummy_read_config_dword, + dummy_write_config_byte, + dummy_write_config_word, + dummy_write_config_dword, +}; +#endif + +void __init via82c505_init(struct arm_pci_sysdata *sysdata) +{ + unsigned int pci_cmd = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | + PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; + struct pci_dev *dev; + struct pci_bus *bus; + + printk(KERN_DEBUG "PCI: VIA 82c505\n"); + request_region(0xA8,2,"via config"); + request_region(0xCF8,8,"pci config"); + + /* Enable compatible Mode */ + outb(0x96,0xA8); + outb(0x18,0xA9); + outb(0x93,0xA8); + outb(0xd0,0xA9); + + pci_scan_bus(0, &via82c505_ops, sysdata); + + pci_cmd |= sysdata->bus[0].features; + + printk("PCI: Fast back to back transfers %sabled\n", + (sysdata->bus[0].features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); + +#ifdef CONFIG_ARCH_SHARK + /* + * Initialize a fake pci-bus number 1 for the CyberPro + * on the vlbus + */ + bus = pci_scan_bus(1, &dummy_ops, sysdata); +#endif +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/Makefile linux/arch/arm/lib/Makefile --- v2.4.0-test8/linux/arch/arm/lib/Makefile Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/Makefile Mon Sep 18 15:15:25 2000 @@ -25,6 +25,7 @@ L_OBJS_nexuspci := io-footbridge.o L_OBJS_sa1100 := io-footbridge.o L_OBJS_shark := io-shark.o +L_OBJS_integrator := io-shark.o ifeq ($(PROCESSOR),armo) L_OBJS += uaccess-armo.o diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/backtrace.S linux/arch/arm/lib/backtrace.S --- v2.4.0-test8/linux/arch/arm/lib/backtrace.S Tue Nov 23 22:23:11 1999 +++ linux/arch/arm/lib/backtrace.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/backtrace.S + * linux/arch/arm/lib/backtrace.S * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/changebit.S linux/arch/arm/lib/changebit.S --- v2.4.0-test8/linux/arch/arm/lib/changebit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/changebit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/changebit.S + * linux/arch/arm/lib/changebit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/clearbit.S linux/arch/arm/lib/clearbit.S --- v2.4.0-test8/linux/arch/arm/lib/clearbit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/clearbit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/clearbit.S + * linux/arch/arm/lib/clearbit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/copy_page.S linux/arch/arm/lib/copy_page.S --- v2.4.0-test8/linux/arch/arm/lib/copy_page.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/copy_page.S Mon Sep 18 15:15:25 2000 @@ -1,10 +1,13 @@ /* - * linux/arch/arm/lib/copypage.S + * linux/arch/arm/lib/copypage.S * - * Copyright (C) 1995-1999 Russell King + * Copyright (C) 1995-1999 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/csumipv6.S linux/arch/arm/lib/csumipv6.S --- v2.4.0-test8/linux/arch/arm/lib/csumipv6.S Thu Jan 13 13:30:31 2000 +++ linux/arch/arm/lib/csumipv6.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/csumipv6.S + * linux/arch/arm/lib/csumipv6.S * - * Copyright (C) 1995-1998 Russell King + * Copyright (C) 1995-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/csumpartial.S linux/arch/arm/lib/csumpartial.S --- v2.4.0-test8/linux/arch/arm/lib/csumpartial.S Thu Jan 13 13:30:31 2000 +++ linux/arch/arm/lib/csumpartial.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/csumpartial.S + * linux/arch/arm/lib/csumpartial.S * - * Copyright (C) 1995-1998 Russell King + * Copyright (C) 1995-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/csumpartialcopy.S linux/arch/arm/lib/csumpartialcopy.S --- v2.4.0-test8/linux/arch/arm/lib/csumpartialcopy.S Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/lib/csumpartialcopy.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/csumpartialcopy.S + * linux/arch/arm/lib/csumpartialcopy.S * - * Copyright (C) 1995-1998 Russell King + * Copyright (C) 1995-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/csumpartialcopyuser.S linux/arch/arm/lib/csumpartialcopyuser.S --- v2.4.0-test8/linux/arch/arm/lib/csumpartialcopyuser.S Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/lib/csumpartialcopyuser.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/csumpartialcopyuser.S + * linux/arch/arm/lib/csumpartialcopyuser.S * - * Copyright (C) 1995-1998 Russell King + * Copyright (C) 1995-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include @@ -396,6 +400,12 @@ mov r4, r4, lsr #8 b .exit +/* + * FIXME: minor buglet here + * We don't return the checksum for the data present in the buffer. To do + * so properly, we would have to add in whatever registers were loaded before + * the fault, which, with the current asm above is not predictable. + */ #if defined(CONFIG_CPU_32) .section .fixup,"ax" #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/delay.S linux/arch/arm/lib/delay.S --- v2.4.0-test8/linux/arch/arm/lib/delay.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/delay.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/delay.S + * linux/arch/arm/lib/delay.S * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/findbit.S linux/arch/arm/lib/findbit.S --- v2.4.0-test8/linux/arch/arm/lib/findbit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/findbit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/findbit.S + * linux/arch/arm/lib/findbit.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/floppydma.S linux/arch/arm/lib/floppydma.S --- v2.4.0-test8/linux/arch/arm/lib/floppydma.S Thu Jun 17 01:11:35 1999 +++ linux/arch/arm/lib/floppydma.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/floppydma.S + * linux/arch/arm/lib/floppydma.S * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/getconsdata.c linux/arch/arm/lib/getconsdata.c --- v2.4.0-test8/linux/arch/arm/lib/getconsdata.c Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/getconsdata.c Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/getconsdata.c + * linux/arch/arm/lib/getconsdata.c * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/io-acorn.S linux/arch/arm/lib/io-acorn.S --- v2.4.0-test8/linux/arch/arm/lib/io-acorn.S Thu Jun 17 01:11:35 1999 +++ linux/arch/arm/lib/io-acorn.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/io.S + * linux/arch/arm/lib/io-acorn.S * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include /* for CONFIG_CPU_nn */ #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/io-ebsa110.S linux/arch/arm/lib/io-ebsa110.S --- v2.4.0-test8/linux/arch/arm/lib/io-ebsa110.S Thu Jun 17 01:11:35 1999 +++ linux/arch/arm/lib/io-ebsa110.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/io-ebsa.S + * linux/arch/arm/lib/io-ebsa.S * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/io-shark.c linux/arch/arm/lib/io-shark.c --- v2.4.0-test8/linux/arch/arm/lib/io-shark.c Sun Mar 12 19:39:39 2000 +++ linux/arch/arm/lib/io-shark.c Mon Sep 18 15:15:25 2000 @@ -1,11 +1,15 @@ /* - * linux/arch/arm/lib/io-shark.c + * linux/arch/arm/lib/io-shark.c * - * by Alexander.Schulz@stud.uni-karlsruhe.de + * by Alexander.Schulz@stud.uni-karlsruhe.de * * derived from: * linux/arch/arm/lib/io-ebsa.S * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/memchr.S linux/arch/arm/lib/memchr.S --- v2.4.0-test8/linux/arch/arm/lib/memchr.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/memchr.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/memchr.S + * linux/arch/arm/lib/memchr.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/memcpy.S linux/arch/arm/lib/memcpy.S --- v2.4.0-test8/linux/arch/arm/lib/memcpy.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/memcpy.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/memcpy.S + * linux/arch/arm/lib/memcpy.S * - * Copyright (C) 1995-1999 Russell King + * Copyright (C) 1995-1999 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/memset.S linux/arch/arm/lib/memset.S --- v2.4.0-test8/linux/arch/arm/lib/memset.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/memset.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/memset.S + * linux/arch/arm/lib/memset.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/memzero.S linux/arch/arm/lib/memzero.S --- v2.4.0-test8/linux/arch/arm/lib/memzero.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/memzero.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/memzero.S + * linux/arch/arm/lib/memzero.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/setbit.S linux/arch/arm/lib/setbit.S --- v2.4.0-test8/linux/arch/arm/lib/setbit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/setbit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/setbit.S + * linux/arch/arm/lib/setbit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/strchr.S linux/arch/arm/lib/strchr.S --- v2.4.0-test8/linux/arch/arm/lib/strchr.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/strchr.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/strchr.S + * linux/arch/arm/lib/strchr.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/strncpy_from_user.S linux/arch/arm/lib/strncpy_from_user.S --- v2.4.0-test8/linux/arch/arm/lib/strncpy_from_user.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/strncpy_from_user.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/strncpy_from_user.S + * linux/arch/arm/lib/strncpy_from_user.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/strnlen_user.S linux/arch/arm/lib/strnlen_user.S --- v2.4.0-test8/linux/arch/arm/lib/strnlen_user.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/strnlen_user.S Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/lib/strnlen_user.S + * linux/arch/arm/lib/strnlen_user.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/strrchr.S linux/arch/arm/lib/strrchr.S --- v2.4.0-test8/linux/arch/arm/lib/strrchr.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/strrchr.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/lib/strrchr.S + * linux/arch/arm/lib/strrchr.S * - * Copyright (C) 1995-2000 Russell King + * Copyright (C) 1995-2000 Russell King * - * ASM optimised string functions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ASM optimised string functions */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/testchangebit.S linux/arch/arm/lib/testchangebit.S --- v2.4.0-test8/linux/arch/arm/lib/testchangebit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/testchangebit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/testchangebit.S + * linux/arch/arm/lib/testchangebit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/testclearbit.S linux/arch/arm/lib/testclearbit.S --- v2.4.0-test8/linux/arch/arm/lib/testclearbit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/testclearbit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/testclearbit.S + * linux/arch/arm/lib/testclearbit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/testsetbit.S linux/arch/arm/lib/testsetbit.S --- v2.4.0-test8/linux/arch/arm/lib/testsetbit.S Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/lib/testsetbit.S Mon Sep 18 15:15:25 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/lib/testsetbit.S + * linux/arch/arm/lib/testsetbit.S * - * Copyright (C) 1995-1996 Russell King + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include .text diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/uaccess-armo.S linux/arch/arm/lib/uaccess-armo.S --- v2.4.0-test8/linux/arch/arm/lib/uaccess-armo.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/uaccess-armo.S Mon Sep 18 15:15:25 2000 @@ -1,10 +1,14 @@ /* - * arch/arm/lib/uaccess-armo.S + * linux/arch/arm/lib/uaccess-armo.S * - * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Russell King * - * Note! Some code fragments found in here have a special calling - * convention - they are not APCS compliant! + * Note! Some code fragments found in here have a special calling + * convention - they are not APCS compliant! + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/lib/uaccess.S linux/arch/arm/lib/uaccess.S --- v2.4.0-test8/linux/arch/arm/lib/uaccess.S Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/lib/uaccess.S Mon Sep 18 15:15:25 2000 @@ -1,11 +1,15 @@ /* - * linux/arch/arm/lib/uaccess.S + * linux/arch/arm/lib/uaccess.S * - * Copyright (C) 1995, 1996,1997,1998 Russell King + * Copyright (C) 1995, 1996,1997,1998 Russell King * - * Routines to block copy data to/from user memory - * These are highly optimised both for the 4k page size - * and for various alignments. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Routines to block copy data to/from user memory + * These are highly optimised both for the 4k page size + * and for various alignments. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-footbridge/Makefile linux/arch/arm/mach-footbridge/Makefile --- v2.4.0-test8/linux/arch/arm/mach-footbridge/Makefile Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/mach-footbridge/Makefile Mon Sep 18 15:15:25 2000 @@ -9,7 +9,7 @@ # Object file lists. -obj-y := #arch.o dma.o mm.o +obj-y := arch.o #dma.o mm.o obj-m := obj-n := obj- := @@ -24,13 +24,13 @@ endif ifeq ($(CONFIG_LEDS),y) -#obj-$(CONFIG_ARCH_CO285) += ebsa285-leds.o -#obj-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o -#obj-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o +obj-$(CONFIG_ARCH_CO285) += ebsa285-leds.o +obj-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o +obj-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o endif -#obj-$(CONFIG_ARCH_CATS) += cats-hw.o -#obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o +obj-$(CONFIG_ARCH_CATS) += cats-hw.o +obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o # Files that are both resident and modular; remove from modular. diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-footbridge/arch.c linux/arch/arm/mach-footbridge/arch.c --- v2.4.0-test8/linux/arch/arm/mach-footbridge/arch.c Sun Sep 3 11:19:11 2000 +++ linux/arch/arm/mach-footbridge/arch.c Mon Sep 18 15:15:25 2000 @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-footbridge/ebsa285-leds.c linux/arch/arm/mach-footbridge/ebsa285-leds.c --- v2.4.0-test8/linux/arch/arm/mach-footbridge/ebsa285-leds.c Tue Sep 5 12:56:51 2000 +++ linux/arch/arm/mach-footbridge/ebsa285-leds.c Mon Sep 18 15:15:25 2000 @@ -1,8 +1,11 @@ /* - * linux/arch/arm/mach-footbridge/ebsa285-leds.c + * linux/arch/arm/mach-footbridge/ebsa285-leds.c * - * Copyright (C) 1998-1999 Russell King + * Copyright (C) 1998-1999 Russell King * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * EBSA-285 control routines. * * The EBSA-285 uses the leds as follows: diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-footbridge/netwinder-leds.c linux/arch/arm/mach-footbridge/netwinder-leds.c --- v2.4.0-test8/linux/arch/arm/mach-footbridge/netwinder-leds.c Tue Sep 5 12:56:51 2000 +++ linux/arch/arm/mach-footbridge/netwinder-leds.c Mon Sep 18 15:15:25 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/mach-footbridge/netwinder-leds.c + * linux/arch/arm/mach-footbridge/netwinder-leds.c * - * Copyright (C) 1998-1999 Russell King + * Copyright (C) 1998-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * NetWinder LED control routines. * diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-sa1100/Makefile linux/arch/arm/mach-sa1100/Makefile --- v2.4.0-test8/linux/arch/arm/mach-sa1100/Makefile Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-sa1100/Makefile Mon Sep 18 15:15:25 2000 @@ -0,0 +1,34 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). + +USE_STANDARD_AS_RULE := true + +O_TARGET := sa1100.o + +# Object file lists. + +obj-y := arch.o hw.o #dma.o mm.o +obj-m := +obj-n := +obj- := + +export-objs := hw.o leds.o + +obj-$(CONFIG_LEDS) += leds.o + +# Files that are both resident and modular; remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) + +include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-sa1100/arch.c linux/arch/arm/mach-sa1100/arch.c --- v2.4.0-test8/linux/arch/arm/mach-sa1100/arch.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-sa1100/arch.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,291 @@ +/* + * linux/arch/arm/mach-sa1100/arch.c + * + * Architecture specific fixups. This is where any + * parameters in the params struct are fixed up, or + * any additional architecture specific information + * is pulled from the params struct. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +extern void setup_initrd(unsigned int start, unsigned int size); +extern void setup_ramdisk(int doload, int prompt, int start, unsigned int rd_sz); + +static void victor_power_off(void) +{ + /* switch off power supply */ + mdelay(2000); + GPCR = GPIO_GPIO23; + while (1); +} + + +static void xp860_power_off(void) +{ + GPDR |= GPIO_GPIO20; + GPSR = GPIO_GPIO20; + mdelay(1000); + GPCR = GPIO_GPIO20; + while(1); +} + + +extern void __init sa1100_map_io(void); + +#define SET_BANK(__nr,__start,__size) \ + mi->bank[__nr].start = (__start), \ + mi->bank[__nr].size = (__size), \ + mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) +static void __init +fixup_sa1100(struct machine_desc *desc, struct param_struct *params, + char **cmdline, struct meminfo *mi) +{ + if (machine_is_assabet()) { + /* + * On Assabet, we must probe for the Neponset board *before* + * paging_init() has occured to actually determine the amount + * of RAM available. + */ + extern void map_sa1100_gpio_regs(void); + extern void get_assabet_scr(void); + map_sa1100_gpio_regs(); + get_assabet_scr(); + + SET_BANK( 0, 0xc0000000, 32*1024*1024 ); + mi->nr_banks = 1; + + if (machine_has_neponset()) { + printk("Neponset expansion board detected\n"); + /* + * Note that Neponset RAM is slower... + * and still untested. + * This would be a candidate for + * _real_ NUMA support. + */ + //SET_BANK( 1, 0xd0000000, 32*1024*1024 ); + //mi->nr_banks = 2; + } + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk( 1, 0, 0, 8192 ); + setup_initrd( 0xc0800000, 3*1024*1024 ); + } + + else if (machine_is_brutus()) { + SET_BANK( 0, 0xc0000000, 4*1024*1024 ); + SET_BANK( 1, 0xc8000000, 4*1024*1024 ); + SET_BANK( 2, 0xd0000000, 4*1024*1024 ); + SET_BANK( 3, 0xd8000000, 4*1024*1024 ); + mi->nr_banks = 4; + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk( 1, 0, 0, 8192 ); + setup_initrd( __phys_to_virt(0xd8000000), 3*1024*1024 ); + } + + else if (machine_is_cerf()) { + // 16Meg Ram. + SET_BANK( 0, 0xc0000000, 8*1024*1024 ); + SET_BANK( 1, 0xc8000000, 8*1024*1024 ); // comment this out for 8MB Cerfs + mi->nr_banks = 2; + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk(1, 0, 0, 8192); + // Save 2Meg for RAMDisk + setup_initrd(0xc0500000, 3*1024*1024); + } + + else if (machine_is_empeg()) { + SET_BANK( 0, 0xc0000000, 4*1024*1024 ); + SET_BANK( 1, 0xc8000000, 4*1024*1024 ); + mi->nr_banks = 2; + + ROOT_DEV = MKDEV( 3, 1 ); /* /dev/hda1 */ + setup_ramdisk( 1, 0, 0, 4096 ); + setup_initrd( 0xd0000000+((1024-320)*1024), (320*1024) ); + } + + else if (machine_is_lart()) { + /* + * Note that LART is a special case - it doesn't use physical + * address line A23 on the DRAM, so we effectively have 4 * 8MB + * in two SA1100 banks. + */ + SET_BANK( 0, 0xc0000000, 8*1024*1024 ); + SET_BANK( 1, 0xc1000000, 8*1024*1024 ); + SET_BANK( 2, 0xc8000000, 8*1024*1024 ); + SET_BANK( 3, 0xc9000000, 8*1024*1024 ); + mi->nr_banks = 4; + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk(1, 0, 0, 8192); + setup_initrd(0xc0400000, 4*1024*1024); + } + + else if (machine_is_thinclient() || machine_is_graphicsclient()) { + SET_BANK( 0, 0xc0000000, 16*1024*1024 ); + mi->nr_banks = 1; + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk( 1, 0, 0, 8192 ); + setup_initrd( __phys_to_virt(0xc0800000), 4*1024*1024 ); + } + + else if (machine_is_nanoengine()) { + SET_BANK( 0, 0xc0000000, 32*1024*1024 ); + mi->nr_banks = 1; + + ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); + setup_ramdisk( 1, 0, 0, 8192 ); + setup_initrd( __phys_to_virt(0xc0800000), 4*1024*1024 ); + + /* Get command line parameters passed from the loader (if any) */ + if( *((char*)0xc0000100) ) + *cmdline = ((char *)0xc0000100); + } + else if (machine_is_tifon()) { + SET_BANK( 0, 0xc0000000, 16*1024*1024 ); + SET_BANK( 1, 0xc8000000, 16*1024*1024 ); + mi->nr_banks = 2; + + ROOT_DEV = MKDEV(UNNAMED_MAJOR, 0); + setup_ramdisk(1, 0, 0, 4096); + setup_initrd( 0xd0000000 + 0x1100004, 0x140000 ); + } + + else if (machine_is_victor()) { + SET_BANK( 0, 0xc0000000, 4*1024*1024 ); + mi->nr_banks = 1; + + ROOT_DEV = MKDEV( 60, 2 ); + + /* Get command line parameters passed from the loader (if any) */ + if( *((char*)0xc0000000) ) + strcpy( *cmdline, ((char *)0xc0000000) ); + + /* power off if any problem */ + strcat( *cmdline, " panic=1" ); + + pm_power_off = victor_power_off; + } + + else if (machine_is_xp860()) { + SET_BANK( 0, 0xc0000000, 32*1024*1024 ); + mi->nr_banks = 1; + + pm_power_off = xp860_power_off; + } +} + +#ifdef CONFIG_SA1100_ASSABET +MACHINE_START(ASSABET, "Intel-Assabet") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_BITSY +MACHINE_START(BITSY, "Compaq Bitsy") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + BOOT_PARAMS(0xc0000100) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_BRUTUS +MACHINE_START(BRUTUS, "Intel Brutus (SA1100 eval board)") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_CERF +MACHINE_START(CERF, "Intrinsyc CerfBoard") + MAINTAINER("Pieter Truter") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_EMPEG +MACHINE_START(EMPEG, "empeg MP3 Car Audio Player") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_GRAPHICSCLIENT +MACHINE_START(GRAPHICSCLIENT, "ADS GraphicsClient") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_ITSY +MACHINE_START(ITSY, "Compaq Itsy") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + BOOT_PARAMS(0xc0000100 + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_LART +MACHINE_START(LART, "LART") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_NANOENGINE +MACHINE_START(NANOENGINE, "BSE nanoEngine") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_PLEB +MACHINE_START(PLEB, "PLEB") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_THINCLIENT +MACHINE_START(THINCLIENT, "ADS ThinClient") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_TIFON +MACHINE_START(TIFON, "Tifon") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_VICTOR +MACHINE_START(VICTOR, "VisuAide Victor") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif +#ifdef CONFIG_SA1100_XP860 +MACHINE_START(XP860, "XP860") + BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000) + FIXUP(fixup_sa1100) + MAPIO(sa1100_map_io) +MACHINE_END +#endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-sa1100/hw.c linux/arch/arm/mach-sa1100/hw.c --- v2.4.0-test8/linux/arch/arm/mach-sa1100/hw.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-sa1100/hw.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,188 @@ +/* + * arch/arm/kernel/hw-sa1100.c + * + * SA1100-dependent machine specifics + * + * Copyright (C) 2000 Nicolas Pitre + * + * This will certainly contain more stuff with time... like power management, + * special hardware autodetection, etc. + * + */ +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * SA1100 GPIO edge detection for IRQs: + * IRQs are generated on Falling-Edge, Rising-Edge, or both. + * This must be called *before* the appropriate IRQ is registered. + * Use this instead of directly setting GRER/GFER. + */ + +int GPIO_IRQ_rising_edge; +int GPIO_IRQ_falling_edge; + +void set_GPIO_IRQ_edge( int gpio_mask, int edge ) +{ + if( edge & GPIO_FALLING_EDGE ) + GPIO_IRQ_falling_edge |= gpio_mask; + else + GPIO_IRQ_falling_edge &= ~gpio_mask; + if( edge & GPIO_RISING_EDGE ) + GPIO_IRQ_rising_edge |= gpio_mask; + else + GPIO_IRQ_rising_edge &= ~gpio_mask; +} + +EXPORT_SYMBOL(set_GPIO_IRQ_edge); + + +#ifdef CONFIG_SA1100_ASSABET + +unsigned long BCR_value = BCR_DB1110; +unsigned long SCR_value = SCR_INIT; +EXPORT_SYMBOL(BCR_value); +EXPORT_SYMBOL(SCR_value); + +/* + * Read System Configuration "Register" + * (taken from "Intel StrongARM SA-1110 Microprocessor Development Board + * User's Guide", section 4.4.1) + * + * This same scan is performed in arch/arm/boot/compressed/head-sa1100.S + * to set up the serial port for decompression status messages. We + * repeat it here because the kernel may not be loaded as a zImage, and + * also because it's a hassle to communicate the SCR value to the kernel + * from the decompressor. + */ + +void __init get_assabet_scr(void) +{ + unsigned long flags, scr, i; + + local_irq_save(flags); + GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */ + GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */ + GPDR &= ~(0x3fc); /* Configure GPIO 9:2 as inputs */ + for(i = 100; i--; scr = GPLR); /* Read GPIO 9:2 */ + GPDR |= 0x3fc; /* restore correct pin direction */ + local_irq_restore(flags); + scr &= 0x3fc; /* save as system configuration byte. */ + + SCR_value = scr; +} + +#endif /* CONFIG_SA1100_ASSABET */ + + +#if defined(CONFIG_SA1100_BITSY) +/* + * Bitsy has extended, write-only memory-mapped GPIO's + */ +static int bitsy_egpio = EGPIO_BITSY_RS232_ON; +void clr_bitsy_egpio(unsigned long x) +{ + bitsy_egpio &= ~x; + *(volatile int *)0xdc000000 = bitsy_egpio; +} +void set_bitsy_egpio(unsigned long x) +{ + bitsy_egpio |= x; + *(volatile int *)0xdc000000 = bitsy_egpio; +} +EXPORT_SYMBOL(clr_bitsy_egpio); +EXPORT_SYMBOL(set_bitsy_egpio); +#endif + + +#ifdef CONFIG_SA1111 + +static void __init sa1111_init(void){ + unsigned long id=SKID; + + if((id & SKID_ID_MASK) == SKID_SA1111_ID) + printk(KERN_INFO "SA-1111 Microprocessor Companion Chip: " + "silicon revision %x, metal revision %x\n", + (id & SKID_SIREV_MASK)>>4, (id & SKID_MTREV_MASK)); + else { + printk(KERN_ERR "Could not detect SA-1111!\n"); + return; + } + + /* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: + * (SA-1110 Developer's Manual, section 9.1.2.1) + */ + GAFR |= GPIO_GPIO27; + GPDR |= GPIO_GPIO27; + TUCR = TUCR_3_6864MHz; + + /* Now, set up the PLL and RCLK in the SA-1111: */ + SKCR = SKCR_PLL_BYPASS | SKCR_RDYEN | SKCR_OE_EN; + udelay(100); + SKCR = SKCR_PLL_BYPASS | SKCR_RCLKEN | SKCR_RDYEN | SKCR_OE_EN; + + /* SA-1111 Register Access Bus should now be available. Clocks for + * any other SA-1111 functional blocks must be enabled separately + * using the SKPCR. + */ + + { + /* + * SA1111 DMA bus master setup + */ + int cas; + + /* SA1111 side */ + switch ( (MDCNFG>>12) & 0x03 ) { + case 0x02: + cas = 0; break; + case 0x03: + cas = 1; break; + default: + cas = 1; break; + } + SMCR = 1 /* 1: memory is SDRAM */ + | ( 1 << 1 ) /* 1:MBGNT is enable */ + | ( ((MDCNFG >> 4) & 0x07) << 2 ) /* row address lines */ + | ( cas << 5 ); /* CAS latency */ + + /* SA1110 side */ + GPDR |= 1<<21; + GPDR &= ~(1<<22); + GAFR |= ( (1<<21) | (1<<22) ); + + TUCR |= (1<<10); + } +} + +#else +#define sa1111_init() printk( "Warning: missing SA1111 support\n" ) +#endif + + +static int __init hw_sa1100_init(void) +{ + if( machine_is_assabet() ){ + if(machine_has_neponset()){ +#ifdef CONFIG_ASSABET_NEPONSET + LEDS = WHOAMI; + sa1111_init(); +#else + printk( "Warning: Neponset detected but full support " + "hasn't been configured in the kernel\n" ); +#endif + } + } else if (machine_is_xp860()) { + sa1111_init(); + } + return 0; +} + +module_init(hw_sa1100_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-sa1100/leds.c linux/arch/arm/mach-sa1100/leds.c --- v2.4.0-test8/linux/arch/arm/mach-sa1100/leds.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-sa1100/leds.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,429 @@ +/* + * linux/arch/arm/kernel/leds-sa1100.c + * + * Copyright (C) 2000 John Dorsey + * + * Original (leds-footbridge.c) by Russell King + * + * Added Brutus LEDs support + * Nicolas Pitre, Mar 19, 2000 + * + * Added LART LED support + * Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000 + * + * + * Assabet uses the LEDs as follows: + * - Green - toggles state every 50 timer interrupts + * - Red - on if system is not idle + * + * Brutus uses the LEDs as follows: + * - D3 (Green, GPIO9) - toggles state every 50 timer interrupts + * - D17 (Red, GPIO20) - on if system is not idle + * - D4 (Green, GPIO8) - misc function + * + * LART uses the LED as follows: + * - GPIO23 is the LED, on if system is not idle + * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same + * time, but in that case the timer events will still dictate the + * pace of the LED. + * + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +#define LED_STATE_ENABLED 1 +#define LED_STATE_CLAIMED 2 + +static unsigned int led_state; +static unsigned int hw_led_state; + + +#ifdef CONFIG_SA1100_ASSABET + +#define BCR_LED_MASK (BCR_LED_GREEN | BCR_LED_RED) + +static void assabet_leds_event(led_event_t evt) +{ + unsigned long flags; + + local_irq_save(flags); + + switch (evt) { + case led_start: + hw_led_state = BCR_LED_RED | BCR_LED_GREEN; + led_state = LED_STATE_ENABLED; + break; + + case led_stop: + led_state &= ~LED_STATE_ENABLED; + break; + + case led_claim: + led_state |= LED_STATE_CLAIMED; + hw_led_state = BCR_LED_RED | BCR_LED_GREEN; + break; + + case led_release: + led_state &= ~LED_STATE_CLAIMED; + hw_led_state = BCR_LED_RED | BCR_LED_GREEN; + break; + +#ifdef CONFIG_LEDS_TIMER + case led_timer: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state ^= BCR_LED_GREEN; + break; +#endif + +#ifdef CONFIG_LEDS_CPU + case led_idle_start: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= BCR_LED_RED; + break; + + case led_idle_end: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~BCR_LED_RED; + break; +#endif + + case led_halted: + break; + + case led_green_on: + if (led_state & LED_STATE_CLAIMED) + hw_led_state &= ~BCR_LED_GREEN; + break; + + case led_green_off: + if (led_state & LED_STATE_CLAIMED) + hw_led_state |= BCR_LED_GREEN; + break; + + case led_amber_on: + break; + + case led_amber_off: + break; + + case led_red_on: + if (led_state & LED_STATE_CLAIMED) + hw_led_state &= ~BCR_LED_RED; + break; + + case led_red_off: + if (led_state & LED_STATE_CLAIMED) + hw_led_state |= BCR_LED_RED; + break; + + default: + break; + } + + if (led_state & LED_STATE_ENABLED) + BCR = BCR_value = (BCR_value & ~BCR_LED_MASK) | hw_led_state; + + local_irq_restore(flags); +} + +#endif /* CONFIG_SA1100_ASSABET */ + +#ifdef CONFIG_SA1100_BRUTUS + +#define LED_D3 GPIO_GPIO(9) +#define LED_D4 GPIO_GPIO(8) +#define LED_D17 GPIO_GPIO(20) +#define LED_MASK (LED_D3|LED_D4|LED_D17) + +static void brutus_leds_event(led_event_t evt) +{ + unsigned long flags; + + local_irq_save(flags); + + switch (evt) { + case led_start: + hw_led_state = LED_MASK; + led_state = LED_STATE_ENABLED; + break; + + case led_stop: + led_state &= ~LED_STATE_ENABLED; + break; + + case led_claim: + led_state |= LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + + case led_release: + led_state &= ~LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + +#ifdef CONFIG_LEDS_TIMER + case led_timer: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state ^= LED_D3; + break; +#endif + +#ifdef CONFIG_LEDS_CPU + case led_idle_start: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_D17; + break; + + case led_idle_end: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_D17; + break; +#endif + + case led_green_on: + hw_led_state &= ~LED_D4; + break; + + case led_green_off: + hw_led_state |= LED_D4; + break; + + case led_amber_on: + break; + + case led_amber_off: + break; + + case led_red_on: + if (led_state & LED_STATE_CLAIMED) + hw_led_state &= ~LED_D17; + break; + + case led_red_off: + if (led_state & LED_STATE_CLAIMED) + hw_led_state |= LED_D17; + break; + + default: + break; + } + + if (led_state & LED_STATE_ENABLED) { + GPSR = hw_led_state; + GPCR = hw_led_state ^ LED_MASK; + } + + local_irq_restore(flags); +} + +#endif /* CONFIG_SA1100_BRUTUS */ + +#ifdef CONFIG_SA1100_LART + +#define LED_23 GPIO_GPIO23 +#define LED_MASK (LED_23) + + +static void lart_leds_event(led_event_t evt) +{ + unsigned long flags; + + local_irq_save(flags); + + switch(evt) { + case led_start: + hw_led_state = LED_MASK; + led_state = LED_STATE_ENABLED; + break; + + case led_stop: + led_state &= ~LED_STATE_ENABLED; + break; + + case led_claim: + led_state |= LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + + case led_release: + led_state &= ~LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + +#ifdef CONFIG_LEDS_TIMER + case led_timer: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state ^= LED_23; + break; +#endif + +#ifdef CONFIG_LEDS_CPU + case led_idle_start: + /* The LART people like the LED to be off when the + system is idle... */ + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_23; + break; + + case led_idle_end: + /* ... and on if the system is not idle */ + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_23; + break; +#endif + + case led_red_on: + if (led_state & LED_STATE_CLAIMED) + hw_led_state &= ~LED_23; + break; + + case led_red_off: + if (led_state & LED_STATE_CLAIMED) + hw_led_state |= LED_23; + break; + + default: + break; + } + + /* Now set the GPIO state, or nothing will happen at all */ + if (led_state & LED_STATE_ENABLED) { + GPSR = hw_led_state; + GPCR = hw_led_state ^ LED_MASK; + } + + local_irq_restore(flags); +} + +#endif /* CONFIG_SA1100_LART */ + +#ifdef CONFIG_SA1100_CERF +#define LED_D0 GPIO_GPIO(0) +#define LED_D1 GPIO_GPIO(1) +#define LED_D2 GPIO_GPIO(2) +#define LED_D3 GPIO_GPIO(3) +#define LED_MASK (LED_D0|LED_D1|LED_D2|LED_D3) + +static void cerf_leds_event(led_event_t evt) +{ + unsigned long flags; + + local_irq_save(flags); + + switch (evt) { + case led_start: + hw_led_state = LED_MASK; + led_state = LED_STATE_ENABLED; + break; + + case led_stop: + led_state &= ~LED_STATE_ENABLED; + break; + + case led_claim: + led_state |= LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + case led_release: + led_state &= ~LED_STATE_CLAIMED; + hw_led_state = LED_MASK; + break; + +#ifdef CONFIG_LEDS_TIMER + case led_timer: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state ^= LED_D0; + break; +#endif + +#ifdef CONFIG_LEDS_CPU + case led_idle_start: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_D1; + break; + + case led_idle_end: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_D1; + break; +#endif + case led_green_on: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_D2; + break; + + case led_green_off: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_D2; + break; + + case led_amber_on: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_D3; + break; + + case led_amber_off: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_D3; + break; + + case led_red_on: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state &= ~LED_D1; + break; + + case led_red_off: + if (!(led_state & LED_STATE_CLAIMED)) + hw_led_state |= LED_D1; + break; + + default: + break; + } + + if (led_state & LED_STATE_ENABLED) { + GPSR = hw_led_state; + GPCR = hw_led_state ^ LED_MASK; + } + + local_irq_restore(flags); +} + +#endif /* CONFIG_SA1100_CERF */ + +static int __init +sa1100_leds_init(void) +{ +#ifdef CONFIG_SA1100_ASSABET + if (machine_is_assabet()) + leds_event = assabet_leds_event; +#endif +#ifdef CONFIG_SA1100_BRUTUS + if (machine_is_brutus()) + leds_event = brutus_leds_event; +#endif +#ifdef CONFIG_SA1100_LART + if (machine_is_lart()) + leds_event = lart_leds_event; +#endif +#ifdef CONFIG_SA1100_CERF + if (machine_is_cerf()) + { + //GPDR |= 0x0000000F; + leds_event = cerf_leds_event; + } +#endif + leds_event(led_start); + return 0; +} + +__initcall(sa1100_leds_init); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-shark/Makefile linux/arch/arm/mach-shark/Makefile --- v2.4.0-test8/linux/arch/arm/mach-shark/Makefile Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-shark/Makefile Mon Sep 18 15:15:25 2000 @@ -0,0 +1,32 @@ +# +# Makefile for the linux kernel. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). + +O_TARGET := shark.o + +# Object file lists. + +obj-y := arch.o dma.o mm.o pci.o +obj-m := +obj-n := +obj- := + +export-objs := + +#obj-$(CONFIG_LEDS) += leds.o + +# Files that are both resident and modular; remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) + +include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-shark/arch.c linux/arch/arm/mach-shark/arch.c --- v2.4.0-test8/linux/arch/arm/mach-shark/arch.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-shark/arch.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,32 @@ +/* + * linux/arch/arm/mach-shark/arch.c + * + * Architecture specific fixups. This is where any + * parameters in the params struct are fixed up, or + * any additional architecture specific information + * is pulled from the params struct. + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +extern void setup_initrd(unsigned int start, unsigned int size); +extern void setup_ramdisk(int doload, int prompt, int start, unsigned int rd_sz); +extern void __init footbridge_map_io(void); +extern void __init shark_map_io(void); + +MACHINE_START(SHARK, "Shark") + MAINTAINER("Alexander Schulz") + BOOT_MEM(0x08000000, 0x40000000, 0xe0000000) + VIDEO(0x06000000, 0x061fffff) + MAPIO(shark_map_io) +MACHINE_END diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-shark/dma.c linux/arch/arm/mach-shark/dma.c --- v2.4.0-test8/linux/arch/arm/mach-shark/dma.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-shark/dma.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,25 @@ +/* + * linux/arch/arm/mach-shark/dma.c + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * derived from: + * arch/arm/kernel/dma-ebsa285.c + * Copyright (C) 1998 Phil Blundell + */ + +#include +#include +#include + +#include +#include + +#include + +void __init arch_dma_init(dma_t *dma) +{ +#ifdef CONFIG_ISA_DMA + isa_init_dma(dma); +#endif +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-shark/mm.c linux/arch/arm/mach-shark/mm.c --- v2.4.0-test8/linux/arch/arm/mach-shark/mm.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-shark/mm.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,30 @@ +/* + * linux/arch/arm/mach-shark/mm.c + * + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include + +#include +#include +#include + +#include + +static struct map_desc shark_io_desc[] __initdata = { + { IO_BASE , IO_START , IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, + { FB_BASE , FB_START , FB_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, + { FBREG_BASE , FBREG_START , FBREG_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, + LAST_DESC +}; + +void __init shark_map_io(void) +{ + iotable_init(shark_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mach-shark/pci.c linux/arch/arm/mach-shark/pci.c --- v2.4.0-test8/linux/arch/arm/mach-shark/pci.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mach-shark/pci.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,28 @@ +/* + * linux/arch/arm/mach-shark/pci.c + * + * PCI bios-type initialisation for PCI machines + * + * Bits taken from various places. + */ +#include +#include +#include +#include + +#include +#include + +static int __init shark_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +{ + if (dev->bus->number == 0) + if (dev->devfn == 0) return 255; + else return 11; + else return 6; +} + +struct hw_pci shark_pci __initdata = { + init: via82c505_init, + swizzle: no_swizzle, + map_irq: shark_map_irq +}; diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/Makefile linux/arch/arm/mm/Makefile --- v2.4.0-test8/linux/arch/arm/mm/Makefile Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/Makefile Mon Sep 18 15:15:25 2000 @@ -9,40 +9,61 @@ USE_STANDARD_AS_RULE := true +EXTRA_AFLAGS := -traditional O_TARGET := mm.o -O_OBJS := extable.o fault-$(PROCESSOR).o init.o \ + +# Object file lists. + +obj-y := extable.o fault-$(PROCESSOR).o init.o \ mm-$(PROCESSOR).o small_page.o +obj-m := +obj-n := +obj- := +export-objs := proc-syms.o -ifeq ($(CONFIG_CPU_26),y) - O_OBJS += proc-arm2,3.o -endif +p-$(CONFIG_CPU_26) += proc-arm2,3.o +p-$(CONFIG_CPU_ARM6) += proc-arm6,7.o +p-$(CONFIG_CPU_ARM7) += proc-arm6,7.o +p-$(CONFIG_CPU_ARM720) += proc-arm720.o +p-$(CONFIG_CPU_ARM920) += proc-arm920.o +p-$(CONFIG_CPU_ARM10) += proc-arm10.o +p-$(CONFIG_CPU_SA110) += proc-sa110.o +p-$(CONFIG_CPU_SA1100) += proc-sa110.o +obj-$(CONFIG_CPU_32) += consistent.o ioremap.o ifeq ($(CONFIG_CPU_32),y) - ifeq ($(CONFIG_CPU_ARM6),y) - P_OBJS += proc-arm6,7.o - endif - ifeq ($(CONFIG_CPU_ARM7),y) - P_OBJS += proc-arm6,7.o - endif - ifeq ($(CONFIG_CPU_ARM720),y) - P_OBJS += proc-arm720.o - endif - ifeq ($(CONFIG_CPU_SA110),y) - P_OBJS += proc-sa110.o - endif - ifeq ($(CONFIG_CPU_SA1100),y) - P_OBJS += proc-sa110.o - endif - O_OBJS += mm-$(MACHINE).o consistent.o ioremap.o $(sort $(P_OBJS)) +obj-$(CONFIG_MODULES) += proc-syms.o +endif + +# Integrator follows "new style" +# Soon, others will do too, and we can get rid of this +MMMACH := mm-$(MACHINE).o +ifeq ($(MMMACH),$(wildcard $(MMMACH))) +obj-$(CONFIG_CPU_32) += $(MMMACH) endif +obj-y += $(sort $(p-y)) + +# Files that are both resident and modular; remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) + include $(TOPDIR)/Rules.make # Special dependencies -fault-armv.o: fault-common.c -fault-armo.o: fault-common.c +fault-armv.o: fault-common.c +fault-armo.o: fault-common.c proc-arm2,3.o: ../lib/constants.h proc-arm6,7.o: ../lib/constants.h proc-arm720.o: ../lib/constants.h +proc-arm920.o: ../lib/constants.h +proc-arm10.o: ../lib/constants.h proc-sa110.o: ../lib/constants.h diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/consistent.c linux/arch/arm/mm/consistent.c --- v2.4.0-test8/linux/arch/arm/mm/consistent.c Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/mm/consistent.c Mon Sep 18 15:15:25 2000 @@ -1,5 +1,13 @@ /* - * Dynamic DMA mapping support. + * linux/arch/arm/mm/consistent.c + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Dynamic DMA mapping support. */ #include #include @@ -43,18 +51,19 @@ ret = __ioremap(virt_to_phys((void *)page), size, 0); if (ret) { /* free wasted pages */ - unsigned long end = page + (PAGE_SIZE << order); + unsigned long end; /* * we need to ensure that there are no * cachelines in use, or worse dirty in * this area. */ - dma_cache_inv(page, size); - dma_cache_inv(ret, size); + invalidate_dcache_range(page, page + size); + invalidate_dcache_range((unsigned long)ret, (unsigned long)ret + size); - *dma_handle = virt_to_bus((void *)page); + *dma_handle = __virt_to_bus(page); + end = page + (PAGE_SIZE << order); page += size; while (page < end) { free_page(page); @@ -102,17 +111,20 @@ */ void consistent_sync(void *vaddr, size_t size, int direction) { + unsigned long start = (unsigned long)vaddr; + unsigned long end = start + size; + switch (direction) { case PCI_DMA_NONE: BUG(); case PCI_DMA_FROMDEVICE: /* invalidate only */ - dma_cache_inv(vaddr, size); + invalidate_dcache_range(start, end); break; case PCI_DMA_TODEVICE: /* writeback only */ - dma_cache_wback(vaddr, size); + clean_dcache_range(start, end); break; case PCI_DMA_BIDIRECTIONAL: /* writeback and invalidate */ - dma_cache_wback_inv(vaddr, size); + flush_dcache_range(start, end); break; } } diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/extable.c linux/arch/arm/mm/extable.c --- v2.4.0-test8/linux/arch/arm/mm/extable.c Wed Nov 10 08:31:37 1999 +++ linux/arch/arm/mm/extable.c Mon Sep 18 15:15:25 2000 @@ -1,5 +1,5 @@ /* - * linux/arch/arm/mm/extable.c + * linux/arch/arm/mm/extable.c */ #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/fault-armo.c linux/arch/arm/mm/fault-armo.c --- v2.4.0-test8/linux/arch/arm/mm/fault-armo.c Wed Oct 20 16:29:08 1999 +++ linux/arch/arm/mm/fault-armo.c Mon Sep 18 15:15:25 2000 @@ -3,8 +3,11 @@ * * Copyright (C) 1995 Linus Torvalds * Modifications for ARM processor (c) 1995-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/fault-armv.c linux/arch/arm/mm/fault-armv.c --- v2.4.0-test8/linux/arch/arm/mm/fault-armv.c Mon Jun 19 17:59:34 2000 +++ linux/arch/arm/mm/fault-armv.c Mon Sep 18 15:15:25 2000 @@ -3,8 +3,11 @@ * * Copyright (C) 1995 Linus Torvalds * Modifications for ARM processor (c) 1995-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include #include @@ -399,7 +402,11 @@ return; bad: force_sig(inf->sig, current); - die_if_kernel(inf->name, regs, fsr); + + printk(KERN_ALERT "Unhandled fault: %s (%X) at 0x%08lx\n", + inf->name, fsr, addr); + show_pte(current->mm, addr); + die_if_kernel("Oops", regs, 0); return; weirdness: diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/fault-common.c linux/arch/arm/mm/fault-common.c --- v2.4.0-test8/linux/arch/arm/mm/fault-common.c Mon Jun 26 12:04:01 2000 +++ linux/arch/arm/mm/fault-common.c Mon Sep 18 15:15:25 2000 @@ -3,6 +3,10 @@ * * Copyright (C) 1995 Linus Torvalds * Modifications for ARM processor (c) 1995-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include @@ -12,7 +16,7 @@ * This is useful to dump out the page tables associated with * 'addr' in mm 'mm'. */ -static void show_pte(struct mm_struct *mm, unsigned long addr) +void show_pte(struct mm_struct *mm, unsigned long addr) { pgd_t *pgd; @@ -31,7 +35,7 @@ break; if (pgd_bad(*pgd)) { - printk("(bad)\n"); + printk("(bad)"); break; } @@ -42,7 +46,7 @@ break; if (pmd_bad(*pmd)) { - printk("(bad)\n"); + printk("(bad)"); break; } diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/init.c linux/arch/arm/mm/init.c --- v2.4.0-test8/linux/arch/arm/mm/init.c Thu Sep 7 08:44:50 2000 +++ linux/arch/arm/mm/init.c Mon Sep 18 15:15:25 2000 @@ -2,6 +2,10 @@ * linux/arch/arm/mm/init.c * * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include @@ -27,7 +31,8 @@ #include #include -#include "map.h" +#include +#include #ifndef CONFIG_DISCONTIGMEM #define NR_NODES 1 @@ -387,6 +392,12 @@ */ reserve_bootmem_node(0, __pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(void *)); +#else + /* + * Stop this memory from being grabbed - its special DMA + * memory that is required for the screen. + */ + reserve_bootmem_node(0, 0x02000000, 0x00080000); #endif /* * And don't forget to reserve the allocator bitmap, @@ -466,7 +477,7 @@ * paging_init() sets up the page tables, initialises the zone memory * maps, and sets up the zero page, bad page and bad page tables. */ -void __init paging_init(struct meminfo *mi) +void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) { void *zero_page, *bad_page, *bad_table; int node; @@ -474,16 +485,19 @@ memcpy(&meminfo, mi, sizeof(meminfo)); /* - * allocate what we need for the bad pages + * allocate what we need for the bad pages. + * note that we count on this going ok. */ zero_page = alloc_bootmem_low_pages(PAGE_SIZE); bad_page = alloc_bootmem_low_pages(PAGE_SIZE); bad_table = alloc_bootmem_low_pages(TABLE_SIZE); /* - * initialise the page tables + * initialise the page tables. */ - pagetable_init(mi); + memtable_init(mi); + if (mdesc->map_io) + mdesc->map_io(); flush_tlb_all(); /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/ioremap.c linux/arch/arm/mm/ioremap.c --- v2.4.0-test8/linux/arch/arm/mm/ioremap.c Sun Feb 6 17:45:25 2000 +++ linux/arch/arm/mm/ioremap.c Mon Sep 18 15:15:25 2000 @@ -1,5 +1,5 @@ /* - * arch/arm/mm/ioremap.c + * linux/arch/arm/mm/ioremap.c * * Re-map IO memory to kernel address space so that we can access it. * diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/map.h linux/arch/arm/mm/map.h --- v2.4.0-test8/linux/arch/arm/mm/map.h Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/mm/map.h Wed Dec 31 16:00:00 1969 @@ -1,25 +0,0 @@ -/* - * linux/arch/arm/mm/map.h - * - * Copyright (C) 1999 Russell King - * - * Page table mapping constructs and function prototypes - */ -struct map_desc { - unsigned long virtual; - unsigned long physical; - unsigned long length; - int domain:4, - prot_read:1, - prot_write:1, - cacheable:1, - bufferable:1; -}; - -extern struct map_desc io_desc[]; -extern unsigned int io_desc_size; - -struct meminfo; - -extern void create_memmap_holes(struct meminfo *); -extern void pagetable_init(struct meminfo *); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-armo.c linux/arch/arm/mm/mm-armo.c --- v2.4.0-test8/linux/arch/arm/mm/mm-armo.c Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/mm/mm-armo.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * arch/arm/mm/mm-armo.c + * linux/arch/arm/mm/mm-armo.c * - * Page table sludge for older ARM processor architectures. + * Copyright (C) 1998-2000 Russell King * - * Copyright (C) 1998-2000 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Page table sludge for older ARM processor architectures. */ #include #include @@ -15,7 +19,7 @@ #include #include -#include "map.h" +#include #define MEMC_TABLE_SIZE (256*sizeof(unsigned long)) #define PGD_TABLE_SIZE (PTRS_PER_PGD * BYTES_PER_PTR) @@ -147,7 +151,7 @@ * some more work to get it to fit into our separate processor and * architecture structure. */ -void __init pagetable_init(struct meminfo *mi) +void __init memtable_init(struct meminfo *mi) { pte_t *pte; int i; @@ -160,6 +164,11 @@ for (i = 1; i < PTRS_PER_PGD; i++) pgd_val(swapper_pg_dir[i]) = 0; +} + +void __init iotable_init(struct map_desc *io_desc) +{ + /* nothing to do */ } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-armv.c linux/arch/arm/mm/mm-armv.c --- v2.4.0-test8/linux/arch/arm/mm/mm-armv.c Mon Aug 7 21:02:27 2000 +++ linux/arch/arm/mm/mm-armv.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* * linux/arch/arm/mm/mm-armv.c * - * Page table sludge for ARM v3 and v4 processor architectures. - * * Copyright (C) 1998-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Page table sludge for ARM v3 and v4 processor architectures. */ #include #include @@ -16,7 +20,7 @@ #include #include -#include "map.h" +#include unsigned long *valid_addr_bitmap; @@ -62,6 +66,10 @@ #define FIRST_KERNEL_PGD_NR (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD) +#define clean_cache_area(start,size) \ + cpu_cache_clean_invalidate_range((unsigned long)start, ((unsigned long)start) + size, 0); + + /* * need to get a 16k page for level 1 */ @@ -72,10 +80,13 @@ if (pgd) { pgd_t *init = pgd_offset_k(0); - + memzero(pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t)); memcpy(pgd + FIRST_KERNEL_PGD_NR, init + FIRST_KERNEL_PGD_NR, (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t)); + /* + * FIXME: this should not be necessary + */ clean_cache_area(pgd, PTRS_PER_PGD * sizeof(pgd_t)); /* @@ -310,18 +321,17 @@ } } -void __init pagetable_init(struct meminfo *mi) +/* + * Setup initial mappings. We use the page we allocated for zero page to hold + * the mappings, which will get overwritten by the vectors in traps_init(). + * The mappings must be in virtual address order. + */ +void __init memtable_init(struct meminfo *mi) { struct map_desc *init_maps, *p, *q; unsigned long address = 0; int i; - /* - * Setup initial mappings. We use the page we allocated - * for zero page to hold the mappings, which will get - * overwritten by the vectors in traps_init(). The - * mappings must be in virtual address order. - */ init_maps = p = alloc_bootmem_low_pages(PAGE_SIZE); p->physical = virt_to_phys(init_maps); @@ -401,16 +411,21 @@ } } while (address != 0); - /* - * Create the architecture specific mappings - */ - for (i = 0; i < io_desc_size; i++) - create_mapping(io_desc + i); - flush_cache_all(); } -static inline void free_memmap(unsigned long start, unsigned long end) +/* + * Create the architecture specific mappings + */ +void __init iotable_init(struct map_desc *io_desc) +{ + int i; + + for (i = 0; io_desc[i].last == 0; i++) + create_mapping(io_desc + i); +} + +static inline void free_memmap(int node, unsigned long start, unsigned long end) { unsigned long pg, pgend; @@ -422,10 +437,8 @@ start = __virt_to_phys(pg); end = __virt_to_phys(pgend); - /* - * The mem_map is always stored in node 0 - */ - free_bootmem_node(0, start, end - start); + + free_bootmem_node(node, start, end - start); } static inline void free_unused_memmap_node(int node, struct meminfo *mi) @@ -449,7 +462,7 @@ * between the current bank and the previous, free it. */ if (prev_bank_end && prev_bank_end != bank_start) - free_memmap(prev_bank_end, bank_start); + free_memmap(node, prev_bank_end, bank_start); prev_bank_end = PAGE_ALIGN(mi->bank[i].start + mi->bank[i].size); diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-clps7500.c linux/arch/arm/mm/mm-clps7500.c --- v2.4.0-test8/linux/arch/arm/mm/mm-clps7500.c Mon Feb 28 14:16:37 2000 +++ linux/arch/arm/mm/mm-clps7500.c Mon Sep 18 15:15:25 2000 @@ -1,12 +1,11 @@ /* - * arch/arm/mm/mm-cl7500.c + * linux/arch/arm/mm/mm-cl7500.c * - * Extra MM routines for CL7500 architecture + * Copyright (C) 1998 Russell King + * Copyright (C) 1999 Nexus Electronics Ltd * - * Copyright (C) 1998 Russell King - * Copyright (C) 1999 Nexus Electronics Ltd + * Extra MM routines for CL7500 architecture */ - #include #include @@ -14,15 +13,17 @@ #include #include -#include "map.h" - -#define SIZE(x) (sizeof(x) / sizeof(x[0])) +#include -struct map_desc io_desc[] __initdata = { +static struct map_desc cl7500_io_desc[] __initdata = { { IO_BASE, IO_START, IO_SIZE , DOMAIN_IO, 0, 1 }, /* IO space */ { ISA_BASE, ISA_START, ISA_SIZE , DOMAIN_IO, 0, 1 }, /* ISA space */ { FLASH_BASE, FLASH_START, FLASH_SIZE, DOMAIN_IO, 0, 1 }, /* Flash */ - { LED_BASE, LED_START, LED_SIZE , DOMAIN_IO, 0, 1 } /* LED */ + { LED_BASE, LED_START, LED_SIZE , DOMAIN_IO, 0, 1 }, /* LED */ + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init clps7500_map_io(void) +{ + iotable_init(cl7500_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-ebsa110.c linux/arch/arm/mm/mm-ebsa110.c --- v2.4.0-test8/linux/arch/arm/mm/mm-ebsa110.c Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/mm/mm-ebsa110.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * arch/arm/mm/mm-ebsa110.c + * linux/arch/arm/mm/mm-ebsa110.c * - * Extra MM routines for the EBSA-110 architecture + * Copyright (C) 1998-1999 Russell King * - * Copyright (C) 1998-1999 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Extra MM routines for the EBSA-110 architecture */ #include #include @@ -12,13 +16,15 @@ #include #include -#include "map.h" +#include -#define SIZE(x) (sizeof(x) / sizeof(x[0])) - -struct map_desc io_desc[] __initdata = { +static struct map_desc ebsa110_io_desc[] __initdata = { { IO_BASE - PGDIR_SIZE, 0xc0000000, PGDIR_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, - { IO_BASE , IO_START , IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 } + { IO_BASE , IO_START , IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init ebsa110_map_io(void) +{ + iotable_init(ebsa110_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-footbridge.c linux/arch/arm/mm/mm-footbridge.c --- v2.4.0-test8/linux/arch/arm/mm/mm-footbridge.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/mm-footbridge.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * arch/arm/mm/mm-footbridge.c + * linux/arch/arm/mm/mm-footbridge.c * - * Extra MM routines for the EBSA285 architecture + * Copyright (C) 1998-2000 Russell King, Dave Gilbert. * - * Copyright (C) 1998-1999 Russell King, Dave Gilbert. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Extra MM routines for the EBSA285 architecture */ #include #include @@ -13,73 +17,83 @@ #include #include #include -#include - -#include "map.h" +#include +#include -#define SIZE(x) (sizeof(x) / sizeof(x[0])) +#include /* - * The first entry allows us to fiddle with the EEPROM from user-space. - * This entry will go away in time, once the fmu32 can mmap() the - * flash. It can't at the moment. - * - * If you want to fiddle with PCI VGA cards from user space, then - * change the '0, 1 }' for the PCI MEM and PCI IO to '1, 1 }' - * You can then access the PCI bus at 0xe0000000 and 0xffe00000. + * Common mapping for all systems. Note that the outbound write flush is + * commented out since there is a "No Fix" problem with it. Not mapping + * it means that we have extra bullet protection on our feet. */ - -#ifdef CONFIG_FOOTBRIDGE_HOST +static struct map_desc fb_common_io_desc[] __initdata = { + { ARMCSR_BASE, DC21285_ARMCSR_BASE, ARMCSR_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { XBUS_BASE, 0x40000000, XBUS_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + LAST_DESC +}; /* - * The mapping when the footbridge is in host mode. + * The mapping when the footbridge is in host mode. We don't map any of + * this when we are in add-in mode. */ -#define MAPPING \ - { FLASH_BASE, DC21285_FLASH, FLASH_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCICFG0_BASE, DC21285_PCI_TYPE_0_CONFIG, PCICFG0_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCICFG1_BASE, DC21285_PCI_TYPE_1_CONFIG, PCICFG1_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCIIACK_BASE, DC21285_PCI_IACK, PCIIACK_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { WFLUSH_BASE, DC21285_OUTBOUND_WRITE_FLUSH, WFLUSH_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { ARMCSR_BASE, DC21285_ARMCSR_BASE, ARMCSR_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { XBUS_BASE, 0x40000000, XBUS_SIZE, DOMAIN_IO, 0, 1, 0, 0 } - -#else +static struct map_desc ebsa285_host_io_desc[] __initdata = { +#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_FOOTBRIDGE_HOST) + { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { PCICFG0_BASE, DC21285_PCI_TYPE_0_CONFIG, PCICFG0_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { PCICFG1_BASE, DC21285_PCI_TYPE_1_CONFIG, PCICFG1_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { PCIIACK_BASE, DC21285_PCI_IACK, PCIIACK_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, +#endif + LAST_DESC +}; /* - * The mapping when the footbridge is in add-in mode. + * The CO-ebsa285 mapping. */ -#define MAPPING \ - { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { XBUS_BASE, 0x40000000, XBUS_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { ARMCSR_BASE, DC21285_ARMCSR_BASE, ARMCSR_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { WFLUSH_BASE, DC21285_OUTBOUND_WRITE_FLUSH, WFLUSH_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { FLASH_BASE, DC21285_FLASH, FLASH_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, \ - { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 } - +static struct map_desc co285_io_desc[] __initdata = { +#ifdef CONFIG_ARCH_CO285 + { PCIO_BASE, DC21285_PCI_IO, PCIO_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, + { PCIMEM_BASE, DC21285_PCI_MEM, PCIMEM_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, #endif - -struct map_desc io_desc[] __initdata = { - MAPPING + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init footbridge_map_io(void) +{ + struct map_desc *desc = NULL; + + /* + * Set up the common mapping first; we need this to + * determine whether we're in host mode or not. + */ + iotable_init(fb_common_io_desc); + + /* + * Now, work out what we've got to map in addition on this + * platform. + */ + if (machine_is_co285()) + desc = co285_io_desc; + else if (footbridge_cfn_mode()) + desc = ebsa285_host_io_desc; + if (desc) + iotable_init(desc); +} #ifdef CONFIG_FOOTBRIDGE_ADDIN /* - * These two functions convert virtual addresses to PCI addresses - * and PCI addresses to virtual addresses. Note that it is only - * legal to use these on memory obtained via get_free_page or - * kmalloc. + * These two functions convert virtual addresses to PCI addresses and PCI + * addresses to virtual addresses. Note that it is only legal to use these + * on memory obtained via get_free_page or kmalloc. */ unsigned long __virt_to_bus(unsigned long res) { #ifdef CONFIG_DEBUG_ERRORS if (res < PAGE_OFFSET || res >= (unsigned long)high_memory) { - printk("__virt_to_phys: invalid virtual address 0x%08lx\n", res); + printk("__virt_to_bus: invalid virtual address 0x%08lx\n", res); __backtrace(); } #endif @@ -93,7 +107,7 @@ #ifdef CONFIG_DEBUG_ERRORS if (res < PAGE_OFFSET || res >= (unsigned long)high_memory) { - printk("__phys_to_virt: invalid virtual address 0x%08lx\n", res); + printk("__bus_to_virt: invalid virtual address 0x%08lx\n", res); __backtrace(); } #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-l7200.c linux/arch/arm/mm/mm-l7200.c --- v2.4.0-test8/linux/arch/arm/mm/mm-l7200.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/mm-l7200.c Mon Sep 18 15:15:25 2000 @@ -1,11 +1,10 @@ /* - * arch/arm/mm/mm-lusl7200.c + * linux/arch/arm/mm/mm-lusl7200.c * - * Extra MM routines for L7200 architecture + * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) * - * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) + * Extra MM routines for L7200 architecture */ - #include #include @@ -13,13 +12,15 @@ #include #include -#include "map.h" - -#define SIZE(x) (sizeof(x) / sizeof(x[0])) +#include -struct map_desc io_desc[] __initdata = { +static struct map_desc l7200_io_desc[] __initdata = { { IO_BASE, IO_START, IO_SIZE, DOMAIN_IO, 0, 1 ,0 ,0}, { IO_BASE_2, IO_START_2, IO_SIZE_2, DOMAIN_IO, 0, 1 ,0 ,0}, + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init l7200_map_io(void) +{ + iotable_init(l7200_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-nexuspci.c linux/arch/arm/mm/mm-nexuspci.c --- v2.4.0-test8/linux/arch/arm/mm/mm-nexuspci.c Mon Feb 28 14:16:37 2000 +++ linux/arch/arm/mm/mm-nexuspci.c Mon Sep 18 15:15:25 2000 @@ -1,13 +1,12 @@ /* - * arch/arm/mm/mm-nexuspci.c - * from arch/arm/mm/mm-ebsa110.c + * linux/arch/arm/mm/mm-nexuspci.c + * from linux/arch/arm/mm/mm-ebsa110.c * - * Extra MM routines for the FTV/PCI architecture + * Copyright (C) 1998-1999 Phil Blundell + * Copyright (C) 1998-1999 Russell King * - * Copyright (C) 1998-1999 Phil Blundell - * Copyright (C) 1998-1999 Russell King + * Extra MM routines for the FTV/PCI architecture */ - #include #include #include @@ -16,16 +15,18 @@ #include #include -#include "map.h" - -struct map_desc io_desc[] __initdata = { +#include + +static struct map_desc nexuspci_io_desc[] __initdata = { { INTCONT_BASE, INTCONT_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, { PLX_BASE, PLX_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, { PCIO_BASE, PLX_IO_START, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, { DUART_BASE, DUART_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { STATUS_BASE, STATUS_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 } + { STATUS_BASE, STATUS_START, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, + LAST_DESC }; -#define SIZE(x) (sizeof(x) / sizeof(x[0])) - -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init nexuspci_map_io(void) +{ + iotable_init(nexuspci_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-rpc.c linux/arch/arm/mm/mm-rpc.c --- v2.4.0-test8/linux/arch/arm/mm/mm-rpc.c Tue Apr 25 16:54:39 2000 +++ linux/arch/arm/mm/mm-rpc.c Mon Sep 18 15:15:25 2000 @@ -1,9 +1,13 @@ /* - * arch/arm/mm/mm-rpc.c + * linux/arch/arm/mm/mm-rpc.c * - * Extra MM routines for RiscPC architecture + * Copyright (C) 1998-1999 Russell King * - * Copyright (C) 1998-1999 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Extra MM routines for RiscPC architecture */ #include @@ -12,17 +16,16 @@ #include #include -#include "map.h" - -#define SIZE(x) (sizeof(x) / sizeof(x[0])) +#include -struct map_desc io_desc[] __initdata = { - /* VRAM */ - { SCREEN_BASE, SCREEN_START, 2*1048576, DOMAIN_IO, 0, 1, 0, 0 }, - /* IO space */ - { IO_BASE, IO_START, IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, - /* EASI space */ - { EASI_BASE, EASI_START, EASI_SIZE, DOMAIN_IO, 0, 1, 0, 0 } +static struct map_desc rpc_io_desc[] __initdata = { + { SCREEN_BASE, SCREEN_START, 2*1048576, DOMAIN_IO, 0, 1, 0, 0 }, /* VRAM */ + { IO_BASE, IO_START, IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, /* IO space */ + { EASI_BASE, EASI_START, EASI_SIZE, DOMAIN_IO, 0, 1, 0, 0 }, /* EASI space */ + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init rpc_map_io(void) +{ + iotable_init(rpc_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-sa1100.c linux/arch/arm/mm/mm-sa1100.c --- v2.4.0-test8/linux/arch/arm/mm/mm-sa1100.c Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/mm-sa1100.c Mon Sep 18 15:15:25 2000 @@ -1,20 +1,19 @@ /* - * arch/arm/mm/mm-sa1100.c + * linux/arch/arm/mm/mm-sa1100.c * - * Extra MM routines for the SA1100 architecture + * Copyright (C) 1998-1999 Russell King + * Copyright (C) 1999 Hugo Fiennes * - * Copyright (C) 1998-1999 Russell King - * Copyright (C) 1999 Hugo Fiennes + * Extra MM routines for the SA1100 architecture * - * 1999/12/04 Nicolas Pitre + * 1999/12/04 Nicolas Pitre * Converted memory definition for struct meminfo initialisations. * Memory is listed physically now. * - * 2000/04/07 Nicolas Pitre + * 2000/04/07 Nicolas Pitre * Reworked for run-time selection of memory definitions * */ - #include #include #include @@ -25,171 +24,158 @@ #include #include -#include "map.h" +#include -#define SIZE(x) (sizeof(x) / sizeof(x[0])) - - -#define SA1100_STD_IO_MAPPING \ +static struct map_desc standard_io_desc[] __initdata = { /* virtual physical length domain r w c b */ \ - { 0xe0000000, 0x20000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA0 IO */ \ - { 0xe4000000, 0x30000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA1 IO */ \ - { 0xe8000000, 0x28000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA0 attr */ \ - { 0xec000000, 0x38000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA1 attr */ \ - { 0xf0000000, 0x2c000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA0 mem */ \ - { 0xf4000000, 0x3c000000, 0x04000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA1 mem */ \ - { 0xf8000000, 0x80000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* PCM */ \ - { 0xfa000000, 0x90000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* SCM */ \ - { 0xfc000000, 0xa0000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* MER */ \ - { 0xfe000000, 0xb0000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 } /* LCD + DMA */ + { 0xf6000000, 0x20000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA0 IO */ + { 0xf7000000, 0x30000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* PCMCIA1 IO */ + { 0xf8000000, 0x80000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* PCM */ + { 0xfa000000, 0x90000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* SCM */ + { 0xfc000000, 0xa0000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* MER */ + { 0xfe000000, 0xb0000000, 0x02000000, DOMAIN_IO, 0, 1, 0, 0 }, /* LCD + DMA */ + LAST_DESC +}; +/* + * Typically, static virtual address mappings are as follow: + * + * 0xe8000000-0xefffffff: flash memory (especially when multiple flash + * banks need to be mapped contigously) + * 0xf0000000-0xf3ffffff: miscellaneous stuff (CPLDs, etc.) + * 0xf4000000-0xf4ffffff: SA-1111 + * 0xf5000000-0xf5ffffff: reserved (used by cache flushing area) + * 0xf6000000-0xffffffff: reserved (internal SA1100 IO defined above) + * + * Below 0xe8000000 is reserved for vm allocation. + */ static struct map_desc assabet_io_desc[] __initdata = { #ifdef CONFIG_SA1100_ASSABET - { 0xd0000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ - { 0xd4000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* System Registers */ - { 0xdc000000, 0x12000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Board Control Register */ - { 0xd8000000, 0x40000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* SA-1111 */ - SA1100_STD_IO_MAPPING -#endif -}; - -static struct map_desc nanoengine_io_desc[] __initdata = { -#ifdef CONFIG_SA1100_NANOENGINE - { 0xd0000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ - { 0xd4000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* System Registers */ - { 0xdc000000, 0x18A00000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Internal PCI Config Space */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ + { 0xf0000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* System Registers */ + { 0xf1000000, 0x12000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Board Control Register */ + { 0xf2800000, 0x4b800000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* MQ200 */ + { 0xf4000000, 0x40000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* SA-1111 */ #endif + LAST_DESC }; static struct map_desc bitsy_io_desc[] __initdata = { #ifdef CONFIG_SA1100_BITSY - { 0xd0000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ - { 0xdc000000, 0x49000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* EGPIO 0 */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ + { 0xf0000000, 0x49000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* EGPIO 0 */ #endif + LAST_DESC }; static struct map_desc cerf_io_desc[] __initdata = { #ifdef CONFIG_SA1100_CERF - { 0xd8000000, 0x08000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Crystal Chip */ - { 0xd0000000, 0x00000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ + { 0xf0000000, 0x08000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Crystal Chip */ #endif + LAST_DESC }; static struct map_desc empeg_io_desc[] __initdata = { #ifdef CONFIG_SA1100_EMPEG { EMPEG_FLASHBASE, 0x00000000, 0x00200000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash */ - SA1100_STD_IO_MAPPING #endif + LAST_DESC }; static struct map_desc graphicsclient_io_desc[] __initdata = { #ifdef CONFIG_SA1100_GRAPHICSCLIENT - { 0xd0000000, 0x08000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 */ - { 0xd0800000, 0x18000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 3 */ - { 0xdc000000, 0x10000000, 0x00400000, DOMAIN_IO, 0, 1, 0, 0 }, /* CPLD */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x08000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 */ + { 0xf0000000, 0x10000000, 0x00400000, DOMAIN_IO, 0, 1, 0, 0 }, /* CPLD */ #endif + LAST_DESC }; static struct map_desc lart_io_desc[] __initdata = { #ifdef CONFIG_SA1100_LART - { 0xd0000000, 0x00000000, 0x00400000, DOMAIN_IO, 1, 1, 0, 0 }, /* main flash memory */ - { 0xd8000000, 0x08000000, 0x00400000, DOMAIN_IO, 1, 1, 0, 0 }, /* main flash, alternative location */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x00400000, DOMAIN_IO, 1, 1, 0, 0 }, /* main flash memory */ + { 0xec000000, 0x08000000, 0x00400000, DOMAIN_IO, 1, 1, 0, 0 }, /* main flash, alternative location */ #endif + LAST_DESC +}; + +static struct map_desc nanoengine_io_desc[] __initdata = { +#ifdef CONFIG_SA1100_NANOENGINE + { 0xe8000000, 0x00000000, 0x02000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 */ + { 0xf0000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* System Registers */ + { 0xf1000000, 0x18A00000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* Internal PCI Config Space */ +#endif + LAST_DESC }; static struct map_desc thinclient_io_desc[] __initdata = { #ifdef CONFIG_SA1100_THINCLIENT #if 0 - { 0xd0000000, 0x00000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 when JP1 2-4 */ + { 0xe8000000, 0x00000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 0 when JP1 2-4 */ #else - { 0xd0000000, 0x08000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 when JP1 3-4 */ + { 0xe8000000, 0x08000000, 0x01000000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 when JP1 3-4 */ #endif - { 0xdc000000, 0x10000000, 0x00400000, DOMAIN_IO, 0, 1, 0, 0 }, /* CPLD */ - SA1100_STD_IO_MAPPING + { 0xf0000000, 0x10000000, 0x00400000, DOMAIN_IO, 0, 1, 0, 0 }, /* CPLD */ #endif + LAST_DESC }; static struct map_desc tifon_io_desc[] __initdata = { #ifdef CONFIG_SA1100_TIFON - { 0xd0000000, 0x00000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 */ - { 0xd0800000, 0x08000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 2 */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 1 */ + { 0xe8800000, 0x08000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash bank 2 */ #endif + LAST_DESC }; static struct map_desc victor_io_desc[] __initdata = { #ifdef CONFIG_SA1100_VICTOR - { 0xd0000000, 0x00000000, 0x00200000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash */ - SA1100_STD_IO_MAPPING + { 0xe8000000, 0x00000000, 0x00200000, DOMAIN_IO, 1, 1, 0, 0 }, /* Flash */ #endif + LAST_DESC }; static struct map_desc xp860_io_desc[] __initdata = { #ifdef CONFIG_SA1100_XP860 - { 0xd8000000, 0x40000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* SA-1111 */ - { 0xda000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* SCSI */ - { 0xdc000000, 0x18000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* LAN */ - SA1100_STD_IO_MAPPING + { 0xf4000000, 0x40000000, 0x00800000, DOMAIN_IO, 1, 1, 0, 0 }, /* SA-1111 */ + { 0xf0000000, 0x10000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* SCSI */ + { 0xf1000000, 0x18000000, 0x00100000, DOMAIN_IO, 1, 1, 0, 0 }, /* LAN */ #endif + LAST_DESC }; -static struct map_desc default_io_desc[] __initdata = { - SA1100_STD_IO_MAPPING -}; +void __init sa1100_map_io(void) +{ + struct map_desc *desc = NULL; + iotable_init(standard_io_desc); -/* - * Here it would be wiser to simply assign a pointer to the appropriate - * list, but io_desc is already declared as an array in "map.h". - */ -struct map_desc io_desc[20] __initdata = {}; -unsigned int io_desc_size; + if (machine_is_assabet()) + desc = assabet_io_desc; + else if (machine_is_nanoengine()) + desc = nanoengine_io_desc; + else if (machine_is_bitsy()) + desc = bitsy_io_desc; + else if (machine_is_cerf()) + desc = cerf_io_desc; + else if (machine_is_empeg()) + desc = empeg_io_desc; + else if (machine_is_graphicsclient()) + desc = graphicsclient_io_desc; + else if (machine_is_lart()) + desc = lart_io_desc; + else if (machine_is_thinclient()) + desc = thinclient_io_desc; + else if (machine_is_tifon()) + desc = tifon_io_desc; + else if (machine_is_victor()) + desc = victor_io_desc; + else if (machine_is_xp860()) + desc = xp860_io_desc; -void __init select_sa1100_io_desc(void) -{ - if( machine_is_assabet() ) { - memcpy( io_desc, assabet_io_desc, sizeof(assabet_io_desc) ); - io_desc_size = SIZE(assabet_io_desc); - } else if( machine_is_nanoengine() ) { - memcpy( io_desc, nanoengine_io_desc, sizeof(nanoengine_io_desc) ); - io_desc_size = SIZE(nanoengine_io_desc); - } else if( machine_is_bitsy() ) { - memcpy( io_desc, bitsy_io_desc, sizeof(bitsy_io_desc) ); - io_desc_size = SIZE(bitsy_io_desc); - } else if( machine_is_cerf() ) { - memcpy( io_desc, cerf_io_desc, sizeof(cerf_io_desc) ); - io_desc_size = SIZE(cerf_io_desc); - } else if( machine_is_empeg() ) { - memcpy( io_desc, empeg_io_desc, sizeof(empeg_io_desc) ); - io_desc_size = SIZE(empeg_io_desc); - } else if( machine_is_graphicsclient() ) { - memcpy( io_desc, graphicsclient_io_desc, sizeof(graphicsclient_io_desc) ); - io_desc_size = SIZE(graphicsclient_io_desc); - } else if( machine_is_lart() ) { - memcpy( io_desc, lart_io_desc, sizeof(lart_io_desc) ); - io_desc_size = SIZE(lart_io_desc); - } else if( machine_is_thinclient() ) { - memcpy( io_desc, thinclient_io_desc, sizeof(thinclient_io_desc) ); - io_desc_size = SIZE(thinclient_io_desc); - } else if( machine_is_tifon() ) { - memcpy( io_desc, tifon_io_desc, sizeof(tifon_io_desc) ); - io_desc_size = SIZE(tifon_io_desc); - } else if( machine_is_victor() ) { - memcpy( io_desc, victor_io_desc, sizeof(victor_io_desc) ); - io_desc_size = SIZE(victor_io_desc); - } else if( machine_is_xp860() ) { - memcpy( io_desc, xp860_io_desc, sizeof(xp860_io_desc) ); - io_desc_size = SIZE(xp860_io_desc); - } else { - memcpy( io_desc, default_io_desc, sizeof(default_io_desc) ); - io_desc_size = SIZE(default_io_desc); - } + if (desc) + iotable_init(desc); } diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-shark.c linux/arch/arm/mm/mm-shark.c --- v2.4.0-test8/linux/arch/arm/mm/mm-shark.c Mon Mar 27 10:46:29 2000 +++ linux/arch/arm/mm/mm-shark.c Wed Dec 31 16:00:00 1969 @@ -1,25 +0,0 @@ -/* - * arch/arm/mm/mm-shark.c - * - * by Alexander.Schulz@stud.uni-karlsruhe.de - */ -#include -#include -#include - -#include -#include -#include - -#include "map.h" - -struct map_desc io_desc[] __initdata = { - { IO_BASE , IO_START , IO_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, - { FB_BASE , FB_START , FB_SIZE , DOMAIN_IO, 0, 1, 0, 0 }, - { FBREG_BASE , FBREG_START , FBREG_SIZE , DOMAIN_IO, 0, 1, 0, 0 } -}; - - -#define SIZEOFMAP (sizeof(io_desc) / sizeof(io_desc[0])) - -unsigned int __initdata io_desc_size = SIZEOFMAP; diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/mm-tbox.c linux/arch/arm/mm/mm-tbox.c --- v2.4.0-test8/linux/arch/arm/mm/mm-tbox.c Fri Oct 29 11:42:57 1999 +++ linux/arch/arm/mm/mm-tbox.c Mon Sep 18 15:15:25 2000 @@ -1,13 +1,11 @@ /* - * arch/arm/mm/mm-tbox.c - * from arch/arm/mm/mm-ebsa110.c + * linux/arch/arm/mm/mm-tbox.c * - * Extra MM routines for the Tbox architecture + * Copyright (C) 1998, 1999, 2000 Phil Blundell + * Copyright (C) 1998-1999 Russell King * - * Copyright (C) 1998 Phil Blundell - * Copyright (C) 1998-1999 Russell King + * Extra MM routines for the Tbox architecture */ - #include #include #include @@ -16,44 +14,15 @@ #include #include -#include "map.h" +#include -#define SIZE(x) (sizeof(x) / sizeof(x[0])) - -/* Logical Physical - * 0xffff1000 0x00100000 DMA registers - * 0xffff2000 0x00200000 MPEG - * 0xffff3000 0x00300000 FPGA1 local control - * 0xffff4000 0x00400000 External serial - * 0xffff5000 0x00500000 Internal serial - * 0xffff6000 0x00600000 Parallel - * 0xffff7000 0x00700000 Interrupt control - * 0xffff8000 0x00800000 Computer video - * 0xffff9000 0x00900000 Control register 0 - * 0xffffs000 0x00a00000 Control register 1 - * 0xffffb000 0x00b00000 Control register 2 - * 0xffffc000 0x00c00000 FPGA2 local control - * 0xffffd000 0x00d00000 Interrupt reset - * 0xffffe000 0x00e00000 MPEG DMA throttle - */ - -const struct map_desc io_desc[] __initdata = { - { 0xffff0000, 0x01000000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff1000, 0x00100000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff2000, 0x00200000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff3000, 0x00300000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff4000, 0x00400000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xfe000000, 0x00400000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff5000, 0x00500000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff6000, 0x00600000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff7000, 0x00700000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff8000, 0x00800000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffff9000, 0x00900000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffffa000, 0x00a00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffffb000, 0x00b00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffffc000, 0x00c00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffffd000, 0x00d00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 }, - { 0xffffe000, 0x00e00000, 0x00001000, DOMAIN_IO, 0, 1, 0, 0 } +static struct map_desc tbox_io_desc[] __initdata = { + /* See hardware.h for details */ + { IO_BASE, IO_START, 0x00100000, DOMAIN_IO, 0, 1, 0, 0 }, + LAST_DESC }; -unsigned int __initdata io_desc_size = SIZE(io_desc); +void __init tbox_map_io(void) +{ + iotable_init(tbox_io_desc); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-arm2,3.S linux/arch/arm/mm/proc-arm2,3.S --- v2.4.0-test8/linux/arch/arm/mm/proc-arm2,3.S Mon Jun 26 12:04:01 2000 +++ linux/arch/arm/mm/proc-arm2,3.S Mon Sep 18 15:15:25 2000 @@ -1,10 +1,16 @@ /* - * linux/arch/arm/mm/proc-arm2,3.S: MMU functions for ARM2,3 + * linux/arch/arm/mm/proc-arm2,3.S * - * (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King * - * These are the low level assembler for performing cache - * and memory functions on ARM2, ARM250 and ARM3 processors. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * MMU functions for ARM2,3 + * + * These are the low level assembler for performing cache + * and memory functions on ARM2, ARM250 and ARM3 processors. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-arm6,7.S linux/arch/arm/mm/proc-arm6,7.S --- v2.4.0-test8/linux/arch/arm/mm/proc-arm6,7.S Mon Jun 26 12:04:01 2000 +++ linux/arch/arm/mm/proc-arm6,7.S Mon Sep 18 15:15:25 2000 @@ -1,20 +1,25 @@ /* - * linux/arch/arm/mm/proc-arm6,7.S: MMU functions for ARM6 + * linux/arch/arm/mm/proc-arm6,7.S * - * (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King * - * These are the low level assembler for performing cache and TLB - * functions on the ARM6 & ARM7. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * MMU functions for ARM6 + * + * These are the low level assembler for performing cache and TLB + * functions on the ARM6 & ARM7. */ #include #include #include -#include #include "../lib/constants.h" /* - * Function: arm6_7_flush_cache_all (void) - * : arm6_7_flush_cache_page (unsigned long address, int size, int flags) + * Function: arm6_7_cache_clean_invalidate_all (void) + * : arm6_7_cache_clean_invalidate_page (unsigned long address, int size, int flags) * * Params : address Area start address * : size size of area @@ -22,41 +27,41 @@ * * Purpose : Flush all cache lines */ -ENTRY(cpu_arm6_flush_cache_all) -ENTRY(cpu_arm7_flush_cache_all) -ENTRY(cpu_arm6_flush_cache_area) -ENTRY(cpu_arm7_flush_cache_area) -ENTRY(cpu_arm6_flush_cache_entry) -ENTRY(cpu_arm7_flush_cache_entry) -ENTRY(cpu_arm6_flush_icache_area) -ENTRY(cpu_arm7_flush_icache_area) -ENTRY(cpu_arm6_flush_icache_page) -ENTRY(cpu_arm7_flush_icache_page) -ENTRY(cpu_arm6_cache_wback_area) -ENTRY(cpu_arm7_cache_wback_area) -ENTRY(cpu_arm6_cache_purge_area) -ENTRY(cpu_arm7_cache_purge_area) +ENTRY(cpu_arm6_cache_clean_invalidate_all) +ENTRY(cpu_arm7_cache_clean_invalidate_all) +ENTRY(cpu_arm6_cache_clean_invalidate_range) +ENTRY(cpu_arm7_cache_clean_invalidate_range) +ENTRY(cpu_arm6_invalidate_icache_range) +ENTRY(cpu_arm7_invalidate_icache_range) +ENTRY(cpu_arm6_invalidate_icache_page) +ENTRY(cpu_arm7_invalidate_icache_page) +ENTRY(cpu_arm6_dcache_clean_range) +ENTRY(cpu_arm7_dcache_clean_range) +ENTRY(cpu_arm6_dcache_invalidate_range) +ENTRY(cpu_arm7_dcache_invalidate_range) mov r0, #0 mcr p15, 0, r0, c7, c0, 0 @ flush cache -ENTRY(cpu_arm6_clean_cache_area) -ENTRY(cpu_arm7_clean_cache_area) +ENTRY(cpu_arm6_dcache_clean_page) +ENTRY(cpu_arm7_dcache_clean_page) +ENTRY(cpu_arm6_dcache_clean_entry) +ENTRY(cpu_arm7_dcache_clean_entry) ENTRY(cpu_arm6_flush_ram_page) ENTRY(cpu_arm7_flush_ram_page) mov pc, lr /* - * Function: arm6_7_flush_tlb_all (void) + * Function: arm6_7_tlb_invalidate_all (void) * * Purpose : flush all TLB entries in all caches */ -ENTRY(cpu_arm6_flush_tlb_all) -ENTRY(cpu_arm7_flush_tlb_all) +ENTRY(cpu_arm6_tlb_invalidate_all) +ENTRY(cpu_arm7_tlb_invalidate_all) mov r0, #0 mcr p15, 0, r0, c5, c0, 0 @ flush TLB mov pc, lr /* - * Function: arm6_7_flush_tlb_page (unsigned long address, int end, int flags) + * Function: arm6_7_tlb_invalidate_page (unsigned long address, int end, int flags) * * Params : address Area start address * : end Area end address @@ -64,8 +69,8 @@ * * Purpose : flush a TLB entry */ -ENTRY(cpu_arm6_flush_tlb_area) -ENTRY(cpu_arm7_flush_tlb_area) +ENTRY(cpu_arm6_tlb_invalidate_range) +ENTRY(cpu_arm7_tlb_invalidate_range) 1: mcr p15, 0, r0, c6, c0, 0 @ flush TLB add r0, r0, #4096 cmp r0, r1 @@ -73,15 +78,15 @@ mov pc, lr /* - * Function: arm6_7_flush_tlb_page (unsigned long address, int flags) + * Function: arm6_7_tlb_invalidate_page (unsigned long address, int flags) * * Params : address Address * : flags b0 = I-TLB as well * * Purpose : flush a TLB entry */ -ENTRY(cpu_arm6_flush_tlb_page) -ENTRY(cpu_arm7_flush_tlb_page) +ENTRY(cpu_arm6_tlb_invalidate_page) +ENTRY(cpu_arm7_tlb_invalidate_page) mcr p15, 0, r0, c6, c0, 0 @ flush TLB mov pc, lr @@ -392,23 +397,33 @@ .word cpu_arm6_check_bugs .word cpu_arm6_proc_init .word cpu_arm6_proc_fin - .word cpu_arm6_flush_cache_all - .word cpu_arm6_flush_cache_area - .word cpu_arm6_flush_cache_entry - .word cpu_arm6_clean_cache_area + .word cpu_arm6_reset + .word cpu_arm6_do_idle + + /* cache */ + .word cpu_arm6_cache_clean_invalidate_all + .word cpu_arm6_cache_clean_invalidate_range .word cpu_arm6_flush_ram_page - .word cpu_arm6_flush_tlb_all - .word cpu_arm6_flush_tlb_area + + /* dcache */ + .word cpu_arm6_dcache_invalidate_range + .word cpu_arm6_dcache_clean_range + .word cpu_arm6_dcache_clean_page + .word cpu_arm6_dcache_clean_entry + + /* icache */ + .word cpu_arm6_invalidate_icache_range + .word cpu_arm6_invalidate_icache_page + + /* tlb */ + .word cpu_arm6_tlb_invalidate_all + .word cpu_arm6_tlb_invalidate_range + .word cpu_arm6_tlb_invalidate_page + + /* pgtable */ .word cpu_arm6_set_pgd .word cpu_arm6_set_pmd .word cpu_arm6_set_pte - .word cpu_arm6_reset - .word cpu_arm6_flush_icache_area - .word cpu_arm6_cache_wback_area - .word cpu_arm6_cache_purge_area - .word cpu_arm6_flush_tlb_page - .word cpu_arm6_do_idle - .word cpu_arm6_flush_icache_page .size arm6_processor_functions, . - arm6_processor_functions /* @@ -421,23 +436,33 @@ .word cpu_arm7_check_bugs .word cpu_arm7_proc_init .word cpu_arm7_proc_fin - .word cpu_arm7_flush_cache_all - .word cpu_arm7_flush_cache_area - .word cpu_arm7_flush_cache_entry - .word cpu_arm7_clean_cache_area + .word cpu_arm7_reset + .word cpu_arm7_do_idle + + /* cache */ + .word cpu_arm7_cache_clean_invalidate_all + .word cpu_arm7_cache_clean_invalidate_range .word cpu_arm7_flush_ram_page - .word cpu_arm7_flush_tlb_all - .word cpu_arm7_flush_tlb_area + + /* dcache */ + .word cpu_arm7_dcache_invalidate_range + .word cpu_arm7_dcache_clean_range + .word cpu_arm7_dcache_clean_page + .word cpu_arm7_dcache_clean_entry + + /* icache */ + .word cpu_arm7_invalidate_icache_range + .word cpu_arm7_invalidate_icache_page + + /* tlb */ + .word cpu_arm7_tlb_invalidate_all + .word cpu_arm7_tlb_invalidate_range + .word cpu_arm7_tlb_invalidate_page + + /* pgtable */ .word cpu_arm7_set_pgd .word cpu_arm7_set_pmd .word cpu_arm7_set_pte - .word cpu_arm7_reset - .word cpu_arm7_flush_icache_area - .word cpu_arm7_cache_wback_area - .word cpu_arm7_cache_purge_area - .word cpu_arm7_flush_tlb_page - .word cpu_arm7_do_idle - .word cpu_arm7_flush_icache_page .size arm7_processor_functions, . - arm7_processor_functions .type cpu_arm6_info, #object @@ -479,7 +504,7 @@ __arm6_proc_info: .long 0x41560600 .long 0xfffffff0 - .long 0x00000c12 + .long 0x00000c1e b __arm6_setup .long cpu_arch_name .long cpu_elf_name @@ -492,7 +517,7 @@ __arm610_proc_info: .long 0x41560610 .long 0xfffffff0 - .long 0x00000c12 + .long 0x00000c1e b __arm6_setup .long cpu_arch_name .long cpu_elf_name @@ -505,7 +530,7 @@ __arm7_proc_info: .long 0x41007000 .long 0xffffff00 - .long 0x00000c12 + .long 0x00000c1e b __arm7_setup .long cpu_arch_name .long cpu_elf_name @@ -518,7 +543,7 @@ __arm710_proc_info: .long 0x41007100 .long 0xfff8ff00 - .long 0x00000c12 + .long 0x00000c1e b __arm7_setup .long cpu_arch_name .long cpu_elf_name diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-arm720.S linux/arch/arm/mm/proc-arm720.S --- v2.4.0-test8/linux/arch/arm/mm/proc-arm720.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/proc-arm720.S Mon Sep 18 15:15:25 2000 @@ -1,27 +1,44 @@ /* - * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720 + * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720 + * + * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) + * Rob Scott (rscott@mtrob.fdns.net) + * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd. + * + * 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 * - * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) - * Rob Scott (rscott@mtrob.fdns.net) * * These are the low level assembler for performing cache and TLB - * functions on the ARM720T. + * functions on the ARM720T. The ARM720T has a writethrough IDC + * cache, so we don't need to clean it. * - * Changelog: - * 05-09-2000 SJH Created by moving 720 specific functions - * out of 'proc-arm6,7.S' per RSK discussion - * 07-25-2000 SJH Added idle function. + * Changelog: + * 05-09-2000 SJH Created by moving 720 specific functions + * out of 'proc-arm6,7.S' per RMK discussion + * 07-25-2000 SJH Added idle function. + * 08-25-2000 DBS Updated for integration of ARM Ltd version. */ #include #include #include -#include #include #include "../lib/constants.h" /* - * Function: arm720_flush_cache_all (void) - * : arm720_flush_cache_page (unsigned long address, int size, + * Function: arm720_cache_clean_invalidate_all (void) + * : arm720_cache_clean_invalidate_page (unsigned long address, int size, * int flags) * * Params : address Area start address @@ -30,33 +47,37 @@ * * Purpose : Flush all cache lines */ -ENTRY(cpu_arm720_flush_cache_all) -ENTRY(cpu_arm720_flush_cache_area) -ENTRY(cpu_arm720_flush_cache_entry) -ENTRY(cpu_arm720_flush_icache_area) -ENTRY(cpu_arm720_flush_icache_page) -ENTRY(cpu_arm720_cache_wback_area) -ENTRY(cpu_arm720_cache_purge_area) +ENTRY(cpu_arm720_cache_clean_invalidate_all) +ENTRY(cpu_arm720_cache_clean_invalidate_range) +ENTRY(cpu_arm720_icache_invalidate_range) +ENTRY(cpu_arm720_icache_invalidate_page) +ENTRY(cpu_arm720_dcache_invalidate_range) mov r0, #0 mcr p15, 0, r0, c7, c7, 0 @ flush cache mov pc, lr -ENTRY(cpu_arm720_clean_cache_area) +/* + * These just expect cache lines to be cleaned. Since we have a writethrough + * cache, we never have any dirty cachelines to worry about. + */ +ENTRY(cpu_arm720_dcache_clean_range) +ENTRY(cpu_arm720_dcache_clean_page) +ENTRY(cpu_arm720_dcache_clean_entry) ENTRY(cpu_arm720_flush_ram_page) mov pc, lr /* - * Function: arm720_flush_tlb_all (void) + * Function: arm720_tlb_invalidate_all (void) * * Purpose : flush all TLB entries in all caches */ -ENTRY(cpu_arm720_flush_tlb_all) +ENTRY(cpu_arm720_tlb_invalidate_all) mov r0, #0 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) mov pc, lr /* - * Function: arm720_flush_tlb_page (unsigned long address, int end, int flags) + * Function: arm720_tlb_invalidate_page (unsigned long address, int end, int flags) * * Params : address Area start address * : end Area end address @@ -64,7 +85,7 @@ * * Purpose : flush a TLB entry */ -ENTRY(cpu_arm720_flush_tlb_area) +ENTRY(cpu_arm720_tlb_invalidate_range) 1: mcr p15, 0, r0, c8, c7, 1 @ flush TLB (v4) add r0, r0, #4096 cmp r0, r1 @@ -72,14 +93,14 @@ mov pc, lr /* - * Function: arm720_flush_tlb_page (unsigned long address, int flags) + * Function: arm720_tlb_invalidate_page (unsigned long address, int flags) * * Params : address Address * : flags b0 = I-TLB as well * * Purpose : flush a TLB entry */ -ENTRY(cpu_arm720_flush_tlb_page) +ENTRY(cpu_arm720_tlb_invalidate_page) mcr p15, 0, r0, c8, c7, 1 @ flush TLB (v4) mov pc, lr @@ -262,12 +283,15 @@ mov pc, lr ENTRY(cpu_arm720_proc_fin) - mrs r0, cpsr - orr r0, r0, #F_BIT | I_BIT - msr cpsr, r0 - mov r0, #0x31 @ ....S..DP...M + stmfd sp!, {lr} + mov ip, #F_BIT | I_BIT | SVC_MODE + msr cpsr_c, ip + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x1000 @ ...i............ + bic r0, r0, #0x000e @ ............wca. mcr p15, 0, r0, c1, c0, 0 @ disable caches - mov pc, lr + mcr p15, 0, r1, c7, c7, 0 @ invalidate cache + ldmfd sp!, {pc} /* * Function: arm720_proc_do_idle (void) @@ -281,10 +305,12 @@ * Purpose : put the processer in proper idle mode */ ENTRY(cpu_arm720_do_idle) +#if 0 /* FIXME: is this part of the processor? */ ldr r2, =IO_BASE @ Virt addr of IO add r2, r2, #0x00050000 @ Start of PMU regs mov r1, #0x01 @ Idle mode - str r1, [r2, #4] + str r1, [r2, #4] +#endif mov pc, lr /* @@ -295,7 +321,7 @@ */ ENTRY(cpu_arm720_set_pgd) mov r1, #0 - mcr p15, 0, r1, c7, c7, 0 @ flush cache + mcr p15, 0, r1, c7, c7, 0 @ invalidate cache mcr p15, 0, r0, c2, c0, 0 @ update page table ptr mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4) mov pc, lr @@ -340,9 +366,6 @@ movne r2, #0 str r2, [r0] @ hardware version - - mcr p15, 0, r0, c7, c7, 0 @ flush cache - mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) mov pc, lr /* @@ -351,30 +374,37 @@ * Notes : This sets up everything for a reset */ ENTRY(cpu_arm720_reset) - mov r0, #0 - mcr p15, 0, r0, c7, c7, 0 @ flush cache - mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) - mov pc, lr + mov ip, #0 + mcr p15, 0, ip, c7, c7, 0 @ invalidate cache + mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4) + mrc p15, 0, ip, c1, c0, 0 @ get ctrl register + bic ip, ip, #0x000f @ ............wcam + bic ip, ip, #0x2100 @ ..v....s........ + mcr p15, 0, ip, c1, c0, 0 @ ctrl register + mov pc, r0 cpu_armvlsi_name: .asciz "ARM/VLSI" cpu_arm720_name: - .asciz "ARM 720" + .asciz "ARM720T" .align .section ".text.init", #alloc, #execinstr __arm720_setup: mov r0, #0 - mcr p15, 0, r0, c7, c7, 0 @ flush caches on v4 + mcr p15, 0, r0, c7, c7, 0 @ invalidate caches mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4) mcr p15, 0, r4, c2, c0 @ load page table pointer mov r0, #0x1f @ Domains 0, 1 = client mcr p15, 0, r0, c3, c0 @ load domain access register - - /* Set CP15 Control reg bits (RSBLDPWCAM) */ - mov r0, #0x7d @ ...LDPWC.M - orr r0, r0, #0x100 @ .S.LDPWC.M + + mrc p15, 0, r0, c1, c0 @ get control register + bic r0, r0, #0x2e00 + bic r0, r0, #0x000e + orr r0, r0, #0x0031 @ ..V...RSBLDPWCAM + orr r0, r0, #0x0100 @ .........111.... (old) + orr r0, r0, #0x000c @ ..0...01..111101 (new) mov pc, lr @ __ret (head-armv.S) /* @@ -387,23 +417,33 @@ .word cpu_arm720_check_bugs .word cpu_arm720_proc_init .word cpu_arm720_proc_fin - .word cpu_arm720_flush_cache_all - .word cpu_arm720_flush_cache_area - .word cpu_arm720_flush_cache_entry - .word cpu_arm720_clean_cache_area + .word cpu_arm720_reset + .word cpu_arm720_do_idle + + /* cache */ + .word cpu_arm720_cache_clean_invalidate_all + .word cpu_arm720_cache_clean_invalidate_range .word cpu_arm720_flush_ram_page - .word cpu_arm720_flush_tlb_all - .word cpu_arm720_flush_tlb_area + + /* dcache */ + .word cpu_arm720_dcache_invalidate_range + .word cpu_arm720_dcache_clean_range + .word cpu_arm720_dcache_clean_page + .word cpu_arm720_dcache_clean_entry + + /* icache */ + .word cpu_arm720_icache_invalidate_range + .word cpu_arm720_icache_invalidate_page + + /* tlb */ + .word cpu_arm720_tlb_invalidate_all + .word cpu_arm720_tlb_invalidate_range + .word cpu_arm720_tlb_invalidate_page + + /* pgtable */ .word cpu_arm720_set_pgd .word cpu_arm720_set_pmd .word cpu_arm720_set_pte - .word cpu_arm720_reset - .word cpu_arm720_flush_icache_area - .word cpu_arm720_cache_wback_area - .word cpu_arm720_cache_purge_area - .word cpu_arm720_flush_tlb_page - .word cpu_arm720_do_idle - .word cpu_arm720_flush_icache_page .size arm720_processor_functions, . - arm720_processor_functions .type cpu_arm720_info, #object @@ -431,11 +471,11 @@ __arm720_proc_info: .long 0x41807200 @ cpu_val .long 0xffffff00 @ cpu_mask - .long 0x00000c12 @ __cpu_mmu_flags + .long 0x00000c0e @ __cpu_mmu_flags b __arm720_setup @ --cpu_flush .long cpu_arch_name @ arch_name .long cpu_elf_name @ elf_name - .long HWCAP_SWP | HWCAP_26BIT @ elf_hwcap + .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT @ elf_hwcap .long cpu_arm720_info @ info .long arm720_processor_functions .size __arm720_proc_info, . - __arm720_proc_info diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-arm920.S linux/arch/arm/mm/proc-arm920.S --- v2.4.0-test8/linux/arch/arm/mm/proc-arm920.S Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mm/proc-arm920.S Mon Sep 18 15:15:25 2000 @@ -0,0 +1,602 @@ +/* + * linux/arch/arm/mm/arm920.S: MMU functions for ARM920 + * + * Copyright (C) 1999,2000 ARM Limited + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * + * 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 + * + * + * These are the low level assembler for performing cache and TLB + * functions on the arm920. + */ +#include +#include +#include +#include +#include +#include "../lib/constants.h" + +/* + * This is the maximum size of an area which will be invalidated + * using the single invalidate entry instructions. Anything larger + * than this, and we go for the whole cache. + * + * This value should be chosen such that we choose the cheapest + * alternative. + */ +#define MAX_AREA_SIZE 16384 + +/* + * the cache line size of the I and D cache + */ +#define DCACHELINESIZE 32 +#define ICACHELINESIZE 32 + +/* + * and the page size + */ +#define PAGESIZE 4096 + + .text + +/* + * cpu_arm920_data_abort() + * + * obtain information about current aborted instruction + * + * r0 = address of aborted instruction + * + * Returns: + * r0 = address of abort + * r1 != 0 if writing + * r3 = FSR + */ + .align 5 +ENTRY(cpu_arm920_data_abort) + ldr r1, [r0] @ read aborted instruction + mrc p15, 0, r0, c6, c0, 0 @ get FAR + mov r1, r1, lsr #19 @ b1 = L + mrc p15, 0, r3, c5, c0, 0 @ get FSR + and r1, r1, #2 + and r3, r3, #255 + mov pc, lr + +/* + * cpu_arm920_check_bugs() + */ +ENTRY(cpu_arm920_check_bugs) + mrs ip, cpsr + bic ip, ip, #F_BIT + msr cpsr, ip + mov pc, lr + +/* + * cpu_arm920_proc_init() + */ +ENTRY(cpu_arm920_proc_init) + mov pc, lr + +/* + * cpu_arm920_proc_fin() + */ +ENTRY(cpu_arm920_proc_fin) + stmfd sp!, {lr} + mov ip, #F_BIT | I_BIT | SVC_MODE + msr cpsr_c, ip + bl cpu_arm920_cache_clean_invalidate_all + mrc p15, 0, r0, c1, c0, 0 @ ctrl register + bic r0, r0, #0x1000 @ ...i............ + bic r0, r0, #0x000e @ ............wca. + mcr p15, 0, r0, c1, c0, 0 @ disable caches + ldmfd sp!, {pc} + +/* + * cpu_arm920_reset(loc) + * + * Perform a soft reset of the system. Put the CPU into the + * same state as it would be if it had been reset, and branch + * to what would be the reset vector. + * + * loc: location to jump to for soft reset + */ + .align 5 +ENTRY(cpu_arm920_reset) + mov ip, #0 + mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs + mrc p15, 0, ip, c1, c0, 0 @ ctrl register + bic ip, ip, #0x000f @ ............wcam + bic ip, ip, #0x1100 @ ...i...s........ + mcr p15, 0, ip, c1, c0, 0 @ ctrl register + mov pc, r0 + +/* + * cpu_arm920_do_idle() + */ + .align 5 +ENTRY(cpu_arm920_do_idle) +#if defined(CONFIG_CPU_ARM920_CPU_IDLE) + mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt +#endif + mov pc, lr + +/* ================================= CACHE ================================ */ + + +/* + * cpu_arm920_cache_clean_invalidate_all() + * + * clean and invalidate all cache lines + * + * Note: + * 1. we should preserve r0 at all times + */ + .align 5 +ENTRY(cpu_arm920_cache_clean_invalidate_all) + mov r2, #1 +cpu_arm920_cache_clean_invalidate_all_r2: + mov ip, #0 +#ifdef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache +#else +/* + * 'Clean & Invalidate whole DCache' + * Re-written to use Index Ops. + * Uses registers r1, r3 and ip + */ + mov r1, #7 << 5 @ 8 segments +1: orr r3, r1, #63 << 26 @ 64 entries +2: mcr p15, 0, r3, c7, c14, 2 @ clean & invalidate D index + subs r3, r3, #1 << 26 + bcs 2b @ entries 63 to 0 + subs r1, r1, #1 << 5 + bcs 1b @ segments 7 to 0 +#endif + teq r2, #0 + mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mov pc, lr + +/* + * cpu_arm920_cache_clean_invalidate_range(start, end, flags) + * + * clean and invalidate all cache lines associated with this area of memory + * + * start: Area start address + * end: Area end address + * flags: nonzero for I cache as well + */ + .align 5 +ENTRY(cpu_arm920_cache_clean_invalidate_range) + bic r0, r0, #DCACHELINESIZE - 1 @ && added by PGM + sub r3, r1, r0 + cmp r3, #MAX_AREA_SIZE + bgt cpu_arm920_cache_clean_invalidate_all_r2 +1: mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blt 1b + teq r2, #0 + movne r0, #0 + mcrne p15, 0, r0, c7, c5, 0 @ invalidate I cache + mov pc, lr + +/* + * cpu_arm920_flush_ram_page(page) + * + * clean and invalidate all cache lines associated with this area of memory + * + * page: page to clean and invalidate + */ + .align 5 +ENTRY(cpu_arm920_flush_ram_page) + mov r1, #PAGESIZE +1: mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bne 1b + mcr p15, 0, r1, c7, c10, 4 @ drain WB + mov pc, lr + +/* ================================ D-CACHE =============================== */ + +/* + * cpu_arm920_dcache_invalidate_range(start, end) + * + * throw away all D-cached data in specified region without an obligation + * to write them back. Note however that we must clean the D-cached entries + * around the boundaries if the start and/or end address are not cache + * aligned. + * + * start: virtual start address + * end: virtual end address + */ + .align 5 +ENTRY(cpu_arm920_dcache_invalidate_range) + tst r0, #DCACHELINESIZE - 1 + bic r0, r0, #DCACHELINESIZE - 1 + mcrne p15, 0, r0, c7, c10, 1 @ clean D entry + tst r1, #DCACHELINESIZE - 1 + mcrne p15, 0, r1, c7, c10, 1 @ clean D entry +1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blt 1b + mov pc, lr + +/* + * cpu_arm920_dcache_clean_range(start, end) + * + * For the specified virtual address range, ensure that all caches contain + * clean data, such that peripheral accesses to the physical RAM fetch + * correct data. + * + * start: virtual start address + * end: virtual end address + */ + .align 5 +ENTRY(cpu_arm920_dcache_clean_range) + bic r0, r0, #DCACHELINESIZE - 1 + sub r1, r1, r0 + cmp r1, #MAX_AREA_SIZE + mov r2, #0 + bgt cpu_arm920_cache_clean_invalidate_all_r2 + +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bpl 1b + mcr p15, 0, r2, c7, c10, 4 @ drain WB + mov pc, lr + +/* + * cpu_arm920_dcache_clean_page(page) + * + * Cleans a single page of dcache so that if we have any future aliased + * mappings, they will be consistent at the time that they are created. + * + * page: virtual address of page to clean from dcache + * + * Note: + * 1. we don't need to flush the write buffer in this case. + * 2. we don't invalidate the entries since when we write the page + * out to disk, the entries may get reloaded into the cache. + */ + .align 5 +ENTRY(cpu_arm920_dcache_clean_page) +#ifndef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + mov r1, #PAGESIZE +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bne 1b +#endif + mov pc, lr + +/* + * cpu_arm920_dcache_clean_entry(addr) + * + * Clean the specified entry of any caches such that the MMU + * translation fetches will obtain correct data. + * + * addr: cache-unaligned virtual address + */ + .align 5 +ENTRY(cpu_arm920_dcache_clean_entry) +#ifndef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + mcr p15, 0, r0, c7, c10, 1 @ clean D entry +#endif + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr + +/* ================================ I-CACHE =============================== */ + +/* + * cpu_arm920_icache_invalidate_range(start, end) + * + * invalidate a range of virtual addresses from the Icache + * + * start: virtual start address + * end: virtual end address + */ + .align 5 +ENTRY(cpu_arm920_icache_invalidate_range) +1: mcr p15, 0, r0, c7, c10, 1 @ Clean D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blo 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 @ drain WB +ENTRY(cpu_arm920_icache_invalidate_page) + /* why no invalidate I cache --rmk */ + mov pc, lr + + +/* ================================== TLB ================================= */ + +/* + * cpu_arm920_tlb_invalidate_all() + * + * Invalidate all TLB entries + */ + .align 5 +ENTRY(cpu_arm920_tlb_invalidate_all) + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mcr p15, 0, r0, c8, c7, 0 @ invalidate I & D TLBs + mov pc, lr + +/* + * cpu_arm920_tlb_invalidate_range(start, end) + * + * invalidate TLB entries covering the specified range + * + * start: range start address + * end: range end address + */ + .align 5 +ENTRY(cpu_arm920_tlb_invalidate_range) + mov r3, #0 + mcr p15, 0, r3, c7, c10, 4 @ drain WB +1: mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry + mcr p15, 0, r0, c8, c5, 1 @ invalidate I TLB entry + add r0, r0, #PAGESIZE + cmp r0, r1 + blt 1b + mov pc, lr + +/* + * cpu_arm920_tlb_invalidate_page(page, flags) + * + * invalidate the TLB entries for the specified page. + * + * page: page to invalidate + * flags: non-zero if we include the I TLB + */ + .align 5 +ENTRY(cpu_arm920_tlb_invalidate_page) + mov r3, #0 + mcr p15, 0, r3, c7, c10, 4 @ drain WB + teq r1, #0 + mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry + mcrne p15, 0, r0, c8, c5, 1 @ invalidate I TLB entry + mov pc, lr + +/* =============================== PageTable ============================== */ + +/* + * cpu_arm920_set_pgd(pgd) + * + * Set the translation base pointer to be as described by pgd. + * + * pgd: new page tables + */ + .align 5 +ENTRY(cpu_arm920_set_pgd) + mov ip, #0 +#ifdef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + /* Any reason why we don't use mcr p15, 0, r0, c7, c7, 0 here? --rmk */ + mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache +#else +@ && 'Clean & Invalidate whole DCache' +@ && Re-written to use Index Ops. +@ && Uses registers r1, r3 and ip + + mov r1, #7 << 5 @ 8 segments +1: orr r3, r1, #63 << 26 @ 64 entries +2: mcr p15, 0, r3, c7, c14, 2 @ clean & invalidate D index + subs r3, r3, #1 << 26 + bcs 2b @ entries 63 to 0 + subs r1, r1, #1 << 5 + bcs 1b @ segments 7 to 0 +#endif + mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mcr p15, 0, r0, c2, c0, 0 @ load page table pointer + mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs + mov pc, lr + +/* + * cpu_arm920_set_pmd(pmdp, pmd) + * + * Set a level 1 translation table entry, and clean it out of + * any caches such that the MMUs can load it correctly. + * + * pmdp: pointer to PMD entry + * pmd: PMD value to store + */ + .align 5 +ENTRY(cpu_arm920_set_pmd) +#ifdef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + eor r2, r1, #0x0a @ C & Section + tst r2, #0x0b + biceq r1, r1, #4 @ clear bufferable bit +#endif + str r1, [r0] + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr + +/* + * cpu_arm920_set_pte(ptep, pte) + * + * Set a PTE and flush it out + */ + .align 5 +ENTRY(cpu_arm920_set_pte) + str r1, [r0], #-1024 @ linux version + + eor r1, r1, #LPTE_PRESENT | LPTE_YOUNG | LPTE_WRITE | LPTE_DIRTY + + bic r2, r1, #0xff0 + bic r2, r2, #3 + orr r2, r2, #HPTE_TYPE_SMALL + + tst r1, #LPTE_USER | LPTE_EXEC @ User or Exec? + orrne r2, r2, #HPTE_AP_READ + + tst r1, #LPTE_WRITE | LPTE_DIRTY @ Write and Dirty? + orreq r2, r2, #HPTE_AP_WRITE + + tst r1, #LPTE_PRESENT | LPTE_YOUNG @ Present and Young? + movne r2, #0 + +#ifdef CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH + eor r3, r1, #0x0a @ C & small page? + tst r3, #0x0b + biceq r2, r2, #4 +#endif + str r2, [r0] @ hardware version + mov r0, r0 + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr + + +cpu_manu_name: + .asciz "ARM/VLSI" +ENTRY(cpu_arm920_name) + .ascii "Arm920" +#if defined(CONFIG_CPU_ARM920_CPU_IDLE) + .ascii "s" +#endif +#if defined(CONFIG_CPU_ARM920_I_CACHE_ON) + .ascii "i" +#endif +#if defined(CONFIG_CPU_ARM920_D_CACHE_ON) + .ascii "d" +#if defined(CONFIG_CPU_ARM920_FORCE_WRITE_THROUGH) + .ascii "(wt)" +#else + .ascii "(wb)" +#endif +#endif + .ascii "\0" + .align + + .section ".text.init", #alloc, #execinstr + +__arm920_setup: + mov r0, #0 + mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 + mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 + mcr p15, 0, r4, c2, c0 @ load page table pointer + mov r0, #0x1f @ Domains 0, 1 = client + mcr p15, 0, r0, c3, c0 @ load domain access register + mrc p15, 0, r0, c1, c0 @ get control register v4 +/* + * Clear out 'unwanted' bits (then put them in if we need them) + */ + bic r0, r0, #0x0e00 @ ....??r......... + bic r0, r0, #0x0002 @ ..............a. + bic r0, r0, #0x000c @ W,D + bic r0, r0, #0x1000 @ I +/* + * Turn on what we want + */ + orr r0, r0, #0x0031 @ ..........DP...M + orr r0, r0, #0x0100 @ .......S........ + +#ifdef CONFIG_CPU_ARM920_D_CACHE_ON + orr r0, r0, #0x0004 @ Enable D cache +#endif +#ifdef CONFIG_CPU_ARM920_I_CACHE_ON + orr r0, r0, #0x1000 @ I Cache on +#endif + mov pc, lr + + .text + +/* + * Purpose : Function pointers used to access above functions - all calls + * come through these + */ + .type arm920_processor_functions, #object +arm920_processor_functions: + .word cpu_arm920_data_abort + .word cpu_arm920_check_bugs + .word cpu_arm920_proc_init + .word cpu_arm920_proc_fin + .word cpu_arm920_reset + .word cpu_arm920_do_idle + + /* cache */ + .word cpu_arm920_cache_clean_invalidate_all + .word cpu_arm920_cache_clean_invalidate_range + .word cpu_arm920_flush_ram_page + + /* dcache */ + .word cpu_arm920_dcache_invalidate_range + .word cpu_arm920_dcache_clean_range + .word cpu_arm920_dcache_clean_page + .word cpu_arm920_dcache_clean_entry + + /* icache */ + .word cpu_arm920_icache_invalidate_range + .word cpu_arm920_icache_invalidate_page + + /* tlb */ + .word cpu_arm920_tlb_invalidate_all + .word cpu_arm920_tlb_invalidate_range + .word cpu_arm920_tlb_invalidate_page + + /* pgtable */ + .word cpu_arm920_set_pgd + .word cpu_arm920_set_pmd + .word cpu_arm920_set_pte + .size arm920_processor_functions, . - arm920_processor_functions + + .type cpu_arm920_info, #object +cpu_arm920_info: + .long cpu_manu_name + .long cpu_arm920_name + .size cpu_arm920_info, . - cpu_arm920_info + + .type cpu_arch_name, #object +cpu_arch_name: + .asciz "armv4" + .size cpu_arch_name, . - cpu_arch_name + + .type cpu_elf_name, #object +cpu_elf_name: + .asciz "v4" + .size cpu_elf_name, . - cpu_elf_name + .align + + .section ".proc.info", #alloc, #execinstr + + .type __arm920_proc_info,#object +__arm920_proc_info: + .long 0x41009200 + .long 0xff00fff0 + .long 0x00000c1e @ mmuflags + b __arm920_setup + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT + .long cpu_arm920_info + .long arm920_processor_functions + .size __arm920_proc_info, . - __arm920_proc_info diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-sa110.S linux/arch/arm/mm/proc-sa110.S --- v2.4.0-test8/linux/arch/arm/mm/proc-sa110.S Sun Aug 13 09:54:15 2000 +++ linux/arch/arm/mm/proc-sa110.S Mon Sep 18 15:15:25 2000 @@ -1,15 +1,21 @@ /* - * linux/arch/arm/mm/proc-sa110.S: MMU functions for SA110 + * linux/arch/arm/mm/proc-sa110.S * - * (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King * - * These are the low level assembler for performing cache and TLB - * functions on the StrongARM-110, StrongARM-1100 and StrongARM-1110. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * MMU functions for SA110 + * + * These are the low level assembler for performing cache and TLB + * functions on the StrongARM-110, StrongARM-1100 and StrongARM-1110. * - * Note that SA1100 and SA1110 share everything but their name and CPU ID. + * Note that SA1100 and SA1110 share everything but their name and CPU ID. * - * 12-jun-2000, Erik Mouw (J.A.K.Mouw@its.tudelft.nl): - * Flush the read buffer at context switches + * 12-jun-2000, Erik Mouw (J.A.K.Mouw@its.tudelft.nl): + * Flush the read buffer at context switches */ #include #include @@ -21,24 +27,35 @@ * is larger than this, then we flush the whole cache */ #define MAX_AREA_SIZE 32768 + +/* + * the cache line size of the I and D cache + */ +#define DCACHELINESIZE 32 + +/* + * and the page size + */ +#define PAGESIZE 4096 + #define FLUSH_OFFSET 32768 .macro flush_110_dcache rd, ra, re add \re, \ra, #16384 @ only necessary for 16k -1001: ldr \rd, [\ra], #32 +1001: ldr \rd, [\ra], #DCACHELINESIZE teq \re, \ra bne 1001b .endm .macro flush_1100_dcache rd, ra, re add \re, \ra, #8192 @ only necessary for 8k -1001: ldr \rd, [\ra], #32 +1001: ldr \rd, [\ra], #DCACHELINESIZE teq \re, \ra bne 1001b #ifdef FLUSH_BASE_MINICACHE add \ra, \ra, #FLUSH_BASE_MINICACHE - FLUSH_BASE add \re, \ra, #512 @ only 512 bytes -1002: ldr \rd, [\ra], #32 +1002: ldr \rd, [\ra], #DCACHELINESIZE teq \re, \ra bne 1002b #endif @@ -48,610 +65,705 @@ Lclean_switch: .long 0 .text + /* - * Function: sa110_flush_cache_all (void) - * Purpose : Flush all cache lines - */ - .align 5 -ENTRY(cpu_sa110_flush_cache_all) @ preserves r0 - mov r2, #1 -cpu_sa110_flush_cache_all_r2: - ldr r3, =Lclean_switch - ldr ip, =FLUSH_BASE - ldr r1, [r3] - ands r1, r1, #1 - eor r1, r1, #1 - str r1, [r3] - addne ip, ip, #FLUSH_OFFSET - flush_110_dcache r3, ip, r1 - mov ip, #0 - teq r2, #0 - mcrne p15, 0, ip, c7, c5, 0 @ flush I cache - mcr p15, 0, ip, c7, c10, 4 @ drain WB - mov pc, lr - - .align 5 -ENTRY(cpu_sa1100_flush_cache_all) @ preserves r0 - mov r2, #1 -cpu_sa1100_flush_cache_all_r2: - ldr r3, =Lclean_switch - ldr ip, =FLUSH_BASE - ldr r1, [r3] - ands r1, r1, #1 - eor r1, r1, #1 - str r1, [r3] - addne ip, ip, #FLUSH_OFFSET - flush_1100_dcache r3, ip, r1 - mov ip, #0 - teq r2, #0 - mcrne p15, 0, ip, c7, c5, 0 @ flush I cache - mcr p15, 0, r1, c9, c0, 0 @ flush RB - mcr p15, 0, ip, c7, c10, 4 @ drain WB - mov pc, lr - -/* - * Function: sa110_flush_cache_area (unsigned long address, int end, int flags) - * Params : address Area start address - * : end Area end address - * : flags b0 = I cache as well - * Purpose : clean & flush all cache lines associated with this area of memory - */ - .align 5 -ENTRY(cpu_sa110_flush_cache_area) - sub r3, r1, r0 - cmp r3, #MAX_AREA_SIZE - bgt cpu_sa110_flush_cache_all_r2 -1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry - mcr p15, 0, r0, c7, c6, 1 @ flush D entry - add r0, r0, #32 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - mcr p15, 0, r0, c7, c6, 1 @ flush D entry - add r0, r0, #32 - cmp r0, r1 - blt 1b - teq r2, #0 - movne r0, #0 - mcrne p15, 0, r0, c7, c5, 0 @ flush I cache - mov pc, lr - -ENTRY(cpu_sa1100_flush_cache_area) - sub r3, r1, r0 - cmp r3, #MAX_AREA_SIZE - bgt cpu_sa1100_flush_cache_all_r2 - b 1b - -/* - * Function: sa110_cache_wback_area(unsigned long address, unsigned long end) - * Params : address Area start address - * : end Area end address - * Purpose : ensure all dirty cachelines in the specified area have been - * written out to memory (for DMA) - */ - .align 5 -ENTRY(cpu_sa110_cache_wback_area) - sub r3, r1, r0 - cmp r3, #MAX_AREA_SIZE - mov r2, #0 - bgt cpu_sa110_flush_cache_all_r2 - bic r0, r0, #31 -1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - cmp r0, r1 - blt 1b - mcr p15, 0, r2, c7, c10, 4 @ drain WB - mov pc, lr - -ENTRY(cpu_sa1100_cache_wback_area) - sub r3, r1, r0 - cmp r3, #MAX_AREA_SIZE - mov r2, #0 - bgt cpu_sa1100_flush_cache_all_r2 - bic r0, r0, #31 - b 1b -/* - * Function: sa110_cache_purge_area(unsigned long address, unsigned long end) - * Params : address Area start address - * : end Area end address - * Purpose : throw away all D-cached data in specified region without - * an obligation to write it back. - * Note : Must clean the D-cached entries around the boundaries if the - * start and/or end address are not cache aligned. - */ - .align 5 -ENTRY(cpu_sa110_cache_purge_area) -ENTRY(cpu_sa1100_cache_purge_area) - tst r0, #31 - bic r0, r0, #31 - mcrne p15, 0, r0, c7, c10, 1 @ clean D entry - tst r1, #31 - mcrne p15, 0, r1, c7, c10, 1 @ clean D entry -1: mcr p15, 0, r0, c7, c6, 1 @ flush D entry - add r0, r0, #32 - cmp r0, r1 - blt 1b - mov pc, lr - -/* - * Function: sa110_flush_cache_entry (unsigned long address) - * Params : address Address of cache line to flush - * Purpose : clean & flush an entry - */ - .align 5 -ENTRY(cpu_sa110_flush_cache_entry) -ENTRY(cpu_sa1100_flush_cache_entry) - mov r1, #0 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - mcr p15, 0, r1, c7, c10, 4 @ drain WB - mcr p15, 0, r1, c7, c5, 0 @ flush I cache - mov pc, lr - -/* - * Function: sa110_clean_cache_area(unsigned long start, unsigned long size) - * Params : address Address of cache line to clean - * Purpose : Ensure that physical memory reflects cache at this location - * for page table purposes. - */ -ENTRY(cpu_sa110_clean_cache_area) -ENTRY(cpu_sa1100_clean_cache_area) -1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry (drain is done by TLB fns) - add r0, r0, #32 - subs r1, r1, #32 - bhi 1b - mov pc, lr - -/* - * Function: sa110_flush_ram_page (unsigned long page) - * Params : page Area start address - * Purpose : clean all cache lines associated with this area of memory - */ - .align 5 -ENTRY(cpu_sa110_flush_ram_page) -ENTRY(cpu_sa1100_flush_ram_page) - mov r1, #4096 -1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - add r0, r0, #32 - subs r1, r1, #128 - bne 1b - mov r0, #0 - mcr p15, 0, r0, c7, c10, 4 @ drain WB - mov pc, lr - -/* - * Function: sa110_flush_tlb_all (void) - * Purpose : flush all TLB entries in all caches - */ - .align 5 -ENTRY(cpu_sa110_flush_tlb_all) -ENTRY(cpu_sa1100_flush_tlb_all) - mov ip, #0 - mcr p15, 0, ip, c7, c10, 4 @ drain WB - mcr p15, 0, ip, c8, c7, 0 @ flush I & D tlbs - mov pc, lr - -/* - * Function: sa110_flush_tlb_area (unsigned long address, unsigned long end, int flags) - * Params : address Area start address - * : end Area end address - * : flags b0 = I-TLB as well - * Purpose : flush a TLB entry - */ - .align 5 -ENTRY(cpu_sa110_flush_tlb_area) -ENTRY(cpu_sa1100_flush_tlb_area) - mov r3, #0 - mcr p15, 0, r3, c7, c10, 4 @ drain WB -1: cmp r0, r1 - mcrlt p15, 0, r0, c8, c6, 1 @ flush D TLB entry - addlt r0, r0, #4096 - cmp r0, r1 - mcrlt p15, 0, r0, c8, c6, 1 @ flush D TLB entry - addlt r0, r0, #4096 - blt 1b - teq r2, #0 - mcrne p15, 0, r3, c8, c5, 0 @ flush I TLB - mov pc, lr - -/* - * Function: sa110_flush_tlb_page (unsigned long address, int flags) - * Params : address Address to flush - * : flags b0 = I-TLB as well - * Purpose : flush a TLB entry - */ - .align 5 -ENTRY(cpu_sa110_flush_tlb_page) -ENTRY(cpu_sa1100_flush_tlb_page) - mov r3, #0 - mcr p15, 0, r3, c7, c10, 4 @ drain WB - mcr p15, 0, r0, c8, c6, 1 @ flush D TLB entry - teq r1, #0 - mcrne p15, 0, r3, c8, c5, 0 @ flush I TLB - mov pc, lr - -/* - * Function: sa110_flush_icache_area (unsigned long address, unsigned long size) - * Params : address Address of area to flush - * : size Size of area to flush - * Purpose : flush an area from the Icache - */ - .align 5 -ENTRY(cpu_sa110_flush_icache_area) -ENTRY(cpu_sa1100_flush_icache_area) -1: mcr p15, 0, r0, c7, c10, 1 @ Clean D entry - add r0, r0, #32 - subs r1, r1, #32 - bhi 1b - mov r0, #0 - mcr p15, 0, r0, c7, c10, 4 @ drain WB - mcr p15, 0, r0, c7, c5, 0 @ flush I cache - mov pc, lr - - .align 5 -ENTRY(cpu_sa110_flush_icache_page) -ENTRY(cpu_sa1100_flush_icache_page) - mcr p15, 0, r0, c7, c5, 0 @ flush I cache - mov pc, lr - -/* - * Function: sa110_data_abort () - * Params : r0 = address of aborted instruction - * Purpose : obtain information about current aborted instruction - * Returns : r0 = address of abort - * : r1 != 0 if writing - * : r3 = FSR + * cpu_sa110_data_abort() + * + * obtain information about current aborted instruction + * + * r0 = address of aborted instruction + * + * Returns: + * r0 = address of abort + * r1 != 0 if writing + * r3 = FSR */ - .align 5 + .align 5 ENTRY(cpu_sa110_data_abort) ENTRY(cpu_sa1100_data_abort) - ldr r1, [r0] @ read instruction causing problem - mrc p15, 0, r0, c6, c0, 0 @ get FAR - mov r1, r1, lsr #19 @ b1 = L - mrc p15, 0, r3, c5, c0, 0 @ get FSR - and r1, r1, #2 - and r3, r3, #255 - mov pc, lr - - .align 5 -/* - * Function: sa110_set_pgd(unsigned long pgd_phys) - * Params : pgd_phys Physical address of page table - * Purpose : Perform a task switch, saving the old processes state, and restoring - * the new. + ldr r1, [r0] @ read aborted instruction + mrc p15, 0, r0, c6, c0, 0 @ get FAR + mov r1, r1, lsr #19 @ b1 = L + mrc p15, 0, r3, c5, c0, 0 @ get FSR + and r1, r1, #2 + and r3, r3, #255 + mov pc, lr + +/* + * cpu_sa110_check_bugs() */ - .align 5 -ENTRY(cpu_sa110_set_pgd) - ldr r3, =Lclean_switch - ldr ip, =FLUSH_BASE - ldr r2, [r3] - ands r2, r2, #1 - eor r2, r2, #1 - str r2, [r3] - addne ip, ip, #FLUSH_OFFSET - flush_110_dcache r3, ip, r1 - mov r1, #0 - mcr p15, 0, r1, c7, c5, 0 @ flush I cache - mcr p15, 0, r1, c7, c10, 4 @ drain WB - mcr p15, 0, r0, c2, c0, 0 @ load page table pointer - mcr p15, 0, r1, c8, c7, 0 @ flush TLBs - mov pc, lr +ENTRY(cpu_sa110_check_bugs) +ENTRY(cpu_sa1100_check_bugs) + mrs ip, cpsr + bic ip, ip, #F_BIT + msr cpsr, ip + mov pc, lr - .align 5 -ENTRY(cpu_sa1100_set_pgd) - ldr r3, =Lclean_switch - ldr ip, =FLUSH_BASE - ldr r2, [r3] - ands r2, r2, #1 - eor r2, r2, #1 - str r2, [r3] - addne ip, ip, #FLUSH_OFFSET - flush_1100_dcache r3, ip, r1 - mov r1, #0 - mcr p15, 0, r1, c7, c5, 0 @ flush I cache - mcr p15, 0, r1, c9, c0, 0 @ flush RB - mcr p15, 0, r1, c7, c10, 4 @ drain WB - mcr p15, 0, r0, c2, c0, 0 @ load page table pointer - mcr p15, 0, r1, c8, c7, 0 @ flush TLBs - mov pc, lr - -/* - * Function: sa110_set_pmd(pmd_t *pmdp, pmd_t pmd) - * Params : r0 = Address to set - * : r1 = value to set - * Purpose : Set a PMD and flush it out +/* + * cpu_sa110_proc_init() */ - .align 5 -ENTRY(cpu_sa110_set_pmd) -ENTRY(cpu_sa1100_set_pmd) - str r1, [r0] - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - mcr p15, 0, r0, c7, c10, 4 @ drain WB - mov pc, lr +ENTRY(cpu_sa110_proc_init) +ENTRY(cpu_sa1100_proc_init) + mov r0, #0 + mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching + mov pc, lr /* - * Function: sa110_set_pte(pte_t *ptep, pte_t pte) - * Params : r0 = Address to set - * : r1 = value to set - * Purpose : Set a PTE and flush it out + * cpu_sa110_proc_fin() */ - .align 5 -ENTRY(cpu_sa110_set_pte) -ENTRY(cpu_sa1100_set_pte) - str r1, [r0], #-1024 @ linux version +ENTRY(cpu_sa110_proc_fin) + stmfd sp!, {lr} + mov ip, #F_BIT | I_BIT | SVC_MODE + msr cpsr_c, ip + bl cpu_sa110_cache_clean_invalidate_all @ clean caches +1: mov r0, #0 + mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching + mrc p15, 0, r0, c1, c0, 0 @ ctrl register + bic r0, r0, #0x1000 @ ...i............ + bic r0, r0, #0x000e @ ............wca. + mcr p15, 0, r0, c1, c0, 0 @ disable caches + ldmfd sp!, {pc} - eor r1, r1, #LPTE_PRESENT | LPTE_YOUNG | LPTE_WRITE | LPTE_DIRTY +ENTRY(cpu_sa1100_proc_fin) + stmfd sp!, {lr} + mov ip, #F_BIT | I_BIT | SVC_MODE + msr cpsr_c, ip + bl cpu_sa1100_cache_clean_invalidate_all @ clean caches + b 1b - bic r2, r1, #0xff0 - bic r2, r2, #3 - orr r2, r2, #HPTE_TYPE_SMALL +/* + * cpu_sa110_reset(loc) + * + * Perform a soft reset of the system. Put the CPU into the + * same state as it would be if it had been reset, and branch + * to what would be the reset vector. + * + * loc: location to jump to for soft reset + */ + .align 5 +ENTRY(cpu_sa110_reset) +ENTRY(cpu_sa1100_reset) + mov ip, #0 + mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs + mrc p15, 0, ip, c1, c0, 0 @ ctrl register + bic ip, ip, #0x000f @ ............wcam + bic ip, ip, #0x1100 @ ...i...s........ + mcr p15, 0, ip, c1, c0, 0 @ ctrl register + mov pc, r0 - tst r1, #LPTE_USER | LPTE_EXEC @ User or Exec? - orrne r2, r2, #HPTE_AP_READ +/* + * cpu_sa110_do_idle(type) + * + * Cause the processor to idle + * + * type: call type: + * 0 = slow idle + * 1 = fast idle + * 2 = switch to slow processor clock + * 3 = switch to fast processor clock + */ + .align 5 +idle: mcr p15, 0, r0, c15, c8, 2 @ Wait for interrupt, cache aligned + mov r0, r0 @ safety + mov pc, lr - tst r1, #LPTE_WRITE | LPTE_DIRTY @ Write and Dirty? - orreq r2, r2, #HPTE_AP_WRITE +ENTRY(cpu_sa110_do_idle) + mov ip, #0 + cmp r0, #4 + addcc pc, pc, r0, lsl #2 + mov pc, lr + + b idle + b idle + b slow_clock + b fast_clock + +fast_clock: + mcr p15, 0, ip, c15, c1, 2 @ enable clock switching + mov pc, lr + +slow_clock: + mcr p15, 0, ip, c15, c2, 2 @ disable clock switching + ldr r1, =UNCACHEABLE_ADDR @ load from uncacheable loc + ldr r1, [r1, #0] @ force switch to MCLK + mov pc, lr + + .align 5 +ENTRY(cpu_sa1100_do_idle) + mov r0, r0 @ 4 nop padding + mov r0, r0 + mov r0, r0 + mov r0, #0 + ldr r1, =UNCACHEABLE_ADDR @ ptr to uncacheable address + mrs r2, cpsr + orr r3, r2, #192 @ disallow interrupts + msr cpsr_c, r3 + @ --- aligned to a cache line + mcr p15, 0, r0, c15, c2, 2 @ disable clock switching + ldr r1, [r1, #0] @ force switch to MCLK + mcr p15, 0, r0, c15, c8, 2 @ wait for interrupt + mov r0, r0 @ safety + mcr p15, 0, r0, c15, c1, 2 @ enable clock switching + msr cpsr_c, r2 @ allow interrupts + mov pc, lr - tst r1, #LPTE_PRESENT | LPTE_YOUNG @ Present and Young? - movne r2, #0 +/* ================================= CACHE ================================ */ - str r2, [r0] @ hardware version - mov r0, r0 - mcr p15, 0, r0, c7, c10, 1 @ clean D entry - mcr p15, 0, r0, c7, c10, 4 @ drain WB - mov pc, lr /* - * Function: sa110_check_bugs (void) - * : sa110_proc_init (void) - * : sa110_proc_fin (void) - * Notes : This processor does not require these + * cpu_sa110_cache_clean_invalidate_all (void) + * + * clean and invalidate all cache lines + * + * Note: + * 1. we should preserve r0 at all times */ -ENTRY(cpu_sa110_check_bugs) -ENTRY(cpu_sa1100_check_bugs) - mrs ip, cpsr - bic ip, ip, #F_BIT - msr cpsr, ip - mov pc, lr + .align 5 +ENTRY(cpu_sa110_cache_clean_invalidate_all) + mov r2, #1 +cpu_sa110_cache_clean_invalidate_all_r2: + ldr r3, =Lclean_switch + ldr ip, =FLUSH_BASE + ldr r1, [r3] + ands r1, r1, #1 + eor r1, r1, #1 + str r1, [r3] + addne ip, ip, #FLUSH_OFFSET + flush_110_dcache r3, ip, r1 + mov ip, #0 + teq r2, #0 + mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mov pc, lr + + .align 5 +ENTRY(cpu_sa1100_cache_clean_invalidate_all) + mov r2, #1 +cpu_sa1100_cache_clean_invalidate_all_r2: + ldr r3, =Lclean_switch + ldr ip, =FLUSH_BASE + ldr r1, [r3] + ands r1, r1, #1 + eor r1, r1, #1 + str r1, [r3] + addne ip, ip, #FLUSH_OFFSET + flush_1100_dcache r3, ip, r1 + mov ip, #0 + teq r2, #0 + mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache + mcr p15, 0, r1, c9, c0, 0 @ invalidate RB + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mov pc, lr -ENTRY(cpu_sa110_proc_init) -ENTRY(cpu_sa1100_proc_init) - mov r0, #0 - mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching - mov pc, lr +/* + * cpu_sa110_cache_clean_invalidate_range(start, end, flags) + * + * clean and invalidate all cache lines associated with this area of memory + * + * start: Area start address + * end: Area end address + * flags: nonzero for I cache as well + */ + .align 5 +ENTRY(cpu_sa110_cache_clean_invalidate_range) + bic r0, r0, #DCACHELINESIZE - 1 + sub r3, r1, r0 + cmp r3, #MAX_AREA_SIZE + bgt cpu_sa110_cache_clean_invalidate_all_r2 +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blt 1b + teq r2, #0 + movne r0, #0 + mcrne p15, 0, r0, c7, c5, 0 @ invalidate I cache + mov pc, lr + +ENTRY(cpu_sa1100_cache_clean_invalidate_range) + sub r3, r1, r0 + cmp r3, #MAX_AREA_SIZE + bgt cpu_sa1100_cache_clean_invalidate_all_r2 + b 1b -ENTRY(cpu_sa110_proc_fin) - stmfd sp!, {r1, lr} - mov ip, #F_BIT | I_BIT | SVC_MODE - msr cpsr_c, ip - bl cpu_sa110_flush_cache_all @ clean caches -1: mov r0, #0 - mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching - mrc p15, 0, r0, c1, c0, 0 - bic r0, r0, #0x1000 @ ...i............ - bic r0, r0, #0x000e @ ............wca. - mcr p15, 0, r0, c1, c0, 0 @ disable caches - ldmfd sp!, {r1, pc} +/* + * cpu_sa110_flush_ram_page(page) + * + * clean and invalidate all cache lines associated with this area of memory + * + * page: page to clean and invalidate + */ + .align 5 +ENTRY(cpu_sa110_flush_ram_page) +ENTRY(cpu_sa1100_flush_ram_page) + mov r1, #PAGESIZE +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bne 1b + mcr p15, 0, r1, c7, c10, 4 @ drain WB + mov pc, lr -ENTRY(cpu_sa1100_proc_fin) - stmfd sp!, {r1, lr} - mov ip, #F_BIT | I_BIT | SVC_MODE - msr cpsr_c, ip - bl cpu_sa1100_flush_cache_all @ clean caches - b 1b - - - .align 5 -idle: mcr p15, 0, r0, c15, c8, 2 @ Wait for interrupt, cache aligned - mov r0, r0 @ safety - mov pc, lr -/* - * Function: *_do_idle - * Params : r0 = call type: - * 0 = slow idle - * 1 = fast idle - * 2 = switch to slow processor clock - * 3 = switch to fast processor clock +/* ================================ D-CACHE =============================== */ + +/* + * cpu_sa110_dcache_invalidate_range(start, end) + * + * throw away all D-cached data in specified region without an obligation + * to write them back. Note however that we must clean the D-cached entries + * around the boundaries if the start and/or end address are not cache + * aligned. + * + * start: virtual start address + * end: virtual end address */ -ENTRY(cpu_sa110_do_idle) -ENTRY(cpu_sa1100_do_idle) - mov ip, #0 - cmp r0, #4 - addcc pc, pc, r0, lsl #2 - mov pc, lr - - b idle - b idle - b slow_clock - b fast_clock - -fast_clock: mcr p15, 0, ip, c15, c1, 2 @ enable clock switching - mov pc, lr - -slow_clock: mcr p15, 0, ip, c15, c2, 2 @ disable clock switching - ldr r1, =UNCACHEABLE_ADDR @ load from uncacheable loc - ldr r1, [r1, #0] @ force switch to MCLK - mov pc, lr - -/* - * Function: sa110_reset - * Params : r0 = address to jump to - * Notes : This sets up everything for a reset + .align 5 +ENTRY(cpu_sa110_dcache_invalidate_range) +ENTRY(cpu_sa1100_dcache_invalidate_range) + tst r0, #DCACHELINESIZE - 1 + bic r0, r0, #DCACHELINESIZE - 1 + mcrne p15, 0, r0, c7, c10, 1 @ clean D entry + tst r1, #DCACHELINESIZE - 1 + mcrne p15, 0, r1, c7, c10, 1 @ clean D entry +1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blt 1b + mov pc, lr + +/* + * cpu_sa110_dcache_clean_range(start, end) + * + * For the specified virtual address range, ensure that all caches contain + * clean data, such that peripheral accesses to the physical RAM fetch + * correct data. + * + * start: virtual start address + * end: virtual end address */ - .align 5 -ENTRY(cpu_sa110_reset) -ENTRY(cpu_sa1100_reset) - mov ip, #0 - mcr p15, 0, ip, c7, c7, 0 @ flush I,D caches - mcr p15, 0, ip, c7, c10, 4 @ drain WB - mcr p15, 0, ip, c8, c7, 0 @ flush I & D tlbs - mrc p15, 0, ip, c1, c0, 0 @ ctrl register - bic ip, ip, #0x000f @ ............wcam - bic ip, ip, #0x1100 @ ...i...s........ - mcr p15, 0, ip, c1, c0, 0 @ ctrl register - mov pc, r0 + .align 5 +ENTRY(cpu_sa110_dcache_clean_range) + bic r0, r0, #DCACHELINESIZE - 1 + sub r1, r1, r0 + cmp r1, #MAX_AREA_SIZE + mov r2, #0 + bgt cpu_sa110_cache_clean_invalidate_all_r2 +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bpl 1b + mcr p15, 0, r2, c7, c10, 4 @ drain WB + mov pc, lr + +ENTRY(cpu_sa1100_dcache_clean_range) + bic r0, r0, #DCACHELINESIZE - 1 + sub r1, r1, r0 + cmp r1, #MAX_AREA_SIZE + mov r2, #0 + bgt cpu_sa1100_cache_clean_invalidate_all_r2 + b 1b + +/* + * cpu_sa110_clean_dcache_page(page) + * + * Cleans a single page of dcache so that if we have any future aliased + * mappings, they will be consistent at the time that they are created. + * + * Note: + * 1. we don't need to flush the write buffer in this case. + * 2. we don't invalidate the entries since when we write the page + * out to disk, the entries may get reloaded into the cache. + */ + .align 5 +ENTRY(cpu_sa110_dcache_clean_page) +ENTRY(cpu_sa1100_dcache_clean_page) + mov r1, #PAGESIZE +1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + add r0, r0, #DCACHELINESIZE + subs r1, r1, #2 * DCACHELINESIZE + bne 1b + mov pc, lr + +/* + * cpu_sa110_dcache_clean_entry(addr) + * + * Clean the specified entry of any caches such that the MMU + * translation fetches will obtain correct data. + * + * addr: cache-unaligned virtual address + */ + .align 5 +ENTRY(cpu_sa110_dcache_clean_entry) +ENTRY(cpu_sa1100_dcache_clean_entry) + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr + +/* ================================ I-CACHE =============================== */ + +/* + * cpu_sa110_icache_invalidate_range(start, end) + * + * invalidate a range of virtual addresses from the Icache + * + * start: virtual start address + * end: virtual end address + */ + .align 5 +ENTRY(cpu_sa110_icache_invalidate_range) +ENTRY(cpu_sa1100_icache_invalidate_range) +1: mcr p15, 0, r0, c7, c10, 1 @ Clean D entry + add r0, r0, #DCACHELINESIZE + cmp r0, r1 + blo 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 @ drain WB +ENTRY(cpu_sa110_icache_invalidate_page) +ENTRY(cpu_sa1100_icache_invalidate_page) + mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache + mov pc, lr + +/* ================================== TLB ================================= */ + +/* + * cpu_sa110_tlb_invalidate_all() + * + * Invalidate all TLB entries + */ + .align 5 +ENTRY(cpu_sa110_tlb_invalidate_all) +ENTRY(cpu_sa1100_tlb_invalidate_all) + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mcr p15, 0, r0, c8, c7, 0 @ invalidate I & D TLBs + mov pc, lr + +/* + * cpu_sa110_tlb_invalidate_range(start, end) + * + * invalidate TLB entries covering the specified range + * + * start: range start address + * end: range end address + */ + .align 5 +ENTRY(cpu_sa110_tlb_invalidate_range) +ENTRY(cpu_sa1100_tlb_invalidate_range) + mov r3, #0 + mcr p15, 0, r3, c7, c10, 4 @ drain WB +1: mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry + add r0, r0, #PAGESIZE + cmp r0, r1 + blt 1b + mcr p15, 0, r3, c8, c5, 0 @ invalidate I TLB + mov pc, lr + +/* + * cpu_sa110_tlb_invalidate_page(page, flags) + * + * invalidate the TLB entries for the specified page. + * + * page: page to invalidate + * flags: non-zero if we include the I TLB + */ + .align 5 +ENTRY(cpu_sa110_tlb_invalidate_page) +ENTRY(cpu_sa1100_tlb_invalidate_page) + mov r3, #0 + mcr p15, 0, r3, c7, c10, 4 @ drain WB + teq r1, #0 + mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry + mcrne p15, 0, r3, c8, c5, 0 @ invalidate I TLB + mov pc, lr + +/* =============================== PageTable ============================== */ + +/* + * cpu_sa110_set_pgd(pgd) + * + * Set the translation base pointer to be as described by pgd. + * + * pgd: new page tables + */ + .align 5 +ENTRY(cpu_sa110_set_pgd) + ldr r3, =Lclean_switch + ldr ip, =FLUSH_BASE + ldr r2, [r3] + ands r2, r2, #1 + eor r2, r2, #1 + str r2, [r3] + addne ip, ip, #FLUSH_OFFSET + flush_110_dcache r3, ip, r1 + mov r1, #0 + mcr p15, 0, r1, c7, c5, 0 @ invalidate I cache + mcr p15, 0, r1, c7, c10, 4 @ drain WB + mcr p15, 0, r0, c2, c0, 0 @ load page table pointer + mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs + mov pc, lr + +/* + * cpu_sa1100_set_pgd(pgd) + * + * Set the translation base pointer to be as described by pgd. + * + * pgd: new page tables + */ + .align 5 +ENTRY(cpu_sa1100_set_pgd) + ldr r3, =Lclean_switch + ldr ip, =FLUSH_BASE + ldr r2, [r3] + ands r2, r2, #1 + eor r2, r2, #1 + str r2, [r3] + addne ip, ip, #FLUSH_OFFSET + flush_1100_dcache r3, ip, r1 + mov ip, #0 + mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache + mcr p15, 0, ip, c9, c0, 0 @ invalidate RB + mcr p15, 0, ip, c7, c10, 4 @ drain WB + mcr p15, 0, r0, c2, c0, 0 @ load page table pointer + mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs + mov pc, lr +/* + * cpu_sa110_set_pmd(pmdp, pmd) + * + * Set a level 1 translation table entry, and clean it out of + * any caches such that the MMUs can load it correctly. + * + * pmdp: pointer to PMD entry + * pmd: PMD value to store + */ + .align 5 +ENTRY(cpu_sa110_set_pmd) +ENTRY(cpu_sa1100_set_pmd) + str r1, [r0] + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr -cpu_manu_name: .asciz "Intel" -cpu_sa110_name: .asciz "StrongARM-110" +/* + * cpu_sa110_arm920_set_pte(ptep, pte) + * + * Set a PTE and flush it out + */ + .align 5 +ENTRY(cpu_sa110_set_pte) +ENTRY(cpu_sa1100_set_pte) + str r1, [r0], #-1024 @ linux version + + eor r1, r1, #LPTE_PRESENT | LPTE_YOUNG | LPTE_WRITE | LPTE_DIRTY + + bic r2, r1, #0xff0 + bic r2, r2, #3 + orr r2, r2, #HPTE_TYPE_SMALL + + tst r1, #LPTE_USER | LPTE_EXEC @ User or Exec? + orrne r2, r2, #HPTE_AP_READ + + tst r1, #LPTE_WRITE | LPTE_DIRTY @ Write and Dirty? + orreq r2, r2, #HPTE_AP_WRITE + + tst r1, #LPTE_PRESENT | LPTE_YOUNG @ Present and Young? + movne r2, #0 + + str r2, [r0] @ hardware version + mov r0, r0 + mcr p15, 0, r0, c7, c10, 1 @ clean D entry + mcr p15, 0, r0, c7, c10, 4 @ drain WB + mov pc, lr + + +cpu_manu_name: + .asciz "Intel" +cpu_sa110_name: + .asciz "StrongARM-110" cpu_sa1100_name: - .asciz "StrongARM-1100" + .asciz "StrongARM-1100" cpu_sa1110_name: - .asciz "StrongARM-1110" - .align + .asciz "StrongARM-1110" + .align - .section ".text.init", #alloc, #execinstr + .section ".text.init", #alloc, #execinstr __sa1100_setup: @ Allow read-buffer operations from userland - mcr p15, 0, r0, c9, c0, 5 + mcr p15, 0, r0, c9, c0, 5 -__sa110_setup: mov r0, #F_BIT | I_BIT | SVC_MODE - msr cpsr_c, r0 - mov r0, #0 - mcr p15, 0, r0, c7, c7 @ flush I,D caches on v4 - mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 - mcr p15, 0, r0, c8, c7 @ flush I,D TLBs on v4 - mcr p15, 0, r4, c2, c0 @ load page table pointer - mov r0, #0x1f @ Domains 0, 1 = client - mcr p15, 0, r0, c3, c0 @ load domain access register - mrc p15, 0, r0, c1, c0 @ get control register v4 - bic r0, r0, #0x0e00 @ ....??r......... - bic r0, r0, #0x0002 @ ..............a. - orr r0, r0, #0x003d @ ..........DPWC.M - orr r0, r0, #0x1100 @ ...I...S........ - mov pc, lr +__sa110_setup: + mov r0, #F_BIT | I_BIT | SVC_MODE + msr cpsr_c, r0 + mov r0, #0 + mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4 + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4 + mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4 + mcr p15, 0, r4, c2, c0 @ load page table pointer + mov r0, #0x1f @ Domains 0, 1 = client + mcr p15, 0, r0, c3, c0 @ load domain access register + mrc p15, 0, r0, c1, c0 @ get control register v4 + bic r0, r0, #0x0e00 @ ....??r......... + bic r0, r0, #0x0002 @ ..............a. + orr r0, r0, #0x003d @ ..........DPWC.M + orr r0, r0, #0x1100 @ ...I...S........ + mov pc, lr - .text + .text /* * Purpose : Function pointers used to access above functions - all calls * come through these */ - .type sa110_processor_functions, #object + .type sa110_processor_functions, #object ENTRY(sa110_processor_functions) - .word cpu_sa110_data_abort - .word cpu_sa110_check_bugs - .word cpu_sa110_proc_init - .word cpu_sa110_proc_fin - .word cpu_sa110_flush_cache_all - .word cpu_sa110_flush_cache_area - .word cpu_sa110_flush_cache_entry - .word cpu_sa110_clean_cache_area - .word cpu_sa110_flush_ram_page - .word cpu_sa110_flush_tlb_all - .word cpu_sa110_flush_tlb_area - .word cpu_sa110_set_pgd - .word cpu_sa110_set_pmd - .word cpu_sa110_set_pte - .word cpu_sa110_reset - .word cpu_sa110_flush_icache_area - .word cpu_sa110_cache_wback_area - .word cpu_sa110_cache_purge_area - .word cpu_sa110_flush_tlb_page - .word cpu_sa110_do_idle - .word cpu_sa110_flush_icache_page - .size sa110_processor_functions, . - sa110_processor_functions + .word cpu_sa110_data_abort + .word cpu_sa110_check_bugs + .word cpu_sa110_proc_init + .word cpu_sa110_proc_fin + .word cpu_sa110_reset + .word cpu_sa110_do_idle + + /* cache */ + .word cpu_sa110_cache_clean_invalidate_all + .word cpu_sa110_cache_clean_invalidate_range + .word cpu_sa110_flush_ram_page + + /* dcache */ + .word cpu_sa110_dcache_invalidate_range + .word cpu_sa110_dcache_clean_range + .word cpu_sa110_dcache_clean_page + .word cpu_sa110_dcache_clean_entry + + /* icache */ + .word cpu_sa110_icache_invalidate_range + .word cpu_sa110_icache_invalidate_page + + /* tlb */ + .word cpu_sa110_tlb_invalidate_all + .word cpu_sa110_tlb_invalidate_range + .word cpu_sa110_tlb_invalidate_page + + /* pgtable */ + .word cpu_sa110_set_pgd + .word cpu_sa110_set_pmd + .word cpu_sa110_set_pte + .size sa110_processor_functions, . - sa110_processor_functions - .type cpu_sa110_info, #object + .type cpu_sa110_info, #object cpu_sa110_info: - .long cpu_manu_name - .long cpu_sa110_name - .size cpu_sa110_info, . - cpu_sa110_info + .long cpu_manu_name + .long cpu_sa110_name + .size cpu_sa110_info, . - cpu_sa110_info /* * SA1100 and SA1110 share the same function calls */ - .type sa1100_processor_functions, #object + .type sa1100_processor_functions, #object ENTRY(sa1100_processor_functions) - .word cpu_sa1100_data_abort - .word cpu_sa1100_check_bugs - .word cpu_sa1100_proc_init - .word cpu_sa1100_proc_fin - .word cpu_sa1100_flush_cache_all - .word cpu_sa1100_flush_cache_area - .word cpu_sa1100_flush_cache_entry - .word cpu_sa1100_clean_cache_area - .word cpu_sa1100_flush_ram_page - .word cpu_sa1100_flush_tlb_all - .word cpu_sa1100_flush_tlb_area - .word cpu_sa1100_set_pgd - .word cpu_sa1100_set_pmd - .word cpu_sa1100_set_pte - .word cpu_sa1100_reset - .word cpu_sa1100_flush_icache_area - .word cpu_sa1100_cache_wback_area - .word cpu_sa1100_cache_purge_area - .word cpu_sa1100_flush_tlb_page - .word cpu_sa1100_do_idle - .word cpu_sa1100_flush_icache_page - .size sa1100_processor_functions, . - sa1100_processor_functions + .word cpu_sa1100_data_abort + .word cpu_sa1100_check_bugs + .word cpu_sa1100_proc_init + .word cpu_sa1100_proc_fin + .word cpu_sa1100_reset + .word cpu_sa1100_do_idle + + /* cache */ + .word cpu_sa1100_cache_clean_invalidate_all + .word cpu_sa1100_cache_clean_invalidate_range + .word cpu_sa1100_flush_ram_page + + /* dcache */ + .word cpu_sa1100_dcache_invalidate_range + .word cpu_sa1100_dcache_clean_range + .word cpu_sa1100_dcache_clean_page + .word cpu_sa1100_dcache_clean_entry + + /* icache */ + .word cpu_sa1100_icache_invalidate_range + .word cpu_sa1100_icache_invalidate_page + + /* tlb */ + .word cpu_sa1100_tlb_invalidate_all + .word cpu_sa1100_tlb_invalidate_range + .word cpu_sa1100_tlb_invalidate_page + + /* pgtable */ + .word cpu_sa1100_set_pgd + .word cpu_sa1100_set_pmd + .word cpu_sa1100_set_pte + .size sa1100_processor_functions, . - sa1100_processor_functions cpu_sa1100_info: - .long cpu_manu_name - .long cpu_sa1100_name - .size cpu_sa1100_info, . - cpu_sa1100_info + .long cpu_manu_name + .long cpu_sa1100_name + .size cpu_sa1100_info, . - cpu_sa1100_info cpu_sa1110_info: - .long cpu_manu_name - .long cpu_sa1110_name - .size cpu_sa1110_info, . - cpu_sa1110_info - + .long cpu_manu_name + .long cpu_sa1110_name + .size cpu_sa1110_info, . - cpu_sa1110_info + + .type cpu_arch_name, #object +cpu_arch_name: + .asciz "armv4" + .size cpu_arch_name, . - cpu_arch_name + + .type cpu_elf_name, #object +cpu_elf_name: + .asciz "v4" + .size cpu_elf_name, . - cpu_elf_name + .align - .type cpu_arch_name, #object -cpu_arch_name: .asciz "armv4" - .size cpu_arch_name, . - cpu_arch_name + .section ".proc.info", #alloc, #execinstr - .type cpu_elf_name, #object -cpu_elf_name: .asciz "v4" - .size cpu_elf_name, . - cpu_elf_name - .align - - .section ".proc.info", #alloc, #execinstr - - .type __sa110_proc_info,#object + .type __sa110_proc_info,#object __sa110_proc_info: - .long 0x4401a100 - .long 0xfffffff0 - .long 0x00000c02 - b __sa110_setup - .long cpu_arch_name - .long cpu_elf_name - .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT - .long cpu_sa110_info - .long sa110_processor_functions - .size __sa110_proc_info, . - __sa110_proc_info + .long 0x4401a100 + .long 0xfffffff0 + .long 0x00000c0e + b __sa110_setup + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT + .long cpu_sa110_info + .long sa110_processor_functions + .size __sa110_proc_info, . - __sa110_proc_info - .type __sa1100_proc_info,#object + .type __sa1100_proc_info,#object __sa1100_proc_info: - .long 0x4401a110 - .long 0xfffffff0 - .long 0x00000c02 - b __sa1100_setup - .long cpu_arch_name - .long cpu_elf_name - .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT - .long cpu_sa1100_info - .long sa1100_processor_functions - .size __sa1100_proc_info, . - __sa1100_proc_info + .long 0x4401a110 + .long 0xfffffff0 + .long 0x00000c0e + b __sa1100_setup + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT + .long cpu_sa1100_info + .long sa1100_processor_functions + .size __sa1100_proc_info, . - __sa1100_proc_info - .type __sa1110_proc_info,#object + .type __sa1110_proc_info,#object __sa1110_proc_info: - .long 0x6901b110 - .long 0xfffffff0 - .long 0x00000c02 - b __sa1100_setup - .long cpu_arch_name - .long cpu_elf_name - .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT - .long cpu_sa1110_info - .long sa1100_processor_functions - .size __sa1110_proc_info, . - __sa1110_proc_info - - + .long 0x6901b110 + .long 0xfffffff0 + .long 0x00000c0e + b __sa1100_setup + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT + .long cpu_sa1110_info + .long sa1100_processor_functions + .size __sa1110_proc_info, . - __sa1110_proc_info diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/proc-syms.c linux/arch/arm/mm/proc-syms.c --- v2.4.0-test8/linux/arch/arm/mm/proc-syms.c Wed Dec 31 16:00:00 1969 +++ linux/arch/arm/mm/proc-syms.c Mon Sep 18 15:15:25 2000 @@ -0,0 +1,31 @@ +/* + * linux/arch/arm/mm/proc-syms.c + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include + +#ifndef MULTI_CPU +EXPORT_SYMBOL(cpu_cache_clean_invalidate_all); +EXPORT_SYMBOL(cpu_cache_clean_invalidate_range); +EXPORT_SYMBOL(cpu_flush_ram_page); +EXPORT_SYMBOL(cpu_dcache_clean_page); +EXPORT_SYMBOL(cpu_dcache_clean_entry); +EXPORT_SYMBOL(cpu_dcache_clean_range); +EXPORT_SYMBOL(cpu_dcache_invalidate_range); +EXPORT_SYMBOL(cpu_icache_invalidate_range); +EXPORT_SYMBOL(cpu_icache_invalidate_page); +EXPORT_SYMBOL(cpu_tlb_invalidate_all); +EXPORT_SYMBOL(cpu_tlb_invalidate_range); +EXPORT_SYMBOL(cpu_tlb_invalidate_page); +EXPORT_SYMBOL(cpu_set_pgd); +EXPORT_SYMBOL(cpu_set_pmd); +EXPORT_SYMBOL(cpu_set_pte); +#else +EXPORT_SYMBOL(processor); +#endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/arm/mm/small_page.c linux/arch/arm/mm/small_page.c --- v2.4.0-test8/linux/arch/arm/mm/small_page.c Mon Aug 7 21:02:27 2000 +++ linux/arch/arm/mm/small_page.c Mon Sep 18 15:15:25 2000 @@ -3,12 +3,15 @@ * * Copyright (C) 1996 Russell King * - * Changelog: - * 26/01/1996 RMK Cleaned up various areas to make little more generic - * 07/02/1999 RMK Support added for 16K and 32K page sizes + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 26/01/1996 RMK Cleaned up various areas to make little more generic + * 07/02/1999 RMK Support added for 16K and 32K page sizes * containing 8K blocks */ - #include #include #include @@ -70,6 +73,8 @@ #define TEST_AND_CLEAR_USED(pg,off) (test_and_clear_bit(off, &USED_MAP(pg))) #define SET_USED(pg,off) (set_bit(off, &USED_MAP(pg))) +static spinlock_t small_page_lock = SPIN_LOCK_UNLOCKED; + static void add_page_to_queue(struct page *page, struct page **p) { #ifdef PEDANTIC @@ -99,11 +104,10 @@ struct page *page; int offset; - save_flags(flags); if (!order->queue) goto need_new_page; - cli(); + spin_lock_irqsave(&small_page_lock, flags); page = order->queue; again: #ifdef PEDANTIC @@ -114,12 +118,14 @@ SET_USED(page, offset); if (USED_MAP(page) == order->all_used) remove_page_from_queue(page); - restore_flags(flags); + spin_unlock_irqrestore(&small_page_lock, flags); return (unsigned long) page_address(page) + (offset << order->shift); need_new_page: page = alloc_page(priority); + + spin_lock_irqsave(&small_page_lock, flags); if (!order->queue) { if (!page) goto no_page; @@ -135,7 +141,7 @@ goto again; no_page: - restore_flags(flags); + spin_unlock_irqrestore(&small_page_lock, flags); return 0; } @@ -164,7 +170,7 @@ /* * the following must be atomic wrt get_page */ - save_flags_cli(flags); + spin_lock_irqsave(&small_page_lock, flags); if (USED_MAP(page) == order->all_used) add_page_to_queue(page, &order->queue); @@ -175,7 +181,7 @@ if (USED_MAP(page) == 0) goto free_page; - restore_flags(flags); + spin_unlock_irqrestore(&small_page_lock, flags); } return; @@ -184,7 +190,7 @@ * unlink the page from the small page queue and free it */ remove_page_from_queue(page); - restore_flags(flags); + spin_unlock_irqrestore(&small_page_lock, flags); ClearPageReserved(page); __free_page(page); return; diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/config.in linux/arch/i386/config.in --- v2.4.0-test8/linux/arch/i386/config.in Tue Aug 22 11:57:15 2000 +++ linux/arch/i386/config.in Mon Sep 18 15:02:03 2000 @@ -128,6 +128,7 @@ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y define_bool CONFIG_X86_USE_3DNOW y fi +tristate 'Toshiba Laptop support' CONFIG_TOSHIBA tristate '/dev/cpu/microcode - Intel P6 CPU microcode support' CONFIG_MICROCODE tristate '/dev/cpu/*/msr - Model-specific register support' CONFIG_X86_MSR diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/defconfig linux/arch/i386/defconfig --- v2.4.0-test8/linux/arch/i386/defconfig Sat Sep 2 11:45:00 2000 +++ linux/arch/i386/defconfig Mon Sep 18 15:36:40 2000 @@ -44,6 +44,7 @@ CONFIG_X86_GOOD_APIC=y CONFIG_X86_PGE=y CONFIG_X86_USE_PPRO_CHECKSUM=y +# CONFIG_TOSHIBA is not set # CONFIG_MICROCODE is not set # CONFIG_X86_MSR is not set # CONFIG_X86_CPUID is not set @@ -224,7 +225,6 @@ # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set -# CONFIG_VIA82CXXX_TUNING is not set # CONFIG_IDE_CHIPSETS is not set # CONFIG_IDEDMA_AUTO is not set # CONFIG_DMA_NONPCI is not set diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile --- v2.4.0-test8/linux/arch/i386/kernel/Makefile Wed Jul 5 11:23:12 2000 +++ linux/arch/i386/kernel/Makefile Mon Sep 18 15:02:02 2000 @@ -18,7 +18,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \ - pci-dma.o i386_ksyms.o i387.o + pci-dma.o i386_ksyms.o i387.o bluesmoke.o ifdef CONFIG_PCI diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/acpi.c linux/arch/i386/kernel/acpi.c --- v2.4.0-test8/linux/arch/i386/kernel/acpi.c Mon Jul 17 17:54:25 2000 +++ linux/arch/i386/kernel/acpi.c Sun Sep 17 09:41:29 2000 @@ -21,6 +21,12 @@ /* * See http://www.geocities.com/SiliconValley/Hardware/3165/ * for the user-level ACPI stuff + * + * Changes: + * Arnaldo Carvalho de Melo - 2000/08/31 + * - check copy*user return + * - get rid of check_region + * - get rid of verify_area */ #include @@ -135,8 +141,7 @@ *len = 0; return 0; } - copy_to_user(buffer, str, size); - return 0; + return copy_to_user(buffer, str, size) ? -EFAULT : 0; } static void cx_statistics(unsigned int x, unsigned long time) @@ -1283,11 +1288,9 @@ */ static int acpi_claim(unsigned long start, unsigned long size) { - if (start && size) { - if (check_region(start, size)) + if (start && size) + if (!request_region(start, size, "acpi")) return -EBUSY; - request_region(start, size, "acpi"); - } return 0; } @@ -1391,7 +1394,8 @@ val = *(unsigned long*) ctl->data; size = sprintf(str, "0x%08lx\n", val); if (*len >= size) { - copy_to_user(buffer, str, size); + if (copy_to_user(buffer, str, size)) + return -EFAULT; *len = size; } else @@ -1404,7 +1408,8 @@ size = sizeof(str) - 1; if (size > *len) size = *len; - copy_from_user(str, buffer, size); + if (copy_from_user(str, buffer, size)) + return -EFAULT; str[size] = '\0'; val = simple_strtoul(str, &strend, 0); if (strend == str) @@ -1423,22 +1428,22 @@ size_t size, struct acpi_table_info *info) { + struct acpi_table hdr; + size_t table_size; + if (size < sizeof(struct acpi_table)) return -EINVAL; - else if (verify_area(VERIFY_READ, buffer, size)) + + if (copy_from_user(&hdr, buffer, sizeof(hdr))) return -EFAULT; - else { - struct acpi_table hdr; - size_t table_size; - copy_from_user(&hdr, buffer, sizeof(hdr)); - table_size = (size_t) hdr.length; - if (hdr.signature != info->expected_signature - || table_size < size - || (info->expected_size - && table_size != info->expected_size)) - return -EINVAL; - } + table_size = (size_t) hdr.length; + if (hdr.signature != info->expected_signature + || table_size < size + || (info->expected_size + && table_size != info->expected_size)) + return -EINVAL; + return 0; } @@ -1496,7 +1501,8 @@ error = acpi_verify_table(buffer, *len, info); if (error) return error; - copy_from_user(&hdr, buffer, sizeof(hdr)); + if (copy_from_user(&hdr, buffer, sizeof(hdr))) + return -EFAULT; table_size = (size_t) hdr.length; write_lock(&acpi_do_table_lock); @@ -1517,7 +1523,8 @@ error = -ENOMEM; } if (data) - copy_from_user(data, buffer, size); + if (copy_from_user(data, buffer, size)) + error = -EFAULT; write_unlock(&acpi_do_table_lock); } @@ -1565,7 +1572,8 @@ size = sprintf(str, "0x%08x\n", val); if (*len >= size) { - copy_to_user(buffer, str, size); + if (copy_to_user(buffer, str, size)) + return -EFAULT; *len = size; } else @@ -1580,7 +1588,8 @@ size = sizeof(str) - 1; if (size > *len) size = *len; - copy_from_user(str, buffer, size); + if (copy_from_user(str, buffer, size)) + return -EFAULT; str[size] = '\0'; val = (u32) simple_strtoul(str, &strend, 0); if (strend == str) @@ -1682,7 +1691,8 @@ pm1_status, gpe_status, event_state); - copy_to_user(buffer, str, size); + if (copy_to_user(buffer, str, size)) + return -EFAULT; *len = size; file->f_pos += size; diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/bluesmoke.c linux/arch/i386/kernel/bluesmoke.c --- v2.4.0-test8/linux/arch/i386/kernel/bluesmoke.c Wed Dec 31 16:00:00 1969 +++ linux/arch/i386/kernel/bluesmoke.c Mon Sep 18 15:02:02 2000 @@ -0,0 +1,107 @@ +/* + * Machine Check Handler For PII/PIII + */ + +#include +#include +#include +#include +#include +#include + +static int banks = 0; + +void mcheck_fault(void) +{ + int recover=1; + u32 alow, ahigh, high, low; + u32 mcgstl, mcgsth; + int i; + + rdmsr(0x17a, mcgstl, mcgsth); + if(mcgstl&(1<<0)) /* Recoverable ? */ + recover=0; + + printk(KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x", smp_processor_id(), mcgstl, mcgsth); + + for(i=0;ix86_vendor!=X86_VENDOR_INTEL) + return; + + if(!(c->x86_capability&X86_FEATURE_MCE)) + return; + + if(!(c->x86_capability&X86_FEATURE_MCA)) + return; + + /* Ok machine check is available */ + + if(done==0) + printk(KERN_INFO "Intel machine check architecture supported.\n"); + rdmsr(0x179, l, h); + if(l&(1<<8)) + wrmsr(0x17b, 0xffffffff, 0xffffffff); + banks = l&0xff; + for(i=1;ix86_capability & X86_FEATURE_TSC) { p += sprintf(p, "cpu MHz\t\t: %lu.%06lu\n", - cpu_hz / 1000000, (cpu_hz % 1000000)); + cpu_khz / 1000, (cpu_khz % 1000)); } /* Cache size */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c --- v2.4.0-test8/linux/arch/i386/kernel/smpboot.c Tue Sep 5 13:50:02 2000 +++ linux/arch/i386/kernel/smpboot.c Mon Sep 18 14:57:02 2000 @@ -774,7 +774,7 @@ } cycles_t cacheflush_time; -extern unsigned long cpu_hz; +extern unsigned long cpu_khz; static void smp_tune_scheduling (void) { @@ -791,7 +791,7 @@ * the cache size) */ - if (!cpu_hz) { + if (!cpu_khz) { /* * this basically disables processor-affinity * scheduling on SMP without a TSC. @@ -805,12 +805,12 @@ bandwidth = 100; } - cacheflush_time = (cpu_hz>>20) * (cachesize<<10) / bandwidth; + cacheflush_time = (cpu_khz>>10) * (cachesize<<10) / bandwidth; } printk("per-CPU timeslice cutoff: %ld.%02ld usecs.\n", - (long)cacheflush_time/(cpu_hz/1000000), - ((long)cacheflush_time*100/(cpu_hz/1000000)) % 100); + (long)cacheflush_time/(cpu_khz/1000), + ((long)cacheflush_time*100/(cpu_khz/1000)) % 100); } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c --- v2.4.0-test8/linux/arch/i386/kernel/time.c Mon Jul 10 14:33:03 2000 +++ linux/arch/i386/kernel/time.c Mon Sep 18 15:43:16 2000 @@ -64,7 +64,7 @@ #include -unsigned long cpu_hz; /* Detected as we calibrate the TSC */ +unsigned long cpu_khz; /* Detected as we calibrate the TSC */ /* Number of usecs that the last interrupt was delayed */ static int delay_at_last_interrupt; @@ -504,37 +504,6 @@ } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - /* not static: needed by APM */ unsigned long get_cmos_time(void) { @@ -707,12 +676,12 @@ * The formula is (10^6 * 2^32) / (2^32 * 1 / (clocks/us)) = * clock/second. Our precision is about 100 ppm. */ - { unsigned long eax=0, edx=1000000; + { unsigned long eax=0, edx=1000; __asm__("divl %2" - :"=a" (cpu_hz), "=d" (edx) + :"=a" (cpu_khz), "=d" (edx) :"r" (tsc_quotient), "0" (eax), "1" (edx)); - printk("Detected %ld Hz processor.\n", cpu_hz); + printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000); } } } diff -u --recursive --new-file v2.4.0-test8/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c --- v2.4.0-test8/linux/arch/i386/kernel/traps.c Wed Sep 6 13:51:55 2000 +++ linux/arch/i386/kernel/traps.c Mon Sep 18 15:02:02 2000 @@ -95,6 +95,7 @@ asmlinkage void reserved(void); asmlinkage void alignment_check(void); asmlinkage void spurious_interrupt_bug(void); +asmlinkage void machine_check(void); int kstack_depth_to_print = 24; @@ -963,6 +964,7 @@ set_trap_gate(15,&spurious_interrupt_bug); set_trap_gate(16,&coprocessor_error); set_trap_gate(17,&alignment_check); + set_trap_gate(18,&machine_check); set_trap_gate(19,&simd_coprocessor_error); set_system_gate(SYSCALL_VECTOR,&system_call); diff -u --recursive --new-file v2.4.0-test8/linux/arch/ia64/kernel/efi.c linux/arch/ia64/kernel/efi.c --- v2.4.0-test8/linux/arch/ia64/kernel/efi.c Fri Aug 11 19:09:06 2000 +++ linux/arch/ia64/kernel/efi.c Mon Sep 11 08:39:48 2000 @@ -98,37 +98,6 @@ efi_call_phys(__va(runtime->reset_system), status, data_size, __pa(data)); } -/* - * Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long -mktime (unsigned int year, unsigned int mon, unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((((unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) - + year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void efi_gettimeofday (struct timeval *tv) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/m68k/kernel/time.c linux/arch/m68k/kernel/time.c --- v2.4.0-test8/linux/arch/m68k/kernel/time.c Tue May 11 09:57:14 1999 +++ linux/arch/m68k/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -102,37 +102,6 @@ #endif /* CONFIG_HEARTBEAT */ } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void time_init(void) { unsigned int year, mon, day, hour, min, sec; diff -u --recursive --new-file v2.4.0-test8/linux/arch/m68k/mac/misc.c linux/arch/m68k/mac/misc.c --- v2.4.0-test8/linux/arch/m68k/mac/misc.c Tue Feb 15 22:39:01 2000 +++ linux/arch/m68k/mac/misc.c Mon Sep 11 08:39:48 2000 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -497,37 +498,6 @@ sti(); printk ("Restart failed. Please restart manually.\n"); while(1); -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/dec/time.c linux/arch/mips/dec/time.c --- v2.4.0-test8/linux/arch/mips/dec/time.c Wed Jul 12 15:14:41 2000 +++ linux/arch/mips/dec/time.c Mon Sep 11 08:39:48 2000 @@ -346,37 +346,6 @@ } } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + - year * 365 - 719499 - ) * 24 + hour /* now have hours */ - ) * 60 + min /* now have minutes */ - ) * 60 + sec; /* finally seconds */ -} - char cyclecounter_available; static inline void init_cycle_counter(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/kernel/time.c linux/arch/mips/kernel/time.c --- v2.4.0-test8/linux/arch/mips/kernel/time.c Tue Jul 11 11:14:48 2000 +++ linux/arch/mips/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -443,37 +443,6 @@ r4k_timer_interrupt (INDY_R4K_TIMER_IRQ, NULL, regs); } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - char cyclecounter_available; static inline void init_cycle_counter(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips/sgi/kernel/indy_timer.c linux/arch/mips/sgi/kernel/indy_timer.c --- v2.4.0-test8/linux/arch/mips/sgi/kernel/indy_timer.c Sat May 13 08:29:14 2000 +++ linux/arch/mips/sgi/kernel/indy_timer.c Mon Sep 11 08:39:48 2000 @@ -151,37 +151,6 @@ return ct1 - ct0; } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long __init get_indy_time(void) { struct indy_clock *clock = (struct indy_clock *)INDY_CLOCK_REGS; diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips64/sgi-ip22/ip22-timer.c linux/arch/mips64/sgi-ip22/ip22-timer.c --- v2.4.0-test8/linux/arch/mips64/sgi-ip22/ip22-timer.c Sat May 13 08:30:17 2000 +++ linux/arch/mips64/sgi-ip22/ip22-timer.c Mon Sep 11 08:39:48 2000 @@ -151,37 +151,6 @@ return ct1 - ct0; } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long __init get_indy_time(void) { struct indy_clock *clock = (struct indy_clock *)INDY_CLOCK_REGS; diff -u --recursive --new-file v2.4.0-test8/linux/arch/mips64/sgi-ip27/ip27-timer.c linux/arch/mips64/sgi-ip27/ip27-timer.c --- v2.4.0-test8/linux/arch/mips64/sgi-ip27/ip27-timer.c Tue Jul 11 11:18:53 2000 +++ linux/arch/mips64/sgi-ip27/ip27-timer.c Mon Sep 11 08:39:48 2000 @@ -219,37 +219,6 @@ #include #include -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - #define DEBUG_RTC static unsigned long __init get_m48t35_time(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/Config.in linux/arch/ppc/8260_io/Config.in --- v2.4.0-test8/linux/arch/ppc/8260_io/Config.in Tue May 2 13:05:39 2000 +++ linux/arch/ppc/8260_io/Config.in Sun Sep 17 09:48:05 2000 @@ -11,12 +11,15 @@ bool 'Ethernet on SCC2' CONFIG_SCC2_ENET fi fi - bool 'FCC Ethernet' CONFIG_FCC_ENET - if [ "$CONFIG_FCC_ENET" = "y" ]; then - bool 'Ethernet on FCC1' CONFIG_FCC1_ENET - if [ "$CONFIG_FCC1_ENET" != "y" ]; then - bool 'Ethernet on FCC2' CONFIG_FCC2_ENET - fi +# +# CONFIG_FEC_ENET is only used to get netdevices to call our init +# function. Any combination of FCC1,2,3 are supported. +# + bool 'FCC Ethernet' CONFIG_FEC_ENET + if [ "$CONFIG_FEC_ENET" = "y" ]; then + bool 'Ethernet on FCC1' CONFIG_FCC1_ENET + bool 'Ethernet on FCC2' CONFIG_FCC2_ENET + bool 'Ethernet on FCC3' CONFIG_FCC3_ENET fi endmenu fi diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/Makefile linux/arch/ppc/8260_io/Makefile --- v2.4.0-test8/linux/arch/ppc/8260_io/Makefile Tue May 2 13:05:39 2000 +++ linux/arch/ppc/8260_io/Makefile Sun Sep 17 09:48:05 2000 @@ -10,8 +10,8 @@ O_TARGET := 8260_io.a O_OBJS = commproc.o uart.o -ifdef CONFIG_FCC_ENET -O_OBJS += fcc.o +ifdef CONFIG_FEC_ENET +O_OBJS += fcc_enet.o endif ifdef CONFIG_SCC_ENET O_OBJS += enet.o diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/commproc.c linux/arch/ppc/8260_io/commproc.c --- v2.4.0-test8/linux/arch/ppc/8260_io/commproc.c Wed May 3 01:47:56 2000 +++ linux/arch/ppc/8260_io/commproc.c Sun Sep 17 09:48:05 2000 @@ -69,17 +69,27 @@ cpmp = (cpm8260_t *)commproc; } -/* Allocate some memory from the dual ported ram. We may want to - * enforce alignment restrictions, but right now everyone is a good - * citizen. +/* Allocate some memory from the dual ported ram. + * To help protocols with object alignment restrictions, we do that + * if they ask. */ uint -m8260_cpm_dpalloc(uint size) +m8260_cpm_dpalloc(uint size, uint align) { uint retloc; + uint align_mask, off; + uint savebase; - if ((dp_alloc_base + size) >= dp_alloc_top) + align_mask = align - 1; + savebase = dp_alloc_base; + + if ((off = (dp_alloc_base & align_mask)) != 0) + dp_alloc_base += (align - off); + + if ((dp_alloc_base + size) >= dp_alloc_top) { + dp_alloc_base = savebase; return(CPM_DP_NOSPACE); + } retloc = dp_alloc_base; dp_alloc_base += size; @@ -91,12 +101,22 @@ * UART "fifos" and the like. */ uint -m8260_cpm_hostalloc(uint size) +m8260_cpm_hostalloc(uint size, uint align) { uint retloc; + uint align_mask, off; + uint savebase; + + align_mask = align - 1; + savebase = host_buffer; + + if ((off = (host_buffer & align_mask)) != 0) + host_buffer += (align - off); - if ((host_buffer + size) >= host_end) + if ((host_buffer + size) >= host_end) { + host_buffer = savebase; return(0); + } retloc = host_buffer; host_buffer += size; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/enet.c linux/arch/ppc/8260_io/enet.c --- v2.4.0-test8/linux/arch/ppc/8260_io/enet.c Mon Jun 19 13:25:05 2000 +++ linux/arch/ppc/8260_io/enet.c Sun Sep 17 09:48:05 2000 @@ -466,8 +466,11 @@ cep->stats.rx_bytes += pkt_len; /* This does 16 byte alignment, much more than we need. - */ - skb = dev_alloc_skb(pkt_len); + * The packet length includes FCS, but we don't want to + * include that when passing upstream as it messes up + * bridging applications. + */ + skb = dev_alloc_skb(pkt_len-4); if (skb == NULL) { printk("%s: Memory squeeze, dropping packet.\n", dev->name); @@ -475,10 +478,10 @@ } else { skb->dev = dev; - skb_put(skb,pkt_len); /* Make room */ + skb_put(skb,pkt_len-4); /* Make room */ eth_copy_and_sum(skb, (unsigned char *)__va(bdp->cbd_bufaddr), - pkt_len, 0); + pkt_len-4, 0); skb->protocol=eth_type_trans(skb,dev); netif_rx(skb); } @@ -549,10 +552,10 @@ /* Log any net taps. */ printk("%s: Promiscuous mode enabled.\n", dev->name); - cep->sccp->scc_pmsr |= SCC_PMSR_PRO; + cep->sccp->scc_pmsr |= SCC_PSMR_PRO; } else { - cep->sccp->scc_pmsr &= ~SCC_PMSR_PRO; + cep->sccp->scc_pmsr &= ~SCC_PSMR_PRO; if (dev->flags & IFF_ALLMULTI) { /* Catch all multicast addresses, so set the @@ -678,11 +681,11 @@ * These are relative offsets in the DP ram address space. * Initialize base addresses for the buffer descriptors. */ - i = m8260_cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE); + i = m8260_cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8); ep->sen_genscc.scc_rbase = i; cep->rx_bd_base = (cbd_t *)&immap->im_dprambase[i]; - i = m8260_cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE); + i = m8260_cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8); ep->sen_genscc.scc_tbase = i; cep->tx_bd_base = (cbd_t *)&immap->im_dprambase[i]; @@ -816,7 +819,7 @@ /* Set processing mode. Use Ethernet CRC, catch broadcast, and * start frame search 22 bit times after RENA. */ - sccp->scc_pmsr = (SCC_PMSR_ENCRC | SCC_PMSR_NIB22); + sccp->scc_pmsr = (SCC_PSMR_ENCRC | SCC_PSMR_NIB22); /* It is now OK to enable the Ethernet transmitter. * Unfortunately, there are board implementation differences here. diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/fcc_enet.c linux/arch/ppc/8260_io/fcc_enet.c --- v2.4.0-test8/linux/arch/ppc/8260_io/fcc_enet.c Wed Dec 31 16:00:00 1969 +++ linux/arch/ppc/8260_io/fcc_enet.c Sun Sep 17 09:48:05 2000 @@ -0,0 +1,1600 @@ +/* + * Fast Ethernet Controller (FCC) driver for Motorola MPC8260. + * Copyright (c) 2000 MontaVista Software, Inc. Dan Malek (dmalek@jlc.net) + * + * This version of the driver is a combination of the 8xx fec and + * 8260 SCC Ethernet drivers. People seem to be choosing common I/O + * configurations, so this driver will work on the EST8260 boards and + * others yet to be announced. + * + * Right now, I am very watseful with the buffers. I allocate memory + * pages and then divide them into 2K frame buffers. This way I know I + * have buffers large enough to hold one frame within one buffer descriptor. + * Once I get this working, I will use 64 or 128 byte CPM buffers, which + * will be much more memory efficient and will easily handle lots of + * small packets. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* The transmitter timeout + */ +#define TX_TIMEOUT (2*HZ) + +/* The number of Tx and Rx buffers. These are allocated from the page + * pool. The code may assume these are power of two, so it it best + * to keep them that size. + * We don't need to allocate pages for the transmitter. We just use + * the skbuffer directly. + */ +#define FCC_ENET_RX_PAGES 16 +#define FCC_ENET_RX_FRSIZE 2048 +#define FCC_ENET_RX_FRPPG (PAGE_SIZE / FCC_ENET_RX_FRSIZE) +#define RX_RING_SIZE (FCC_ENET_RX_FRPPG * FCC_ENET_RX_PAGES) +#define TX_RING_SIZE 16 /* Must be power of two */ +#define TX_RING_MOD_MASK 15 /* for this to work */ + +/* The FCC stores dest/src/type, data, and checksum for receive packets. + */ +#define PKT_MAXBUF_SIZE 1518 +#define PKT_MINBUF_SIZE 64 + +/* Maximum input DMA size. Must be a should(?) be a multiple of 4. +*/ +#define PKT_MAXDMA_SIZE 1520 + +/* Maximum input buffer size. Must be a multiple of 32. +*/ +#define PKT_MAXBLR_SIZE 1536 + +static int fcc_enet_open(struct net_device *dev); +static int fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev); +static int fcc_enet_rx(struct net_device *dev); +static void fcc_enet_mii(struct net_device *dev); +static void fcc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs); +static int fcc_enet_close(struct net_device *dev); +static struct net_device_stats *fcc_enet_get_stats(struct net_device *dev); +static void set_multicast_list(struct net_device *dev); +static void restart_fcc(struct net_device *dev); + +/* These will be configurable for the FCC choice. + * Multiple ports can be configured. There is little choice among the + * I/O pins to the PHY, except the clocks. We will need some board + * dependent clock selection. + * Why in the hell did I put these inside #ifdef's? I dunno, maybe to + * help show what pins are used for each device. + */ + +/* I/O Pin assignment for FCC1. I don't yet know the best way to do this, + * but there is little variation among the choices. + */ +#define PA1_COL ((uint)0x00000001) +#define PA1_CRS ((uint)0x00000002) +#define PA1_TXER ((uint)0x00000004) +#define PA1_TXEN ((uint)0x00000008) +#define PA1_RXDV ((uint)0x00000010) +#define PA1_RXER ((uint)0x00000020) +#define PA1_TXDAT ((uint)0x00003c00) +#define PA1_RXDAT ((uint)0x0003c000) +#define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT) +#define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \ + PA1_RXDV | PA1_RXER) +#define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV) +#define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER) + +/* CLK12 is receive, CLK11 is transmit. These are board specific. +*/ +#define PC_F1RXCLK ((uint)0x00000800) +#define PC_F1TXCLK ((uint)0x00000400) +#define CMX1_CLK_ROUTE ((uint)0x3e000000) +#define CMX1_CLK_MASK ((uint)0xff000000) + +/* I/O Pin assignment for FCC2. I don't yet know the best way to do this, + * but there is little variation among the choices. + */ +#define PB2_TXER ((uint)0x00000001) +#define PB2_RXDV ((uint)0x00000002) +#define PB2_TXEN ((uint)0x00000004) +#define PB2_RXER ((uint)0x00000008) +#define PB2_COL ((uint)0x00000010) +#define PB2_CRS ((uint)0x00000020) +#define PB2_TXDAT ((uint)0x000003c0) +#define PB2_RXDAT ((uint)0x00003c00) +#define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \ + PB2_RXER | PB2_RXDV | PB2_TXER) +#define PB2_PSORB1 (PB2_TXEN) +#define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV) +#define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER) + +/* CLK13 is receive, CLK14 is transmit. These are board dependent. +*/ +#define PC_F2RXCLK ((uint)0x00001000) +#define PC_F2TXCLK ((uint)0x00002000) +#define CMX2_CLK_ROUTE ((uint)0x00250000) +#define CMX2_CLK_MASK ((uint)0x00ff0000) + +/* I/O Pin assignment for FCC3. I don't yet know the best way to do this, + * but there is little variation among the choices. + */ +#define PB3_RXDV ((uint)0x00004000) +#define PB3_RXER ((uint)0x00008000) +#define PB3_TXER ((uint)0x00010000) +#define PB3_TXEN ((uint)0x00020000) +#define PB3_COL ((uint)0x00040000) +#define PB3_CRS ((uint)0x00080000) +#define PB3_TXDAT ((uint)0x0f000000) +#define PB3_RXDAT ((uint)0x00f00000) +#define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \ + PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN) +#define PB3_PSORB1 (0) +#define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV) +#define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER) + +/* CLK15 is receive, CLK16 is transmit. These are board dependent. +*/ +#define PC_F3RXCLK ((uint)0x00004000) +#define PC_F3TXCLK ((uint)0x00008000) +#define CMX3_CLK_ROUTE ((uint)0x00003700) +#define CMX3_CLK_MASK ((uint)0x0000ff00) + +/* MII status/control serial interface. +*/ +#define PC_MDIO ((uint)0x00400000) +#define PC_MDCK ((uint)0x00200000) + +/* A table of information for supporting FCCs. This does two things. + * First, we know how many FCCs we have and they are always externally + * numbered from zero. Second, it holds control register and I/O + * information that could be different among board designs. + */ +typedef struct fcc_info { + uint fc_fccnum; + uint fc_cpmblock; + uint fc_cpmpage; + uint fc_proff; + uint fc_interrupt; + uint fc_trxclocks; + uint fc_clockroute; + uint fc_clockmask; + uint fc_mdio; + uint fc_mdck; +} fcc_info_t; + +static fcc_info_t fcc_ports[] = { +#ifdef CONFIG_FCC1_ENET + { 0, CPM_CR_FCC1_SBLOCK, CPM_CR_FCC1_PAGE, PROFF_FCC1, SIU_INT_FCC1, + (PC_F1RXCLK | PC_F1TXCLK), CMX1_CLK_ROUTE, CMX1_CLK_MASK, + PC_MDIO, PC_MDCK }, +#endif +#ifdef CONFIG_FCC2_ENET + { 1, CPM_CR_FCC2_SBLOCK, CPM_CR_FCC2_PAGE, PROFF_FCC2, SIU_INT_FCC2, + (PC_F2RXCLK | PC_F2TXCLK), CMX2_CLK_ROUTE, CMX2_CLK_MASK, + PC_MDIO, PC_MDCK }, +#endif +#ifdef CONFIG_FCC3_ENET + { 2, CPM_CR_FCC3_SBLOCK, CPM_CR_FCC3_PAGE, PROFF_FCC3, SIU_INT_FCC3, + (PC_F3RXCLK | PC_F3TXCLK), CMX3_CLK_ROUTE, CMX3_CLK_MASK, + PC_MDIO, PC_MDCK }, +#endif +}; + +/* The FCC buffer descriptors track the ring buffers. The rx_bd_base and + * tx_bd_base always point to the base of the buffer descriptors. The + * cur_rx and cur_tx point to the currently available buffer. + * The dirty_tx tracks the current buffer that is being sent by the + * controller. The cur_tx and dirty_tx are equal under both completely + * empty and completely full conditions. The empty/ready indicator in + * the buffer descriptor determines the actual condition. + */ +struct fcc_enet_private { + /* The saved address of a sent-in-place packet/buffer, for skfree(). */ + struct sk_buff* tx_skbuff[TX_RING_SIZE]; + ushort skb_cur; + ushort skb_dirty; + + /* CPM dual port RAM relative addresses. + */ + cbd_t *rx_bd_base; /* Address of Rx and Tx buffers. */ + cbd_t *tx_bd_base; + cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ + cbd_t *dirty_tx; /* The ring entries to be free()ed. */ + volatile fcc_t *fccp; + volatile fcc_enet_t *ep; + struct net_device_stats stats; + uint tx_full; + spinlock_t lock; + uint phy_address; + uint phy_type; + uint phy_duplex; + fcc_info_t *fip; +}; + +static void init_fcc_shutdown(fcc_info_t *fip, struct fcc_enet_private *cep, + volatile immap_t *immap); +static void init_fcc_startup(fcc_info_t *fip, struct net_device *dev); +static void init_fcc_ioports(fcc_info_t *fip, volatile iop8260_t *io, + volatile immap_t *immap); +static void init_fcc_param(fcc_info_t *fip, struct net_device *dev, + volatile immap_t *immap); + +/* MII processing. We keep this as simple as possible. Requests are + * placed on the list (if there is room). When the request is finished + * by the MII, an optional function may be called. + */ +typedef struct mii_list { + uint mii_regval; + void (*mii_func)(uint val, struct net_device *dev); + struct mii_list *mii_next; +} mii_list_t; + +#define NMII 20 +mii_list_t mii_cmds[NMII]; +mii_list_t *mii_free; +mii_list_t *mii_head; +mii_list_t *mii_tail; + +static int phyaddr; +static uint phytype; + +static int mii_queue(int request, void (*func)(uint, struct net_device *)); +static void mii_startup_cmds(void); +static uint mii_send_receive(fcc_info_t *fip, uint cmd); + +/* Make MII read/write commands for the FCC. +*/ + +#define mk_mii_phyaddr(ADDR) (0x60020000 | ((ADDR) << 23) | (2 << 18)) + +#define mk_mii_read(REG) (0x60020000 | ((phyaddr << 23) | \ + (REG & 0x1f) << 18)) + +#define mk_mii_write(REG, VAL) (0x50020000 | ((phyaddr << 23) | \ + (REG & 0x1f) << 18) | \ + (VAL & 0xffff)) + + +static int +fcc_enet_open(struct net_device *dev) +{ + netif_start_queue(dev); + return 0; /* Always succeed */ +} + +static int +fcc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv; + volatile cbd_t *bdp; + + + /* Fill in a Tx ring entry */ + bdp = cep->cur_tx; + +#ifndef final_version + if (bdp->cbd_sc & BD_ENET_TX_READY) { + /* Ooops. All transmit buffers are full. Bail out. + * This should not happen, since cep->tx_full should be set. + */ + printk("%s: tx queue full!.\n", dev->name); + return 1; + } +#endif + + /* Clear all of the status flags. + */ + bdp->cbd_sc &= ~BD_ENET_TX_STATS; + + /* If the frame is short, tell CPM to pad it. + */ + if (skb->len <= ETH_ZLEN) + bdp->cbd_sc |= BD_ENET_TX_PAD; + else + bdp->cbd_sc &= ~BD_ENET_TX_PAD; + + /* Set buffer length and buffer pointer. + */ + bdp->cbd_datlen = skb->len; + bdp->cbd_bufaddr = __pa(skb->data); + + /* Save skb pointer. + */ + cep->tx_skbuff[cep->skb_cur] = skb; + + cep->stats.tx_bytes += skb->len; + cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK; + + spin_lock_irq(&cep->lock); + + /* Send it on its way. Tell CPM its ready, interrupt when done, + * its the last BD of the frame, and to put the CRC on the end. + */ + bdp->cbd_sc |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | BD_ENET_TX_LAST | BD_ENET_TX_TC); + +#if 0 + /* Errata says don't do this. + */ + cep->fccp->fcc_ftodr = 0x8000; +#endif + dev->trans_start = jiffies; + + /* If this was the last BD in the ring, start at the beginning again. + */ + if (bdp->cbd_sc & BD_ENET_TX_WRAP) + bdp = cep->tx_bd_base; + else + bdp++; + + if (bdp->cbd_sc & BD_ENET_TX_READY) { + netif_stop_queue(dev); + cep->tx_full = 1; + } + + cep->cur_tx = (cbd_t *)bdp; + + spin_unlock_irq(&cep->lock); + + return 0; +} + + +static void +fcc_enet_timeout(struct net_device *dev) +{ + struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv; + + printk("%s: transmit timed out.\n", dev->name); + cep->stats.tx_errors++; +#ifndef final_version + { + int i; + cbd_t *bdp; + printk(" Ring data dump: cur_tx %p%s cur_rx %p.\n", + cep->cur_tx, cep->tx_full ? " (full)" : "", + cep->cur_rx); + bdp = cep->tx_bd_base; + printk(" Tx @base %p :\n", bdp); + for (i = 0 ; i < TX_RING_SIZE; i++, bdp++) + printk("%04x %04x %08x\n", + bdp->cbd_sc, + bdp->cbd_datlen, + bdp->cbd_bufaddr); + bdp = cep->rx_bd_base; + printk(" Rx @base %p :\n", bdp); + for (i = 0 ; i < RX_RING_SIZE; i++, bdp++) + printk("%04x %04x %08x\n", + bdp->cbd_sc, + bdp->cbd_datlen, + bdp->cbd_bufaddr); + } +#endif + if (!cep->tx_full) + netif_wake_queue(dev); +} + +/* The interrupt handler. + */ +static void +fcc_enet_interrupt(int irq, void * dev_id, struct pt_regs * regs) +{ + struct net_device *dev = dev_id; + volatile struct fcc_enet_private *cep; + volatile cbd_t *bdp; + ushort int_events; + int must_restart; + + cep = (struct fcc_enet_private *)dev->priv; + + /* Get the interrupt events that caused us to be here. + */ + int_events = cep->fccp->fcc_fcce; + cep->fccp->fcc_fcce = int_events; + must_restart = 0; + + /* Handle receive event in its own function. + */ + if (int_events & FCC_ENET_RXF) + fcc_enet_rx(dev_id); + + /* Check for a transmit error. The manual is a little unclear + * about this, so the debug code until I get it figured out. It + * appears that if TXE is set, then TXB is not set. However, + * if carrier sense is lost during frame transmission, the TXE + * bit is set, "and continues the buffer transmission normally." + * I don't know if "normally" implies TXB is set when the buffer + * descriptor is closed.....trial and error :-). + */ + + /* Transmit OK, or non-fatal error. Update the buffer descriptors. + */ + if (int_events & (FCC_ENET_TXE | FCC_ENET_TXB)) { + spin_lock(&cep->lock); + bdp = cep->dirty_tx; + while ((bdp->cbd_sc&BD_ENET_TX_READY)==0) { + if ((bdp==cep->cur_tx) && (cep->tx_full == 0)) + break; + + if (bdp->cbd_sc & BD_ENET_TX_HB) /* No heartbeat */ + cep->stats.tx_heartbeat_errors++; + if (bdp->cbd_sc & BD_ENET_TX_LC) /* Late collision */ + cep->stats.tx_window_errors++; + if (bdp->cbd_sc & BD_ENET_TX_RL) /* Retrans limit */ + cep->stats.tx_aborted_errors++; + if (bdp->cbd_sc & BD_ENET_TX_UN) /* Underrun */ + cep->stats.tx_fifo_errors++; + if (bdp->cbd_sc & BD_ENET_TX_CSL) /* Carrier lost */ + cep->stats.tx_carrier_errors++; + + + /* No heartbeat or Lost carrier are not really bad errors. + * The others require a restart transmit command. + */ + if (bdp->cbd_sc & + (BD_ENET_TX_LC | BD_ENET_TX_RL | BD_ENET_TX_UN)) { + must_restart = 1; + cep->stats.tx_errors++; + } + + cep->stats.tx_packets++; + + /* Deferred means some collisions occurred during transmit, + * but we eventually sent the packet OK. + */ + if (bdp->cbd_sc & BD_ENET_TX_DEF) + cep->stats.collisions++; + + /* Free the sk buffer associated with this last transmit. + */ + dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]); + cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK; + + /* Update pointer to next buffer descriptor to be transmitted. + */ + if (bdp->cbd_sc & BD_ENET_TX_WRAP) + bdp = cep->tx_bd_base; + else + bdp++; + + /* I don't know if we can be held off from processing these + * interrupts for more than one frame time. I really hope + * not. In such a case, we would now want to check the + * currently available BD (cur_tx) and determine if any + * buffers between the dirty_tx and cur_tx have also been + * sent. We would want to process anything in between that + * does not have BD_ENET_TX_READY set. + */ + + /* Since we have freed up a buffer, the ring is no longer + * full. + */ + if (cep->tx_full) { + cep->tx_full = 0; + if (netif_queue_stopped(dev)) { + netif_wake_queue(dev); + } + } + + cep->dirty_tx = (cbd_t *)bdp; + } + + if (must_restart) { + volatile cpm8260_t *cp; + + /* Some transmit errors cause the transmitter to shut + * down. We now issue a restart transmit. Since the + * errors close the BD and update the pointers, the restart + * _should_ pick up without having to reset any of our + * pointers either. + */ + + cp = cpmp; + cp->cp_cpcr = + mk_cr_cmd(cep->fip->fc_cpmpage, cep->fip->fc_cpmblock, + 0x0c, CPM_CR_RESTART_TX) | CPM_CR_FLG; + while (cp->cp_cpcr & CPM_CR_FLG); + } + spin_unlock(&cep->lock); + } + + /* Check for receive busy, i.e. packets coming but no place to + * put them. + */ + if (int_events & FCC_ENET_BSY) { + cep->stats.rx_dropped++; + } + return; +} + +/* During a receive, the cur_rx points to the current incoming buffer. + * When we update through the ring, if the next incoming buffer has + * not been given to the system, we just set the empty indicator, + * effectively tossing the packet. + */ +static int +fcc_enet_rx(struct net_device *dev) +{ + struct fcc_enet_private *cep; + volatile cbd_t *bdp; + struct sk_buff *skb; + ushort pkt_len; + + cep = (struct fcc_enet_private *)dev->priv; + + /* First, grab all of the stats for the incoming packet. + * These get messed up if we get called due to a busy condition. + */ + bdp = cep->cur_rx; + +for (;;) { + if (bdp->cbd_sc & BD_ENET_RX_EMPTY) + break; + +#ifndef final_version + /* Since we have allocated space to hold a complete frame, both + * the first and last indicators should be set. + */ + if ((bdp->cbd_sc & (BD_ENET_RX_FIRST | BD_ENET_RX_LAST)) != + (BD_ENET_RX_FIRST | BD_ENET_RX_LAST)) + printk("CPM ENET: rcv is not first+last\n"); +#endif + + /* Frame too long or too short. + */ + if (bdp->cbd_sc & (BD_ENET_RX_LG | BD_ENET_RX_SH)) + cep->stats.rx_length_errors++; + if (bdp->cbd_sc & BD_ENET_RX_NO) /* Frame alignment */ + cep->stats.rx_frame_errors++; + if (bdp->cbd_sc & BD_ENET_RX_CR) /* CRC Error */ + cep->stats.rx_crc_errors++; + if (bdp->cbd_sc & BD_ENET_RX_OV) /* FIFO overrun */ + cep->stats.rx_crc_errors++; + + /* Report late collisions as a frame error. + * On this error, the BD is closed, but we don't know what we + * have in the buffer. So, just drop this frame on the floor. + */ + if (bdp->cbd_sc & BD_ENET_RX_CL) { + cep->stats.rx_frame_errors++; + } + else { + + /* Process the incoming frame. + */ + cep->stats.rx_packets++; + pkt_len = bdp->cbd_datlen; + cep->stats.rx_bytes += pkt_len; + + /* This does 16 byte alignment, much more than we need. + * The packet length includes FCS, but we don't want to + * include that when passing upstream as it messes up + * bridging applications. + */ + skb = dev_alloc_skb(pkt_len-4); + + if (skb == NULL) { + printk("%s: Memory squeeze, dropping packet.\n", dev->name); + cep->stats.rx_dropped++; + } + else { + skb->dev = dev; + skb_put(skb,pkt_len-4); /* Make room */ + eth_copy_and_sum(skb, + (unsigned char *)__va(bdp->cbd_bufaddr), + pkt_len-4, 0); + skb->protocol=eth_type_trans(skb,dev); + netif_rx(skb); + } + } + + /* Clear the status flags for this buffer. + */ + bdp->cbd_sc &= ~BD_ENET_RX_STATS; + + /* Mark the buffer empty. + */ + bdp->cbd_sc |= BD_ENET_RX_EMPTY; + + /* Update BD pointer to next entry. + */ + if (bdp->cbd_sc & BD_ENET_RX_WRAP) + bdp = cep->rx_bd_base; + else + bdp++; + + } + cep->cur_rx = (cbd_t *)bdp; + + return 0; +} + +static int +fcc_enet_close(struct net_device *dev) +{ + /* Don't know what to do yet. + */ + netif_stop_queue(dev); + + return 0; +} + +static struct net_device_stats *fcc_enet_get_stats(struct net_device *dev) +{ + struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv; + + return &cep->stats; +} + +/* The MII is simulated from the 8xx FEC implementation. The FCC + * is not responsible for the MII control/status interface. + */ +static void +fcc_enet_mii(struct net_device *dev) +{ + struct fcc_enet_private *fep; + mii_list_t *mip; + uint mii_reg; + + fep = (struct fcc_enet_private *)dev->priv; +#if 0 + ep = &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec); + mii_reg = ep->fec_mii_data; +#endif + + if ((mip = mii_head) == NULL) { + printk("MII and no head!\n"); + return; + } + + if (mip->mii_func != NULL) + (*(mip->mii_func))(mii_reg, dev); + + mii_head = mip->mii_next; + mip->mii_next = mii_free; + mii_free = mip; + +#if 0 + if ((mip = mii_head) != NULL) + ep->fec_mii_data = mip->mii_regval; +#endif +} + +static int +mii_queue(int regval, void (*func)(uint, struct net_device *)) +{ + unsigned long flags; + mii_list_t *mip; + int retval; + + retval = 0; + + save_flags(flags); + cli(); + + if ((mip = mii_free) != NULL) { + mii_free = mip->mii_next; + mip->mii_regval = regval; + mip->mii_func = func; + mip->mii_next = NULL; + if (mii_head) { + mii_tail->mii_next = mip; + mii_tail = mip; + } + else { + mii_head = mii_tail = mip; +#if 0 + (&(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec))->fec_mii_data = regval; +#endif + } + } + else { + retval = 1; + } + + restore_flags(flags); + + return(retval); +} + +static volatile uint full_duplex; + +static void +mii_status(uint mii_reg, struct net_device *dev) +{ + volatile uint prev_duplex; + + if (((mii_reg >> 18) & 0x1f) == 1) { + /* status register. + */ + printk("fec: "); + if (mii_reg & 0x0004) + printk("link up"); + else + printk("link down"); + + if (mii_reg & 0x0010) + printk(",remote fault"); + if (mii_reg & 0x0020) + printk(",auto complete"); + printk("\n"); + } + if (((mii_reg >> 18) & 0x1f) == 0x14) { + /* Extended chip status register. + */ + prev_duplex = full_duplex; + printk("fec: "); + if (mii_reg & 0x0800) + printk("100 Mbps"); + else + printk("10 Mbps"); + + if (mii_reg & 0x1000) { + printk(", Full-Duplex\n"); + full_duplex = 1; + } + else { + printk(", Half-Duplex\n"); + full_duplex = 0; + } +#if 0 + if (prev_duplex != full_duplex) + restart_fec(dev); +#endif + } + if (((mii_reg >> 18) & 0x1f) == 31) { + /* QS6612 PHY Control/Status. + * OK, now we have it all, so figure out what is going on. + */ + prev_duplex = full_duplex; + printk("fec: "); + + mii_reg = (mii_reg >> 2) & 7; + + if (mii_reg & 1) + printk("10 Mbps"); + else + printk("100 Mbps"); + + if (mii_reg > 4) { + printk(", Full-Duplex\n"); + full_duplex = 1; + } + else { + printk(", Half-Duplex\n"); + full_duplex = 0; + } + +#if 0 + if (prev_duplex != full_duplex) + restart_fec(dev); +#endif + } +} + +static uint phyno; + +static void +mii_discover_phy3(uint mii_reg, struct net_device *dev) +{ + phytype <<= 16; + phytype |= (mii_reg & 0xffff); + printk("fec: Phy @ 0x%x, type 0x%08x\n", phyno, phytype); + mii_startup_cmds(); +} + +static void +mii_discover_phy(uint mii_reg, struct net_device *dev) +{ + if (phyno < 32) { + if ((phytype = (mii_reg & 0xffff)) != 0xffff) { + phyaddr = phyno; + mii_queue(mk_mii_read(3), mii_discover_phy3); + } + else { + phyno++; + mii_queue(mk_mii_phyaddr(phyno), mii_discover_phy); + } + } + else { + printk("FEC: No PHY device found.\n"); + } +} + +static void +mii_discover_phy_poll(fcc_info_t *fip) +{ + uint rv; + int i; + + for (i=0; i<32; i++) { + rv = mii_send_receive(fip, mk_mii_phyaddr(i)); + if ((phytype = (rv & 0xffff)) != 0xffff) { + phyaddr = i; + rv = mii_send_receive(fip, mk_mii_read(3)); + phytype <<= 16; + phytype |= (rv & 0xffff); + printk("fec: Phy @ 0x%x, type 0x%08x\n", phyaddr, phytype); + } + } +} + +static void +mii_startup_cmds(void) +{ + +#if 1 + /* Level One PHY. + */ + + /* Read status registers to clear any pending interrupt. + */ + mii_queue(mk_mii_read(1), mii_status); + mii_queue(mk_mii_read(18), mii_status); + + /* Read extended chip status register. + */ + mii_queue(mk_mii_read(0x14), mii_status); + + /* Set default operation of 100-TX....for some reason + * some of these bits are set on power up, which is wrong. + */ + mii_queue(mk_mii_write(0x13, 0), NULL); + + /* Enable Link status change interrupts. + */ + mii_queue(mk_mii_write(0x11, 0x0002), NULL); + + /* Don't advertize Full duplex. + mii_queue(mk_mii_write(0x04, 0x0021), NULL); + */ +#endif + +} + +/* This supports the mii_link interrupt below. + * We should get called three times. Once for register 1, once for + * register 18, and once for register 20. + */ +static uint mii_saved_reg1; + +static void +mii_relink(uint mii_reg, struct net_device *dev) +{ + volatile uint prev_duplex; + unsigned long flags; + + if (((mii_reg >> 18) & 0x1f) == 1) { + /* Just save the status register and get out. + */ + mii_saved_reg1 = mii_reg; + return; + } + if (((mii_reg >> 18) & 0x1f) == 18) { + /* Not much here, but has to be read to clear the + * interrupt condition. + */ + if ((mii_reg & 0x8000) == 0) + printk("fec: re-link and no IRQ?\n"); + if ((mii_reg & 0x4000) == 0) + printk("fec: no PHY power?\n"); + } + if (((mii_reg >> 18) & 0x1f) == 20) { + /* Extended chip status register. + * OK, now we have it all, so figure out what is going on. + */ + prev_duplex = full_duplex; + printk("fec: "); + if (mii_saved_reg1 & 0x0004) + printk("link up"); + else + printk("link down"); + + if (mii_saved_reg1 & 0x0010) + printk(", remote fault"); + if (mii_saved_reg1 & 0x0020) + printk(", auto complete"); + + if (mii_reg & 0x0800) + printk(", 100 Mbps"); + else + printk(", 10 Mbps"); + + if (mii_reg & 0x1000) { + printk(", Full-Duplex\n"); + full_duplex = 1; + } + else { + printk(", Half-Duplex\n"); + full_duplex = 0; + } + if (prev_duplex != full_duplex) { + save_flags(flags); + cli(); +#if 0 + restart_fec(dev); +#endif + restore_flags(flags); + } + } + if (((mii_reg >> 18) & 0x1f) == 31) { + /* QS6612 PHY Control/Status. + * OK, now we have it all, so figure out what is going on. + */ + prev_duplex = full_duplex; + printk("fec: "); + if (mii_saved_reg1 & 0x0004) + printk("link up"); + else + printk("link down"); + + if (mii_saved_reg1 & 0x0010) + printk(", remote fault"); + if (mii_saved_reg1 & 0x0020) + printk(", auto complete"); + + mii_reg = (mii_reg >> 2) & 7; + + if (mii_reg & 1) + printk(", 10 Mbps"); + else + printk(", 100 Mbps"); + + if (mii_reg > 4) { + printk(", Full-Duplex\n"); + full_duplex = 1; + } + else { + printk(", Half-Duplex\n"); + full_duplex = 0; + } + +#if 0 + if (prev_duplex != full_duplex) { + save_flags(flags); + cli(); + restart_fec(dev); + restore_flags(flags); + } +#endif + } +} + +/* Set or clear the multicast filter for this adaptor. + * Skeleton taken from sunlance driver. + * The CPM Ethernet implementation allows Multicast as well as individual + * MAC address filtering. Some of the drivers check to make sure it is + * a group multicast address, and discard those that are not. I guess I + * will do the same for now, but just remove the test if you want + * individual filtering as well (do the upper net layers want or support + * this kind of feature?). + */ +static void +set_multicast_list(struct net_device *dev) +{ + struct fcc_enet_private *cep; + struct dev_mc_list *dmi; + u_char *mcptr, *tdptr; + volatile fcc_enet_t *ep; + int i, j; + + cep = (struct fcc_enet_private *)dev->priv; + +return; + /* Get pointer to FCC area in parameter RAM. + */ + ep = (fcc_enet_t *)dev->base_addr; + + if (dev->flags&IFF_PROMISC) { + + /* Log any net taps. */ + printk("%s: Promiscuous mode enabled.\n", dev->name); + cep->fccp->fcc_fpsmr |= FCC_PSMR_PRO; + } else { + + cep->fccp->fcc_fpsmr &= ~FCC_PSMR_PRO; + + if (dev->flags & IFF_ALLMULTI) { + /* Catch all multicast addresses, so set the + * filter to all 1's. + */ + ep->fen_gaddrh = 0xffffffff; + ep->fen_gaddrl = 0xffffffff; + } + else { + /* Clear filter and add the addresses in the list. + */ + ep->fen_gaddrh = 0; + ep->fen_gaddrl = 0; + + dmi = dev->mc_list; + + for (i=0; imc_count; i++) { + + /* Only support group multicast for now. + */ + if (!(dmi->dmi_addr[0] & 1)) + continue; + + /* The address in dmi_addr is LSB first, + * and taddr is MSB first. We have to + * copy bytes MSB first from dmi_addr. + */ + mcptr = (u_char *)dmi->dmi_addr + 5; + tdptr = (u_char *)&ep->fen_taddrh; + for (j=0; j<6; j++) + *tdptr++ = *mcptr--; + + /* Ask CPM to run CRC and set bit in + * filter mask. + */ + cpmp->cp_cpcr = mk_cr_cmd(cep->fip->fc_cpmpage, + cep->fip->fc_cpmblock, 0x0c, + CPM_CR_SET_GADDR) | CPM_CR_FLG; + udelay(10); + while (cpmp->cp_cpcr & CPM_CR_FLG); + } + } + } +} + +/* Initialize the CPM Ethernet on FCC. + */ +int __init fec_enet_init(void) +{ + struct net_device *dev; + struct fcc_enet_private *cep; + fcc_info_t *fip; + int i, np; + volatile immap_t *immap; + volatile iop8260_t *io; + + immap = (immap_t *)IMAP_ADDR; /* and to internal registers */ + io = &immap->im_ioport; + + np = sizeof(fcc_ports) / sizeof(fcc_info_t); + fip = fcc_ports; + + while (np-- > 0) { + + /* Allocate some private information. + */ + cep = (struct fcc_enet_private *) + kmalloc(sizeof(*cep), GFP_KERNEL); + __clear_user(cep,sizeof(*cep)); + spin_lock_init(&cep->lock); + cep->fip = fip; + + /* Create an Ethernet device instance. + */ + dev = init_etherdev(0, 0); + dev->priv = cep; + + init_fcc_shutdown(fip, cep, immap); + init_fcc_ioports(fip, io, immap); + init_fcc_param(fip, dev, immap); + + dev->base_addr = (unsigned long)(cep->ep); + + /* The CPM Ethernet specific entries in the device + * structure. + */ + dev->open = fcc_enet_open; + dev->hard_start_xmit = fcc_enet_start_xmit; + dev->tx_timeout = fcc_enet_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + dev->stop = fcc_enet_close; + dev->get_stats = fcc_enet_get_stats; + dev->set_multicast_list = set_multicast_list; + + init_fcc_startup(fip, dev); + + printk("%s: FCC ENET Version 0.2, ", dev->name); + for (i=0; i<5; i++) + printk("%02x:", dev->dev_addr[i]); + printk("%02x\n", dev->dev_addr[5]); + + /* This is just a hack for now that works only on the EST + * board, or anything else that has MDIO/CK configured. + * It is mainly to test the MII software clocking. + */ + mii_discover_phy_poll(fip); + + fip++; + } + + return 0; +} + +/* Make sure the device is shut down during initialization. +*/ +static void __init +init_fcc_shutdown(fcc_info_t *fip, struct fcc_enet_private *cep, + volatile immap_t *immap) +{ + volatile fcc_enet_t *ep; + volatile fcc_t *fccp; + + /* Get pointer to FCC area in parameter RAM. + */ + ep = (fcc_enet_t *)(&immap->im_dprambase[fip->fc_proff]); + + /* And another to the FCC register area. + */ + fccp = (volatile fcc_t *)(&immap->im_fcc[fip->fc_fccnum]); + cep->fccp = fccp; /* Keep the pointers handy */ + cep->ep = ep; + + /* Disable receive and transmit in case someone left it running. + */ + fccp->fcc_gfmr &= ~(FCC_GFMR_ENR | FCC_GFMR_ENT); +} + +/* Initialize the I/O pins for the FCC Ethernet. +*/ +static void __init +init_fcc_ioports(fcc_info_t *fip, volatile iop8260_t *io, + volatile immap_t *immap) +{ + + /* FCC1 pins are on port A/C. FCC2/3 are port B/C. + */ + if (fip->fc_proff == PROFF_FCC1) { + /* Configure port A and C pins for FCC1 Ethernet. + */ + io->iop_pdira &= ~PA1_DIRA0; + io->iop_pdira |= PA1_DIRA1; + io->iop_psora &= ~PA1_PSORA0; + io->iop_psora |= PA1_PSORA1; + io->iop_ppara |= (PA1_DIRA0 | PA1_DIRA1); + } + if (fip->fc_proff == PROFF_FCC2) { + /* Configure port B and C pins for FCC Ethernet. + */ + io->iop_pdirb &= ~PB2_DIRB0; + io->iop_pdirb |= PB2_DIRB1; + io->iop_psorb &= ~PB2_PSORB0; + io->iop_psorb |= PB2_PSORB1; + io->iop_pparb |= (PB2_DIRB0 | PB2_DIRB1); + } + if (fip->fc_proff == PROFF_FCC3) { + /* Configure port B and C pins for FCC Ethernet. + */ + io->iop_pdirb &= ~PB3_DIRB0; + io->iop_pdirb |= PB3_DIRB1; + io->iop_psorb &= ~PB3_PSORB0; + io->iop_psorb |= PB3_PSORB1; + io->iop_pparb |= (PB3_DIRB0 | PB3_DIRB1); + } + + /* Port C has clocks...... + */ + io->iop_psorc &= ~(fip->fc_trxclocks); + io->iop_pdirc &= ~(fip->fc_trxclocks); + io->iop_pparc |= fip->fc_trxclocks; + + /* ....and the MII serial clock/data. + */ + io->iop_pdatc |= (fip->fc_mdio | fip->fc_mdck); + io->iop_podrc |= fip->fc_mdio; + io->iop_pdirc |= (fip->fc_mdio | fip->fc_mdck); + io->iop_pparc &= ~(fip->fc_mdio | fip->fc_mdck); + + /* Configure Serial Interface clock routing. + * First, clear all FCC bits to zero, + * then set the ones we want. + */ + immap->im_cpmux.cmx_fcr &= ~(fip->fc_clockmask); + immap->im_cpmux.cmx_fcr |= fip->fc_clockroute; +} + +static void __init +init_fcc_param(fcc_info_t *fip, struct net_device *dev, + volatile immap_t *immap) +{ + unsigned char *eap; + unsigned long mem_addr; + bd_t *bd; + int i, j; + struct fcc_enet_private *cep; + volatile fcc_enet_t *ep; + volatile cbd_t *bdp; + volatile cpm8260_t *cp; + + cep = (struct fcc_enet_private *)(dev->priv); + ep = cep->ep; + cp = cpmp; + + bd = (bd_t *)__res; + + /* Zero the whole thing.....I must have missed some individually. + * It works when I do this. + */ + memset((char *)ep, 0, sizeof(fcc_enet_t)); + + /* Allocate space for the buffer descriptors in the DP ram. + * These are relative offsets in the DP ram address space. + * Initialize base addresses for the buffer descriptors. + */ +#if 0 + /* I really want to do this, but for some reason it doesn't + * work with the data cache enabled, so I allocate from the + * main memory instead. + */ + i = m8260_cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8); + ep->fen_genfcc.fcc_rbase = (uint)&immap->im_dprambase[i]; + cep->rx_bd_base = (cbd_t *)&immap->im_dprambase[i]; + + i = m8260_cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8); + ep->fen_genfcc.fcc_tbase = (uint)&immap->im_dprambase[i]; + cep->tx_bd_base = (cbd_t *)&immap->im_dprambase[i]; +#else + cep->rx_bd_base = (cbd_t *)m8260_cpm_hostalloc(sizeof(cbd_t) * RX_RING_SIZE, 8); + ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); + cep->tx_bd_base = (cbd_t *)m8260_cpm_hostalloc(sizeof(cbd_t) * TX_RING_SIZE, 8); + ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); +#endif + + cep->dirty_tx = cep->cur_tx = cep->tx_bd_base; + cep->cur_rx = cep->rx_bd_base; + + ep->fen_genfcc.fcc_rstate = (CPMFCR_GBL | CPMFCR_EB) << 24; + ep->fen_genfcc.fcc_tstate = (CPMFCR_GBL | CPMFCR_EB) << 24; + + /* Set maximum bytes per receive buffer. + * It must be a multiple of 32. + */ + ep->fen_genfcc.fcc_mrblr = PKT_MAXBLR_SIZE; + + /* Allocate space in the reserved FCC area of DPRAM for the + * internal buffers. No one uses this space (yet), so we + * can do this. Later, we will add resource management for + * this area. + */ + mem_addr = CPM_FCC_SPECIAL_BASE + (fip->fc_fccnum * 128); + ep->fen_genfcc.fcc_riptr = mem_addr; + ep->fen_genfcc.fcc_tiptr = mem_addr+32; + ep->fen_padptr = mem_addr+64; + memset((char *)(&(immap->im_dprambase[(mem_addr+64)])), 0x88, 32); + + ep->fen_genfcc.fcc_rbptr = 0; + ep->fen_genfcc.fcc_tbptr = 0; + ep->fen_genfcc.fcc_rcrc = 0; + ep->fen_genfcc.fcc_tcrc = 0; + ep->fen_genfcc.fcc_res1 = 0; + ep->fen_genfcc.fcc_res2 = 0; + + ep->fen_camptr = 0; /* CAM isn't used in this driver */ + + /* Set CRC preset and mask. + */ + ep->fen_cmask = 0xdebb20e3; + ep->fen_cpres = 0xffffffff; + + ep->fen_crcec = 0; /* CRC Error counter */ + ep->fen_alec = 0; /* alignment error counter */ + ep->fen_disfc = 0; /* discard frame counter */ + ep->fen_retlim = 15; /* Retry limit threshold */ + ep->fen_pper = 0; /* Normal persistence */ + + /* Clear hash filter tables. + */ + ep->fen_gaddrh = 0; + ep->fen_gaddrl = 0; + ep->fen_iaddrh = 0; + ep->fen_iaddrl = 0; + + /* Clear the Out-of-sequence TxBD. + */ + ep->fen_tfcstat = 0; + ep->fen_tfclen = 0; + ep->fen_tfcptr = 0; + + ep->fen_mflr = PKT_MAXBUF_SIZE; /* maximum frame length register */ + ep->fen_minflr = PKT_MINBUF_SIZE; /* minimum frame length register */ + + /* Set Ethernet station address. + * + * This is supplied in the board information structure, so we + * copy that into the controller. + * So, far we have only been given one Ethernet address. We make + * it unique by setting a few bits in the upper byte of the + * non-static part of the address. + */ + eap = (unsigned char *)&(ep->fen_paddrh); + for (i=5; i>=0; i--) { + if (i == 3) { + dev->dev_addr[i] = bd->bi_enetaddr[i]; + dev->dev_addr[i] |= (1 << (7 - fip->fc_fccnum)); + *eap++ = dev->dev_addr[i]; + } + else { + *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i]; + } + } + + ep->fen_taddrh = 0; + ep->fen_taddrm = 0; + ep->fen_taddrl = 0; + + ep->fen_maxd1 = PKT_MAXDMA_SIZE; /* maximum DMA1 length */ + ep->fen_maxd2 = PKT_MAXDMA_SIZE; /* maximum DMA2 length */ + + /* Clear stat counters, in case we ever enable RMON. + */ + ep->fen_octc = 0; + ep->fen_colc = 0; + ep->fen_broc = 0; + ep->fen_mulc = 0; + ep->fen_uspc = 0; + ep->fen_frgc = 0; + ep->fen_ospc = 0; + ep->fen_jbrc = 0; + ep->fen_p64c = 0; + ep->fen_p65c = 0; + ep->fen_p128c = 0; + ep->fen_p256c = 0; + ep->fen_p512c = 0; + ep->fen_p1024c = 0; + + ep->fen_rfthr = 0; /* Suggested by manual */ + ep->fen_rfcnt = 0; + ep->fen_cftype = 0; + + /* Now allocate the host memory pages and initialize the + * buffer descriptors. + */ + bdp = cep->tx_bd_base; + for (i=0; icbd_sc = 0; + bdp->cbd_datlen = 0; + bdp->cbd_bufaddr = 0; + bdp++; + } + + /* Set the last buffer to wrap. + */ + bdp--; + bdp->cbd_sc |= BD_SC_WRAP; + + bdp = cep->rx_bd_base; + for (i=0; icbd_sc = BD_ENET_RX_EMPTY | BD_ENET_RX_INTR; + bdp->cbd_datlen = 0; + bdp->cbd_bufaddr = __pa(mem_addr); + mem_addr += FCC_ENET_RX_FRSIZE; + bdp++; + } + } + + /* Set the last buffer to wrap. + */ + bdp--; + bdp->cbd_sc |= BD_SC_WRAP; + + /* Let's re-initialize the channel now. We have to do it later + * than the manual describes because we have just now finished + * the BD initialization. + */ + cp->cp_cpcr = mk_cr_cmd(fip->fc_cpmpage, fip->fc_cpmblock, 0x0c, + CPM_CR_INIT_TRX) | CPM_CR_FLG; + while (cp->cp_cpcr & CPM_CR_FLG); + + cep->skb_cur = cep->skb_dirty = 0; +} + +/* Let 'er rip. +*/ +static void __init +init_fcc_startup(fcc_info_t *fip, struct net_device *dev) +{ + volatile fcc_t *fccp; + struct fcc_enet_private *cep; + + cep = (struct fcc_enet_private *)(dev->priv); + fccp = cep->fccp; + + fccp->fcc_fcce = 0xffff; /* Clear any pending events */ + + /* Enable interrupts for transmit error, complete frame + * received, and any transmit buffer we have also set the + * interrupt flag. + */ + fccp->fcc_fccm = (FCC_ENET_TXE | FCC_ENET_RXF | FCC_ENET_TXB); + + /* Install our interrupt handler. + */ + if (request_8xxirq(fip->fc_interrupt, fcc_enet_interrupt, 0, + "fenet", dev) < 0) + printk("Can't get FCC IRQ %d\n", fip->fc_interrupt); + + /* Set GFMR to enable Ethernet operating mode. + */ + fccp->fcc_gfmr = (FCC_GFMR_TCI | FCC_GFMR_MODE_ENET); + + /* Set sync/delimiters. + */ + fccp->fcc_fdsr = 0xd555; + + /* Set protocol specific processing mode for Ethernet. + * This has to be adjusted for Full Duplex operation after we can + * determine how to detect that. + */ + fccp->fcc_fpsmr = FCC_PSMR_ENCRC; + + /* And last, enable the transmit and receive processing. + */ + fccp->fcc_gfmr |= (FCC_GFMR_ENR | FCC_GFMR_ENT); +} + +/* MII command/status interface. + * I'm not going to describe all of the details. You can find the + * protocol definition in many other places, including the data sheet + * of most PHY parts. + * I wonder what "they" were thinking (maybe weren't) when they leave + * the I2C in the CPM but I have to toggle these bits...... + */ +static uint +mii_send_receive(fcc_info_t *fip, uint cmd) +{ + unsigned long flags; + uint retval; + int read_op, i; + volatile immap_t *immap; + volatile iop8260_t *io; + + immap = (immap_t *)IMAP_ADDR; + io = &immap->im_ioport; + + /* When we get here, both clock and data are high, outputs. + * Output is open drain. + * Data transitions on high->low clock, is valid on low->high clock. + * Spec says edge transitions no closer than 160 nSec, minimum clock + * cycle 400 nSec. I could only manage about 500 nSec edges with + * an XOR loop, so I won't worry about delays yet. + * I disable interrupts during bit flipping to ensure atomic + * updates of the registers. I do lots of interrupt disable/enable + * to ensure we don't hang out too long with interrupts disabled. + */ + + /* First, crank out 32 1-bits as preamble. + * This is 64 transitions to clock the bits, with clock/data + * left high. + */ + save_flags(flags); + cli(); + for (i=0; i<64; i++) { + io->iop_pdatc ^= fip->fc_mdck; + udelay(0); + } + restore_flags(flags); + + read_op = ((cmd & 0xf0000000) == 0x60000000); + + /* We return the command word on a write op, or the command portion + * plus the new data on a read op. This is what the 8xx FEC does, + * and it allows the functions to simply look at the returned value + * and know the PHY/register as well. + */ + if (read_op) + retval = cmd; + else + retval = (cmd >> 16); + + /* Clock out the first 16 MS bits of the command. + */ + save_flags(flags); + cli(); + for (i=0; i<16; i++) { + io->iop_pdatc &= ~(fip->fc_mdck); + if (cmd & 0x80000000) + io->iop_pdatc |= fip->fc_mdio; + else + io->iop_pdatc &= ~(fip->fc_mdio); + cmd <<= 1; + io->iop_pdatc |= fip->fc_mdck; + udelay(0); + } + + /* Do the turn-around. If read op, we make the IO and input. + * If write op, do the 1/0 thing. + */ + io->iop_pdatc &= ~(fip->fc_mdck); + if (read_op) + io->iop_pdirc &= ~(fip->fc_mdio); + else + io->iop_pdatc |= fip->fc_mdio; + io->iop_pdatc |= fip->fc_mdck; + + /* I do this mainly to get just a little delay. + */ + restore_flags(flags); + save_flags(flags); + cli(); + io->iop_pdatc &= ~(fip->fc_mdck); + io->iop_pdirc &= ~(fip->fc_mdio); + io->iop_pdatc |= fip->fc_mdck; + + restore_flags(flags); + save_flags(flags); + cli(); + + /* For read, clock in 16 bits. For write, clock out + * rest of command. + */ + if (read_op) { + io->iop_pdatc &= ~(fip->fc_mdck); + udelay(0); + for (i=0; i<16; i++) { + io->iop_pdatc |= fip->fc_mdck; + udelay(0); + retval <<= 1; + if (io->iop_pdatc & fip->fc_mdio) + retval |= 1; + io->iop_pdatc &= ~(fip->fc_mdck); + udelay(0); + } + } + else { + for (i=0; i<16; i++) { + io->iop_pdatc &= ~(fip->fc_mdck); + if (cmd & 0x80000000) + io->iop_pdatc |= fip->fc_mdio; + else + io->iop_pdatc &= ~(fip->fc_mdio); + cmd <<= 1; + io->iop_pdatc |= fip->fc_mdck; + udelay(0); + } + io->iop_pdatc &= ~(fip->fc_mdck); + } + restore_flags(flags); + + /* Some diagrams show two 1 bits for "idle". I don't know if + * this is really necessary or if it was just to indicate nothing + * is going to happen for a while. + * Make the data pin an output, set the data high, and clock it. + */ + save_flags(flags); + cli(); + io->iop_pdatc |= fip->fc_mdio; + io->iop_pdirc |= fip->fc_mdio; + for (i=0; i<3; i++) + io->iop_pdatc ^= fip->fc_mdck; + restore_flags(flags); + + /* We exit with the same conditions as entry. + */ + return(retval); +} diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8260_io/uart.c linux/arch/ppc/8260_io/uart.c --- v2.4.0-test8/linux/arch/ppc/8260_io/uart.c Wed Jul 5 11:24:40 2000 +++ linux/arch/ppc/8260_io/uart.c Sun Sep 17 09:48:05 2000 @@ -977,8 +977,7 @@ } if (from_user) { - if (c != - copy_from_user(__va(bdp->cbd_bufaddr), buf, c)) { + if (copy_from_user(__va(bdp->cbd_bufaddr), buf, c)) { if (!ret) ret = -EFAULT; break; @@ -2396,10 +2395,10 @@ io->iop_pdird &= ~0x00800000; io->iop_psord &= ~0x00c00000; #if USE_SMC2 - io->iop_ppara |= 0x01800000; - io->iop_pdira |= 0x00800000; - io->iop_pdira &= ~0x01000000; - io->iop_psora &= ~0x01800000; + io->iop_ppara |= 0x00c00000; + io->iop_pdira |= 0x00400000; + io->iop_pdira &= ~0x00800000; + io->iop_psora &= ~0x00c00000; #endif /* Configure SCC2 and SCC3. Be careful about the fine print. @@ -2473,11 +2472,11 @@ * descriptors from dual port ram, and a character * buffer area from host mem. */ - dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * RX_NUM_FIFO); + dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * RX_NUM_FIFO, 8); /* Allocate space for FIFOs in the host memory. */ - mem_addr = m8260_cpm_hostalloc(RX_NUM_FIFO * RX_BUF_SIZE); + mem_addr = m8260_cpm_hostalloc(RX_NUM_FIFO * RX_BUF_SIZE, 1); /* Set the physical address of the host memory * buffers in the buffer descriptors, and the @@ -2506,11 +2505,11 @@ sup->scc_genscc.scc_rbase = dp_addr; } - dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * TX_NUM_FIFO); + dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * TX_NUM_FIFO, 8); /* Allocate space for FIFOs in the host memory. */ - mem_addr = m8260_cpm_hostalloc(TX_NUM_FIFO * TX_BUF_SIZE); + mem_addr = m8260_cpm_hostalloc(TX_NUM_FIFO * TX_BUF_SIZE, 1); /* Set the physical address of the host memory * buffers in the buffer descriptors, and the @@ -2716,11 +2715,11 @@ /* Allocate space for two buffer descriptors in the DP ram. */ - dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * 2); + dp_addr = m8260_cpm_dpalloc(sizeof(cbd_t) * 2, 8); /* Allocate space for two 2 byte FIFOs in the host memory. */ - mem_addr = m8260_cpm_hostalloc(4); + mem_addr = m8260_cpm_hostalloc(4, 1); /* Set the physical address of the host memory buffers in * the buffer descriptors. diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8xx_io/enet.c linux/arch/ppc/8xx_io/enet.c --- v2.4.0-test8/linux/arch/ppc/8xx_io/enet.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/8xx_io/enet.c Sun Sep 17 09:48:05 2000 @@ -484,8 +484,11 @@ cep->stats.rx_bytes += pkt_len; /* This does 16 byte alignment, much more than we need. - */ - skb = dev_alloc_skb(pkt_len); + * The packet length includes FCS, but we don't want to + * include that when passing upstream as it messes up + * bridging applications. + */ + skb = dev_alloc_skb(pkt_len-4); if (skb == NULL) { printk("%s: Memory squeeze, dropping packet.\n", dev->name); @@ -493,10 +496,10 @@ } else { skb->dev = dev; - skb_put(skb,pkt_len); /* Make room */ + skb_put(skb,pkt_len-4); /* Make room */ eth_copy_and_sum(skb, (unsigned char *)__va(bdp->cbd_bufaddr), - pkt_len, 0); + pkt_len-4, 0); skb->protocol=eth_type_trans(skb,dev); netif_rx(skb); } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/8xx_io/fec.c linux/arch/ppc/8xx_io/fec.c --- v2.4.0-test8/linux/arch/ppc/8xx_io/fec.c Mon Jun 19 13:25:06 2000 +++ linux/arch/ppc/8xx_io/fec.c Sun Sep 17 09:48:06 2000 @@ -669,18 +669,21 @@ #endif /* This does 16 byte alignment, exactly what we need. + * The packet length includes FCS, but we don't want to + * include that when passing upstream as it messes up + * bridging applications. */ - skb = dev_alloc_skb(pkt_len); + skb = dev_alloc_skb(pkt_len-4); if (skb == NULL) { printk("%s: Memory squeeze, dropping packet.\n", dev->name); fep->stats.rx_dropped++; } else { skb->dev = dev; - skb_put(skb,pkt_len); /* Make room */ + skb_put(skb,pkt_len-4); /* Make room */ eth_copy_and_sum(skb, (unsigned char *)__va(bdp->cbd_bufaddr), - pkt_len, 0); + pkt_len-4, 0); skb->protocol=eth_type_trans(skb,dev); netif_rx(skb); } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/amiga/time.c linux/arch/ppc/amiga/time.c --- v2.4.0-test8/linux/arch/ppc/amiga/time.c Thu Oct 7 10:17:08 1999 +++ linux/arch/ppc/amiga/time.c Mon Sep 11 08:39:48 2000 @@ -11,10 +11,6 @@ #include -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec); - unsigned long m68k_get_rtc_time(void) { unsigned int year, mon, day, hour, min, sec; @@ -36,38 +32,6 @@ return mach_set_clock_mmss (nowtime); return -1; } - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - void apus_heartbeat (void) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/chrpboot/Makefile linux/arch/ppc/chrpboot/Makefile --- v2.4.0-test8/linux/arch/ppc/chrpboot/Makefile Mon Jun 19 17:59:35 2000 +++ linux/arch/ppc/chrpboot/Makefile Sun Sep 17 09:48:06 2000 @@ -67,11 +67,13 @@ zImage: $(OBJS) no_initrd.o addnote $(LD) $(LD_ARGS) -o $@ $(OBJS) no_initrd.o $(LIBS) - ./addnote $@ + cp $@ $@.rs6k + ./addnote $@.rs6k zImage.initrd: $(OBJS) initrd.o addnote $(LD) $(LD_ARGS) -o $@ $(OBJS) initrd.o $(LIBS) - ./addnote $@ + cp $@ $@.rs6k + ./addnote $@.rs6k else znetboot: diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/chrpboot/addnote.c linux/arch/ppc/chrpboot/addnote.c --- v2.4.0-test8/linux/arch/ppc/chrpboot/addnote.c Mon Jun 19 17:59:35 2000 +++ linux/arch/ppc/chrpboot/addnote.c Sun Sep 17 09:48:06 2000 @@ -22,12 +22,23 @@ #define N_DESCR 6 unsigned int descr[N_DESCR] = { +#if 1 + /* values for IBM RS/6000 machines */ 0xffffffff, /* real-mode = true */ 0x00c00000, /* real-base, i.e. where we expect OF to be */ 0xffffffff, /* real-size */ 0xffffffff, /* virt-base */ 0xffffffff, /* virt-size */ 0x4000, /* load-base */ +#else + /* values for longtrail CHRP */ + 0, /* real-mode = false */ + 0xffffffff, /* real-base */ + 0xffffffff, /* real-size */ + 0xffffffff, /* virt-base */ + 0xffffffff, /* virt-size */ + 0x00600000, /* load-base */ +#endif }; unsigned char buf[512]; @@ -63,7 +74,7 @@ unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' }; -main(int ac, char **av) +int main(int ac, char **av) { int fd, n, i; int ph, ps, np; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile --- v2.4.0-test8/linux/arch/ppc/coffboot/Makefile Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/coffboot/Makefile Sun Sep 17 09:48:06 2000 @@ -8,7 +8,7 @@ CFLAGS = $(CPPFLAGS) -O -fno-builtin OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic -CHRP_LD_ARGS = -Ttext 0x00400000 +CHRP_LD_ARGS = -Ttext 0x01000000 COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c --- v2.4.0-test8/linux/arch/ppc/coffboot/chrpmain.c Wed Feb 9 19:43:47 2000 +++ linux/arch/ppc/coffboot/chrpmain.c Sun Sep 17 09:48:06 2000 @@ -22,13 +22,18 @@ #define get_16be(x) (*(unsigned short *)(x)) #define get_32be(x) (*(unsigned *)(x)) -#define RAM_START 0x00000000 -#define RAM_END (8<<20) +#define RAM_END (16 << 20) #define PROG_START 0x00010000 +#define PROG_SIZE 0x003f0000 + +#define SCRATCH_SIZE (128 << 10) char *avail_ram; -char *end_avail; +char *begin_avail, *end_avail; +char *avail_high; +unsigned int heap_use; +unsigned int heap_max; extern char _end[]; extern char image_data[]; @@ -60,29 +65,30 @@ im = image_data; len = image_len; /* claim 3MB starting at PROG_START */ - claim(PROG_START, 3 << 20, 0); + claim(PROG_START, PROG_SIZE, 0); dst = (void *) PROG_START; if (im[0] == 0x1f && im[1] == 0x8b) { - /* claim 512kB for scratch space */ - avail_ram = (char *) claim(0, 512 << 10, 0x10); - end_avail = avail_ram + (512 << 10); - printf("avail_ram = %x\n", avail_ram); + /* claim some memory for scratch space */ + avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10); + begin_avail = avail_high = avail_ram; + end_avail = avail_ram + SCRATCH_SIZE; + printf("heap at 0x%x\n", avail_ram); printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len); - gunzip(dst, 3 << 20, im, &len); + gunzip(dst, PROG_SIZE, im, &len); printf("done %u bytes\n", len); + printf("%u bytes of heap consumed, max in use %u\n", + avail_high - begin_avail, heap_max); } else { memmove(dst, im, len); } flush_cache(dst, len); - stop_imac_ethernet(); - stop_imac_usb(); make_bi_recs((unsigned long) dst + len); sa = (unsigned long)PROG_START; printf("start address = 0x%x\n", sa); - (*(void (*)())sa)(0, 0, prom, a1, a2); + (*(void (*)())sa)(a1, a2, prom); printf("returned?\n"); @@ -122,6 +128,7 @@ rec = (struct bi_record *)((unsigned long)rec + rec->size); } +#if 0 #define eieio() asm volatile("eieio"); void stop_imac_ethernet(void) @@ -172,14 +179,35 @@ *usb_ctrl = 0x01000000; /* cpu_to_le32(1) */ eieio(); } +#endif + +struct memchunk { + unsigned int size; + struct memchunk *next; +}; + +static struct memchunk *freechunks; void *zalloc(void *x, unsigned items, unsigned size) { - void *p = avail_ram; + void *p; + struct memchunk **mpp, *mp; size *= items; size = (size + 7) & -8; + heap_use += size; + if (heap_use > heap_max) + heap_max = heap_use; + for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) { + if (mp->size == size) { + *mpp = mp->next; + return mp; + } + } + p = avail_ram; avail_ram += size; + if (avail_ram > avail_high) + avail_high = avail_ram; if (avail_ram > end_avail) { printf("oops... out of memory\n"); pause(); @@ -189,6 +217,17 @@ void zfree(void *x, void *addr, unsigned nb) { + struct memchunk *mp = addr; + + nb = (nb + 7) & -8; + heap_use -= nb; + if (avail_ram == addr + nb) { + avail_ram = addr; + return; + } + mp->size = nb; + mp->next = freechunks; + freechunks = mp; } #define HEAD_CRC 2 diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/config.in linux/arch/ppc/config.in --- v2.4.0-test8/linux/arch/ppc/config.in Tue Aug 22 11:41:14 2000 +++ linux/arch/ppc/config.in Sun Sep 17 09:48:06 2000 @@ -88,11 +88,15 @@ if [ "$CONFIG_4xx" = "y" -o "$CONFIG_8xx" = "y" ]; then bool 'Math emulation' CONFIG_MATH_EMULATION fi + endmenu mainmenu_option next_comment comment 'General setup' +bool 'High memory support (experimental)' CONFIG_HIGHMEM +bool 'Mac-on-Linux support' CONFIG_MOL + define_bool CONFIG_ISA n define_bool CONFIG_SBUS n @@ -140,20 +144,6 @@ bool 'Backward compatibility mode for Xpmac' CONFIG_FB_COMPAT_XPMAC fi - bool 'Power management support for PowerBooks' CONFIG_PMAC_PBOOK - bool 'Support for PowerMac floppy' CONFIG_MAC_FLOPPY - tristate 'Support for PowerMac serial ports' CONFIG_MAC_SERIAL - if [ "$CONFIG_MAC_SERIAL" = "y" ]; then - bool ' Support for console on serial port' CONFIG_SERIAL_CONSOLE - fi - bool 'Apple Desktop Bus (ADB) support' CONFIG_ADB - if [ "$CONFIG_ADB" = "y" ]; then - bool ' Include CUDA ADB driver' CONFIG_ADB_CUDA - bool ' Include MacIO ADB driver' CONFIG_ADB_MACIO - bool ' Include PMU (Powerbook) ADB driver' CONFIG_ADB_PMU - bool 'Support for ADB keyboard' CONFIG_ADB_KEYBOARD - bool 'Support for ADB mouse' CONFIG_ADBMOUSE - fi tristate 'Support for /dev/rtc' CONFIG_PPC_RTC bool 'Support for Open Firmware device tree in /proc' CONFIG_PROC_DEVICETREE bool 'Support for early boot text console (BootX only)' CONFIG_BOOTX_TEXT @@ -192,7 +182,6 @@ source drivers/mtd/Config.in source drivers/pnp/Config.in source drivers/block/Config.in -#source drivers.new/Config.in if [ "$CONFIG_NET" = "y" ]; then source net/Config.in @@ -262,6 +251,43 @@ source drivers/video/Config.in endmenu +source drivers/input/Config.in + +mainmenu_option next_comment +comment 'Macintosh device drivers' + +if [ "$CONFIG_ALL_PPC" = "y" ]; then + # we want to change this to something like CONFIG_SYSCTRL_CUDA/PMU + bool 'Support for CUDA based PowerMacs' CONFIG_ADB_CUDA + bool 'Support for PMU based PowerMacs' CONFIG_ADB_PMU + if [ "$CONFIG_ADB_PMU" = "y" ]; then + bool ' Power management support for PowerBooks' CONFIG_PMAC_PBOOK + # made a separate option since backlight may end up beeing used + # on non-powerbook machines (but only on PMU based ones AFAIK) + bool ' Backlight control for LCD screens' CONFIG_PMAC_BACKLIGHT + fi + bool 'Support for PowerMac floppy' CONFIG_MAC_FLOPPY + tristate 'Support for PowerMac serial ports' CONFIG_MAC_SERIAL + if [ "$CONFIG_MAC_SERIAL" = "y" ]; then + bool ' Support for console on serial port' CONFIG_SERIAL_CONSOLE + fi + bool 'Apple Desktop Bus (ADB) support' CONFIG_ADB + if [ "$CONFIG_ADB" = "y" ]; then + bool ' Include MacIO (CHRP) ADB driver' CONFIG_ADB_MACIO + fi +fi +if [ "$CONFIG_ADB" = "y" ]; then + dep_bool ' Use input layer for ADB devices' CONFIG_INPUT_ADBHID $CONFIG_INPUT + if [ "$CONFIG_INPUT_ADBHID" = "y" ]; then + define_bool CONFIG_MAC_HID y + bool ' Support for ADB raw keycodes' CONFIG_MAC_ADBKEYCODES + bool ' Support for mouse button 2+3 emulation' CONFIG_MAC_EMUMOUSEBTN + else + bool ' Support for ADB keyboard (old driver)' CONFIG_ADB_KEYBOARD + fi +fi +endmenu + source drivers/char/Config.in source drivers/media/Config.in @@ -287,7 +313,6 @@ fi source drivers/usb/Config.in -source drivers/input/Config.in mainmenu_option next_comment comment 'Kernel hacking' diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/configs/common_defconfig linux/arch/ppc/configs/common_defconfig --- v2.4.0-test8/linux/arch/ppc/configs/common_defconfig Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/configs/common_defconfig Sun Sep 17 09:48:06 2000 @@ -1,5 +1,5 @@ # -# Automatically generated by make menuconfig: don't edit +# Automatically generated make config: don't edit # # CONFIG_UID16 is not set @@ -9,12 +9,20 @@ CONFIG_EXPERIMENTAL=y # +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODVERSIONS=y +CONFIG_KMOD=y + +# # Platform support # CONFIG_PPC=y CONFIG_6xx=y # CONFIG_4xx is not set -# CONFIG_PPC64BRIDGE is not set +# CONFIG_POWER3 is not set +# CONFIG_POWER4 is not set # CONFIG_8260 is not set # CONFIG_8xx is not set CONFIG_ALL_PPC=y @@ -25,15 +33,9 @@ CONFIG_ALTIVEC=y # -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODVERSIONS=y -CONFIG_KMOD=y - -# # General setup # +# CONFIG_HIGHMEM is not set # CONFIG_ISA is not set # CONFIG_SBUS is not set CONFIG_PCI=y @@ -44,8 +46,8 @@ CONFIG_KCORE_ELF=y CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_PCI_NAMES is not set +CONFIG_BINFMT_MISC=m +CONFIG_PCI_NAMES=y # CONFIG_HOTPLUG is not set # CONFIG_PCMCIA is not set @@ -57,21 +59,18 @@ CONFIG_FB=y CONFIG_FB_COMPAT_XPMAC=y CONFIG_PMAC_PBOOK=y -CONFIG_MAC_FLOPPY=y -CONFIG_MAC_SERIAL=y -# CONFIG_SERIAL_CONSOLE is not set -CONFIG_ADB=y -CONFIG_ADB_CUDA=y -CONFIG_ADB_MACIO=y -CONFIG_ADB_PMU=y -CONFIG_ADB_KEYBOARD=y -CONFIG_ADBMOUSE=y +CONFIG_PPC_RTC=y CONFIG_PROC_DEVICETREE=y CONFIG_BOOTX_TEXT=y # CONFIG_MOTOROLA_HOTSWAP is not set # CONFIG_CMDLINE_BOOL is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Plug and Play configuration # # CONFIG_PNP is not set @@ -90,8 +89,11 @@ # CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set -# CONFIG_MD_STRIPED is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # @@ -109,22 +111,24 @@ CONFIG_IP_MULTICAST=y # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set -# CONFIG_IP_ROUTER is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set -CONFIG_IP_ALIAS=y +# CONFIG_INET_ECN is not set CONFIG_SYN_COOKIES=y -CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set + +# +# +# # CONFIG_IPX is not set CONFIG_ATALK=m # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -145,26 +149,42 @@ # IDE, ATA and ATAPI Block devices # CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# # CONFIG_BLK_DEV_HD_IDE is not set # CONFIG_BLK_DEV_HD is not set CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set +# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set +# CONFIG_BLK_DEV_IDEDISK_IBM is not set +# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set +# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set +# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set +# CONFIG_BLK_DEV_IDEDISK_WD is not set +# CONFIG_BLK_DEV_COMMERIAL is not set +# CONFIG_BLK_DEV_TIVO is not set # CONFIG_BLK_DEV_IDECS is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set +CONFIG_BLK_DEV_IDEFLOPPY=y CONFIG_BLK_DEV_IDESCSI=y + +# +# IDE chipset support/bugfixes +# # CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_CMD640_ENHANCED is not set # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_BLK_DEV_RZ1000 is not set CONFIG_BLK_DEV_IDEPCI=y -# CONFIG_IDEPCI_SHARE_IRQ is not set +CONFIG_IDEPCI_SHARE_IRQ=y CONFIG_BLK_DEV_IDEDMA_PCI=y # CONFIG_BLK_DEV_OFFBOARD is not set CONFIG_IDEDMA_PCI_AUTO=y CONFIG_BLK_DEV_IDEDMA=y -CONFIG_IDEDMA_PCI_EXPERIMENTAL=y # CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_BLK_DEV_AEC62XX is not set @@ -173,37 +193,40 @@ # CONFIG_WDC_ALI15X3 is not set # CONFIG_BLK_DEV_AMD7409 is not set # CONFIG_AMD7409_OVERRIDE is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_CMD64X_RAID is not set +CONFIG_BLK_DEV_CMD64X=y # CONFIG_BLK_DEV_CY82C693 is not set # CONFIG_BLK_DEV_CS5530 is not set # CONFIG_BLK_DEV_HPT34X is not set # CONFIG_HPT34X_AUTODMA is not set # CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_HPT366_FIP is not set -# CONFIG_HPT366_MODE3 is not set # CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_OPTI621 is not set # CONFIG_BLK_DEV_PDC202XX is not set # CONFIG_PDC202XX_BURST is not set -# CONFIG_PDC202XX_MASTER is not set # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set # CONFIG_VIA82CXXX_TUNING is not set -# CONFIG_BLK_DEV_SL82C105 is not set +CONFIG_BLK_DEV_SL82C105=y CONFIG_BLK_DEV_IDE_PMAC=y CONFIG_BLK_DEV_IDEDMA_PMAC=y -CONFIG_IDEDMA_PMAC_AUTO=y +CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y CONFIG_BLK_DEV_IDEDMA=y +CONFIG_BLK_DEV_IDEPCI=y # CONFIG_IDE_CHIPSETS is not set CONFIG_IDEDMA_AUTO=y +# CONFIG_IDEDMA_IVB is not set +# CONFIG_DMA_NONPCI is not set CONFIG_BLK_DEV_IDE_MODES=y # # SCSI support # CONFIG_SCSI=y + +# +# SCSI support type (disk, tape, CD-ROM) +# CONFIG_BLK_DEV_SD=y CONFIG_SD_EXTRA_DEVS=40 CONFIG_CHR_DEV_ST=y @@ -211,6 +234,10 @@ CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_SR_EXTRA_DEVS=2 CONFIG_CHR_DEV_SG=y + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# # CONFIG_SCSI_DEBUG_QUEUES is not set # CONFIG_SCSI_MULTI_LUN is not set CONFIG_SCSI_CONSTANTS=y @@ -296,6 +323,7 @@ # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # CONFIG_ETHERTAP is not set # CONFIG_NET_SB1000 is not set @@ -327,8 +355,9 @@ # CONFIG_DM9102 is not set # CONFIG_EEPRO100 is not set # CONFIG_LNE390 is not set -# CONFIG_NE3210 is not set +# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set +# CONFIG_NE3210 is not set # CONFIG_RTL8129 is not set # CONFIG_8139TOO is not set # CONFIG_SIS900 is not set @@ -347,11 +376,13 @@ # CONFIG_FDDI is not set # CONFIG_HIPPI is not set CONFIG_PPP=y -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_ASYNC is not set +CONFIG_PPP_MULTILINK=y +CONFIG_PPP_FILTER=y +CONFIG_PPP_ASYNC=y # CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPP_DEFLATE is not set +CONFIG_PPP_DEFLATE=y # CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPPOE is not set # CONFIG_SLIP is not set # @@ -404,12 +435,13 @@ # CONFIG_FB_RIVA is not set # CONFIG_FB_CLGEN is not set # CONFIG_FB_PM2 is not set +# CONFIG_FB_CYBER2000 is not set CONFIG_FB_OF=y CONFIG_FB_CONTROL=y CONFIG_FB_PLATINUM=y CONFIG_FB_VALKYRIE=y -CONFIG_FB_IMSTT=y CONFIG_FB_CT65550=y +CONFIG_FB_IMSTT=y # CONFIG_FB_S3TRIO is not set # CONFIG_FB_VGA16 is not set CONFIG_FB_MATROX=y @@ -420,6 +452,7 @@ CONFIG_FB_ATY=y CONFIG_FB_ATY128=y CONFIG_FB_3DFX=y +# CONFIG_FB_SIS is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FBCON_ADVANCED is not set CONFIG_FBCON_CFB8=y @@ -437,6 +470,32 @@ # CONFIG_FONT_ACORN_8x8 is not set # +# Input core support +# +CONFIG_INPUT=y +CONFIG_INPUT_KEYBDEV=y +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +CONFIG_INPUT_EVDEV=y + +# +# Macintosh device drivers +# +CONFIG_MAC_FLOPPY=y +CONFIG_MAC_SERIAL=y +# CONFIG_SERIAL_CONSOLE is not set +CONFIG_ADB=y +CONFIG_ADB_CUDA=y +CONFIG_ADB_MACIO=y +CONFIG_ADB_PMU=y +CONFIG_INPUT_ADBHID=y +CONFIG_MAC_HID=y +CONFIG_MAC_ADBKEYCODES=y +CONFIG_MAC_EMUMOUSEBTN=y + +# # Character devices # CONFIG_VT=y @@ -459,7 +518,6 @@ # CONFIG_ATIXL_BUSMOUSE is not set # CONFIG_LOGIBUSMOUSE is not set # CONFIG_MS_BUSMOUSE is not set -CONFIG_ADBMOUSE=y CONFIG_MOUSE=y CONFIG_PSMOUSE=y # CONFIG_82C710_MOUSE is not set @@ -469,19 +527,19 @@ # Joysticks # # CONFIG_JOYSTICK is not set + +# +# Input core support is needed for joysticks +# # CONFIG_QIC02_TAPE is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set CONFIG_NVRAM=y # CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -490,26 +548,31 @@ # Ftape, the floppy tape device driver # # CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set # CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set # # File systems # # CONFIG_QUOTA is not set CONFIG_AUTOFS_FS=y -# CONFIG_AUTOFS4_FS is not set +CONFIG_AUTOFS4_FS=y # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set -CONFIG_HFS_FS=y +# CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y @@ -519,7 +582,8 @@ # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set +CONFIG_DEVFS_FS=y +# CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set @@ -571,12 +635,14 @@ # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set CONFIG_NLS=y # # Native Language Support # +CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set @@ -593,6 +659,10 @@ # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -605,6 +675,7 @@ # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_UTF8 is not set # # Sound @@ -614,6 +685,7 @@ CONFIG_DMASOUND=y # CONFIG_SOUND_CMPCI is not set # CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_FUSION is not set # CONFIG_SOUND_ES1370 is not set # CONFIG_SOUND_ES1371 is not set # CONFIG_SOUND_ESSSOLO1 is not set @@ -622,6 +694,7 @@ # CONFIG_SOUND_TRIDENT is not set # CONFIG_SOUND_MSNDCLAS is not set # CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_VIA82CXXX is not set CONFIG_SOUND_OSS=y # CONFIG_SOUND_TRACEINIT is not set # CONFIG_SOUND_DMAP is not set @@ -647,24 +720,39 @@ # CONFIG_SOUND_AWE32_SYNTH is not set # CONFIG_SOUND_WAVEFRONT is not set # CONFIG_SOUND_MAUI is not set -# CONFIG_SOUND_VIA82CXXX is not set # CONFIG_SOUND_YM3812 is not set # CONFIG_SOUND_OPL3SA1 is not set # CONFIG_SOUND_OPL3SA2 is not set +# CONFIG_SOUND_YMPCI is not set # CONFIG_SOUND_UART6850 is not set # CONFIG_SOUND_AEDSP16 is not set +# CONFIG_SOUND_TVMIXER is not set # # USB support # CONFIG_USB=y CONFIG_USB_DEBUG=y -# CONFIG_USB_DEVICEFS is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEVICEFS=y +# CONFIG_USB_BANDWIDTH is not set + +# +# USB Controllers +# # CONFIG_USB_UHCI is not set # CONFIG_USB_UHCI_ALT is not set CONFIG_USB_OHCI=y + +# +# USB Devices +# # CONFIG_USB_PRINTER is not set # CONFIG_USB_SCANNER is not set +# CONFIG_USB_MICROTEK is not set # CONFIG_USB_AUDIO is not set # CONFIG_USB_ACM is not set # CONFIG_USB_SERIAL is not set @@ -679,15 +767,13 @@ # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RIO500 is not set # CONFIG_USB_DSBR is not set +# CONFIG_USB_BLUETOOTH is not set + +# +# USB Human Interface Devices (HID) +# CONFIG_USB_HID=y # CONFIG_USB_WACOM is not set -# CONFIG_USB_WMFORCE is not set -CONFIG_INPUT_KEYBDEV=y -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_EVDEV is not set # # Kernel hacking @@ -695,4 +781,3 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_KGDB is not set CONFIG_XMON=y - diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/configs/est8260_defconfig linux/arch/ppc/configs/est8260_defconfig --- v2.4.0-test8/linux/arch/ppc/configs/est8260_defconfig Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/configs/est8260_defconfig Sun Sep 17 09:48:06 2000 @@ -9,12 +9,18 @@ CONFIG_EXPERIMENTAL=y # +# Loadable module support +# +# CONFIG_MODULES is not set + +# # Platform support # CONFIG_PPC=y # CONFIG_6xx is not set # CONFIG_4xx is not set -# CONFIG_PPC64BRIDGE is not set +# CONFIG_POWER3 is not set +# CONFIG_POWER4 is not set CONFIG_8260=y # CONFIG_8xx is not set CONFIG_6xx=y @@ -29,13 +35,9 @@ CONFIG_MACH_SPECIFIC=y # -# Loadable module support -# -# CONFIG_MODULES is not set - -# # General setup # +# CONFIG_HIGHMEM is not set # CONFIG_ISA is not set # CONFIG_SBUS is not set # CONFIG_PCI is not set @@ -56,15 +58,17 @@ # CONFIG_PARPORT is not set # CONFIG_VGA_CONSOLE is not set # CONFIG_FB is not set -# CONFIG_PMAC_PBOOK is not set -# CONFIG_MAC_FLOPPY is not set -# CONFIG_MAC_SERIAL is not set -# CONFIG_ADB is not set +# CONFIG_PPC_RTC is not set # CONFIG_PROC_DEVICETREE is not set # CONFIG_BOOTX_TEXT is not set # CONFIG_MOTOROLA_HOTSWAP is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Plug and Play configuration # # CONFIG_PNP is not set @@ -84,8 +88,10 @@ # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_RAID0 is not set -# CONFIG_RAID15_DANGEROUS is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # @@ -105,17 +111,11 @@ CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set -# CONFIG_IP_ROUTER is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set -CONFIG_IP_ALIAS=y +# CONFIG_INET_ECN is not set CONFIG_SYN_COOKIES=y - -# -# (it is safe to leave these untouched) -# -CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set @@ -126,9 +126,9 @@ # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -164,6 +164,7 @@ # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # CONFIG_ETHERTAP is not set # CONFIG_NET_SB1000 is not set @@ -245,6 +246,15 @@ # CONFIG_FB is not set # +# Input core support +# +# CONFIG_INPUT is not set + +# +# Macintosh device drivers +# + +# # Character devices # # CONFIG_VT is not set @@ -269,19 +279,19 @@ # Joysticks # # CONFIG_JOYSTICK is not set + +# +# Input core support is needed for joysticks +# # CONFIG_QIC02_TAPE is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set # CONFIG_NVRAM is not set # CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -290,9 +300,13 @@ # Ftape, the floppy tape device driver # # CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set # CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set # # File systems @@ -310,6 +324,7 @@ # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set @@ -369,6 +384,7 @@ # CONFIG_MAC_PARTITION is not set # CONFIG_MSDOS_PARTITION is not set # CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set @@ -382,7 +398,7 @@ # CONFIG_SCC_ENET=y CONFIG_SCC1_ENET=y -# CONFIG_FCC_ENET is not set +# CONFIG_FEC_ENET is not set # # USB support diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/configs/gemini_defconfig linux/arch/ppc/configs/gemini_defconfig --- v2.4.0-test8/linux/arch/ppc/configs/gemini_defconfig Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/configs/gemini_defconfig Sun Sep 17 09:48:06 2000 @@ -14,14 +14,12 @@ CONFIG_PPC=y CONFIG_6xx=y # CONFIG_4xx is not set -# CONFIG_PPC64BRIDGE is not set -# CONFIG_82xx is not set +# CONFIG_PPC64 is not set +# CONFIG_8260 is not set # CONFIG_8xx is not set -# CONFIG_PMAC is not set -# CONFIG_PREP is not set -# CONFIG_CHRP is not set # CONFIG_ALL_PPC is not set CONFIG_GEMINI=y +# CONFIG_EST8260 is not set # CONFIG_APUS is not set # CONFIG_SMP is not set CONFIG_ALTIVEC=y @@ -37,7 +35,8 @@ # # General setup # -# CONFIG_PCI is not set +# CONFIG_ISA is not set +# CONFIG_SBUS is not set CONFIG_PCI=y CONFIG_NET=y CONFIG_SYSCTL=y @@ -47,8 +46,12 @@ CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y # CONFIG_BINFMT_MISC is not set -# CONFIG_PCI_NAMES is not set # CONFIG_HOTPLUG is not set +# CONFIG_PCMCIA is not set + +# +# Parallel port support +# # CONFIG_PARPORT is not set # CONFIG_VGA_CONSOLE is not set # CONFIG_FB is not set @@ -57,7 +60,6 @@ # CONFIG_MAC_SERIAL is not set # CONFIG_ADB is not set # CONFIG_PROC_DEVICETREE is not set -# CONFIG_TOTALMP is not set # CONFIG_BOOTX_TEXT is not set # CONFIG_MOTOROLA_HOTSWAP is not set @@ -70,22 +72,16 @@ # Block devices # # CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_IDE is not set # -# Please see Documentation/ide.txt for help/info on IDE drives +# Additional Block Devices # -# CONFIG_BLK_DEV_HD_ONLY is not set -# CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set +# CONFIG_RAID15_DANGEROUS is not set # CONFIG_BLK_DEV_RAM is not set -# CONFIG_BLK_DEV_XD is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_PARIDE is not set -# CONFIG_BLK_DEV_IDE_MODES is not set -# CONFIG_BLK_DEV_HD is not set # # Networking options @@ -138,6 +134,13 @@ # CONFIG_NET_SCHED is not set # +# ATA/IDE/MFM/RLL support +# +# CONFIG_IDE is not set +# CONFIG_BLK_DEV_IDE_MODES is not set +# CONFIG_BLK_DEV_HD is not set + +# # SCSI support # CONFIG_SCSI=y @@ -148,7 +151,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_SD_EXTRA_DEVS=40 # CONFIG_CHR_DEV_ST is not set -CONFIG_ST_EXTRA_DEVS=2 CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_SR_EXTRA_DEVS=2 @@ -171,7 +173,6 @@ # CONFIG_SCSI_AHA1542 is not set # CONFIG_SCSI_AHA1740 is not set # CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_IPS is not set # CONFIG_SCSI_ADVANSYS is not set # CONFIG_SCSI_IN2000 is not set # CONFIG_SCSI_AM53C974 is not set @@ -184,43 +185,22 @@ # CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_GDTH is not set # CONFIG_SCSI_GENERIC_NCR5380 is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_SYM53C416 is not set # CONFIG_SCSI_SIM710 is not set -# CONFIG_SCSI_NCR53C7xx is not set -# CONFIG_SCSI_NCR53C8XX is not set -CONFIG_SCSI_SYM53C8XX=y -CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8 -CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32 -CONFIG_SCSI_NCR53C8XX_SYNC=20 -# CONFIG_SCSI_NCR53C8XX_PROFILE is not set -# CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set -# CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set -# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set +# CONFIG_SCSI_NCR53C7xx_sync is not set +# CONFIG_SCSI_NCR53C7xx_FAST is not set +# CONFIG_SCSI_NCR53C7xx_DISCONNECT is not set # CONFIG_SCSI_PAS16 is not set # CONFIG_SCSI_PCI2000 is not set # CONFIG_SCSI_PCI2220I is not set # CONFIG_SCSI_PSI240I is not set # CONFIG_SCSI_QLOGIC_FAS is not set -# CONFIG_SCSI_QLOGIC_ISP is not set -# CONFIG_SCSI_QLOGIC_FC is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_SEAGATE is not set -# CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_T128 is not set # CONFIG_SCSI_U14_34F is not set -# CONFIG_SCSI_ULTRASTOR is not set # CONFIG_SCSI_DEBUG is not set # CONFIG_SCSI_MESH is not set # CONFIG_SCSI_MAC53C94 is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_IEEE1394 is not set # # Network device support @@ -232,6 +212,7 @@ # # CONFIG_ARCNET is not set # CONFIG_DUMMY is not set +# CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_ETHERTAP is not set # CONFIG_NET_SB1000 is not set @@ -249,12 +230,10 @@ # CONFIG_LANCE is not set # CONFIG_NET_VENDOR_SMC is not set # CONFIG_NET_VENDOR_RACAL is not set -# CONFIG_RTL8139 is not set -# CONFIG_DM9102 is not set # CONFIG_AT1700 is not set # CONFIG_DEPCA is not set # CONFIG_NET_ISA is not set -# CONFIG_NET_EISA is not set +# CONFIG_NET_PCI is not set # CONFIG_NET_POCKET is not set # @@ -274,7 +253,7 @@ # CONFIG_NET_RADIO is not set # -# Token Ring driver support +# Token Ring devices # # CONFIG_TR is not set # CONFIG_NET_FC is not set @@ -292,6 +271,11 @@ # CONFIG_HAMRADIO is not set # +# IrDA (infrared) support +# +# CONFIG_IRDA is not set + +# # ISDN subsystem # # CONFIG_ISDN is not set @@ -361,12 +345,7 @@ # CONFIG_AGP is not set # -# USB support -# -# CONFIG_USB is not set - -# -# Filesystems +# File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set @@ -378,12 +357,14 @@ # CONFIG_FAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set +# CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y +# CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_ROMFS_FS is not set @@ -397,6 +378,7 @@ # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y +# CONFIG_NFS_V3 is not set # CONFIG_NFSD is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y @@ -414,6 +396,11 @@ # Sound # # CONFIG_SOUND is not set + +# +# USB support +# +# CONFIG_USB is not set # # Kernel hacking diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/configs/rpxcllf_defconfig linux/arch/ppc/configs/rpxcllf_defconfig --- v2.4.0-test8/linux/arch/ppc/configs/rpxcllf_defconfig Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/configs/rpxcllf_defconfig Sun Sep 17 09:48:06 2000 @@ -9,18 +9,27 @@ CONFIG_EXPERIMENTAL=y # +# Loadable module support +# +# CONFIG_MODULES is not set + +# # Platform support # CONFIG_PPC=y # CONFIG_6xx is not set # CONFIG_4xx is not set -# CONFIG_PPC64BRIDGE is not set +# CONFIG_POWER3 is not set +# CONFIG_POWER4 is not set # CONFIG_8260 is not set CONFIG_8xx=y CONFIG_SERIAL_CONSOLE=y # CONFIG_RPXLITE is not set CONFIG_RPXCLASSIC=y # CONFIG_BSEIP is not set +# CONFIG_TQM8xxL is not set +# CONFIG_TQM860L is not set +# CONFIG_TQM860 is not set # CONFIG_MBX is not set # CONFIG_WINCEPT is not set # CONFIG_ALL_PPC is not set @@ -29,13 +38,9 @@ CONFIG_MATH_EMULATION=y # -# Loadable module support -# -# CONFIG_MODULES is not set - -# # General setup # +# CONFIG_HIGHMEM is not set # CONFIG_ISA is not set # CONFIG_SBUS is not set # CONFIG_PCI is not set @@ -56,6 +61,11 @@ # CONFIG_PARPORT is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Plug and Play configuration # # CONFIG_PNP is not set @@ -75,8 +85,10 @@ # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_RAID0 is not set -# CONFIG_RAID15_DANGEROUS is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # @@ -96,17 +108,11 @@ CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set -# CONFIG_IP_ROUTER is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set -CONFIG_IP_ALIAS=y +# CONFIG_INET_ECN is not set CONFIG_SYN_COOKIES=y - -# -# (it is safe to leave these untouched) -# -CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set @@ -117,9 +123,9 @@ # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -155,6 +161,7 @@ # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # CONFIG_ETHERTAP is not set # CONFIG_NET_SB1000 is not set @@ -236,6 +243,15 @@ # CONFIG_FB is not set # +# Input core support +# +# CONFIG_INPUT is not set + +# +# Macintosh device drivers +# + +# # Character devices # # CONFIG_VT is not set @@ -260,19 +276,19 @@ # Joysticks # # CONFIG_JOYSTICK is not set + +# +# Input core support is needed for joysticks +# # CONFIG_QIC02_TAPE is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set # CONFIG_NVRAM is not set # CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -281,9 +297,13 @@ # Ftape, the floppy tape device driver # # CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set # CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set # # File systems @@ -301,6 +321,7 @@ # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set @@ -360,6 +381,7 @@ # CONFIG_MAC_PARTITION is not set # CONFIG_MSDOS_PARTITION is not set # CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set # CONFIG_NLS is not set @@ -374,7 +396,9 @@ CONFIG_SCC_ENET=y CONFIG_SCC1_ENET=y CONFIG_FEC_ENET=y +CONFIG_ENET_BIG_BUFFERS=y CONFIG_8xxSMC2=y +# CONFIG_8xx_ALTSMC2 is not set CONFIG_8xxSCC=y # diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/defconfig linux/arch/ppc/defconfig --- v2.4.0-test8/linux/arch/ppc/defconfig Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/defconfig Sun Sep 17 09:48:06 2000 @@ -1,5 +1,5 @@ # -# Automatically generated by make menuconfig: don't edit +# Automatically generated make config: don't edit # # CONFIG_UID16 is not set @@ -9,12 +9,20 @@ CONFIG_EXPERIMENTAL=y # +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODVERSIONS=y +CONFIG_KMOD=y + +# # Platform support # CONFIG_PPC=y CONFIG_6xx=y # CONFIG_4xx is not set -# CONFIG_PPC64BRIDGE is not set +# CONFIG_POWER3 is not set +# CONFIG_POWER4 is not set # CONFIG_8260 is not set # CONFIG_8xx is not set CONFIG_ALL_PPC=y @@ -25,15 +33,9 @@ CONFIG_ALTIVEC=y # -# Loadable module support -# -CONFIG_MODULES=y -CONFIG_MODVERSIONS=y -CONFIG_KMOD=y - -# # General setup # +# CONFIG_HIGHMEM is not set # CONFIG_ISA is not set # CONFIG_SBUS is not set CONFIG_PCI=y @@ -44,8 +46,8 @@ CONFIG_KCORE_ELF=y CONFIG_BINFMT_ELF=y CONFIG_KERNEL_ELF=y -# CONFIG_BINFMT_MISC is not set -# CONFIG_PCI_NAMES is not set +CONFIG_BINFMT_MISC=m +CONFIG_PCI_NAMES=y # CONFIG_HOTPLUG is not set # CONFIG_PCMCIA is not set @@ -57,21 +59,18 @@ CONFIG_FB=y CONFIG_FB_COMPAT_XPMAC=y CONFIG_PMAC_PBOOK=y -CONFIG_MAC_FLOPPY=y -CONFIG_MAC_SERIAL=y -# CONFIG_SERIAL_CONSOLE is not set -CONFIG_ADB=y -CONFIG_ADB_CUDA=y -CONFIG_ADB_MACIO=y -CONFIG_ADB_PMU=y -CONFIG_ADB_KEYBOARD=y -CONFIG_ADBMOUSE=y +CONFIG_PPC_RTC=y CONFIG_PROC_DEVICETREE=y CONFIG_BOOTX_TEXT=y # CONFIG_MOTOROLA_HOTSWAP is not set # CONFIG_CMDLINE_BOOL is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Plug and Play configuration # # CONFIG_PNP is not set @@ -90,8 +89,11 @@ # CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set -# CONFIG_MD_STRIPED is not set +# CONFIG_MD_RAID0 is not set +# CONFIG_MD_RAID1 is not set +# CONFIG_MD_RAID5 is not set CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # @@ -109,22 +111,24 @@ CONFIG_IP_MULTICAST=y # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set -# CONFIG_IP_ROUTER is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set -CONFIG_IP_ALIAS=y +# CONFIG_INET_ECN is not set CONFIG_SYN_COOKIES=y -CONFIG_SKB_LARGE=y # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set + +# +# +# # CONFIG_IPX is not set CONFIG_ATALK=m # CONFIG_DECNET is not set +# CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set -# CONFIG_BRIDGE is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -145,26 +149,42 @@ # IDE, ATA and ATAPI Block devices # CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# # CONFIG_BLK_DEV_HD_IDE is not set # CONFIG_BLK_DEV_HD is not set CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set +# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set +# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set +# CONFIG_BLK_DEV_IDEDISK_IBM is not set +# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set +# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set +# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set +# CONFIG_BLK_DEV_IDEDISK_WD is not set +# CONFIG_BLK_DEV_COMMERIAL is not set +# CONFIG_BLK_DEV_TIVO is not set # CONFIG_BLK_DEV_IDECS is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set -# CONFIG_BLK_DEV_IDEFLOPPY is not set +CONFIG_BLK_DEV_IDEFLOPPY=y CONFIG_BLK_DEV_IDESCSI=y + +# +# IDE chipset support/bugfixes +# # CONFIG_BLK_DEV_CMD640 is not set # CONFIG_BLK_DEV_CMD640_ENHANCED is not set # CONFIG_BLK_DEV_ISAPNP is not set # CONFIG_BLK_DEV_RZ1000 is not set CONFIG_BLK_DEV_IDEPCI=y -# CONFIG_IDEPCI_SHARE_IRQ is not set +CONFIG_IDEPCI_SHARE_IRQ=y CONFIG_BLK_DEV_IDEDMA_PCI=y # CONFIG_BLK_DEV_OFFBOARD is not set CONFIG_IDEDMA_PCI_AUTO=y CONFIG_BLK_DEV_IDEDMA=y -CONFIG_IDEDMA_PCI_EXPERIMENTAL=y # CONFIG_IDEDMA_PCI_WIP is not set # CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set # CONFIG_BLK_DEV_AEC62XX is not set @@ -173,37 +193,40 @@ # CONFIG_WDC_ALI15X3 is not set # CONFIG_BLK_DEV_AMD7409 is not set # CONFIG_AMD7409_OVERRIDE is not set -# CONFIG_BLK_DEV_CMD64X is not set -# CONFIG_CMD64X_RAID is not set +CONFIG_BLK_DEV_CMD64X=y # CONFIG_BLK_DEV_CY82C693 is not set # CONFIG_BLK_DEV_CS5530 is not set # CONFIG_BLK_DEV_HPT34X is not set # CONFIG_HPT34X_AUTODMA is not set # CONFIG_BLK_DEV_HPT366 is not set -# CONFIG_HPT366_FIP is not set -# CONFIG_HPT366_MODE3 is not set # CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_OPTI621 is not set # CONFIG_BLK_DEV_PDC202XX is not set # CONFIG_PDC202XX_BURST is not set -# CONFIG_PDC202XX_MASTER is not set # CONFIG_BLK_DEV_SIS5513 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set # CONFIG_VIA82CXXX_TUNING is not set -# CONFIG_BLK_DEV_SL82C105 is not set +CONFIG_BLK_DEV_SL82C105=y CONFIG_BLK_DEV_IDE_PMAC=y CONFIG_BLK_DEV_IDEDMA_PMAC=y -CONFIG_IDEDMA_PMAC_AUTO=y +CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y CONFIG_BLK_DEV_IDEDMA=y +CONFIG_BLK_DEV_IDEPCI=y # CONFIG_IDE_CHIPSETS is not set CONFIG_IDEDMA_AUTO=y +# CONFIG_IDEDMA_IVB is not set +# CONFIG_DMA_NONPCI is not set CONFIG_BLK_DEV_IDE_MODES=y # # SCSI support # CONFIG_SCSI=y + +# +# SCSI support type (disk, tape, CD-ROM) +# CONFIG_BLK_DEV_SD=y CONFIG_SD_EXTRA_DEVS=40 CONFIG_CHR_DEV_ST=y @@ -211,6 +234,10 @@ CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_SR_EXTRA_DEVS=2 CONFIG_CHR_DEV_SG=y + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# # CONFIG_SCSI_DEBUG_QUEUES is not set # CONFIG_SCSI_MULTI_LUN is not set CONFIG_SCSI_CONSTANTS=y @@ -296,6 +323,7 @@ # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set +# CONFIG_TUN is not set # CONFIG_ETHERTAP is not set # CONFIG_NET_SB1000 is not set @@ -327,8 +355,9 @@ # CONFIG_DM9102 is not set # CONFIG_EEPRO100 is not set # CONFIG_LNE390 is not set -# CONFIG_NE3210 is not set +# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set +# CONFIG_NE3210 is not set # CONFIG_RTL8129 is not set # CONFIG_8139TOO is not set # CONFIG_SIS900 is not set @@ -347,11 +376,13 @@ # CONFIG_FDDI is not set # CONFIG_HIPPI is not set CONFIG_PPP=y -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_ASYNC is not set +CONFIG_PPP_MULTILINK=y +CONFIG_PPP_FILTER=y +CONFIG_PPP_ASYNC=y # CONFIG_PPP_SYNC_TTY is not set -# CONFIG_PPP_DEFLATE is not set +CONFIG_PPP_DEFLATE=y # CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPPOE is not set # CONFIG_SLIP is not set # @@ -404,12 +435,13 @@ # CONFIG_FB_RIVA is not set # CONFIG_FB_CLGEN is not set # CONFIG_FB_PM2 is not set +# CONFIG_FB_CYBER2000 is not set CONFIG_FB_OF=y CONFIG_FB_CONTROL=y CONFIG_FB_PLATINUM=y CONFIG_FB_VALKYRIE=y -CONFIG_FB_IMSTT=y CONFIG_FB_CT65550=y +CONFIG_FB_IMSTT=y # CONFIG_FB_S3TRIO is not set # CONFIG_FB_VGA16 is not set CONFIG_FB_MATROX=y @@ -420,6 +452,7 @@ CONFIG_FB_ATY=y CONFIG_FB_ATY128=y CONFIG_FB_3DFX=y +# CONFIG_FB_SIS is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FBCON_ADVANCED is not set CONFIG_FBCON_CFB8=y @@ -437,6 +470,32 @@ # CONFIG_FONT_ACORN_8x8 is not set # +# Input core support +# +CONFIG_INPUT=y +CONFIG_INPUT_KEYBDEV=y +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +CONFIG_INPUT_EVDEV=y + +# +# Macintosh device drivers +# +CONFIG_MAC_FLOPPY=y +CONFIG_MAC_SERIAL=y +# CONFIG_SERIAL_CONSOLE is not set +CONFIG_ADB=y +CONFIG_ADB_CUDA=y +CONFIG_ADB_MACIO=y +CONFIG_ADB_PMU=y +CONFIG_INPUT_ADBHID=y +CONFIG_MAC_HID=y +CONFIG_MAC_ADBKEYCODES=y +CONFIG_MAC_EMUMOUSEBTN=y + +# # Character devices # CONFIG_VT=y @@ -459,7 +518,6 @@ # CONFIG_ATIXL_BUSMOUSE is not set # CONFIG_LOGIBUSMOUSE is not set # CONFIG_MS_BUSMOUSE is not set -CONFIG_ADBMOUSE=y CONFIG_MOUSE=y CONFIG_PSMOUSE=y # CONFIG_82C710_MOUSE is not set @@ -469,19 +527,19 @@ # Joysticks # # CONFIG_JOYSTICK is not set + +# +# Input core support is needed for joysticks +# # CONFIG_QIC02_TAPE is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set +# CONFIG_INTEL_RNG is not set CONFIG_NVRAM=y # CONFIG_RTC is not set - -# -# Video For Linux -# -# CONFIG_VIDEO_DEV is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set @@ -490,26 +548,31 @@ # Ftape, the floppy tape device driver # # CONFIG_FTAPE is not set -# CONFIG_DRM is not set -# CONFIG_DRM_TDFX is not set # CONFIG_AGP is not set +# CONFIG_DRM is not set + +# +# Multimedia devices +# +# CONFIG_VIDEO_DEV is not set # # File systems # # CONFIG_QUOTA is not set CONFIG_AUTOFS_FS=y -# CONFIG_AUTOFS4_FS is not set +CONFIG_AUTOFS4_FS=y # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set -CONFIG_HFS_FS=y +# CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y @@ -519,7 +582,7 @@ # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set +CONFIG_DEVFS_FS=y # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y @@ -572,12 +635,14 @@ # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set +# CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set CONFIG_NLS=y # # Native Language Support # +CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set @@ -594,6 +659,10 @@ # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set @@ -606,6 +675,7 @@ # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_UTF8 is not set # # Sound @@ -615,6 +685,7 @@ CONFIG_DMASOUND=y # CONFIG_SOUND_CMPCI is not set # CONFIG_SOUND_EMU10K1 is not set +# CONFIG_SOUND_FUSION is not set # CONFIG_SOUND_ES1370 is not set # CONFIG_SOUND_ES1371 is not set # CONFIG_SOUND_ESSSOLO1 is not set @@ -623,6 +694,7 @@ # CONFIG_SOUND_TRIDENT is not set # CONFIG_SOUND_MSNDCLAS is not set # CONFIG_SOUND_MSNDPIN is not set +# CONFIG_SOUND_VIA82CXXX is not set CONFIG_SOUND_OSS=y # CONFIG_SOUND_TRACEINIT is not set # CONFIG_SOUND_DMAP is not set @@ -648,24 +720,39 @@ # CONFIG_SOUND_AWE32_SYNTH is not set # CONFIG_SOUND_WAVEFRONT is not set # CONFIG_SOUND_MAUI is not set -# CONFIG_SOUND_VIA82CXXX is not set # CONFIG_SOUND_YM3812 is not set # CONFIG_SOUND_OPL3SA1 is not set # CONFIG_SOUND_OPL3SA2 is not set +# CONFIG_SOUND_YMPCI is not set # CONFIG_SOUND_UART6850 is not set # CONFIG_SOUND_AEDSP16 is not set +# CONFIG_SOUND_TVMIXER is not set # # USB support # CONFIG_USB=y CONFIG_USB_DEBUG=y -# CONFIG_USB_DEVICEFS is not set + +# +# Miscellaneous USB options +# +CONFIG_USB_DEVICEFS=y +# CONFIG_USB_BANDWIDTH is not set + +# +# USB Controllers +# # CONFIG_USB_UHCI is not set # CONFIG_USB_UHCI_ALT is not set CONFIG_USB_OHCI=y + +# +# USB Devices +# # CONFIG_USB_PRINTER is not set # CONFIG_USB_SCANNER is not set +# CONFIG_USB_MICROTEK is not set # CONFIG_USB_AUDIO is not set # CONFIG_USB_ACM is not set # CONFIG_USB_SERIAL is not set @@ -680,15 +767,18 @@ # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RIO500 is not set # CONFIG_USB_DSBR is not set +# CONFIG_USB_BLUETOOTH is not set + +# +# USB Human Interface Devices (HID) +# CONFIG_USB_HID=y # CONFIG_USB_WACOM is not set -# CONFIG_USB_WMFORCE is not set -CONFIG_INPUT_KEYBDEV=y -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_EVDEV is not set + +# +# Mac-on-Linux (MOL) support +# +# CONFIG_MOL is not set # # Kernel hacking diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile --- v2.4.0-test8/linux/arch/ppc/kernel/Makefile Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/Makefile Sun Sep 17 09:48:06 2000 @@ -99,8 +99,10 @@ ifeq ($(CONFIG_ALL_PPC),y) O_OBJS += pmac_pic.o pmac_setup.o pmac_time.o feature.o pmac_pci.o prom.o \ chrp_setup.o chrp_time.o chrp_pci.o open_pic.o indirect_pci.o \ - prep_pci.o i8259.o prep_nvram.o prep_time.o residual.o \ - pmac_backlight.o + prep_pci.o i8259.o prep_nvram.o prep_time.o residual.o + ifeq ($(CONFIG_PMAC_BACKLIGHT),y) + O_OBJS += pmac_backlight.o + endif OX_OBJS += prep_setup.o endif ifeq ($(CONFIG_GEMINI),y) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/apus_setup.c Tue Apr 25 17:58:46 2000 +++ linux/arch/ppc/kernel/apus_setup.c Sun Sep 17 09:48:06 2000 @@ -304,7 +304,7 @@ void apus_calibrate_decr(void) { #ifdef CONFIG_APUS - int freq, divisor; + unsigned long freq; /* This algorithm for determining the bus speed was contributed by Ralph Schmidt. */ @@ -335,8 +335,8 @@ bus_speed = 60; freq = 15000000; } else if ((bus_speed >= 63) && (bus_speed < 69)) { - bus_speed = 66; - freq = 16500000; + bus_speed = 67; + freq = 16666667; } else { printk ("APUS: Unable to determine bus speed (%d). " "Defaulting to 50MHz", bus_speed); @@ -375,12 +375,10 @@ } - freq *= 60; /* try to make freq/1e6 an integer */ - divisor = 60; - printk("time_init: decrementer frequency = %d/%d\n", freq, divisor); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + printk("time_init: decrementer frequency = %lu.%.6lu MHz\n", + freq/1000000, freq%1000000); + tb_ticks_per_jiffy = freq / HZ; + tb_to_us = mulhwu_scale_factor(freq, 1000000); __bus_speed = bus_speed; __speed_test_failed = speed_test_failed; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c --- v2.4.0-test8/linux/arch/ppc/kernel/chrp_pci.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/chrp_pci.c Sun Sep 17 09:48:06 2000 @@ -284,13 +284,38 @@ return 1; } +#ifdef CONFIG_POWER4 +static void +power4_fixup_dev(struct pci_dev *dev) +{ + int i; + unsigned long offset; + + for (i = 0; i < 6; ++i) { + if (dev->resource[i].start == 0) + continue; + offset = pci_address_offset(dev->bus->number, + dev->resource[i].flags); + if (offset) { + dev->resource[i].start += offset; + dev->resource[i].end += offset; + printk("device %x.%x[%d] now [%lx..%lx]\n", + dev->bus->number, dev->devfn, i, + dev->resource[i].start, + dev->resource[i].end); + } + /* zap the 2nd function of the winbond chip */ + if (dev->resource[i].flags & IORESOURCE_IO + && dev->bus->number == 0 && dev->devfn == 0x81) + dev->resource[i].flags &= ~IORESOURCE_IO; + } +} +#endif /* CONFIG_POWER4 */ + void __init chrp_pcibios_fixup(void) { struct pci_dev *dev; -#ifdef CONFIG_POWER4 - int i; -#endif int *brp; struct device_node *np; extern struct pci_ops generic_pci_ops; @@ -316,10 +341,8 @@ /* PCI interrupts are controlled by the OpenPIC */ pci_for_each_dev(dev) { np = find_pci_device_OFnode(dev->bus->number, dev->devfn); - if ( (np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0)) + if ((np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0)) dev->irq = np->intrs[0].line; - if ( dev->irq ) - dev->irq = openpic_to_irq( dev->irq ); /* these need to be absolute addrs for OF and Matrox FB -- Cort */ if ( dev->vendor == PCI_VENDOR_ID_MATROX ) { @@ -337,25 +360,7 @@ dev->devfn, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD); } #ifdef CONFIG_POWER4 - for (i = 0; i < 6; ++i) { - unsigned long offset; - if (dev->resource[i].start == 0) - continue; - offset = pci_address_offset(dev->bus->number, - dev->resource[i].flags); - if (offset) { - dev->resource[i].start += offset; - dev->resource[i].end += offset; - printk("device %x.%x[%d] now [%lx..%lx]\n", - dev->bus->number, dev->devfn, i, - dev->resource[i].start, - dev->resource[i].end); - } - /* zap the 2nd function of the winbond chip */ - if (dev->resource[i].flags & IORESOURCE_IO - && dev->bus->number == 0 && dev->devfn == 0x81) - dev->resource[i].flags &= ~IORESOURCE_IO; - } + power4_fixup_dev(dev); #else if (dev->bus->number > 0 && python_busnr > 0) dev->resource[0].start += dev->bus->number*0x01000000; @@ -363,6 +368,40 @@ } } +static struct { + /* parent is iomem */ + struct resource ram, pci_mem, isa_mem, pci_io, pci_cfg, rom_exp, flash; + /* parent is isa_mem */ + struct resource nvram; +} gg2_resources = { + ram: { "RAM", 0x00000000, 0xbfffffff, IORESOURCE_MEM }, + pci_mem: { "GG2 PCI mem", 0xc0000000, 0xf6ffffff, IORESOURCE_MEM }, + isa_mem: { "GG2 ISA mem", 0xf7000000, 0xf7ffffff }, + pci_io: { "GG2 PCI I/O", 0xf8000000, 0xf8ffffff }, + pci_cfg: { "GG2 PCI cfg", 0xfec00000, 0xfec7ffff }, + rom_exp: { "ROM exp", 0xff000000, 0xff7fffff, }, + flash: { "Flash ROM", 0xfff80000, 0xffffffff }, + nvram: { "NVRAM", 0xf70e0000, 0xf70e7fff }, +}; + +static void __init gg2_pcibios_fixup(void) +{ + int i; + extern unsigned long *end_of_DRAM; + + chrp_pcibios_fixup(); + gg2_resources.ram.end = (unsigned long)end_of_DRAM-PAGE_OFFSET; + for (i = 0; i < 7; i++) + request_resource(&iomem_resource, + &((struct resource *)&gg2_resources)[i]); + request_resource(&gg2_resources.isa_mem, &gg2_resources.nvram); +} + +static void __init gg2_pcibios_fixup_bus(struct pci_bus *bus) +{ + bus->resource[1] = &gg2_resources.pci_mem; +} + decl_config_access_method(grackle); decl_config_access_method(indirect); decl_config_access_method(rtas); @@ -372,6 +411,7 @@ { struct device_node *py; + ppc_md.pcibios_fixup = chrp_pcibios_fixup; #ifdef CONFIG_POWER4 set_config_access_method(rtas); pci_dram_offset = 0; @@ -428,16 +468,17 @@ } else { + /* LongTrail */ pci_dram_offset = 0; isa_mem_base = 0xf7000000; isa_io_base = 0xf8000000; set_config_access_method(gg2); + ppc_md.pcibios_fixup = gg2_pcibios_fixup; + ppc_md.pcibios_fixup_bus = gg2_pcibios_fixup_bus; } } } #endif /* CONFIG_POWER4 */ - - ppc_md.pcibios_fixup = chrp_pcibios_fixup; } #ifdef CONFIG_PPC64BRIDGE diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/chrp_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/chrp_setup.c Sun Sep 17 09:48:06 2000 @@ -62,11 +62,13 @@ unsigned long chrp_get_rtc_time(void); int chrp_set_rtc_time(unsigned long nowtime); void chrp_calibrate_decr(void); -void chrp_time_init(void); +long chrp_time_init(void); void chrp_setup_pci_ptrs(void); -extern void chrp_progress(char *, unsigned short); void chrp_event_scan(void); +void rtas_display_progress(char *, unsigned short); +void rtas_indicator_progress(char *, unsigned short); +void bootx_text_progress(char *, unsigned short); extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); @@ -91,6 +93,8 @@ extern unsigned long Hash_size, Hash_mask; extern int probingmem; extern unsigned long loops_per_sec; +extern int bootx_text_mapped; +static int max_width; unsigned long empty_zero_page[1024]; @@ -252,13 +256,6 @@ #endif ROOT_DEV = to_kdev_t(0x0802); /* sda2 (sda1 is for the kernel) */ printk("Boot arguments: %s\n", cmd_line); - - request_region(0x20,0x20,"pic1"); - request_region(0xa0,0x20,"pic2"); - request_region(0x00,0x20,"dma1"); - request_region(0x40,0x20,"timer"); - request_region(0x80,0x10,"dma page reg"); - request_region(0xc0,0x20,"dma2"); #ifndef CONFIG_PPC64BRIDGE /* PCI bridge config space access area - @@ -446,11 +443,43 @@ void __init chrp_init2(void) { +#if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) + struct device_node *kbd; +#endif #ifdef CONFIG_NVRAM pmac_nvram_init(); #endif + + request_region(0x20,0x20,"pic1"); + request_region(0xa0,0x20,"pic2"); + request_region(0x00,0x20,"dma1"); + request_region(0x40,0x20,"timer"); + request_region(0x80,0x10,"dma page reg"); + request_region(0xc0,0x20,"dma2"); + if (ppc_md.progress) ppc_md.progress(" Have fun! ", 0x7777); + +#if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) + /* see if there is a keyboard in the device tree + with a parent of type "adb" */ + for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) + if (kbd->parent && kbd->parent->type + && strcmp(kbd->parent->type, "adb") == 0) + break; + if (kbd) { + ppc_md.kbd_setkeycode = mackbd_setkeycode; + ppc_md.kbd_getkeycode = mackbd_getkeycode; + ppc_md.kbd_translate = mackbd_translate; + ppc_md.kbd_unexpected_up = mackbd_unexpected_up; + ppc_md.kbd_leds = mackbd_leds; + ppc_md.kbd_init_hw = mackbd_init_hw; +#ifdef CONFIG_MAGIC_SYSRQ + ppc_md.ppc_kbd_sysrq_xlate = mackbd_sysrq_xlate; + SYSRQ_KEY = 0x69; +#endif /* CONFIG_MAGIC_SYSRQ */ + } +#endif /* CONFIG_VT && CONFIG_ADB_KEYBOARD */ } #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) @@ -598,40 +627,40 @@ ppc_md.calibrate_decr = chrp_calibrate_decr; #ifdef CONFIG_VT -#ifdef CONFIG_MAC_KEYBOARD - if (adb_driver == NULL) - { -#endif /* CONFIG_MAC_KEYBOAD */ - ppc_md.kbd_setkeycode = pckbd_setkeycode; - ppc_md.kbd_getkeycode = pckbd_getkeycode; - ppc_md.kbd_translate = pckbd_translate; - ppc_md.kbd_unexpected_up = pckbd_unexpected_up; - ppc_md.kbd_leds = pckbd_leds; - ppc_md.kbd_init_hw = pckbd_init_hw; -#ifdef CONFIG_MAGIC_SYSRQ - ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate; - SYSRQ_KEY = 0x54; -#endif /* CONFIG_MAGIC_SYSRQ */ -#ifdef CONFIG_MAC_KEYBOARD - } - else - { - ppc_md.kbd_setkeycode = mackbd_setkeycode; - ppc_md.kbd_getkeycode = mackbd_getkeycode; - ppc_md.kbd_translate = mackbd_translate; - ppc_md.kbd_unexpected_up = mackbd_unexpected_up; - ppc_md.kbd_leds = mackbd_leds; - ppc_md.kbd_init_hw = mackbd_init_hw; + /* these are adjusted in chrp_init2 if we have an ADB keyboard */ + ppc_md.kbd_setkeycode = pckbd_setkeycode; + ppc_md.kbd_getkeycode = pckbd_getkeycode; + ppc_md.kbd_translate = pckbd_translate; + ppc_md.kbd_unexpected_up = pckbd_unexpected_up; + ppc_md.kbd_leds = pckbd_leds; + ppc_md.kbd_init_hw = pckbd_init_hw; #ifdef CONFIG_MAGIC_SYSRQ - ppc_md.ppc_kbd_sysrq_xlate = mackbd_sysrq_xlate; - SYSRQ_KEY = 0x69; + ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate; + SYSRQ_KEY = 0x54; #endif /* CONFIG_MAGIC_SYSRQ */ - } -#endif /* CONFIG_MAC_KEYBOARD */ #endif /* CONFIG_VT */ - if ( rtas_data ) - ppc_md.progress = chrp_progress; - + + if (rtas_data) { + struct device_node *rtas; + unsigned int *p; + + rtas = find_devices("rtas"); + if (rtas != NULL) { + if (get_property(rtas, "display-character", NULL)) { + ppc_md.progress = rtas_display_progress; + p = (unsigned int *) get_property + (rtas, "ibm,display-line-length", NULL); + if (p) + max_width = *p; + } else if (get_property(rtas, "set-indicator", NULL)) + ppc_md.progress = rtas_indicator_progress; + } + } +#ifdef CONFIG_BOOTX_TEXT + if (ppc_md.progress == NULL && bootx_text_mapped) + ppc_md.progress = bootx_text_progress; +#endif + #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) ppc_ide_md.insw = chrp_ide_insw; ppc_ide_md.outsw = chrp_ide_outsw; @@ -653,30 +682,13 @@ } void __chrp -chrp_progress(char *s, unsigned short hex) +rtas_display_progress(char *s, unsigned short hex) { - extern unsigned int rtas_data; - int max_width, width; - struct device_node *root; + int width; char *os = s; - unsigned long *p; - if ( (root = find_path_device("/rtas")) && - (p = (unsigned long *)get_property(root, - "ibm,display-line-length", - NULL)) ) - max_width = *p; - else - max_width = 0x10; - - if ( (_machine != _MACH_chrp) || !rtas_data ) - return; if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) ) - { - /* assume no display-character RTAS method - use hex display */ - call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex); return; - } width = max_width; while ( *os ) @@ -696,3 +708,17 @@ call_rtas( "display-character", 1, 1, NULL, ' ' ); } +void __chrp +rtas_indicator_progress(char *s, unsigned short hex) +{ + call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex); +} + +#ifdef CONFIG_BOOTX_TEXT +void +bootx_text_progress(char *s, unsigned short hex) +{ + prom_print(s); + prom_print("\n"); +} +#endif /* CONFIG_BOOTX_TEXT */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c --- v2.4.0-test8/linux/arch/ppc/kernel/chrp_time.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/chrp_time.c Sun Sep 17 09:48:06 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -32,18 +33,20 @@ static int nvram_as0 = NVRAM_AS0; static int nvram_data = NVRAM_DATA; -void __init chrp_time_init(void) +long __init chrp_time_init(void) { struct device_node *rtcs; int base; rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); if (rtcs == NULL || rtcs->addrs == NULL) - return; + return 0; base = rtcs->addrs[0].address; nvram_as1 = 0; nvram_as0 = base; nvram_data = base + 1; + + return 0; } int __chrp chrp_cmos_clock_read(int addr) @@ -115,28 +118,34 @@ unsigned long __chrp chrp_get_rtc_time(void) { unsigned int year, mon, day, hour, min, sec; - int i; + int uip, i; /* The Linux interpretation of the CMOS clock register contents: * When the Update-In-Progress (UIP) flag goes from 1 to 0, the * RTC registers show the second which has precisely just started. * Let's hope other operating systems interpret the RTC the same way. */ - /* read RTC exactly on falling edge of update flag */ - for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ - if (chrp_cmos_clock_read(RTC_FREQ_SELECT) & RTC_UIP) - break; - for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ - if (!(chrp_cmos_clock_read(RTC_FREQ_SELECT) & RTC_UIP)) - break; - do { /* Isn't this overkill ? UIP above should guarantee consistency */ + + /* Since the UIP flag is set for about 2.2 ms and the clock + * is typically written with a precision of 1 jiffy, trying + * to obtain a precision better than a few milliseconds is + * an illusion. Only consistency is interesting, this also + * allows to use the routine for /dev/rtc without a potential + * 1 second kernel busy loop triggered by any reader of /dev/rtc. + */ + + for ( i = 0; i<1000000; i++) { + uip = chrp_cmos_clock_read(RTC_FREQ_SELECT); sec = chrp_cmos_clock_read(RTC_SECONDS); min = chrp_cmos_clock_read(RTC_MINUTES); hour = chrp_cmos_clock_read(RTC_HOURS); day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); mon = chrp_cmos_clock_read(RTC_MONTH); year = chrp_cmos_clock_read(RTC_YEAR); - } while (sec != chrp_cmos_clock_read(RTC_SECONDS)); + uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); + if ((uip & RTC_UIP)==0) break; + } + if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { BCD_TO_BIN(sec); @@ -155,8 +164,7 @@ void __init chrp_calibrate_decr(void) { struct device_node *cpu; - int *fp, divisor; - unsigned long freq; + unsigned int freq, *fp; if (via_calibrate_decr()) return; @@ -168,15 +176,13 @@ freq = 16666000; /* hardcoded default */ cpu = find_type_devices("cpu"); if (cpu != 0) { - fp = (int *) get_property(cpu, "timebase-frequency", NULL); + fp = (unsigned int *) + get_property(cpu, "timebase-frequency", NULL); if (fp != 0) freq = *fp; } - freq *= 30; - divisor = 30; - printk("time_init: decrementer frequency = %lu/%d (%ld MHz)\n", freq, - divisor, (freq/divisor)>>20); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + printk("time_init: decrementer frequency = %u.%.6u MHz\n", + freq/1000000, freq%1000000); + tb_ticks_per_jiffy = freq / HZ; + tb_to_us = mulhwu_scale_factor(freq, 1000000); } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/entry.S linux/arch/ppc/kernel/entry.S --- v2.4.0-test8/linux/arch/ppc/kernel/entry.S Fri Aug 4 16:15:37 2000 +++ linux/arch/ppc/kernel/entry.S Sun Sep 17 09:48:06 2000 @@ -30,6 +30,7 @@ #include #include #include +#include "mol.h" #undef SHOW_SYSCALLS #undef SHOW_SYSCALLS_TASK @@ -85,7 +86,7 @@ beq- 10f cmpi 0,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */ beq- 16f - lwz r10,TASK_FLAGS(r2) + lwz r10,TASK_PTRACE(r2) andi. r10,r10,PT_TRACESYS bne- 50f cmpli 0,r0,NR_syscalls @@ -241,6 +242,13 @@ /* XXX it would be nice to find a SPRGx for this on 6xx,7xx too */ lwz r9,PGDIR(r4) /* cache the page table root */ tophys(r9,r9) /* convert to phys addr */ +#ifdef CONFIG_8xx_CPU6 + lis r6, cpu6_errata_word@h + ori r6, r6, cpu6_errata_word@l + li r5, 0x3980 + stw r5, 8(r6) + lwz r5, 8(r6) +#endif mtspr M_TWB,r9 /* Update MMU base address */ tlbia SYNC @@ -349,21 +357,18 @@ beq+ restore li r3,0 addi r4,r1,STACK_FRAME_OVERHEAD + MOL_HOOK_MMU(8,r8) bl do_signal .globl do_signal_ret do_signal_ret: -restore: - lwz r3,_CTR(r1) - lwz r0,_LINK(r1) - mtctr r3 - mtlr r0 +restore: lwz r3,_XER(r1) mtspr XER,r3 - REST_10GPRS(3, r1) - REST_10GPRS(13, r1) - REST_8GPRS(23, r1) - REST_GPR(31, r1) - + REST_10GPRS(9,r1) + REST_10GPRS(19,r1) + REST_2GPRS(29,r1) + REST_GPR(31,r1) + /* make sure we hard disable here, even if rtl is active, to protect * SRR[01] and SPRG2 -- Cort */ @@ -376,12 +381,28 @@ lwz r0,_MSR(r1) andi. r0,r0,MSR_PR beq+ 1f +#ifdef CONFIG_ALTIVEC + mfpvr r8 /* check if we are on a G4 */ + srwi r8,r8,16 + cmpwi r8,PVR_7400@h + bne 2f + lwz r0,THREAD+THREAD_VRSAVE(r2) + mtspr SPRN_VRSAVE,r0 /* if so, restore VRSAVE reg */ +2: +#endif /* CONFIG_ALTIVEC */ addi r0,r1,INT_FRAME_SIZE /* size of frame */ stw r0,THREAD+KSP(r2) /* save kernel stack pointer */ - tophys(r2,r1) - CLR_TOP32(r2) - mtspr SPRG2,r2 /* phys exception stack pointer */ + tophys(r8,r1) + CLR_TOP32(r8) + MOL_HOOK_MMU(9, r4) /* mod. r0,r2-r7, lr, ctr */ + mtspr SPRG2,r8 /* phys exception stack pointer */ 1: + lwz r3,_CTR(r1) + lwz r0,_LINK(r1) + mtctr r3 + mtlr r0 + REST_4GPRS(3, r1) + REST_2GPRS(7, r1) lwz r0,_MSR(r1) FIX_SRR1(r0,r2) mtspr SRR1,r0 diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/feature.c linux/arch/ppc/kernel/feature.c --- v2.4.0-test8/linux/arch/ppc/kernel/feature.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/feature.c Sun Sep 17 09:48:06 2000 @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -34,6 +36,20 @@ #define MAX_FEATURE_OFFSET 0x100 #define FREG(c,r) (&(((c)->reg)[(r)>>2])) +/* Keylargo reg. access. */ +#define KL_FCR(r) (keylargo_base + ((r) >> 2)) +#define KL_IN(r) (in_le32(KL_FCR(r))) +#define KL_OUT(r,v) (out_le32(KL_FCR(r), (v))) +#define KL_BIS(r,v) (KL_OUT((r), KL_IN(r) | (v))) +#define KL_BIC(r,v) (KL_OUT((r), KL_IN(r) & ~(v))) + +/* Uni-N reg. access. Note that Uni-N regs are big endian */ +#define UN_REG(r) (uninorth_base + ((r) >> 2)) +#define UN_IN(r) (in_be32(UN_REG(r))) +#define UN_OUT(r,v) (out_be32(UN_REG(r), (v))) +#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v))) +#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v))) + typedef struct feature_bit { int reg; /* reg. offset from mac-io base */ unsigned int polarity; /* 0 = normal, 1 = inverse */ @@ -74,11 +90,45 @@ {0x38,0,0}, /* FEATURE_Airport_reset */ }; -/* Those bits are from a PowerBook. It's possible that desktop machines - * based on heathrow need a different definition or some bits removed +/* Those bits concern heathrow-based desktop machines (Beige G3s). We have removed + * the SCC related bits and init them once. They have proven to occasionally cause + * problems with the desktop units. */ static fbit feature_bits_heathrow[] = { {0x38,0,0}, /* FEATURE_null */ + {0x38,0,0}, /* FEATURE_Serial_reset */ + {0x38,0,0}, /* FEATURE_Serial_enable */ + {0x38,0,0}, /* FEATURE_Serial_IO_A */ + {0x38,0,0}, /* FEATURE_Serial_IO_B */ + {0x38,0,HRW_SWIM_ENABLE}, /* FEATURE_SWIM3_enable */ + {0x38,0,HRW_MESH_ENABLE}, /* FEATURE_MESH_enable */ + {0x38,0,HRW_IDE0_ENABLE}, /* FEATURE_IDE0_enable */ + {0x38,1,HRW_IDE0_RESET_N}, /* FEATURE_IDE0_reset */ + {0x38,0,HRW_IOBUS_ENABLE}, /* FEATURE_IOBUS_enable */ + {0x38,1,0}, /* FEATURE_Mediabay_reset */ + {0x38,1,0}, /* FEATURE_Mediabay_power */ + {0x38,0,0}, /* FEATURE_Mediabay_PCI_enable */ + {0x38,0,HRW_BAY_IDE_ENABLE}, /* FEATURE_IDE1_enable */ + {0x38,1,HRW_IDE1_RESET_N}, /* FEATURE_IDE1_reset */ + {0x38,0,0}, /* FEATURE_Mediabay_floppy_enable */ + {0x38,0,HRW_BMAC_RESET}, /* FEATURE_BMac_reset */ + {0x38,0,HRW_BMAC_IO_ENABLE}, /* FEATURE_BMac_IO_enable */ + {0x38,1,0}, /* FEATURE_Modem_power */ + {0x38,0,HRW_SLOW_SCC_PCLK}, /* FEATURE_Slow_SCC_PCLK */ + {0x38,1,0}, /* FEATURE_Sound_Power */ + {0x38,0,0}, /* FEATURE_Sound_CLK_Enable */ + {0x38,0,0}, /* FEATURE_IDE2_enable */ + {0x38,0,0}, /* FEATURE_IDE2_reset */ + {0x38,0,0}, /* FEATURE_Mediabay_IDE_switch */ + {0x38,0,0}, /* FEATURE_Mediabay_content */ + {0x38,0,0}, /* FEATURE_Airport_reset */ +}; + +/* Those bits concern heathrow-based PowerBooks (wallstreet/mainstreet). + * Heathrow-based desktop macs (Beige G3s) are _not_ handled here + */ +static fbit feature_bits_wallstreet[] = { + {0x38,0,0}, /* FEATURE_null */ {0x38,0,HRW_RESET_SCC}, /* FEATURE_Serial_reset */ {0x38,0,HRW_SCC_ENABLE}, /* FEATURE_Serial_enable */ {0x38,0,HRW_SCCA_IO}, /* FEATURE_Serial_IO_A */ @@ -145,32 +195,32 @@ */ static fbit feature_bits_keylargo[] = { {0x38,0,0}, /* FEATURE_null */ - {0x38,0,0}, /* FEATURE_Serial_reset */ - {0x38,0,0x00000054}, /* FEATURE_Serial_enable */ - {0x38,0,0}, /* FEATURE_Serial_IO_A */ - {0x38,0,0}, /* FEATURE_Serial_IO_B */ + {0x38,0,KL0_SCC_RESET}, /* FEATURE_Serial_reset */ + {0x38,0,KL0_SERIAL_ENABLE}, /* FEATURE_Serial_enable */ + {0x38,0,KL0_SCC_A_INTF_ENABLE}, /* FEATURE_Serial_IO_A */ + {0x38,0,KL0_SCC_B_INTF_ENABLE}, /* FEATURE_Serial_IO_B */ {0x38,0,0}, /* FEATURE_SWIM3_enable */ {0x38,0,0}, /* FEATURE_MESH_enable */ {0x3c,0,0}, /* FEATURE_IDE0_enable */ - {0x3c,1,0x01000000}, /* FEATURE_IDE0_reset */ + {0x3c,1,KL1_EIDE0_RESET_N}, /* FEATURE_IDE0_reset */ {0x38,0,0}, /* FEATURE_IOBUS_enable */ {0x34,1,0x00000200}, /* FEATURE_Mediabay_reset */ {0x34,1,0x00000400}, /* FEATURE_Mediabay_power */ {0x38,0,0}, /* FEATURE_Mediabay_PCI_enable */ {0x3c,0,0x0}, /* FEATURE_IDE1_enable */ - {0x3c,1,0x08000000}, /* FEATURE_IDE1_reset */ + {0x3c,1,KL1_EIDE1_RESET_N}, /* FEATURE_IDE1_reset */ {0x38,0,0}, /* FEATURE_Mediabay_floppy_enable */ {0x38,0,0}, /* FEATURE_BMac_reset */ {0x38,0,0}, /* FEATURE_BMac_IO_enable */ - {0x40,1,0x02000000}, /* FEATURE_Modem_power */ + {0x40,1,KL2_MODEM_POWER_N}, /* FEATURE_Modem_power */ {0x38,0,0}, /* FEATURE_Slow_SCC_PCLK */ {0x38,0,0}, /* FEATURE_Sound_Power */ {0x38,0,0}, /* FEATURE_Sound_CLK_Enable */ {0x38,0,0}, /* FEATURE_IDE2_enable */ - {0x3c,1,0x40000000}, /* FEATURE_IDE2_reset */ - {0x34,0,0x00001000}, /* FEATURE_Mediabay_IDE_switch */ + {0x3c,1,KL1_UIDE_RESET_N}, /* FEATURE_IDE2_reset */ + {0x34,0,KL_MBCR_MBDEV_ENABLE}, /* FEATURE_Mediabay_IDE_switch */ {0x34,0,0x00000100}, /* FEATURE_Mediabay_content */ - {0x40,1,0x08000000}, /* FEATURE_Airport_reset */ + {0x40,1,KL2_AIRPORT_RESET_N}, /* FEATURE_Airport_reset */ }; /* definition of a feature controller object */ @@ -190,6 +240,8 @@ static void heathrow_prepare_for_sleep(struct feature_controller* ctrler); static void heathrow_wakeup(struct feature_controller* ctrler); +static void keylargo_init(void); +static void uninorth_init(void); static void core99_prepare_for_sleep(struct feature_controller* ctrler); static void core99_wake_up(struct feature_controller* ctrler); @@ -228,8 +280,15 @@ } } else if (device_is_compatible(np, "paddington")) { feature_add_controller(np, feature_bits_paddington); + } else if (machine_is_compatible("AAPL,PowerBook1998")) { + feature_add_controller(np, feature_bits_wallstreet); } else { - feature_add_controller(np, feature_bits_heathrow); + struct feature_controller* ctrler = + feature_add_controller(np, feature_bits_heathrow); + if (ctrler) + out_le32(FREG(ctrler,HEATHROW_FEATURE_REG), + in_le32(FREG(ctrler,HEATHROW_FEATURE_REG)) | HRW_DEFAULTS); + } np = np->next; } @@ -249,14 +308,17 @@ np = find_devices("uni-n"); if (np && np->n_addrs > 0) { uninorth_base = ioremap(np->addrs[0].address, 0x1000); - rev = (u32 *)get_property(np, "device-rev", NULL); - if (rev) - uninorth_rev = *rev; + uninorth_rev = in_be32(UN_REG(UNI_N_VERSION)); } if (uninorth_base && keylargo_base) printk("Uni-N revision: %d, KeyLargo revision: %d\n", uninorth_rev, keylargo_rev); + if (uninorth_base) + uninorth_init(); + if (keylargo_base) + keylargo_init(); + if (controller_count) printk(KERN_INFO "Registered %d feature controller(s)\n", controller_count); @@ -440,14 +502,21 @@ if (!uninorth_base) return; if (power) - out_le32(uninorth_base + 0x20/4, - in_le32(uninorth_base + 0x20/4) | 0x02000000); + UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC); else - out_le32(uninorth_base + 0x20/4, - in_le32(uninorth_base + 0x20/4) & ~0x02000000); + UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC); udelay(20); } +void +feature_set_gmac_phy_reset(struct device_node* device, int reset) +{ + if (!keylargo_base) + return; + out_8((volatile u8 *)KL_FCR(KL_GPIO_ETH_PHY_RESET), reset); + (void)in_8((volatile u8 *)KL_FCR(KL_GPIO_ETH_PHY_RESET)); +} + /* Pass the node of the correct controller, please */ void feature_set_usb_power(struct device_node* device, int power) @@ -460,6 +529,53 @@ { } +/* Initialize the Core99 UniNorth host bridge and memory controller + */ +static void +uninorth_init(void) +{ + struct device_node* gmac; + unsigned long actrl; + + /* Set the arbitrer QAck delay according to what Apple does + */ + actrl = in_be32(UN_REG(UNI_N_ARB_CTRL)) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK; + actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 : UNI_N_ARB_CTRL_QACK_DELAY) + << UNI_N_ARB_CTRL_QACK_DELAY_SHIFT; + UN_OUT(UNI_N_ARB_CTRL, actrl); + + /* + * Turns OFF the gmac clock. The gmac driver will turn + * it back ON when the interface is enabled. This save + * power on portables. + * + * Note: We could also try to turn OFF the PHY. Since this + * has to be done by both the gmac driver and this code, + * I'll probably end-up moving some of this out of the + * modular gmac driver into a non-modular stub containing + * some basic PHY management and power management stuffs + */ + gmac = find_devices("ethernet"); + + while(gmac) { + if (device_is_compatible(gmac, "gmac")) + break; + gmac = gmac->next; + } + if (gmac) + feature_set_gmac_power(gmac, 0); +} + +/* Initialize the Core99 KeyLargo ASIC. Currently, we just make sure + * OpenPIC is enabled + */ +static void +keylargo_init(void) +{ + KL_BIS(KEYLARGO_FCR2, KL2_MPIC_ENABLE); +} + +#ifdef CONFIG_PMAC_PBOOK void feature_prepare_for_sleep(void) { @@ -506,27 +622,28 @@ } } -static u32 save_fcr0; -//static u32 save_fcr1; -//static u32 save_fcr2; +static u32 save_fcr[5]; static u32 save_mbcr; static void heathrow_prepare_for_sleep(struct feature_controller* ctrler) { save_mbcr = in_le32(FREG(ctrler, 0x34)); - save_fcr0 = in_le32(FREG(ctrler, 0x38)); + save_fcr[0] = in_le32(FREG(ctrler, 0x38)); + save_fcr[1] = in_le32(FREG(ctrler, 0x3c)); - out_le32(FREG(ctrler, 0x38), save_fcr0 & ~HRW_IOBUS_ENABLE); + out_le32(FREG(ctrler, 0x38), save_fcr[0] & ~HRW_IOBUS_ENABLE); } static void heathrow_wakeup(struct feature_controller* ctrler) { - out_le32(FREG(ctrler, 0x38), save_fcr0); + out_le32(FREG(ctrler, 0x38), save_fcr[0]); + out_le32(FREG(ctrler, 0x3c), save_fcr[1]); out_le32(FREG(ctrler, 0x34), save_mbcr); - - out_le32(FREG(ctrler, 0x38), save_fcr0 | HRW_IOBUS_ENABLE); + mdelay(1); + out_le32(FREG(ctrler, 0x38), save_fcr[0] | HRW_IOBUS_ENABLE); + mdelay(1); } static void @@ -540,4 +657,4 @@ { /* Not yet implemented */ } - +#endif /* CONFIG_PMAC_PBOOK */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/gemini_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/gemini_setup.c Sun Sep 17 09:48:06 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -335,7 +336,7 @@ #define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x)))) /* ensure that the RTC is up and running */ -void __init gemini_time_init(void) +long __init gemini_time_init(void) { unsigned char reg; @@ -346,6 +347,7 @@ gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL); gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL); } + return 0; } #undef DEBUG_RTC diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/hashtable.S linux/arch/ppc/kernel/hashtable.S --- v2.4.0-test8/linux/arch/ppc/kernel/hashtable.S Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/kernel/hashtable.S Sun Sep 17 09:48:06 2000 @@ -27,6 +27,7 @@ #include #include #include +#include "mol.h" /* * Load a PTE into the hash table, if possible. @@ -593,6 +594,11 @@ * flush_hash_page(unsigned context, unsigned long va) */ _GLOBAL(flush_hash_page) +#ifdef CONFIG_MOL + mflr r10 + MOL_HOOK_MMU(10, r6) + mtlr r10 +#endif lis r6,Hash@ha lwz r6,Hash@l(r6) /* hash table base */ cmpwi 0,r6,0 /* hash table in use? */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S --- v2.4.0-test8/linux/arch/ppc/kernel/head.S Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/head.S Sun Sep 17 09:48:06 2000 @@ -31,6 +31,7 @@ #include #include #include +#include "mol.h" #ifdef CONFIG_APUS #include @@ -78,7 +79,7 @@ mtspr DBAT##n##L,RB; \ 1: #endif /* CONFIG_PPC64BRIDGE */ - + .text .globl _stext _stext: @@ -162,8 +163,8 @@ /* Switch MMU off, clear BATs and flush TLB. At this point, r3 contains * the physical address we are running at, returned by prom_init() */ -__after_prom_start: bl mmu_off +__after_mmu_off: bl clear_bats bl flush_tlbs #endif @@ -202,15 +203,7 @@ mr r26,r3 addis r4,r3,KERNELBASE@h /* current address of _start */ cmpwi 0,r4,0 /* are we already running at 0? */ - beq 2f /* assume it's OK if so */ - li r3,0 - mfmsr r0 - andi. r0,r0,MSR_DR /* MMU enabled? */ - beq relocate_kernel - lis r3,KERNELBASE@h /* if so, are we */ - cmpw 0,r4,r3 /* already running at KERNELBASE? */ bne relocate_kernel -2: #endif /* CONFIG_APUS */ /* * we now have the 1st 16M of ram mapped with the bats. @@ -300,6 +293,17 @@ .long hdlr; \ .long ret_from_except +#define STD_MOL_EXCEPTION(n, label, hdlr, hook) \ + . = n; \ +label: \ + EXCEPTION_PROLOG; \ + MOL_HOOK(hook); \ + addi r3,r1,STACK_FRAME_OVERHEAD; \ + li r20,MSR_KERNEL; \ + bl transfer_to_handler; \ + .long hdlr; \ + .long ret_from_except + /* System reset */ #ifdef CONFIG_SMP /* MVME/MTX and gemini start the secondary here */ #ifdef CONFIG_GEMINI @@ -324,6 +328,7 @@ DataAccess: EXCEPTION_PROLOG #endif /* CONFIG_PPC64BRIDGE */ + MOL_HOOK(0) mfspr r20,DSISR andis. r0,r20,0xa470 /* weird error? */ bne 1f /* if not, try to put a PTE */ @@ -366,6 +371,7 @@ InstructionAccess: EXCEPTION_PROLOG #endif /* CONFIG_PPC64BRIDGE */ + MOL_HOOK(1) andis. r0,r23,0x4000 /* no pte found? */ beq 1f /* if so, try to put a PTE */ mr r3,r22 /* into the hash table */ @@ -430,6 +436,7 @@ . = 0x700 ProgramCheck: EXCEPTION_PROLOG + MOL_HOOK(2) addi r3,r1,STACK_FRAME_OVERHEAD li r20,MSR_KERNEL rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */ @@ -441,6 +448,7 @@ . = 0x800 FPUnavailable: EXCEPTION_PROLOG + MOL_HOOK_RESTORE(3) bne load_up_fpu /* if from user, just load it up */ li r20,MSR_KERNEL bl transfer_to_handler /* if from kernel, take a trap */ @@ -450,6 +458,7 @@ . = 0x900 Decrementer: EXCEPTION_PROLOG + MOL_HOOK(4) addi r3,r1,STACK_FRAME_OVERHEAD li r20,MSR_KERNEL bl transfer_to_handler @@ -473,12 +482,9 @@ .long ret_from_except /* Single step - not used on 601 */ - STD_EXCEPTION(0xd00, SingleStep, SingleStepException) - + STD_MOL_EXCEPTION(0xd00, SingleStep, SingleStepException, 5) STD_EXCEPTION(0xe00, Trap_0e, UnknownException) -#ifndef CONFIG_ALTIVEC - STD_EXCEPTION(0xf00, Trap_0f, UnknownException) -#else + /* * The Altivec unavailable trap is at 0x0f20. Foo. * We effectively remap it to 0x3000. @@ -493,15 +499,20 @@ .long ret_from_except . = 0xf20 +#ifdef CONFIG_ALTIVEC b AltiVecUnavailable -#endif /* CONFIG_ALTIVEC */ - +#endif +Trap_0f: + EXCEPTION_PROLOG + b trap_0f_cont + /* * Handle TLB miss for instruction on 603/603e. * Note: we get an alternate set of r0 - r3 to use automatically. */ . = 0x1000 InstructionTLBMiss: + MOL_HOOK_TLBMISS( 14 ) /* * r0: stored ctr * r1: linux style pte ( later becomes ppc hardware pte ) @@ -568,6 +579,7 @@ */ . = 0x1100 DataLoadTLBMiss: + MOL_HOOK_TLBMISS( 15 ) /* * r0: stored ctr * r1: linux style pte ( later becomes ppc hardware pte ) @@ -633,6 +645,7 @@ */ . = 0x1200 DataStoreTLBMiss: + MOL_HOOK_TLBMISS( 16 ) /* * r0: stored ctr * r1: linux style pte ( later becomes ppc hardware pte ) @@ -674,7 +687,7 @@ mtcrf 0x80,r3 rfi - STD_EXCEPTION(0x1300, Trap_13, InstructionBreakpoint) + STD_MOL_EXCEPTION(0x1300, Trap_13, InstructionBreakpoint, 11) STD_EXCEPTION(0x1400, SMI, SMIException) STD_EXCEPTION(0x1500, Trap_15, UnknownException) STD_EXCEPTION(0x1600, Trap_16, UnknownException) @@ -687,7 +700,7 @@ STD_EXCEPTION(0x1d00, Trap_1d, UnknownException) STD_EXCEPTION(0x1e00, Trap_1e, UnknownException) STD_EXCEPTION(0x1f00, Trap_1f, UnknownException) - STD_EXCEPTION(0x2000, RunMode, RunModeException) + STD_MOL_EXCEPTION(0x2000, RunMode, RunModeException, 5) STD_EXCEPTION(0x2100, Trap_21, UnknownException) STD_EXCEPTION(0x2200, Trap_22, UnknownException) STD_EXCEPTION(0x2300, Trap_23, UnknownException) @@ -709,16 +722,12 @@ #ifdef CONFIG_ALTIVEC AltiVecUnavailable: EXCEPTION_PROLOG + MOL_HOOK_RESTORE(12) bne load_up_altivec /* if from user, just load it up */ li r20,MSR_KERNEL bl transfer_to_handler /* if from kernel, take a trap */ .long KernelAltiVec .long ret_from_except - -/* here are the bits of trap 0xf00 which got displaced */ -Trap_0f: - EXCEPTION_PROLOG - b trap_0f_cont #endif /* CONFIG_ALTIVEC */ #ifdef CONFIG_PPC64BRIDGE @@ -753,6 +762,14 @@ beq 2f addi r24,r1,STACK_FRAME_OVERHEAD stw r24,PT_REGS(r23) +#ifdef CONFIG_ALTIVEC + mfpvr r24 /* check if we are on a G4 */ + srwi r24,r24,16 + cmpwi r24,PVR_7400@h + bne 2f + mfspr r22,SPRN_VRSAVE /* if so, save vrsave register value */ + stw r22,THREAD_VRSAVE(r23) +#endif /* CONFIG_ALTIVEC */ 2: addi r2,r23,-THREAD /* set r2 to current */ tovirt(r2,r2) mflr r23 @@ -771,6 +788,7 @@ lwz r24,0(r23) /* virtual address of handler */ lwz r23,4(r23) /* where to go when done */ FIX_SRR1(r20,r22) + MOL_HOOK(6) mtspr SRR0,r24 mtspr SRR1,r20 mtlr r23 @@ -981,6 +999,11 @@ .globl giveup_altivec giveup_altivec: +#ifdef CONFIG_MOL + mflr r4 + MOL_HOOK_MMU(13, r5) + mtlr r4 +#endif mfmsr r5 oris r5,r5,MSR_VEC@h SYNC @@ -1017,6 +1040,11 @@ */ .globl giveup_fpu giveup_fpu: +#ifdef CONFIG_MOL + mflr r4 + MOL_HOOK_MMU(7, r5) + mtlr r4 +#endif mfmsr r5 ori r5,r5,MSR_FP SYNC @@ -1048,19 +1076,10 @@ * the kernel image to physical address 0. */ relocate_kernel: -#if 0 /* Is this still needed ? I don't think so. It breaks new - * boot-with-mmu-off stuff - */ - lis r9,0x426f /* if booted from BootX, don't */ - addi r9,r9,0x6f58 /* translate source addr */ - cmpw r31,r9 /* (we have to on chrp) */ - beq 7f - rlwinm r4,r4,0,8,31 /* translate source address */ - add r4,r4,r3 /* to region mapped with BATs */ -#endif -7: addis r9,r26,klimit@ha /* fetch klimit */ + addis r9,r26,klimit@ha /* fetch klimit */ lwz r25,klimit@l(r9) addis r25,r25,-KERNELBASE@h + li r3,0 /* Destination base address */ li r6,0 /* Destination offset */ li r5,0x4000 /* # bytes of memory to copy */ bl copy_and_flush /* copy the first 0x4000 bytes */ @@ -1307,7 +1326,7 @@ mfspr r9,PVR rlwinm r9,r9,16,16,31 cmpi 0,r9,1 - beq 4f /* not needed for 601 */ + beq 6f /* not needed for 601 */ mfspr r11,HID0 andi. r0,r11,HID0_DCE ori r11,r11,HID0_ICE|HID0_DCE @@ -1323,26 +1342,33 @@ isync cmpi 0,r9,4 /* check for 604 */ cmpi 1,r9,9 /* or 604e */ - cmpi 2,r9,10 /* or mach5 */ + cmpi 2,r9,10 /* or mach5 / 604r */ cmpi 3,r9,8 /* check for 750 (G3) */ cmpi 4,r9,12 /* or 7400 (G4) */ cror 2,2,6 cror 2,2,10 bne 4f - ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */ + ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e|r], enable */ bne 2,5f - ori r11,r11,HID0_BTCD + ori r11,r11,HID0_BTCD /* superscalar exec & br history tbl */ b 5f 4: cror 14,14,18 bne 3,6f - /* We should add ABE here if we want to use Store Gathering - * and other nifty bridge features + /* for G3/G4: + * enable Store Gathering (SGE), Address Brodcast (ABE), + * Branch History Table (BHTE), Branch Target ICache (BTIC) */ - ori r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC /* for g3/g4, enable */ + ori r11,r11,HID0_SGE | HID0_ABE | HID0_BHTE | HID0_BTIC + oris r11,r11,HID0_DPM@h /* enable dynamic power mgmt */ + li r3,HID0_SPD + andc r11,r11,r3 /* clear SPD: enable speculative */ li r3,0 - mtspr ICTC,r3 -5: mtspr HID0,r11 /* superscalar exec & br history tbl */ + mtspr ICTC,r3 /* Instruction Cache Throttling off */ +5: isync + mtspr HID0,r11 + sync + isync 6: blr /* @@ -1548,12 +1574,11 @@ blr mmu_off: - addi r4, r3, __after_prom_start - _start + addi r4, r3, __after_mmu_off - _start mfmsr r3 andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */ beqlr - ori r3,r3,MSR_DR|MSR_IR - xori r3,r3,MSR_DR|MSR_IR + andc r3,r3,r0 mtspr SRR0,r4 mtspr SRR1,r3 sync @@ -1617,23 +1642,19 @@ mflr r8 bl reloc_offset mtlr r8 - lis r8, disp_BATL@h - ori r8, r8, disp_BATL@l - add r8, r3, r8 - lwz r8, 0(r8) - lis r11, disp_BATU@h - ori r11, r11, disp_BATU@l - add r11, r3, r11 - lwz r11, 0(r11) - mtspr IBAT3L,r8 - mtspr IBAT3U,r11 + addis r8,r3,disp_BAT@ha + addi r8,r8,disp_BAT@l + lwz r11,0(r8) + lwz r8,4(r8) mfspr r9,PVR rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ cmpi 0,r9,1 beq 1f mtspr DBAT3L,r8 mtspr DBAT3U,r11 -1: + blr +1: mtspr IBAT3L,r8 + mtspr IBAT3U,r11 blr #endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */ @@ -1649,17 +1670,42 @@ */ .globl m8260_gorom m8260_gorom: - li r5,MSR_KERNEL & ~(MSR_IR|MSR_DR) - lis r6,2f@h - addis r6,r6,-KERNELBASE@h - ori r6,r6,2f@l - mtspr SRR0,r6 - mtspr SRR1,r5 - rfi + mfmsr r0 + rlwinm r0,r0,0,17,15 /* clear MSR_EE in r0 */ + sync + mtmsr r0 + sync + mfspr r11, HID0 + lis r10, 0 + ori r10,r10,HID0_ICE|HID0_DCE + andc r11, r11, r10 + mtspr HID0, r11 + isync + li r5, MSR_ + lis r6,2f@h + addis r6,r6,-KERNELBASE@h + ori r6,r6,2f@l + mtspr SRR0,r6 + mtspr SRR1,r5 + isync + sync + rfi 2: - mtlr r4 - blr + mtlr r4 + blr +#endif + +#ifdef CONFIG_MOL +/* + * Mac-on-linux hook_table. Don't put this in the data section - + * the base address must be within the first 32KB of RAM. + */ + .globl mol_interface +mol_interface: + .long MOL_INTERFACE_VERSION + .fill 24,4,0 /* space for 24 hooks */ #endif + /* * We put a few things here that have to be page-aligned. diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/head_8xx.S linux/arch/ppc/kernel/head_8xx.S --- v2.4.0-test8/linux/arch/ppc/kernel/head_8xx.S Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/kernel/head_8xx.S Sun Sep 17 09:48:06 2000 @@ -874,6 +874,13 @@ lis r6, swapper_pg_dir@h tophys(r6,r6) ori r6, r6, swapper_pg_dir@l +#ifdef CONFIG_8xx_CPU6 + lis r4, cpu6_errata_word@h + ori r4, r4, cpu6_errata_word@l + li r3, 0x3980 + stw r3, 12(r4) + lwz r3, 12(r4) +#endif mtspr M_TWB, r6 lis r4,2f@h ori r4,r4,2f@l @@ -940,9 +947,23 @@ * ASID compare register with the new "context". */ _GLOBAL(set_context) +#ifdef CONFIG_8xx_CPU6 + lis r6, cpu6_errata_word@h + ori r6, r6, cpu6_errata_word@l + tophys (r4, r4) + li r7, 0x3980 + stw r7, 12(r6) + lwz r7, 12(r6) + mtspr M_TWB, r4 /* Update MMU base address */ + li r7, 0x3380 + stw r7, 12(r6) + lwz r7, 12(r6) + mtspr M_CASID, r3 /* Update context */ +#else mtspr M_CASID,r3 /* Update context */ tophys (r4, r4) mtspr M_TWB, r4 /* and pgd */ +#endif tlbia SYNC blr @@ -966,6 +987,24 @@ 2: mtlr r4 blr + +#ifdef CONFIG_8xx_CPU6 +/* It's here because it is unique to the 8xx. + * It is important we get called with interrupts disabled. I used to + * do that, but it appears that all code that calls this already had + * interrupt disabled. + */ + .globl set_dec_cpu6 +set_dec_cpu6: + lis r7, cpu6_errata_word@h + ori r7, r7, cpu6_errata_word@l + li r4, 0x2c00 + stw r4, 8(r7) + lwz r4, 8(r7) + mtspr 22, r3 /* Update Decrementer */ + SYNC + blr +#endif /* * We put a few things here that have to be page-aligned. @@ -990,4 +1029,10 @@ .globl cmd_line cmd_line: .space 512 + +#ifdef CONFIG_8xx_CPU6 + .globl cpu6_errata_word +cpu6_errata_word: + .space 16 +#endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/idle.c linux/arch/ppc/kernel/idle.c --- v2.4.0-test8/linux/arch/ppc/kernel/idle.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/idle.c Sun Sep 17 09:48:06 2000 @@ -286,6 +286,7 @@ case 6: /* 603e */ case 7: /* 603ev */ case 8: /* 750 */ + case 12: /* 7400 */ save_flags(msr); __cli(); if (!current->need_resched) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c --- v2.4.0-test8/linux/arch/ppc/kernel/irq.c Fri Aug 4 16:15:37 2000 +++ linux/arch/ppc/kernel/irq.c Sun Sep 17 09:48:06 2000 @@ -137,17 +137,21 @@ if (!handler) { /* Free */ - for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) - { - /* Found it - now free it */ - save_flags(flags); - cli(); - *p = action->next; - restore_flags(flags); - irq_kfree(action); - return 0; - } - return -ENOENT; + p = &irq_desc[irq].action; + while ((action = *p) != NULL && action->dev_id != dev_id) + p = &action->next; + if (action == NULL) + return -ENOENT; + + /* Found it - now free it */ + save_flags(flags); + cli(); + *p = action->next; + if (irq_desc[irq].action == NULL) + disable_irq(irq); + restore_flags(flags); + irq_kfree(action); + return 0; } action = (struct irqaction *) @@ -300,7 +304,7 @@ } } -asmlinkage int do_IRQ(struct pt_regs *regs, int isfake) +int do_IRQ(struct pt_regs *regs, int isfake) { int cpu = smp_processor_id(); int irq; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/m8260_setup.c linux/arch/ppc/kernel/m8260_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/m8260_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/m8260_setup.c Sun Sep 17 09:48:07 2000 @@ -112,11 +112,10 @@ bd_t *binfo = (bd_t *)__res; int freq, divisor; - freq = (binfo->bi_intfreq * 1000000); - divisor = 16; - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + freq = (binfo->bi_busfreq * 1000000); + divisor = 4; + tb_ticks_per_jiffy = freq / HZ / divisor; + tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000); } /* The 8260 has an internal 1-second timer update register that @@ -143,8 +142,20 @@ m8260_restart(char *cmd) { extern void m8260_gorom(bd_t *bi, uint addr); + uint startaddr; - m8260_gorom(NULL, 0xff000100); + /* Most boot roms have a warmstart as the second instruction + * of the reset vector. If that doesn't work for you, change this + * or the reboot program to send a proper address. + */ + startaddr = 0xff000104; + + if (cmd != NULL) { + if (!strncmp(cmd, "startaddr=", 10)) + startaddr = simple_strtoul(&cmd[10], NULL, 0); + } + + m8260_gorom((uint)__pa(__res), startaddr); } void diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/m8xx_setup.c linux/arch/ppc/kernel/m8xx_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/m8xx_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/m8xx_setup.c Sun Sep 17 09:48:07 2000 @@ -135,6 +135,13 @@ machine_restart(NULL); } +/* A place holder for time base interrupts, if they are ever enabled. +*/ +void timebase_interrupt(int irq, void * dev, struct pt_regs * regs) +{ + printk("timebase_interrupt()\n"); +} + /* The decrementer counts at the system (internal) clock frequency divided by * sixteen, or external oscillator divided by four. We force the processor * to use system clock divided by sixteen. @@ -160,35 +167,14 @@ freq = fp*60; /* try to make freq/1e6 an integer */ divisor = 60; printk("time_init: decrementer frequency = %d/%d\n", freq, divisor); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; -} + tb_ticks_per_jiffy = freq / HZ / divisor; + tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000); -/* A place holder for time base interrupts, if they are ever enabled. -*/ -void timebase_interrupt(int irq, void * dev, struct pt_regs * regs) -{ - printk("timebase_interrupt()\n"); -} - -/* The RTC on the MPC8xx is an internal register. - * We want to protect this during power down, so we need to unlock, - * modify, and re-lock. - */ -static int -m8xx_set_rtc_time(unsigned long time) -{ - ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = KAPWR_KEY; - ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtc = time; - ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = ~KAPWR_KEY; - return(0); -} - -unsigned long __init -m8xx_get_rtc_time(void) -{ - /* First, unlock all of the registers we are going to modify. + /* Perform some more timer/timebase initialization. This used + * to be done elsewhere, but other changes caused it to get + * called more than once....that is a bad thing. + * + * First, unlock all of the registers we are going to modify. * To protect them from corruption during power down, registers * that are maintained by keep alive power are "locked". To * modify these registers we have to write the key value to @@ -219,9 +205,27 @@ ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_tbscr = ((mk_int_int_mask(DEC_INTERRUPT) << 8) | (TBSCR_TBF | TBSCR_TBE)); + if (request_8xxirq(DEC_INTERRUPT, timebase_interrupt, 0, "tbint", NULL) != 0) panic("Could not allocate timer IRQ!"); +} + +/* The RTC on the MPC8xx is an internal register. + * We want to protect this during power down, so we need to unlock, + * modify, and re-lock. + */ +static int +m8xx_set_rtc_time(unsigned long time) +{ + ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = KAPWR_KEY; + ((volatile immap_t *)IMAP_ADDR)->im_sit.sit_rtc = time; + ((volatile immap_t *)IMAP_ADDR)->im_sitk.sitk_rtck = ~KAPWR_KEY; + return(0); +} +unsigned long __init +m8xx_get_rtc_time(void) +{ /* Get time from the RTC. */ return((unsigned long)(((immap_t *)IMAP_ADDR)->im_sit.sit_rtc)); diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S --- v2.4.0-test8/linux/arch/ppc/kernel/misc.S Fri Aug 11 14:29:04 2000 +++ linux/arch/ppc/kernel/misc.S Sun Sep 17 09:48:07 2000 @@ -24,12 +24,15 @@ #if defined(CONFIG_4xx) || defined(CONFIG_8xx) #define CACHE_LINE_SIZE 16 #define LG_CACHE_LINE_SIZE 4 +#define MAX_COPY_PREFETCH 1 #elif !defined(CONFIG_PPC64BRIDGE) #define CACHE_LINE_SIZE 32 #define LG_CACHE_LINE_SIZE 5 +#define MAX_COPY_PREFETCH 4 #else #define CACHE_LINE_SIZE 128 #define LG_CACHE_LINE_SIZE 7 +#define MAX_COPY_PREFETCH 1 #endif /* CONFIG_4xx || CONFIG_8xx */ .text @@ -339,7 +342,15 @@ _GLOBAL(clear_page) li r0,4096/CACHE_LINE_SIZE mtctr r0 +#ifdef CONFIG_8xx + li r4, 0 +1: stw r4, 0(r3) + stw r4, 4(r3) + stw r4, 8(r3) + stw r4, 12(r3) +#else 1: dcbz 0,r3 +#endif addi r3,r3,CACHE_LINE_SIZE bdnz 1b blr @@ -361,12 +372,31 @@ stwu r9,16(r3) _GLOBAL(copy_page) - li r0,4096/CACHE_LINE_SIZE - mtctr r0 addi r3,r3,-4 addi r4,r4,-4 li r5,4 -1: dcbz r5,r3 + +#ifndef CONFIG_8xx +#if MAX_COPY_PREFETCH > 1 + li r0,MAX_COPY_PREFETCH + li r11,4 + mtctr r0 +11: dcbt r11,r4 + addi r11,r11,CACHE_LINE_SIZE + bdnz 11b +#else /* MAX_COPY_PREFETCH == 1 */ + dcbt r5,r4 + li r11,CACHE_LINE_SIZE+4 +#endif /* MAX_COPY_PREFETCH */ +#endif /* CONFIG_8xx */ + + li r0,4096/CACHE_LINE_SIZE + mtctr r0 +1: +#ifndef CONFIG_8xx + dcbt r11,r4 + dcbz r5,r3 +#endif COPY_16_BYTES #if CACHE_LINE_SIZE >= 32 COPY_16_BYTES @@ -484,7 +514,7 @@ stwcx. r5,0,r3 /* Update with new value */ bne- 10b /* Retry if "reservation" (i.e. lock) lost */ cntlzw r3,r5 - srwi r3,r3,5 + srwi r3,r3,5 blr #endif /* 0 */ _GLOBAL(atomic_clear_mask) @@ -629,48 +659,59 @@ blr /* - * Extended precision shifts + * Extended precision shifts. + * + * Updated to be valid for shift counts from 0 to 63 inclusive. + * -- Gabriel * * R3/R4 has 64 bit value * R5 has shift count * result in R3/R4 * - * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ - * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000 - * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ + * ashrdi3: arithmetic right shift (sign propagation) + * lshrdi3: logical right shift + * ashldi3: left shift */ _GLOBAL(__ashrdi3) - li r6,32 - sub r6,r6,r5 - slw r7,r3,r6 /* isolate YYY */ - srw r4,r4,r5 /* isolate ZZZ */ - or r4,r4,r7 /* YYYZZZ */ - sraw r3,r3,r5 /* SSSXXX */ + subfic r6,r5,32 + srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count + addi r7,r5,32 # could be xori, or addi with -32 + slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count) + rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0 + sraw r7,r3,r7 # t2 = MSW >> (count-32) + or r4,r4,r6 # LSW |= t1 + slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2 + sraw r3,r3,r5 # MSW = MSW >> count + or r4,r4,r7 # LSW |= t2 blr _GLOBAL(__ashldi3) - li r6,32 - sub r6,r6,r5 - srw r7,r4,r6 /* isolate ZZZ */ - slw r4,r4,r5 /* AAA000 */ - slw r3,r3,r5 /* YYY--- */ - or r3,r3,r7 /* YYYZZZ */ + subfic r6,r5,32 + slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count + addi r7,r5,32 # could be xori, or addi with -32 + srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count) + slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32) + or r3,r3,r6 # MSW |= t1 + slw r4,r4,r5 # LSW = LSW << count + or r3,r3,r7 # MSW |= t2 blr _GLOBAL(__lshrdi3) - li r6,32 - sub r6,r6,r5 - slw r7,r3,r6 /* isolate YYY */ - srw r4,r4,r5 /* isolate ZZZ */ - or r4,r4,r7 /* YYYZZZ */ - srw r3,r3,r5 /* 000XXX */ + subfic r6,r5,32 + srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count + addi r7,r5,32 # could be xori, or addi with -32 + slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count) + srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32) + or r4,r4,r6 # LSW |= t1 + srw r3,r3,r5 # MSW = MSW >> count + or r4,r4,r7 # LSW |= t2 blr _GLOBAL(abs) - cmpi 0,r3,0 - bge 10f - neg r3,r3 -10: blr + srawi r4,r3,31 + xor r3,r3,r4 + sub r3,r3,r4 + blr _GLOBAL(_get_SP) mr r3,r1 /* Close enough */ @@ -1217,6 +1258,6 @@ .long sys_pciconfig_iobase /* 200 */ .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */ .long sys_getdents64 /* 202 */ - .rept NR_syscalls-201 + .rept NR_syscalls-(.-sys_call_table)/4 .long sys_ni_syscall .endr diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/mol.h linux/arch/ppc/kernel/mol.h --- v2.4.0-test8/linux/arch/ppc/kernel/mol.h Wed Dec 31 16:00:00 1969 +++ linux/arch/ppc/kernel/mol.h Sun Sep 17 09:48:07 2000 @@ -0,0 +1,68 @@ +/* + * arch/ppc/kernel/mol.h + * + * + * + * Mac-on-Linux hook macros + * + * + * Copyright (C) 2000 Samuel Rydh (samuel@ibrium.se) + * + * 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 + * + */ + +#ifndef _PPC_KERNEL_MOL +#define _PPC_KERNEL_MOL + +#include + +#ifdef CONFIG_MOL +#define MOL_INTERFACE_VERSION 3 + +#define MOL_HOOK(hook_num) \ + lwz r0,(mol_interface + 4 * hook_num + 4)@l(0); \ + cmpwi cr1,r0,0; \ + beq+ cr1,777f; \ + mtctr r0; \ + bctrl; \ +777: lwz r0,GPR0(r21) + +#define MOL_HOOK_RESTORE(hook_num) \ + mfcr r2; \ + MOL_HOOK(hook_num); \ + mtcrf 0x80,r2; \ + lwz r2,_CTR(r21); \ + mtctr r2; \ + lwz r2,GPR2(r21) + +#define MOL_HOOK_MMU(hook_num, scr) \ + lis scr,(mol_interface + 4 * hook_num + 4)@ha; \ + lwz scr,(mol_interface + 4 * hook_num + 4)@l(scr); \ + cmpwi cr1,scr,0; \ + beq+ cr1,778f; \ + mtctr scr; \ + bctrl; \ +778: + +#define MOL_HOOK_TLBMISS(hook_num) \ + lwz r0,(mol_interface + 4 * hook_num + 4)@l(0); \ + cmpwi r0,0; \ + beq+ 779f; \ + mflr r3; \ + mtlr r0; \ + blrl; \ + mtlr r3; \ +779: + +#else +#define MOL_HOOK(num) +#define MOL_HOOK_RESTORE(num) +#define MOL_HOOK_MMU(num, scr) +#define MOL_HOOK_TLBMISS(num) +#endif + + +#endif /* _PPC_KERNEL_MOL */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/oak_setup.c linux/arch/ppc/kernel/oak_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/oak_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/oak_setup.c Sun Sep 17 09:48:07 2000 @@ -231,10 +231,11 @@ /* * Document me. */ -void __init +long __init oak_time_init(void) { /* XXX - Implement me */ + return 0; } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/open_pic.c linux/arch/ppc/kernel/open_pic.c --- v2.4.0-test8/linux/arch/ppc/kernel/open_pic.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/open_pic.c Sun Sep 17 09:48:07 2000 @@ -100,7 +100,7 @@ #ifdef CONFIG_SMP void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs) { - smp_message_recv(cpl-OPENPIC_VEC_IPI); + smp_message_recv(cpl-OPENPIC_VEC_IPI, regs); } #endif /* CONFIG_SMP */ @@ -262,11 +262,11 @@ int j, pri; pri = strcmp(np->name, "programmer-switch") ? 2 : 7; for (j=0;jn_intrs;j++) { - openpic_initirq( np->intrs[j].line, - pri, - np->intrs[j].line, - 0, - np->intrs[j].sense); + openpic_initirq(np->intrs[j].line, + pri, + np->intrs[j].line, + 0, + np->intrs[j].sense); if (np->intrs[j].sense) irq_desc[np->intrs[j].line].status = IRQ_LEVEL; } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c --- v2.4.0-test8/linux/arch/ppc/kernel/pci.c Mon Aug 7 14:31:40 2000 +++ linux/arch/ppc/kernel/pci.c Sun Sep 17 09:48:07 2000 @@ -25,7 +25,13 @@ #include "pci.h" -static void __init pcibios_claim_resources(struct list_head *); +#undef DEBUG + +#ifdef DEBUG +#define DBG(x...) printk(x) +#else +#define DBG(x...) +#endif unsigned long isa_io_base = 0; unsigned long isa_mem_base = 0; @@ -70,95 +76,297 @@ generic_pcibios_write_dword }; -void __init pcibios_init(void) -{ - printk("PCI: Probing PCI hardware\n"); - pci_scan_bus(0, &generic_pci_ops, NULL); - if (ppc_md.pcibios_fixup) - ppc_md.pcibios_fixup(); - pcibios_claim_resources(&pci_root_buses); -} -void __init -pcibios_fixup_pbus_ranges(struct pci_bus * bus, struct pbus_set_ranges_data * ranges) + +void pcibios_update_resource(struct pci_dev *dev, struct resource *root, + struct resource *res, int resource) { - ranges->io_start -= bus->resource[0]->start; - ranges->io_end -= bus->resource[0]->start; - ranges->mem_start -= bus->resource[1]->start; - ranges->mem_end -= bus->resource[1]->start; + u32 new, check; + int reg; + + new = res->start | (res->flags & PCI_REGION_FLAG_MASK); + if (resource < 6) { + reg = PCI_BASE_ADDRESS_0 + 4*resource; + } else if (resource == PCI_ROM_RESOURCE) { + res->flags |= PCI_ROM_ADDRESS_ENABLE; + reg = dev->rom_base_reg; + } else { + /* Somebody might have asked allocation of a non-standard resource */ + return; + } + + pci_write_config_dword(dev, reg, new); + pci_read_config_dword(dev, reg, &check); + if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) { + printk(KERN_ERR "PCI: Error while updating region " + "%s/%d (%08x != %08x)\n", dev->slot_name, resource, + new, check); + } } -unsigned long resource_fixup(struct pci_dev * dev, struct resource * res, - unsigned long start, unsigned long size) +/* + * We need to avoid collisions with `mirrored' VGA ports + * and other strange ISA hardware, so we always want the + * addresses to be allocated in the 0x000-0x0ff region + * modulo 0x400. + * + * Why? Because some silly external IO cards only decode + * the low 10 bits of the IO address. The 0x00-0xff region + * is reserved for motherboard devices that decode all 16 + * bits, so it's ok to allocate at, say, 0x2800-0x28ff, + * but we want to try to avoid allocating at 0x2900-0x2bff + * which might have be mirrored at 0x0100-0x03ff.. + */ +void +pcibios_align_resource(void *data, struct resource *res, unsigned long size) { - return start; + struct pci_dev *dev = data; + + if (res->flags & IORESOURCE_IO) { + unsigned long start = res->start; + + if (size > 0x100) { + printk(KERN_ERR "PCI: I/O Region %s/%d too large" + " (%ld bytes)\n", dev->slot_name, + dev->resource - res, size); + } + + if (start & 0x300) { + start = (start + 0x3ff) & ~0x3ff; + res->start = start; + } + } } -static void __init pcibios_claim_resources(struct list_head *bus_list) + +/* + * Handle resources of PCI devices. If the world were perfect, we could + * just allocate all the resource regions and do nothing more. It isn't. + * On the other hand, we cannot just re-allocate all devices, as it would + * require us to know lots of host bridge internals. So we attempt to + * keep as much of the original configuration as possible, but tweak it + * when it's found to be wrong. + * + * Known BIOS problems we have to work around: + * - I/O or memory regions not configured + * - regions configured, but not enabled in the command register + * - bogus I/O addresses above 64K used + * - expansion ROMs left enabled (this may sound harmless, but given + * the fact the PCI specs explicitly allow address decoders to be + * shared between expansion ROMs and other resource regions, it's + * at least dangerous) + * + * Our solution: + * (1) Allocate resources for all buses behind PCI-to-PCI bridges. + * This gives us fixed barriers on where we can allocate. + * (2) Allocate resources for all enabled devices. If there is + * a collision, just mark the resource as unallocated. Also + * disable expansion ROMs during this step. + * (3) Try to allocate resources for disabled devices. If the + * resources were assigned correctly, everything goes well, + * if they weren't, they won't disturb allocation of other + * resources. + * (4) Assign new addresses to resources which were either + * not configured at all or misconfigured. If explicitly + * requested by the user, configure expansion ROM address + * as well. + */ + +static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) { - struct list_head *ln, *dn; + struct list_head *ln; struct pci_bus *bus; struct pci_dev *dev; int idx; + struct resource *r, *pr; + /* Depth-First Search on bus tree */ for (ln=bus_list->next; ln != bus_list; ln=ln->next) { bus = pci_bus_b(ln); - for (dn=bus->devices.next; dn != &bus->devices; dn=dn->next) { - dev = pci_dev_b(dn); - for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) - { - struct resource *r = &dev->resource[idx]; - struct resource *pr; + if ((dev = bus->self)) { + for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { + r = &dev->resource[idx]; if (!r->start) continue; pr = pci_find_parent_resource(dev, r); if (!pr || request_resource(pr, r) < 0) - { - printk(KERN_ERR "PCI: Address space collision on region %d of device %s\n", idx, dev->name); - /* We probably should disable the region, shouldn't we? */ + printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, dev->slot_name); + } + } + pcibios_allocate_bus_resources(&bus->children); + } +} + +static void __init pcibios_allocate_resources(int pass) +{ + struct pci_dev *dev; + int idx, disabled; + u16 command; + struct resource *r, *pr; + + pci_for_each_dev(dev) { + pci_read_config_word(dev, PCI_COMMAND, &command); + for(idx = 0; idx < 6; idx++) { + r = &dev->resource[idx]; + if (r->parent) /* Already allocated */ + continue; + if (!r->start) /* Address not assigned at all */ + continue; + if (r->end == 0xffffffff) { + /* LongTrail OF quirk: unassigned */ + DBG("PCI: Resource %08lx-%08lx was unassigned\n", r->start, r->end); + r->end -= r->start; + r->start = 0; + continue; + } + + if (r->flags & IORESOURCE_IO) + disabled = !(command & PCI_COMMAND_IO); + else + disabled = !(command & PCI_COMMAND_MEMORY); + if (pass == disabled) { + DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", + r->start, r->end, r->flags, disabled, pass); + pr = pci_find_parent_resource(dev, r); + if (!pr || request_resource(pr, r) < 0) { + printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, dev->slot_name); + /* We'll assign a new address later */ + r->end -= r->start; + r->start = 0; } } } - pcibios_claim_resources(&bus->children); + if (!pass) { + r = &dev->resource[PCI_ROM_RESOURCE]; + if (r->flags & PCI_ROM_ADDRESS_ENABLE) { + /* Turn the ROM off, leave the resource region, but keep it unregistered. */ + u32 reg; + DBG("PCI: Switching off ROM of %s\n", dev->slot_name); + r->flags &= ~PCI_ROM_ADDRESS_ENABLE; + pci_read_config_dword(dev, dev->rom_base_reg, ®); + pci_write_config_dword(dev, dev->rom_base_reg, reg & ~PCI_ROM_ADDRESS_ENABLE); + } + } } } -void __init pcibios_fixup_bus(struct pci_bus *bus) +static void __init pcibios_assign_resources(void) { - if ( ppc_md.pcibios_fixup_bus ) - ppc_md.pcibios_fixup_bus(bus); + struct pci_dev *dev; + int idx; + struct resource *r; + + pci_for_each_dev(dev) { + int class = dev->class >> 8; + + /* Don't touch classless devices and host bridges */ + if (!class || class == PCI_CLASS_BRIDGE_HOST) + continue; + + for(idx=0; idx<6; idx++) { + r = &dev->resource[idx]; + + /* + * Don't touch IDE controllers and I/O ports of video cards! + */ + if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) || + (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO))) + continue; + + /* + * We shall assign a new address to this resource, either because + * the BIOS forgot to do so or because we have decided the old + * address was unusable for some reason. + */ + if (!r->start && r->end) + pci_assign_resource(dev, idx); + } + + if (0) { /* don't assign ROMs */ + r = &dev->resource[PCI_ROM_RESOURCE]; + r->end -= r->start; + r->start = 0; + if (r->end) + pci_assign_resource(dev, PCI_ROM_RESOURCE); + } + } } -char __init *pcibios_setup(char *str) + +int pcibios_enable_resources(struct pci_dev *dev) { - return str; + u16 cmd, old_cmd; + int idx; + struct resource *r; + + pci_read_config_word(dev, PCI_COMMAND, &cmd); + old_cmd = cmd; + for(idx=0; idx<6; idx++) { + r = &dev->resource[idx]; + if (!r->start && r->end) { + printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name); + return -EINVAL; + } + if (r->flags & IORESOURCE_IO) + cmd |= PCI_COMMAND_IO; + if (r->flags & IORESOURCE_MEM) + cmd |= PCI_COMMAND_MEMORY; + } + if (dev->resource[PCI_ROM_RESOURCE].start) + cmd |= PCI_COMMAND_MEMORY; + if (cmd != old_cmd) { + printk("PCI: Enabling device %s (%04x -> %04x)\n", dev->slot_name, old_cmd, cmd); + pci_write_config_word(dev, PCI_COMMAND, cmd); + } + return 0; +} + + + +void __init pcibios_init(void) +{ + printk("PCI: Probing PCI hardware\n"); + pci_scan_bus(0, &generic_pci_ops, NULL); + if (ppc_md.pcibios_fixup) + ppc_md.pcibios_fixup(); + pcibios_allocate_bus_resources(&pci_root_buses); + pcibios_allocate_resources(0); + pcibios_allocate_resources(1); + pcibios_assign_resources(); } -/* the next two are stolen from the alpha port... */ void __init -pcibios_update_resource(struct pci_dev *dev, struct resource *root, - struct resource *res, int resource) +pcibios_fixup_pbus_ranges(struct pci_bus * bus, struct pbus_set_ranges_data * ranges) { - unsigned long where, size; - u32 reg; + ranges->io_start -= bus->resource[0]->start; + ranges->io_end -= bus->resource[0]->start; + ranges->mem_start -= bus->resource[1]->start; + ranges->mem_end -= bus->resource[1]->start; +} - where = PCI_BASE_ADDRESS_0 + (resource * 4); - size = res->end - res->start; - pci_read_config_dword(dev, where, ®); - reg = (reg & size) | (((u32)(res->start - root->start)) & ~size); - pci_write_config_dword(dev, where, reg); +unsigned long resource_fixup(struct pci_dev * dev, struct resource * res, + unsigned long start, unsigned long size) +{ + return start; } -void __init -pcibios_update_irq(struct pci_dev *dev, int irq) +void __init pcibios_fixup_bus(struct pci_bus *bus) { - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); - /* XXX FIXME - update OF device tree node interrupt property */ + if ( ppc_md.pcibios_fixup_bus ) + ppc_md.pcibios_fixup_bus(bus); } +char __init *pcibios_setup(char *str) +{ + return str; +} + +/* the next one is stolen from the alpha port... */ void __init -pcibios_align_resource(void *data, struct resource *res, unsigned long size) +pcibios_update_irq(struct pci_dev *dev, int irq) { + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); + /* XXX FIXME - update OF device tree node interrupt property */ } int pcibios_enable_device(struct pci_dev *dev) @@ -188,114 +396,26 @@ return 0; } -/* - * Those syscalls are derived from the Alpha versions, they - * allow userland apps to retreive the per-device iobase and - * mem-base. They also provide wrapper for userland to do - * config space accesses. - * The "host_number" returns the number of the Uni-N sub bridge - */ - -asmlinkage int -sys_pciconfig_read(unsigned long bus, unsigned long dfn, - unsigned long off, unsigned long len, - unsigned char *buf) -{ - unsigned char ubyte; - unsigned short ushort; - unsigned int uint; - long err = 0; - - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - if (!pcibios_present()) - return -ENOSYS; - - switch (len) { - case 1: - err = pcibios_read_config_byte(bus, dfn, off, &ubyte); - put_user(ubyte, buf); - break; - case 2: - err = pcibios_read_config_word(bus, dfn, off, &ushort); - put_user(ushort, (unsigned short *)buf); - break; - case 4: - err = pcibios_read_config_dword(bus, dfn, off, &uint); - put_user(uint, (unsigned int *)buf); - break; - default: - err = -EINVAL; - break; - } - return err; -} - -asmlinkage int -sys_pciconfig_write(unsigned long bus, unsigned long dfn, - unsigned long off, unsigned long len, - unsigned char *buf) -{ - unsigned char ubyte; - unsigned short ushort; - unsigned int uint; - long err = 0; - - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - if (!pcibios_present()) - return -ENOSYS; - - switch (len) { - case 1: - err = get_user(ubyte, buf); - if (err) - break; - err = pcibios_write_config_byte(bus, dfn, off, ubyte); - if (err != PCIBIOS_SUCCESSFUL) { - err = -EFAULT; - } - break; - case 2: - err = get_user(ushort, (unsigned short *)buf); - if (err) - break; - err = pcibios_write_config_word(bus, dfn, off, ushort); - if (err != PCIBIOS_SUCCESSFUL) { - err = -EFAULT; - } - break; - case 4: - err = get_user(uint, (unsigned int *)buf); - if (err) - break; - err = pcibios_write_config_dword(bus, dfn, off, uint); - if (err != PCIBIOS_SUCCESSFUL) { - err = -EFAULT; - } - break; - default: - err = -EINVAL; - break; - } - return err; -} - void * -pci_dev_io_base(unsigned char bus, unsigned char devfn) +pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical) { - /* Defaults to old way */ - if (!ppc_md.pci_dev_io_base) - return pci_io_base(bus); - return ppc_md.pci_dev_io_base(bus, devfn); + if (!ppc_md.pci_dev_io_base) { + /* Please, someone fix this for non-pmac machines, we + * need either the virtual or physical PCI IO base + */ + return 0; + } + return ppc_md.pci_dev_io_base(bus, devfn, physical); } void * pci_dev_mem_base(unsigned char bus, unsigned char devfn) { /* Default memory base is 0 (1:1 mapping) */ - if (!ppc_md.pci_dev_mem_base) + if (!ppc_md.pci_dev_mem_base) { + /* Please, someone fix this for non-pmac machines.*/ return 0; + } return ppc_md.pci_dev_mem_base(bus, devfn); } @@ -318,15 +438,20 @@ asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) { + long result = -EOPNOTSUPP; + switch (which) { case IOBASE_BRIDGE_NUMBER: return (long)pci_dev_root_bridge(bus, devfn); case IOBASE_MEMORY: return (long)pci_dev_mem_base(bus, devfn); case IOBASE_IO: - return (long)pci_dev_io_base(bus, devfn); + result = (long)pci_dev_io_base(bus, devfn, 1); + if (result == 0) + result = -EOPNOTSUPP; + break; } - return -EOPNOTSUPP; + return result; } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_backlight.c linux/arch/ppc/kernel/pmac_backlight.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_backlight.c Tue Jul 18 15:03:55 2000 +++ linux/arch/ppc/kernel/pmac_backlight.c Sun Sep 17 09:48:07 2000 @@ -41,16 +41,16 @@ #ifdef CONFIG_ADB_PMU /* Special case for the old PowerBook since I can't test on it */ - if ((machine_is_compatible("AAPL,3400/2400") || machine_is_compatible("AAPL,3500") - || machine_is_compatible("AAPL,PowerBook1998") - || machine_is_compatible("AAPL,PowerBook1999")) - && !strcmp(type, "pmu")) + backlight_autosave = machine_is_compatible("AAPL,3400/2400") + || machine_is_compatible("AAPL,3500"); + if ((backlight_autosave + || machine_is_compatible("AAPL,PowerBook1998") + || machine_is_compatible("PowerBook1,1")) + && !strcmp(type, "pmu")) valid = 1; - else #endif - { - if (bk_node) - prop = get_property(bk_node, "backlight-control", NULL); + if (bk_node) { + prop = get_property(bk_node, "backlight-control", NULL); if (prop && !strncmp(prop, type, strlen(type))) valid = 1; } @@ -70,8 +70,6 @@ } #ifdef CONFIG_ADB_PMU - backlight_autosave = machine_is_compatible("AAPL,3400/2400") - || machine_is_compatible("AAPL,3500"); if (backlight_autosave) { struct adb_request req; pmu_request(&req, NULL, 2, 0xd9, 0); diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_nvram.c linux/arch/ppc/kernel/pmac_nvram.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_nvram.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/pmac_nvram.c Sun Sep 17 09:48:07 2000 @@ -312,17 +312,18 @@ __openfirmware unsigned char nvram_read_byte(int addr) { - struct adb_request req; - switch (nvram_naddrs) { #ifdef CONFIG_ADB_PMU - case -1: + case -1: { + struct adb_request req; + if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM, (addr >> 8) & 0xff, addr & 0xff)) break; while (!req.complete) pmu_poll(); return req.reply[1]; + } #endif case 1: if (is_core_99) @@ -339,17 +340,18 @@ __openfirmware void nvram_write_byte(unsigned char val, int addr) { - struct adb_request req; - switch (nvram_naddrs) { #ifdef CONFIG_ADB_PMU - case -1: + case -1: { + struct adb_request req; + if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM, (addr >> 8) & 0xff, addr & 0xff, val)) break; while (!req.complete) pmu_poll(); break; + } #endif case 1: if (is_core_99) { diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_pci.c linux/arch/ppc/kernel/pmac_pci.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_pci.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/pmac_pci.c Sun Sep 17 09:48:07 2000 @@ -35,6 +35,7 @@ volatile unsigned int* cfg_addr; volatile unsigned int* cfg_data; void* iobase; + unsigned long iobase_phys; }; static struct uninorth_data uninorth_bridges[3]; @@ -133,15 +134,20 @@ __pmac void * -pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn) +pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical) { - int bridge; - if (uninorth_count == 0) - return pci_io_base(bus); - bridge = pmac_pci_dev_root_bridge(bus, devfn); - if (bridge == -1) - return pci_io_base(bus); - return uninorth_bridges[bridge].iobase; + int bridge = -1; + if (uninorth_count != 0) + bridge = pmac_pci_dev_root_bridge(bus, devfn); + if (bridge == -1) { + struct bridge_data *bp; + + if (bus > max_bus || (bp = bridges[bus]) == 0) + return 0; + return physical ? (void *) bp->io_base_phys : bp->io_base; + } + return physical ? (void *) uninorth_bridges[bridge].iobase_phys + : uninorth_bridges[bridge].iobase; } __pmac @@ -649,7 +655,9 @@ uninorth_bridges[i].cfg_addr = ioremap(addr->address + 0x800000, 0x1000); uninorth_bridges[i].cfg_data = ioremap(addr->address + 0xc00000, 0x1000); uninorth_bridges[i].node = dev; - uninorth_bridges[i].iobase = (void *)addr->address; + uninorth_bridges[i].iobase_phys = addr->address; + /* is 0x10000 enough for io space ? */ + uninorth_bridges[i].iobase = (void *)ioremap(addr->address, 0x10000); /* XXX This is the bridge with the PCI expansion bus. This is also the * address of the bus that will receive type 1 config accesses and io * accesses. Appears to be correct for iMac DV and G4 Sawtooth too. @@ -667,14 +675,15 @@ if (device_is_compatible(dev, "uni-north")) { bp->cfg_addr = 0; bp->cfg_data = 0; - /* is 0x10000 enough for io space ? */ - bp->io_base = (void *)ioremap(addr->address, 0x10000); + bp->io_base = uninorth_bridges[uninorth_count-1].iobase; + bp->io_base_phys = uninorth_bridges[uninorth_count-1].iobase_phys; } else if (strcmp(dev->name, "pci") == 0) { /* XXX assume this is a mpc106 (grackle) */ bp->cfg_addr = (volatile unsigned int *) ioremap(0xfec00000, 0x1000); bp->cfg_data = (volatile unsigned char *) ioremap(0xfee00000, 0x1000); + bp->io_base_phys = 0xfe000000; bp->io_base = (void *) ioremap(0xfe000000, 0x20000); if (machine_is_compatible("AAPL,PowerBook1998")) grackle_set_loop_snoop(bp, 1); @@ -687,6 +696,7 @@ ioremap(addr->address + 0x800000, 0x1000); bp->cfg_data = (volatile unsigned char *) ioremap(addr->address + 0xc00000, 0x1000); + bp->io_base_phys = addr->address; bp->io_base = (void *) ioremap(addr->address, 0x10000); } if (isa_io_base == 0) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_pic.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/pmac_pic.c Sun Sep 17 09:48:07 2000 @@ -204,17 +204,12 @@ unsigned long bits = 0; #ifdef CONFIG_SMP - void pmac_smp_message_recv(void); + void pmac_smp_message_recv(struct pt_regs *); /* IPI's are a hack on the powersurge -- Cort */ if ( smp_processor_id() != 0 ) { -#ifdef CONFIG_XMON - static int xmon_2nd; - if (xmon_2nd) - xmon(regs); -#endif - pmac_smp_message_recv(); + pmac_smp_message_recv(regs); return -2; /* ignore, already handled */ } #endif /* CONFIG_SMP */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_setup.c Tue Jul 18 23:02:09 2000 +++ linux/arch/ppc/kernel/pmac_setup.c Sun Sep 17 09:48:07 2000 @@ -68,7 +68,7 @@ #undef SHOW_GATWICK_IRQS -extern void pmac_time_init(void); +extern long pmac_time_init(void); extern unsigned long pmac_get_rtc_time(void); extern int pmac_set_rtc_time(unsigned long nowtime); extern void pmac_read_rtc_time(void); @@ -77,24 +77,29 @@ extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int mackbd_getkeycode(unsigned int scancode); -extern int mackbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode); -extern char mackbd_unexpected_up(unsigned char keycode); +extern int mackbd_translate(unsigned char keycode, unsigned char *keycodep, + char raw_mode); +extern int mackbd_unexpected_up(unsigned char keycode); extern void mackbd_leds(unsigned char leds); -extern void mackbd_init_hw(void); +extern void __init mackbd_init_hw(void); +extern int mac_hid_kbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char mac_hid_kbd_unexpected_up(unsigned char keycode); +extern void mac_hid_init_hw(void); #ifdef CONFIG_MAGIC_SYSRQ -unsigned char mackbd_sysrq_xlate[128]; +extern unsigned char mac_hid_kbd_sysrq_xlate[128]; +extern unsigned char pckbd_sysrq_xlate[128]; +extern unsigned char mackbd_sysrq_xlate[128]; #endif /* CONFIG_MAGIC_SYSRQ */ extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char pckbd_unexpected_up(unsigned char keycode); -extern void pckbd_leds(unsigned char leds); -extern void pckbd_init_hw(void); +extern int keyboard_sends_linux_keycodes; extern void pmac_nvram_update(void); -extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn); +extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical); extern void *pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn); extern int pmac_pci_dev_root_bridge(unsigned char bus, unsigned char devfn); @@ -115,7 +120,6 @@ extern void zs_kgdb_hook(int tty_num); static void ohare_init(void); static void init_p2pbridge(void); -static void init_uninorth(void); #ifdef CONFIG_BOOTX_TEXT void pmac_progress(char *s, unsigned short hex); #endif @@ -276,7 +280,6 @@ pmac_find_bridges(); init_p2pbridge(); - init_uninorth(); /* Checks "l2cr-value" property in the registry */ if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) { @@ -372,31 +375,6 @@ } } -static void __init -init_uninorth(void) -{ - /* - * Turns OFF the gmac clock. The gmac driver will turn - * it back ON when the interface is enabled. This save - * power on portables. - * - * Note: We could also try to turn OFF the PHY. Since this - * has to be done by both the gmac driver and this code, - * I'll probably end-up moving some of this out of the - * modular gmac driver into a non-modular stub containing - * some basic PHY management and power management stuffs - */ - struct device_node* gmac = find_devices("ethernet"); - - while(gmac) { - if (device_is_compatible(gmac, "gmac")) - break; - gmac = gmac->next; - } - if (gmac) - feature_set_gmac_power(gmac, 0); -} - extern char *bootpath; extern char *bootdevice; void *boot_host; @@ -404,14 +382,15 @@ int boot_part; kdev_t boot_dev; -extern void via_pmu_start(void); - void __init pmac_init2(void) { #ifdef CONFIG_ADB_PMU via_pmu_start(); #endif +#ifdef CONFIG_ADB_CUDA + via_cuda_start(); +#endif #ifdef CONFIG_PMAC_PBOOK media_bay_init(); #endif @@ -683,7 +662,26 @@ ppc_md.pci_dev_mem_base = pmac_pci_dev_mem_base; ppc_md.pci_dev_root_bridge = pmac_pci_dev_root_bridge; -#if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) +#ifdef CONFIG_VT +#ifdef CONFIG_INPUT_ADBHID + ppc_md.kbd_init_hw = mac_hid_init_hw; + ppc_md.kbd_translate = mac_hid_kbd_translate; + ppc_md.kbd_unexpected_up = mac_hid_kbd_unexpected_up; + ppc_md.kbd_setkeycode = 0; + ppc_md.kbd_getkeycode = 0; +#ifdef CONFIG_MAGIC_SYSRQ +#ifdef CONFIG_MAC_ADBKEYCODES + if (!keyboard_sends_linux_keycodes) { + ppc_md.ppc_kbd_sysrq_xlate = mac_hid_kbd_sysrq_xlate; + SYSRQ_KEY = 0x69; + } else +#endif /* CONFIG_MAC_ADBKEYCODES */ + { + ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate; + SYSRQ_KEY = 0x54; + } +#endif /* CONFIG_MAGIC_SYSRQ */ +#elif defined(CONFIG_ADB_KEYBOARD) ppc_md.kbd_setkeycode = mackbd_setkeycode; ppc_md.kbd_getkeycode = mackbd_getkeycode; ppc_md.kbd_translate = mackbd_translate; @@ -691,10 +689,11 @@ ppc_md.kbd_leds = mackbd_leds; ppc_md.kbd_init_hw = mackbd_init_hw; #ifdef CONFIG_MAGIC_SYSRQ - ppc_md.ppc_kbd_sysrq_xlate = mackbd_sysrq_xlate; + ppc_md.ppc_kbd_sysrq_xlate = mackbd_sysrq_xlate; SYSRQ_KEY = 0x69; -#endif -#endif +#endif /* CONFIG_MAGIC_SYSRQ */ +#endif /* CONFIG_INPUT_ADBHID/CONFIG_ADB_KEYBOARD */ +#endif /* CONFIG_VT */ #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) ppc_ide_md.insw = pmac_ide_insw; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c --- v2.4.0-test8/linux/arch/ppc/kernel/pmac_time.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/pmac_time.c Sun Sep 17 09:48:07 2000 @@ -25,7 +25,7 @@ #include #include #include - +#include #include #include @@ -58,7 +58,7 @@ extern struct timezone sys_tz; __init -void pmac_time_init(void) +long pmac_time_init(void) { #ifdef CONFIG_NVRAM s32 delta = 0; @@ -72,17 +72,18 @@ dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0); printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60, dst ? "on" : "off"); - sys_tz.tz_minuteswest = -delta/60; - /* I _suppose_ this is 0:off, 1:on */ - sys_tz.tz_dsttime = dst; + return delta; +#else + return 0; #endif } __pmac unsigned long pmac_get_rtc_time(void) { -#ifdef CONFIG_ADB +#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) struct adb_request req; + unsigned long now; #endif /* Get the time from the RTC */ @@ -96,8 +97,9 @@ if (req.reply_len != 7) printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n", req.reply_len); - return (req.reply[3] << 24) + (req.reply[4] << 16) - + (req.reply[5] << 8) + req.reply[6] - RTC_OFFSET; + now = (req.reply[3] << 24) + (req.reply[4] << 16) + + (req.reply[5] << 8) + req.reply[6]; + return now - RTC_OFFSET; #endif /* CONFIG_ADB_CUDA */ #ifdef CONFIG_ADB_PMU case SYS_CTRLER_PMU: @@ -108,21 +110,25 @@ if (req.reply_len != 5) printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n", req.reply_len); - return (req.reply[1] << 24) + (req.reply[2] << 16) - + (req.reply[3] << 8) + req.reply[4] - RTC_OFFSET; + now = (req.reply[1] << 24) + (req.reply[2] << 16) + + (req.reply[3] << 8) + req.reply[4]; + return now - RTC_OFFSET; #endif /* CONFIG_ADB_PMU */ default: - return 0; } + return 0; } int pmac_set_rtc_time(unsigned long nowtime) { +#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU) struct adb_request req; +#endif - nowtime += RTC_OFFSET - sys_tz.tz_minuteswest * 60; + nowtime += RTC_OFFSET; switch (sys_ctrler) { +#ifdef CONFIG_ADB_CUDA case SYS_CTRLER_CUDA: if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) @@ -133,16 +139,19 @@ printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n", req.reply_len); return 1; +#endif /* CONFIG_ADB_CUDA */ +#ifdef CONFIG_ADB_PMU case SYS_CTRLER_PMU: if (pmu_request(&req, NULL, 5, PMU_SET_RTC, nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0) return 0; while (!req.complete) pmu_poll(); - if (req.reply_len != 5) + if (req.reply_len != 0) printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n", req.reply_len); return 1; +#endif /* CONFIG_ADB_PMU */ default: return 0; } @@ -186,12 +195,11 @@ ; dend = get_dec(); - decrementer_count = (dstart - dend) / 6; - count_period_num = 60; - count_period_den = decrementer_count * 6 * HZ / 100000; + tb_ticks_per_jiffy = (dstart - dend) / 6; + tb_to_us = mulhwu_scale_factor(dstart - dend, 60000); - printk(KERN_INFO "via_calibrate_decr: decrementer_count = %u (%u ticks)\n", - decrementer_count, dstart - dend); + printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n", + tb_ticks_per_jiffy, dstart - dend); return 1; } @@ -214,8 +222,11 @@ case PBOOK_WAKE: write_lock_irqsave(&xtime_lock, flags); xtime.tv_sec = pmac_get_rtc_time() + time_diff; + set_dec(tb_ticks_per_jiffy); + /* No currently-supported powerbook has a 601, + so use get_tbl, not native */ + last_jiffy_stamp(0) = tb_last_stamp = get_tbl(); xtime.tv_usec = 0; - set_dec(decrementer_count); last_rtc_update = xtime.tv_sec; write_unlock_irqrestore(&xtime_lock, flags); break; @@ -236,7 +247,7 @@ void __init pmac_calibrate_decr(void) { struct device_node *cpu; - int freq, *fp, divisor; + unsigned int freq, *fp; #ifdef CONFIG_PMAC_PBOOK pmu_register_sleep_notifier(&time_sleep_notifier); @@ -252,15 +263,13 @@ cpu = find_type_devices("cpu"); if (cpu == 0) panic("can't find cpu node in time_init"); - fp = (int *) get_property(cpu, "timebase-frequency", NULL); + fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL); if (fp == 0) panic("can't get cpu timebase frequency"); - freq = *fp * 60; /* try to make freq/1e6 an integer */ - divisor = 60; - printk("time_init: decrementer frequency = %d/%d\n", - freq, divisor); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + freq = *fp; + printk("time_init: decrementer frequency = %u.%.6u MHz\n", + freq/1000000, freq%1000000); + tb_ticks_per_jiffy = freq / HZ; + tb_to_us = mulhwu_scale_factor(freq, 1000000); } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c --- v2.4.0-test8/linux/arch/ppc/kernel/ppc_ksyms.c Fri Aug 4 16:15:37 2000 +++ linux/arch/ppc/kernel/ppc_ksyms.c Sun Sep 17 09:48:07 2000 @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef CONFIG_SMP #include #endif /* CONFIG_SMP */ @@ -184,6 +185,10 @@ EXPORT_SYMBOL(enable_kernel_fp); EXPORT_SYMBOL(flush_icache_range); EXPORT_SYMBOL(xchg_u32); +#ifdef CONFIG_ALTIVEC +EXPORT_SYMBOL(last_task_used_altivec); +EXPORT_SYMBOL(giveup_altivec); +#endif /* CONFIG_ALTIVEC */ #ifdef CONFIG_SMP EXPORT_SYMBOL(__global_cli); EXPORT_SYMBOL(__global_sti); @@ -204,26 +209,34 @@ EXPORT_SYMBOL(ppc_md); #ifdef CONFIG_ADB -/* - * This could be more fine-grained, but for now assume if we have - * ADB we have it all -- Cort - */ EXPORT_SYMBOL(adb_request); EXPORT_SYMBOL(adb_register); +EXPORT_SYMBOL(adb_unregister); +EXPORT_SYMBOL(adb_poll); +EXPORT_SYMBOL(adb_try_handler_change); +#endif /* CONFIG_ADB */ +#ifdef CONFIG_ADB_CUDA EXPORT_SYMBOL(cuda_request); EXPORT_SYMBOL(cuda_poll); +#endif /* CONFIG_ADB_CUDA */ #ifdef CONFIG_ADB_PMU EXPORT_SYMBOL(pmu_request); EXPORT_SYMBOL(pmu_poll); #endif /* CONFIG_ADB_PMU */ -#endif /* CONFIG_ADB */ #ifdef CONFIG_PMAC_PBOOK EXPORT_SYMBOL(pmu_register_sleep_notifier); EXPORT_SYMBOL(pmu_unregister_sleep_notifier); EXPORT_SYMBOL(pmu_enable_irled); -#endif CONFIG_PMAC_PBOOK +#endif /* CONFIG_PMAC_PBOOK */ +#ifdef CONFIG_PMAC_BACKLIGHT +EXPORT_SYMBOL(get_backlight_level); +EXPORT_SYMBOL(set_backlight_level); +#endif /* CONFIG_PMAC_BACKLIGHT */ #if defined(CONFIG_ALL_PPC) EXPORT_SYMBOL_NOVERS(sys_ctrler); +#ifndef CONFIG_MACH_SPECIFIC +EXPORT_SYMBOL_NOVERS(have_of); +#endif /* CONFIG_MACH_SPECIFIC */ EXPORT_SYMBOL(find_devices); EXPORT_SYMBOL(find_type_devices); EXPORT_SYMBOL(find_compatible_devices); @@ -253,10 +266,7 @@ EXPORT_SYMBOL(pmac_xpram_read); EXPORT_SYMBOL(pmac_xpram_write); #endif /* CONFIG_NVRAM */ -#ifdef CONFIG_PPC_RTC -EXPORT_SYMBOL(mktime); EXPORT_SYMBOL(to_tm); -#endif EXPORT_SYMBOL_NOVERS(__ashrdi3); EXPORT_SYMBOL_NOVERS(__ashldi3); @@ -280,7 +290,7 @@ EXPORT_SYMBOL(irq_desc); void ppc_irq_dispatch_handler(struct pt_regs *, int); EXPORT_SYMBOL(ppc_irq_dispatch_handler); -EXPORT_SYMBOL(decrementer_count); +EXPORT_SYMBOL(tb_ticks_per_jiffy); EXPORT_SYMBOL(get_wchan); EXPORT_SYMBOL(console_drivers); EXPORT_SYMBOL(console_lock); @@ -310,3 +320,17 @@ EXPORT_SYMBOL(next_mmu_context); EXPORT_SYMBOL(set_context); EXPORT_SYMBOL(mmu_context_overflow); + +#ifdef CONFIG_MOL +extern ulong mol_interface[]; +extern PTE *Hash; +extern unsigned long Hash_mask; +extern void (*ret_from_except)(void); +extern struct task_struct *last_task_used_altivec; +EXPORT_SYMBOL_NOVERS(mol_interface); +EXPORT_SYMBOL(Hash); +EXPORT_SYMBOL(Hash_mask); +EXPORT_SYMBOL(handle_mm_fault); +EXPORT_SYMBOL(last_task_used_math); +EXPORT_SYMBOL(ret_from_except); +#endif /* CONFIG_MOL */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/prep_setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/prep_setup.c Sun Sep 17 09:48:07 2000 @@ -365,14 +365,13 @@ */ void __init prep_res_calibrate_decr(void) { - int freq, divisor; + unsigned long freq, divisor=4; freq = res->VitalProductData.ProcessorBusHz; - divisor = 4; - printk("time_init: decrementer frequency = %d/%d\n", freq, divisor); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + printk("time_init: decrementer frequency = %lu.%.6lu MHz\n", + (freq/divisor)/1000000, (freq/divisor)%1000000); + tb_ticks_per_jiffy = freq / HZ / divisor; + tb_to_us = mulhwu_scale_factor(freq/divisor, 1000000); } /* @@ -381,32 +380,30 @@ * but on prep we have to figure it out. * -- Cort */ -int calibrate_done = 0; -volatile int *done_ptr = &calibrate_done; +/* Done with 3 interrupts: the first one primes the cache and the + * 2 following ones measure the interval. The precision of the method + * is still doubtful due to the short interval sampled. + */ +static __initdata volatile int calibrate_steps = 3; +static __initdata unsigned tbstamp; void __init prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs *regs) { - unsigned long freq, divisor; - static unsigned long t1 = 0, t2 = 0; - - if ( !t1 ) - t1 = get_dec(); - else if (!t2) - { - t2 = get_dec(); - t2 = t1-t2; /* decr's in 1/HZ */ - t2 = t2*HZ; /* # decrs in 1s - thus in Hz */ - freq = t2 * 60; /* try to make freq/1e6 an integer */ - divisor = 60; - printk("time_init: decrementer frequency = %lu/%lu (%luMHz)\n", - freq, divisor,t2>>20); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; - *done_ptr = 1; + unsigned long t, freq; + int step=--calibrate_steps; + + t = get_tbl(); + if (step > 0) { + tbstamp = t; + } else { + freq = (t - tbstamp)*HZ; + printk("time_init: decrementer frequency = %lu.%.6lu MHz\n", + freq/1000000, freq%1000000); + tb_ticks_per_jiffy = freq / HZ; + tb_to_us = mulhwu_scale_factor(freq, 1000000); } } @@ -428,17 +425,43 @@ if (request_irq(0, prep_calibrate_decr_handler, 0, "timer", NULL) != 0) panic("Could not allocate timer IRQ!"); __sti(); - while ( ! *done_ptr ) /* nothing */; /* wait for calibrate */ + while ( calibrate_steps ) /* nothing */; /* wait for calibrate */ restore_flags(flags); free_irq( 0, NULL); } -/* We use the NVRAM RTC to time a second to calibrate the decrementer. */ +static long __init mk48t59_init(void) { + unsigned char tmp; + + tmp = ppc_md.nvram_read_val(MK48T59_RTC_CONTROLB); + if (tmp & MK48T59_RTC_CB_STOP) { + printk("Warning: RTC was stopped, date will be wrong.\n"); + ppc_md.nvram_write_val(MK48T59_RTC_CONTROLB, + tmp & ~MK48T59_RTC_CB_STOP); + /* Low frequency crystal oscillators may take a very long + * time to startup and stabilize. For now just ignore the + * the issue, but attempting to calibrate the decrementer + * from the RTC just after this wakeup is likely to be very + * inaccurate. Firmware should not allow to load + * the OS with the clock stopped anyway... + */ + } + /* Ensure that the clock registers are updated */ + tmp = ppc_md.nvram_read_val(MK48T59_RTC_CONTROLA); + tmp &= ~(MK48T59_RTC_CA_READ | MK48T59_RTC_CA_WRITE); + ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA, tmp); + return 0; +} + +/* We use the NVRAM RTC to time a second to calibrate the decrementer, + * the RTC registers have just been set up in the right state by the + * preceding routine. + */ void __init mk48t59_calibrate_decr(void) { - unsigned long freq, divisor; - unsigned long t1, t2; + unsigned long freq; + unsigned long t1; unsigned char save_control; long i; unsigned char sec; @@ -458,29 +481,31 @@ /* Read the seconds value to see when it changes. */ sec = ppc_md.nvram_read_val(MK48T59_RTC_SECONDS); + /* Actually this is bad for precision, we should have a loop in + * which we only read the seconds counter. nvram_read_val writes + * the address bytes on every call and this takes a lot of time. + * Perhaps an nvram_wait_change method returning a time + * stamp with a loop count as parameter would be the solution. + */ for (i = 0 ; i < 1000000 ; i++) { /* may take up to 1 second... */ + t1 = get_tbl(); if (ppc_md.nvram_read_val(MK48T59_RTC_SECONDS) != sec) { break; } } - t1 = get_dec(); sec = ppc_md.nvram_read_val(MK48T59_RTC_SECONDS); for (i = 0 ; i < 1000000 ; i++) { /* Should take up 1 second... */ + freq = get_tbl()-t1; if (ppc_md.nvram_read_val(MK48T59_RTC_SECONDS) != sec) { break; } } - t2 = t1 - get_dec(); - - freq = t2 * 60; /* try to make freq/1e6 an integer */ - divisor = 60; - printk("time_init: decrementer frequency = %lu/%lu (%luMHz)\n", - freq, divisor,t2>>20); - decrementer_count = freq / HZ / divisor; - count_period_num = divisor; - count_period_den = freq / 1000000; + printk("time_init: decrementer frequency = %lu.%.6lu MHz\n", + freq/1000000, freq%1000000); + tb_ticks_per_jiffy = freq / HZ; + tb_to_us = mulhwu_scale_factor(freq, 1000000); } void __prep @@ -788,6 +813,7 @@ { ppc_md.set_rtc_time = mk48t59_set_rtc_time; ppc_md.get_rtc_time = mk48t59_get_rtc_time; + ppc_md.time_init = mk48t59_init; } else { @@ -808,6 +834,7 @@ ppc_md.set_rtc_time = mk48t59_set_rtc_time; ppc_md.get_rtc_time = mk48t59_get_rtc_time; ppc_md.calibrate_decr = mk48t59_calibrate_decr; + ppc_md.time_init = mk48t59_init; } #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c --- v2.4.0-test8/linux/arch/ppc/kernel/prep_time.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/prep_time.c Sun Sep 17 09:48:07 2000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -99,28 +100,34 @@ unsigned long mc146818_get_rtc_time(void) { unsigned int year, mon, day, hour, min, sec; - int i; + int uip, i; /* The Linux interpretation of the CMOS clock register contents: * When the Update-In-Progress (UIP) flag goes from 1 to 0, the * RTC registers show the second which has precisely just started. * Let's hope other operating systems interpret the RTC the same way. */ - /* read RTC exactly on falling edge of update flag */ - for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ - if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) - break; - for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ - if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) - break; - do { /* Isn't this overkill ? UIP above should guarantee consistency */ + + /* Since the UIP flag is set for about 2.2 ms and the clock + * is typically written with a precision of 1 jiffy, trying + * to obtain a precision better than a few milliseconds is + * an illusion. Only consistency is interesting, this also + * allows to use the routine for /dev/rtc without a potential + * 1 second kernel busy loop triggered by any reader of /dev/rtc. + */ + + for ( i = 0; i<1000000; i++) { + uip = CMOS_READ(RTC_FREQ_SELECT); sec = CMOS_READ(RTC_SECONDS); min = CMOS_READ(RTC_MINUTES); hour = CMOS_READ(RTC_HOURS); day = CMOS_READ(RTC_DAY_OF_MONTH); mon = CMOS_READ(RTC_MONTH); year = CMOS_READ(RTC_YEAR); - } while (sec != CMOS_READ(RTC_SECONDS)); + uip |= CMOS_READ(RTC_FREQ_SELECT); + if ((uip & RTC_UIP)==0) break; + } + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { @@ -177,28 +184,11 @@ { unsigned char save_control; unsigned int year, mon, day, hour, min, sec; - int i; - /* Make sure the time is not stopped. */ - save_control = ppc_md.nvram_read_val(MK48T59_RTC_CONTROLB); - - ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA, - (save_control & (~MK48T59_RTC_CB_STOP))); - - /* Now make sure the read bit is off so the value will change. */ + /* Simple: freeze the clock, read it and allow updates again */ save_control = ppc_md.nvram_read_val(MK48T59_RTC_CONTROLA); save_control &= ~MK48T59_RTC_CA_READ; ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA, save_control); - - /* Read the seconds value to see when it changes. */ - sec = ppc_md.nvram_read_val(MK48T59_RTC_SECONDS); - - /* Wait until the seconds value changes, then read the value. */ - for (i = 0 ; i < 1000000 ; i++) { /* may take up to 1 second... */ - if (ppc_md.nvram_read_val(MK48T59_RTC_SECONDS) != sec) { - break; - } - } /* Set the register to read the value. */ ppc_md.nvram_write_val(MK48T59_RTC_CONTROLA, diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c --- v2.4.0-test8/linux/arch/ppc/kernel/process.c Tue Sep 5 13:50:02 2000 +++ linux/arch/ppc/kernel/process.c Sun Sep 17 09:48:07 2000 @@ -234,7 +234,6 @@ prev->thread.vrsave ) giveup_altivec(prev); #endif /* CONFIG_ALTIVEC */ - prev->last_processor = prev->processor; current_set[smp_processor_id()] = new; #endif /* CONFIG_SMP */ /* Avoid the trap. On smp this this never happens since @@ -266,7 +265,7 @@ last_task_used_altivec); #ifdef CONFIG_SMP - printk(" CPU: %d last CPU: %d", current->processor,current->last_processor); + printk(" CPU: %d", current->processor); #endif /* CONFIG_SMP */ printk("\n"); @@ -379,9 +378,6 @@ childregs->msr &= ~MSR_VEC; #endif /* CONFIG_ALTIVEC */ -#ifdef CONFIG_SMP - p->last_processor = NO_PROC_ID; -#endif /* CONFIG_SMP */ return 0; } @@ -441,8 +437,8 @@ current->thread.fpscr = 0; } -asmlinkage int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6, - struct pt_regs *regs) +int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6, + struct pt_regs *regs) { unsigned long clone_flags = p1; int res; @@ -460,8 +456,8 @@ return res; } -asmlinkage int sys_fork(int p1, int p2, int p3, int p4, int p5, int p6, - struct pt_regs *regs) +int sys_fork(int p1, int p2, int p3, int p4, int p5, int p6, + struct pt_regs *regs) { int res; @@ -478,15 +474,15 @@ return res; } -asmlinkage int sys_vfork(int p1, int p2, int p3, int p4, int p5, int p6, - struct pt_regs *regs) +int sys_vfork(int p1, int p2, int p3, int p4, int p5, int p6, + struct pt_regs *regs) { return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1], regs, 0); } -asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, - unsigned long a3, unsigned long a4, unsigned long a5, - struct pt_regs *regs) +int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, + unsigned long a3, unsigned long a4, unsigned long a5, + struct pt_regs *regs) { int error; char * filename; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c --- v2.4.0-test8/linux/arch/ppc/kernel/prom.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/prom.c Sun Sep 17 09:48:07 2000 @@ -140,8 +140,7 @@ static long g_max_loc_X = 0; static long g_max_loc_Y = 0; -unsigned long disp_BATL = 0; -unsigned long disp_BATU = 0; +unsigned long disp_BAT[2] = {0, 0}; #define cmapsz (16*256) @@ -276,8 +275,7 @@ prom_drawstring(msg); #endif return; - } - + } for (p = msg; *p != 0; p = q) { for (q = p; *q != 0 && *q != '\n'; ++q) @@ -362,7 +360,7 @@ /* copy the holding pattern code to someplace safe (0) */ /* the holding pattern is now within the first 0x100 bytes of the kernel image -- paulus */ - memcpy((void *)0, KERNELBASE + offset, 0x100); + memcpy((void *)0, (void *)(KERNELBASE + offset), 0x100); flush_icache_range(0, 0x100); /* look for cpus */ @@ -556,6 +554,54 @@ } #endif /* CONFIG_PPC64BRIDGE */ +static __init void +prom_instantiate_rtas(void) +{ + ihandle prom_rtas; + unsigned int i; + struct prom_args prom_args; + unsigned long offset = reloc_offset(); + + prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas")); + if (prom_rtas == (void *) -1) + return; + + RELOC(rtas_size) = 0; + call_prom(RELOC("getprop"), 4, 1, prom_rtas, + RELOC("rtas-size"), &RELOC(rtas_size), sizeof(rtas_size)); + prom_print(RELOC("instantiating rtas")); + if (RELOC(rtas_size) == 0) { + RELOC(rtas_data) = 0; + } else { + /* + * Ask OF for some space for RTAS. + * Actually OF has bugs so we just arbitrarily + * use memory at the 6MB point. + */ + RELOC(rtas_data) = 6 << 20; + prom_print(RELOC(" at ")); + prom_print_hex(RELOC(rtas_data)); + } + + prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas")); + prom_print(RELOC("...")); + prom_args.service = RELOC("call-method"); + prom_args.nargs = 3; + prom_args.nret = 2; + prom_args.args[0] = RELOC("instantiate-rtas"); + prom_args.args[1] = prom_rtas; + prom_args.args[2] = (void *) RELOC(rtas_data); + RELOC(prom)(&prom_args); + i = 0; + if (prom_args.args[3] == 0) + i = (unsigned int)prom_args.args[4]; + RELOC(rtas_entry) = i; + if ((RELOC(rtas_entry) == -1) || (RELOC(rtas_entry) == 0)) + prom_print(RELOC(" failed\n")); + else + prom_print(RELOC(" done\n")); +} + /* * We enter here early on, when the Open Firmware prom is still * handling exceptions and the MMU hash table for us. @@ -566,7 +612,7 @@ { int chrp = 0; unsigned long mem; - ihandle prom_rtas, prom_mmu, prom_op; + ihandle prom_mmu, prom_op; unsigned long offset = reloc_offset(); int l; char *p, *d; @@ -650,47 +696,7 @@ mem = ALIGN(mem + strlen(d) + 1); } - prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas")); - if (prom_rtas != (void *) -1) { - int i, nargs; - struct prom_args prom_args; - - RELOC(rtas_size) = 0; - call_prom(RELOC("getprop"), 4, 1, prom_rtas, - RELOC("rtas-size"), &RELOC(rtas_size), sizeof(rtas_size)); - prom_print(RELOC("instantiating rtas")); - if (RELOC(rtas_size) == 0) { - RELOC(rtas_data) = 0; - } else { - /* - * Ask OF for some space for RTAS. - * Actually OF has bugs so we just arbitrarily - * use memory at the 6MB point. - */ - RELOC(rtas_data) = 6 << 20; - prom_print(RELOC(" at ")); - prom_print_hex(RELOC(rtas_data)); - } - prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas")); - prom_print(RELOC("...")); - nargs = 3; - prom_args.service = RELOC("call-method"); - prom_args.nargs = nargs; - prom_args.nret = 2; - prom_args.args[0] = RELOC("instantiate-rtas"); - prom_args.args[1] = prom_rtas; - prom_args.args[2] = (void *) RELOC(rtas_data); - RELOC(prom)(&prom_args); - if (prom_args.args[nargs] != 0) - i = 0; - else - i = (int)prom_args.args[nargs+1]; - RELOC(rtas_entry) = i; - if ((RELOC(rtas_entry) == -1) || (RELOC(rtas_entry) == 0)) - prom_print(RELOC(" failed\n")); - else - prom_print(RELOC(" done\n")); - } + prom_instantiate_rtas(); #ifdef CONFIG_PPC64BRIDGE /* @@ -737,7 +743,7 @@ /* We assume the phys. address size is 3 cells */ if (prom_args.args[nargs] != 0) - prom_print(RELOC(" (translate failed) ")); + prom_print(RELOC(" (translate failed)\n")); else phys = (unsigned long)prom_args.args[nargs+3]; } @@ -752,8 +758,6 @@ if (prom_version >= 3) { prom_print(RELOC("Calling quiesce ...\n")); call_prom(RELOC("quiesce"), 0, 0); - offset = reloc_offset(); - phys = offset + KERNELBASE; } #ifdef CONFIG_BOOTX_TEXT @@ -769,7 +773,9 @@ } #endif - prom_print(RELOC("returning from prom_init\n")); + prom_print(RELOC("returning ")); + prom_print_hex(phys); + prom_print(RELOC(" from prom_init\n")); RELOC(prom_stdout) = 0; return phys; } @@ -836,9 +842,8 @@ } /* Calc BAT values for mapping the display and store them - * in disp_BATH and disp_BATL. Those values are then used - * from head.S to map the display during identify_machine() - * and MMU_Init() + * in disp_BAT. Those values are then used from head.S to map + * the display during identify_machine() and MMU_Init() * * For now, the display is mapped in place (1:1). This should * be changed if the display physical address overlaps @@ -862,13 +867,13 @@ if ((_get_PVR() >> 16) != 1) { /* 603, 604, G3, G4, ... */ addr &= 0xFF000000UL; - RELOC(disp_BATU) = addr | (BL_16M<<2) | 2; - RELOC(disp_BATL) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); + RELOC(disp_BAT[0]) = addr | (BL_16M<<2) | 2; + RELOC(disp_BAT[1]) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); } else { /* 601 */ addr &= 0xFF800000UL; - RELOC(disp_BATU) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4; - RELOC(disp_BATL) = addr | BL_8M | 0x40; + RELOC(disp_BAT[0]) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4; + RELOC(disp_BAT[1]) = addr | BL_8M | 0x40; } bi->logicalDisplayBase = bi->dispDeviceBase; } @@ -1003,34 +1008,52 @@ unsigned address; boot_infos_t* bi; unsigned long offset = reloc_offset(); - - prom_print(RELOC("Initializing fake screen\n")); - - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("width"), - &width, sizeof(width)); - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("height"), - &height, sizeof(height)); - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("depth"), - &depth, sizeof(depth)); + struct pci_reg_property addrs[8]; + int i, naddrs; + char name[32]; + char *getprop = RELOC("getprop"); + + prom_print(RELOC("Initializing fake screen: ")); + + memset(name, 0, sizeof(name)); + call_prom(getprop, 4, 1, dp, RELOC("name"), name, sizeof(name)); + name[sizeof(name)-1] = 0; + prom_print(name); + prom_print(RELOC("\n")); + call_prom(getprop, 4, 1, dp, RELOC("width"), &width, sizeof(width)); + call_prom(getprop, 4, 1, dp, RELOC("height"), &height, sizeof(height)); + call_prom(getprop, 4, 1, dp, RELOC("depth"), &depth, sizeof(depth)); pitch = width * ((depth + 7) / 8); - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("linebytes"), + call_prom(getprop, 4, 1, dp, RELOC("linebytes"), &pitch, sizeof(pitch)); - address = 0; - if (pitch == 1) { - address = 0xfa000000; + if (pitch == 1) pitch = 0x1000; /* for strange IBM display */ - } - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("address"), + address = 0; + call_prom(getprop, 4, 1, dp, RELOC("address"), &address, sizeof(address)); if (address == 0) { - prom_print(RELOC("Failed to get address\n")); - return; + /* look for an assigned address with a size of >= 1MB */ + naddrs = (int) call_prom(getprop, 4, 1, dp, + RELOC("assigned-addresses"), + addrs, sizeof(addrs)); + naddrs /= sizeof(struct pci_reg_property); + for (i = 0; i < naddrs; ++i) { + if (addrs[i].size_lo >= (1 << 20)) { + address = addrs[i].addr.a_lo; + /* use the BE aperture if possible */ + if (addrs[i].size_lo >= (16 << 20)) + address += (8 << 20); + break; + } + } + if (address == 0) { + prom_print(RELOC("Failed to get address\n")); + return; + } } -#if 0 /* kludge for valkyrie */ - if (strcmp(dp->name, "valkyrie") == 0) - address += 0x1000; -#endif + if (strcmp(name, RELOC("valkyrie")) == 0) + address += 0x1000; RELOC(disp_bi) = &fake_bi; bi = PTRRELOC((&fake_bi)); @@ -1334,11 +1357,19 @@ */ if (get_property(node, "interrupt-controller", &l)) { int i,j; + int cvt_irq; + + /* XXX on chrp, offset interrupt numbers for the + 8259 by 0, those for the openpic by 16 */ + cvt_irq = _machine == _MACH_chrp + && get_property(node, "interrupt-parent", NULL) == 0; np->intrs = (struct interrupt_info *) mem_start; np->n_intrs = ipsize / isize; mem_start += np->n_intrs * sizeof(struct interrupt_info); for (i = 0; i < np->n_intrs; ++i) { np->intrs[i].line = *interrupts++; + if (cvt_irq) + np->intrs[i].line = openpic_to_irq(np->intrs[i].line); np->intrs[i].sense = 0; if (isize > 1) np->intrs[i].sense = *interrupts++; @@ -2072,7 +2103,6 @@ * changes. */ -__init void map_bootx_text(void) { @@ -2083,7 +2113,10 @@ offset = ((unsigned long) disp_bi->dispDeviceBase) - base; size = disp_bi->dispDeviceRowBytes * disp_bi->dispDeviceRect[3] + offset + disp_bi->dispDeviceRect[0]; - disp_bi->logicalDisplayBase = ioremap(base, size) + offset; + disp_bi->logicalDisplayBase = ioremap(base, size); + if (disp_bi->logicalDisplayBase == 0) + return; + disp_bi->logicalDisplayBase += offset; bootx_text_mapped = 1; } @@ -2102,6 +2135,35 @@ return base; } +/* Adjust the display to a new resolution */ +void +bootx_update_display(unsigned long phys, int width, int height, + int depth, int pitch) +{ + if (disp_bi == 0) + return; + /* check it's the same frame buffer (within 16MB) */ + if ((phys ^ (unsigned long)disp_bi->dispDeviceBase) & 0xff000000) + return; + + disp_bi->dispDeviceBase = (__u8 *) phys; + disp_bi->dispDeviceRect[0] = 0; + disp_bi->dispDeviceRect[1] = 0; + disp_bi->dispDeviceRect[2] = width; + disp_bi->dispDeviceRect[3] = height; + disp_bi->dispDeviceDepth = depth; + disp_bi->dispDeviceRowBytes = pitch; + if (bootx_text_mapped) { + iounmap(disp_bi->logicalDisplayBase); + bootx_text_mapped = 0; + } + map_bootx_text(); + g_loc_X = 0; + g_loc_Y = 0; + g_max_loc_X = width / 8; + g_max_loc_Y = height / 16; +} + __pmac static void clearscreen(void) @@ -2162,6 +2224,9 @@ (bi->dispDeviceDepth >> 3)) >> 2; int i,j; +#ifdef CONFIG_ADB_PMU + pmu_suspend(); /* PMU will not shut us down ! */ +#endif for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++) { unsigned long *src_ptr = src; @@ -2178,6 +2243,9 @@ *(dst_ptr++) = 0; dst += (bi->dispDeviceRowBytes >> 2); } +#ifdef CONFIG_ADB_PMU + pmu_resume(); /* PMU will not shut us down ! */ +#endif } #endif /* ndef NO_SCROLL */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/setup.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/setup.c Sun Sep 17 09:48:07 2000 @@ -35,6 +35,8 @@ #include #include #include +#include + #ifdef CONFIG_OAK #include "oak_setup.h" #endif /* CONFIG_OAK */ @@ -655,16 +657,18 @@ } /* Checks "l2cr=xxxx" command-line option */ -void ppc_setup_l2cr(char *str, int *ints) +int ppc_setup_l2cr(char *str) { if ( ((_get_PVR() >> 16) == 8) || ((_get_PVR() >> 16) == 12) ) { unsigned long val = simple_strtoul(str, NULL, 0); printk(KERN_INFO "l2cr set to %lx\n", val); - _set_L2CR(0); - _set_L2CR(val); + _set_L2CR(0); /* force invalidate by disable cache */ + _set_L2CR(val); /* and enable it */ } + return 1; } +__setup("l2cr=", ppc_setup_l2cr); void __init ppc_init(void) { @@ -683,6 +687,9 @@ extern char *klimit; extern void do_init_bootmem(void); + /* so udelay does something sensible, assume <= 1000 bogomips */ + loops_per_sec = 500000000; + #ifdef CONFIG_ALL_PPC feature_init(); #endif @@ -737,6 +744,7 @@ if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); paging_init(); + sort_exception_table(); } void ppc_generic_ide_fix_driveid(struct hd_driveid *id) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c --- v2.4.0-test8/linux/arch/ppc/kernel/signal.c Sun Sep 3 11:50:26 2000 +++ linux/arch/ppc/kernel/signal.c Sun Sep 17 09:48:07 2000 @@ -154,7 +154,7 @@ } -asmlinkage int +int sys_sigaltstack(const stack_t *uss, stack_t *uoss) { struct pt_regs *regs = (struct pt_regs *) &uss; @@ -232,7 +232,7 @@ * Each of these things must be a multiple of 16 bytes in size. * */ -asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) +int sys_rt_sigreturn(struct pt_regs *regs) { struct rt_sigframe *rt_sf; struct sigcontext_struct sigctx; @@ -301,7 +301,6 @@ return ret; badframe: - lock_kernel(); do_exit(SIGSEGV); } @@ -351,7 +350,6 @@ printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", regs, frame, newsp); #endif - lock_kernel(); do_exit(SIGSEGV); } @@ -418,7 +416,6 @@ return ret; badframe: - lock_kernel(); do_exit(SIGSEGV); } @@ -460,7 +457,6 @@ printk("badframe in setup_frame, regs=%p frame=%p newsp=%lx\n", regs, frame, newsp); #endif - lock_kernel(); do_exit(SIGSEGV); } @@ -541,7 +537,6 @@ regs, frame, *newspp); printk("sc=%p sig=%d ka=%p info=%p oldset=%p\n", sc, sig, ka, info, oldset); #endif - lock_kernel(); do_exit(SIGSEGV); } @@ -645,7 +640,6 @@ /* FALLTHRU */ default: - lock_kernel(); sigaddset(¤t->pending.signal, signr); recalc_sigpending(current); current->flags |= PF_SIGNALED; @@ -663,6 +657,7 @@ /* Whee! Actually deliver the signal. */ handle_signal(signr, ka, &info, oldset, regs, &newsp, frame); + break; } if (regs->trap == 0x0C00 /* System Call! */ && diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c --- v2.4.0-test8/linux/arch/ppc/kernel/smp.c Tue Sep 5 13:50:02 2000 +++ linux/arch/ppc/kernel/smp.c Sun Sep 17 09:48:07 2000 @@ -62,72 +62,62 @@ int start_secondary(void *); extern int cpu_idle(void *unused); u_int openpic_read(volatile u_int *addr); +void smp_call_function_interrupt(void); +void smp_message_pass(int target, int msg, unsigned long data, int wait); +/* register for interrupting the primary processor on the powersurge */ +/* N.B. this is actually the ethernet ROM! */ +#define PSURGE_PRI_INTR 0xf3019000 /* register for interrupting the secondary processor on the powersurge */ -#define PSURGE_INTR ((volatile unsigned *)0xf80000c0) +#define PSURGE_SEC_INTR 0xf80000c0 +/* register for storing the start address for the secondary processor */ +#define PSURGE_START 0xf2800000 +/* virtual addresses for the above */ +volatile u32 *psurge_pri_intr; +volatile u32 *psurge_sec_intr; +volatile u32 *psurge_start; + +/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. */ +#define PPC_MSG_CALL_FUNCTION 0 +#define PPC_MSG_RESCHEDULE 1 +#define PPC_MSG_INVALIDATE_TLB 2 +#define PPC_MSG_XMON_BREAK 3 + +static inline void set_tb(unsigned int upper, unsigned int lower) +{ + mtspr(SPRN_TBWU, upper); + mtspr(SPRN_TBWL, lower); +} void smp_local_timer_interrupt(struct pt_regs * regs) { int cpu = smp_processor_id(); - extern void update_one_process(struct task_struct *,unsigned long, - unsigned long,unsigned long,int); - if (!--prof_counter[cpu]) { - int user=0,system=0; - struct task_struct * p = current; - - /* - * After doing the above, we need to make like - * a normal interrupt - otherwise timer interrupts - * ignore the global interrupt lock, which is the - * WrongThing (tm) to do. - */ - - if (user_mode(regs)) - user=1; - else - system=1; - - if (p->pid) { - update_one_process(p, 1, user, system, cpu); - - p->counter -= 1; - if (p->counter <= 0) { - p->counter = 0; - current->need_resched = 1; - } - if (p->nice > 0) { - kstat.cpu_nice += user; - kstat.per_cpu_nice[cpu] += user; - } else { - kstat.cpu_user += user; - kstat.per_cpu_user[cpu] += user; - } - - kstat.cpu_system += system; - kstat.per_cpu_system[cpu] += system; - } + if (!--prof_counter[cpu]) { + update_process_times(user_mode(regs)); prof_counter[cpu]=prof_multiplier[cpu]; } } -void smp_message_recv(int msg) +void smp_message_recv(int msg, struct pt_regs *regs) { ipi_count++; - switch( msg ) - { - case MSG_STOP_CPU: - __cli(); - while (1) ; + switch( msg ) { + case PPC_MSG_CALL_FUNCTION: + smp_call_function_interrupt(); break; - case MSG_RESCHEDULE: + case PPC_MSG_RESCHEDULE: current->need_resched = 1; break; - case MSG_INVALIDATE_TLB: + case PPC_MSG_INVALIDATE_TLB: _tlbia(); - case 0xf0f0: /* pmac syncing time bases - just return */ break; +#ifdef CONFIG_XMON + case PPC_MSG_XMON_BREAK: + xmon(regs); + break; +#endif /* CONFIG_XMON */ default: printk("SMP %d: smp_message_recv(): unknown msg %d\n", smp_processor_id(), msg); @@ -142,25 +132,38 @@ * smp_message[]. * * This is because don't have several IPI's on the PowerSurge even though - * we do on the chrp. It would be nice to use actual IPI's such as with openpic - * rather than this. + * we do on the chrp. It would be nice to use actual IPI's such as with + * openpic rather than this. * -- Cort */ int pmac_smp_message[NR_CPUS]; -void pmac_smp_message_recv(void) +void pmac_smp_message_recv(struct pt_regs *regs) { - int msg = pmac_smp_message[smp_processor_id()]; - + int cpu = smp_processor_id(); + int msg; + /* clear interrupt */ - out_be32(PSURGE_INTR, ~0); - - /* make sure msg is for us */ - if ( msg == -1 ) return; + if (cpu == 1) + out_be32(psurge_sec_intr, ~0); + + if (smp_num_cpus < 2) + return; + + /* make sure there is a message there */ + msg = pmac_smp_message[cpu]; + if (msg == 0) + return; - smp_message_recv(msg); - /* reset message */ - pmac_smp_message[smp_processor_id()] = -1; + pmac_smp_message[cpu] = 0; + + smp_message_recv(msg - 1, regs); +} + +void +pmac_primary_intr(int irq, void *d, struct pt_regs *regs) +{ + pmac_smp_message_recv(regs); } /* @@ -171,7 +174,7 @@ void smp_send_tlb_invalidate(int cpu) { if ( (_get_PVR()>>16) == 8 ) - smp_message_pass(MSG_ALL_BUT_SELF, MSG_INVALIDATE_TLB, 0, 0); + smp_message_pass(MSG_ALL_BUT_SELF, PPC_MSG_INVALIDATE_TLB, 0, 0); } void smp_send_reschedule(int cpu) @@ -187,18 +190,135 @@ */ /* This is only used if `cpu' is running an idle task, so it will reschedule itself anyway... */ - smp_message_pass(cpu, MSG_RESCHEDULE, 0, 0); + smp_message_pass(cpu, PPC_MSG_RESCHEDULE, 0, 0); +} + +#ifdef CONFIG_XMON +void smp_send_xmon_break(int cpu) +{ + smp_message_pass(cpu, PPC_MSG_XMON_BREAK, 0, 0); +} +#endif /* CONFIG_XMON */ + +static void stop_this_cpu(void *dummy) +{ + __cli(); + while (1) + ; } void smp_send_stop(void) { - smp_message_pass(MSG_ALL_BUT_SELF, MSG_STOP_CPU, 0, 0); + smp_call_function(stop_this_cpu, NULL, 1, 0); + smp_num_cpus = 1; +} + +/* + * Structure and data for smp_call_function(). This is designed to minimise + * static memory requirements. It also looks cleaner. + * Stolen from the i386 version. + */ +static spinlock_t call_lock = SPIN_LOCK_UNLOCKED; + +static volatile struct call_data_struct { + void (*func) (void *info); + void *info; + atomic_t started; + atomic_t finished; + int wait; +} *call_data = NULL; + +/* + * this function sends a 'generic call function' IPI to all other CPUs + * in the system. + */ + +int smp_call_function (void (*func) (void *info), void *info, int nonatomic, + int wait) +/* + * [SUMMARY] Run a function on all other CPUs. + * The function to run. This must be fast and non-blocking. + * An arbitrary pointer to pass to the function. + * currently unused. + * If true, wait (atomically) until function has completed on other CPUs. + * [RETURNS] 0 on success, else a negative status code. Does not return until + * remote CPUs are nearly ready to execute <> or are or have executed. + * + * You must not call this function with disabled interrupts or from a + * hardware interrupt handler, you may call it from a bottom half handler. + */ +{ + struct call_data_struct data; + int ret = -1, cpus = smp_num_cpus-1; + int timeout; + + if (!cpus) + return 0; + + data.func = func; + data.info = info; + atomic_set(&data.started, 0); + data.wait = wait; + if (wait) + atomic_set(&data.finished, 0); + + spin_lock_bh(&call_lock); + call_data = &data; + /* Send a message to all other CPUs and wait for them to respond */ + smp_message_pass(MSG_ALL_BUT_SELF, PPC_MSG_CALL_FUNCTION, 0, 0); + + /* Wait for response */ + timeout = 1000000; + while (atomic_read(&data.started) != cpus) { + if (--timeout == 0) { + printk("smp_call_function on cpu %d: other cpus not responding (%d)\n", + smp_processor_id(), atomic_read(&data.started)); + goto out; + } + barrier(); + udelay(1); + } + + if (wait) { + timeout = 1000000; + while (atomic_read(&data.finished) != cpus) { + if (--timeout == 0) { + printk("smp_call_function on cpu %d: other cpus not finishing (%d/%d)\n", + smp_processor_id(), atomic_read(&data.finished), atomic_read(&data.started)); + goto out; + } + barrier(); + udelay(1); + } + } + ret = 0; + + out: + spin_unlock_bh(&call_lock); + return ret; +} + +void smp_call_function_interrupt(void) +{ + void (*func) (void *info) = call_data->func; + void *info = call_data->info; + int wait = call_data->wait; + + /* + * Notify initiating CPU that I've grabbed the data and am + * about to execute the function + */ + atomic_inc(&call_data->started); + /* + * At this point the info structure may be out of scope unless wait==1 + */ + (*func)(info); + if (wait) + atomic_inc(&call_data->finished); } void smp_message_pass(int target, int msg, unsigned long data, int wait) { - int i; - if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep|_MACH_gemini)) ) return; @@ -212,31 +332,29 @@ * the recipient won't know the message was destined * for it. -- Cort */ - for ( i = 0; i <= smp_num_cpus ; i++ ) - pmac_smp_message[i] = -1; - switch( target ) - { - case MSG_ALL: - pmac_smp_message[smp_processor_id()] = msg; - /* fall through */ - case MSG_ALL_BUT_SELF: - for ( i = 0 ; i < smp_num_cpus ; i++ ) - if ( i != smp_processor_id () ) - pmac_smp_message[i] = msg; - break; - default: - pmac_smp_message[target] = msg; - break; + if (smp_processor_id() == 0) { + /* primary cpu */ + if (target == 1 || target == MSG_ALL_BUT_SELF + || target == MSG_ALL) { + pmac_smp_message[1] = msg + 1; + /* interrupt secondary processor */ + out_be32(psurge_sec_intr, ~0); + out_be32(psurge_sec_intr, 0); + } + } else { + /* secondary cpu */ + if (target == 0 || target == MSG_ALL_BUT_SELF + || target == MSG_ALL) { + pmac_smp_message[0] = msg + 1; + /* interrupt primary processor */ + in_be32(psurge_pri_intr); + } + } + if (target == smp_processor_id() || target == MSG_ALL) { + /* sending a message to ourself */ + /* XXX maybe we shouldn't do this if ints are off */ + smp_message_recv(msg, NULL); } - /* interrupt secondary processor */ - out_be32(PSURGE_INTR, ~0); - out_be32(PSURGE_INTR, 0); - /* - * Assume for now that the secondary doesn't send - * IPI's -- Cort - */ - /* interrupt primary */ - /**(volatile unsigned long *)(0xf3019000);*/ break; case _MACH_chrp: case _MACH_prep: @@ -261,7 +379,7 @@ #else /* CONFIG_POWER4 */ /* for now, only do reschedule messages since we only have one IPI */ - if (msg != MSG_RESCHEDULE) + if (msg != PPC_MSG_RESCHEDULE) break; for (i = 0; i < smp_num_cpus; ++i) { if (target == MSG_ALL || target == i @@ -319,7 +437,10 @@ { case _MACH_Pmac: /* assume powersurge board - 2 processors -- Cort */ - cpu_nr = 2; + cpu_nr = 2; + psurge_pri_intr = ioremap(PSURGE_PRI_INTR, 4); + psurge_sec_intr = ioremap(PSURGE_SEC_INTR, 4); + psurge_start = ioremap(PSURGE_START, 4); break; case _MACH_chrp: if (OpenPIC) @@ -370,13 +491,11 @@ { case _MACH_Pmac: /* setup entry point of secondary processor */ - *(volatile unsigned long *)(0xf2800000) = - (unsigned long)__secondary_start_psurge-KERNELBASE; - eieio(); + out_be32(psurge_start, __pa(__secondary_start_psurge)); /* interrupt secondary to begin executing code */ - out_be32(PSURGE_INTR, ~0); + out_be32(psurge_sec_intr, ~0); udelay(1); - out_be32(PSURGE_INTR, 0); + out_be32(psurge_sec_intr, 0); break; case _MACH_chrp: *(unsigned long *)KERNELBASE = i; @@ -399,9 +518,6 @@ if ( cpu_callin_map[i] ) { printk("Processor %d found.\n", i); - /* this sync's the decr's -- Cort */ - if ( _machine == _MACH_Pmac ) - set_dec(decrementer_count); smp_num_cpus++; } else { printk("Processor %d is stuck.\n", i); @@ -415,9 +531,25 @@ { /* reset the entry point so if we get another intr we won't * try to startup again */ - *(volatile unsigned long *)(0xf2800000) = 0x100; - /* send interrupt to other processors to start decr's on all cpus */ - smp_message_pass(1,0xf0f0, 0, 0); + out_be32(psurge_start, 0x100); + if (request_irq(30, pmac_primary_intr, 0, "primary IPI", 0)) + printk(KERN_ERR "Couldn't get primary IPI interrupt"); + /* + * The decrementers of both cpus are frozen at this point + * until we give the secondary cpu another interrupt. + * We set them both to decrementer_count and then send + * the interrupt. This should get the decrementers + * synchronized. + * -- paulus. + */ + set_dec(tb_ticks_per_jiffy); + if ((_get_PVR() >> 16) != 1) { + set_tb(0, 0); /* set timebase if not 601 */ + last_jiffy_stamp(0) = 0; + } + out_be32(psurge_sec_intr, ~0); + udelay(1); + out_be32(psurge_sec_intr, 0); } } @@ -447,8 +579,11 @@ void __init smp_callin(void) { smp_store_cpu_info(current->processor); - set_dec(decrementer_count); - + set_dec(tb_ticks_per_jiffy); + if (_machine == _MACH_Pmac && (_get_PVR() >> 16) != 1) { + set_tb(0, 0); /* set timebase if not 601 */ + last_jiffy_stamp(current->processor) = 0; + } init_idle(); cpu_callin_map[current->processor] = 1; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c --- v2.4.0-test8/linux/arch/ppc/kernel/syscalls.c Tue Jul 18 15:03:56 2000 +++ linux/arch/ppc/kernel/syscalls.c Sun Sep 17 09:48:07 2000 @@ -45,7 +45,7 @@ { } -asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) +int sys_ioperm(unsigned long from, unsigned long num, int on) { printk(KERN_ERR "sys_ioperm()\n"); return -EIO; @@ -74,7 +74,7 @@ * * This is really horribly ugly. */ -asmlinkage int +int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) { int version, ret; @@ -172,7 +172,7 @@ * sys_pipe() is the normal C calling standard for creating * a pipe. It's not the way unix traditionally does this, though. */ -asmlinkage int sys_pipe(int *fildes) +int sys_pipe(int *fildes) { int fd[2]; int error; @@ -185,19 +185,19 @@ return error; } -asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, - unsigned long prot, unsigned long flags, - unsigned long fd, off_t offset) +unsigned long sys_mmap(unsigned long addr, size_t len, + unsigned long prot, unsigned long flags, + unsigned long fd, off_t offset) { struct file * file = NULL; int ret = -EBADF; + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); if (!(flags & MAP_ANONYMOUS)) { if (!(file = fget(fd))) goto out; } - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); down(¤t->mm->mmap_sem); ret = do_mmap(file, addr, len, prot, flags, offset); up(¤t->mm->mmap_sem); @@ -207,7 +207,7 @@ return ret; } -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); /* * Due to some executables calling the wrong select we sometimes @@ -215,7 +215,7 @@ * (a single ptr to them all args passed) then calls * sys_select() with the appropriate args. -- Cort */ -asmlinkage int +int ppc_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp) { if ( (unsigned long)n >= 4096 ) @@ -232,14 +232,14 @@ return sys_select(n, inp, outp, exp, tvp); } -asmlinkage int sys_pause(void) +int sys_pause(void) { current->state = TASK_INTERRUPTIBLE; schedule(); return -ERESTARTNOHAND; } -asmlinkage int sys_uname(struct old_utsname * name) +int sys_uname(struct old_utsname * name) { int err = -EFAULT; @@ -250,7 +250,7 @@ return err; } -asmlinkage int sys_olduname(struct oldold_utsname * name) +int sys_olduname(struct oldold_utsname * name) { int error; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c --- v2.4.0-test8/linux/arch/ppc/kernel/time.c Thu Jul 13 09:42:50 2000 +++ linux/arch/ppc/kernel/time.c Sun Sep 17 09:48:07 2000 @@ -6,6 +6,27 @@ * Paul Mackerras' version and mine for PReP and Pmac. * MPC8xx/MBX changes by Dan Malek (dmalek@jlc.net). * + * First round of bugfixes by Gabriel Paubert (paubert@iram.es) + * to make clock more stable (2.4.0-test5). The only thing + * that this code assumes is that the timebases have been synchronized + * by firmware on SMP and are never stopped (never do sleep + * on SMP then, nap and doze are OK). + * + * TODO (not necessarily in this file): + * - improve precision and reproducibility of timebase frequency + * measurement at boot time. + * - get rid of xtime_lock for gettimeofday (generic kernel problem + * to be implemented on all architectures for SMP scalability and + * eventually implementing gettimeofday without entering the kernel). + * - put all time/clock related variables in a single structure + * to minimize number of cache lines touched by gettimeofday() + * - for astronomical applications: add a new function to get + * non ambiguous timestamps even around leap seconds. This needs + * a new timestamp format and a good name. + * + * + * The following comment is partially obsolete (at least the long wait + * is no more a valid reason): * Since the MPC8xx has a programmable interrupt timer, I decided to * use that rather than the decrementer. Two reasons: 1.) the clock * frequency is low, causing 2.) a long wait in the timer interrupt @@ -49,18 +70,32 @@ void smp_local_timer_interrupt(struct pt_regs *); /* keep track of when we need to update the rtc */ -time_t last_rtc_update = 0; +time_t last_rtc_update; extern rwlock_t xtime_lock; /* The decrementer counts down by 128 every 128ns on a 601. */ #define DECREMENTER_COUNT_601 (1000000000 / HZ) -#define COUNT_PERIOD_NUM_601 1 -#define COUNT_PERIOD_DEN_601 1000 -unsigned decrementer_count; /* count value for 1e6/HZ microseconds */ -unsigned count_period_num; /* 1 decrementer count equals */ -unsigned count_period_den; /* count_period_num / count_period_den us */ -unsigned long last_tb; +unsigned tb_ticks_per_jiffy; +unsigned tb_to_us; +unsigned tb_last_stamp; + +extern unsigned long wall_jiffies; + +static long time_offset; + +/* Timer interrupt helper function */ +static inline int tb_delta(unsigned *jiffy_stamp) { + int delta; + if (__USE_RTC()) { + delta = get_rtcl(); + if (delta < *jiffy_stamp) *jiffy_stamp -= 1000000000; + delta -= *jiffy_stamp; + } else { + delta = get_tbl() - *jiffy_stamp; + } + return delta; +} /* * timer_interrupt - gets called when the decrementer overflows, @@ -69,88 +104,56 @@ */ int timer_interrupt(struct pt_regs * regs) { - int dval, d; -#if 0 - unsigned long flags; -#endif + int next_dec; unsigned long cpu = smp_processor_id(); - + unsigned jiffy_stamp = last_jiffy_stamp(cpu); + hardirq_enter(cpu); -#ifdef CONFIG_SMP - { - unsigned int loops = 100000000; - while (test_bit(0, &global_irq_lock)) { - if (smp_processor_id() == global_irq_holder) { - printk("uh oh, interrupt while we hold global irq lock!\n"); -#ifdef CONFIG_XMON - xmon(0); -#endif - break; - } - if (loops-- == 0) { - printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder); -#ifdef CONFIG_XMON - xmon(0); -#endif - } - } - } -#endif /* CONFIG_SMP */ - dval = get_dec(); - /* - * Wait for the decrementer to change, then jump - * in and add decrementer_count to its value - * (quickly, before it changes again!) - */ - while ((d = get_dec()) == dval) - ; - asm volatile("mftb %0" : "=r" (last_tb) ); - /* - * Don't play catchup between the call to time_init() - * and sti() in init/main.c. - * - * This also means if we're delayed for > HZ - * we lose those ticks. If we're delayed for > HZ - * then we have something wrong anyway, though. - * - * -- Cort - */ - if ( d < (-1*decrementer_count) ) - d = 0; - set_dec(d + decrementer_count); - if ( !smp_processor_id() ) - { + do { + jiffy_stamp += tb_ticks_per_jiffy; + if (smp_processor_id()) continue; + /* We are in an interrupt, no need to save/restore flags */ + write_lock(&xtime_lock); + tb_last_stamp = jiffy_stamp; do_timer(regs); -#if 0 - /* -- BenH -- I'm removing this for now since it can cause various - * troubles with local-time RTCs. Now that we have a - * /dev/rtc that uses ppc_md.set_rtc_time() on mac, it - * should be possible to program the RTC from userland - * in all cases. - */ + /* - * update the rtc when needed + * update the rtc when needed, this should be performed on the + * right fraction of a second. Half or full second ? + * Full second works on mk48t59 clocks, others need testing. + * Note that this update is basically only used through + * the adjtimex system calls. Setting the HW clock in + * any other way is a /dev/rtc and userland business. + * This is still wrong by -0.5/+1.5 jiffies because of the + * timer interrupt resolution and possible delay, but here we + * hit a quantization limit which can only be solved by higher + * resolution timers and decoupling time management from timer + * interrupts. This is also wrong on the clocks + * which require being written at the half second boundary. + * We should have an rtc call that only sets the minutes and + * seconds like on Intel to avoid problems with non UTC clocks. */ - read_lock_irqsave(&xtime_lock, flags); - if ( (time_status & STA_UNSYNC) && - ((xtime.tv_sec > last_rtc_update + 60) || - (xtime.tv_sec < last_rtc_update)) ) - { - if (ppc_md.set_rtc_time(xtime.tv_sec) == 0) - last_rtc_update = xtime.tv_sec; + if ( (time_status & STA_UNSYNC) == 0 && + xtime.tv_sec - last_rtc_update >= 659 && + abs(xtime.tv_usec - (1000000-1000000/HZ)) < 500000/HZ && + jiffies - wall_jiffies == 1) { + if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) + last_rtc_update = xtime.tv_sec+1; else - /* do it again in 60 s */ - last_rtc_update = xtime.tv_sec; + /* Try again one minute later */ + last_rtc_update += 60; } - read_unlock_irqrestore(&xtime_lock, flags); -#endif - } + write_unlock(&xtime_lock); + } while((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) < 0); + set_dec(next_dec); + last_jiffy_stamp(cpu) = jiffy_stamp; + #ifdef CONFIG_SMP smp_local_timer_interrupt(regs); #endif - if ( ppc_md.heartbeat && !ppc_md.heartbeat_count--) + if (ppc_md.heartbeat && !ppc_md.heartbeat_count--) ppc_md.heartbeat(); hardirq_exit(cpu); @@ -162,106 +165,138 @@ */ void do_gettimeofday(struct timeval *tv) { - unsigned long flags, diff; + unsigned long flags; + unsigned delta, lost_ticks, usec, sec; - save_flags(flags); - cli(); read_lock_irqsave(&xtime_lock, flags); - *tv = xtime; + sec = xtime.tv_sec; + usec = xtime.tv_usec; + delta = tb_ticks_since(tb_last_stamp); +#ifdef CONFIG_SMP + /* As long as timebases are not in sync, gettimeofday can only + * have jiffy resolution on SMP. + */ + if (_machine != _MACH_Pmac) + delta = 0; +#endif /* CONFIG_SMP */ + lost_ticks = jiffies - wall_jiffies; read_unlock_irqrestore(&xtime_lock, flags); - /* XXX we don't seem to have the decrementers synced properly yet */ -#ifndef CONFIG_SMP - asm volatile("mftb %0" : "=r" (diff) ); - diff -= last_tb; - tv->tv_usec += diff * count_period_num / count_period_den; - tv->tv_sec += tv->tv_usec / 1000000; - tv->tv_usec = tv->tv_usec % 1000000; -#endif - - restore_flags(flags); + + usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta); + while (usec > 1000000) { + sec++; + usec -= 1000000; + } + tv->tv_sec = sec; + tv->tv_usec = usec; } void do_settimeofday(struct timeval *tv) { unsigned long flags; - int frac_tick; - - last_rtc_update = 0; /* so the rtc gets updated soon */ - - frac_tick = tv->tv_usec % (1000000 / HZ); - save_flags(flags); - cli(); + int tb_delta, new_usec, new_sec; + write_lock_irqsave(&xtime_lock, flags); - xtime.tv_sec = tv->tv_sec; - xtime.tv_usec = tv->tv_usec - frac_tick; - write_unlock_irqrestore(&xtime_lock, flags); - set_dec(frac_tick * count_period_den / count_period_num); + /* Updating the RTC is not the job of this code. If the time is + * stepped under NTP, the RTC will be update after STA_UNSYNC + * is cleared. Tool like clock/hwclock either copy the RTC + * to the system time, in which case there is no point in writing + * to the RTC again, or write to the RTC but then they don't call + * settimeofday to perform this operation. Note also that + * we don't touch the decrementer since: + * a) it would lose timer interrupt synchronization on SMP + * (if it is working one day) + * b) it could make one jiffy spuriously shorter or longer + * which would introduce another source of uncertainty potentially + * harmful to relatively short timers. + */ + + /* This works perfectly on SMP only if the tb are in sync but + * guarantees an error < 1 jiffy even if they are off by eons, + * still reasonable when gettimeofday resolution is 1 jiffy. + */ + tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id())); + tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy; + new_sec = tv->tv_sec; + new_usec = tv->tv_usec - mulhwu(tb_to_us, tb_delta); + while (new_usec <0) { + new_sec--; + new_usec += 1000000; + } + xtime.tv_usec = new_usec; + xtime.tv_sec = new_sec; + + /* In case of a large backwards jump in time with NTP, we want the + * clock to be updated as soon as the PLL is again in lock. + */ + last_rtc_update = new_sec - 658; + time_adjust = 0; /* stop active adjtime() */ time_status |= STA_UNSYNC; time_state = TIME_ERROR; /* p. 24, (a) */ time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; - restore_flags(flags); + write_unlock_irqrestore(&xtime_lock, flags); } void __init time_init(void) { + time_t sec, old_sec; + unsigned old_stamp, stamp, elapsed; + /* This function is only called on the boot processor */ unsigned long flags; + if (ppc_md.time_init != NULL) - { - ppc_md.time_init(); - } + time_offset = ppc_md.time_init(); - if ((_get_PVR() >> 16) == 1) { + if (__USE_RTC()) { /* 601 processor: dec counts down by 128 every 128ns */ - decrementer_count = DECREMENTER_COUNT_601; - count_period_num = COUNT_PERIOD_NUM_601; - count_period_den = COUNT_PERIOD_DEN_601; - } else if (!smp_processor_id()) { + tb_ticks_per_jiffy = DECREMENTER_COUNT_601; + /* mulhwu_scale_factor(1000000000, 1000000) is 0x418937 */ + tb_to_us = 0x418937; + } else { ppc_md.calibrate_decr(); } + /* Now that the decrementer is calibrated, it can be used in case the + * clock is stuck, but the fact that we have to handle the 601 + * makes things more complex. Repeatedly read the RTC until the + * next second boundary to try to achieve some precision... + */ + stamp = get_native_tbl(); + sec = ppc_md.get_rtc_time(); + elapsed = 0; + do { + old_stamp = stamp; + old_sec = sec; + stamp = get_native_tbl(); + if (__USE_RTC() && stamp < old_stamp) old_stamp -= 1000000000; + elapsed += stamp - old_stamp; + sec = ppc_md.get_rtc_time(); + } while ( sec == old_sec && elapsed < 2*HZ*tb_ticks_per_jiffy); + if (sec==old_sec) { + printk("Warning: real time clock seems stuck!\n"); + } write_lock_irqsave(&xtime_lock, flags); - xtime.tv_sec = ppc_md.get_rtc_time(); + xtime.tv_sec = sec; + last_jiffy_stamp(0) = tb_last_stamp = stamp; xtime.tv_usec = 0; + /* No update now, we just read the time from the RTC ! */ + last_rtc_update = xtime.tv_sec; write_unlock_irqrestore(&xtime_lock, flags); + /* Not exact, but the timer interrupt takes care of this */ + set_dec(tb_ticks_per_jiffy); - set_dec(decrementer_count); - /* allow setting the time right away */ - last_rtc_update = 0; -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ + /* If platform provided a timezone (pmac), we correct the time + * using do_sys_settimeofday() which in turn calls warp_clock() + */ + if (time_offset) { + struct timezone tz; + tz.tz_minuteswest = -time_offset / 60; + tz.tz_dsttime = 0; + do_sys_settimeofday(NULL, &tz); + } } #define TICK_SIZE tick @@ -354,3 +389,31 @@ */ GregorianDay(tm); } + +/* Auxiliary function to compute scaling factors */ +/* Actually the choice of a timebase running at 1/4 the of the bus + * frequency giving resolution of a few tens of nanoseconds is quite nice. + * It makes this computation very precise (27-28 bits typically) which + * is optimistic considering the stability of most processor clock + * oscillators and the precision with which the timebase frequency + * is measured but does not harm. + */ +unsigned mulhwu_scale_factor(unsigned inscale, unsigned outscale) { + unsigned mlt=0, tmp, err; + /* No concern for performance, it's done once: use a stupid + * but safe and compact method to find the multiplier. + */ + for (tmp = 1U<<31; tmp != 0; tmp >>= 1) { + if (mulhwu(inscale, mlt|tmp) < outscale) mlt|=tmp; + } + /* We might still be off by 1 for the best approximation. + * A side effect of this is that if outscale is too large + * the returned value will be zero. + * Many corner cases have been checked and seem to work, + * some might have been forgotten in the test however. + */ + err = inscale*(mlt+1); + if (err <= inscale/2) mlt++; + return mlt; +} + diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c --- v2.4.0-test8/linux/arch/ppc/kernel/traps.c Mon May 15 14:53:30 2000 +++ linux/arch/ppc/kernel/traps.c Sun Sep 17 09:48:07 2000 @@ -87,45 +87,76 @@ void MachineCheckException(struct pt_regs *regs) { - if ( !user_mode(regs) ) - { -#if defined(CONFIG_8xx) && defined(CONFIG_PCI) - /* the qspan pci read routines can cause machine checks -- Cort */ - bad_page_fault(regs, regs->dar); +#ifdef CONFIG_ALL_PPC + unsigned long fixup; +#endif /* CONFIG_ALL_PPC */ + + if (user_mode(regs)) { + _exception(SIGSEGV, regs); return; + } + +#if defined(CONFIG_8xx) && defined(CONFIG_PCI) + /* the qspan pci read routines can cause machine checks -- Cort */ + bad_page_fault(regs, regs->dar); + return; #endif #if defined(CONFIG_XMON) || defined(CONFIG_KGDB) - if (debugger_fault_handler) { - debugger_fault_handler(regs); - return; - } + if (debugger_fault_handler) { + debugger_fault_handler(regs); + return; + } #endif - printk("Machine check in kernel mode.\n"); - printk("Caused by (from SRR1=%lx): ", regs->msr); - switch (regs->msr & 0xF0000) { - case 0x80000: - printk("Machine check signal\n"); - break; - case 0x40000: - printk("Transfer error ack signal\n"); - break; - case 0x20000: - printk("Data parity error signal\n"); - break; - case 0x10000: - printk("Address parity error signal\n"); - break; - default: - printk("Unknown values in msr\n"); + +#ifdef CONFIG_ALL_PPC + /* + * I/O accesses can cause machine checks on powermacs. + * Check if the NIP corresponds to the address of a sync + * instruction for which there is an entry in the exception + * table. + */ + if (regs->msr & (0x80000 | 0x40000) + && (fixup = search_exception_table(regs->nip)) != 0) { + /* + * Check that it's a sync instruction. + * As the address is in the exception table + * we should be able to read the instr there. + */ + if (*(unsigned int *)regs->nip == 0x7c0004ac) { + unsigned int lsi = ((unsigned int *)regs->nip)[-1]; + int rb = (lsi >> 11) & 0x1f; + printk(KERN_DEBUG "%s bad port %lx at %lx\n", + (lsi & 0x100)? "OUT to": "IN from", + regs->gpr[rb] - _IO_BASE, regs->nip); + regs->nip = fixup; + return; } - show_regs(regs); + } +#endif /* CONFIG_ALL_PPC */ + printk("Machine check in kernel mode.\n"); + printk("Caused by (from SRR1=%lx): ", regs->msr); + switch (regs->msr & 0xF0000) { + case 0x80000: + printk("Machine check signal\n"); + break; + case 0x40000: + printk("Transfer error ack signal\n"); + break; + case 0x20000: + printk("Data parity error signal\n"); + break; + case 0x10000: + printk("Address parity error signal\n"); + break; + default: + printk("Unknown values in msr\n"); + } + show_regs(regs); #if defined(CONFIG_XMON) || defined(CONFIG_KGDB) - debugger(regs); + debugger(regs); #endif - print_backtrace((unsigned long *)regs->gpr[1]); - panic("machine check"); - } - _exception(SIGSEGV, regs); + print_backtrace((unsigned long *)regs->gpr[1]); + panic("machine check"); } void @@ -166,6 +197,46 @@ _exception(SIGTRAP, regs); } +/* Illegal instruction emulation support. Originally written to + * provide the PVR to user applications using the mfspr rd, PVR. + * Return non-zero if we can't emulate, or EFAULT if the associated + * memory access caused an access fault. Return zero on success. + * + * There are a couple of ways to do this, either "decode" the instruction + * or directly match lots of bits. In this case, matching lots of + * bits is faster and easier. + * + */ +#define INST_MFSPR_PVR 0x7c1f42a6 +#define INST_MFSPR_PVR_MASK 0xfc1fffff + +static int +emulate_instruction(struct pt_regs *regs) +{ + uint instword; + uint rd; + uint retval; + + retval = EFAULT; + + if (!user_mode(regs)) + return retval; + + if (get_user(instword, (uint *)(regs->nip))) + return retval; + + /* Emulate the mfspr rD, PVR. + */ + if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) { + rd = (instword >> 21) & 0x1f; + regs->gpr[rd] = _get_PVR(); + retval = 0; + } + if (retval == 0) + regs->nip += 4; + return(retval); +} + void ProgramCheckException(struct pt_regs *regs) { @@ -193,7 +264,14 @@ #endif _exception(SIGTRAP, regs); } else { - _exception(SIGILL, regs); + /* Try to emulate it if we should. */ + int errcode; + if ((errcode = emulate_instruction(regs))) { + if (errcode == EFAULT) + _exception(SIGBUS, regs); + else + _exception(SIGILL, regs); + } } #endif } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/walnut_setup.c linux/arch/ppc/kernel/walnut_setup.c --- v2.4.0-test8/linux/arch/ppc/kernel/walnut_setup.c Thu Jul 13 09:42:51 2000 +++ linux/arch/ppc/kernel/walnut_setup.c Sun Sep 17 09:48:07 2000 @@ -226,10 +226,11 @@ /* * Document me. */ -void __init +long __init walnut_time_init(void) { /* XXX - Implement me */ + return 0; } /* diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/kernel/xics.c linux/arch/ppc/kernel/xics.c --- v2.4.0-test8/linux/arch/ppc/kernel/xics.c Mon Jun 19 17:59:36 2000 +++ linux/arch/ppc/kernel/xics.c Sun Sep 17 09:48:07 2000 @@ -166,7 +166,7 @@ void xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) { qirr_info(smp_processor_id()) = 0xff; - smp_message_recv(MSG_RESCHEDULE); + smp_message_recv(MSG_RESCHEDULE, regs); } void xics_cause_IPI(int cpu) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/lib/string.S linux/arch/ppc/lib/string.S --- v2.4.0-test8/linux/arch/ppc/lib/string.S Sun Feb 13 10:47:01 2000 +++ linux/arch/ppc/lib/string.S Sun Sep 17 09:48:07 2000 @@ -12,10 +12,70 @@ #include #include -CACHELINE_BYTES = 32 -LG_CACHELINE_BYTES = 5 -CACHELINE_MASK = 0x1f -CACHELINE_WORDS = 8 +#if defined(CONFIG_4xx) || defined(CONFIG_8xx) +#define CACHE_LINE_SIZE 16 +#define LG_CACHE_LINE_SIZE 4 +#define MAX_COPY_PREFETCH 1 +#elif !defined(CONFIG_PPC64BRIDGE) +#define CACHE_LINE_SIZE 32 +#define LG_CACHE_LINE_SIZE 5 +#define MAX_COPY_PREFETCH 4 +#else +#define CACHE_LINE_SIZE 128 +#define LG_CACHE_LINE_SIZE 7 +#define MAX_COPY_PREFETCH 1 +#endif /* CONFIG_4xx || CONFIG_8xx */ + +#define COPY_16_BYTES \ + lwz r7,4(r4); \ + lwz r8,8(r4); \ + lwz r9,12(r4); \ + lwzu r10,16(r4); \ + stw r7,4(r6); \ + stw r8,8(r6); \ + stw r9,12(r6); \ + stwu r10,16(r6) + +#define COPY_16_BYTES_WITHEX(n) \ +8 ## n ## 0: \ + lwz r7,4(r4); \ +8 ## n ## 1: \ + lwz r8,8(r4); \ +8 ## n ## 2: \ + lwz r9,12(r4); \ +8 ## n ## 3: \ + lwzu r10,16(r4); \ +8 ## n ## 4: \ + stw r7,4(r6); \ +8 ## n ## 5: \ + stw r8,8(r6); \ +8 ## n ## 6: \ + stw r9,12(r6); \ +8 ## n ## 7: \ + stwu r10,16(r6) + +#define COPY_16_BYTES_EXCODE(n) \ +9 ## n ## 0: \ + addi r5,r5,-(16 * n); \ + b 104f; \ +9 ## n ## 1: \ + addi r5,r5,-(16 * n); \ + b 105f; \ +.section __ex_table,"a"; \ + .align 2; \ + .long 8 ## n ## 0b,9 ## n ## 0b; \ + .long 8 ## n ## 1b,9 ## n ## 0b; \ + .long 8 ## n ## 2b,9 ## n ## 0b; \ + .long 8 ## n ## 3b,9 ## n ## 0b; \ + .long 8 ## n ## 4b,9 ## n ## 1b; \ + .long 8 ## n ## 5b,9 ## n ## 1b; \ + .long 8 ## n ## 6b,9 ## n ## 1b; \ + .long 8 ## n ## 7b,9 ## n ## 1b; \ +.text + +CACHELINE_BYTES = CACHE_LINE_SIZE +LG_CACHELINE_BYTES = LG_CACHE_LINE_SIZE +CACHELINE_MASK = (CACHE_LINE_SIZE-1) .globl strcpy strcpy: @@ -105,7 +165,14 @@ bdnz 4b 3: mtctr r9 li r7,4 +#if !defined(CONFIG_8xx) 10: dcbz r7,r6 +#else +10: stw r4, 4(r6) + stw r4, 8(r6) + stw r4, 12(r6) + stw r4, 16(r6) +#endif addi r6,r6,CACHELINE_BYTES bdnz 10b clrlwi r5,r8,32-LG_CACHELINE_BYTES @@ -202,23 +269,24 @@ li r11,4 mtctr r0 beq 63f -53: dcbz r11,r6 - lwz r7,4(r4) - lwz r8,8(r4) - lwz r9,12(r4) - lwzu r10,16(r4) - stw r7,4(r6) - stw r8,8(r6) - stw r9,12(r6) - stwu r10,16(r6) - lwz r7,4(r4) - lwz r8,8(r4) - lwz r9,12(r4) - lwzu r10,16(r4) - stw r7,4(r6) - stw r8,8(r6) - stw r9,12(r6) - stwu r10,16(r6) +53: +#if !defined(CONFIG_8xx) + dcbz r11,r6 +#endif + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 32 + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 64 + COPY_16_BYTES + COPY_16_BYTES +#if CACHE_LINE_SIZE >= 128 + COPY_16_BYTES + COPY_16_BYTES + COPY_16_BYTES + COPY_16_BYTES +#endif +#endif +#endif bdnz 53b 63: srwi. r0,r5,2 @@ -380,25 +448,59 @@ 58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */ clrlwi r5,r5,32-LG_CACHELINE_BYTES li r11,4 - mtctr r0 beq 63f -53: dcbz r11,r6 -10: lwz r7,4(r4) -11: lwz r8,8(r4) -12: lwz r9,12(r4) -13: lwzu r10,16(r4) -14: stw r7,4(r6) -15: stw r8,8(r6) -16: stw r9,12(r6) -17: stwu r10,16(r6) -20: lwz r7,4(r4) -21: lwz r8,8(r4) -22: lwz r9,12(r4) -23: lwzu r10,16(r4) -24: stw r7,4(r6) -25: stw r8,8(r6) -26: stw r9,12(r6) -27: stwu r10,16(r6) + +#if !defined(CONFIG_8xx) + /* Here we decide how far ahead to prefetch the source */ +#if MAX_COPY_PREFETCH > 1 + /* Heuristically, for large transfers we prefetch + MAX_COPY_PREFETCH cachelines ahead. For small transfers + we prefetch 1 cacheline ahead. */ + cmpwi r0,MAX_COPY_PREFETCH + li r7,1 + li r3,4 + ble 111f + li r7,MAX_COPY_PREFETCH +111: mtctr r7 +112: dcbt r3,r4 + addi r3,r3,CACHELINE_BYTES + bdnz 112b +#else /* MAX_COPY_PREFETCH == 1 */ + li r3,CACHELINE_BYTES + 4 + dcbt r11,r4 +#endif /* MAX_COPY_PREFETCH */ +#endif /* CONFIG_8xx */ + + mtctr r0 +53: +#if !defined(CONFIG_8xx) + dcbt r3,r4 + dcbz r11,r6 +#endif +/* had to move these to keep extable in order */ + .section __ex_table,"a" + .align 2 + .long 70b,100f + .long 71b,101f + .long 72b,102f + .long 73b,103f + .long 53b,105f + .text +/* the main body of the cacheline loop */ + COPY_16_BYTES_WITHEX(0) +#if CACHE_LINE_SIZE >= 32 + COPY_16_BYTES_WITHEX(1) +#if CACHE_LINE_SIZE >= 64 + COPY_16_BYTES_WITHEX(2) + COPY_16_BYTES_WITHEX(3) +#if CACHE_LINE_SIZE >= 128 + COPY_16_BYTES_WITHEX(4) + COPY_16_BYTES_WITHEX(5) + COPY_16_BYTES_WITHEX(6) + COPY_16_BYTES_WITHEX(7) +#endif +#endif +#endif bdnz 53b 63: srwi. r0,r5,2 @@ -434,15 +536,31 @@ 103: li r4,1 91: li r3,2 b 99f -/* read fault in 2nd half of cacheline loop */ -106: addi r5,r5,-16 -/* read fault in 1st half of cacheline loop */ + +/* + * this stuff handles faults in the cacheline loop and branches to either + * 104f (if in read part) or 105f (if in write part), after updating r5 + */ + COPY_16_BYTES_EXCODE(0) +#if CACHE_LINE_SIZE >= 32 + COPY_16_BYTES_EXCODE(1) +#if CACHE_LINE_SIZE >= 64 + COPY_16_BYTES_EXCODE(2) + COPY_16_BYTES_EXCODE(3) +#if CACHE_LINE_SIZE >= 128 + COPY_16_BYTES_EXCODE(4) + COPY_16_BYTES_EXCODE(5) + COPY_16_BYTES_EXCODE(6) + COPY_16_BYTES_EXCODE(7) +#endif +#endif +#endif + +/* read fault in cacheline loop */ 104: li r4,0 b 92f -/* write fault in 2nd half of cacheline loop */ -107: addi r5,r5,-16 /* fault on dcbz (effectively a write fault) */ -/* or write fault in 1st half of cacheline loop */ +/* or write fault in cacheline loop */ 105: li r4,1 92: li r3,LG_CACHELINE_BYTES b 99f @@ -485,36 +603,15 @@ bdnz 114b 120: blr -.section __ex_table,"a" + .section __ex_table,"a" .align 2 - .long 70b,100b - .long 71b,101b - .long 72b,102b - .long 73b,103b - .long 53b,105b - .long 10b,104b - .long 11b,104b - .long 12b,104b - .long 13b,104b - .long 14b,105b - .long 15b,105b - .long 16b,105b - .long 17b,105b - .long 20b,106b - .long 21b,106b - .long 22b,106b - .long 23b,106b - .long 24b,107b - .long 25b,107b - .long 26b,107b - .long 27b,107b .long 30b,108b .long 31b,109b .long 40b,110b .long 41b,111b .long 112b,120b .long 114b,120b -.text + .text .globl __clear_user __clear_user: @@ -546,12 +643,13 @@ blr 99: li r3,-EFAULT blr -.section __ex_table,"a" + + .section __ex_table,"a" .align 2 .long 11b,99b .long 1b,99b .long 8b,99b -.text + .text .globl __strncpy_from_user __strncpy_from_user: @@ -570,10 +668,11 @@ blr 99: li r3,-EFAULT blr -.section __ex_table,"a" + + .section __ex_table,"a" .align 2 .long 1b,99b -.text + .text /* r3 = str, r4 = len (> 0), r5 = top (highest addr) */ .globl __strnlen_user @@ -596,6 +695,7 @@ blr 99: li r3,0 /* bad address, return 0 */ blr -.section __ex_table,"a" + + .section __ex_table,"a" .align 2 .long 1b,99b diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/mbxboot/misc.c linux/arch/ppc/mbxboot/misc.c --- v2.4.0-test8/linux/arch/ppc/mbxboot/misc.c Thu Jul 13 09:42:51 2000 +++ linux/arch/ppc/mbxboot/misc.c Sun Sep 17 09:48:07 2000 @@ -269,6 +269,11 @@ */ #ifdef CONFIG_MBX cmd_line = (char *)(load_addr - 0x10000); + + /* To be like everyone else, we need one too, although this + * board information is passed from the boot rom. + */ + bp->bi_baudrate = 9600; #else cmd_line = (char *)(0x200000); #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/mm/extable.c linux/arch/ppc/mm/extable.c --- v2.4.0-test8/linux/arch/ppc/mm/extable.c Wed Nov 10 22:18:39 1999 +++ linux/arch/ppc/mm/extable.c Sun Sep 17 09:48:07 2000 @@ -7,8 +7,43 @@ #include #include -extern const struct exception_table_entry __start___ex_table[]; -extern const struct exception_table_entry __stop___ex_table[]; +extern struct exception_table_entry __start___ex_table[]; +extern struct exception_table_entry __stop___ex_table[]; + +/* + * The exception table needs to be sorted because we use the macros + * which put things into the exception table in a variety of segments + * such as the prep, pmac, chrp, etc. segments as well as the init + * segment and the main kernel text segment. + */ +static inline void +sort_ex_table(struct exception_table_entry *start, + struct exception_table_entry *finish) +{ + struct exception_table_entry el, *p, *q; + + /* insertion sort */ + for (p = start + 1; p < finish; ++p) { + /* start .. p-1 is sorted */ + if (p[0].insn < p[-1].insn) { + /* move element p down to its right place */ + el = *p; + q = p; + do { + /* el comes before q[-1], move q[-1] up one */ + q[0] = q[-1]; + --q; + } while (q > start && el.insn < q[-1].insn); + *q = el; + } + } +} + +void +sort_exception_table(void) +{ + sort_ex_table(__start___ex_table, __stop___ex_table); +} static inline unsigned long search_one_table(const struct exception_table_entry *first, @@ -36,25 +71,21 @@ { unsigned long ret; -#if 1 /*ndef CONFIG_MODULES*/ +#ifndef CONFIG_MODULES /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); if (ret) return ret; #else /* The kernel is the last "module" -- no need to treat it special. */ struct module *mp; - read_lock(&modlist_lock); for (mp = module_list; mp != NULL; mp = mp->next) { if (mp->ex_table_start == NULL) continue; ret = search_one_table(mp->ex_table_start, mp->ex_table_end - 1, addr); - if (ret) { - read_unlock(&modlist_lock); + if (ret) return ret; - } } - read_unlock(&modlist_lock); #endif return 0; diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c --- v2.4.0-test8/linux/arch/ppc/mm/fault.c Mon Jun 19 17:59:37 2000 +++ linux/arch/ppc/mm/fault.c Sun Sep 17 09:48:07 2000 @@ -67,7 +67,7 @@ #if defined(CONFIG_4xx) int is_write = error_code & ESR_DST; #else - int is_write = error_code & 0x02000000; + int is_write = 0; /* * Fortunately the bit assignments in SRR1 for an instruction @@ -77,6 +77,8 @@ */ if (regs->trap == 0x400) error_code &= 0x48200000; + else + is_write = error_code & 0x02000000; #endif /* CONFIG_4xx */ #if defined(CONFIG_XMON) || defined(CONFIG_KGDB) diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c --- v2.4.0-test8/linux/arch/ppc/mm/init.c Mon Aug 7 21:02:27 2000 +++ linux/arch/ppc/mm/init.c Sun Sep 17 09:48:07 2000 @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef CONFIG_BLK_DEV_INITRD #include /* for initrd_* */ #endif @@ -69,15 +70,20 @@ #include "4xx_tlb.h" #endif +#define MAX_LOW_MEM (640 << 20) + #define PGTOKB(pages) (((pages) * PAGE_SIZE) >> 10) int prom_trashed; atomic_t next_mmu_context; unsigned long *end_of_DRAM; +unsigned long total_memory; +unsigned long total_lowmem; int mem_init_done; int init_bootmem_done; int boot_mapsize; unsigned long totalram_pages = 0; +unsigned long totalhigh_pages = 0; extern pgd_t swapper_pg_dir[]; extern char _start[], _end[]; extern char etext[], _stext[]; @@ -98,22 +104,26 @@ #ifndef CONFIG_SMP struct pgtable_cache_struct quicklists; #endif +#ifdef CONFIG_HIGHMEM +pte_t *kmap_pte; +pgprot_t kmap_prot; +#endif void MMU_init(void); static void *MMU_get_page(void); -unsigned long *prep_find_end_of_memory(void); -unsigned long *pmac_find_end_of_memory(void); -unsigned long *apus_find_end_of_memory(void); -unsigned long *gemini_find_end_of_memory(void); -extern unsigned long *find_end_of_memory(void); +unsigned long prep_find_end_of_memory(void); +unsigned long pmac_find_end_of_memory(void); +unsigned long apus_find_end_of_memory(void); +unsigned long gemini_find_end_of_memory(void); +extern unsigned long find_end_of_memory(void); #ifdef CONFIG_8xx -unsigned long *m8xx_find_end_of_memory(void); +unsigned long m8xx_find_end_of_memory(void); #endif /* CONFIG_8xx */ #ifdef CONFIG_4xx -unsigned long *oak_find_end_of_memory(void); +unsigned long oak_find_end_of_memory(void); #endif #ifdef CONFIG_8260 -unsigned long *m8260_find_end_of_memory(void); +unsigned long m8260_find_end_of_memory(void); #endif /* CONFIG_8260 */ static void mapin_ram(void); void map_page(unsigned long va, unsigned long pa, int flags); @@ -269,6 +279,7 @@ int i,free = 0,total = 0,reserved = 0; int shared = 0, cached = 0; struct task_struct *p; + int highmem = 0; printk("Mem-info:\n"); show_free_areas(); @@ -276,6 +287,8 @@ i = max_mapnr; while (i-- > 0) { total++; + if (PageHighMem(mem_map+i)) + highmem++; if (PageReserved(mem_map+i)) reserved++; else if (PageSwapCache(mem_map+i)) @@ -286,6 +299,7 @@ shared += atomic_read(&mem_map[i].count) - 1; } printk("%d pages of RAM\n",total); + printk("%d pages of HIGHMEM\n", highmem); printk("%d free pages\n",free); printk("%d reserved pages\n",reserved); printk("%d pages shared\n",shared); @@ -354,6 +368,8 @@ continue; val->sharedram += atomic_read(&mem_map[i].count) - 1; } + val->totalhigh = totalhigh_pages; + val->freehigh = nr_free_highpages(); val->mem_unit = PAGE_SIZE; } @@ -443,7 +459,8 @@ void iounmap(void *addr) { - /* XXX todo */ + if (addr > high_memory && (unsigned long) addr < ioremap_bot) + vfree((void *) (PAGE_MASK & (unsigned long) addr)); } unsigned long iopa(unsigned long addr) @@ -476,7 +493,7 @@ { pmd_t *pd, oldpd; pte_t *pg; - + /* Use upper 10 bits of VA to index the first level map */ pd = pmd_offset(pgd_offset_k(va), va); oldpd = *pd; @@ -516,6 +533,7 @@ flush_hash_segments(0xd, 0xffffff); #else __clear_user(Hash, Hash_size); + _tlbia(); #ifdef CONFIG_SMP smp_send_tlb_invalidate(0); #endif /* CONFIG_SMP */ @@ -610,6 +628,13 @@ } #endif /* CONFIG_8xx */ +void flush_page_to_ram(struct page *page) +{ + unsigned long vaddr = kmap(page); + __flush_page_to_ram(vaddr); + kunmap(page); +} + #if !defined(CONFIG_4xx) && !defined(CONFIG_8xx) static void get_mem_prop(char *, struct mem_pieces *); @@ -722,7 +747,7 @@ if (align && align < max_size) max_size = align; - tot = (unsigned long)end_of_DRAM - KERNELBASE; + tot = total_lowmem; for (bl = 128<<10; bl < max_size; bl <<= 1) { if (bl * 2 > tot) break; @@ -745,6 +770,8 @@ for (i = 0; i < phys_mem.n_regions; ++i) { v = (ulong)__va(phys_mem.regions[i].address); p = phys_mem.regions[i].address; + if (p >= total_lowmem) + break; for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) { /* On the MPC8xx, we want the page shared so we * don't get ASID compares on kernel space. @@ -766,6 +793,8 @@ map_page(v, p, f); v += PAGE_SIZE; p += PAGE_SIZE; + if (p >= total_lowmem) + break; } } } @@ -788,77 +817,42 @@ return p; } -void __init free_initmem(void) +static void free_sec(unsigned long start, unsigned long end, const char *name) { - unsigned long a; - unsigned long num_freed_pages = 0, num_prep_pages = 0, - num_pmac_pages = 0, num_openfirmware_pages = 0, - num_apus_pages = 0, num_chrp_pages = 0; -#define FREESEC(START,END,CNT) do { \ - a = (unsigned long)(&START); \ - for (; a < (unsigned long)(&END); a += PAGE_SIZE) { \ - clear_bit(PG_reserved, &virt_to_page(a)->flags); \ - set_page_count(virt_to_page(a), 1); \ - free_page(a); \ - CNT++; \ - } \ -} while (0) - - FREESEC(__init_begin,__init_end,num_freed_pages); - switch (_machine) - { - case _MACH_Pmac: - FREESEC(__apus_begin,__apus_end,num_apus_pages); - FREESEC(__prep_begin,__prep_end,num_prep_pages); - FREESEC(__chrp_begin,__chrp_end,num_chrp_pages); - break; - case _MACH_chrp: - FREESEC(__apus_begin,__apus_end,num_apus_pages); - FREESEC(__pmac_begin,__pmac_end,num_pmac_pages); - FREESEC(__prep_begin,__prep_end,num_prep_pages); - break; - case _MACH_prep: - FREESEC(__apus_begin,__apus_end,num_apus_pages); - FREESEC(__pmac_begin,__pmac_end,num_pmac_pages); - FREESEC(__chrp_begin,__chrp_end,num_chrp_pages); - break; - case _MACH_mbx: - FREESEC(__apus_begin,__apus_end,num_apus_pages); - FREESEC(__pmac_begin,__pmac_end,num_pmac_pages); - FREESEC(__prep_begin,__prep_end,num_prep_pages); - FREESEC(__chrp_begin,__chrp_end,num_chrp_pages); - break; - case _MACH_apus: - FREESEC(__pmac_begin,__pmac_end,num_pmac_pages); - FREESEC(__prep_begin,__prep_end,num_prep_pages); - FREESEC(__chrp_begin,__chrp_end,num_chrp_pages); - break; - case _MACH_gemini: - FREESEC(__apus_begin,__apus_end,num_apus_pages); - FREESEC(__pmac_begin,__pmac_end,num_pmac_pages); - FREESEC(__prep_begin,__prep_end,num_prep_pages); - FREESEC(__chrp_begin,__chrp_end,num_chrp_pages); - break; - } + unsigned long cnt = 0; - if ( !have_of ) - FREESEC( __openfirmware_begin, __openfirmware_end, - num_openfirmware_pages ); - - printk ("Freeing unused kernel memory: %ldk init", - PGTOKB(num_freed_pages)); + while (start < end) { + clear_bit(PG_reserved, &virt_to_page(start)->flags); + set_page_count(virt_to_page(start), 1); + free_page(start); + cnt++; + start += PAGE_SIZE; + } + if (cnt) + printk(" %ldk %s", PGTOKB(cnt), name); +} - if ( num_prep_pages ) - printk(" %ldk prep", PGTOKB(num_prep_pages)); - if ( num_chrp_pages ) - printk(" %ldk chrp", PGTOKB(num_chrp_pages)); - if ( num_pmac_pages ) - printk(" %ldk pmac", PGTOKB(num_pmac_pages)); - if ( num_openfirmware_pages ) - printk(" %ldk open firmware", PGTOKB(num_openfirmware_pages)); - if ( num_apus_pages ) - printk(" %ldk apus", PGTOKB(num_apus_pages)); - printk("\n"); +void free_initmem(void) +{ +#define FREESEC(TYPE) \ + free_sec((unsigned long)(&__ ## TYPE ## _begin), \ + (unsigned long)(&__ ## TYPE ## _end), \ + #TYPE); + + printk ("Freeing unused kernel memory:"); + FREESEC(init); + if (_machine != _MACH_Pmac) + FREESEC(pmac); + if (_machine != _MACH_chrp) + FREESEC(chrp); + if (_machine != _MACH_prep) + FREESEC(prep); + if (_machine != _MACH_apus) + FREESEC(apus); + if (!have_of) + FREESEC(openfirmware); + printk("\n"); +#undef FREESEC } #ifdef CONFIG_BLK_DEV_INITRD @@ -909,7 +903,8 @@ * at KERNELBASE. */ - end_of_DRAM = oak_find_end_of_memory(); + total_memory = total_lowmem = oak_find_end_of_memory(); + end_of_DRAM = __va(total_memory); mapin_ram(); /* @@ -939,23 +934,33 @@ if ( ppc_md.progress ) ppc_md.progress("MMU:enter", 0x111); #ifndef CONFIG_8xx if (have_of) - end_of_DRAM = pmac_find_end_of_memory(); + total_memory = pmac_find_end_of_memory(); #ifdef CONFIG_APUS else if (_machine == _MACH_apus ) - end_of_DRAM = apus_find_end_of_memory(); + total_memory = apus_find_end_of_memory(); #endif #ifdef CONFIG_GEMINI else if ( _machine == _MACH_gemini ) - end_of_DRAM = gemini_find_end_of_memory(); + total_memory = gemini_find_end_of_memory(); #endif /* CONFIG_GEMINI */ #if defined(CONFIG_8260) else - end_of_DRAM = m8260_find_end_of_memory(); + total_memory = m8260_find_end_of_memory(); #else else /* prep */ - end_of_DRAM = prep_find_end_of_memory(); + total_memory = prep_find_end_of_memory(); #endif + total_lowmem = total_memory; +#ifdef CONFIG_HIGHMEM + if (total_lowmem > MAX_LOW_MEM) { + total_lowmem = MAX_LOW_MEM; + mem_pieces_remove(&phys_avail, total_lowmem, + total_memory - total_lowmem, 0); + } +#endif /* CONFIG_HIGHMEM */ + end_of_DRAM = __va(total_lowmem); + if ( ppc_md.progress ) ppc_md.progress("MMU:hash init", 0x300); hash_init(); #ifndef CONFIG_PPC64BRIDGE @@ -995,7 +1000,7 @@ #endif break; case _MACH_Pmac: - ioremap_base = 0xf8000000; + ioremap_base = 0xfe000000; break; case _MACH_apus: /* Map PPC exception vectors. */ @@ -1022,7 +1027,15 @@ #endif /* CONFIG_POWER4 */ #else /* CONFIG_8xx */ - end_of_DRAM = m8xx_find_end_of_memory(); + total_memory = total_lowmem = m8xx_find_end_of_memory(); +#ifdef CONFIG_HIGHMEM + if (total_lowmem > MAX_LOW_MEM) { + total_lowmem = MAX_LOW_MEM; + mem_pieces_remove(&phys_avail, total_lowmem, + total_memory - total_lowmem, 0); + } +#endif /* CONFIG_HIGHMEM */ + end_of_DRAM = __va(total_lowmem); /* Map in all of RAM starting at KERNELBASE */ mapin_ram(); @@ -1055,7 +1068,7 @@ if ( ppc_md.progress ) ppc_md.progress("MMU:exit", 0x211); #ifdef CONFIG_BOOTX_TEXT /* Must be done last, or ppc_md.progress will die */ - if (_machine == _MACH_Pmac) + if (_machine == _MACH_Pmac || _machine == _MACH_chrp) map_bootx_text(); #endif } @@ -1092,7 +1105,7 @@ start = PAGE_ALIGN(start); boot_mapsize = init_bootmem(start >> PAGE_SHIFT, - __pa(end_of_DRAM) >> PAGE_SHIFT); + total_lowmem >> PAGE_SHIFT); /* remove the bootmem bitmap from the available memory */ mem_pieces_remove(&phys_avail, start, boot_mapsize, 1); @@ -1105,47 +1118,6 @@ init_bootmem_done = 1; } -#if 0 -/* - * Find some memory for setup_arch to return. - * We use the largest chunk of available memory as the area - * that setup_arch returns, making sure that there are at - * least 32 pages unused before this for MMU_get_page to use. - */ -unsigned long __init find_available_memory(void) -{ - int i, rn; - unsigned long a, free; - unsigned long start, end; - - if (_machine == _MACH_mbx) { - /* Return the first, not the last region, because we - * may not yet have properly initialized the additonal - * memory DIMM. - */ - a = PAGE_ALIGN(phys_avail.regions[0].address); - avail_start = (unsigned long) __va(a); - return avail_start; - } - - rn = 0; - for (i = 1; i < phys_avail.n_regions; ++i) - if (phys_avail.regions[i].size > phys_avail.regions[rn].size) - rn = i; - free = 0; - for (i = 0; i < rn; ++i) { - start = phys_avail.regions[i].address; - end = start + phys_avail.regions[i].size; - free += (end & PAGE_MASK) - PAGE_ALIGN(start); - } - a = PAGE_ALIGN(phys_avail.regions[rn].address); - if (free < 32 * PAGE_SIZE) - a += 32 * PAGE_SIZE - free; - avail_start = (unsigned long) __va(a); - return avail_start; -} -#endif /* 0 */ - /* * paging_init() sets up the page tables - in fact we've already done this. */ @@ -1153,6 +1125,14 @@ { unsigned long zones_size[MAX_NR_ZONES], i; +#ifdef CONFIG_HIGHMEM + map_page(PKMAP_BASE, 0, 0); /* XXX gross */ + pkmap_page_table = pte_offset(pmd_offset(pgd_offset_k(PKMAP_BASE), PKMAP_BASE), PKMAP_BASE); + map_page(KMAP_FIX_BEGIN, 0, 0); /* XXX gross */ + kmap_pte = pte_offset(pmd_offset(pgd_offset_k(KMAP_FIX_BEGIN), KMAP_FIX_BEGIN), KMAP_FIX_BEGIN); + kmap_prot = PAGE_KERNEL; +#endif /* CONFIG_HIGHMEM */ + /* * Grab some memory for bad_page and bad_pagetable to use. */ @@ -1162,9 +1142,14 @@ /* * All pages are DMA-able so we put them all in the DMA zone. */ - zones_size[0] = ((unsigned long)end_of_DRAM - KERNELBASE) >> PAGE_SHIFT; + zones_size[ZONE_DMA] = total_lowmem >> PAGE_SHIFT; for (i = 1; i < MAX_NR_ZONES; i++) zones_size[i] = 0; + +#ifdef CONFIG_HIGHMEM + zones_size[ZONE_HIGHMEM] = (total_memory - total_lowmem) >> PAGE_SHIFT; +#endif /* CONFIG_HIGHMEM */ + free_area_init(zones_size); } @@ -1176,7 +1161,17 @@ int codepages = 0; int datapages = 0; int initpages = 0; +#ifdef CONFIG_HIGHMEM + unsigned long highmem_mapnr; + + highmem_mapnr = total_lowmem >> PAGE_SHIFT; + highmem_start_page = mem_map + highmem_mapnr; + max_mapnr = total_memory >> PAGE_SHIFT; + totalram_pages += max_mapnr - highmem_mapnr; +#else max_mapnr = max_low_pfn; +#endif /* CONFIG_HIGHMEM */ + high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); num_physpages = max_mapnr; /* RAM is assumed contiguous */ @@ -1217,11 +1212,28 @@ datapages++; } - printk("Memory: %luk available (%dk kernel code, %dk data, %dk init) [%08x,%08lx]\n", +#ifdef CONFIG_HIGHMEM + { + unsigned long pfn; + + for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { + struct page *page = mem_map + pfn; + + ClearPageReserved(page); + set_bit(PG_highmem, &page->flags); + atomic_set(&page->count, 1); + __free_page(page); + totalhigh_pages++; + } + totalram_pages += totalhigh_pages; + } +#endif /* CONFIG_HIGHMEM */ + + printk("Memory: %luk available (%dk kernel code, %dk data, %dk init, %ldk highmem)\n", (unsigned long)nr_free_pages()<< (PAGE_SHIFT-10), codepages<< (PAGE_SHIFT-10), datapages<< (PAGE_SHIFT-10), initpages<< (PAGE_SHIFT-10), - PAGE_OFFSET, (unsigned long) end_of_DRAM); + (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); mem_init_done = 1; } @@ -1234,7 +1246,7 @@ * Our text, data, bss use something over 1MB, starting at 0. * Open Firmware may be using 1MB at the 4MB point. */ -unsigned long __init *pmac_find_end_of_memory(void) +unsigned long __init pmac_find_end_of_memory(void) { unsigned long a, total; unsigned long ram_limit = 0xe0000000 - KERNELBASE; @@ -1279,7 +1291,7 @@ set_phys_avail(&phys_mem); - return __va(total); + return total; } #endif /* CONFIG_ALL_PPC */ @@ -1290,7 +1302,7 @@ * this will likely stay separate from the pmac. * -- Cort */ -unsigned long __init *prep_find_end_of_memory(void) +unsigned long __init prep_find_end_of_memory(void) { unsigned long total; total = res->TotalMemory; @@ -1308,15 +1320,15 @@ mem_pieces_append(&phys_mem, 0, total); set_phys_avail(&phys_mem); - return (__va(total)); + return (total); } #endif /* defined(CONFIG_ALL_PPC) */ #if defined(CONFIG_GEMINI) -unsigned long __init *gemini_find_end_of_memory(void) +unsigned long __init gemini_find_end_of_memory(void) { - unsigned long total, *ret; + unsigned long total; unsigned char reg; reg = readb(GEMINI_MEMCFG); @@ -1327,9 +1339,8 @@ phys_mem.regions[0].size = total; phys_mem.n_regions = 1; - ret = __va(phys_mem.regions[0].size); set_phys_avail(&phys_mem); - return ret; + return phys_mem.regions[0].size; } #endif /* defined(CONFIG_GEMINI) */ @@ -1337,10 +1348,9 @@ /* * Same hack as 8xx. */ -unsigned long __init *m8260_find_end_of_memory(void) +unsigned long __init m8260_find_end_of_memory(void) { bd_t *binfo; - unsigned long *ret; extern unsigned char __res[]; binfo = (bd_t *)__res; @@ -1349,15 +1359,14 @@ phys_mem.regions[0].size = binfo->bi_memsize; phys_mem.n_regions = 1; - ret = __va(phys_mem.regions[0].size); set_phys_avail(&phys_mem); - return ret; + return phys_mem.regions[0].size; } #endif /* CONFIG_8260 */ #ifdef CONFIG_APUS #define HARDWARE_MAPPED_SIZE (512*1024) -unsigned long __init *apus_find_end_of_memory(void) +unsigned long __init apus_find_end_of_memory(void) { int shadow = 0; @@ -1421,7 +1430,7 @@ the PowerUP board. Other system memory is horrible slow in comparison. The user can use other memory for swapping using the z2ram device. */ - return __va(memory[0].addr + memory[0].size); + return memory[0].addr + memory[0].size; } #endif /* CONFIG_APUS */ @@ -1484,7 +1493,7 @@ /* Find some memory for the hash table. */ if ( Hash_size ) { Hash = mem_pieces_find(Hash_size, Hash_size); - /*__clear_user(Hash, Hash_size);*/ + cacheable_memzero(Hash, Hash_size); } else Hash = 0; #endif /* CONFIG_PPC64BRIDGE */ @@ -1544,10 +1553,9 @@ * functions in the image just to get prom_init, all we really need right * now is the initialization of the physical memory region. */ -unsigned long __init *m8xx_find_end_of_memory(void) +unsigned long __init m8xx_find_end_of_memory(void) { bd_t *binfo; - unsigned long *ret; extern unsigned char __res[]; binfo = (bd_t *)__res; @@ -1555,12 +1563,9 @@ phys_mem.regions[0].address = 0; phys_mem.regions[0].size = binfo->bi_memsize; phys_mem.n_regions = 1; - - ret = __va(phys_mem.regions[0].address+ - phys_mem.regions[0].size); set_phys_avail(&phys_mem); - return ret; + return phys_mem.regions[0].address + phys_mem.regions[0].size; } #endif /* !CONFIG_4xx && !CONFIG_8xx */ @@ -1569,7 +1574,7 @@ * Return the virtual address representing the top of physical RAM * on the Oak board. */ -unsigned long __init * +unsigned long __init oak_find_end_of_memory(void) { extern unsigned char __res[]; @@ -1580,12 +1585,9 @@ phys_mem.regions[0].address = 0; phys_mem.regions[0].size = bip->bi_memsize; phys_mem.n_regions = 1; - - ret = __va(phys_mem.regions[0].address + - phys_mem.regions[0].size); set_phys_avail(&phys_mem); - return (ret); + return (phys_mem.regions[0].address + phys_mem.regions[0].size); } #endif diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c --- v2.4.0-test8/linux/arch/ppc/xmon/start.c Mon Jun 19 17:59:37 2000 +++ linux/arch/ppc/xmon/start.c Sun Sep 17 09:48:07 2000 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,12 @@ use_screen = 1; } #endif +#ifdef CONFIG_ADB_CUDA + if (!via_modem && disp_bi ) { + prom_drawstring("xmon uses screen and keyboard\n"); + use_screen = 1; + } +#endif #endif #ifdef CHRP_ESCC @@ -100,6 +107,10 @@ /* should already be mapped by the kernel boot */ sccc = (volatile unsigned char *) (isa_io_base + 0x3fd); sccd = (volatile unsigned char *) (isa_io_base + 0x3f8); + if (xmon_use_sccb) { + sccc -= 0x100; + sccd -= 0x100; + } TXRDY = 0x20; RXRDY = 1; } @@ -109,6 +120,19 @@ void xmon_init_scc(void); extern void pmu_poll(void); +extern void cuda_poll(void); + +static inline void do_poll_adb(void) +{ +#ifdef CONFIG_ADB_PMU + if (sys_ctrler == SYS_CTRLER_PMU) + pmu_poll(); +#endif /* CONFIG_ADB_PMU */ +#ifdef CONFIG_ADB_CUDA + if (sys_ctrler == SYS_CTRLER_CUDA) + cuda_poll(); +#endif /* CONFIG_ADB_CUDA */ +} int xmon_write(void *handle, void *ptr, int nb) @@ -128,12 +152,8 @@ xmon_init_scc(); ct = 0; for (i = 0; i < nb; ++i) { - while ((*sccc & TXRDY) == 0) { -#ifdef CONFIG_ADB_PMU - if (sys_ctrler == SYS_CTRLER_PMU) - pmu_poll(); -#endif /* CONFIG_ADB_PMU */ - } + while ((*sccc & TXRDY) == 0) + do_poll_adb(); c = p[i]; if (c == '\n' && !ct) { c = '\r'; @@ -189,9 +209,7 @@ prom_drawchar('\b'); t = 200000; } -#ifdef CONFIG_ADB_PMU - pmu_poll(); -#endif /* CONFIG_ADB_PMU */ + do_poll_adb(); } while (xmon_adb_keycode == -1); k = xmon_adb_keycode; if (on) @@ -230,14 +248,9 @@ xmon_init_scc(); for (i = 0; i < nb; ++i) { while ((*sccc & RXRDY) == 0) -#ifdef CONFIG_ADB_PMU - if (sys_ctrler == SYS_CTRLER_PMU) - pmu_poll(); -#else - ; -#endif /* CONFIG_ADB_PMU */ + do_poll_adb(); buf_access(); - *p++ = *sccd; + *p++ = *sccd; } return i; } @@ -246,10 +259,7 @@ xmon_read_poll(void) { if ((*sccc & RXRDY) == 0) { -#ifdef CONFIG_ADB_PMU - if (sys_ctrler == SYS_CTRLER_PMU) - pmu_poll(); -#endif /* CONFIG_ADB_PMU */ + do_poll_adb(); return -1; } buf_access(); @@ -490,4 +500,20 @@ } *p = 0; return str; +} + +void +xmon_enter(void) +{ +#ifdef CONFIG_ADB_PMU + pmu_suspend(); +#endif +} + +void +xmon_leave(void) +{ +#ifdef CONFIG_ADB_PMU + pmu_resume(); +#endif } diff -u --recursive --new-file v2.4.0-test8/linux/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c --- v2.4.0-test8/linux/arch/ppc/xmon/xmon.c Thu Jul 13 09:42:51 2000 +++ linux/arch/ppc/xmon/xmon.c Sun Sep 17 09:48:07 2000 @@ -6,15 +6,23 @@ #include #include #include +#include #include #include #include +#include #include "nonstdio.h" #include "privinst.h" #define scanhex xmon_scanhex #define skipbl xmon_skipbl +#ifdef CONFIG_SMP +static unsigned long cpus_in_xmon = 0; +static unsigned long got_xmon = 0; +static volatile int take_xmon = -1; +#endif /* CONFIG_SMP */ + static unsigned adrs; static int size = 1; static unsigned ndump = 64; @@ -84,6 +92,9 @@ static struct bpt *at_breakpoint(unsigned pc); static void bpt_cmds(void); static void cacheflush(void); +#ifdef CONFIG_SMP +static void cpu_cmd(void); +#endif /* CONFIG_SMP */ #if 0 /* Makes compile with -Wall */ static char *pretty_print_addr(unsigned long addr); static char *lookup_name(unsigned long addr); @@ -96,8 +107,18 @@ extern int setjmp(u_int *); extern void longjmp(u_int *, int); +extern void xmon_enter(void); +extern void xmon_leave(void); + #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3]) +#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ + || ('a' <= (c) && (c) <= 'f') \ + || ('A' <= (c) && (c) <= 'F')) +#define isalnum(c) (('0' <= (c) && (c) <= '9') \ + || ('a' <= (c) && (c) <= 'z') \ + || ('A' <= (c) && (c) <= 'Z')) + static char *help_string = "\ Commands:\n\ d dump bytes\n\ @@ -117,10 +138,12 @@ x exit monitor\n\ "; -static int xmon_trace; +static int xmon_trace[NR_CPUS]; #define SSTEP 1 /* stepping because of 's' command */ #define BRSTEP 2 /* stepping over breakpoint */ +static struct pt_regs *xmon_regs[NR_CPUS]; + void xmon(struct pt_regs *excp) { @@ -143,27 +166,52 @@ msr = get_msr(); set_msr(msr & ~0x8000); /* disable interrupts */ - remove_bpts(); + xmon_regs[smp_processor_id()] = excp; + xmon_enter(); excprint(excp); +#ifdef CONFIG_SMP + if (test_and_set_bit(smp_processor_id(), &cpus_in_xmon)) + for (;;) + ; + while (test_and_set_bit(0, &got_xmon)) { + if (take_xmon == smp_processor_id()) { + take_xmon = -1; + break; + } + } + /* + * XXX: breakpoints are removed while any cpu is in xmon + */ +#endif /* CONFIG_SMP */ + remove_bpts(); cmd = cmds(excp); if (cmd == 's') { - xmon_trace = SSTEP; + xmon_trace[smp_processor_id()] = SSTEP; excp->msr |= 0x400; } else if (at_breakpoint(excp->nip)) { - xmon_trace = BRSTEP; + xmon_trace[smp_processor_id()] = BRSTEP; excp->msr |= 0x400; } else { - xmon_trace = 0; + xmon_trace[smp_processor_id()] = 0; insert_bpts(); } + xmon_leave(); + xmon_regs[smp_processor_id()] = 0; +#ifdef CONFIG_SMP + clear_bit(0, &got_xmon); + clear_bit(smp_processor_id(), &cpus_in_xmon); +#endif /* CONFIG_SMP */ set_msr(msr); /* restore interrupt enable */ } void xmon_irq(int irq, void *d, struct pt_regs *regs) { + unsigned long flags; + save_flags(flags);cli(); printf("Keyboard interrupt\n"); xmon(regs); + restore_flags(flags); } int @@ -178,7 +226,7 @@ --bp->count; remove_bpts(); excprint(regs); - xmon_trace = BRSTEP; + xmon_trace[smp_processor_id()] = BRSTEP; regs->msr |= 0x400; } else { xmon(regs); @@ -189,10 +237,10 @@ int xmon_sstep(struct pt_regs *regs) { - if (!xmon_trace) + if (!xmon_trace[smp_processor_id()]) return 0; - if (xmon_trace == BRSTEP) { - xmon_trace = 0; + if (xmon_trace[smp_processor_id()] == BRSTEP) { + xmon_trace[smp_processor_id()] = 0; insert_bpts(); } else { xmon(regs); @@ -207,7 +255,7 @@ --dabr.count; remove_bpts(); excprint(regs); - xmon_trace = BRSTEP; + xmon_trace[smp_processor_id()] = BRSTEP; regs->msr |= 0x400; } else { dabr.instr = regs->nip; @@ -223,7 +271,7 @@ --iabr.count; remove_bpts(); excprint(regs); - xmon_trace = BRSTEP; + xmon_trace[smp_processor_id()] = BRSTEP; regs->msr |= 0x400; } else { xmon(regs); @@ -264,6 +312,7 @@ bp->address); bp->enabled = 0; } + store_inst((void *) bp->address); } #if !defined(CONFIG_8xx) && !defined(CONFIG_POWER4) if (dabr.enabled) @@ -293,6 +342,7 @@ && mwrite(bp->address, &bp->instr, 4) != 4) printf("Couldn't remove breakpoint at %x\n", bp->address); + store_inst((void *) bp->address); } } @@ -306,6 +356,9 @@ last_cmd = NULL; for(;;) { +#ifdef CONFIG_SMP + printf("%d:", smp_processor_id()); +#endif /* CONFIG_SMP */ printf("mon> "); fflush(stdout); flush_input(); @@ -383,12 +436,67 @@ case 'b': bpt_cmds(); break; - case 'c': + case 'C': csum(); break; +#ifdef CONFIG_SMP + case 'c': + cpu_cmd(); + break; +#endif /* CONFIG_SMP */ + } + } +} + +#ifdef CONFIG_SMP +static void cpu_cmd(void) +{ + unsigned cpu; + int timeout; + int cmd; + + cmd = inchar(); + if (cmd == 'i') { + /* interrupt other cpu(s) */ + cpu = MSG_ALL_BUT_SELF; + scanhex(&cpu); + smp_send_xmon_break(cpu); + return; + } + termch = cmd; + if (!scanhex(&cpu)) { + /* print cpus waiting or in xmon */ + printf("cpus stopped:"); + for (cpu = 0; cpu < NR_CPUS; ++cpu) { + if (test_bit(cpu, &cpus_in_xmon)) { + printf(" %d", cpu); + if (cpu == smp_processor_id()) + printf("*", cpu); + } + } + printf("\n"); + return; + } + /* try to switch to cpu specified */ + take_xmon = cpu; + timeout = 10000000; + while (take_xmon >= 0) { + if (--timeout == 0) { + /* yes there's a race here */ + take_xmon = -1; + printf("cpu %u didn't take control\n", cpu); + return; + } + } + /* now have to wait to be given control back */ + while (test_and_set_bit(0, &got_xmon)) { + if (take_xmon == smp_processor_id()) { + take_xmon = -1; + break; } } } +#endif /* CONFIG_SMP */ static unsigned short fcstab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, @@ -551,6 +659,8 @@ extern char lost_irq_ret, do_bottom_half_ret, do_signal_ret; extern char ret_from_except; + printf("backtrace:\n"); + if (excp != NULL) sp = excp->gpr[1]; else @@ -592,6 +702,9 @@ void excprint(struct pt_regs *fp) { +#ifdef CONFIG_SMP + printf("cpu %d: ", smp_processor_id()); +#endif /* CONFIG_SMP */ printf("vector: %x at pc = %x", fp->trap, fp->nip); printf(", lr = %x, msr = %x, sp = %x [%x]\n", @@ -1163,9 +1276,6 @@ return c; } -#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ - || ('a' <= (c) && (c) <= 'f') \ - || ('A' <= (c) && (c) <= 'F')) void dump() { @@ -1402,6 +1512,16 @@ return c; } +#define N_PTREGS 44 +static char *regnames[N_PTREGS] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", + "pc", "msr", "or3", "ctr", "lr", "xer", "ccr", "mq", + "trap", "dar", "dsisr", "res" +}; + int scanhex(vp) unsigned *vp; @@ -1410,6 +1530,36 @@ unsigned v; c = skipbl(); + if (c == '%') { + /* parse register name */ + char regname[8]; + int i; + + for (i = 0; i < sizeof(regname) - 1; ++i) { + c = inchar(); + if (!isalnum(c)) { + termch = c; + break; + } + regname[i] = c; + } + regname[i] = 0; + for (i = 0; i < N_PTREGS; ++i) { + if (strcmp(regnames[i], regname) == 0) { + unsigned *rp = (unsigned *) + xmon_regs[smp_processor_id()]; + if (rp == NULL) { + printf("regs not available\n"); + return 0; + } + *vp = rp[i]; + return 1; + } + } + printf("invalid register name '%%%s'\n", regname); + return 0; + } + d = hexdigit(c); if( d == EOF ){ termch = c; diff -u --recursive --new-file v2.4.0-test8/linux/arch/sh/kernel/time.c linux/arch/sh/kernel/time.c --- v2.4.0-test8/linux/arch/sh/kernel/time.c Wed Aug 9 13:59:04 2000 +++ linux/arch/sh/kernel/time.c Mon Sep 11 08:39:48 2000 @@ -274,37 +274,6 @@ write_unlock(&xtime_lock); } -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} - static unsigned long get_rtc_time(void) { unsigned int sec, min, hr, wk, day, mon, yr, yr100; diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc/kernel/time.c linux/arch/sparc/kernel/time.c --- v2.4.0-test8/linux/arch/sparc/kernel/time.c Mon Jun 19 17:59:38 2000 +++ linux/arch/sparc/kernel/time.c Sun Sep 17 10:01:49 2000 @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.56 2000/06/13 22:51:28 anton Exp $ +/* $Id: time.c,v 1.57 2000/09/16 07:33:45 davem Exp $ * linux/arch/sparc/kernel/time.c * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -147,37 +147,6 @@ last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } write_unlock(&xtime_lock); -} - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ } /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/kernel/entry.S linux/arch/sparc64/kernel/entry.S --- v2.4.0-test8/linux/arch/sparc64/kernel/entry.S Thu Sep 7 08:32:00 2000 +++ linux/arch/sparc64/kernel/entry.S Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: entry.S,v 1.119 2000/09/06 00:45:01 davem Exp $ +/* $Id: entry.S,v 1.120 2000/09/08 13:58:12 jj Exp $ * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points. * * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu) @@ -940,8 +940,8 @@ 1: b,pt %xcc, ret_sys_call ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_I0], %o0 -sparc_exit: rdpr %otherwin, %g1 - wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate +sparc_exit: wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate + rdpr %otherwin, %g1 rdpr %cansave, %g3 add %g3, %g1, %g3 wrpr %g3, 0x0, %cansave diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/kernel/sys_sparc32.c linux/arch/sparc64/kernel/sys_sparc32.c --- v2.4.0-test8/linux/arch/sparc64/kernel/sys_sparc32.c Wed Aug 23 09:30:13 2000 +++ linux/arch/sparc64/kernel/sys_sparc32.c Sun Sep 17 10:01:49 2000 @@ -1,4 +1,4 @@ -/* $Id: sys_sparc32.c,v 1.163 2000/08/22 10:09:10 jj Exp $ +/* $Id: sys_sparc32.c,v 1.164 2000/09/14 10:42:47 davem Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -1621,7 +1621,7 @@ static void *do_ncp_super_data_conv(void *raw_data) { - struct ncp_mount_data *n = (struct ncp_mount_data *)raw_data; + struct ncp_mount_data news, *n = &news; struct ncp_mount_data32 *n32 = (struct ncp_mount_data32 *)raw_data; n->dir_mode = n32->dir_mode; @@ -1631,6 +1631,7 @@ memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int))); n->wdog_pid = n32->wdog_pid; n->mounted_uid = low2highuid(n32->mounted_uid); + memcpy(raw_data, n, sizeof(struct ncp_mount_data)); return raw_data; } @@ -1645,7 +1646,7 @@ static void *do_smb_super_data_conv(void *raw_data) { - struct smb_mount_data *s = (struct smb_mount_data *)raw_data; + struct smb_mount_data news, *s = &news; struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; s->version = s32->version; @@ -1654,6 +1655,7 @@ s->gid = low2highgid(s32->gid); s->file_mode = s32->file_mode; s->dir_mode = s32->dir_mode; + memcpy(raw_data, s, sizeof(struct smb_mount_data)); return raw_data; } diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/kernel/time.c linux/arch/sparc64/kernel/time.c --- v2.4.0-test8/linux/arch/sparc64/kernel/time.c Tue Jul 11 15:46:08 2000 +++ linux/arch/sparc64/kernel/time.c Sun Sep 17 10:01:49 2000 @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.28 2000/07/11 02:21:12 davem Exp $ +/* $Id: time.c,v 1.29 2000/09/16 07:33:45 davem Exp $ * time.c: UltraSparc timer and TOD clock support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -176,37 +176,6 @@ write_unlock(&xtime_lock); } #endif - -/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. - * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 - * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. - * - * [For the Julian calendar (which was used in Russia before 1917, - * Britain & colonies before 1752, anywhere else before 1582, - * and is still in use by some communities) leave out the - * -year/100+year/400 terms, and add 10.] - * - * This algorithm was first published by Gauss (I think). - * - * WARNING: this function will overflow on 2106-02-07 06:28:16 on - * machines were long is 32-bit! (However, as time_t is signed, we - * will already get problems at other places on 2038-01-19 03:14:08) - */ -static inline unsigned long mktime(unsigned int year, unsigned int mon, - unsigned int day, unsigned int hour, - unsigned int min, unsigned int sec) -{ - if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ - mon += 12; /* Puts Feb last since it has leap day */ - year -= 1; - } - return ((( - (unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day) + - year*365 - 719499 - )*24 + hour /* now have hours */ - )*60 + min /* now have minutes */ - )*60 + sec; /* finally seconds */ -} /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ static void __init kick_start_clock(void) diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/lib/rwlock.S linux/arch/sparc64/lib/rwlock.S --- v2.4.0-test8/linux/arch/sparc64/lib/rwlock.S Thu Mar 16 11:40:17 2000 +++ linux/arch/sparc64/lib/rwlock.S Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: rwlock.S,v 1.3 2000/03/16 16:44:38 davem Exp $ +/* $Id: rwlock.S,v 1.4 2000/09/09 00:00:34 davem Exp $ * rwlocks.S: These things are too big to do inline. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -30,54 +30,38 @@ cmp %g5, %g7 be,pt %xcc, 99b membar #StoreLoad | #StoreStore - b,a,pt %xcc, __read_unlock + ba,a,pt %xcc, __read_unlock __read_wait_for_writer: ldsw [%o0], %g5 brlz,pt %g5, __read_wait_for_writer membar #LoadLoad - b,a,pt %xcc, 4b -__write_wait_for_writer: - ldsw [%o0], %g5 - brlz,pt %g5, __write_wait_for_writer + ba,a,pt %xcc, 4b +__write_wait_for_any: + lduw [%o0], %g5 + brnz,pt %g5, __write_wait_for_any membar #LoadLoad - b,a,pt %xcc, 4f - - /* Similarly, 2 cache lines for non-contention write locks. */ + ba,a,pt %xcc, 4f .align 64 .globl __write_unlock __write_unlock: /* %o0 = lock_ptr */ - sethi %hi(0x80000000), %g2 -1: lduw [%o0], %g5 - andn %g5, %g2, %g7 - cas [%o0], %g5, %g7 - cmp %g5, %g7 - be,pt %icc, 99b - membar #StoreLoad | #StoreStore - b,a,pt %xcc, 1b + membar #LoadStore | #StoreStore + retl + stw %g0, [%o0] .globl __write_lock __write_lock: /* %o0 = lock_ptr */ sethi %hi(0x80000000), %g2 -1: ldsw [%o0], %g5 -4: brnz,pn %g5, 5f - or %g5, %g2, %g7 + +1: lduw [%o0], %g5 + brnz,pn %g5, __write_wait_for_any +4: or %g5, %g2, %g7 cas [%o0], %g5, %g7 + cmp %g5, %g7 be,pt %icc, 99b membar #StoreLoad | #StoreStore - - b,a,pt %xcc, 1b -5: brlz %g5, __write_wait_for_writer - or %g5, %g2, %g7 - cas [%o0], %g5, %g7 - cmp %g5, %g7 - bne,pn %icc, 5b -8: ldsw [%o0], %g5 - cmp %g5, %g2 - be,pn %icc, 99b - membar #LoadLoad - b,a,pt %xcc, 99b + ba,a,pt %xcc, 1b rwlock_impl_end: diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/mm/fault.c linux/arch/sparc64/mm/fault.c --- v2.4.0-test8/linux/arch/sparc64/mm/fault.c Sat Aug 12 12:08:50 2000 +++ linux/arch/sparc64/mm/fault.c Sun Sep 17 10:01:50 2000 @@ -1,4 +1,4 @@ -/* $Id: fault.c,v 1.50 2000/08/11 03:00:13 davem Exp $ +/* $Id: fault.c,v 1.51 2000/09/14 06:22:32 anton Exp $ * arch/sparc64/mm/fault.c: Page fault handlers for the 64-bit Sparc. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -145,7 +145,7 @@ if (!insn) { if (regs->tstate & TSTATE_PRIV) { - if (regs->tpc & 0x3) + if (!regs->tpc || (regs->tpc & 0x3)) goto cannot_handle; insn = *(unsigned int *)regs->tpc; } else { diff -u --recursive --new-file v2.4.0-test8/linux/arch/sparc64/mm/init.c linux/arch/sparc64/mm/init.c --- v2.4.0-test8/linux/arch/sparc64/mm/init.c Thu Sep 7 08:44:50 2000 +++ linux/arch/sparc64/mm/init.c Fri Sep 8 17:55:17 2000 @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.154 2000/08/09 00:00:15 davem Exp $ +/* $Id: init.c,v 1.155 2000/09/09 00:02:19 davem Exp $ * arch/sparc64/mm/init.c * * Copyright (C) 1996-1999 David S. Miller (davem@caip.rutgers.edu) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/Makefile linux/drivers/Makefile --- v2.4.0-test8/linux/drivers/Makefile Tue Aug 22 11:41:14 2000 +++ linux/drivers/Makefile Sun Sep 17 09:48:04 2000 @@ -63,7 +63,7 @@ MOD_SUB_DIRS += macintosh endif -ifdef CONFIG_PPC +ifdef CONFIG_ALL_PPC SUB_DIRS += macintosh MOD_SUB_DIRS += macintosh endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c --- v2.4.0-test8/linux/drivers/acorn/block/mfmhd.c Mon Feb 28 14:16:37 2000 +++ linux/drivers/acorn/block/mfmhd.c Mon Sep 18 15:15:21 2000 @@ -124,7 +124,7 @@ #include #include #include -#include +#include /* * This sort of stuff should be in a header file shared with ide.c, hd.c, xd.c etc diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/Makefile linux/drivers/acorn/char/Makefile --- v2.4.0-test8/linux/drivers/acorn/char/Makefile Sun Aug 13 09:54:15 2000 +++ linux/drivers/acorn/char/Makefile Mon Sep 18 15:15:21 2000 @@ -28,19 +28,15 @@ obj-arc := keyb_arc.o obj-rpc := keyb_ps2.o +obj-clps7500 := keyb_ps2.o defkeymap-acorn.o obj-$(CONFIG_RPCMOUSE) += mouse_rpc.o obj-$(CONFIG_ATOMWIDE_SERIAL) += serial-atomwide.o obj-$(CONFIG_DUALSP_SERIAL) += serial-dualsp.o -obj-$(CONFIG_ARCH_ACORN) += defkeymap-acorn.o +obj-$(CONFIG_ARCH_ACORN) += defkeymap-acorn.o i2c.o pcf8583.o # Do the i2c and rtc last obj-y += $(obj-$(MACHINE)) - -# CL-PS7500 does not have these devices. -ifneq ($(CONFIG_ARCH_CLPS7500),y) -obj-y += i2c.o pcf8583.o -endif O_OBJS := $(filter-out $(export-objs), $(obj-y)) OX_OBJS := $(filter $(export-objs), $(obj-y)) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/defkeymap-acorn.c linux/drivers/acorn/char/defkeymap-acorn.c --- v2.4.0-test8/linux/drivers/acorn/char/defkeymap-acorn.c Mon Jun 26 12:04:42 2000 +++ linux/drivers/acorn/char/defkeymap-acorn.c Mon Sep 18 15:15:21 2000 @@ -1,9 +1,12 @@ /* - * linux/arch/arm/drivers/char/defkeymap.c + * linux/drivers/acorn/char/defkeymap.c * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/i2c.c linux/drivers/acorn/char/i2c.c --- v2.4.0-test8/linux/drivers/acorn/char/i2c.c Sun Feb 6 17:45:25 2000 +++ linux/drivers/acorn/char/i2c.c Mon Sep 18 15:15:21 2000 @@ -1,11 +1,15 @@ /* - * linux/drivers/acorn/char/i2c.c + * linux/drivers/acorn/char/i2c.c * - * Copyright (C) 2000 Russell King + * Copyright (C) 2000 Russell King * - * ARM IOC/IOMD i2c driver. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * On Acorn machines, the following i2c devices are on the bus: + * ARM IOC/IOMD i2c driver. + * + * On Acorn machines, the following i2c devices are on the bus: * - PCF8583 real time clock & static RAM */ #include @@ -15,7 +19,7 @@ #include #include -#include +#include #include #include "pcf8583.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/keyb_arc.c linux/drivers/acorn/char/keyb_arc.c --- v2.4.0-test8/linux/drivers/acorn/char/keyb_arc.c Wed Aug 9 14:11:11 2000 +++ linux/drivers/acorn/char/keyb_arc.c Mon Sep 18 15:15:21 2000 @@ -1,13 +1,18 @@ /* - * linux/arch/arm/drivers/char1/keyb_arc.c + * linux/drivers/acorn/char/keyb_arc.c * - * Acorn keyboard driver for ARM Linux. + * Copyright (C) 2000 Russell King * - * The Acorn keyboard appears to have a ***very*** buggy reset protocol - - * every reset behaves differently. We try to get round this by attempting - * a few things... + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Acorn keyboard driver for ARM Linux. + * + * The Acorn keyboard appears to have a ***very*** buggy reset protocol - + * every reset behaves differently. We try to get round this by attempting + * a few things... */ - #include #include #include @@ -28,8 +33,8 @@ #include #include #include -#include #include +#include #include "../../char/busmouse.h" @@ -424,14 +429,11 @@ { unsigned long flags; - save_flags_cli (flags); if (request_irq (IRQ_KEYBOARDTX, a5kkbd_tx, 0, "keyboard", NULL) != 0) panic("Could not allocate keyboard transmit IRQ!"); - disable_irq (IRQ_KEYBOARDTX); + (void)inb(IOC_KARTRX); if (request_irq (IRQ_KEYBOARDRX, a5kkbd_rx, 0, "keyboard", NULL) != 0) panic("Could not allocate keyboard receive IRQ!"); - (void)inb(IOC_KARTRX); - restore_flags (flags); a5kkbd_sendbyte (HRST); /* send HRST (expect HRST) */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/keyb_ps2.c linux/drivers/acorn/char/keyb_ps2.c --- v2.4.0-test8/linux/drivers/acorn/char/keyb_ps2.c Wed Aug 9 14:11:11 2000 +++ linux/drivers/acorn/char/keyb_ps2.c Mon Sep 18 15:15:21 2000 @@ -1,11 +1,16 @@ /* - * linux/arch/arm/drivers/block/keyb_ps2.c + * linux/drivers/acorn/char/keyb_ps2.c * - * Keyboard driver for RPC ARM Linux. + * Copyright (C) 2000 Russell King * - * Note!!! This driver talks directly to the keyboard. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Keyboard driver for RiscPC ARM Linux. + * + * Note!!! This driver talks directly to the keyboard. */ - #include #include #include @@ -25,7 +30,7 @@ #include #include #include -#include +#include #include extern struct tasklet_struct keyboard_tasklet; @@ -326,20 +331,15 @@ int __init ps2kbd_init_hw(void) { - unsigned long flags; - /* Reset the keyboard state machine. */ outb(0, IOMD_KCTRL); outb(8, IOMD_KCTRL); - save_flags_cli (flags); + (void)IOMD_KARTRX; if (request_irq (IRQ_KEYBOARDRX, ps2kbd_rx, 0, "keyboard", NULL) != 0) panic("Could not allocate keyboard receive IRQ!"); if (request_irq (IRQ_KEYBOARDTX, ps2kbd_tx, 0, "keyboard", NULL) != 0) panic("Could not allocate keyboard transmit IRQ!"); - disable_irq (IRQ_KEYBOARDTX); - (void)IOMD_KARTRX; - restore_flags (flags); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/mouse_rpc.c linux/drivers/acorn/char/mouse_rpc.c --- v2.4.0-test8/linux/drivers/acorn/char/mouse_rpc.c Tue Jun 20 07:24:52 2000 +++ linux/drivers/acorn/char/mouse_rpc.c Mon Sep 18 15:15:21 2000 @@ -1,12 +1,16 @@ /* - * linux/drivers/char/mouse_rpc.c + * linux/drivers/char/mouse_rpc.c * - * Copyright (C) 1996-1998 Russell King + * Copyright (C) 1996-1998 Russell King * - * This handles the Acorn RiscPCs mouse. We basically have a couple - * of hardware registers that track the sensor count for the X-Y movement - * and another register holding the button state. On every VSYNC interrupt - * we read the complete state and then work out if something has changed. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This handles the Acorn RiscPCs mouse. We basically have a couple + * of hardware registers that track the sensor count for the X-Y movement + * and another register holding the button state. On every VSYNC interrupt + * we read the complete state and then work out if something has changed. */ #include #include @@ -17,7 +21,7 @@ #include #include #include -#include +#include #include "../../char/busmouse.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/pcf8583.c linux/drivers/acorn/char/pcf8583.c --- v2.4.0-test8/linux/drivers/acorn/char/pcf8583.c Sun Feb 6 17:45:25 2000 +++ linux/drivers/acorn/char/pcf8583.c Mon Sep 18 15:15:21 2000 @@ -1,11 +1,14 @@ /* - * linux/drivers/i2c/pcf8583.c + * linux/drivers/acorn/char/pcf8583.c * - * Copyright (C) 2000 Russell King + * Copyright (C) 2000 Russell King * - * Driver for PCF8583 RTC & RAM chip + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Driver for PCF8583 RTC & RAM chip */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/pcf8583.h linux/drivers/acorn/char/pcf8583.h --- v2.4.0-test8/linux/drivers/acorn/char/pcf8583.h Sun Feb 6 17:45:25 2000 +++ linux/drivers/acorn/char/pcf8583.h Mon Sep 18 15:15:21 2000 @@ -1,3 +1,12 @@ +/* + * linux/drivers/acorn/char/pcf8583.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ struct rtc_tm { unsigned char cs; unsigned char secs; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/serial-atomwide.c linux/drivers/acorn/char/serial-atomwide.c --- v2.4.0-test8/linux/drivers/acorn/char/serial-atomwide.c Thu Dec 2 15:41:02 1999 +++ linux/drivers/acorn/char/serial-atomwide.c Mon Sep 18 15:15:22 2000 @@ -1,14 +1,17 @@ /* - * linux/arch/arm/drivers/char/serial-atomwide.c + * linux/arch/arm/drivers/char/serial-atomwide.c * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 02-05-1996 RMK Created - * 07-05-1996 RMK Altered for greater number of cards. - * 30-07-1996 RMK Now uses generic card code. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 02-05-1996 RMK Created + * 07-05-1996 RMK Altered for greater number of cards. + * 30-07-1996 RMK Now uses generic card code. */ - #define MY_CARD_LIST { MANU_ATOMWIDE, PROD_ATOMWIDE_3PSERIAL } #define MY_NUMPORTS 3 #define MY_BAUD_BASE (7372800 / 16) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/serial-card.c linux/drivers/acorn/char/serial-card.c --- v2.4.0-test8/linux/drivers/acorn/char/serial-card.c Thu Dec 2 15:41:02 1999 +++ linux/drivers/acorn/char/serial-card.c Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/drivers/char/serial-card.c + * linux/drivers/acorn/char/serial-card.c * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * A generic handler of serial expansion cards that use 16550s or * the like. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/char/serial-dualsp.c linux/drivers/acorn/char/serial-dualsp.c --- v2.4.0-test8/linux/drivers/acorn/char/serial-dualsp.c Thu Dec 2 15:41:02 1999 +++ linux/drivers/acorn/char/serial-dualsp.c Mon Sep 18 15:15:22 2000 @@ -1,10 +1,14 @@ /* - * linux/arch/arm/drivers/char/serial-dualsp.c + * linux/drivers/acorn/char/serial-dualsp.c * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 30-07-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 30-07-1996 RMK Created */ #define MY_CARD_LIST { MANU_SERPORT, PROD_SERPORT_DSPORT } #define MY_NUMPORTS 2 diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/net/ether1.c linux/drivers/acorn/net/ether1.c --- v2.4.0-test8/linux/drivers/acorn/net/ether1.c Tue Jul 11 11:12:23 2000 +++ linux/drivers/acorn/net/ether1.c Mon Sep 18 15:15:22 2000 @@ -1,13 +1,14 @@ /* - * linux/arch/arm/drivers/net/ether1.c + * linux/drivers/acorn/net/ether1.c * - * (C) Copyright 1996-2000 Russell King + * Copyright (C) 1996-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Acorn ether1 driver (82586 chip) for Acorn machines * - * Acorn ether1 driver (82586 chip) - * for Acorn machines - */ - -/* * We basically keep two queues in the cards memory - one for transmit * and one for receive. Each has a head and a tail. The head is where * we/the chip adds packets to be transmitted/received, and the tail @@ -15,9 +16,7 @@ * Both of these queues are circular, and since the chip is running * all the time, we have to be careful when we modify the pointers etc * so that the buffer memory contents is valid all the time. - */ - -/* + * * Change log: * 1.00 RMK Released * 1.01 RMK 19/03/1996 Transfers the last odd byte onto/off of the card now. @@ -132,135 +131,128 @@ * This routine is essentially an optimised memcpy from the card's * onboard RAM to kernel memory. */ -static inline void * -ether1_inswb (unsigned int addr, void *data, unsigned int len) -{ - int used; - - addr = ioaddr(addr); - - __asm__ __volatile__( - "subs %3, %3, #2 - bmi 2f -1: ldr %0, [%1], #4 - strb %0, [%2], #1 - mov %0, %0, lsr #8 - strb %0, [%2], #1 - subs %3, %3, #2 - bmi 2f - ldr %0, [%1], #4 - strb %0, [%2], #1 - mov %0, %0, lsr #8 - strb %0, [%2], #1 - subs %3, %3, #2 - bmi 2f - ldr %0, [%1], #4 - strb %0, [%2], #1 - mov %0, %0, lsr #8 - strb %0, [%2], #1 - subs %3, %3, #2 - bmi 2f - ldr %0, [%1], #4 - strb %0, [%2], #1 - mov %0, %0, lsr #8 - strb %0, [%2], #1 - subs %3, %3, #2 - bpl 1b -2: adds %3, %3, #1 - ldreqb %0, [%1] - streqb %0, [%2]" - : "=&r" (used), "=&r" (addr), "=&r" (data), "=&r" (len) - : "1" (addr), "2" (data), "3" (len)); - - return data; -} - -static inline void * -ether1_outswb (unsigned int addr, void *data, unsigned int len) -{ - int used; - - addr = ioaddr(addr); - - __asm__ __volatile__( - "subs %3, %3, #2 - bmi 2f -1: ldr %0, [%2], #2 - mov %0, %0, lsl #16 - orr %0, %0, %0, lsr #16 - str %0, [%1], #4 - subs %3, %3, #2 - bmi 2f - ldr %0, [%2], #2 - mov %0, %0, lsl #16 - orr %0, %0, %0, lsr #16 - str %0, [%1], #4 - subs %3, %3, #2 - bmi 2f - ldr %0, [%2], #2 - mov %0, %0, lsl #16 - orr %0, %0, %0, lsr #16 - str %0, [%1], #4 - subs %3, %3, #2 - bmi 2f - ldr %0, [%2], #2 - mov %0, %0, lsl #16 - orr %0, %0, %0, lsr #16 - str %0, [%1], #4 - subs %3, %3, #2 - bpl 1b -2: adds %3, %3, #1 - ldreqb %0, [%2] - streqb %0, [%1]" - : "=&r" (used), "=&r" (addr), "=&r" (data), "=&r" (len) - : "1" (addr), "2" (data), "3" (len)); - - return data; -} - - static void ether1_writebuffer (struct net_device *dev, void *data, unsigned int start, unsigned int length) { - unsigned int page, thislen, offset; + unsigned int page, thislen, offset, addr; offset = start & 4095; + page = start >> 12; + addr = ioaddr(ETHER1_RAM + (offset >> 1)); - for (page = start >> 12; length; page++) { - outb (page, REG_PAGE); - if (offset + length > 4096) { - length -= 4096 - offset; - thislen = 4096 - offset; - } else { - thislen = length; - length = 0; - } - - data = ether1_outswb (ETHER1_RAM + (offset >> 1), data, thislen); - offset = 0; - } + if (offset + length > 4096) + thislen = 4096 - offset; + else + thislen = length; + + do { + int used; + + outb(page, REG_PAGE); + length -= thislen; + + __asm__ __volatile__( + "subs %3, %3, #2 + bmi 2f +1: ldr %0, [%1], #2 + mov %0, %0, lsl #16 + orr %0, %0, %0, lsr #16 + str %0, [%2], #4 + subs %3, %3, #2 + bmi 2f + ldr %0, [%1], #2 + mov %0, %0, lsl #16 + orr %0, %0, %0, lsr #16 + str %0, [%2], #4 + subs %3, %3, #2 + bmi 2f + ldr %0, [%1], #2 + mov %0, %0, lsl #16 + orr %0, %0, %0, lsr #16 + str %0, [%2], #4 + subs %3, %3, #2 + bmi 2f + ldr %0, [%1], #2 + mov %0, %0, lsl #16 + orr %0, %0, %0, lsr #16 + str %0, [%2], #4 + subs %3, %3, #2 + bpl 1b +2: adds %3, %3, #1 + ldreqb %0, [%1] + streqb %0, [%2]" + : "=&r" (used), "=&r" (data) + : "r" (addr), "r" (thislen), "1" (data)); + + addr = ioaddr(ETHER1_RAM); + + thislen = length; + if (thislen > 4096) + thislen = 4096; + page++; + } while (thislen); } static void ether1_readbuffer (struct net_device *dev, void *data, unsigned int start, unsigned int length) { - unsigned int page, thislen, offset; + unsigned int page, thislen, offset, addr; offset = start & 4095; + page = start >> 12; + addr = ioaddr(ETHER1_RAM + (offset >> 1)); - for (page = start >> 12; length; page++) { - outb (page, REG_PAGE); - if (offset + length > 4096) { - length -= 4096 - offset; - thislen = 4096 - offset; - } else { - thislen = length; - length = 0; - } - - data = ether1_inswb (ETHER1_RAM + (offset >> 1), data, thislen); - offset = 0; - } + if (offset + length > 4096) + thislen = 4096 - offset; + else + thislen = length; + + do { + int used; + + outb(page, REG_PAGE); + length -= thislen; + + __asm__ __volatile__( + "subs %3, %3, #2 + bmi 2f +1: ldr %0, [%2], #4 + strb %0, [%1], #1 + mov %0, %0, lsr #8 + strb %0, [%1], #1 + subs %3, %3, #2 + bmi 2f + ldr %0, [%2], #4 + strb %0, [%1], #1 + mov %0, %0, lsr #8 + strb %0, [%1], #1 + subs %3, %3, #2 + bmi 2f + ldr %0, [%2], #4 + strb %0, [%1], #1 + mov %0, %0, lsr #8 + strb %0, [%1], #1 + subs %3, %3, #2 + bmi 2f + ldr %0, [%2], #4 + strb %0, [%1], #1 + mov %0, %0, lsr #8 + strb %0, [%1], #1 + subs %3, %3, #2 + bpl 1b +2: adds %3, %3, #1 + ldreqb %0, [%2] + streqb %0, [%1]" + : "=&r" (used), "=&r" (data) + : "r" (addr), "r" (thislen), "1" (data)); + + addr = ioaddr(ETHER1_RAM); + + thislen = length; + if (thislen > 4096) + thislen = 4096; + page++; + } while (thislen); } static int __init diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/net/ether1.h linux/drivers/acorn/net/ether1.h --- v2.4.0-test8/linux/drivers/acorn/net/ether1.h Tue Jul 11 11:12:23 2000 +++ linux/drivers/acorn/net/ether1.h Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/drivers/net/ether1.h + * linux/drivers/acorn/net/ether1.h * - * network driver for Acorn Ether1 cards. + * Copyright (C) 1996 Russell King * - * (c) 1996 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Network driver for Acorn Ether1 cards. */ #ifndef _LINUX_ether1_H diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/net/ether3.c linux/drivers/acorn/net/ether3.c --- v2.4.0-test8/linux/drivers/acorn/net/ether3.c Tue Jul 11 11:12:23 2000 +++ linux/drivers/acorn/net/ether3.c Mon Sep 18 15:15:22 2000 @@ -1,5 +1,11 @@ /* - * linux/drivers/net/ether3.c + * linux/drivers/acorn/net/ether3.c + * + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * SEEQ nq8005 ethernet driver for Acorn/ANT Ether3 card * for Acorn machines diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/net/ether3.h linux/drivers/acorn/net/ether3.h --- v2.4.0-test8/linux/drivers/acorn/net/ether3.h Tue Jul 11 11:12:23 2000 +++ linux/drivers/acorn/net/ether3.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * linux/drivers/net/ether3.h + * linux/drivers/acorn/net/ether3.h * - * network driver for Acorn/ANT Ether3 cards + * Copyright (C) 1995-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * network driver for Acorn/ANT Ether3 cards */ #ifndef _LINUX_ether3_H diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/net/etherh.c linux/drivers/acorn/net/etherh.c --- v2.4.0-test8/linux/drivers/acorn/net/etherh.c Tue Jun 20 07:24:52 2000 +++ linux/drivers/acorn/net/etherh.c Mon Sep 18 15:15:22 2000 @@ -1,12 +1,16 @@ /* - * linux/drivers/net/etherh.c + * linux/drivers/acorn/net/etherh.c + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * NS8390 ANT etherh specific driver * For Acorn machines * * Thanks to I-Cubed for information on their cards. - * - * By Russell King. * * Changelog: * 08-12-1996 RMK 1.00 Created diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi-io.S linux/drivers/acorn/scsi/acornscsi-io.S --- v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi-io.S Sun Jan 11 16:45:53 1998 +++ linux/drivers/acorn/scsi/acornscsi-io.S Mon Sep 18 15:15:22 2000 @@ -1,4 +1,10 @@ -@ linux/arch/arm/drivers/scsi/acornscsi-io.S: Acorn SCSI card IO +/* + * linux/drivers/acorn/scsi/acornscsi-io.S: Acorn SCSI card IO + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi.c linux/drivers/acorn/scsi/acornscsi.c --- v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/acorn/scsi/acornscsi.c Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * linux/arch/arm/drivers/scsi/acornscsi.c + * linux/drivers/acorn/scsi/acornscsi.c * * Acorn SCSI 3 driver * By R.M.King. * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * * Abandoned using the Select and Transfer command since there were * some nasty races between our software and the target devices that * were not easy to solve, and the device errata had a lot of entries @@ -2621,7 +2625,7 @@ { enum res_abort res = res_not_running; - if (queue_removecmd(&host->queues.issue, SCpnt)) { + if (queue_remove_cmd(&host->queues.issue, SCpnt)) { /* * The command was on the issue queue, and has not been * issued yet. We can remove the command from the queue, @@ -2632,7 +2636,7 @@ printk("on issue queue "); //#endif res = res_success; - } else if (queue_removecmd(&host->queues.disconnected, SCpnt)) { + } else if (queue_remove_cmd(&host->queues.disconnected, SCpnt)) { /* * The command was on the disconnected queue. Simply * acknowledge the abort condition, and when the target diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi.h linux/drivers/acorn/scsi/acornscsi.h --- v2.4.0-test8/linux/drivers/acorn/scsi/acornscsi.h Sun Apr 2 17:28:21 2000 +++ linux/drivers/acorn/scsi/acornscsi.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * Acorn SCSI driver + * linux/drivers/acorn/scsi/acornscsi.h * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Acorn SCSI driver */ #ifndef ACORNSCSI_H #define ACORNSCSI_H diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/arxescsi.c linux/drivers/acorn/scsi/arxescsi.c --- v2.4.0-test8/linux/drivers/acorn/scsi/arxescsi.c Fri May 12 11:21:20 2000 +++ linux/drivers/acorn/scsi/arxescsi.c Mon Sep 18 15:15:22 2000 @@ -17,7 +17,6 @@ * (arxescsi_pseudo_dma_write) * 02-04-2000 RMK 0.1.1 Updated for new error handling code. */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/cumana_2.c linux/drivers/acorn/scsi/cumana_2.c --- v2.4.0-test8/linux/drivers/acorn/scsi/cumana_2.c Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/cumana_2.c Mon Sep 18 15:15:22 2000 @@ -1,18 +1,21 @@ /* - * linux/arch/arm/drivers/scsi/cumana_2.c + * linux/drivers/acorn/scsi/cumana_2.c * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King * - * Changelog: - * 30-08-1997 RMK 0.0.0 Created, READONLY version. - * 22-01-1998 RMK 0.0.1 Updated to 2.1.80. - * 15-04-1998 RMK 0.0.1 Only do PIO if FAS216 will allow it. - * 02-05-1998 RMK 0.0.2 Updated & added DMA support. - * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h - * 18-08-1998 RMK 0.0.3 Fixed synchronous transfer depth. - * 02-04-2000 RMK 0.0.4 Updated for new error handling code. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 30-08-1997 RMK 0.0.0 Created, READONLY version. + * 22-01-1998 RMK 0.0.1 Updated to 2.1.80. + * 15-04-1998 RMK 0.0.1 Only do PIO if FAS216 will allow it. + * 02-05-1998 RMK 0.0.2 Updated & added DMA support. + * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h + * 18-08-1998 RMK 0.0.3 Fixed synchronous transfer depth. + * 02-04-2000 RMK 0.0.4 Updated for new error handling code. */ - #include #include #include @@ -23,6 +26,7 @@ #include #include #include +#include #include #include @@ -151,15 +155,6 @@ fas216_intr(host); } -static void -cumanascsi_2_invalidate(char *addr, long len, fasdmadir_t direction) -{ - if (direction == DMA_OUT) - dma_cache_wback((unsigned long)addr, (unsigned long)len); - else - dma_cache_inv((unsigned long)addr, (unsigned long)len); -} - /* Prototype: fasdmatype_t cumanascsi_2_dma_setup(host, SCpnt, direction, min_type) * Purpose : initialises DMA/PIO * Params : host - host @@ -179,33 +174,30 @@ if (dmach != NO_DMA && (min_type == fasdma_real_all || SCp->this_residual >= 512)) { - int buf; + int bufs = SCp->buffers_residual; + int pci_dir, dma_dir, alatch_dir; + + if (bufs) + memcpy(info->sg + 1, SCp->buffer + 1, + sizeof(struct scatterlist) * bufs); + info->sg[0].address = SCp->ptr; + info->sg[0].length = SCp->this_residual; + + if (direction == DMA_OUT) + pci_dir = PCI_DMA_TODEVICE, + dma_dir = DMA_MODE_WRITE, + alatch_dir = ALATCH_DMA_OUT; + else + pci_dir = PCI_DMA_FROMDEVICE, + dma_dir = DMA_MODE_READ, + alatch_dir = ALATCH_DMA_IN; - for (buf = 1; buf <= SCp->buffers_residual && - buf < NR_SG; buf++) { - info->dmasg[buf].address = __virt_to_bus( - (unsigned long)SCp->buffer[buf].address); - info->dmasg[buf].length = SCp->buffer[buf].length; - - cumanascsi_2_invalidate(SCp->buffer[buf].address, - SCp->buffer[buf].length, - direction); - } - - info->dmasg[0].address = __virt_to_phys((unsigned long)SCp->ptr); - info->dmasg[0].length = SCp->this_residual; - cumanascsi_2_invalidate(SCp->ptr, - SCp->this_residual, direction); + pci_map_sg(NULL, info->sg, bufs + 1, pci_dir); disable_dma(dmach); - set_dma_sg(dmach, info->dmasg, buf); - if (direction == DMA_OUT) { - outb(ALATCH_DMA_OUT, info->alatch); - set_dma_mode(dmach, DMA_MODE_WRITE); - } else { - outb(ALATCH_DMA_IN, info->alatch); - set_dma_mode(dmach, DMA_MODE_READ); - } + set_dma_sg(dmach, info->sg, bufs + 1); + outb(alatch_dir, info->alatch); + set_dma_mode(dmach, dma_dir); enable_dma(dmach); outb(ALATCH_ENA_DMA, info->alatch); outb(ALATCH_DIS_BIT32, info->alatch); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/cumana_2.h linux/drivers/acorn/scsi/cumana_2.h --- v2.4.0-test8/linux/drivers/acorn/scsi/cumana_2.h Fri May 12 11:21:20 2000 +++ linux/drivers/acorn/scsi/cumana_2.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * Cumana SCSI II driver + * linux/drivers/acorn/scsi/cumana_2.h * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Cumana SCSI II driver */ #ifndef CUMANA_2_H #define CUMANA_2_H @@ -76,7 +82,7 @@ unsigned int alatch; /* Control register */ unsigned int terms; /* Terminator state */ unsigned int dmaarea; /* Pseudo DMA area */ - dmasg_t dmasg[NR_SG]; /* Scatter DMA list */ + struct scatterlist sg[NR_SG]; /* Scatter DMA list */ } CumanaScsi2_Info; #define CSTATUS_IRQ (1 << 0) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/eesox.c linux/drivers/acorn/scsi/eesox.c --- v2.4.0-test8/linux/drivers/acorn/scsi/eesox.c Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/eesox.c Mon Sep 18 15:15:22 2000 @@ -1,24 +1,27 @@ /* - * linux/arch/arm/drivers/scsi/eesox.c + * linux/drivers/acorn/scsi/eesox.c * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King * - * This driver is based on experimentation. Hence, it may have made - * assumptions about the particular card that I have available, and - * may not be reliable! + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Changelog: - * 01-10-1997 RMK Created, READONLY version - * 15-02-1998 RMK READ/WRITE version + * This driver is based on experimentation. Hence, it may have made + * assumptions about the particular card that I have available, and + * may not be reliable! + * + * Changelog: + * 01-10-1997 RMK Created, READONLY version + * 15-02-1998 RMK READ/WRITE version * added DMA support and hardware definitions - * 14-03-1998 RMK Updated DMA support + * 14-03-1998 RMK Updated DMA support * Added terminator control - * 15-04-1998 RMK Only do PIO if FAS216 will allow it. - * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h - * 02-04-2000 RMK 0.0.3 Fixed NO_IRQ/NO_DMA problem, updated for new + * 15-04-1998 RMK Only do PIO if FAS216 will allow it. + * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h + * 02-04-2000 RMK 0.0.3 Fixed NO_IRQ/NO_DMA problem, updated for new * error handling code. */ - #include #include #include @@ -29,6 +32,7 @@ #include #include #include +#include #include #include @@ -157,15 +161,6 @@ fas216_intr(host); } -static void -eesoxscsi_invalidate(char *addr, long len, fasdmadir_t direction) -{ - if (direction == DMA_OUT) - dma_cache_wback((unsigned long)addr, (unsigned long)len); - else - dma_cache_inv((unsigned long)addr, (unsigned long)len); -} - /* Prototype: fasdmatype_t eesoxscsi_dma_setup(host, SCpnt, direction, min_type) * Purpose : initialises DMA/PIO * Params : host - host @@ -183,29 +178,27 @@ if (dmach != NO_DMA && (min_type == fasdma_real_all || SCp->this_residual >= 512)) { - int buf; + int bufs = SCp->buffers_residual; + int pci_dir, dma_dir; + + if (bufs) + memcpy(info->sg + 1, SCp->buffer + 1, + sizeof(struct scatterlist) * bufs); + info->sg[0].address = SCp->ptr; + info->sg[0].length = SCp->this_residual; + + if (direction == DMA_OUT) + pci_dir = PCI_DMA_TODEVICE, + dma_dir = DMA_MODE_WRITE; + else + pci_dir = PCI_DMA_FROMDEVICE, + dma_dir = DMA_MODE_READ; - for(buf = 1; buf <= SCp->buffers_residual && - buf < NR_SG; buf++) { - info->dmasg[buf].address = __virt_to_bus( - (unsigned long)SCp->buffer[buf].address); - info->dmasg[buf].length = SCp->buffer[buf].length; - - eesoxscsi_invalidate(SCp->buffer[buf].address, - SCp->buffer[buf].length, - direction); - } - - info->dmasg[0].address = __virt_to_phys((unsigned long)SCp->ptr); - info->dmasg[0].length = SCp->this_residual; - eesoxscsi_invalidate(SCp->ptr, - SCp->this_residual, direction); + pci_map_sg(NULL, info->sg, bufs + 1, pci_dir); disable_dma(dmach); - set_dma_sg(dmach, info->dmasg, buf); - set_dma_mode(dmach, - direction == DMA_OUT ? DMA_MODE_WRITE : - DMA_MODE_READ); + set_dma_sg(dmach, info->sg, bufs + 1); + set_dma_mode(dmach, dma_dir); enable_dma(dmach); return fasdma_real_all; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/eesox.h linux/drivers/acorn/scsi/eesox.h --- v2.4.0-test8/linux/drivers/acorn/scsi/eesox.h Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/eesox.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * EESOX SCSI driver + * linux/drivers/acorn/scsi/eesox.h * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * EESOX SCSI driver */ #ifndef EESOXSCSI_H #define EESOXSCSI_H @@ -76,7 +82,7 @@ struct control control; unsigned int dmaarea; /* Pseudo DMA area */ - dmasg_t dmasg[NR_SG]; /* Scatter DMA list */ + struct scatterlist sg[NR_SG]; /* Scatter DMA list */ } EESOXScsi_Info; #endif /* HOSTS_C */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/fas216.c linux/drivers/acorn/scsi/fas216.c --- v2.4.0-test8/linux/drivers/acorn/scsi/fas216.c Wed Aug 9 14:11:11 2000 +++ linux/drivers/acorn/scsi/fas216.c Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/drivers/scsi/fas216.c + * linux/arch/arm/drivers/scsi/fas216.c * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Based on information in qlogicfas.c by Tom Zerucha, Michael Griffith, and * other sources, including: @@ -33,7 +37,6 @@ * Todo: * - allow individual devices to enable sync xfers. */ - #include #include #include @@ -2177,7 +2180,7 @@ { enum res_abort res = res_failed; - if (queue_removecmd(&info->queues.issue, SCpnt)) { + if (queue_remove_cmd(&info->queues.issue, SCpnt)) { /* * The command was on the issue queue, and has not been * issued yet. We can remove the command from the queue, @@ -2187,7 +2190,7 @@ printk("on issue queue "); res = res_success; - } else if (queue_removecmd(&info->queues.disconnected, SCpnt)) { + } else if (queue_remove_cmd(&info->queues.disconnected, SCpnt)) { /* * The command was on the disconnected queue. We must * reconnect with the device if possible, and send it diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/fas216.h linux/drivers/acorn/scsi/fas216.h --- v2.4.0-test8/linux/drivers/acorn/scsi/fas216.h Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/fas216.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * FAS216 generic driver + * linux/drivers/acorn/scsi/fas216.h * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * FAS216 generic driver */ #ifndef FAS216_H #define FAS216_H diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/msgqueue.c linux/drivers/acorn/scsi/msgqueue.c --- v2.4.0-test8/linux/drivers/acorn/scsi/msgqueue.c Thu Jun 17 01:11:35 1999 +++ linux/drivers/acorn/scsi/msgqueue.c Mon Sep 18 15:15:22 2000 @@ -1,9 +1,14 @@ /* - * drivers/acorn/scsi/msgqueue.c: message queue handling + * linux/drivers/acorn/scsi/msgqueue.c * - * Copyright (C) 1997-1998 Russell King + * Copyright (C) 1997-1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * message queue handling */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/msgqueue.h linux/drivers/acorn/scsi/msgqueue.h --- v2.4.0-test8/linux/drivers/acorn/scsi/msgqueue.h Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/msgqueue.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * msgqueue.h: message queue handling + * linux/drivers/acorn/scsi/msgqueue.h * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * message queue handling */ #ifndef MSGQUEUE_H #define MSGQUEUE_H diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/powertec.c linux/drivers/acorn/scsi/powertec.c --- v2.4.0-test8/linux/drivers/acorn/scsi/powertec.c Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/powertec.c Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/arch/arm/drivers/scsi/powertec.c + * linux/drivers/acorn/scsi/powertec.c * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * This driver is based on experimentation. Hence, it may have made * assumptions about the particular card that I have available, and @@ -15,7 +19,6 @@ * 27-06-1998 RMK Changed asm/delay.h to linux/delay.h * 02-04-2000 RMK Updated for new error handling code. */ - #include #include #include @@ -26,6 +29,7 @@ #include #include #include +#include #include #include @@ -147,15 +151,6 @@ fas216_intr(host); } -static void -powertecscsi_invalidate(char *addr, long len, fasdmadir_t direction) -{ - if (direction == DMA_OUT) - dma_cache_wback((unsigned long)addr, (unsigned long)len); - else - dma_cache_inv((unsigned long)addr, (unsigned long)len); -} - /* Prototype: fasdmatype_t powertecscsi_dma_setup(host, SCpnt, direction, min_type) * Purpose : initialises DMA/PIO * Params : host - host @@ -173,29 +168,27 @@ if (dmach != NO_DMA && (min_type == fasdma_real_all || SCp->this_residual >= 512)) { - int buf; + int bufs = SCp->buffers_residual; + int pci_dir, dma_dir; + + if (bufs) + memcpy(info->sg + 1, SCp->buffer + 1, + sizeof(struct scatterlist) * bufs); + info->sg[0].address = SCp->ptr; + info->sg[0].length = SCp->this_residual; + + if (direction == DMA_OUT) + pci_dir = PCI_DMA_TODEVICE, + dma_dir = DMA_MODE_WRITE; + else + pci_dir = PCI_DMA_FROMDEVICE, + dma_dir = DMA_MODE_READ; - for (buf = 1; buf <= SCp->buffers_residual && - buf < NR_SG; buf++) { - info->dmasg[buf].address = __virt_to_bus( - (unsigned long)SCp->buffer[buf].address); - info->dmasg[buf].length = SCp->buffer[buf].length; - - powertecscsi_invalidate(SCp->buffer[buf].address, - SCp->buffer[buf].length, - direction); - } - - info->dmasg[0].address = __virt_to_phys((unsigned long)SCp->ptr); - info->dmasg[0].length = SCp->this_residual; - powertecscsi_invalidate(SCp->ptr, - SCp->this_residual, direction); + pci_map_sg(NULL, info->sg, bufs + 1, pci_dir); disable_dma(dmach); - set_dma_sg(dmach, info->dmasg, buf); - set_dma_mode(dmach, - direction == DMA_OUT ? DMA_MODE_WRITE : - DMA_MODE_READ); + set_dma_sg(dmach, info->sg, bufs + 1); + set_dma_mode(dmach, dma_dir); enable_dma(dmach); return fasdma_real_all; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/powertec.h linux/drivers/acorn/scsi/powertec.h --- v2.4.0-test8/linux/drivers/acorn/scsi/powertec.h Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/powertec.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,13 @@ /* - * PowerTec SCSI driver + * linux/drivers/acorn/scsi/powertec.h * - * Copyright (C) 1997-2000 Russell King + * Copyright (C) 1997-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * PowerTec SCSI driver */ #ifndef POWERTECSCSI_H #define POWERTECSCSI_H @@ -74,7 +80,7 @@ } control; /* other info... */ - dmasg_t dmasg[NR_SG]; /* Scatter DMA list */ + struct scatterlist sg[NR_SG]; /* Scatter DMA list */ } PowerTecScsi_Info; #endif /* HOSTS_C */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/queue.c linux/drivers/acorn/scsi/queue.c --- v2.4.0-test8/linux/drivers/acorn/scsi/queue.c Thu Jun 17 01:11:35 1999 +++ linux/drivers/acorn/scsi/queue.c Mon Sep 18 15:15:22 2000 @@ -1,40 +1,57 @@ /* - * queue.c: queue handling primitives + * linux/drivers/acorn/scsi/queue.c: queue handling primitives * - * (c) 1997 Russell King + * Copyright (C) 1997-2000 Russell King * - * Changelog: - * 15-Sep-1997 RMK Created. - * 11-Oct-1997 RMK Corrected problem with queue_remove_exclude + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-Sep-1997 RMK Created. + * 11-Oct-1997 RMK Corrected problem with queue_remove_exclude * not updating internal linked list properly * (was causing commands to go missing). + * 30-Aug-2000 RMK Use Linux list handling and spinlocks */ - -#define SECTOR_SIZE 512 - #include #include #include #include #include +#include +#include #include "../../scsi/scsi.h" MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("SCSI command queueing"); +#define DEBUG + typedef struct queue_entry { - struct queue_entry *next; - struct queue_entry *prev; - unsigned long magic; + struct list_head list; Scsi_Cmnd *SCpnt; +#ifdef DEBUG + unsigned long magic; +#endif } QE_t; +#ifdef DEBUG #define QUEUE_MAGIC_FREE 0xf7e1c9a3 #define QUEUE_MAGIC_USED 0xf7e1cc33 +#define SET_MAGIC(q,m) ((q)->magic = (m)) +#define BAD_MAGIC(q,m) ((q)->magic != (m)) +#else +#define SET_MAGIC(q,m) do { } while (0) +#define BAD_MAGIC(q,m) (0) +#endif + #include "queue.h" +#define NR_QE 32 + /* * Function: void queue_initialise (Queue_t *queue) * Purpose : initialise a queue @@ -42,24 +59,29 @@ */ int queue_initialise (Queue_t *queue) { - unsigned int nqueues; + unsigned int nqueues = NR_QE; QE_t *q; - queue->alloc = queue->free = q = (QE_t *) kmalloc (SECTOR_SIZE, GFP_KERNEL); + spin_lock_init(&queue->queue_lock); + INIT_LIST_HEAD(&queue->head); + INIT_LIST_HEAD(&queue->free); + + /* + * If life was easier, then SCpnt would have a + * host-available list head, and we wouldn't + * need to keep free lists or allocate this + * memory. + */ + queue->alloc = q = kmalloc(sizeof(QE_t) * nqueues, GFP_KERNEL); if (q) { - nqueues = SECTOR_SIZE / sizeof (QE_t); - for (; nqueues; q++, nqueues--) { - q->next = q + 1; - q->prev = NULL; - q->magic = QUEUE_MAGIC_FREE; + SET_MAGIC(q, QUEUE_MAGIC_FREE); q->SCpnt = NULL; + list_add(&q->list, &queue->free); } - q -= 1; - q->next = NULL; } - return q != NULL; + return queue->alloc != NULL; } /* @@ -69,103 +91,69 @@ */ void queue_free (Queue_t *queue) { + if (!list_empty(&queue->head)) + printk(KERN_WARNING "freeing non-empty queue %p\n", queue); if (queue->alloc) - kfree (queue->alloc); + kfree(queue->alloc); } /* - * Function: int queue_add_cmd_ordered (Queue_t *queue, Scsi_Cmnd *SCpnt) + * Function: int queue_add_cmd(Queue_t *queue, Scsi_Cmnd *SCpnt, int head) * Purpose : Add a new command onto a queue, adding REQUEST_SENSE to head. * Params : queue - destination queue * SCpnt - command to add + * head - add command to head of queue * Returns : 0 on error, !0 on success */ -int queue_add_cmd_ordered (Queue_t *queue, Scsi_Cmnd *SCpnt) +int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head) { unsigned long flags; + struct list_head *l; QE_t *q; + int ret = 0; - save_flags_cli (flags); - q = queue->free; - if (q) - queue->free = q->next; - - if (q) { - if (q->magic != QUEUE_MAGIC_FREE) { - restore_flags (flags); - panic ("scsi queues corrupted - queue entry not free"); - } - - q->magic = QUEUE_MAGIC_USED; - q->SCpnt = SCpnt; - - if (SCpnt->cmnd[0] == REQUEST_SENSE) { /* request_sense gets put on the queue head */ - if (queue->head) { - q->prev = NULL; - q->next = queue->head; - queue->head->prev = q; - queue->head = q; - } else { - q->next = q->prev = NULL; - queue->head = queue->tail = q; - } - } else { /* others get put on the tail */ - if (queue->tail) { - q->next = NULL; - q->prev = queue->tail; - queue->tail->next = q; - queue->tail = q; - } else { - q->next = q->prev = NULL; - queue->head = queue->tail = q; - } - } - } - restore_flags (flags); - - return q != NULL; + spin_lock_irqsave(&queue->queue_lock, flags); + if (list_empty(&queue->free)) + goto empty; + + l = queue->free.next; + list_del(l); + + q = list_entry(l, QE_t, list); + if (BAD_MAGIC(q, QUEUE_MAGIC_FREE)) + BUG(); + + SET_MAGIC(q, QUEUE_MAGIC_USED); + q->SCpnt = SCpnt; + + if (head) + list_add(l, &queue->head); + else + list_add_tail(l, &queue->head); + + ret = 1; +empty: + spin_unlock_irqrestore(&queue->queue_lock, flags); + return ret; } -/* - * Function: int queue_add_cmd_tail (Queue_t *queue, Scsi_Cmnd *SCpnt) - * Purpose : Add a new command onto a queue, adding onto tail of list - * Params : queue - destination queue - * SCpnt - command to add - * Returns : 0 on error, !0 on success - */ -int queue_add_cmd_tail (Queue_t *queue, Scsi_Cmnd *SCpnt) +static Scsi_Cmnd *__queue_remove(Queue_t *queue, struct list_head *ent) { - unsigned long flags; QE_t *q; - save_flags_cli (flags); - q = queue->free; - if (q) - queue->free = q->next; - - if (q) { - if (q->magic != QUEUE_MAGIC_FREE) { - restore_flags (flags); - panic ("scsi queues corrupted - queue entry not free"); - } - - q->magic = QUEUE_MAGIC_USED; - q->SCpnt = SCpnt; + /* + * Move the entry from the "used" list onto the "free" list + */ + list_del(ent); + q = list_entry(ent, QE_t, list); + if (BAD_MAGIC(q, QUEUE_MAGIC_USED)) + BUG(); - if (queue->tail) { - q->next = NULL; - q->prev = queue->tail; - queue->tail->next = q; - queue->tail = q; - } else { - q->next = q->prev = NULL; - queue->head = queue->tail = q; - } - } - restore_flags (flags); + SET_MAGIC(q, QUEUE_MAGIC_FREE); + list_add(ent, &queue->free); - return q != NULL; + return q->SCpnt; } /* @@ -175,50 +163,21 @@ * exclude - bit array of target&lun which is busy * Returns : Scsi_Cmnd if successful (and a reference), or NULL if no command available */ -Scsi_Cmnd *queue_remove_exclude (Queue_t *queue, unsigned char *exclude) +Scsi_Cmnd *queue_remove_exclude(Queue_t *queue, void *exclude) { unsigned long flags; - Scsi_Cmnd *SCpnt; - QE_t *q, *prev; + struct list_head *l; + Scsi_Cmnd *SCpnt = NULL; - save_flags_cli (flags); - for (q = queue->head, prev = NULL; q; q = q->next) { - if (exclude && !test_bit (q->SCpnt->target * 8 + q->SCpnt->lun, exclude)) + spin_lock_irqsave(&queue->queue_lock, flags); + list_for_each(l, &queue->head) { + QE_t *q = list_entry(l, QE_t, list); + if (!test_bit(q->SCpnt->target * 8 + q->SCpnt->lun, exclude)) { + SCpnt = __queue_remove(queue, l); break; - prev = q; - } - - if (q) { - if (q->magic != QUEUE_MAGIC_USED) { - restore_flags (flags); - panic ("q_remove_exclude: scsi queues corrupted - queue entry not used"); - } - if (q->prev != prev) - panic ("q_remove_exclude: scsi queues corrupted - q->prev != prev"); - - if (!prev) { - queue->head = q->next; - if (queue->head) - queue->head->prev = NULL; - else - queue->tail = NULL; - } else { - prev->next = q->next; - if (prev->next) - prev->next->prev = prev; - else - queue->tail = prev; } - - SCpnt = q->SCpnt; - - q->next = queue->free; - queue->free = q; - q->magic = QUEUE_MAGIC_FREE; - } else - SCpnt = NULL; - - restore_flags (flags); + } + spin_unlock_irqrestore(&queue->queue_lock, flags); return SCpnt; } @@ -229,35 +188,15 @@ * Params : queue - queue to remove command from * Returns : Scsi_Cmnd if successful (and a reference), or NULL if no command available */ -Scsi_Cmnd *queue_remove (Queue_t *queue) +Scsi_Cmnd *queue_remove(Queue_t *queue) { unsigned long flags; - Scsi_Cmnd *SCpnt; - QE_t *q; - - save_flags_cli (flags); - q = queue->head; - if (q) { - queue->head = q->next; - if (queue->head) - queue->head->prev = NULL; - else - queue->tail = NULL; - - if (q->magic != QUEUE_MAGIC_USED) { - restore_flags (flags); - panic ("scsi queues corrupted - queue entry not used"); - } - - SCpnt = q->SCpnt; + Scsi_Cmnd *SCpnt = NULL; - q->next = queue->free; - queue->free = q; - q->magic = QUEUE_MAGIC_FREE; - } else - SCpnt = NULL; - - restore_flags (flags); + spin_lock_irqsave(&queue->queue_lock, flags); + if (!list_empty(&queue->head)) + SCpnt = __queue_remove(queue, queue->head.next); + spin_unlock_irqrestore(&queue->queue_lock, flags); return SCpnt; } @@ -274,50 +213,19 @@ Scsi_Cmnd *queue_remove_tgtluntag (Queue_t *queue, int target, int lun, int tag) { unsigned long flags; - Scsi_Cmnd *SCpnt; - QE_t *q, *prev; + struct list_head *l; + Scsi_Cmnd *SCpnt = NULL; - save_flags_cli (flags); - for (q = queue->head, prev = NULL; q; q = q->next) { - if (q->SCpnt->target == target && - q->SCpnt->lun == lun && - q->SCpnt->tag == tag) + spin_lock_irqsave(&queue->queue_lock, flags); + list_for_each(l, &queue->head) { + QE_t *q = list_entry(l, QE_t, list); + if (q->SCpnt->target == target && q->SCpnt->lun == lun && + q->SCpnt->tag == tag) { + SCpnt = __queue_remove(queue, l); break; - - prev = q; - } - - if (q) { - if (q->magic != QUEUE_MAGIC_USED) { - restore_flags (flags); - panic ("q_remove_tgtluntag: scsi queues corrupted - queue entry not used"); - } - if (q->prev != prev) - panic ("q_remove_tgtluntag: scsi queues corrupted - q->prev != prev"); - - if (!prev) { - queue->head = q->next; - if (queue->head) - queue->head->prev = NULL; - else - queue->tail = NULL; - } else { - prev->next = q->next; - if (prev->next) - prev->next->prev = prev; - else - queue->tail = prev; } - - SCpnt = q->SCpnt; - - q->magic = QUEUE_MAGIC_FREE; - q->next = queue->free; - queue->free = q; - } else - SCpnt = NULL; - - restore_flags (flags); + } + spin_unlock_irqrestore(&queue->queue_lock, flags); return SCpnt; } @@ -333,96 +241,58 @@ */ int queue_probetgtlun (Queue_t *queue, int target, int lun) { - QE_t *q; - - for (q = queue->head; q; q = q->next) - if (q->SCpnt->target == target && - q->SCpnt->lun == lun) - break; - - return q != NULL; -} - -/* - * Function: int queue_cmdonqueue (queue, SCpnt) - * Purpose : check to see if we have a command on the queue - * Params : queue - queue to look in - * SCpnt - command to find - * Returns : 0 if not found, != 0 if found - */ -int queue_cmdonqueue (Queue_t *queue, Scsi_Cmnd *SCpnt) -{ - QE_t *q; + unsigned long flags; + struct list_head *l; + int found = 0; - for (q = queue->head; q; q = q->next) - if (q->SCpnt == SCpnt) + spin_lock_irqsave(&queue->queue_lock, flags); + list_for_each(l, &queue->head) { + QE_t *q = list_entry(l, QE_t, list); + if (q->SCpnt->target == target && q->SCpnt->lun == lun) { + found = 1; break; + } + } + spin_unlock_irqrestore(&queue->queue_lock, flags); - return q != NULL; + return found; } /* - * Function: int queue_removecmd (Queue_t *queue, Scsi_Cmnd *SCpnt) + * Function: int queue_remove_cmd(Queue_t *queue, Scsi_Cmnd *SCpnt) * Purpose : remove a specific command from the queues * Params : queue - queue to look in * SCpnt - command to find * Returns : 0 if not found */ -int queue_removecmd (Queue_t *queue, Scsi_Cmnd *SCpnt) +int queue_remove_cmd(Queue_t *queue, Scsi_Cmnd *SCpnt) { unsigned long flags; - QE_t *q, *prev; + struct list_head *l; + int found = 0; - save_flags_cli (flags); - for (q = queue->head, prev = NULL; q; q = q->next) { - if (q->SCpnt == SCpnt) + spin_lock_irqsave(&queue->queue_lock, flags); + list_for_each(l, &queue->head) { + QE_t *q = list_entry(l, QE_t, list); + if (q->SCpnt == SCpnt) { + __queue_remove(queue, l); + found = 1; break; - - prev = q; - } - - if (q) { - if (q->magic != QUEUE_MAGIC_USED) { - restore_flags (flags); - panic ("q_removecmd: scsi queues corrupted - queue entry not used"); } - if (q->prev != prev) - panic ("q_removecmd: scsi queues corrupted - q->prev != prev"); - - if (!prev) { - queue->head = q->next; - if (queue->head) - queue->head->prev = NULL; - else - queue->tail = NULL; - } else { - prev->next = q->next; - if (prev->next) - prev->next->prev = prev; - else - queue->tail = prev; - } - - q->magic = QUEUE_MAGIC_FREE; - q->next = queue->free; - queue->free = q; } + spin_unlock_irqrestore(&queue->queue_lock, flags); - restore_flags (flags); - - return q != NULL; + return found; } EXPORT_SYMBOL(queue_initialise); EXPORT_SYMBOL(queue_free); +EXPORT_SYMBOL(__queue_add); EXPORT_SYMBOL(queue_remove); EXPORT_SYMBOL(queue_remove_exclude); -EXPORT_SYMBOL(queue_add_cmd_ordered); -EXPORT_SYMBOL(queue_add_cmd_tail); EXPORT_SYMBOL(queue_remove_tgtluntag); +EXPORT_SYMBOL(queue_remove_cmd); EXPORT_SYMBOL(queue_probetgtlun); -EXPORT_SYMBOL(queue_cmdonqueue); -EXPORT_SYMBOL(queue_removecmd); #ifdef MODULE int init_module (void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acorn/scsi/queue.h linux/drivers/acorn/scsi/queue.h --- v2.4.0-test8/linux/drivers/acorn/scsi/queue.h Sun Apr 2 17:28:22 2000 +++ linux/drivers/acorn/scsi/queue.h Mon Sep 18 15:15:22 2000 @@ -1,16 +1,20 @@ /* - * queue.h: queue handling + * linux/drivers/acorn/scsi/queue.h: queue handling * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef QUEUE_H #define QUEUE_H typedef struct { - struct queue_entry *head; /* head of queue */ - struct queue_entry *tail; /* tail of queue */ - struct queue_entry *free; /* free list */ - void *alloc; /* start of allocated mem */ + struct list_head head; + struct list_head free; + spinlock_t queue_lock; + void *alloc; /* start of allocated mem */ } Queue_t; /* @@ -36,32 +40,27 @@ extern Scsi_Cmnd *queue_remove (Queue_t *queue); /* - * Function: Scsi_Cmnd *queue_remove_exclude_ref (queue, exclude, ref) + * Function: Scsi_Cmnd *queue_remove_exclude_ref (queue, exclude) * Purpose : remove a SCSI command from a queue * Params : queue - queue to remove command from * exclude - array of busy LUNs - * ref - a reference that can be used to put the command back * Returns : Scsi_Cmnd if successful (and a reference), or NULL if no command available */ -extern Scsi_Cmnd *queue_remove_exclude (Queue_t *queue, unsigned char *exclude); - -/* - * Function: int queue_add_cmd_ordered (Queue_t *queue, Scsi_Cmnd *SCpnt) - * Purpose : Add a new command onto a queue, queueing REQUEST_SENSE first - * Params : queue - destination queue - * SCpnt - command to add - * Returns : 0 on error, !0 on success - */ -extern int queue_add_cmd_ordered (Queue_t *queue, Scsi_Cmnd *SCpnt); +extern Scsi_Cmnd *queue_remove_exclude (Queue_t *queue, void *exclude); +#define queue_add_cmd_ordered(queue,SCpnt) \ + __queue_add(queue,SCpnt,(SCpnt)->cmnd[0] == REQUEST_SENSE) +#define queue_add_cmd_tail(queue,SCpnt) \ + __queue_add(queue,SCpnt,0) /* - * Function: int queue_add_cmd_tail (Queue_t *queue, Scsi_Cmnd *SCpnt) - * Purpose : Add a new command onto a queue, queueing at end of list + * Function: int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head) + * Purpose : Add a new command onto a queue * Params : queue - destination queue * SCpnt - command to add + * head - add command to head of queue * Returns : 0 on error, !0 on success */ -extern int queue_add_cmd_tail (Queue_t *queue, Scsi_Cmnd *SCpnt); +extern int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head); /* * Function: Scsi_Cmnd *queue_remove_tgtluntag (queue, target, lun, tag) @@ -86,21 +85,12 @@ extern int queue_probetgtlun (Queue_t *queue, int target, int lun); /* - * Function: int queue_cmdonqueue (queue, SCpnt) - * Purpose : check to see if we have a command on the queue - * Params : queue - queue to look in - * SCpnt - command to find - * Returns : 0 if not found, != 0 if found - */ -int queue_cmdonqueue (Queue_t *queue, Scsi_Cmnd *SCpnt); - -/* - * Function: int queue_removecmd (Queue_t *queue, Scsi_Cmnd *SCpnt) + * Function: int queue_remove_cmd (Queue_t *queue, Scsi_Cmnd *SCpnt) * Purpose : remove a specific command from the queues * Params : queue - queue to look in * SCpnt - command to find * Returns : 0 if not found */ -int queue_removecmd (Queue_t *queue, Scsi_Cmnd *SCpnt); +int queue_remove_cmd(Queue_t *queue, Scsi_Cmnd *SCpnt); #endif /* QUEUE_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/Makefile linux/drivers/acpi/Makefile --- v2.4.0-test8/linux/drivers/acpi/Makefile Wed Jul 12 13:21:57 2000 +++ linux/drivers/acpi/Makefile Fri Sep 15 18:21:43 2000 @@ -2,7 +2,7 @@ # Makefile for the Linux ACPI interpreter # -SUB_DIRS := +SUB_DIRS := MOD_SUB_DIRS := $(SUB_DIRS) MOD_IN_SUB_DIRS := ALL_SUB_DIRS := $(SUB_DIRS) @@ -11,13 +11,22 @@ O_OBJS := M_OBJS := -ACPI_OBJS := driver.o ec.o cpu.o os.o sys.o tables.o -ACPI_OBJS += $(patsubst %.c,%.o,$(wildcard */*.c)) +export ACPI_CFLAGS +ACPI_CFLAGS := -D_LINUX -EXTRA_CFLAGS += -I./include -D_LINUX +EXTRA_CFLAGS += -I./include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) # if the interpreter is used, it overrides arch/i386/kernel/acpi.c ifeq ($(CONFIG_ACPI_INTERPRETER),y) + + SUB_DIRS += common dispatcher events hardware\ + interpreter namespace parser resources tables + + ACPI_OBJS := $(patsubst %,%.o,$(SUB_DIRS)) + ACPI_OBJS += $(patsubst %.c,%.o,$(wildcard *.c)) + O_OBJS += $(ACPI_OBJS) endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/Makefile linux/drivers/acpi/common/Makefile --- v2.4.0-test8/linux/drivers/acpi/common/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/common/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmalloc.c linux/drivers/acpi/common/cmalloc.c --- v2.4.0-test8/linux/drivers/acpi/common/cmalloc.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmalloc.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmalloc - local memory allocation routines + * $Revision: 73 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" -#include "namesp.h" -#include "globals.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acglobal.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmalloc"); + MODULE_NAME ("cmalloc") /***************************************************************************** @@ -52,8 +53,8 @@ _cm_allocate ( u32 size, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { void *address = NULL; @@ -98,8 +99,8 @@ _cm_callocate ( u32 size, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { void *address = NULL; @@ -146,8 +147,8 @@ _cm_free ( void *address, u32 component, - ACPI_STRING module, - s32 line) + NATIVE_CHAR *module, + u32 line) { if (NULL == address) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmclib.c linux/drivers/acpi/common/cmclib.c --- v2.4.0-test8/linux/drivers/acpi/common/cmclib.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/common/cmclib.c Fri Sep 15 14:30:29 2000 @@ -0,0 +1,821 @@ +/****************************************************************************** + * + * Module Name: cmclib - Local implementation of C library functions + * $Revision: 24 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#include "acpi.h" +#include "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "amlcode.h" + +/* + * These implementations of standard C Library routines can optionally be + * used if a C library is not available. In general, they are less efficient + * than an inline or assembly implementation + */ + +#define _COMPONENT MISCELLANEOUS + MODULE_NAME ("cmclib") + + +#ifdef _MSC_VER /* disable some level-4 warnings for VC++ */ +#pragma warning(disable:4706) /* warning C4706: assignment within conditional expression */ +#endif + +#ifndef ACPI_USE_SYSTEM_CLIBRARY + +/******************************************************************************* + * + * FUNCTION: strlen + * + * PARAMETERS: String - Null terminated string + * + * RETURN: Length + * + * DESCRIPTION: Returns the length of the input string + * + ******************************************************************************/ + + +NATIVE_UINT +acpi_cm_strlen ( + const NATIVE_CHAR *string) +{ + NATIVE_UINT length = 0; + + + /* Count the string until a null is encountered */ + + while (*string) { + length++; + string++; + } + + return (length); +} + + +/******************************************************************************* + * + * FUNCTION: strcpy + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Copy a null terminated string + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strcpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string = dst_string; + + + /* Move bytes brute force */ + + while (*src_string) { + *string = *src_string; + + string++; + src_string++; + } + + /* Null terminate */ + + *string = 0; + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strncpy + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * Count - Maximum # of bytes to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Copy a null terminated string, with a maximum length + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strncpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count) +{ + NATIVE_CHAR *string = dst_string; + + + /* Copy the string */ + + for (string = dst_string; + count && (count--, (*string++ = *src_string++)); ) + {;} + + /* Pad with nulls if necessary */ + + while (count--) { + *string = 0; + string++; + } + + /* Return original pointer */ + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strcmp + * + * PARAMETERS: String1 - First string + * String2 - Second string + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings + * + ******************************************************************************/ + +u32 +acpi_cm_strcmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2) +{ + + + for ( ; (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + + return ((unsigned char) *string1 - (unsigned char) *string2); +} + + +/******************************************************************************* + * + * FUNCTION: strncmp + * + * PARAMETERS: String1 - First string + * String2 - Second string + * Count - Maximum # of bytes to compare + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings, with a maximum length + * + ******************************************************************************/ + +u32 +acpi_cm_strncmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2, + NATIVE_UINT count) +{ + + + for ( ; count-- && (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + return ((count == -1) ? 0 : ((unsigned char) *string1 - + (unsigned char) *string2)); +} + + +/******************************************************************************* + * + * FUNCTION: Strcat + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strcat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string; + + + /* Find end of the destination string */ + + for (string = dst_string; *string++; ) { ; } + + /* Concatinate the string */ + + for (--string; (*string++ = *src_string++); ) { ; } + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: strncat + * + * PARAMETERS: Dst_string - Target of the copy + * Src_string - The source string to copy + * Count - Maximum # of bytes to copy + * + * RETURN: Dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string, + * with a maximum count. + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strncat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count) +{ + NATIVE_CHAR *string; + + + if (count) { + /* Find end of the destination string */ + + for (string = dst_string; *string++; ) { ; } + + /* Concatinate the string */ + + for (--string; (*string++ = *src_string++) && --count; ) { ; } + + /* Null terminate if necessary */ + + if (!count) { + *string = 0; + } + } + + return (dst_string); +} + + +/******************************************************************************* + * + * FUNCTION: memcpy + * + * PARAMETERS: Dest - Target of the copy + * Src - Source buffer to copy + * Count - Number of bytes to copy + * + * RETURN: Dest + * + * DESCRIPTION: Copy arbitrary bytes of memory + * + ******************************************************************************/ + +void * +acpi_cm_memcpy ( + void *dest, + const void *src, + NATIVE_UINT count) +{ + NATIVE_CHAR *new = (NATIVE_CHAR *) dest; + NATIVE_CHAR *old = (NATIVE_CHAR *) src; + + + while (count) { + *new = *old; + new++; + old++; + count--; + } + + return (dest); +} + + +/******************************************************************************* + * + * FUNCTION: memset + * + * PARAMETERS: Dest - Buffer to set + * Value - Value to set each byte of memory + * Count - Number of bytes to set + * + * RETURN: Dest + * + * DESCRIPTION: Initialize a buffer to a known value. + * + ******************************************************************************/ + +void * +acpi_cm_memset ( + void *dest, + u32 value, + NATIVE_UINT count) +{ + NATIVE_CHAR *new = (NATIVE_CHAR *) dest; + + + while (count) { + *new = (char) value; + new++; + count--; + } + + return (dest); +} + + +#define NEGATIVE 1 +#define POSITIVE 0 + + +#define _XA 0x00 /* extra alphabetic - not supported */ +#define _XS 0x40 /* extra space */ +#define _BB 0x00 /* BEL, BS, etc. - not supported */ +#define _CN 0x20 /* CR, FF, HT, NL, VT */ +#define _DI 0x04 /* '0'-'9' */ +#define _LO 0x02 /* 'a'-'z' */ +#define _PU 0x10 /* punctuation */ +#define _SP 0x08 /* space */ +#define _UP 0x01 /* 'A'-'Z' */ +#define _XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ + +const u8 _ctype[257] = { + _CN, /* 0x0 0. */ + _CN, /* 0x1 1. */ + _CN, /* 0x2 2. */ + _CN, /* 0x3 3. */ + _CN, /* 0x4 4. */ + _CN, /* 0x5 5. */ + _CN, /* 0x6 6. */ + _CN, /* 0x7 7. */ + _CN, /* 0x8 8. */ + _CN|_SP, /* 0x9 9. */ + _CN|_SP, /* 0xA 10. */ + _CN|_SP, /* 0xB 11. */ + _CN|_SP, /* 0xC 12. */ + _CN|_SP, /* 0xD 13. */ + _CN, /* 0xE 14. */ + _CN, /* 0xF 15. */ + _CN, /* 0x10 16. */ + _CN, /* 0x11 17. */ + _CN, /* 0x12 18. */ + _CN, /* 0x13 19. */ + _CN, /* 0x14 20. */ + _CN, /* 0x15 21. */ + _CN, /* 0x16 22. */ + _CN, /* 0x17 23. */ + _CN, /* 0x18 24. */ + _CN, /* 0x19 25. */ + _CN, /* 0x1A 26. */ + _CN, /* 0x1B 27. */ + _CN, /* 0x1C 28. */ + _CN, /* 0x1D 29. */ + _CN, /* 0x1E 30. */ + _CN, /* 0x1F 31. */ + _XS|_SP, /* 0x20 32. ' ' */ + _PU, /* 0x21 33. '!' */ + _PU, /* 0x22 34. '"' */ + _PU, /* 0x23 35. '#' */ + _PU, /* 0x24 36. '$' */ + _PU, /* 0x25 37. '%' */ + _PU, /* 0x26 38. '&' */ + _PU, /* 0x27 39. ''' */ + _PU, /* 0x28 40. '(' */ + _PU, /* 0x29 41. ')' */ + _PU, /* 0x2A 42. '*' */ + _PU, /* 0x2B 43. '+' */ + _PU, /* 0x2C 44. ',' */ + _PU, /* 0x2D 45. '-' */ + _PU, /* 0x2E 46. '.' */ + _PU, /* 0x2F 47. '/' */ + _XD|_DI, /* 0x30 48. '0' */ + _XD|_DI, /* 0x31 49. '1' */ + _XD|_DI, /* 0x32 50. '2' */ + _XD|_DI, /* 0x33 51. '3' */ + _XD|_DI, /* 0x34 52. '4' */ + _XD|_DI, /* 0x35 53. '5' */ + _XD|_DI, /* 0x36 54. '6' */ + _XD|_DI, /* 0x37 55. '7' */ + _XD|_DI, /* 0x38 56. '8' */ + _XD|_DI, /* 0x39 57. '9' */ + _PU, /* 0x3A 58. ':' */ + _PU, /* 0x3B 59. ';' */ + _PU, /* 0x3C 60. '<' */ + _PU, /* 0x3D 61. '=' */ + _PU, /* 0x3E 62. '>' */ + _PU, /* 0x3F 63. '?' */ + _PU, /* 0x40 64. '@' */ + _XD|_UP, /* 0x41 65. 'A' */ + _XD|_UP, /* 0x42 66. 'B' */ + _XD|_UP, /* 0x43 67. 'C' */ + _XD|_UP, /* 0x44 68. 'D' */ + _XD|_UP, /* 0x45 69. 'E' */ + _XD|_UP, /* 0x46 70. 'F' */ + _UP, /* 0x47 71. 'G' */ + _UP, /* 0x48 72. 'H' */ + _UP, /* 0x49 73. 'I' */ + _UP, /* 0x4A 74. 'J' */ + _UP, /* 0x4B 75. 'K' */ + _UP, /* 0x4C 76. 'L' */ + _UP, /* 0x4D 77. 'M' */ + _UP, /* 0x4E 78. 'N' */ + _UP, /* 0x4F 79. 'O' */ + _UP, /* 0x50 80. 'P' */ + _UP, /* 0x51 81. 'Q' */ + _UP, /* 0x52 82. 'R' */ + _UP, /* 0x53 83. 'S' */ + _UP, /* 0x54 84. 'T' */ + _UP, /* 0x55 85. 'U' */ + _UP, /* 0x56 86. 'V' */ + _UP, /* 0x57 87. 'W' */ + _UP, /* 0x58 88. 'X' */ + _UP, /* 0x59 89. 'Y' */ + _UP, /* 0x5A 90. 'Z' */ + _PU, /* 0x5B 91. '[' */ + _PU, /* 0x5C 92. '\' */ + _PU, /* 0x5D 93. ']' */ + _PU, /* 0x5E 94. '^' */ + _PU, /* 0x5F 95. '_' */ + _PU, /* 0x60 96. '`' */ + _XD|_LO, /* 0x61 97. 'a' */ + _XD|_LO, /* 0x62 98. 'b' */ + _XD|_LO, /* 0x63 99. 'c' */ + _XD|_LO, /* 0x64 100. 'd' */ + _XD|_LO, /* 0x65 101. 'e' */ + _XD|_LO, /* 0x66 102. 'f' */ + _LO, /* 0x67 103. 'g' */ + _LO, /* 0x68 104. 'h' */ + _LO, /* 0x69 105. 'i' */ + _LO, /* 0x6A 106. 'j' */ + _LO, /* 0x6B 107. 'k' */ + _LO, /* 0x6C 108. 'l' */ + _LO, /* 0x6D 109. 'm' */ + _LO, /* 0x6E 110. 'n' */ + _LO, /* 0x6F 111. 'o' */ + _LO, /* 0x70 112. 'p' */ + _LO, /* 0x71 113. 'q' */ + _LO, /* 0x72 114. 'r' */ + _LO, /* 0x73 115. 's' */ + _LO, /* 0x74 116. 't' */ + _LO, /* 0x75 117. 'u' */ + _LO, /* 0x76 118. 'v' */ + _LO, /* 0x77 119. 'w' */ + _LO, /* 0x78 120. 'x' */ + _LO, /* 0x79 121. 'y' */ + _LO, /* 0x7A 122. 'z' */ + _PU, /* 0x7B 123. '{' */ + _PU, /* 0x7C 124. '|' */ + _PU, /* 0x7D 125. '}' */ + _PU, /* 0x7E 126. '~' */ + _CN, /* 0x7F 127. */ + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 to 0x8F */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90 to 0x9F */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xA0 to 0xAF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xB0 to 0xBF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xC0 to 0xCF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xD0 to 0xDF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xE0 to 0xEF */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100 */ +}; + +#define IS_UPPER(c) (_ctype[(unsigned char)(c)] & (_UP)) +#define IS_LOWER(c) (_ctype[(unsigned char)(c)] & (_LO)) +#define IS_DIGIT(c) (_ctype[(unsigned char)(c)] & (_DI)) +#define IS_SPACE(c) (_ctype[(unsigned char)(c)] & (_SP)) + + +/******************************************************************************* + * + * FUNCTION: Acpi_cm_to_upper + * + * PARAMETERS: + * + * RETURN: + * + * DESCRIPTION: Convert character to uppercase + * + ******************************************************************************/ + +u32 +acpi_cm_to_upper ( + u32 c) +{ + + return (IS_LOWER(c) ? ((c)-0x20) : (c)); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_cm_to_lower + * + * PARAMETERS: + * + * RETURN: + * + * DESCRIPTION: Convert character to lowercase + * + ******************************************************************************/ + +u32 +acpi_cm_to_lower ( + u32 c) +{ + + return (IS_UPPER(c) ? ((c)+0x20) : (c)); +} + + +/******************************************************************************* + * + * FUNCTION: strupr + * + * PARAMETERS: Src_string - The source string to convert to + * + * RETURN: Src_string + * + * DESCRIPTION: Convert string to uppercase + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strupr ( + NATIVE_CHAR *src_string) +{ + NATIVE_CHAR *string; + + + /* Walk entire string, uppercasing the letters */ + + for (string = src_string; *string; ) { + *string = (char) acpi_cm_to_upper (*string); + string++; + } + + + return (src_string); +} + + +/******************************************************************************* + * + * FUNCTION: strstr + * + * PARAMETERS: String1 - + * String2 + * + * RETURN: + * + * DESCRIPTION: Checks if String2 occurs in String1. This is not really a + * full implementation of strstr, only sufficient for command + * matching + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_cm_strstr ( + NATIVE_CHAR *string1, + NATIVE_CHAR *string2) +{ + NATIVE_CHAR *string; + + + if (acpi_cm_strlen (string2) > acpi_cm_strlen (string1)) { + return (NULL); + } + + /* Walk entire string, uppercasing the letters */ + + for (string = string1; *string2; ) { + if (*string2 != *string) { + return (NULL); + } + + string2++; + string++; + } + + + return (string1); +} + + +/******************************************************************************* + * + * FUNCTION: strtoul + * + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte is returned + * Base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. + * + ******************************************************************************/ + +u32 +acpi_cm_strtoul ( + const NATIVE_CHAR *string, + NATIVE_CHAR **terminator, + u32 base) +{ + u32 converted = 0; + u32 index; + u32 sign; + const NATIVE_CHAR *string_start; + u32 return_value = 0; + ACPI_STATUS status = AE_OK; + + + /* + * Save the value of the pointer to the buffer's first + * character, save the current errno value, and then + * skip over any white space in the buffer: + */ + string_start = string; + while (IS_SPACE (*string) || *string == '\t') { + ++string; + } + + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*string == '-') { + sign = NEGATIVE; + ++string; + } + + else if (*string == '+') { + ++string; + sign = POSITIVE; + } + + else { + sign = POSITIVE; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (base == 0) { + if (*string == '0') { + if (acpi_cm_to_lower (*(++string)) == 'x') { + base = 16; + ++string; + } + + else { + base = 8; + } + } + + else { + base = 10; + } + } + + else if (base < 2 || base > 36) { + /* + * The specified Base parameter is not in the domain of + * this function: + */ + goto done; + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (base == 8 && *string == '0') { + string++; + } + + if (base == 16 && + *string == '0' && + acpi_cm_to_lower (*(++string)) == 'x') + { + string++; + } + + + /* + * Main loop: convert the string to an unsigned long: + */ + while (*string) { + if (IS_DIGIT (*string)) { + index = *string - '0'; + } + + else { + index = acpi_cm_to_upper (*string); + if (IS_UPPER (index)) { + index = index - 'A' + 10; + } + + else { + goto done; + } + } + + if (index >= base) { + goto done; + } + + /* + * Check to see if value is out of range: + */ + + if (return_value > ((ACPI_UINT32_MAX - (u32) index) / + (u32) base)) + { + status = AE_ERROR; + return_value = 0L; /* reset */ + } + + else { + return_value *= base; + return_value += index; + converted = 1; + } + + ++string; + } + +done: + /* + * If appropriate, update the caller's pointer to the next + * unconverted character in the buffer. + */ + if (terminator) { + if (converted == 0 && return_value == 0L && string != NULL) { + *terminator = (NATIVE_CHAR *) string_start; + } + + else { + *terminator = (NATIVE_CHAR *) string; + } + } + + if (status == AE_ERROR) { + return_value = ACPI_UINT32_MAX; + } + + /* + * If a minus sign was present, then "the conversion is negated": + */ + if (sign == NEGATIVE) { + return_value = (ACPI_UINT32_MAX - return_value) + 1; + } + + return (return_value); +} + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmcopy.c linux/drivers/acpi/common/cmcopy.c --- v2.4.0-test8/linux/drivers/acpi/common/cmcopy.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmcopy.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmcopy - Internal to external object translation utilities + * $Revision: 56 $ * *****************************************************************************/ @@ -24,17 +25,17 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmcopy"); + MODULE_NAME ("cmcopy") typedef struct search_st { - ACPI_OBJECT_INTERNAL *internal_obj; + ACPI_OPERAND_OBJECT *internal_obj; u32 index; ACPI_OBJECT *external_obj; @@ -64,13 +65,13 @@ ACPI_STATUS acpi_cm_build_external_simple_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, ACPI_OBJECT *external_obj, u8 *data_space, u32 *buffer_space_used) { u32 length = 0; - char *source_ptr = NULL; + u8 *source_ptr = NULL; /* @@ -103,8 +104,8 @@ length = internal_obj->string.length; external_obj->string.length = internal_obj->string.length; - external_obj->string.pointer = (char *) data_space; - source_ptr = internal_obj->string.pointer; + external_obj->string.pointer = (NATIVE_CHAR *) data_space; + source_ptr = (u8 *) internal_obj->string.pointer; break; @@ -113,7 +114,7 @@ length = internal_obj->buffer.length; external_obj->buffer.length = internal_obj->buffer.length; external_obj->buffer.pointer = data_space; - source_ptr = (char *) internal_obj->buffer.pointer; + source_ptr = (u8 *) internal_obj->buffer.pointer; break; @@ -132,7 +133,7 @@ */ external_obj->type = ACPI_TYPE_ANY; - external_obj->reference.handle = internal_obj->reference.nte; + external_obj->reference.handle = internal_obj->reference.node; break; @@ -142,10 +143,10 @@ internal_obj->processor.proc_id; external_obj->processor.pblk_address = - internal_obj->processor.pblk_address; + internal_obj->processor.address; external_obj->processor.pblk_length = - internal_obj->processor.pblk_length; + internal_obj->processor.length; break; case ACPI_TYPE_POWER: @@ -200,7 +201,7 @@ ACPI_STATUS acpi_cm_build_external_package_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u8 *buffer, u32 *space_used) { @@ -211,7 +212,7 @@ u32 length = 0; u32 this_index; u32 object_space; - ACPI_OBJECT_INTERNAL *this_internal_obj; + ACPI_OPERAND_OBJECT *this_internal_obj; ACPI_OBJECT *this_external_obj; PKG_SEARCH_INFO *level_ptr; @@ -256,7 +257,7 @@ while (1) { this_index = level_ptr->index; this_internal_obj = - (ACPI_OBJECT_INTERNAL *) + (ACPI_OPERAND_OBJECT *) level_ptr->internal_obj->package.elements[this_index]; this_external_obj = (ACPI_OBJECT *) @@ -264,10 +265,11 @@ /* - * Check for 1) Null object -- OK, this can happen if package + * Check for + * 1) Null object -- OK, this can happen if package * element is never initialized - * 2) Not an internal object - can be an NTE instead - * 3) Any internal object other than a package. + * 2) Not an internal object - can be Node instead + * 3) Any internal object other than a package. * * The more complex package case is handled later */ @@ -367,8 +369,6 @@ level_ptr->index = 0; } } - - return (AE_OK); } @@ -388,7 +388,7 @@ ACPI_STATUS acpi_cm_build_external_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, ACPI_BUFFER *ret_buffer) { ACPI_STATUS status; @@ -446,7 +446,7 @@ ACPI_STATUS acpi_cm_build_internal_simple_object ( ACPI_OBJECT *external_obj, - ACPI_OBJECT_INTERNAL *internal_obj) + ACPI_OPERAND_OBJECT *internal_obj) { @@ -508,18 +508,17 @@ ACPI_STATUS acpi_cm_build_internal_package_object ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u8 *buffer, u32 *space_used) { u8 *free_space; ACPI_OBJECT *external_obj; u32 current_depth = 0; - ACPI_STATUS status = AE_OK; u32 length = 0; u32 this_index; u32 object_space = 0; - ACPI_OBJECT_INTERNAL *this_internal_obj; + ACPI_OPERAND_OBJECT *this_internal_obj; ACPI_OBJECT *this_external_obj; PKG_SEARCH_INFO *level_ptr; @@ -562,7 +561,7 @@ while (1) { this_index = level_ptr->index; - this_internal_obj = (ACPI_OBJECT_INTERNAL *) + this_internal_obj = (ACPI_OPERAND_OBJECT *) &level_ptr->internal_obj->package.elements[this_index]; this_external_obj = (ACPI_OBJECT *) @@ -605,17 +604,6 @@ } /* if object is a package */ else { -/* Status = Acpi_cm_build_simple_object(This_internal_obj, - This_external_obj, Free_space, - &Object_space); -*/ - if (status != AE_OK) { - /* - * Failure get out - */ - return (status); - } - free_space += object_space; length += object_space; @@ -651,13 +639,6 @@ } } /* else object is NOT a package */ } /* while (1) */ - - - /* - * We'll never get here, but the compiler whines about - * return value - */ - return (AE_OK); } @@ -677,7 +658,7 @@ ACPI_STATUS acpi_cm_build_internal_object ( ACPI_OBJECT *external_obj, - ACPI_OBJECT_INTERNAL *internal_obj) + ACPI_OPERAND_OBJECT *internal_obj) { ACPI_STATUS status; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmdebug.c linux/drivers/acpi/common/cmdebug.c --- v2.4.0-test8/linux/drivers/acpi/common/cmdebug.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmdebug.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmdebug - Debug print routines + * $Revision: 60 $ * *****************************************************************************/ @@ -27,7 +27,7 @@ #include "acpi.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdebug"); + MODULE_NAME ("cmdebug") /***************************************************************************** @@ -41,16 +41,16 @@ ****************************************************************************/ -s32 +u32 get_debug_level (void) { - return acpi_dbg_level; + return (acpi_dbg_level); } void set_debug_level ( - s32 new_debug_level) + u32 new_debug_level) { acpi_dbg_level = new_debug_level; @@ -75,10 +75,10 @@ void function_trace ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name) { acpi_gbl_nesting_level++; @@ -109,10 +109,10 @@ void function_trace_ptr ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, void *pointer) { @@ -142,11 +142,11 @@ void function_trace_str ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, - char *string) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_CHAR *string) { acpi_gbl_nesting_level++; @@ -175,16 +175,16 @@ void function_trace_u32 ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, u32 integer) { acpi_gbl_nesting_level++; debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s, 0x%l_x\n", + " %2.2ld Entered Function: %s, 0x%lX\n", acpi_gbl_nesting_level, function_name, integer); } @@ -207,10 +207,10 @@ void function_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name) { debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, @@ -240,30 +240,19 @@ void function_status_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, ACPI_STATUS status) { - if (status > ACPI_MAX_STATUS) { - debug_print (module_name, line_number, component_id, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, [Unknown Status] 0x%X\n", - acpi_gbl_nesting_level, - function_name, - status); - } - - else { - debug_print (module_name, line_number, component_id, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %s\n", - acpi_gbl_nesting_level, - function_name, - acpi_cm_format_exception (status)); - } + debug_print (module_name, line_number, component_id, + TRACE_FUNCTIONS, + " %2.2ld Exiting Function: %s, %s\n", + acpi_gbl_nesting_level, + function_name, + acpi_cm_format_exception (status)); acpi_gbl_nesting_level--; } @@ -288,10 +277,10 @@ void function_value_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, NATIVE_UINT value) { @@ -322,11 +311,11 @@ void function_ptr_exit ( - char *module_name, - s32 line_number, - s32 component_id, - char *function_name, - char *ptr) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u8 *ptr) { debug_print (module_name, line_number, component_id, TRACE_FUNCTIONS, @@ -357,11 +346,11 @@ void debug_print ( - char *module_name, - s32 line_number, - s32 component_id, - s32 print_level, - char *format, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + u32 print_level, + NATIVE_CHAR *format, ...) { va_list args; @@ -397,8 +386,8 @@ void debug_print_prefix ( - char *module_name, - s32 line_number) + NATIVE_CHAR *module_name, + u32 line_number) { @@ -421,7 +410,7 @@ void debug_print_raw ( - char *format, + NATIVE_CHAR *format, ...) { va_list args; @@ -451,10 +440,10 @@ void acpi_cm_dump_buffer ( - char *buffer, + u8 *buffer, u32 count, u32 display, - s32 component_id) + u32 component_id) { u32 i = 0; u32 j; @@ -477,7 +466,7 @@ while (i < count) { /* Print current offset */ - acpi_os_printf ("%05_x ", i); + acpi_os_printf ("%05X ", i); /* Print 16 hex chars */ @@ -488,7 +477,7 @@ return; } - /* Make sure that the char doesn't get sign-extended! */ + /* Make sure that the s8 doesn't get sign-extended! */ switch (display) { @@ -496,7 +485,7 @@ default: - acpi_os_printf ("%02_x ", + acpi_os_printf ("%02X ", *((u8 *) &buffer[i + j])); j += 1; break; @@ -506,7 +495,7 @@ MOVE_UNALIGNED16_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%04_x ", temp32); + acpi_os_printf ("%04X ", temp32); j += 2; break; @@ -515,7 +504,7 @@ MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08_x ", temp32); + acpi_os_printf ("%08X ", temp32); j += 4; break; @@ -524,11 +513,11 @@ MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j]); - acpi_os_printf ("%08_x", temp32); + acpi_os_printf ("%08X", temp32); MOVE_UNALIGNED32_TO_32 (&temp32, &buffer[i + j + 4]); - acpi_os_printf ("%08_x ", temp32); + acpi_os_printf ("%08X ", temp32); j += 8; break; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmdelete.c linux/drivers/acpi/common/cmdelete.c --- v2.4.0-test8/linux/drivers/acpi/common/cmdelete.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmdelete.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmdelete - object deletion and reference count utilities + * $Revision: 53 $ * *****************************************************************************/ @@ -25,13 +25,13 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "parser.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acparser.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdelete"); + MODULE_NAME ("cmdelete") /****************************************************************************** @@ -49,7 +49,7 @@ void acpi_cm_delete_internal_obj ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { void *obj_pointer = NULL; @@ -110,14 +110,7 @@ case ACPI_TYPE_METHOD: - /* Delete parse tree if it exists */ - - if (object->method.parser_op) { - acpi_ps_delete_parse_tree (object->method.parser_op); - object->method.parser_op = NULL; - } - - /* Delete semaphore if it exists */ + /* Delete the method semaphore if it exists */ if (object->method.semaphore) { acpi_os_delete_semaphore (object->method.semaphore); @@ -146,7 +139,7 @@ /* Only delete the object if it was dynamically allocated */ - if (!(object->common.flags & AO_STATIC_ALLOCATION)) { + if (!(object->common.flags & AOPOBJ_STATIC_ALLOCATION)) { acpi_cm_delete_object_desc (object); } @@ -170,9 +163,9 @@ ACPI_STATUS acpi_cm_delete_internal_object_list ( - ACPI_OBJECT_INTERNAL **obj_list) + ACPI_OPERAND_OBJECT **obj_list) { - ACPI_OBJECT_INTERNAL **internal_obj; + ACPI_OPERAND_OBJECT **internal_obj; /* Walk the null-terminated internal list */ @@ -220,8 +213,8 @@ void acpi_cm_update_ref_count ( - ACPI_OBJECT_INTERNAL *object, - s32 action) + ACPI_OPERAND_OBJECT *object, + u32 action) { u16 count; u16 new_count; @@ -308,23 +301,23 @@ * DESCRIPTION: Increment the object reference count * * Object references are incremented when: - * 1) An object is added as a value in an Name Table Entry (NTE) + * 1) An object is attached to a Node (namespace object) * 2) An object is copied (all subobjects must be incremented) * * Object references are decremented when: - * 1) An object is removed from an NTE + * 1) An object is detached from an Node * ******************************************************************************/ ACPI_STATUS acpi_cm_update_object_reference ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action) { ACPI_STATUS status; u32 i; - ACPI_OBJECT_INTERNAL *next; - ACPI_OBJECT_INTERNAL *new; + ACPI_OPERAND_OBJECT *next; + ACPI_OPERAND_OBJECT *new; ACPI_GENERIC_STATE *state_list = NULL; ACPI_GENERIC_STATE *state; @@ -381,9 +374,9 @@ /* Must walk list of address handlers */ - next = object->addr_handler.link; + next = object->addr_handler.next; while (next) { - new = next->addr_handler.link; + new = next->addr_handler.next; acpi_cm_update_ref_count (next, action); next = new; @@ -512,7 +505,7 @@ void acpi_cm_add_reference ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { @@ -549,7 +542,7 @@ void acpi_cm_remove_reference ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmeval.c linux/drivers/acpi/common/cmeval.c --- v2.4.0-test8/linux/drivers/acpi/common/cmeval.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmeval.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmeval - Object evaluation + * $Revision: 14 $ * *****************************************************************************/ @@ -25,19 +25,19 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmeval"); + MODULE_NAME ("cmeval") /**************************************************************************** * * FUNCTION: Acpi_cm_evaluate_numeric_object * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Address - Where the value is returned * * RETURN: Status @@ -51,17 +51,17 @@ ACPI_STATUS acpi_cm_evaluate_numeric_object ( - char *object_name, - ACPI_NAMED_OBJECT *acpi_device, + NATIVE_CHAR *object_name, + ACPI_NAMESPACE_NODE *device_node, u32 *address) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, object_name, NULL, &obj_desc); + status = acpi_ns_evaluate_relative (device_node, object_name, NULL, &obj_desc); if (ACPI_FAILURE (status)) { return (status); @@ -99,7 +99,7 @@ * * FUNCTION: Acpi_cm_execute_HID * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Hid - Where the HID is returned * * RETURN: Status @@ -113,16 +113,16 @@ ACPI_STATUS acpi_cm_execute_HID ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, DEVICE_ID *hid) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__HID, NULL, &obj_desc); if (ACPI_FAILURE (status)) { @@ -176,7 +176,7 @@ * * FUNCTION: Acpi_cm_execute_UID * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Uid - Where the UID is returned * * RETURN: Status @@ -190,16 +190,16 @@ ACPI_STATUS acpi_cm_execute_UID ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, DEVICE_ID *uid) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__UID, NULL, &obj_desc); if (ACPI_FAILURE (status)) { @@ -251,7 +251,7 @@ * * FUNCTION: Acpi_cm_execute_STA * - * PARAMETERS: Acpi_device - NTE for the device + * PARAMETERS: Device_node - Node for the device * *Flags - Where the status flags are returned * * RETURN: Status @@ -265,16 +265,16 @@ ACPI_STATUS acpi_cm_execute_STA ( - ACPI_NAMED_OBJECT *acpi_device, + ACPI_NAMESPACE_NODE *device_node, u32 *flags) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Execute the method */ - status = acpi_ns_evaluate_relative (acpi_device, + status = acpi_ns_evaluate_relative (device_node, METHOD_NAME__STA, NULL, &obj_desc); if (ACPI_FAILURE (status)) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmglobal.c linux/drivers/acpi/common/cmglobal.c --- v2.4.0-test8/linux/drivers/acpi/common/cmglobal.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmglobal.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmglobal - Global variables for the ACPI subsystem + * $Revision: 99 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #define DEFINE_ACPI_GLOBALS #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmglobal"); + MODULE_NAME ("cmglobal") /****************************************************************************** @@ -126,31 +126,25 @@ NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ NSP_NORMAL, /* 14 Buffer_field */ NSP_NORMAL, /* 15 Ddb_handle */ - NSP_NORMAL, /* 16 reserved */ - NSP_NORMAL, /* 17 reserved */ - NSP_NORMAL, /* 18 reserved */ - NSP_NORMAL, /* 19 reserved */ - NSP_NORMAL, /* 20 reserved */ - NSP_NORMAL, /* 21 reserved */ - NSP_NORMAL, /* 22 reserved */ - NSP_NORMAL, /* 23 reserved */ - NSP_NORMAL, /* 24 reserved */ - NSP_NORMAL, /* 25 Def_field */ - NSP_NORMAL, /* 26 Bank_field */ - NSP_NORMAL, /* 27 Index_field */ - NSP_NORMAL, /* 28 Def_field_defn */ - NSP_NORMAL, /* 29 Bank_field_defn */ - NSP_NORMAL, /* 30 Index_field_defn */ - NSP_NORMAL, /* 31 If */ - NSP_NORMAL, /* 32 Else */ - NSP_NORMAL, /* 33 While */ - NSP_NEWSCOPE, /* 34 Scope */ - NSP_LOCAL, /* 35 Def_any */ - NSP_NORMAL, /* 36 Reference */ - NSP_NORMAL, /* 37 Alias */ - NSP_NORMAL, /* 38 Notify */ - NSP_NORMAL, /* 39 Address Handler */ - NSP_NORMAL /* 40 Invalid */ + NSP_NORMAL, /* 16 Debug Object */ + NSP_NORMAL, /* 17 Def_field */ + NSP_NORMAL, /* 18 Bank_field */ + NSP_NORMAL, /* 19 Index_field */ + NSP_NORMAL, /* 20 Reference */ + NSP_NORMAL, /* 21 Alias */ + NSP_NORMAL, /* 22 Notify */ + NSP_NORMAL, /* 23 Address Handler */ + NSP_NORMAL, /* 24 Def_field_defn */ + NSP_NORMAL, /* 25 Bank_field_defn */ + NSP_NORMAL, /* 26 Index_field_defn */ + NSP_NORMAL, /* 27 If */ + NSP_NORMAL, /* 28 Else */ + NSP_NORMAL, /* 29 While */ + NSP_NEWSCOPE, /* 30 Scope */ + NSP_LOCAL, /* 31 Def_any */ + NSP_NORMAL, /* 32 Method Arg */ + NSP_NORMAL, /* 33 Method Local */ + NSP_NORMAL /* 34 Invalid */ }; @@ -204,11 +198,11 @@ if ((type < INTERNAL_TYPE_BEGIN) || (type > INTERNAL_TYPE_MAX)) { - return FALSE; + return (FALSE); } } - return TRUE; + return (TRUE); } @@ -224,16 +218,60 @@ * ****************************************************************************/ -char * +NATIVE_CHAR * acpi_cm_format_exception ( ACPI_STATUS status) { + NATIVE_CHAR *exception = "UNKNOWN_STATUS"; + ACPI_STATUS sub_status; + + + sub_status = (status & ~AE_CODE_MASK); + - if (status > ACPI_MAX_STATUS) { - return "UNKNOWN_STATUS"; + switch (status & AE_CODE_MASK) + { + case AE_CODE_ENVIRONMENTAL: + + if (sub_status <= AE_CODE_ENV_MAX) { + exception = acpi_gbl_exception_names_env [sub_status]; + } + break; + + case AE_CODE_PROGRAMMER: + + if (sub_status <= AE_CODE_PGM_MAX) { + exception = acpi_gbl_exception_names_pgm [sub_status -1]; + } + break; + + case AE_CODE_ACPI_TABLES: + + if (sub_status <= AE_CODE_TBL_MAX) { + exception = acpi_gbl_exception_names_tbl [sub_status -1]; + } + break; + + case AE_CODE_AML: + + if (sub_status <= AE_CODE_AML_MAX) { + exception = acpi_gbl_exception_names_aml [sub_status -1]; + } + break; + + case AE_CODE_CONTROL: + + if (sub_status <= AE_CODE_CTRL_MAX) { + exception = acpi_gbl_exception_names_ctrl [sub_status -1]; + } + break; + + default: + break; } - return (acpi_gbl_exception_names [status]); + + return (exception); } @@ -389,6 +427,11 @@ acpi_gbl_parse_cache_requests = 0; acpi_gbl_parse_cache_hits = 0; + acpi_gbl_ext_parse_cache = NULL; + acpi_gbl_ext_parse_cache_depth = 0; + acpi_gbl_ext_parse_cache_requests = 0; + acpi_gbl_ext_parse_cache_hits = 0; + acpi_gbl_object_cache = NULL; acpi_gbl_object_cache_depth = 0; acpi_gbl_object_cache_requests = 0; @@ -402,7 +445,7 @@ /* Interpreter */ acpi_gbl_buf_seq = 0; - acpi_gbl_named_object_err = FALSE; + acpi_gbl_node_err = FALSE; /* Parser */ @@ -418,18 +461,15 @@ /* Namespace */ - acpi_gbl_root_name_table.next_table = NULL; - acpi_gbl_root_name_table.parent_entry = NULL; - acpi_gbl_root_name_table.parent_table = NULL; - - acpi_gbl_root_object = acpi_gbl_root_name_table.entries; - - acpi_gbl_root_object->name = ACPI_ROOT_NAME; - acpi_gbl_root_object->data_type = ACPI_DESC_TYPE_NAMED; - acpi_gbl_root_object->type = ACPI_TYPE_ANY; - acpi_gbl_root_object->this_index = 0; - acpi_gbl_root_object->child_table = NULL; - acpi_gbl_root_object->object = NULL; + acpi_gbl_root_node = NULL; + + acpi_gbl_root_node_struct.name = ACPI_ROOT_NAME; + acpi_gbl_root_node_struct.data_type = ACPI_DESC_TYPE_NAMED; + acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY; + acpi_gbl_root_node_struct.child = NULL; + acpi_gbl_root_node_struct.peer = NULL; + acpi_gbl_root_node_struct.object = NULL; + acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; /* Memory allocation metrics - compiled out in non-debug mode. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cminit.c linux/drivers/acpi/common/cminit.c --- v2.4.0-test8/linux/drivers/acpi/common/cminit.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cminit.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cminit - Common ACPI subsystem initialization + * $Revision: 79 $ * *****************************************************************************/ @@ -25,14 +25,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" -#include "parser.h" -#include "dispatch.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acparser.h" +#include "acdispat.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cminit"); + MODULE_NAME ("cminit") /******************************************************************************* @@ -52,7 +52,7 @@ void acpi_cm_facp_register_error ( - char *register_name, + NATIVE_CHAR *register_name, u32 value) { @@ -77,7 +77,7 @@ acpi_cm_hardware_initialize (void) { ACPI_STATUS status = AE_OK; - s32 index; + u32 index; /* Are we running on the actual hardware */ @@ -351,8 +351,9 @@ acpi_ps_delete_parse_cache (); /* Debug only - display leftover memory allocation, if any */ - +#ifdef ENABLE_DEBUGGER acpi_cm_dump_current_allocations (ACPI_UINT32_MAX, NULL); +#endif BREAKPOINT3; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmobject.c linux/drivers/acpi/common/cmobject.c --- v2.4.0-test8/linux/drivers/acpi/common/cmobject.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmobject.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: cmobject - ACPI object create/delete/size/cache routines + * $Revision: 27 $ * *****************************************************************************/ @@ -25,14 +25,14 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" #include "amlcode.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmobject"); + MODULE_NAME ("cmobject") /****************************************************************************** @@ -57,14 +57,14 @@ * ******************************************************************************/ -ACPI_OBJECT_INTERNAL * +ACPI_OPERAND_OBJECT * _cm_create_internal_object ( - char *module_name, - s32 line_number, - s32 component_id, + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, OBJECT_TYPE_INTERNAL type) { - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; /* Allocate the raw object descriptor */ @@ -79,7 +79,6 @@ /* Save the object type in the object descriptor */ object->common.type = type; - object->common.size = (u8) sizeof (ACPI_OBJECT_INTERNAL); /* Init the reference count */ @@ -88,10 +87,6 @@ /* Any per-type initialization should go here */ - /* Memory allocation metrics - compiled out in non debug mode. */ - - INCREMENT_OBJECT_METRICS (sizeof (ACPI_OBJECT_INTERNAL)); - return (object); } @@ -102,7 +97,7 @@ * * PARAMETERS: Operand - Object to be validated * - * RETURN: Validate a pointer to be an ACPI_OBJECT_INTERNAL + * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT * *****************************************************************************/ @@ -114,13 +109,13 @@ /* Check for a null pointer */ if (!object) { - return FALSE; + return (FALSE); } /* Check for a pointer within one of the ACPI tables */ if (acpi_tb_system_table_pointer (object)) { - return FALSE; + return (FALSE); } /* Check the descriptor type field */ @@ -131,13 +126,13 @@ - return FALSE; + return (FALSE); } - /* The object appears to be a valid ACPI_OBJECT_INTERNAL */ + /* The object appears to be a valid ACPI_OPERAND_OBJECT */ - return TRUE; + return (TRUE); } @@ -159,11 +154,11 @@ void * _cm_allocate_object_desc ( - char *module_name, - s32 line_number, - s32 component_id) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id) { - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; acpi_cm_acquire_mutex (ACPI_MTX_CACHES); @@ -176,8 +171,8 @@ /* There is an object available, use it */ object = acpi_gbl_object_cache; - acpi_gbl_object_cache = object->common.next; - object->common.next = NULL; + acpi_gbl_object_cache = object->cache.next; + object->cache.next = NULL; acpi_gbl_object_cache_hits++; acpi_gbl_object_cache_depth--; @@ -192,9 +187,8 @@ /* Attempt to allocate new descriptor */ - object = _cm_callocate (sizeof (ACPI_OBJECT_INTERNAL), component_id, + object = _cm_callocate (sizeof (ACPI_OPERAND_OBJECT), component_id, module_name, line_number); - if (!object) { /* Allocation failed */ @@ -203,6 +197,10 @@ return (NULL); } + + /* Memory allocation metrics - compiled out in non debug mode. */ + + INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); } /* Mark the descriptor type */ @@ -227,19 +225,19 @@ void acpi_cm_delete_object_desc ( - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object) { - /* Object must be an ACPI_OBJECT_INTERNAL */ + /* Make sure that the object isn't already in the cache */ - if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) { + if (object->common.data_type == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) { return; } - /* Make sure that the object isn't already in the cache */ + /* Object must be an ACPI_OPERAND_OBJECT */ - if (object->common.next) { + if (object->common.data_type != ACPI_DESC_TYPE_INTERNAL) { return; } @@ -251,7 +249,7 @@ * Memory allocation metrics. Call the macro here since we only * care about dynamically allocated objects. */ - DECREMENT_OBJECT_METRICS (acpi_gbl_object_cache->common.size); + DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); acpi_cm_free (object); return; @@ -261,17 +259,18 @@ /* Clear the entire object. This is important! */ - MEMSET (object, 0, sizeof (ACPI_OBJECT_INTERNAL)); - object->common.data_type = ACPI_DESC_TYPE_INTERNAL; + MEMSET (object, 0, sizeof (ACPI_OPERAND_OBJECT)); + object->common.data_type = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT; /* Put the object at the head of the global cache list */ - object->common.next = acpi_gbl_object_cache; + object->cache.next = acpi_gbl_object_cache; acpi_gbl_object_cache = object; acpi_gbl_object_cache_depth++; acpi_cm_release_mutex (ACPI_MTX_CACHES); + return; } @@ -292,7 +291,7 @@ acpi_cm_delete_object_cache ( void) { - ACPI_OBJECT_INTERNAL *next; + ACPI_OPERAND_OBJECT *next; /* Traverse the global cache list */ @@ -300,17 +299,18 @@ while (acpi_gbl_object_cache) { /* Delete one cached state object */ - next = acpi_gbl_object_cache->common.next; - acpi_gbl_object_cache->common.next = NULL; + next = acpi_gbl_object_cache->cache.next; + acpi_gbl_object_cache->cache.next = NULL; /* * Memory allocation metrics. Call the macro here since we only * care about dynamically allocated objects. */ - DECREMENT_OBJECT_METRICS (acpi_gbl_object_cache->common.size); + DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); acpi_cm_free (acpi_gbl_object_cache); acpi_gbl_object_cache = next; + acpi_gbl_object_cache_depth--; } return; @@ -333,7 +333,7 @@ void acpi_cm_init_static_object ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { @@ -345,12 +345,12 @@ /* * Clear the entire descriptor */ - MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OBJECT_INTERNAL)); + MEMSET ((void *) obj_desc, 0, sizeof (ACPI_OPERAND_OBJECT)); /* * Initialize the header fields - * 1) This is an ACPI_OBJECT_INTERNAL descriptor + * 1) This is an ACPI_OPERAND_OBJECT descriptor * 2) The size is the full object (worst case) * 3) The flags field indicates static allocation * 4) Reference count starts at one (not really necessary since the @@ -358,8 +358,7 @@ */ obj_desc->common.data_type = ACPI_DESC_TYPE_INTERNAL; - obj_desc->common.size = sizeof (ACPI_OBJECT_INTERNAL); - obj_desc->common.flags = AO_STATIC_ALLOCATION; + obj_desc->common.flags = AOPOBJ_STATIC_ALLOCATION; obj_desc->common.reference_count = 1; return; @@ -385,7 +384,7 @@ ACPI_STATUS acpi_cm_get_simple_object_size ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { u32 length; @@ -405,7 +404,7 @@ length = sizeof (ACPI_OBJECT); if (VALID_DESCRIPTOR_TYPE (internal_obj, ACPI_DESC_TYPE_NAMED)) { - /* Object is an NTE (reference), just return the length */ + /* Object is a named object (reference), just return the length */ *obj_length = (u32) ROUND_UP_TO_NATIVE_WORD (length); return (status); @@ -495,13 +494,13 @@ ACPI_STATUS acpi_cm_get_package_object_size ( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { - ACPI_OBJECT_INTERNAL *this_internal_obj; - ACPI_OBJECT_INTERNAL *parent_obj[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; - ACPI_OBJECT_INTERNAL *this_parent; + ACPI_OPERAND_OBJECT *this_internal_obj; + ACPI_OPERAND_OBJECT *parent_obj[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; + ACPI_OPERAND_OBJECT *this_parent; u32 this_index; u32 index[MAX_PACKAGE_DEPTH] = { 0,0,0,0,0 }; u32 length = 0; @@ -537,7 +536,7 @@ status = acpi_cm_get_simple_object_size (this_internal_obj, &object_space); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -603,8 +602,6 @@ } } } - - return (AE_OK); } @@ -624,7 +621,7 @@ ACPI_STATUS acpi_cm_get_object_size( - ACPI_OBJECT_INTERNAL *internal_obj, + ACPI_OPERAND_OBJECT *internal_obj, u32 *obj_length) { ACPI_STATUS status; @@ -642,7 +639,7 @@ acpi_cm_get_simple_object_size (internal_obj, obj_length); } - return status; + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmutils.c linux/drivers/acpi/common/cmutils.c --- v2.4.0-test8/linux/drivers/acpi/common/cmutils.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmutils.c Fri Sep 15 14:30:29 2000 @@ -1,8 +1,9 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: cmutils - common utility procedures + * $Revision: 18 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -24,19 +25,19 @@ #include "acpi.h" -#include "events.h" -#include "hardware.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "debugger.h" +#include "acdebug.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmutils"); + MODULE_NAME ("cmutils") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_valid_acpi_name * @@ -49,13 +50,13 @@ * 2) numeric * 3) underscore * - ****************************************************************************/ + ******************************************************************************/ u8 acpi_cm_valid_acpi_name ( u32 name) { - char *name_ptr = (char *) &name; + NATIVE_CHAR *name_ptr = (NATIVE_CHAR *) &name; u32 i; @@ -64,16 +65,16 @@ (name_ptr[i] >= 'A' && name_ptr[i] <= 'Z') || (name_ptr[i] >= '0' && name_ptr[i] <= '9'))) { - return FALSE; + return (FALSE); } } - return TRUE; + return (TRUE); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_valid_acpi_character * @@ -83,11 +84,11 @@ * * DESCRIPTION: Check for a printable character * - ****************************************************************************/ + ******************************************************************************/ u8 acpi_cm_valid_acpi_character ( - char character) + NATIVE_CHAR character) { return ((u8) ((character == '_') || @@ -96,7 +97,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_mutex_initialize * @@ -106,7 +107,7 @@ * * DESCRIPTION: Create the system mutex objects. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_mutex_initialize ( @@ -130,7 +131,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_mutex_terminate * @@ -140,7 +141,7 @@ * * DESCRIPTION: Delete all of the system mutex objects. * - ****************************************************************************/ + ******************************************************************************/ void acpi_cm_mutex_terminate ( @@ -160,7 +161,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_mutex * @@ -170,7 +171,7 @@ * * DESCRIPTION: Create a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_create_mutex ( @@ -195,7 +196,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_mutex * @@ -205,7 +206,7 @@ * * DESCRIPTION: Delete a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_delete_mutex ( @@ -228,7 +229,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_acquire_mutex * @@ -238,7 +239,7 @@ * * DESCRIPTION: Acquire a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_acquire_mutex ( @@ -252,9 +253,8 @@ } - status = - acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, - 1, WAIT_FOREVER); + status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, + 1, WAIT_FOREVER); if (ACPI_SUCCESS (status)) { acpi_gbl_acpi_mutex_info[mutex_id].locked = TRUE; @@ -265,7 +265,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_release_mutex * @@ -275,7 +275,7 @@ * * DESCRIPTION: Release a mutex object. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_cm_release_mutex ( @@ -291,14 +291,14 @@ acpi_gbl_acpi_mutex_info[mutex_id].locked = FALSE; /* Mark before unlocking */ - status = - acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1); + status = acpi_os_signal_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex, 1); + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_update_state_and_push * @@ -314,7 +314,7 @@ ACPI_STATUS acpi_cm_create_update_state_and_push ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action, ACPI_GENERIC_STATE **state_list) { @@ -324,21 +324,21 @@ /* Ignore null objects; these are expected */ if (!object) { - return AE_OK; + return (AE_OK); } state = acpi_cm_create_update_state (object, action); if (!state) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } acpi_cm_push_generic_state (state_list, state); - return AE_OK; + return (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_push_generic_state * @@ -365,7 +365,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_pop_generic_state * @@ -397,7 +397,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_generic_state * @@ -433,6 +433,7 @@ acpi_gbl_generic_state_cache_depth--; acpi_cm_release_mutex (ACPI_MTX_CACHES); + } else { @@ -446,18 +447,23 @@ /* Initialize */ if (state) { + /* Always zero out the object before init */ + + MEMSET (state, 0, sizeof (ACPI_GENERIC_STATE)); + state->common.data_type = ACPI_DESC_TYPE_STATE; } - return state; + return (state); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_update_state * - * PARAMETERS: Object - Initial Object to be installed in the state + * PARAMETERS: Object - Initial Object to be installed in the + * state * Action - Update action to be performed * * RETURN: Status @@ -470,7 +476,7 @@ ACPI_GENERIC_STATE * acpi_cm_create_update_state ( - ACPI_OBJECT_INTERNAL *object, + ACPI_OPERAND_OBJECT *object, u16 action) { ACPI_GENERIC_STATE *state; @@ -480,7 +486,7 @@ state = acpi_cm_create_generic_state (); if (!state) { - return NULL; + return (NULL); } /* Init fields specific to the update struct */ @@ -492,7 +498,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_create_control_state * @@ -516,7 +522,7 @@ state = acpi_cm_create_generic_state (); if (!state) { - return NULL; + return (NULL); } @@ -528,7 +534,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_generic_state * @@ -575,7 +581,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_cm_delete_generic_state_cache * @@ -603,13 +609,14 @@ next = acpi_gbl_generic_state_cache->common.next; acpi_cm_free (acpi_gbl_generic_state_cache); acpi_gbl_generic_state_cache = next; + acpi_gbl_generic_state_cache_depth--; } return; } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_error * @@ -622,14 +629,14 @@ * * DESCRIPTION: Print error message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_error ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_ERROR, @@ -638,7 +645,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_warning * @@ -651,14 +658,14 @@ * * DESCRIPTION: Print warning message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_warning ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_WARN, @@ -667,35 +674,7 @@ } -/***************************************************************************** - * - * FUNCTION: _Report_success - * - * PARAMETERS: Module_name - Caller's module name (for error output) - * Line_number - Caller's line number (for error output) - * Component_id - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: None - * - * DESCRIPTION: Print warning message from KD table - * - ****************************************************************************/ - -void -_report_success ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) -{ - - debug_print (module_name, line_number, component_id, ACPI_OK, - "*** Success: %s\n", message); -} - - -/***************************************************************************** +/******************************************************************************* * * FUNCTION: _Report_info * @@ -708,14 +687,14 @@ * * DESCRIPTION: Print information message from KD table * - ****************************************************************************/ + ******************************************************************************/ void _report_info ( - char *module_name, - s32 line_number, - s32 component_id, - char *message) + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message) { debug_print (module_name, line_number, component_id, ACPI_INFO, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/common/cmxface.c linux/drivers/acpi/common/cmxface.c --- v2.4.0-test8/linux/drivers/acpi/common/cmxface.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/common/cmxface.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: cmxface - External interfaces for "global" ACPI functions + * $Revision: 43 $ * *****************************************************************************/ @@ -24,16 +25,16 @@ #include "acpi.h" -#include "events.h" -#include "hardware.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "achware.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "debugger.h" +#include "acdebug.h" #define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmxface"); + MODULE_NAME ("cmxface") /******************************************************************************* @@ -77,6 +78,8 @@ /* If configured, initialize the AML debugger */ + DEBUGGER_EXEC (acpi_db_initialize ()); + return (status); } @@ -100,7 +103,9 @@ /* Terminate the AML Debuger if present */ acpi_gbl_db_terminate_threads = TRUE; - acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); + + /* TBD: [Investigate] This is no longer needed?*/ +/* Acpi_cm_release_mutex (ACPI_MTX_DEBUG_CMD_READY); */ /* Shutdown and free all resources */ @@ -224,7 +229,7 @@ ACPI_BUFFER *out_buffer) { u32 length; - char *formatted_exception; + NATIVE_CHAR *formatted_exception; /* @@ -237,14 +242,7 @@ } - /* Exception must be within range */ - - if (exception > ACPI_MAX_STATUS) { - return (AE_BAD_PARAMETER); - } - - - /* Convert the exception code */ + /* Convert the exception code (Handles bad exception codes) */ formatted_exception = acpi_cm_format_exception (exception); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/cpu.c linux/drivers/acpi/cpu.c --- v2.4.0-test8/linux/drivers/acpi/cpu.c Wed Jul 12 13:21:57 2000 +++ linux/drivers/acpi/cpu.c Fri Sep 15 14:30:29 2000 @@ -25,6 +25,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("cpu") + unsigned long acpi_c2_exit_latency = ACPI_INFINITE; unsigned long acpi_c3_exit_latency = ACPI_INFINITE; unsigned long acpi_c2_enter_latency = ACPI_INFINITE; @@ -33,6 +36,7 @@ static unsigned long acpi_pblk = ACPI_INVALID; static int acpi_c2_tested = 0; static int acpi_c3_tested = 0; +static int acpi_max_c_state = 1; /* * Clear busmaster activity flag @@ -101,10 +105,14 @@ /* * start from the previous sleep level.. */ - if (sleep_level == 1) + if (sleep_level == 1 + || acpi_max_c_state < 2) goto sleep1; - if (sleep_level == 2) + + if (sleep_level == 2 + || acpi_max_c_state < 3) goto sleep2; + sleep3: sleep_level = 3; if (!acpi_c3_tested) { @@ -193,7 +201,8 @@ acpi_clear_bm_activity(facp); continue; } - if (time > acpi_c3_enter_latency) + if (time > acpi_c3_enter_latency + && acpi_max_c_state >= 3) goto sleep3; } @@ -210,7 +219,8 @@ time = TIME_BEGIN(pm_tmr); safe_halt(); time = TIME_END(pm_tmr, time); - if (time > acpi_c2_enter_latency) + if (time > acpi_c2_enter_latency + && acpi_max_c_state >= 2) goto sleep2; } @@ -260,12 +270,19 @@ return AE_OK; if (lat[2].latency < MAX_CX_STATE_LATENCY) { - printk(KERN_INFO "ACPI: C2 supported\n"); + printk(KERN_INFO "ACPI: C2"); acpi_c2_exit_latency = lat[2].latency; - } - if (lat[3].latency < MAX_CX_STATE_LATENCY) { - printk(KERN_INFO "ACPI: C3 supported\n"); - acpi_c3_exit_latency = lat[3].latency; + acpi_max_c_state = 2; + + if (lat[3].latency < MAX_CX_STATE_LATENCY) { + printk(", C3 supported\n"); + acpi_c3_exit_latency = lat[3].latency; + acpi_max_c_state = 3; + } + else { + printk(" supported\n"); + } + } memset(throttle, 0, sizeof(throttle)); @@ -291,7 +308,7 @@ { acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, - ACPI_INT32_MAX, + ACPI_UINT32_MAX, acpi_find_cpu, NULL, NULL); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/Makefile linux/drivers/acpi/dispatcher/Makefile --- v2.4.0-test8/linux/drivers/acpi/dispatcher/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/dispatcher/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsfield.c linux/drivers/acpi/dispatcher/dsfield.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsfield.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsfield.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines + * $Revision: 29 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsfield"); + MODULE_NAME ("dsfield") /* @@ -46,28 +46,28 @@ #define FIELD_UPDATE_RULE_MASK 0x60 -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_AML_ERROR; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *entry; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *node; u8 field_flags; u8 access_attribute = 0; u32 field_bit_position = 0; @@ -76,6 +76,16 @@ /* First arg is the name of the parent Op_region */ arg = op->value.arg; + if (!region_node) { + status = acpi_ns_lookup (walk_state->scope_info, arg->value.name, + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, walk_state, + ®ion_node); + + if (ACPI_FAILURE (status)) { + return (status); + } + } /* Second arg is the field flags */ @@ -111,32 +121,29 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_DEF_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_def_field_value (entry, region, - field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_def_field_value (node, region_node, field_flags, + access_attribute, field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); } - /* Keep track of bit position for the *next* field */ + /* Keep track of bit position for *next* field */ field_bit_position += arg->value.size; break; @@ -149,29 +156,29 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_bank_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new bank field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_bank_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_AML_ERROR; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *bank_reg; - ACPI_NAMED_OBJECT *entry; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *register_node; + ACPI_NAMESPACE_NODE *node; u32 bank_value; u8 field_flags; u8 access_attribute = 0; @@ -181,8 +188,18 @@ /* First arg is the name of the parent Op_region */ arg = op->value.arg; + if (!region_node) { + status = acpi_ns_lookup (walk_state->scope_info, arg->value.name, + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, walk_state, + ®ion_node); + + if (ACPI_FAILURE (status)) { + return (status); + } + } - /* Socond arg is the Bank Register */ + /* Second arg is the Bank Register */ arg = arg->next; @@ -190,7 +207,7 @@ INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &bank_reg); + NULL, ®ister_node); if (ACPI_FAILURE (status)) { return (status); @@ -236,27 +253,24 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_DEF_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_bank_field_value (entry, region, - bank_reg, bank_value, - field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_bank_field_value (node, region_node, register_node, + bank_value, field_flags, access_attribute, + field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); @@ -276,30 +290,30 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_index_field * * PARAMETERS: Op - Op containing the Field definition and args - * Region - NTE for the containing Operation Region + * Region_node - Object for the containing Operation Region * * RETURN: Status * * DESCRIPTION: Create a new index field in the specified operation region * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_index_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE region_node, ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *index_reg; - ACPI_NAMED_OBJECT *data_reg; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *index_register_node; + ACPI_NAMESPACE_NODE *data_register_node; u8 field_flags; u8 access_attribute = 0; u32 field_bit_position = 0; @@ -312,7 +326,7 @@ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string, ACPI_TYPE_ANY, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &index_reg); + NULL, &index_register_node); if (ACPI_FAILURE (status)) { return (status); @@ -326,7 +340,7 @@ INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &data_reg); + NULL, &data_register_node); if (ACPI_FAILURE (status)) { return (status); @@ -368,26 +382,24 @@ case AML_NAMEDFIELD_OP: status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)arg)->name, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)arg)->name, INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &entry); + NULL, &node); if (ACPI_FAILURE (status)) { return (status); } /* - * Initialize an object for the new NTE that is on + * Initialize an object for the new Node that is on * the object stack */ - status = acpi_aml_prep_index_field_value (entry, index_reg, - data_reg, field_flags, - access_attribute, - field_bit_position, - arg->value.size); + status = acpi_aml_prep_index_field_value (node, index_register_node, data_register_node, + field_flags, access_attribute, + field_bit_position, arg->value.size); if (ACPI_FAILURE (status)) { return (status); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmethod.c linux/drivers/acpi/dispatcher/dsmethod.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmethod.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsmethod.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing + * $Revision: 52 $ * *****************************************************************************/ @@ -25,24 +25,24 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acdebug.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsmethod"); + MODULE_NAME ("dsmethod") /******************************************************************************* * * FUNCTION: Acpi_ds_parse_method * - * PARAMETERS: Obj_handle - NTE of the method + * PARAMETERS: Obj_handle - Node of the method * Level - Current nesting level * Context - Points to a method counter * Return_value - Not used @@ -61,9 +61,9 @@ ACPI_HANDLE obj_handle) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *op; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *op; + ACPI_NAMESPACE_NODE *node; ACPI_OWNER_ID owner_id; @@ -74,10 +74,10 @@ } - /* Extract the method object from the method NTE */ + /* Extract the method object from the method Node */ - entry = (ACPI_NAMED_OBJECT*) obj_handle; - obj_desc = entry->object; + node = (ACPI_NAMESPACE_NODE *) obj_handle; + obj_desc = node->object; if (!obj_desc) { return (AE_NULL_OBJECT); } @@ -87,8 +87,7 @@ if ((obj_desc->method.concurrency != INFINITE_CONCURRENCY) && (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore (1, - obj_desc->method.concurrency, + status = acpi_os_create_semaphore (1,obj_desc->method.concurrency, &obj_desc->method.semaphore); if (ACPI_FAILURE (status)) { return (status); @@ -105,17 +104,17 @@ return (AE_NO_MEMORY); } - /* Init new op with the method name and pointer back to the NTE */ + /* Init new op with the method name and pointer back to the Node */ - acpi_ps_set_name (op, entry->name); - op->acpi_named_object = entry; + acpi_ps_set_name (op, node->name); + op->node = node; /* - * Parse the method, creating a parse tree. + * Parse the method, first pass * - * The parse also includes a first pass load of the - * namespace where newly declared named objects are + * The first pass load is + * where newly declared named objects are * added into the namespace. Actual evaluation of * the named objects (what would be called a "second * pass") happens during the actual execution of the @@ -124,7 +123,10 @@ */ status = acpi_ps_parse_aml (op, obj_desc->method.pcode, - obj_desc->method.pcode_length, 0); + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + node, NULL, NULL, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); if (ACPI_FAILURE (status)) { return (status); @@ -133,11 +135,13 @@ /* Get a new Owner_id for objects created by this method */ owner_id = acpi_cm_allocate_owner_id (OWNER_TYPE_METHOD); + obj_desc->method.owning_id = owner_id; /* Install the parsed tree in the method object */ + /* TBD: [Restructure] Obsolete field? */ + + acpi_ps_delete_parse_tree (op); - obj_desc->method.parser_op = op; - obj_desc->method.owning_id = owner_id; return (status); } @@ -147,7 +151,7 @@ * * FUNCTION: Acpi_ds_begin_method_execution * - * PARAMETERS: Method_entry - NTE of the method + * PARAMETERS: Method_node - Node of the method * Obj_desc - The method object * * RETURN: Status @@ -162,38 +166,31 @@ ACPI_STATUS acpi_ds_begin_method_execution ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; - if (!method_entry) { + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } + /* - * Lock the parser while we check for and possibly parse the - * control method + * If there is a concurrency limit on this method, we need to + * obtain a unit from the method semaphore. This releases the + * interpreter if we block */ - acpi_cm_acquire_mutex (ACPI_MTX_PARSER); - - - /* If method is not parsed at this time, we must parse it first */ - - if (!obj_desc->method.parser_op) { - - status = acpi_ds_parse_method (method_entry); - if (ACPI_FAILURE (status)) { - acpi_cm_release_mutex (ACPI_MTX_PARSER); - return (status); - } + if (obj_desc->method.semaphore) { + status = acpi_aml_system_wait_semaphore (obj_desc->method.semaphore, + WAIT_FOREVER); } @@ -204,29 +201,10 @@ * the last thread completes execution of the method */ - ((ACPI_DEFERRED_OP *) obj_desc->method.parser_op)->thread_count++; - - /* - * Parsing is complete, we can unlock the parser. Parse tree - * cannot be deleted at least until this thread completes. - */ - - acpi_cm_release_mutex (ACPI_MTX_PARSER); - - /* - * If there is a concurrency limit on this method, we need to - * obtain a unit from the method semaphore. This releases the - * interpreter if we block - */ - - if (obj_desc->method.semaphore) { - status = acpi_aml_system_wait_semaphore (obj_desc->method.semaphore, - WAIT_FOREVER); - } + obj_desc->method.thread_count++; return (status); - } @@ -247,61 +225,76 @@ acpi_ds_call_control_method ( ACPI_WALK_LIST *walk_list, ACPI_WALK_STATE *this_walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_DEFERRED_OP *method; - ACPI_NAMED_OBJECT *method_entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *method_node; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_WALK_STATE *next_walk_state; + ACPI_PARSE_STATE *parser_state; u32 i; /* - * Prev_op points to the METHOD_CALL Op. - * Get the NTE entry (in the METHOD_CALL->NAME Op) and the - * corresponding METHOD Op + * Get the namespace entry for the control method we are about to call */ - method_entry = (this_walk_state->prev_op->value.arg)->acpi_named_object; - if (!method_entry) { + method_node = this_walk_state->method_call_node; + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } - /* Parse method if necessary, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (method_entry, obj_desc); + /* Init for new method, wait on concurrency semaphore */ + + status = acpi_ds_begin_method_execution (method_node, obj_desc); if (ACPI_FAILURE (status)) { return (status); } - /* Save the (current) Op for when this walk is restarted */ - this_walk_state->method_call_op = this_walk_state->prev_op; - this_walk_state->prev_op = op; - method = obj_desc->method.parser_op; + /* Create and initialize a new parser state */ + + parser_state = acpi_ps_create_state (obj_desc->method.pcode, + obj_desc->method.pcode_length); + if (!parser_state) { + return (AE_NO_MEMORY); + } + + acpi_ps_init_scope (parser_state, NULL); + parser_state->start_node = method_node; + /* Create a new state for the preempting walk */ next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, - (ACPI_GENERIC_OP *) method, - obj_desc, walk_list); + NULL, obj_desc, walk_list); if (!next_walk_state) { + /* TBD: delete parser state */ + return (AE_NO_MEMORY); } + next_walk_state->walk_type = WALK_METHOD; + next_walk_state->method_node = method_node; + next_walk_state->parser_state = parser_state; + next_walk_state->parse_flags = this_walk_state->parse_flags; + next_walk_state->descending_callback = this_walk_state->descending_callback; + next_walk_state->ascending_callback = this_walk_state->ascending_callback; + /* The Next_op of the Next_walk will be the beginning of the method */ + /* TBD: [Restructure] -- obsolete? */ - next_walk_state->next_op = (ACPI_GENERIC_OP *) method; + next_walk_state->next_op = NULL; /* Open a new scope */ - status = acpi_ds_scope_stack_push (method_entry->child_table, + status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, next_walk_state); if (ACPI_FAILURE (status)) { goto cleanup; @@ -316,11 +309,28 @@ */ status = acpi_ds_method_data_init_args (&this_walk_state->operands[0], - this_walk_state->num_operands); + this_walk_state->num_operands, + next_walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } + + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + method_node, NULL, NULL, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); + acpi_ps_delete_parse_tree (op); + + /* * Delete the operands on the previous walkstate operand stack * (they were copied to new objects) @@ -328,6 +338,7 @@ for (i = 0; i < obj_desc->method.param_count; i++) { acpi_cm_remove_reference (this_walk_state->operands [i]); + this_walk_state->operands [i] = NULL; } /* Clear the operand stack */ @@ -364,30 +375,33 @@ ACPI_STATUS acpi_ds_restart_control_method ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL *return_desc) + ACPI_OPERAND_OBJECT *return_desc) { ACPI_STATUS status; if (return_desc) { - /* - * Get the return value (if any) from the previous method. - * NULL if no return value - */ + if (walk_state->return_used) { + /* + * Get the return value (if any) from the previous method. + * NULL if no return value + */ + + status = acpi_ds_result_stack_push (return_desc, walk_state); + if (ACPI_FAILURE (status)) { + acpi_cm_remove_reference (return_desc); + return (status); + } + } - status = acpi_ds_result_stack_push (return_desc, walk_state); - if (ACPI_FAILURE (status)) { + else { + /* + * Delete the return value if it will not be used by the + * calling method + */ acpi_cm_remove_reference (return_desc); - return (status); } - /* - * Delete the return value if it will not be used by the - * calling method - */ - - acpi_ds_delete_result_if_not_used (walk_state->method_call_op, - return_desc, walk_state); } @@ -414,9 +428,8 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_DEFERRED_OP *op; - ACPI_NAMED_OBJECT *method_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *method_node; /* The method object should be stored in the walk state */ @@ -438,66 +451,41 @@ acpi_cm_acquire_mutex (ACPI_MTX_PARSER); - /* - * The root of the method parse tree should be stored - * in the method object - */ - - op = obj_desc->method.parser_op; - if (!op) { - goto unlock_and_exit; - } /* Signal completion of the execution of this method if necessary */ if (walk_state->method_desc->method.semaphore) { status = acpi_os_signal_semaphore ( - walk_state->method_desc->method.semaphore, 1); + walk_state->method_desc->method.semaphore, 1); } /* Decrement the thread count on the method parse tree */ - op->thread_count--; - if (!op->thread_count) { + walk_state->method_desc->method.thread_count--; + if (!walk_state->method_desc->method.thread_count) { /* * There are no more threads executing this method. Perform * additional cleanup. * - * The method NTE is stored in the method Op + * The method Node is stored in the walk state */ - method_entry = op->acpi_named_object; - + method_node = walk_state->method_node; /* * Delete any namespace entries created immediately underneath * the method */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - if (method_entry->child_table) { - acpi_ns_delete_namespace_subtree (method_entry); + if (method_node->child) { + acpi_ns_delete_namespace_subtree (method_node); } /* * Delete any namespace entries created anywhere else within * the namespace */ - - acpi_ns_delete_namespace_by_owner ( - walk_state->method_desc->method.owning_id); - + acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - - /* - * Delete the method's parse tree if asked to - */ - if (acpi_gbl_when_to_parse_methods & METHOD_DELETE_AT_COMPLETION) { - acpi_ps_delete_parse_tree ( - walk_state->method_desc->method.parser_op); - - walk_state->method_desc->method.parser_op = NULL; - } } - -unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_PARSER); return (AE_OK); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmthdat.c linux/drivers/acpi/dispatcher/dsmthdat.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsmthdat.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsmthdat.c Fri Sep 15 14:30:29 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables + * $Revision: 34 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,18 +25,18 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsmthdat"); + MODULE_NAME ("dsmthdat") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_init * @@ -49,7 +49,7 @@ * This allows Ref_of and De_ref_of to work properly for these * special data types. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_init ( @@ -62,8 +62,8 @@ * Walk_state fields are initialized to zero by the * Acpi_cm_callocate(). * - * An NTE is assigned to each argument and local so - * that Ref_of() can return a pointer to the NTE. + * An Node is assigned to each argument and local so + * that Ref_of() can return a pointer to the Node. */ /* Init the method arguments */ @@ -72,10 +72,9 @@ MOVE_UNALIGNED32_TO_32 (&walk_state->arguments[i].name, NAMEOF_ARG_NTE); - walk_state->arguments[i].name |= (i << 24); - walk_state->arguments[i].data_type = ACPI_DESC_TYPE_NAMED; - walk_state->arguments[i].type = - INTERNAL_TYPE_METHOD_ARGUMENT; + walk_state->arguments[i].name |= (i << 24); + walk_state->arguments[i].data_type = ACPI_DESC_TYPE_NAMED; + walk_state->arguments[i].type = INTERNAL_TYPE_METHOD_ARGUMENT; } /* Init the method locals */ @@ -84,18 +83,16 @@ MOVE_UNALIGNED32_TO_32 (&walk_state->local_variables[i].name, NAMEOF_LOCAL_NTE); - walk_state->local_variables[i].name |= (i << 24); + walk_state->local_variables[i].name |= (i << 24); walk_state->local_variables[i].data_type = ACPI_DESC_TYPE_NAMED; - walk_state->local_variables[i].type = - INTERNAL_TYPE_METHOD_LOCAL_VAR; + walk_state->local_variables[i].type = INTERNAL_TYPE_METHOD_LOCAL_VAR; } - return (AE_OK); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_delete_all * @@ -106,14 +103,14 @@ * DESCRIPTION: Delete method locals and arguments. Arguments are only * deleted if this method was called from another method. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_delete_all ( ACPI_WALK_STATE *walk_state) { u32 index; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT *object; /* Delete the locals */ @@ -122,8 +119,11 @@ object = walk_state->local_variables[index].object; if (object) { /* Remove first */ + walk_state->local_variables[index].object = NULL; + /* Was given a ref when stored */ + acpi_cm_remove_reference (object); } } @@ -135,8 +135,11 @@ object = walk_state->arguments[index].object; if (object) { /* Remove first */ + walk_state->arguments[index].object = NULL; + /* Was given a ref when stored */ + acpi_cm_remove_reference (object); } } @@ -145,7 +148,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_init_args * @@ -155,12 +158,13 @@ * * DESCRIPTION: Initialize arguments for a method * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_init_args ( - ACPI_OBJECT_INTERNAL **params, - u32 max_param_count) + ACPI_OPERAND_OBJECT **params, + u32 max_param_count, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; u32 mindex; @@ -183,9 +187,8 @@ * Set the current method argument to the * Params[Pindex++] argument object descriptor */ - status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, - mindex, - params[pindex]); + status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, mindex, + params[pindex], walk_state); if (ACPI_FAILURE (status)) { break; } @@ -202,7 +205,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_entry * @@ -215,18 +218,16 @@ * * DESCRIPTION: Get the address of the stack entry given by Type:Index * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_get_entry ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL ***entry) + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT ***entry) { - ACPI_WALK_STATE *walk_state; - - walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list); /* * Get the requested object. @@ -243,7 +244,7 @@ } *entry = - (ACPI_OBJECT_INTERNAL **) &walk_state->local_variables[index].object; + (ACPI_OPERAND_OBJECT **) &walk_state->local_variables[index].object; break; @@ -254,7 +255,7 @@ } *entry = - (ACPI_OBJECT_INTERNAL **) &walk_state->arguments[index].object; + (ACPI_OPERAND_OBJECT **) &walk_state->arguments[index].object; break; @@ -267,7 +268,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_set_entry * @@ -279,21 +280,22 @@ * * DESCRIPTION: Insert an object onto the method stack at entry Type:Index. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_set_entry ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL *object) + ACPI_OPERAND_OBJECT *object, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; + ACPI_OPERAND_OBJECT **entry; /* Get a pointer to the stack entry to set */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -310,7 +312,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_type * @@ -321,21 +323,22 @@ * RETURN: Data type of selected Arg or Local * Used only in Exec_monadic2()/Type_op. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_method_data_get_type ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Get a pointer to the requested stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return ((ACPI_TYPE_NOT_FOUND)); } @@ -355,7 +358,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_nte * @@ -363,20 +366,17 @@ * Index - Which local_var or argument whose type * to get * - * RETURN: Get the NTE associated with a local or arg. + * RETURN: Get the Node associated with a local or arg. * - ****************************************************************************/ + ******************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ds_method_data_get_nte ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { - ACPI_NAMED_OBJECT *entry = NULL; - ACPI_WALK_STATE *walk_state; - - - walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list); + ACPI_NAMESPACE_NODE *node = NULL; switch (type) @@ -385,20 +385,20 @@ case MTH_TYPE_LOCAL: if (index > MTH_MAX_LOCAL) { - return (entry); + return (node); } - entry = &walk_state->local_variables[index]; + node = &walk_state->local_variables[index]; break; case MTH_TYPE_ARG: if (index > MTH_MAX_ARG) { - return (entry); + return (node); } - entry = &walk_state->arguments[index]; + node = &walk_state->arguments[index]; break; @@ -407,11 +407,11 @@ } - return (entry); + return (node); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_get_value * @@ -426,17 +426,18 @@ * at the current top of the method stack. * Used only in Acpi_aml_resolve_to_value(). * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_get_value ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL **dest_desc) + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **dest_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Validate the object descriptor */ @@ -448,7 +449,7 @@ /* Get a pointer to the requested method stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -494,7 +495,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_delete_value * @@ -506,21 +507,22 @@ * DESCRIPTION: Delete the entry at Type:Index on the method stack. Inserts * a null into the stack slot after the object is deleted. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_delete_value ( u32 type, - u32 index) + u32 index, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; - ACPI_OBJECT_INTERNAL *object; + ACPI_OPERAND_OBJECT **entry; + ACPI_OPERAND_OBJECT *object; /* Get a pointer to the requested entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { return (status); } @@ -532,7 +534,7 @@ /* * Undefine the Arg or Local by setting its descriptor * pointer to NULL. Locals/Args can contain both - * ACPI_OBJECT_INTERNALS and ACPI_NAMED_OBJECTs + * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs */ *entry = NULL; @@ -554,7 +556,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_method_data_set_value * @@ -573,16 +575,17 @@ * as the new value for the Arg or Local and the reference count * is incremented. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_method_data_set_value ( u32 type, u32 index, - ACPI_OBJECT_INTERNAL *src_desc) + ACPI_OPERAND_OBJECT *src_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **entry; + ACPI_OPERAND_OBJECT **entry; /* Parameter validation */ @@ -594,7 +597,7 @@ /* Get a pointer to the requested method stack entry */ - status = acpi_ds_method_data_get_entry (type, index, &entry); + status = acpi_ds_method_data_get_entry (type, index, walk_state, &entry); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -614,7 +617,7 @@ if (*entry) { /* * Check for an indirect store if an argument - * contains an object reference (stored as an NTE). + * contains an object reference (stored as an Node). * We don't allow this automatic dereferencing for * locals, since a store to a local should overwrite * anything there, including an object reference. @@ -632,16 +635,16 @@ if ((type == MTH_TYPE_ARG) && (VALID_DESCRIPTOR_TYPE (*entry, ACPI_DESC_TYPE_NAMED))) { - /* Detach an existing object from the NTE */ + /* Detach an existing object from the Node */ - acpi_ns_detach_object (*entry); + acpi_ns_detach_object ((ACPI_NAMESPACE_NODE *) *entry); /* - * Store this object into the NTE + * Store this object into the Node * (do the indirect store) */ - status = acpi_ns_attach_object (*entry, src_desc, + status = acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) *entry, src_desc, src_desc->common.type); return (status); } @@ -652,7 +655,7 @@ * before storing the new one */ - acpi_ds_method_data_delete_value (type, index); + acpi_ds_method_data_delete_value (type, index, walk_state); } @@ -663,7 +666,7 @@ * (increments the object reference count by one) */ - status = acpi_ds_method_data_set_entry (type, index, src_desc); + status = acpi_ds_method_data_set_entry (type, index, src_desc, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsobject.c linux/drivers/acpi/dispatcher/dsobject.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsobject.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsobject.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines + * $Revision: 43 $ * *****************************************************************************/ @@ -25,21 +25,21 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsobject"); + MODULE_NAME ("dsobject") /******************************************************************************* * * FUNCTION: Acpi_ds_init_one_object * - * PARAMETERS: Obj_handle - NTE of the object + * PARAMETERS: Obj_handle - Node * Level - Current nesting level * Context - Points to a init info struct * Return_value - Not used @@ -64,7 +64,6 @@ { OBJECT_TYPE_INTERNAL type; ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; INIT_WALK_INFO *info = (INIT_WALK_INFO *) context; @@ -73,10 +72,10 @@ * was just loaded */ - if (((ACPI_NAMED_OBJECT*) obj_handle)->owner_id != + if (((ACPI_NAMESPACE_NODE *) obj_handle)->owner_id != info->table_desc->table_id) { - return AE_OK; + return (AE_OK); } @@ -119,12 +118,7 @@ */ if (acpi_gbl_when_to_parse_methods != METHOD_PARSE_AT_INIT) { - acpi_ns_delete_namespace_subtree (obj_handle); - - obj_desc = ((ACPI_NAMED_OBJECT*)obj_handle)->object; - acpi_ps_delete_parse_tree (obj_desc->method.parser_op); - obj_desc->method.parser_op = NULL; } break; @@ -149,15 +143,15 @@ * * RETURN: Status * - * DESCRIPTION: Walk the entire namespace and perform any necessary initialization - * on the objects found therein + * DESCRIPTION: Walk the entire namespace and perform any necessary + * initialization on the objects found therein * ******************************************************************************/ ACPI_STATUS acpi_ds_initialize_objects ( ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *start_entry) + ACPI_NAMESPACE_NODE *start_node) { ACPI_STATUS status; INIT_WALK_INFO info; @@ -170,8 +164,8 @@ /* Walk entire namespace from the supplied root */ - status = acpi_walk_namespace (ACPI_TYPE_ANY, start_entry, - ACPI_INT32_MAX, acpi_ds_init_one_object, + status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, + ACPI_UINT32_MAX, acpi_ds_init_one_object, &info, NULL); return (AE_OK); @@ -197,28 +191,28 @@ ACPI_STATUS acpi_ds_init_object_from_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u16 opcode, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT **obj_desc) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_BYTELIST_OP *byte_list; - ACPI_OBJECT_INTERNAL *arg_desc; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *arg; + ACPI_PARSE2_OBJECT *byte_list; + ACPI_OPERAND_OBJECT *arg_desc; + ACPI_OPCODE_INFO *op_info; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Unknown opcode */ - return AE_TYPE; + return (AE_TYPE); } /* Get and prepare the first argument */ - switch (obj_desc->common.type) + switch ((*obj_desc)->common.type) { case ACPI_TYPE_BUFFER: @@ -230,31 +224,31 @@ /* Resolve the object (could be an arg or local) */ - status = acpi_aml_resolve_to_value (&arg_desc); + status = acpi_aml_resolve_to_value (&arg_desc, walk_state); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (arg_desc); - return status; + return (status); } /* We are expecting a number */ if (arg_desc->common.type != ACPI_TYPE_NUMBER) { acpi_cm_remove_reference (arg_desc); - return AE_TYPE; + return (AE_TYPE); } /* Get the value, delete the internal object */ - obj_desc->buffer.length = arg_desc->number.value; + (*obj_desc)->buffer.length = arg_desc->number.value; acpi_cm_remove_reference (arg_desc); /* Allocate the buffer */ - obj_desc->buffer.pointer = - acpi_cm_callocate (obj_desc->buffer.length); + (*obj_desc)->buffer.pointer = + acpi_cm_callocate ((*obj_desc)->buffer.length); - if (!obj_desc->buffer.pointer) { - return AE_NO_MEMORY; + if (!(*obj_desc)->buffer.pointer) { + return (AE_NO_MEMORY); } /* @@ -265,27 +259,42 @@ /* skip first arg */ arg = op->value.arg; - byte_list = (ACPI_BYTELIST_OP *) arg->next; + byte_list = (ACPI_PARSE2_OBJECT *) arg->next; if (byte_list) { if (byte_list->opcode != AML_BYTELIST_OP) { - return AE_TYPE; + return (AE_TYPE); } - MEMCPY (obj_desc->buffer.pointer, byte_list->data, - obj_desc->buffer.length); + MEMCPY ((*obj_desc)->buffer.pointer, byte_list->data, + (*obj_desc)->buffer.length); } break; + case ACPI_TYPE_PACKAGE: + + /* + * When called, an internal package object has already + * been built and is pointed to by *Obj_desc. + * Acpi_ds_build_internal_object build another internal + * package object, so remove reference to the original + * so that it is deleted. Error checking is done + * within the remove reference function. + */ + acpi_cm_remove_reference(*obj_desc); + + status = acpi_ds_build_internal_object (walk_state, op, obj_desc); + break; + case ACPI_TYPE_NUMBER: - obj_desc->number.value = op->value.integer; + (*obj_desc)->number.value = op->value.integer; break; case ACPI_TYPE_STRING: - obj_desc->string.pointer = op->value.string; - obj_desc->string.length = STRLEN (op->value.string); + (*obj_desc)->string.pointer = op->value.string; + (*obj_desc)->string.length = STRLEN (op->value.string); break; @@ -295,33 +304,33 @@ case INTERNAL_TYPE_REFERENCE: - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_LOCAL_VARIABLE: /* Split the opcode into a base opcode + offset */ - obj_desc->reference.op_code = AML_LOCAL_OP; - obj_desc->reference.offset = opcode - AML_LOCAL_OP; + (*obj_desc)->reference.op_code = AML_LOCAL_OP; + (*obj_desc)->reference.offset = opcode - AML_LOCAL_OP; break; case OPTYPE_METHOD_ARGUMENT: /* Split the opcode into a base opcode + offset */ - obj_desc->reference.op_code = AML_ARG_OP; - obj_desc->reference.offset = opcode - AML_ARG_OP; + (*obj_desc)->reference.op_code = AML_ARG_OP; + (*obj_desc)->reference.offset = opcode - AML_ARG_OP; break; default: /* Constants, Literals, etc.. */ if (op->opcode == AML_NAMEPATH_OP) { - /* Nte was saved in Op */ + /* Node was saved in Op */ - obj_desc->reference.nte = op->acpi_named_object; + (*obj_desc)->reference.node = op->node; } - obj_desc->reference.op_code = opcode; + (*obj_desc)->reference.op_code = opcode; break; } @@ -333,7 +342,7 @@ break; } - return AE_OK; + return (AE_OK); } @@ -354,10 +363,10 @@ ACPI_STATUS acpi_ds_build_internal_simple_obj ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; OBJECT_TYPE_INTERNAL type; ACPI_STATUS status; @@ -369,13 +378,13 @@ * Otherwise, go ahead and look it up now */ - if (!op->acpi_named_object) { + if (!op->node) { status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, - (ACPI_NAMED_OBJECT**)&(op->acpi_named_object)); + (ACPI_NAMESPACE_NODE **)&(op->node)); if (ACPI_FAILURE (status)) { return (status); @@ -403,7 +412,7 @@ } status = acpi_ds_init_object_from_op (walk_state, op, - op->opcode, obj_desc); + op->opcode, &obj_desc); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); @@ -433,11 +442,11 @@ ACPI_STATUS acpi_ds_build_internal_package_obj ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status = AE_OK; @@ -466,7 +475,7 @@ REPORT_ERROR ("Ds_build_internal_package_obj: Package vector allocation failure"); - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); return (AE_NO_MEMORY); } @@ -514,8 +523,8 @@ ACPI_STATUS acpi_ds_build_internal_object ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr) + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr) { ACPI_STATUS status; @@ -536,7 +545,7 @@ /***************************************************************************** * - * FUNCTION: Acpi_ds_create_named_object + * FUNCTION: Acpi_ds_create_node * * PARAMETERS: Op - Parser object to be translated * Obj_desc_ptr - Where the ACPI internal object is returned @@ -548,13 +557,13 @@ ****************************************************************************/ ACPI_STATUS -acpi_ds_create_named_object ( +acpi_ds_create_node ( ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT *entry, - ACPI_GENERIC_OP *op) + ACPI_NAMESPACE_NODE *node, + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; if (!op->value.arg) { @@ -575,12 +584,12 @@ /* Re-type the object according to it's argument */ - entry->type = obj_desc->common.type; + node->type = obj_desc->common.type; /* Init obj */ - status = acpi_ns_attach_object ((ACPI_HANDLE) entry, obj_desc, - (u8) entry->type); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) node->type); if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsopcode.c linux/drivers/acpi/dispatcher/dsopcode.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsopcode.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsopcode.c Fri Sep 15 14:30:29 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * - * Module Name: dsopcode - Dispatcher Op Region support - * and handling of "control" opcodes + * Module Name: dsopcode - Dispatcher Op Region support and handling of + * "control" opcodes + * $Revision: 17 $ * *****************************************************************************/ @@ -26,16 +26,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "events.h" -#include "tables.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dsopcode"); + MODULE_NAME ("dsopcode") /***************************************************************************** @@ -53,23 +53,23 @@ ACPI_STATUS acpi_ds_get_region_arguments ( - ACPI_OBJECT_INTERNAL *rgn_desc) + ACPI_OPERAND_OBJECT *rgn_desc) { - ACPI_OBJECT_INTERNAL *method_desc; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *op; - ACPI_GENERIC_OP *region_op; + ACPI_OPERAND_OBJECT *method_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *op; + ACPI_PARSE_OBJECT *region_op; ACPI_STATUS status; ACPI_TABLE_DESC *table_desc; - if (rgn_desc->region.region_flags & REGION_AGRUMENT_DATA_VALID) { + if (rgn_desc->region.flags & AOPOBJ_DATA_VALID) { return (AE_OK); } method_desc = rgn_desc->region.method; - entry = rgn_desc->region.nte; + node = rgn_desc->region.node; /* @@ -77,18 +77,18 @@ * Op_region tree */ - op = acpi_ps_alloc_op (AML_REGION_OP); + op = acpi_ps_alloc_op (AML_SCOPE_OP); if (!op) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } - /* Save the NTE for use in Acpi_ps_parse_aml */ + /* Save the Node for use in Acpi_ps_parse_aml */ - op->acpi_named_object = acpi_ns_get_parent_entry (entry); + op->node = acpi_ns_get_parent_object (node); /* Get a handle to the parent ACPI table */ - status = acpi_tb_handle_to_object (entry->owner_id, &table_desc); + status = acpi_tb_handle_to_object (node->owner_id, &table_desc); if (ACPI_FAILURE (status)) { return (status); } @@ -96,20 +96,44 @@ /* Parse the entire Op_region declaration, creating a parse tree */ status = acpi_ps_parse_aml (op, method_desc->method.pcode, - method_desc->method.pcode_length, 0); - if (ACPI_SUCCESS (status)) { - /* Get and init the actual Region_op created above */ - - region_op = op->value.arg; - region_op->acpi_named_object = entry; - - /* Acpi_evaluate the address and length arguments for the Op_region */ - - acpi_ps_walk_parsed_aml (region_op, region_op, NULL, NULL, NULL, - NULL, table_desc->table_id, - acpi_ds_exec_begin_op, acpi_ds_exec_end_op); + method_desc->method.pcode_length, 0, + NULL, NULL, NULL, acpi_ds_load1_begin_op, acpi_ds_load1_end_op); + + if (ACPI_FAILURE (status)) { + acpi_ps_delete_parse_tree (op); + return (status); } + + /* Get and init the actual Region_op created above */ + +/* Region_op = Op->Value.Arg; + Op->Node = Node;*/ + + + region_op = op->value.arg; + region_op->node = node; + acpi_ps_delete_parse_tree (op); + + /* Acpi_evaluate the address and length arguments for the Op_region */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + op->node = acpi_ns_get_parent_object (node); + + status = acpi_ps_parse_aml (op, method_desc->method.pcode, + method_desc->method.pcode_length, + ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, + NULL /*Method_desc*/, NULL, NULL, + acpi_ds_exec_begin_op, acpi_ds_exec_end_op); +/* + Acpi_ps_walk_parsed_aml (Region_op, Region_op, NULL, NULL, NULL, + NULL, Table_desc->Table_id, + Acpi_ds_exec_begin_op, Acpi_ds_exec_end_op); +*/ /* All done with the parse tree, delete it */ acpi_ps_delete_parse_tree (op); @@ -134,7 +158,7 @@ acpi_ds_initialize_region ( ACPI_HANDLE obj_handle) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -144,7 +168,7 @@ status = acpi_ev_initialize_region (obj_desc, FALSE); - return status; + return (status); } @@ -164,20 +188,20 @@ ACPI_STATUS acpi_ds_eval_region_operands ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *region_desc; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *next_op; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *region_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *next_op; /* * This is where we evaluate the address and length fields of the Op_region declaration */ - entry = op->acpi_named_object; + node = op->node; /* Next_op points to the op that holds the Space_iD */ next_op = op->value.arg; @@ -192,7 +216,7 @@ return (status); } - region_desc = acpi_ns_get_attached_object (entry); + region_desc = acpi_ns_get_attached_object (node); if (!region_desc) { return (AE_NOT_EXIST); } @@ -216,7 +240,7 @@ /* Now the address and length are valid for this opregion */ - region_desc->region.region_flags |= REGION_AGRUMENT_DATA_VALID; + region_desc->region.flags |= AOPOBJ_DATA_VALID; return (status); } @@ -239,7 +263,7 @@ ACPI_STATUS acpi_ds_exec_begin_control_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; ACPI_GENERIC_STATE *control_state; @@ -263,6 +287,14 @@ } acpi_cm_push_generic_state (&walk_state->control_state, control_state); + + /* + * Save a pointer to the predicate for multiple executions + * of a loop + */ + walk_state->control_state->control.aml_predicate_start = + walk_state->parser_state->aml - 1; + /*Acpi_ps_pkg_length_encoding_size (GET8 (Walk_state->Parser_state->Aml));*/ break; @@ -287,7 +319,7 @@ break; } - return status; + return (status); } @@ -309,7 +341,7 @@ ACPI_STATUS acpi_ds_exec_end_control_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; ACPI_GENERIC_STATE *control_state; @@ -350,16 +382,18 @@ if (walk_state->control_state->common.value) { /* Predicate was true, go back and evaluate it again! */ - status = AE_CTRL_TRUE; + status = AE_CTRL_PENDING; } - else { +/* else {*/ /* Pop this control state and free it */ control_state = acpi_cm_pop_generic_state (&walk_state->control_state); + + walk_state->aml_last_while = control_state->control.aml_predicate_start; acpi_cm_delete_generic_state (control_state); - } +/* }*/ break; @@ -367,44 +401,62 @@ case AML_RETURN_OP: - /* One optional operand -- the return value */ - + /* + * One optional operand -- the return value + * It can be either an immediate operand or a result that + * has been bubbled up the tree + */ if (op->value.arg) { + /* Return statement has an immediate operand */ + status = acpi_ds_create_operands (walk_state, op->value.arg); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* - * TBD: [Restructure] Just check for NULL arg - * to signify no return value??? - */ - - /* * If value being returned is a Reference (such as * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - status = acpi_aml_resolve_to_value (&walk_state->operands [0]); + status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* * Get the return value and save as the last result - * value - * This is the only place where Walk_state->Return_desc + * value. This is the only place where Walk_state->Return_desc * is set to anything other than zero! */ walk_state->return_desc = walk_state->operands[0]; } + else if (walk_state->num_results > 0) { + /* + * The return value has come from a previous calculation. + * + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + */ + + status = acpi_aml_resolve_to_value (&walk_state->results [0], walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } + + walk_state->return_desc = walk_state->results [0]; + } + else { /* No return operand */ - acpi_cm_remove_reference (walk_state->operands [0]); + if (walk_state->num_operands) { + acpi_cm_remove_reference (walk_state->operands [0]); + } walk_state->operands [0] = NULL; walk_state->num_operands = 0; @@ -417,7 +469,7 @@ break; - case AML_NOOP_CODE: + case AML_NOOP_OP: /* Just do nothing! */ break; @@ -459,6 +511,6 @@ } - return status; + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dsutils.c linux/drivers/acpi/dispatcher/dsutils.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dsutils.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dsutils.c Fri Sep 15 14:30:29 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: dsutils - Dispatcher utilities + * $Revision: 44 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,20 +25,20 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT PARSER - MODULE_NAME ("dsutils"); + MODULE_NAME ("dsutils") -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ds_delete_result_if_not_used + * FUNCTION: Acpi_ds_is_result_used * * PARAMETERS: Op * Result_obj @@ -46,52 +46,32 @@ * * RETURN: Status * - * DESCRIPTION: Used after interpretation of an opcode. If there is an internal - * result descriptor, check if the parent opcode will actually use - * this result. If not, delete the result now so that it will - * not become orphaned. + * DESCRIPTION: Check if a result object will be used by the parent * - ****************************************************************************/ + ******************************************************************************/ -void -acpi_ds_delete_result_if_not_used ( - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL *result_obj, - ACPI_WALK_STATE *walk_state) +u8 +acpi_ds_is_result_used ( + ACPI_PARSE_OBJECT *op) { - ACPI_OP_INFO *parent_info; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_STATUS status; + ACPI_OPCODE_INFO *parent_info; + + /* Must have both an Op and a Result Object */ if (!op) { - return; + return (TRUE); } - if (!result_obj) { - return; - } + /* + * If there is no parent, the result can't possibly be used! + * (An executing method typically has no parent, since each + * method is parsed separately) However, a method that is + * invoked from another method has a parent. + */ if (!op->parent) { - /* - * If there is no parent, the result can't possibly be used! - * (An executing method typically has no parent, since each - * method is parsed separately - */ - - /* - * Must pop the result stack (Obj_desc should be equal - * to Result_obj) - */ - - status = acpi_ds_result_stack_pop (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return; - } - - acpi_cm_remove_reference (result_obj); - - return; + return (FALSE); } @@ -100,15 +80,15 @@ */ parent_info = acpi_ps_get_opcode_info (op->parent->opcode); - if (!parent_info) { - return; + if (ACPI_GET_OP_TYPE (parent_info) != ACPI_OP_TYPE_OPCODE) { + return (FALSE); } /* Never delete the return value associated with a return opcode */ if (op->parent->opcode == AML_RETURN_OP) { - return; + return (TRUE); } @@ -119,26 +99,15 @@ * as an operand later. */ - switch (parent_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (parent_info)) { /* - * In these cases, the parent will never use the return object, - * so delete it here and now. + * In these cases, the parent will never use the return object */ case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */ - /* - * Must pop the result stack (Obj_desc should be equal - * to Result_obj) - */ - - status = acpi_ds_result_stack_pop (&obj_desc, walk_state); - if (ACPI_FAILURE (status)) { - return; - } - - acpi_cm_remove_reference (result_obj); + return (FALSE); break; /* @@ -149,11 +118,63 @@ break; } + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ds_delete_result_if_not_used + * + * PARAMETERS: Op + * Result_obj + * Walk_state + * + * RETURN: Status + * + * DESCRIPTION: Used after interpretation of an opcode. If there is an internal + * result descriptor, check if the parent opcode will actually use + * this result. If not, delete the result now so that it will + * not become orphaned. + * + ******************************************************************************/ + +void +acpi_ds_delete_result_if_not_used ( + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT *result_obj, + ACPI_WALK_STATE *walk_state) +{ + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_STATUS status; + + + if (!op) { + return; + } + + if (!result_obj) { + return; + } + + + if (!acpi_ds_is_result_used (op)) { + /* + * Must pop the result stack (Obj_desc should be equal + * to Result_obj) + */ + + status = acpi_ds_result_stack_pop (&obj_desc, walk_state); + if (ACPI_SUCCESS (status)) { + acpi_cm_remove_reference (result_obj); + } + } + return; } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_operand * @@ -167,19 +188,19 @@ * looking up a name or entering a new name into the internal * namespace. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_operand ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *arg) + ACPI_PARSE_OBJECT *arg) { ACPI_STATUS status = AE_OK; - char *name_string; + NATIVE_CHAR *name_string; u32 name_length; OBJECT_TYPE_INTERNAL data_type; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *parent_op; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *parent_op; u16 opcode; u32 flags; OPERATING_MODE interpreter_mode; @@ -214,7 +235,7 @@ */ parent_op = arg->parent; - if ((acpi_ps_is_named_object_op (parent_op->opcode)) && + if ((acpi_ps_is_node_op (parent_op->opcode)) && (parent_op->opcode != AML_METHODCALL_OP) && (parent_op->opcode != AML_NAMEPATH_OP)) { @@ -233,7 +254,7 @@ ACPI_TYPE_ANY, interpreter_mode, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, walk_state, - (ACPI_NAMED_OBJECT**) &obj_desc); + (ACPI_NAMESPACE_NODE **) &obj_desc); /* Free the namestring created above */ @@ -252,7 +273,7 @@ * indicate this to the interpreter, set the * object to the root */ - obj_desc = (ACPI_OBJECT_INTERNAL *) acpi_gbl_root_object; + obj_desc = (ACPI_OPERAND_OBJECT *) acpi_gbl_root_node; status = AE_OK; } @@ -277,6 +298,7 @@ if (ACPI_FAILURE (status)) { return (status); } + DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); } @@ -311,6 +333,8 @@ } if (flags & OP_HAS_RETURN_VALUE) { + DEBUGGER_EXEC (acpi_db_display_argument_object (walk_state->operands [walk_state->num_operands - 1], walk_state)); + /* * Use value that was already previously returned * by the evaluation of this argument @@ -338,9 +362,9 @@ /* Initialize the new object */ status = acpi_ds_init_object_from_op (walk_state, arg, - opcode, obj_desc); + opcode, &obj_desc); if (ACPI_FAILURE (status)) { - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); return (status); } } @@ -352,13 +376,14 @@ return (status); } + DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); } return (AE_OK); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_create_operands * @@ -370,15 +395,15 @@ * namespace objects and place those argument object on the object * stack in preparation for evaluation by the interpreter. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_create_operands ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *first_arg) + ACPI_PARSE_OBJECT *first_arg) { ACPI_STATUS status = AE_OK; - ACPI_GENERIC_OP *arg; + ACPI_PARSE_OBJECT *arg; u32 args_pushed = 0; @@ -416,7 +441,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_resolve_operands * @@ -428,7 +453,7 @@ * arguments to a control method invocation (a call from one * method to another.) * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ds_resolve_operands ( @@ -449,7 +474,7 @@ */ for (i = 0; i < walk_state->num_operands; i++) { - status = acpi_aml_resolve_to_value (&walk_state->operands[i]); + status = acpi_aml_resolve_to_value (&walk_state->operands[i], walk_state); if (ACPI_FAILURE (status)) { break; } @@ -459,7 +484,7 @@ } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_map_opcode_to_data_type * @@ -472,7 +497,7 @@ * if any. If the opcode returns a value as part of the * intepreter execution, a flag is returned in Out_flags. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_map_opcode_to_data_type ( @@ -480,18 +505,18 @@ u32 *out_flags) { OBJECT_TYPE_INTERNAL data_type = INTERNAL_TYPE_INVALID; - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; u32 flags = 0; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Unknown opcode */ - return data_type; + return (data_type); } - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_LITERAL: @@ -552,6 +577,7 @@ case OPTYPE_DYADIC2_s: case OPTYPE_INDEX: case OPTYPE_MATCH: + case OPTYPE_RETURN: flags = OP_HAS_RETURN_VALUE; data_type = ACPI_TYPE_ANY; @@ -592,11 +618,11 @@ *out_flags = flags; } - return data_type; + return (data_type); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ds_map_named_opcode_to_data_type * @@ -607,7 +633,7 @@ * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. * Named opcodes are a subsystem of the AML opcodes. * - ****************************************************************************/ + ******************************************************************************/ OBJECT_TYPE_INTERNAL acpi_ds_map_named_opcode_to_data_type ( @@ -688,7 +714,7 @@ } - return data_type; + return (data_type); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswexec.c linux/drivers/acpi/dispatcher/dswexec.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswexec.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dswexec.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * * Module Name: dswexec - Dispatcher method execution callbacks; - * Dispatch to interpreter. + * dispatch to interpreter. + * $Revision: 42 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "debugger.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswexec"); + MODULE_NAME ("dswexec") /***************************************************************************** @@ -55,14 +56,29 @@ ACPI_STATUS acpi_ds_exec_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; ACPI_STATUS status = AE_OK; + if (!op) { + status = acpi_ds_load2_begin_op (opcode, NULL, walk_state, out_op); + if (ACPI_FAILURE (status)) { + return (status); + } + + op = *out_op; + } + if (op == walk_state->origin) { + if (out_op) { + *out_op = op; + } + return (AE_OK); } @@ -97,7 +113,7 @@ * Handle the opcode based upon the opcode type */ - switch (op_info->flags & OP_INFO_TYPE) + switch (ACPI_GET_OP_CLASS (op_info)) { case OPTYPE_CONTROL: @@ -107,7 +123,7 @@ case OPTYPE_NAMED_OBJECT: - if (walk_state->origin->opcode == AML_METHOD_OP) { + if (walk_state->walk_type == WALK_METHOD) { /* * Found a named object declaration during method * execution; we must enter this object into the @@ -116,7 +132,7 @@ * of this method. */ - status = acpi_ds_load2_begin_op (walk_state, op); + status = acpi_ds_load2_begin_op (op->opcode, op, walk_state, NULL); } break; @@ -150,17 +166,17 @@ ACPI_STATUS acpi_ds_exec_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; u16 opcode; u8 optype; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_GENERIC_OP *next_op; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *first_arg; - ACPI_OBJECT_INTERNAL *result_obj = NULL; - ACPI_OP_INFO *op_info; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_PARSE_OBJECT *next_op; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *first_arg; + ACPI_OPERAND_OBJECT *result_obj = NULL; + ACPI_OPCODE_INFO *op_info; u32 operand_index; @@ -168,11 +184,11 @@ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_NOT_IMPLEMENTED); } - optype = (u8) (op_info->flags & OP_INFO_TYPE); + optype = (u8) ACPI_GET_OP_CLASS (op_info); first_arg = op->value.arg; /* Init the walk state */ @@ -183,6 +199,9 @@ /* Call debugger for single step support (DEBUG build only) */ + DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, optype)); + DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return (status);}); + /* Decode the opcode */ @@ -220,6 +239,7 @@ case OPTYPE_CREATE_FIELD: case OPTYPE_FATAL: + status = acpi_ds_create_operands (walk_state, first_arg); if (ACPI_FAILURE (status)) { goto cleanup; @@ -376,12 +396,12 @@ case OPTYPE_METHOD_CALL: /* - * (AML_METHODCALL) Op->Value->Arg->Acpi_named_object contains - * the method NTE pointer + * (AML_METHODCALL) Op->Value->Arg->Node contains + * the method Node pointer */ /* Next_op points to the op that holds the method name */ next_op = first_arg; - entry = next_op->acpi_named_object; + node = next_op->node; /* Next_op points to first argument op */ next_op = next_op->next; @@ -410,7 +430,7 @@ /* Open new scope on the scope stack */ /* - Status = Acpi_ns_scope_stack_push_entry (Entry); + Status = Acpi_ns_scope_stack_push_entry (Node); if (ACPI_FAILURE (Status)) { break; } @@ -419,7 +439,7 @@ /* Tell the walk loop to preempt this running method and execute the new method */ - status = AE_CTRL_PENDING; + status = AE_CTRL_TRANSFER; /* Return now; we don't want to disturb anything, especially the operand count! */ @@ -431,14 +451,20 @@ case OPTYPE_NAMED_OBJECT: - if ((walk_state->origin->opcode == AML_METHOD_OP) && - (walk_state->origin != op)) + status = acpi_ds_load2_end_op (walk_state, op); + if (ACPI_FAILURE (status)) { + break; + } +/* + if ((Walk_state->Origin->Opcode == AML_METHOD_OP) && + (Walk_state->Origin != Op)) { - status = acpi_ds_load2_end_op (walk_state, op); - if (ACPI_FAILURE (status)) { + Status = Acpi_ds_load2_end_op (Walk_state, Op); + if (ACPI_FAILURE (Status)) { break; } } +*/ switch (op->opcode) { @@ -504,7 +530,7 @@ goto cleanup; } - status = acpi_aml_resolve_to_value (&walk_state->operands [0]); + status = acpi_aml_resolve_to_value (&walk_state->operands [0], walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -537,6 +563,8 @@ /* Break to debugger to display result */ + DEBUGGER_EXEC (acpi_db_display_result_object (obj_desc, walk_state)); + /* Delete the predicate result object (we know that we don't need it anymore) and cleanup the stack */ @@ -551,6 +579,8 @@ if (result_obj) { /* Break to debugger to display result */ + + DEBUGGER_EXEC (acpi_db_display_result_object (result_obj, walk_state)); /* * Delete the result op if and only if: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswload.c linux/drivers/acpi/dispatcher/dswload.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswload.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dswload.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks + * $Revision: 19 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "events.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswload"); + MODULE_NAME ("dswload") /***************************************************************************** @@ -53,61 +53,75 @@ ACPI_STATUS acpi_ds_load1_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; OBJECT_TYPE_INTERNAL data_type; + NATIVE_CHAR *path; /* We are only interested in opcodes that have an associated name */ - if (!acpi_ps_is_named_op (op->opcode)) { - return AE_OK; + if (!acpi_ps_is_named_op (opcode)) { + *out_op = op; + return (AE_OK); } /* Check if this object has already been installed in the namespace */ - if (op->acpi_named_object) { - return AE_OK; + if (op && op->node) { + *out_op = op; + return (AE_OK); } + path = acpi_ps_get_next_namestring (walk_state->parser_state); + /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + data_type = acpi_ds_map_named_opcode_to_data_type (opcode); - /* Attempt to type a NAME opcode by examining the argument */ - /* TBD: [Investigate] is this the right place to do this? */ + /* + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that involve + * arguments to the opcode must be created as we go back up the parse tree later. + */ + status = acpi_ns_lookup (walk_state->scope_info, path, + data_type, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH, walk_state, &(node)); - if (op->opcode == AML_NAME_OP) { - if (op->value.arg) { + if (ACPI_FAILURE (status)) { + return (status); + } - data_type = acpi_ds_map_opcode_to_data_type ((op->value.arg)->opcode, - NULL); + if (!op) { + /* Create a new op */ + + op = acpi_ps_alloc_op (opcode); + if (!op) { + return (AE_NO_MEMORY); } } + /* Initialize */ + + ((ACPI_PARSE2_OBJECT *)op)->name = node->name; /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that involve - * arguments to the opcode must be created as we go back up the parse tree later. + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed */ - status = acpi_ns_lookup (walk_state->scope_info, - (char *) &((ACPI_NAMED_OP *)op)->name, - data_type, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH, walk_state, &(new_entry)); + op->node = node; - if (ACPI_SUCCESS (status)) { - /* - * Put the NTE in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - op->acpi_named_object = new_entry; - } + + acpi_ps_append_arg (acpi_ps_get_parent_scope (walk_state->parser_state), op); + + *out_op = op; return (status); } @@ -131,7 +145,7 @@ ACPI_STATUS acpi_ds_load1_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { OBJECT_TYPE_INTERNAL data_type; @@ -139,20 +153,26 @@ /* We are only interested in opcodes that have an associated name */ if (!acpi_ps_is_named_op (op->opcode)) { - return AE_OK; + return (AE_OK); } - /* TBD: [Investigate] can this be removed? */ - if (op->opcode == AML_SCOPE_OP) { - if (((ACPI_NAMED_OP *)op)->name == -1) { - return AE_OK; + /* Get the type to determine if we should pop the scope */ + + data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + + if (op->opcode == AML_NAME_OP) { + /* For Name opcode, check the argument */ + + if (op->value.arg) { + data_type = acpi_ds_map_opcode_to_data_type ( + (op->value.arg)->opcode, NULL); + ((ACPI_NAMESPACE_NODE *)op->node)->type = + (u8) data_type; } } - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); - /* Pop the scope stack */ if (acpi_ns_opens_scope (data_type)) { @@ -160,7 +180,7 @@ acpi_ds_scope_stack_pop (walk_state); } - return AE_OK; + return (AE_OK); } @@ -181,60 +201,74 @@ ACPI_STATUS acpi_ds_load2_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT **out_op) { - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; OBJECT_TYPE_INTERNAL data_type; - char *buffer_ptr; + NATIVE_CHAR *buffer_ptr; void *original = NULL; /* We only care about Namespace opcodes here */ - if (!acpi_ps_is_namespace_op (op->opcode) && - op->opcode != AML_NAMEPATH_OP) + if (!acpi_ps_is_namespace_op (opcode) && + opcode != AML_NAMEPATH_OP) { - return AE_OK; + return (AE_OK); } - /* - * Get the name we are going to enter or lookup in the namespace - */ - if (op->opcode == AML_NAMEPATH_OP) { - /* For Namepath op , get the path string */ + /* Temp! same code as in psparse */ + + if (!acpi_ps_is_named_op (opcode)) { + return (AE_OK); + } + + if (op) { + /* + * Get the name we are going to enter or lookup in the namespace + */ + if (opcode == AML_NAMEPATH_OP) { + /* For Namepath op, get the path string */ + + buffer_ptr = op->value.string; + if (!buffer_ptr) { + /* No name, just exit */ + + return (AE_OK); + } + } - buffer_ptr = op->value.string; - if (!buffer_ptr) { - /* No name, just exit */ + else { + /* Get name from the op */ - return AE_OK; + buffer_ptr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)op)->name; } } else { - /* Get name from the op */ - - buffer_ptr = (char *) &((ACPI_NAMED_OP *)op)->name; + buffer_ptr = acpi_ps_get_next_namestring (walk_state->parser_state); } /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + data_type = acpi_ds_map_named_opcode_to_data_type (opcode); - if (op->opcode == AML_DEF_FIELD_OP || - op->opcode == AML_BANK_FIELD_OP || - op->opcode == AML_INDEX_FIELD_OP) + if (opcode == AML_DEF_FIELD_OP || + opcode == AML_BANK_FIELD_OP || + opcode == AML_INDEX_FIELD_OP) { - new_entry = NULL; + node = NULL; status = AE_OK; } - else if (op->opcode == AML_NAMEPATH_OP) { + else if (opcode == AML_NAMEPATH_OP) { /* * The Name_path is an object reference to an existing object. Don't enter the * name into the namespace, but look it up for use later @@ -242,16 +276,16 @@ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type, IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, - &(new_entry)); + &(node)); } else { - if (op->acpi_named_object) { - original = op->acpi_named_object; - new_entry = op->acpi_named_object; + if (op && op->node) { + original = op->node; + node = op->node; if (acpi_ns_opens_scope (data_type)) { - status = acpi_ds_scope_stack_push (new_entry->child_table, + status = acpi_ds_scope_stack_push (node, data_type, walk_state); if (ACPI_FAILURE (status)) { @@ -259,7 +293,7 @@ } } - return AE_OK; + return (AE_OK); } /* @@ -270,15 +304,30 @@ status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, data_type, IMODE_EXECUTE, NS_NO_UPSEARCH, walk_state, - &(new_entry)); + &(node)); } if (ACPI_SUCCESS (status)) { + if (!op) { + /* Create a new op */ + + op = acpi_ps_alloc_op (opcode); + if (!op) { + return (AE_NO_MEMORY); + } + + /* Initialize */ + + ((ACPI_PARSE2_OBJECT *)op)->name = node->name; + *out_op = op; + } + + /* - * Put the NTE in the "op" object that the parser uses, so we + * Put the Node in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ - op->acpi_named_object = new_entry; + op->node = node; } @@ -305,22 +354,22 @@ ACPI_STATUS acpi_ds_load2_end_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { ACPI_STATUS status = AE_OK; OBJECT_TYPE_INTERNAL data_type; - ACPI_NAMED_OBJECT *entry; - ACPI_GENERIC_OP *arg; - ACPI_NAMED_OBJECT *new_entry; + ACPI_NAMESPACE_NODE *node; + ACPI_PARSE_OBJECT *arg; + ACPI_NAMESPACE_NODE *new_node; if (!acpi_ps_is_namespace_object_op (op->opcode)) { - return AE_OK; + return (AE_OK); } if (op->opcode == AML_SCOPE_OP) { - if (((ACPI_NAMED_OP *)op)->name == -1) { - return AE_OK; + if (((ACPI_PARSE2_OBJECT *)op)->name == -1) { + return (AE_OK); } } @@ -328,17 +377,17 @@ data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); /* - * Get the NTE/name from the earlier lookup + * Get the Node/name from the earlier lookup * (It was saved in the *op structure) */ - entry = op->acpi_named_object; + node = op->node; /* - * Put the NTE on the object stack (Contains the ACPI Name of + * Put the Node on the object stack (Contains the ACPI Name of * this object) */ - walk_state->operands[0] = (void *) entry; + walk_state->operands[0] = (void *) node; walk_state->num_operands = 1; /* Pop the scope stack */ @@ -409,29 +458,38 @@ INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - walk_state, &(new_entry)); + walk_state, &(new_node)); if (ACPI_SUCCESS (status)) { - /* We could put the returned object (NTE) on the object stack for later, but + /* We could put the returned object (Node) on the object stack for later, but * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - op->acpi_named_object = new_entry; - } + op->node = new_node; + /* + * If this is NOT a control method, we need to evaluate this opcode now. + */ + + /* THIS WON"T WORK. Must execute all operands like Add(). => Must do an execute pass + if (!Walk_state->Method_desc) { + Status = Acpi_ds_exec_end_op (Walk_state, Op); + } + */ + } break; case AML_METHODCALL_OP: /* - * Lookup the method name and save the NTE + * Lookup the method name and save the Node */ status = acpi_ns_lookup (walk_state->scope_info, arg->value.string, ACPI_TYPE_ANY, IMODE_LOAD_PASS2, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - walk_state, &(new_entry)); + walk_state, &(new_node)); if (ACPI_SUCCESS (status)) { @@ -440,11 +498,11 @@ /* TBD: [Restructure] Make sure that what we found is indeed a method! */ /* We didn't search for a method on purpose, to see if the name would resolve! */ - /* We could put the returned object (NTE) on the object stack for later, but + /* We could put the returned object (Node) on the object stack for later, but * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - op->acpi_named_object = new_entry; + op->node = new_node; } @@ -455,7 +513,7 @@ /* Nothing to do other than enter object into namespace */ - status = acpi_aml_exec_create_processor (op, (ACPI_HANDLE) entry); + status = acpi_aml_exec_create_processor (op, (ACPI_HANDLE) node); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -467,7 +525,7 @@ /* Nothing to do other than enter object into namespace */ - status = acpi_aml_exec_create_power_resource (op, (ACPI_HANDLE) entry); + status = acpi_aml_exec_create_power_resource (op, (ACPI_HANDLE) node); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -487,7 +545,7 @@ arg = op->value.arg; status = acpi_ds_create_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + arg->node, walk_state); break; @@ -497,7 +555,7 @@ arg = op->value.arg; status = acpi_ds_create_index_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + (ACPI_HANDLE) arg->node, walk_state); break; @@ -506,7 +564,7 @@ arg = op->value.arg; status = acpi_ds_create_bank_field (op, - (ACPI_HANDLE) arg->acpi_named_object, + arg->node, walk_state); break; @@ -516,10 +574,10 @@ */ case AML_METHOD_OP: - if (!entry->object) { - status = acpi_aml_exec_create_method (((ACPI_DEFERRED_OP *) op)->body, - ((ACPI_DEFERRED_OP *) op)->body_length, - arg->value.integer, (ACPI_HANDLE) entry); + if (!node->object) { + status = acpi_aml_exec_create_method (((ACPI_PARSE2_OBJECT *) op)->data, + ((ACPI_PARSE2_OBJECT *) op)->length, + arg->value.integer, (ACPI_HANDLE) node); } break; @@ -549,14 +607,18 @@ case AML_REGION_OP: + if (node->object) { + break; + } + /* * The Op_region is not fully parsed at this time. Only valid argument is the Space_id. * (We must save the address of the AML of the address and length operands) */ - status = acpi_aml_exec_create_region (((ACPI_DEFERRED_OP *) op)->body, - ((ACPI_DEFERRED_OP *) op)->body_length, + status = acpi_aml_exec_create_region (((ACPI_PARSE2_OBJECT *) op)->data, + ((ACPI_PARSE2_OBJECT *) op)->length, arg->value.integer, walk_state); break; @@ -577,7 +639,7 @@ case AML_NAME_OP: - status = acpi_ds_create_named_object (walk_state, entry, op); + status = acpi_ds_create_node (walk_state, node, op); break; @@ -593,7 +655,9 @@ cleanup: - /* Remove the NTE pushed at the very beginning */ + + /* Remove the Node pushed at the very beginning */ + acpi_ds_obj_stack_pop (1, walk_state); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswscope.c linux/drivers/acpi/dispatcher/dswscope.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswscope.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dswscope.c Fri Sep 15 14:30:29 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation + * $Revision: 38 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "interp.h" -#include "dispatch.h" +#include "acinterp.h" +#include "acdispat.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("dswscope"); + MODULE_NAME ("dswscope") #define STACK_POP(head) head @@ -69,24 +69,24 @@ * * FUNCTION: Acpi_ds_scope_stack_push * - * PARAMETERS: *New_scope, - Name to be made current - * Type, - Type of frame being pushed + * PARAMETERS: *Node, - Name to be made current + * Type, - Type of frame being pushed * * DESCRIPTION: Push the current scope on the scope stack, and make the - * passed nte current. + * passed Node current. * ***************************************************************************/ ACPI_STATUS acpi_ds_scope_stack_push ( - ACPI_NAME_TABLE *new_scope, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, ACPI_WALK_STATE *walk_state) { ACPI_GENERIC_STATE *scope_info; - if (!new_scope) { + if (!node) { /* invalid scope */ REPORT_ERROR ("Ds_scope_stack_push: null scope passed"); @@ -109,7 +109,7 @@ /* Init new scope object */ - scope_info->scope.name_table = new_scope; + scope_info->scope.node = node; scope_info->common.value = (u16) type; /* Push new scope object onto stack */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/dispatcher/dswstate.c linux/drivers/acpi/dispatcher/dswstate.c --- v2.4.0-test8/linux/drivers/acpi/dispatcher/dswstate.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/dispatcher/dswstate.c Fri Sep 15 14:30:29 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines + * $Revision: 31 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "namesp.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT DISPATCHER - MODULE_NAME ("dswstate"); + MODULE_NAME ("dswstate") /******************************************************************************* @@ -55,7 +56,7 @@ walk_state->num_results = 0; walk_state->current_result = 0; - return AE_OK; + return (AE_OK); } @@ -80,13 +81,13 @@ if (walk_state->num_results >= OBJ_NUM_OPERANDS) { - return AE_STACK_OVERFLOW; + return (AE_STACK_OVERFLOW); } walk_state->results [walk_state->num_results] = object; walk_state->num_results++; - return AE_OK; + return (AE_OK); } @@ -106,7 +107,7 @@ ACPI_STATUS acpi_ds_result_stack_pop ( - ACPI_OBJECT_INTERNAL **object, + ACPI_OPERAND_OBJECT **object, ACPI_WALK_STATE *walk_state) { @@ -114,7 +115,7 @@ /* Check for stack underflow */ if (walk_state->num_results == 0) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } @@ -125,13 +126,13 @@ /* Check for a valid result object */ if (!walk_state->results [walk_state->num_results]) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } *object = walk_state->results [walk_state->num_results]; walk_state->results [walk_state->num_results] = NULL; - return AE_OK; + return (AE_OK); } @@ -191,7 +192,7 @@ /* Check for stack overflow */ if (walk_state->num_operands >= OBJ_NUM_OPERANDS) { - return AE_STACK_OVERFLOW; + return (AE_STACK_OVERFLOW); } /* Put the object onto the stack */ @@ -199,7 +200,7 @@ walk_state->operands [walk_state->num_operands] = object; walk_state->num_operands++; - return AE_OK; + return (AE_OK); } @@ -219,7 +220,7 @@ ACPI_STATUS acpi_ds_obj_stack_pop_object ( - ACPI_OBJECT_INTERNAL **object, + ACPI_OPERAND_OBJECT **object, ACPI_WALK_STATE *walk_state) { @@ -227,7 +228,7 @@ /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } @@ -238,7 +239,7 @@ /* Check for a valid operand */ if (!walk_state->operands [walk_state->num_operands]) { - return AE_AML_NO_OPERAND; + return (AE_AML_NO_OPERAND); } /* Get operand and set stack entry to null */ @@ -246,7 +247,7 @@ *object = walk_state->operands [walk_state->num_operands]; walk_state->operands [walk_state->num_operands] = NULL; - return AE_OK; + return (AE_OK); } @@ -276,7 +277,7 @@ /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_STACK_UNDERFLOW; + return (AE_STACK_UNDERFLOW); } /* Just set the stack entry to null */ @@ -285,7 +286,7 @@ walk_state->operands [walk_state->num_operands] = NULL; } - return AE_OK; + return (AE_OK); } @@ -309,14 +310,14 @@ ACPI_WALK_STATE *walk_state) { u32 i; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; for (i = 0; i < pop_count; i++) { /* Check for stack underflow */ if (walk_state->num_operands == 0) { - return AE_STACK_UNDERFLOW; + return (AE_STACK_UNDERFLOW); } /* Pop the stack and delete an object if present in this stack entry */ @@ -329,7 +330,7 @@ } } - return AE_OK; + return (AE_OK); } @@ -393,10 +394,10 @@ { if (!walk_list) { - return NULL; + return (NULL); } - return walk_list->walk_state; + return (walk_list->walk_state); } @@ -483,8 +484,8 @@ ACPI_WALK_STATE * acpi_ds_create_walk_state ( ACPI_OWNER_ID owner_id, - ACPI_GENERIC_OP *origin, - ACPI_OBJECT_INTERNAL *mth_desc, + ACPI_PARSE_OBJECT *origin, + ACPI_OPERAND_OBJECT *mth_desc, ACPI_WALK_LIST *walk_list) { ACPI_WALK_STATE *walk_state; @@ -511,6 +512,7 @@ /* The cache is empty, create a new object */ /* Avoid deadlock with Acpi_cm_callocate */ + acpi_cm_release_mutex (ACPI_MTX_CACHES); walk_state = acpi_cm_callocate (sizeof (ACPI_WALK_STATE)); @@ -640,6 +642,7 @@ next = acpi_gbl_walk_state_cache->next; acpi_cm_free (acpi_gbl_walk_state_cache); acpi_gbl_walk_state_cache = next; + acpi_gbl_walk_state_cache_depth--; } return; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/driver.c linux/drivers/acpi/driver.c --- v2.4.0-test8/linux/drivers/acpi/driver.c Wed Jul 12 13:21:57 2000 +++ linux/drivers/acpi/driver.c Fri Sep 15 14:30:30 2000 @@ -32,6 +32,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("driver") + struct acpi_run_entry { void (*callback)(void*); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/ec.c linux/drivers/acpi/ec.c --- v2.4.0-test8/linux/drivers/acpi/ec.c Thu Jul 13 09:39:49 2000 +++ linux/drivers/acpi/ec.c Fri Sep 15 14:30:30 2000 @@ -1,21 +1,21 @@ /* - * ec.c - Embedded controller support + * ec.c - Embedded controller support * - * Copyright (C) 2000 Andrew Henroid + * Copyright (C) 2000 Andrew Henroid * - * 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 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. + * 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 + * 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 */ #include @@ -28,28 +28,28 @@ #include "acpi.h" #include "driver.h" -enum -{ - ACPI_EC_HID = 0x090cd041, -}; +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("ec") + +#define ACPI_EC_HID "PNP0A09" enum { - ACPI_EC_SMI = 0x40, - ACPI_EC_SCI = 0x20, - ACPI_EC_BURST = 0x10, - ACPI_EC_CMD = 0x08, - ACPI_EC_IBF = 0x02, - ACPI_EC_OBF = 0x01 + ACPI_EC_SMI = 0x40, + ACPI_EC_SCI = 0x20, + ACPI_EC_BURST = 0x10, + ACPI_EC_CMD = 0x08, + ACPI_EC_IBF = 0x02, + ACPI_EC_OBF = 0x01 }; enum { - ACPI_EC_READ = 0x80, - ACPI_EC_WRITE = 0x81, - ACPI_EC_BURST_ENABLE = 0x82, - ACPI_EC_BURST_DISABLE = 0x83, - ACPI_EC_QUERY = 0x84, + ACPI_EC_READ = 0x80, + ACPI_EC_WRITE = 0x81, + ACPI_EC_BURST_ENABLE = 0x82, + ACPI_EC_BURST_DISABLE = 0x83, + ACPI_EC_QUERY = 0x84, }; @@ -74,9 +74,9 @@ static void acpi_ec_wait_control(void) { - udelay(1); - while(inb(acpi_ec_status) & ACPI_EC_IBF) - udelay(10); + udelay(1); + while(inb(acpi_ec_status) & ACPI_EC_IBF) + udelay(10); } /* @@ -88,12 +88,12 @@ if (!acpi_ec_data || !acpi_ec_status) return -1; - outb(ACPI_EC_READ, acpi_ec_status); - acpi_ec_wait_control(); - outb(addr, acpi_ec_data); - acpi_ec_wait_control(); - interruptible_sleep_on(&acpi_ec_wait); - *value = inb(acpi_ec_data); + outb(ACPI_EC_READ, acpi_ec_status); + acpi_ec_wait_control(); + outb(addr, acpi_ec_data); + acpi_ec_wait_control(); + interruptible_sleep_on(&acpi_ec_wait); + *value = inb(acpi_ec_data); return 0; } @@ -107,33 +107,32 @@ if (!acpi_ec_data || !acpi_ec_status) return -1; - outb(ACPI_EC_WRITE, acpi_ec_status); - acpi_ec_wait_control(); - outb(addr, acpi_ec_data); - acpi_ec_wait_control(); - outb(value, acpi_ec_data); - acpi_ec_wait_control(); - interruptible_sleep_on(&acpi_ec_wait); + outb(ACPI_EC_WRITE, acpi_ec_status); + acpi_ec_wait_control(); + outb(addr, acpi_ec_data); + acpi_ec_wait_control(); + outb(value, acpi_ec_data); + acpi_ec_wait_control(); + interruptible_sleep_on(&acpi_ec_wait); return 0; } /* - * Get processor information + * Get Embedded Controller information */ static ACPI_STATUS acpi_find_ec(ACPI_HANDLE handle, u32 level, void *ctx, void **value) { - ACPI_BUFFER buf; + ACPI_DEVICE_INFO dev_info; ACPI_OBJECT obj; + ACPI_BUFFER buf; RESOURCE *res; int gpe; - buf.length = sizeof(obj); - buf.pointer = &obj; - if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_HID", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER - || obj.number.value != ACPI_EC_HID) + if (!ACPI_SUCCESS(acpi_get_object_info(handle, &dev_info)) + || !(dev_info.valid & ACPI_VALID_HID) + || 0 != STRCMP(dev_info.hardware_id, ACPI_EC_HID)) return AE_OK; buf.length = 0; @@ -160,20 +159,23 @@ buf.length = sizeof(obj); buf.pointer = &obj; if (!ACPI_SUCCESS(acpi_evaluate_object(handle, "_GPE", NULL, &buf)) - || obj.type != ACPI_TYPE_NUMBER) + || obj.type != ACPI_TYPE_NUMBER) return AE_OK; gpe = (int) obj.number.value; printk(KERN_INFO "ACPI: found EC @ (0x%02x,0x%02x,%d)\n", - acpi_ec_data, acpi_ec_status, gpe); + acpi_ec_data, acpi_ec_status, gpe); if (!ACPI_SUCCESS(acpi_install_gpe_handler( gpe, (ACPI_EVENT_LEVEL_TRIGGERED | ACPI_EVENT_EDGE_TRIGGERED), acpi_ec_gpe, - NULL))) + NULL))) { + + DEBUG_PRINT(ACPI_ERROR, ("Could not install GPE handler for EC.\n")); return AE_OK; + } return AE_OK; } @@ -182,10 +184,10 @@ acpi_ec_init(void) { acpi_walk_namespace(ACPI_TYPE_DEVICE, - ACPI_ROOT_OBJECT, - ACPI_INT32_MAX, - acpi_find_ec, - NULL, - NULL); + ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, + acpi_find_ec, + NULL, + NULL); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/Makefile linux/drivers/acpi/events/Makefile --- v2.4.0-test8/linux/drivers/acpi/events/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/events/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evevent.c linux/drivers/acpi/events/evevent.c --- v2.4.0-test8/linux/drivers/acpi/events/evevent.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evevent.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evevent - Fixed and General Purpose Acpi_event * handling and dispatch + * $Revision: 13 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ */ #include "acpi.h" -#include "hardware.h" -#include "events.h" -#include "namesp.h" -#include "common.h" +#include "achware.h" +#include "acevents.h" +#include "acnamesp.h" +#include "accommon.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evevent"); + MODULE_NAME ("evevent") /****************************************************************************** @@ -68,7 +69,7 @@ acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, ACPI_EVENT_RTC + TMR_EN, 0); - return AE_OK; + return (AE_OK); } @@ -140,7 +141,7 @@ int_status |= acpi_ev_fixed_event_dispatch (ACPI_EVENT_SLEEP_BUTTON); } - return int_status; + return (int_status); } @@ -163,7 +164,7 @@ { /* Clear the status bit */ - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, (s32)TMR_STS + + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_DO_NOT_LOCK, TMR_STS + event, 1); /* @@ -175,13 +176,13 @@ TMR_EN + event, 0); REPORT_ERROR("No installed handler for fixed event."); - return INTERRUPT_NOT_HANDLED; + return (INTERRUPT_NOT_HANDLED); } /* Invoke the handler */ - return (acpi_gbl_fixed_event_handlers[event].handler)( - acpi_gbl_fixed_event_handlers[event].context); + return ((acpi_gbl_fixed_event_handlers[event].handler)( + acpi_gbl_fixed_event_handlers[event].context)); } @@ -216,6 +217,11 @@ gpe1_register_count = (u16) DIV_2 (acpi_gbl_FACP->gpe1_blk_len); acpi_gbl_gpe_register_count = gpe0register_count + gpe1_register_count; + if (!acpi_gbl_gpe_register_count) { + REPORT_WARNING ("No GPEs defined in the FACP"); + return (AE_OK); + } + /* * Allocate the Gpe information block */ @@ -341,17 +347,17 @@ void **return_value) { u32 gpe_number; - char name[ACPI_NAME_SIZE + 1]; + NATIVE_CHAR name[ACPI_NAME_SIZE + 1]; u8 type; /* Extract the name from the object and convert to a string */ - MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMED_OBJECT*) obj_handle)->name); + MOVE_UNALIGNED32_TO_32 (name, &((ACPI_NAMESPACE_NODE *) obj_handle)->name); name[ACPI_NAME_SIZE] = 0; /* - * Edge/Level determination is based on the 2nd char of the method name + * Edge/Level determination is based on the 2nd s8 of the method name */ if (name[1] == 'L') { type = ACPI_EVENT_LEVEL_TRIGGERED; @@ -362,7 +368,7 @@ else { /* Unknown method type, just ignore it! */ - return AE_OK; + return (AE_OK); } /* Convert the last two characters of the name to the Gpe Number */ @@ -371,7 +377,7 @@ if (gpe_number == ACPI_UINT32_MAX) { /* Conversion failed; invalid method, just ignore it */ - return AE_OK; + return (AE_OK); } /* Ensure that we have a valid GPE number */ @@ -379,7 +385,7 @@ if (acpi_gbl_gpe_valid[gpe_number] == ACPI_GPE_INVALID) { /* Not valid, all we can do here is ignore it */ - return AE_OK; + return (AE_OK); } /* @@ -397,7 +403,7 @@ acpi_hw_enable_gpe (gpe_number); - return AE_OK; + return (AE_OK); } @@ -431,7 +437,7 @@ /* Traverse the namespace under \_GPE to find all methods there */ status = acpi_walk_namespace (ACPI_TYPE_METHOD, acpi_gbl_gpe_obj_handle, - ACPI_INT32_MAX, acpi_ev_save_method_info, + ACPI_UINT32_MAX, acpi_ev_save_method_info, NULL, NULL); return (status); @@ -523,7 +529,7 @@ } } - return int_status; + return (int_status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evmisc.c linux/drivers/acpi/events/evmisc.c --- v2.4.0-test8/linux/drivers/acpi/events/evmisc.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evmisc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evmisc - ACPI device notification handler dispatch * and ACPI Global Lock support + * $Revision: 13 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ */ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" -#include "hardware.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "achware.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evmisc"); + MODULE_NAME ("evmisc") /************************************************************************** @@ -51,8 +52,8 @@ ACPI_HANDLE device, u32 notify_value) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; NOTIFY_HANDLER handler; @@ -108,7 +109,7 @@ /* - * Get the notify object which must be attached to the device NTE + * Get the notify object which must be attached to the device Node */ obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device); @@ -211,7 +212,7 @@ context); } - return INTERRUPT_HANDLED; + return (INTERRUPT_HANDLED); } @@ -349,7 +350,7 @@ */ if (pending) { acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, - (s32)PM1_CONTROL | GBL_RLS, 1); + PM1_CONTROL | GBL_RLS, 1); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evregion.c linux/drivers/acpi/events/evregion.c --- v2.4.0-test8/linux/drivers/acpi/events/evregion.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evregion.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI Address_space / Op_region handler dispatch + * $Revision: 76 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evregion"); + MODULE_NAME ("evregion") #define PCI_ROOT_HID_STRING "PNP0A03" @@ -56,23 +57,23 @@ void *context, void **return_value) { - ACPI_NAMED_OBJECT *entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *node; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; - entry = (ACPI_NAMED_OBJECT*) obj_handle; - obj_desc = ((ACPI_NAMED_OBJECT*)obj_handle)->object; + node = (ACPI_NAMESPACE_NODE *) obj_handle; + obj_desc = ((ACPI_NAMESPACE_NODE *) obj_handle)->object; /* * We are looking for all valid _HID objects. */ - if (STRNCMP ((char *)&entry->name, METHOD_NAME__HID, ACPI_NAME_SIZE) || + if (STRNCMP ((NATIVE_CHAR *) &node->name, METHOD_NAME__HID, ACPI_NAME_SIZE) || (!obj_desc)) { - return AE_OK; + return (AE_OK); } @@ -87,7 +88,7 @@ case ACPI_TYPE_NUMBER: if (obj_desc->number.value != PCI_ROOT_HID_VALUE) { - return AE_OK; + return (AE_OK); } break; @@ -97,14 +98,14 @@ if (STRNCMP (obj_desc->string.pointer, PCI_ROOT_HID_STRING, sizeof (PCI_ROOT_HID_STRING))) { - return AE_OK; + return (AE_OK); } break; default: - return AE_OK; + return (AE_OK); } @@ -114,11 +115,11 @@ * handler for this PCI device. */ - status = acpi_install_address_space_handler (acpi_ns_get_parent_entry (entry), + status = acpi_install_address_space_handler (acpi_ns_get_parent_object (node), ADDRESS_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); - return AE_OK; + return (AE_OK); } @@ -142,7 +143,90 @@ acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, acpi_ev_find_one_pci_root_bus, NULL, NULL); - return AE_OK; + return (AE_OK); +} + +/****************************************************************************** + * + * FUNCTION: Acpi_ev_init_one_device + * + * PARAMETERS: The usual "I'm a namespace callback" stuff + * + * RETURN: ACPI_STATUS + * + * DESCRIPTION: This is called once per device soon after ACPI is enabled + * to initialize each device. It determines if the device is + * present, and if so, calls _INI. + * + *****************************************************************************/ + +ACPI_STATUS +acpi_ev_init_one_device ( + ACPI_HANDLE obj_handle, + u32 nesting_level, + void *context, + void **return_value) +{ + ACPI_STATUS status; + ACPI_OPERAND_OBJECT *ret_obj; + + + /* + * Run _STA to determine if we can run _INI on the device. + */ + status = acpi_ns_evaluate_relative(obj_handle, "_STA", NULL, &ret_obj); + if (AE_NOT_FOUND == status) { + /* No _STA means device is present */ + } + else if (ACPI_FAILURE (status)) { + return (status); + } + else if (ret_obj) { + if (ACPI_TYPE_NUMBER != ret_obj->common.type) { + status = AE_AML_OPERAND_TYPE; + goto cleanup; + } + + /* + * if _STA "present" bit not set, we're done. + */ + if (!(ret_obj->number.value & 1)) { + goto cleanup; + } + } + + /* + * The device is present. Run _INI. + */ + + status = acpi_ns_evaluate_relative(obj_handle, "_INI", NULL, NULL); + +cleanup: + + acpi_cm_remove_reference (ret_obj); + return (status); +} + +/****************************************************************************** + * + * FUNCTION: Acpi_ev_init_devices + * + * PARAMETERS: None + * + * RETURN: ACPI_STATUS + * + * DESCRIPTION: This initializes all ACPI devices. + * + *****************************************************************************/ + +ACPI_STATUS +acpi_ev_init_devices ( + void) +{ + acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + FALSE, acpi_ev_init_one_device, NULL, NULL); + + return (AE_OK); } @@ -172,28 +256,20 @@ * associated with the address space. For these we use the root. */ - status = acpi_install_address_space_handler (acpi_gbl_root_object, + status = acpi_install_address_space_handler (acpi_gbl_root_node, ADDRESS_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (status)) { return (status); } - status = acpi_install_address_space_handler (acpi_gbl_root_object, + status = acpi_install_address_space_handler (acpi_gbl_root_node, ADDRESS_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL); if (ACPI_FAILURE (status)) { return (status); } - /* - * Install PCI config space handler for all PCI root bridges. A PCI root - * bridge is found by searching for devices containing a HID with the value - * EISAID("PNP0A03") - */ - - acpi_ev_find_pci_root_buses (); - return (AE_OK); } @@ -216,12 +292,12 @@ ACPI_STATUS acpi_ev_execute_reg_method ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u32 function) { - ACPI_OBJECT_INTERNAL *params[3]; - ACPI_OBJECT_INTERNAL space_iD_obj; - ACPI_OBJECT_INTERNAL function_obj; + ACPI_OPERAND_OBJECT *params[3]; + ACPI_OPERAND_OBJECT space_iD_obj; + ACPI_OPERAND_OBJECT function_obj; ACPI_STATUS status; @@ -286,7 +362,7 @@ ACPI_STATUS acpi_ev_address_space_dispatch ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u32 function, u32 address, u32 bit_width, @@ -295,8 +371,8 @@ ACPI_STATUS status; ADDRESS_SPACE_HANDLER handler; ADDRESS_SPACE_SETUP region_setup; - ACPI_OBJECT_INTERNAL *handler_desc; - void *region_context; + ACPI_OPERAND_OBJECT *handler_desc; + void *region_context = NULL; /* @@ -312,7 +388,7 @@ * It may be the case that the region has never been initialized * Some types of regions require special init code */ - if (!(region_obj->region.region_flags & REGION_INITIALIZED)) { + if (!(region_obj->region.flags & AOPOBJ_INITIALIZED)) { /* * This region has not been initialized yet, do it */ @@ -346,9 +422,10 @@ } /* - * Save the returned context for use in all accesses to the region + * Save the returned context for use in all accesses to + * this particular region. */ - handler_desc->addr_handler.context = region_context; + region_obj->region.region_context = region_context; } /* @@ -369,7 +446,8 @@ * Invoke the handler. */ status = handler (function, address, bit_width, value, - handler_desc->addr_handler.context); + handler_desc->addr_handler.context, + region_obj->region.region_context); if (!(handler_desc->addr_handler.flags & ADDR_HANDLER_DEFAULT_INSTALLED)) { @@ -398,13 +476,13 @@ void acpi_ev_disassociate_region_from_handler( - ACPI_OBJECT_INTERNAL *region_obj) + ACPI_OPERAND_OBJECT *region_obj) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL **last_obj_ptr; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT **last_obj_ptr; ADDRESS_SPACE_SETUP region_setup; - void *region_context; + void *region_context = region_obj->region.region_context; ACPI_STATUS status; @@ -436,7 +514,8 @@ /* * This is it, remove it from the handler's list */ - *last_obj_ptr = obj_desc->region.link; + *last_obj_ptr = obj_desc->region.next; + obj_desc->region.next = NULL; /* Must clear field */ /* * Now stop region accesses by executing the _REG method @@ -452,12 +531,6 @@ ®ion_context); /* - * Save the returned context (It is the original context - * passed into Install) - */ - handler_obj->addr_handler.context = region_context; - - /* * Init routine may fail, Just ignore errors */ @@ -482,8 +555,8 @@ /* * Move through the linked list of handlers */ - last_obj_ptr = &obj_desc->region.link; - obj_desc = obj_desc->region.link; + last_obj_ptr = &obj_desc->region.next; + obj_desc = obj_desc->region.next; } /* @@ -508,9 +581,10 @@ ******************************************************************************/ ACPI_STATUS -acpi_ev_associate_region_and_handler( - ACPI_OBJECT_INTERNAL *handler_obj, - ACPI_OBJECT_INTERNAL *region_obj) +acpi_ev_associate_region_and_handler ( + ACPI_OPERAND_OBJECT *handler_obj, + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_is_locked) { ACPI_STATUS status; @@ -522,7 +596,7 @@ * Link this region to the front of the handler's list */ - region_obj->region.link = handler_obj->addr_handler.region_list; + region_obj->region.next = handler_obj->addr_handler.region_list; handler_obj->addr_handler.region_list = region_obj; /* @@ -539,9 +613,15 @@ /* * Last thing, tell all users that this region is usable */ - acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); + if (acpi_ns_is_locked) { + acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); + } + status = acpi_ev_execute_reg_method (region_obj, 1); - acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); + + if (acpi_ns_is_locked) { + acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); + } return (status); } @@ -551,7 +631,7 @@ * * FUNCTION: Acpi_ev_addr_handler_helper * - * PARAMETERS: Handle - Entry to be dumped + * PARAMETERS: Handle - Node to be dumped * Level - Nesting level of the handle * Context - Passed into Acpi_ns_walk_namespace * @@ -573,14 +653,14 @@ void *context, void **return_value) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *tmp_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *tmp_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - handler_obj = (ACPI_OBJECT_INTERNAL *) context; + handler_obj = (ACPI_OPERAND_OBJECT *) context; /* Parameter validation */ @@ -590,8 +670,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (obj_handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (obj_handle); + if (!node) { return (AE_BAD_PARAMETER); } @@ -600,16 +680,16 @@ * that can have address handlers */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_REGION) && - (obj_entry != acpi_gbl_root_object)) + if ((node->type != ACPI_TYPE_DEVICE) && + (node->type != ACPI_TYPE_REGION) && + (node != acpi_gbl_root_node)) { return (AE_OK); } /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (!obj_desc) { /* * The object DNE, we don't care about it @@ -647,7 +727,7 @@ /* * Move through the linked list of handlers */ - tmp_obj = tmp_obj->addr_handler.link; + tmp_obj = tmp_obj->addr_handler.next; } /* @@ -682,7 +762,7 @@ /* * Then connect the region to the new handler */ - status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc); + status = acpi_ev_associate_region_and_handler (handler_obj, obj_desc, FALSE); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evrgnini.c linux/drivers/acpi/events/evrgnini.c --- v2.4.0-test8/linux/drivers/acpi/events/evrgnini.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evrgnini.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI Address_space / Op_region init + * $Revision: 22 $ * *****************************************************************************/ @@ -24,13 +25,13 @@ #include "acpi.h" -#include "events.h" -#include "namesp.h" -#include "interp.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evrgnini"); + MODULE_NAME ("evrgnini") /***************************************************************************** @@ -40,8 +41,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling, a nop for now @@ -53,21 +54,17 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - MEM_HANDLER_CONTEXT *mem_context; - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - - *return_context = NULL; - if (handler_context) { - mem_context = handler_context; - *return_context = mem_context->handler_context; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); - acpi_cm_free (mem_context); + if (*region_context) { + acpi_cm_free (*region_context); + *region_context = NULL; } return (AE_OK); } @@ -75,17 +72,15 @@ /* Activate. Create a new context */ - mem_context = acpi_cm_callocate (sizeof (MEM_HANDLER_CONTEXT)); - if (!mem_context) { + *region_context = acpi_cm_callocate (sizeof (MEM_HANDLER_CONTEXT)); + if (!(*region_context)) { return (AE_NO_MEMORY); } /* Init. (Mapping fields are all set to zeros above) */ - mem_context->handler_context = handler_context; - region_obj->region.region_flags |= REGION_INITIALIZED; + region_obj->region.flags |= AOPOBJ_INITIALIZED; - *return_context = mem_context; return (AE_OK); } @@ -97,8 +92,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -110,21 +105,18 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; - + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - *return_context = handler_context; - return (AE_OK); + *region_context = NULL; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); + } + else { + *region_context = handler_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; } - - /* Activate the region */ - - region_obj->region.region_flags |= REGION_INITIALIZED; - *return_context = handler_context; return (AE_OK); } @@ -137,8 +129,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -152,14 +144,14 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { ACPI_STATUS status = AE_OK; u32 temp; - PCI_HANDLER_CONTEXT *pci_context; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_NAMED_OBJECT *search_scope; - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + PCI_HANDLER_CONTEXT *pci_context = *region_context; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_NAMESPACE_NODE *node; + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; handler_obj = region_obj->region.addr_handler; @@ -173,14 +165,11 @@ } if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - - *return_context = NULL; - if (handler_context) { - pci_context = handler_context; - *return_context = pci_context->handler_context; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); + if (pci_context) { acpi_cm_free (pci_context); + *region_context = NULL; } return (status); @@ -189,7 +178,7 @@ /* Create a new context */ - pci_context = acpi_cm_allocate (sizeof(PCI_HANDLER_CONTEXT)); + pci_context = acpi_cm_callocate (sizeof(PCI_HANDLER_CONTEXT)); if (!pci_context) { return (AE_NO_MEMORY); } @@ -203,16 +192,16 @@ * First get device and function numbers from the _ADR object * in the parent's scope. */ - ACPI_ASSERT(region_obj->region.nte); + ACPI_ASSERT(region_obj->region.node); - search_scope = acpi_ns_get_parent_entry (region_obj->region.nte); + node = acpi_ns_get_parent_object (region_obj->region.node); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); /* Acpi_evaluate the _ADR object */ - status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, node, &temp); /* * The default is zero, since the allocation above zeroed the data, just * do nothing on failures. @@ -232,9 +221,9 @@ * This is the device the handler has been registered to handle. */ - search_scope = handler_obj->addr_handler.nte; + node = handler_obj->addr_handler.node; - status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__SEG, node, &temp); if (ACPI_SUCCESS (status)) { /* * Got it.. @@ -242,7 +231,7 @@ pci_context->seg = temp; } - status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, search_scope, &temp); + status = acpi_cm_evaluate_numeric_object (METHOD_NAME__BBN, node, &temp); if (ACPI_SUCCESS (status)) { /* * Got it.. @@ -250,11 +239,12 @@ pci_context->bus = temp; } + *region_context = pci_context; + acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - *return_context = pci_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; - region_obj->region.region_flags |= REGION_INITIALIZED; return (AE_OK); } @@ -266,8 +256,8 @@ * PARAMETERS: Region_obj - region we are interested in * Function - start or stop * Handler_context - Address space handler context - * Returned context - context to be used with each call to the - * handler for this region + * Region_context - Region specific context + * * RETURN: Status * * DESCRIPTION: Do any prep work for region handling @@ -279,18 +269,18 @@ ACPI_HANDLE handle, u32 function, void *handler_context, - void **return_context) + void **region_context) { - ACPI_OBJECT_INTERNAL *region_obj = (ACPI_OBJECT_INTERNAL *) handle; + ACPI_OPERAND_OBJECT *region_obj = (ACPI_OPERAND_OBJECT *) handle; if (function == ACPI_REGION_DEACTIVATE) { - region_obj->region.region_flags &= ~(REGION_INITIALIZED); - *return_context = NULL; + *region_context = NULL; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); } else { - region_obj->region.region_flags |= REGION_INITIALIZED; - *return_context = handler_context; + *region_context = handler_context; + region_obj->region.flags |= AOPOBJ_INITIALIZED; } return (AE_OK); @@ -320,15 +310,15 @@ ACPI_STATUS acpi_ev_initialize_region ( - ACPI_OBJECT_INTERNAL *region_obj, + ACPI_OPERAND_OBJECT *region_obj, u8 acpi_ns_locked) { - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *obj_desc; u32 space_id; - ACPI_NAMED_OBJECT *entry; /* Namespace Object */ + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - ACPI_NAMED_OBJECT *reg_entry; + ACPI_NAMESPACE_NODE *method_node; ACPI_NAME *reg_name_ptr = (ACPI_NAME *) METHOD_NAME__REG; @@ -336,44 +326,44 @@ return (AE_BAD_PARAMETER); } - ACPI_ASSERT(region_obj->region.nte); + ACPI_ASSERT(region_obj->region.node); - entry = acpi_ns_get_parent_entry (region_obj->region.nte); + node = acpi_ns_get_parent_object (region_obj->region.node); space_id = region_obj->region.space_id; region_obj->region.addr_handler = NULL; region_obj->region.REGmethod = NULL; - region_obj->region.region_flags = INITIAL_REGION_FLAGS; + region_obj->region.flags &= ~(AOPOBJ_INITIALIZED); /* * Find any "_REG" associated with this region definition */ - status = acpi_ns_search_one_scope (*reg_name_ptr, entry->child_table, - ACPI_TYPE_METHOD, ®_entry, NULL); - if (status == AE_OK) { + status = acpi_ns_search_node (*reg_name_ptr, node, + ACPI_TYPE_METHOD, &method_node); + if (ACPI_SUCCESS (status)) { /* * The _REG method is optional and there can be only one per region * definition. This will be executed when the handler is attached * or removed */ - region_obj->region.REGmethod = reg_entry; + region_obj->region.REGmethod = method_node; } /* - * The following loop depends upon the root nte having no parent - * ie: Acpi_gbl_Root_object->Parent_entry being set to NULL + * The following loop depends upon the root Node having no parent + * ie: Acpi_gbl_Root_node->Parent_entry being set to NULL */ - while (entry) { + while (node) { /* * Check to see if a handler exists */ handler_obj = NULL; - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (obj_desc) { /* * can only be a handler if the object exists */ - switch (entry->type) + switch (node->type) { case ACPI_TYPE_DEVICE: @@ -400,11 +390,11 @@ /* * Found it! Now update the region and the handler */ - acpi_ev_associate_region_and_handler(handler_obj, region_obj); + acpi_ev_associate_region_and_handler (handler_obj, region_obj, acpi_ns_locked); return (AE_OK); } - handler_obj = handler_obj->addr_handler.link; + handler_obj = handler_obj->addr_handler.next; } /* while handlerobj */ } @@ -413,9 +403,9 @@ * This one does not have the handler we need * Pop up one level */ - entry = acpi_ns_get_parent_entry (entry); + node = acpi_ns_get_parent_object (node); - } /* while Entry != ROOT */ + } /* while Node != ROOT */ /* * If we get here, there is no handler for this region diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evsci.c linux/drivers/acpi/events/evsci.c --- v2.4.0-test8/linux/drivers/acpi/events/evsci.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evsci.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,10 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions + * $Revision: 59 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -24,27 +25,26 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evsci"); + MODULE_NAME ("evsci") /* - * Elements correspond to counts for - * TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC, - * and GENERAL respectively. These counts - * are modified by the ACPI interrupt handler... - * Note that GENERAL should probably be split out - * into one element for each bit in the GPE - * registers + * Elements correspond to counts for TMR, NOT_USED, GBL, PWR_BTN, SLP_BTN, RTC, + * and GENERAL respectively. These counts are modified by the ACPI interrupt + * handler. + * + * TBD: [Investigate] Note that GENERAL should probably be split out into + * one element for each bit in the GPE registers */ -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_sci_handler * @@ -61,16 +61,16 @@ u32 acpi_ev_sci_handler (void *context) { - u32 interrupt_handled = INTERRUPT_NOT_HANDLED; + u32 interrupt_handled = INTERRUPT_NOT_HANDLED; + /* - * ACPI Enabled? - * ------------- * Make sure that ACPI is enabled by checking SCI_EN. Note that we are * required to treat the SCI interrupt as sharable, level, active low. */ - if (!acpi_hw_register_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, (s32)SCI_EN)) { - REPORT_ERROR ("Received and SCI but ACPI is not enabled."); + if (!acpi_hw_register_access (ACPI_READ, ACPI_MTX_DO_NOT_LOCK, SCI_EN)) { + /* ACPI is not enabled; this interrupt cannot be for us */ + return (INTERRUPT_NOT_HANDLED); } @@ -107,12 +107,12 @@ u32 acpi_ev_install_sci_handler (void) { - u32 except = AE_OK; + u32 except = AE_OK; + - except = acpi_os_install_interrupt_handler ( - (u32) acpi_gbl_FACP->sci_int, - acpi_ev_sci_handler, - NULL); + except = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FACP->sci_int, + acpi_ev_sci_handler, + NULL); return (except); } @@ -163,24 +163,21 @@ #endif - acpi_os_remove_interrupt_handler ( - (u32) acpi_gbl_FACP->sci_int, - acpi_ev_sci_handler); + acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FACP->sci_int, + acpi_ev_sci_handler); return (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_sci_count * - * PARAMETERS: char * Event_name name (fully qualified name from namespace - * or one of the fixed event names defined above) - * of the event to check if it's generated an SCI. + * PARAMETERS: Event Event that generated an SCI. * - * RETURN: Number of SCI's for requested event since last time i_sci_occured() - * was called for this event. + * RETURN: Number of SCI's for requested event since last time + * Sci_occured() was called for this event. * * DESCRIPTION: Checks to see if SCI has been generated from requested source * since the last time this function was called. @@ -188,7 +185,7 @@ ******************************************************************************/ -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ev_restore_acpi_state * @@ -203,7 +200,7 @@ void acpi_ev_restore_acpi_state (void) { - s32 index; + u32 index; /* Restore the state of the chipset enable bits. */ @@ -283,6 +280,7 @@ void acpi_ev_terminate (void) { + /* * Free global tables, etc. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxface.c linux/drivers/acpi/events/evxface.c --- v2.4.0-test8/linux/drivers/acpi/events/evxface.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evxface.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events + * $Revision: 88 $ * *****************************************************************************/ @@ -24,14 +25,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxface"); + MODULE_NAME ("evxface") /****************************************************************************** @@ -172,9 +173,9 @@ NOTIFY_HANDLER handler, void *context) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *notify_obj; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *notify_obj; + ACPI_NAMESPACE_NODE *device_node; ACPI_STATUS status = AE_OK; @@ -190,8 +191,8 @@ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -217,13 +218,13 @@ } if (handler_type == ACPI_SYSTEM_NOTIFY) { - acpi_gbl_sys_notify.nte = obj_entry; + acpi_gbl_sys_notify.node = device_node; acpi_gbl_sys_notify.handler = handler; acpi_gbl_sys_notify.context = context; } else { - acpi_gbl_drv_notify.nte = obj_entry; + acpi_gbl_drv_notify.node = device_node; acpi_gbl_drv_notify.handler = handler; acpi_gbl_drv_notify.context = context; } @@ -239,10 +240,10 @@ * These are the ONLY objects that can receive ACPI notifications */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_POWER) && - (obj_entry->type != ACPI_TYPE_THERMAL)) + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -250,7 +251,7 @@ /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); if (obj_desc) { /* * The object exists. @@ -270,15 +271,15 @@ else { /* Create a new object */ - obj_desc = acpi_cm_create_internal_object (obj_entry->type); + obj_desc = acpi_cm_create_internal_object (device_node->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; } - /* Attach new object to the NTE */ + /* Attach new object to the Node */ - status = acpi_ns_attach_object (device, obj_desc, (u8) obj_entry->type); + status = acpi_ns_attach_object (device, obj_desc, (u8) device_node->type); if (ACPI_FAILURE (status)) { goto unlock_and_exit; @@ -296,7 +297,7 @@ goto unlock_and_exit; } - notify_obj->notify_handler.nte = obj_entry; + notify_obj->notify_handler.node = device_node; notify_obj->notify_handler.handler = handler; notify_obj->notify_handler.context = context; @@ -337,9 +338,9 @@ u32 handler_type, NOTIFY_HANDLER handler) { - ACPI_OBJECT_INTERNAL *notify_obj; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *notify_obj; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *device_node; ACPI_STATUS status = AE_OK; @@ -355,8 +356,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -365,10 +366,10 @@ * These are the ONLY objects that can receive ACPI notifications */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_POWER) && - (obj_entry->type != ACPI_TYPE_THERMAL)) + if ((device_node->type != ACPI_TYPE_DEVICE) && + (device_node->type != ACPI_TYPE_PROCESSOR) && + (device_node->type != ACPI_TYPE_POWER) && + (device_node->type != ACPI_TYPE_THERMAL)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -376,7 +377,7 @@ /* Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) device_node); if (!obj_desc) { status = AE_NOT_EXIST; goto unlock_and_exit; @@ -573,7 +574,7 @@ acpi_aml_exit_interpreter (); *out_handle = 0; - return status; + return (status); } @@ -598,7 +599,7 @@ /* TBD: [Restructure] Validate handle */ acpi_ev_release_global_lock (); - return AE_OK; + return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxfevnt.c linux/drivers/acpi/events/evxfevnt.c --- v2.4.0-test8/linux/drivers/acpi/events/evxfevnt.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evxfevnt.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable + * $Revision: 19 $ * *****************************************************************************/ @@ -24,16 +25,24 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxfevnt"); + MODULE_NAME ("evxfevnt") +ACPI_STATUS +acpi_ev_find_pci_root_buses ( + void); + +ACPI_STATUS +acpi_ev_init_devices ( + void); + /************************************************************************** * * FUNCTION: Acpi_enable @@ -60,12 +69,27 @@ return (AE_NO_ACPI_TABLES); } + /* Init the hardware */ + + /* + * With the advent of a 3-pass parser, we need to be + * prepared to execute on initialized HW before the + * namespace has completed its load. + */ + + status = acpi_cm_hardware_initialize (); + if (ACPI_FAILURE (status)) { + return (status); + } + + /* Make sure the BIOS supports ACPI mode */ if (SYS_MODE_LEGACY == acpi_hw_get_mode_capabilities()) { return (AE_ERROR); } + acpi_gbl_original_mode = acpi_hw_get_mode(); /* @@ -74,24 +98,28 @@ * before handers are installed. */ - if (ACPI_FAILURE (acpi_ev_fixed_event_initialize ())) { - return (AE_ERROR); + status = acpi_ev_fixed_event_initialize (); + if (ACPI_FAILURE (status)) { + return (status); } - if (ACPI_FAILURE (acpi_ev_gpe_initialize())) { - return (AE_ERROR); + status = acpi_ev_gpe_initialize (); + if (ACPI_FAILURE (status)) { + return (status); } /* Install the SCI handler */ - if (ACPI_FAILURE (acpi_ev_install_sci_handler ())) { - return (AE_ERROR); + status = acpi_ev_install_sci_handler (); + if (ACPI_FAILURE (status)) { + return (status); } /* Transition to ACPI mode */ - if (AE_OK != acpi_hw_set_mode (SYS_MODE_ACPI)) { - return (AE_ERROR); + status = acpi_hw_set_mode (SYS_MODE_ACPI); + if (ACPI_FAILURE (status)) { + return (status); } /* Install handlers for control method GPE handlers (_Lxx, _Exx) */ @@ -100,6 +128,26 @@ status = acpi_ev_init_global_lock_handler (); + /* + * Perform additional initialization that may cause control methods + * to be executed + * + * It may be wise to move this code to a new interface + */ + + + /* + * Install PCI config space handler for all PCI root bridges. A PCI root + * bridge is found by searching for devices containing a HID with the value + * EISAID("PNP0A03") + */ + + acpi_ev_find_pci_root_buses (); + + /* Call _INI on all devices */ + + acpi_ev_init_devices (); + return (status); } @@ -120,12 +168,14 @@ ACPI_STATUS acpi_disable (void) { + ACPI_STATUS status; /* Restore original mode */ - if (AE_OK != acpi_hw_set_mode (acpi_gbl_original_mode)) { - return (AE_ERROR); + status = acpi_hw_set_mode (acpi_gbl_original_mode); + if (ACPI_FAILURE (status)) { + return (status); } /* Unload the SCI interrupt handler */ @@ -133,7 +183,7 @@ acpi_ev_remove_sci_handler (); acpi_ev_restore_acpi_state (); - return (AE_OK); + return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/events/evxfregn.c linux/drivers/acpi/events/evxfregn.c --- v2.4.0-test8/linux/drivers/acpi/events/evxfregn.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/events/evxfregn.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. + * $Revision: 20 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #include "amlcode.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT EVENT_HANDLING - MODULE_NAME ("evxfregn"); + MODULE_NAME ("evxfregn") /****************************************************************************** @@ -59,9 +60,9 @@ ADDRESS_SPACE_SETUP setup, void *context) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; OBJECT_TYPE_INTERNAL type; u16 flags = 0; @@ -80,8 +81,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (device); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -92,10 +93,10 @@ * get placed. */ - if ((obj_entry->type != ACPI_TYPE_DEVICE) && - (obj_entry->type != ACPI_TYPE_PROCESSOR) && - (obj_entry->type != ACPI_TYPE_THERMAL) && - (obj_entry != acpi_gbl_root_object)) + if ((node->type != ACPI_TYPE_DEVICE) && + (node->type != ACPI_TYPE_PROCESSOR) && + (node->type != ACPI_TYPE_THERMAL) && + (node != acpi_gbl_root_node)) { status = AE_BAD_PARAMETER; goto unlock_and_exit; @@ -139,7 +140,7 @@ * Check for an existing internal object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (obj_desc) { /* * The object exists. @@ -162,19 +163,19 @@ /* * Move through the linked list of handlers */ - handler_obj = handler_obj->addr_handler.link; + handler_obj = handler_obj->addr_handler.next; } } else { /* Obj_desc does not exist, create one */ - if (obj_entry->type == ACPI_TYPE_ANY) { + if (node->type == ACPI_TYPE_ANY) { type = ACPI_TYPE_DEVICE; } else { - type = obj_entry->type; + type = node->type; } obj_desc = acpi_cm_create_internal_object (type); @@ -187,19 +188,13 @@ obj_desc->common.type = (u8) type; - /* Attach the new object to the NTE */ + /* Attach the new object to the Node */ status = acpi_ns_attach_object (device, obj_desc, (u8) type); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); goto unlock_and_exit; } - - /* TBD: [Investigate] Will this always be of type DEVICE? */ - - if (type == ACPI_TYPE_DEVICE) { - obj_desc->device.handle = device; - } } /* @@ -215,11 +210,11 @@ goto unlock_and_exit; } - handler_obj->addr_handler.space_id = (u16) space_id; + handler_obj->addr_handler.space_id = (u8) space_id; handler_obj->addr_handler.hflags = flags; - handler_obj->addr_handler.link = obj_desc->device.addr_handler; + handler_obj->addr_handler.next = obj_desc->device.addr_handler; handler_obj->addr_handler.region_list = NULL; - handler_obj->addr_handler.nte = obj_entry; + handler_obj->addr_handler.node = node; handler_obj->addr_handler.handler = handler; handler_obj->addr_handler.context = context; handler_obj->addr_handler.setup = setup; @@ -237,7 +232,7 @@ * of the branch */ status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, device, - ACPI_INT32_MAX, NS_WALK_NO_UNLOCK, + ACPI_UINT32_MAX, NS_WALK_UNLOCK, acpi_ev_addr_handler_helper, handler_obj, NULL); @@ -276,11 +271,11 @@ ACPI_ADDRESS_SPACE_TYPE space_id, ADDRESS_SPACE_HANDLER handler) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *handler_obj; - ACPI_OBJECT_INTERNAL *region_obj; - ACPI_OBJECT_INTERNAL **last_obj_ptr; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *handler_obj; + ACPI_OPERAND_OBJECT *region_obj; + ACPI_OPERAND_OBJECT **last_obj_ptr; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; @@ -297,8 +292,8 @@ /* Convert and validate the device handle */ - obj_entry = acpi_ns_convert_handle_to_entry (device); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (device); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -306,7 +301,7 @@ /* Make sure the internal object exists */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) obj_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); if (!obj_desc) { /* * The object DNE. @@ -356,7 +351,7 @@ /* * Remove this Handler object from the list */ - *last_obj_ptr = handler_obj->addr_handler.link; + *last_obj_ptr = handler_obj->addr_handler.next; /* * Now we can delete the handler object @@ -370,8 +365,8 @@ /* * Move through the linked list of handlers */ - last_obj_ptr = &handler_obj->addr_handler.link; - handler_obj = handler_obj->addr_handler.link; + last_obj_ptr = &handler_obj->addr_handler.next; + handler_obj = handler_obj->addr_handler.next; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/Makefile linux/drivers/acpi/hardware/Makefile --- v2.4.0-test8/linux/drivers/acpi/hardware/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/hardware/Makefile Fri Sep 15 18:21:43 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwacpi.c linux/drivers/acpi/hardware/hwacpi.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwacpi.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/hardware/hwacpi.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: hwacpi - ACPI hardware functions - mode and timer + * $Revision: 22 $ * *****************************************************************************/ @@ -25,11 +25,11 @@ #include "acpi.h" -#include "hardware.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwacpi"); + MODULE_NAME ("hwacpi") /****************************************************************************** @@ -95,7 +95,7 @@ { - if (acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, (s32)SCI_EN)) { + if (acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, SCI_EN)) { return (SYS_MODE_ACPI); } else { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwcpu32.c linux/drivers/acpi/hardware/hwcpu32.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwcpu32.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/hardware/hwcpu32.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Name: hwcpu32.c - CPU support for IA32 (Throttling, Cx_states) + * $Revision: 33 $ * *****************************************************************************/ @@ -23,11 +24,11 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" +#include "acnamesp.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("Hwcpu32"); + MODULE_NAME ("Hwcpu32") #define BIT_4 0x10 /* TBD: [investigate] is this correct? */ @@ -82,7 +83,7 @@ *pm_timer_ticks = timer; } - return AE_OK; + return (AE_OK); } @@ -108,7 +109,7 @@ if (!pblk_address || !pm_timer_ticks) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* @@ -146,7 +147,7 @@ */ enable (); - return AE_OK; + return (AE_OK); } @@ -175,7 +176,7 @@ if (!pblk_address || !pm_timer_ticks) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* @@ -186,14 +187,14 @@ * eventually cause a demotion to C2 */ if (1 == (bus_master_status = - acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, (s32)BM_STS))) + acpi_hw_register_access (ACPI_READ, ACPI_MTX_LOCK, BM_STS))) { /* * Clear the BM_STS bit by setting it. */ - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, (s32)BM_STS, 1); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_STS, 1); *pm_timer_ticks = 0; - return AE_OK; + return (AE_OK); } /* @@ -253,7 +254,7 @@ */ enable(); - return AE_OK; + return (AE_OK); } @@ -277,7 +278,7 @@ { if (!acpi_hw_cx_handlers[acpi_hw_active_cx_state]) { - return AE_SUPPORT; + return (AE_SUPPORT); } return (acpi_hw_cx_handlers[acpi_hw_active_cx_state] (pblk_address, pm_timer_ticks)); @@ -305,11 +306,11 @@ * ---------------- */ if ((cx_state < 1) || (cx_state > 3)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (!acpi_hw_cx_handlers[cx_state]) { - return AE_SUPPORT; + return (AE_SUPPORT); } /* @@ -318,7 +319,7 @@ * We only care when moving from one state to another... */ if (acpi_hw_active_cx_state == cx_state) { - return AE_OK; + return (AE_OK); } /* @@ -331,7 +332,7 @@ switch (cx_state) { case 3: - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, (s32)BM_RLD, 1); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 1); break; } @@ -345,7 +346,7 @@ switch (acpi_hw_active_cx_state) { case 3: - acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, (s32)BM_RLD, 0); + acpi_hw_register_access (ACPI_WRITE, ACPI_MTX_LOCK, BM_RLD, 0); break; } @@ -355,7 +356,7 @@ */ acpi_hw_active_cx_state = cx_state; - return AE_OK; + return (AE_OK); } @@ -526,7 +527,7 @@ result = result * x; } - return result; + return (result); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwgpe.c linux/drivers/acpi/hardware/hwgpe.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwgpe.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/hardware/hwgpe.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions + * $Revision: 22 $ * *****************************************************************************/ @@ -23,12 +24,12 @@ */ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" -#include "events.h" +#include "achware.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwgpe"); + MODULE_NAME ("hwgpe") u8 decode_to8bit [8] = {1,2,4,8,16,32,64,128}; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwregs.c linux/drivers/acpi/hardware/hwregs.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwregs.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/hardware/hwregs.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,11 @@ -/****************************************************************************** +/******************************************************************************* * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. + * $Revision: 67 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,20 +27,20 @@ #include "acpi.h" -#include "hardware.h" -#include "namesp.h" +#include "achware.h" +#include "acnamesp.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwregs"); + MODULE_NAME ("hwregs") /* This matches the #defines in actypes.h. */ -ACPI_STRING sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_", +NATIVE_CHAR *sleep_state_table[] = {"\\_S0_","\\_S1_","\\_S2_","\\_S3_", "\\_S4_","\\_S4_b","\\_S5_"}; -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_get_bit_shift * @@ -52,11 +53,11 @@ * ******************************************************************************/ -s32 +u32 acpi_hw_get_bit_shift ( u32 mask) { - s32 shift; + u32 shift; for (shift = 0; ((mask >> shift) & 1) == 0; shift++) { ; } @@ -65,7 +66,7 @@ } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_clear_acpi_status * @@ -116,7 +117,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_obtain_sleep_type_register_data * @@ -129,8 +130,7 @@ * DESCRIPTION: Acpi_hw_obtain_sleep_type_register_data() obtains the SLP_TYP and * SLP_TYPb values for the sleep state requested. * - - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_hw_obtain_sleep_type_register_data ( @@ -139,7 +139,7 @@ u8 *slp_typ_b) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* @@ -157,45 +157,64 @@ */ status = acpi_ns_evaluate_by_name (sleep_state_table[sleep_state], NULL, &obj_desc); - if (AE_OK == status) { - if (obj_desc) { - /* - * We got something, now ensure it is correct. The object must - * be a package and must have at least 2 numeric values as the - * two elements - */ + if (ACPI_FAILURE (status)) { + return (status); + } - if ((obj_desc->common.type != ACPI_TYPE_PACKAGE) || - ((obj_desc->package.elements[0])->common.type != - ACPI_TYPE_NUMBER) || - ((obj_desc->package.elements[1])->common.type != - ACPI_TYPE_NUMBER)) - { - /* Invalid _Sx_ package type or value */ + if (!obj_desc) { + REPORT_ERROR ("Missing Sleep State object"); + return (AE_NOT_EXIST); + } - REPORT_ERROR ("Object type returned from interpreter differs from expected value"); - status = AE_ERROR; - } - else { - /* - * Valid _Sx_ package size, type, and value - */ - *slp_typ_a = - (u8) (obj_desc->package.elements[0])->number.value; + /* + * We got something, now ensure it is correct. The object must + * be a package and must have at least 2 numeric values as the + * two elements + */ - *slp_typ_b = - (u8) (obj_desc->package.elements[1])->number.value; - } + if (obj_desc->common.type != ACPI_TYPE_PACKAGE) { + /* Must be a package */ - acpi_cm_remove_reference (obj_desc); - } + REPORT_ERROR ("Sleep State object is not of type Package"); + status = AE_ERROR; + } + + else if (obj_desc->package.count < 2) { + /* Must have at least two elements */ + + REPORT_ERROR ("Sleep State package does not have at least two elements"); + status = AE_ERROR; + } + + else if (((obj_desc->package.elements[0])->common.type != + ACPI_TYPE_NUMBER) || + ((obj_desc->package.elements[1])->common.type != + ACPI_TYPE_NUMBER)) + { + /* Must have two */ + + REPORT_ERROR ("Sleep State package elements are not both of type Number"); + status = AE_ERROR; } + else { + /* + * Valid _Sx_ package size, type, and value + */ + *slp_typ_a = (u8) (obj_desc->package.elements[0])->number.value; + + *slp_typ_b = (u8) (obj_desc->package.elements[1])->number.value; + } + + + + acpi_cm_remove_reference (obj_desc); + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_hw_register_access * @@ -229,7 +248,7 @@ va_list marker; va_start (marker, register_id); - value = va_arg (marker, s32); + value = va_arg (marker, u32); va_end (marker); } @@ -407,7 +426,7 @@ register_value = (u32) acpi_os_in16 (acpi_gbl_FACP->pm1a_cnt_blk); } - if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (s32) SLP_TYPE_A) { + if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (u32) SLP_TYPE_A) { register_value |= (u32) acpi_os_in16 (acpi_gbl_FACP->pm1b_cnt_blk); } @@ -469,7 +488,7 @@ } } - if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (s32) SLP_TYPE_A) { + if (acpi_gbl_FACP->pm1b_cnt_blk && register_id != (u32) SLP_TYPE_A) { acpi_os_out16 (acpi_gbl_FACP->pm1b_cnt_blk, (u16) register_value); } } @@ -551,13 +570,17 @@ mask = (((u32) register_id) & BIT_IN_REGISTER_MASK); mask = 1 << (mask-1); - /* The base address of the GPE 0 Register Block */ - /* Plus 1/2 the length of the GPE 0 Register Block */ - /* The enable register is the register following the Status Register */ - /* and each register is defined as 1/2 of the total Register Block */ - - /* This sets the bit within Enable_bit that needs to be written to */ - /* the register indicated in Mask to a 1, all others are 0 */ + /* + * The base address of the GPE 0 Register Block + * Plus 1/2 the length of the GPE 0 Register Block + * The enable register is the register following the Status Register + * and each register is defined as 1/2 of the total Register Block + */ + + /* + * This sets the bit within Enable_bit that needs to be written to + * the register indicated in Mask to a 1, all others are 0 + */ if (mask > LOW_BYTE) { /* Shift the value 1 byte to the right and add 1 to the register */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/hardware/hwxface.c linux/drivers/acpi/hardware/hwxface.c --- v2.4.0-test8/linux/drivers/acpi/hardware/hwxface.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/hardware/hwxface.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Name: hwxface.c - Hardware access external interfaces + * $Revision: 31 $ * *****************************************************************************/ @@ -24,11 +25,11 @@ */ #include "acpi.h" -#include "namesp.h" -#include "hardware.h" +#include "acnamesp.h" +#include "achware.h" #define _COMPONENT HARDWARE - MODULE_NAME ("hwxface"); + MODULE_NAME ("hwxface") /****************************************************************************** @@ -68,10 +69,9 @@ NATIVE_UINT num_throttle_states; NATIVE_UINT buffer_space_needed; NATIVE_UINT i; - u8 duty_offset; - u8 duty_width; - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + u8 duty_width = 0; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; ACPI_CPU_THROTTLING_STATE *state_ptr; @@ -86,8 +86,8 @@ * Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { return (AE_BAD_PARAMETER); } @@ -95,23 +95,27 @@ * Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { return (AE_NOT_FOUND); } - duty_offset = acpi_gbl_FACP->duty_offset; +#ifndef _IA64 + /* + * No Duty fields in IA64 tables + */ duty_width = acpi_gbl_FACP->duty_width; +#endif /* * P0 must always have a P_BLK all others may be null - * in either case, we can't thottle a processor that has no P_BLK + * in either case, we can't throttle a processor that has no P_BLK * * Also if no Duty width, one state and it is 100% * */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { /* * Acpi_even though we can't throttle, we still have one state (100%) @@ -169,30 +173,35 @@ ACPI_HANDLE processor_handle, u32 *throttle_state) { - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; u32 num_throttle_states; u32 duty_cycle; - u8 duty_offset; - u8 duty_width; + u8 duty_offset = 0; + u8 duty_width = 0; /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry || !throttle_state) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node || !throttle_state) { return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { return (AE_NOT_FOUND); } +#ifndef _IA64 + /* + * No Duty fields in IA64 tables + */ duty_offset = acpi_gbl_FACP->duty_offset; duty_width = acpi_gbl_FACP->duty_width; +#endif /* * Must have a valid P_BLK P0 must have a P_BLK all others may be null @@ -201,8 +210,8 @@ * * also, if Duty_width is zero there are no additional states */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { *throttle_state = 0; return(AE_OK); @@ -214,7 +223,7 @@ * Get the current duty cycle value. */ duty_cycle = acpi_hw_get_duty_cycle (duty_offset, - cpu_obj->processor.pblk_address, + cpu_obj->processor.address, num_throttle_states); /* @@ -251,8 +260,8 @@ ACPI_HANDLE processor_handle, u32 throttle_state) { - ACPI_NAMED_OBJECT *cpu_entry; - ACPI_OBJECT_INTERNAL *cpu_obj; + ACPI_NAMESPACE_NODE *cpu_node; + ACPI_OPERAND_OBJECT *cpu_obj; u32 num_throttle_states = 0; u8 duty_offset = 0; u8 duty_width = 0; @@ -261,20 +270,25 @@ /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { return (AE_NOT_FOUND); } +#ifndef _IA64 + /* + * No Duty fields in IA64 tables + */ duty_offset = acpi_gbl_FACP->duty_offset; duty_width = acpi_gbl_FACP->duty_width; +#endif /* * Must have a valid P_BLK P0 must have a P_BLK all others may be null @@ -283,8 +297,8 @@ * * also, if Duty_width is zero there are no additional states */ - if (!cpu_obj->processor.pblk_length || !duty_width || - (0xFFFF < cpu_obj->processor.pblk_address)) + if (!cpu_obj->processor.length || !duty_width || + (0xFFFF < cpu_obj->processor.address)) { /* * If caller wants to set the state to the only state we handle @@ -312,19 +326,19 @@ /* * Turn off throttling (don't muck with the h/w while throttling). */ - acpi_hw_disable_throttling (cpu_obj->processor.pblk_address); + acpi_hw_disable_throttling (cpu_obj->processor.address); /* * Program the throttling state. */ acpi_hw_program_duty_cycle (duty_offset, duty_cycle, - cpu_obj->processor.pblk_address, num_throttle_states); + cpu_obj->processor.address, num_throttle_states); /* * Only enable throttling for non-zero states (0 - 100%) */ if (throttle_state) { - acpi_hw_enable_throttling (cpu_obj->processor.pblk_address); + acpi_hw_enable_throttling (cpu_obj->processor.address); } return(AE_OK); @@ -438,9 +452,9 @@ ACPI_HANDLE processor_handle, u32 *pm_timer_ticks) { - ACPI_NAMED_OBJECT *cpu_entry = NULL; - ACPI_OBJECT_INTERNAL *cpu_obj = NULL; - ACPI_IO_ADDRESS pblk_address = 0; + ACPI_NAMESPACE_NODE *cpu_node = NULL; + ACPI_OPERAND_OBJECT *cpu_obj = NULL; + ACPI_IO_ADDRESS address = 0; /* @@ -449,31 +463,31 @@ /* Convert and validate the device handle */ - cpu_entry = acpi_ns_convert_handle_to_entry (processor_handle); - if (!cpu_entry) { - return AE_BAD_PARAMETER; + cpu_node = acpi_ns_convert_handle_to_entry (processor_handle); + if (!cpu_node) { + return (AE_BAD_PARAMETER); } /* Check for an existing internal object */ - cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_entry); + cpu_obj = acpi_ns_get_attached_object ((ACPI_HANDLE) cpu_node); if (!cpu_obj) { - return AE_NOT_FOUND; + return (AE_NOT_FOUND); } /* Get the processor register block (P_BLK) address */ - pblk_address = cpu_obj->processor.pblk_address; - if (!cpu_obj->processor.pblk_length) { + address = cpu_obj->processor.address; + if (!cpu_obj->processor.length) { /* Ensure a NULL addresss (note that P_BLK isn't required for C1) */ - pblk_address = 0; + address = 0; } /* * Enter the currently active Cx sleep state. */ - return acpi_hw_enter_cx (pblk_address, pm_timer_ticks); + return (acpi_hw_enter_cx (address, pm_timer_ticks)); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/accommon.h linux/drivers/acpi/include/accommon.h --- v2.4.0-test8/linux/drivers/acpi/include/accommon.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/accommon.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,661 @@ +/****************************************************************************** + * + * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures + * $Revision: 74 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef _ACCOMMON_H +#define _ACCOMMON_H + + +#define REF_INCREMENT (u16) 0 +#define REF_DECREMENT (u16) 1 +#define REF_FORCE_DELETE (u16) 2 + +/* Acpi_cm_dump_buffer */ + +#define DB_BYTE_DISPLAY 1 +#define DB_WORD_DISPLAY 2 +#define DB_DWORD_DISPLAY 4 +#define DB_QWORD_DISPLAY 8 + + +/* Global initialization interfaces */ + +void +acpi_cm_init_globals ( + ACPI_INIT_DATA *init_data); + +void +acpi_cm_terminate ( + void); + + +/* + * Acpi_cm_init - miscellaneous initialization and shutdown + */ + +ACPI_STATUS +acpi_cm_hardware_initialize ( + void); + +ACPI_STATUS +acpi_cm_subsystem_shutdown ( + void); + +/* + * Acpi_cm_global - Global data structures and procedures + */ + +NATIVE_CHAR * +acpi_cm_get_mutex_name ( + u32 mutex_id); + +NATIVE_CHAR * +acpi_cm_get_type_name ( + u32 type); + +u8 +acpi_cm_valid_object_type ( + u32 type); + +ACPI_OWNER_ID +acpi_cm_allocate_owner_id ( + u32 id_type); + + +/* + * Acpi_cm_clib - Local implementations of C library functions + */ + +NATIVE_UINT +acpi_cm_strlen ( + const NATIVE_CHAR *string); + +NATIVE_CHAR * +acpi_cm_strcpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string); + +NATIVE_CHAR * +acpi_cm_strncpy ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count); + +u32 +acpi_cm_strncmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2, + NATIVE_UINT count); + +u32 +acpi_cm_strcmp ( + const NATIVE_CHAR *string1, + const NATIVE_CHAR *string2); + +NATIVE_CHAR * +acpi_cm_strcat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string); + +NATIVE_CHAR * +acpi_cm_strncat ( + NATIVE_CHAR *dst_string, + const NATIVE_CHAR *src_string, + NATIVE_UINT count); + +u32 +acpi_cm_strtoul ( + const NATIVE_CHAR *string, + NATIVE_CHAR **terminator, + u32 base); + +NATIVE_CHAR * +acpi_cm_strstr ( + NATIVE_CHAR *string1, + NATIVE_CHAR *string2); + +NATIVE_CHAR * +acpi_cm_strupr ( + NATIVE_CHAR *src_string); + +void * +acpi_cm_memcpy ( + void *dest, + const void *src, + NATIVE_UINT count); + +void * +acpi_cm_memset ( + void *dest, + u32 value, + NATIVE_UINT count); + +u32 +acpi_cm_to_upper ( + u32 c); + +u32 +acpi_cm_to_lower ( + u32 c); + + +/* + * Acpi_cm_copy - Object construction and conversion interfaces + */ + +ACPI_STATUS +acpi_cm_build_simple_object( + ACPI_OPERAND_OBJECT *obj, + ACPI_OBJECT *user_obj, + u8 *data_space, + u32 *buffer_space_used); + +ACPI_STATUS +acpi_cm_build_package_object ( + ACPI_OPERAND_OBJECT *obj, + u8 *buffer, + u32 *space_used); + +ACPI_STATUS +acpi_cm_build_external_object ( + ACPI_OPERAND_OBJECT *obj, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_cm_build_internal_simple_object( + ACPI_OBJECT *user_obj, + ACPI_OPERAND_OBJECT *obj); + +ACPI_STATUS +acpi_cm_build_internal_object ( + ACPI_OBJECT *obj, + ACPI_OPERAND_OBJECT *internal_obj); + +ACPI_STATUS +acpi_cm_copy_internal_simple_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj); + +ACPI_STATUS +acpi_cm_build_copy_internal_package_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj); + + +/* + * Acpi_cm_create - Object creation + */ + +ACPI_STATUS +acpi_cm_update_object_reference ( + ACPI_OPERAND_OBJECT *object, + u16 action); + +ACPI_OPERAND_OBJECT * +_cm_create_internal_object ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + OBJECT_TYPE_INTERNAL type); + + +/* + * Acpi_cm_debug - Debug interfaces + */ + +u32 +get_debug_level ( + void); + +void +set_debug_level ( + u32 level); + +void +function_trace ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name); + +void +function_trace_ptr ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + void *pointer); + +void +function_trace_u32 ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u32 integer); + +void +function_trace_str ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_CHAR *string); + +void +function_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name); + +void +function_status_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + ACPI_STATUS status); + +void +function_value_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + NATIVE_UINT value); + +void +function_ptr_exit ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *function_name, + u8 *ptr); + +void +debug_print_prefix ( + NATIVE_CHAR *module_name, + u32 line_number); + +void +debug_print ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + u32 print_level, + NATIVE_CHAR *format, ...); + +void +debug_print_raw ( + NATIVE_CHAR *format, ...); + +void +_report_info ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +_report_error ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +_report_warning ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id, + NATIVE_CHAR *message); + +void +acpi_cm_dump_buffer ( + u8 *buffer, + u32 count, + u32 display, + u32 component_id); + + +/* + * Acpi_cm_delete - Object deletion + */ + +void +acpi_cm_delete_internal_obj ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_delete_internal_package_object ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_delete_internal_simple_object ( + ACPI_OPERAND_OBJECT *object); + +ACPI_STATUS +acpi_cm_delete_internal_object_list ( + ACPI_OPERAND_OBJECT **obj_list); + + +/* + * Acpi_cm_eval - object evaluation + */ + +/* Method name strings */ + +#define METHOD_NAME__HID "_HID" +#define METHOD_NAME__UID "_UID" +#define METHOD_NAME__ADR "_ADR" +#define METHOD_NAME__STA "_STA" +#define METHOD_NAME__REG "_REG" +#define METHOD_NAME__SEG "_SEG" +#define METHOD_NAME__BBN "_BBN" + + +ACPI_STATUS +acpi_cm_evaluate_numeric_object ( + NATIVE_CHAR *method_name, + ACPI_NAMESPACE_NODE *device_node, + u32 *address); + +ACPI_STATUS +acpi_cm_execute_HID ( + ACPI_NAMESPACE_NODE *device_node, + DEVICE_ID *hid); + +ACPI_STATUS +acpi_cm_execute_STA ( + ACPI_NAMESPACE_NODE *device_node, + u32 *status_flags); + +ACPI_STATUS +acpi_cm_execute_UID ( + ACPI_NAMESPACE_NODE *device_node, + DEVICE_ID *uid); + + +/* + * Acpi_cm_error - exception interfaces + */ + +NATIVE_CHAR * +acpi_cm_format_exception ( + ACPI_STATUS status); + + +/* + * Acpi_cm_mutex - mutual exclusion interfaces + */ + +ACPI_STATUS +acpi_cm_mutex_initialize ( + void); + +void +acpi_cm_mutex_terminate ( + void); + +ACPI_STATUS +acpi_cm_create_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_delete_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_acquire_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + +ACPI_STATUS +acpi_cm_release_mutex ( + ACPI_MUTEX_HANDLE mutex_id); + + +/* + * Acpi_cm_object - internal object create/delete/cache routines + */ + +void * +_cm_allocate_object_desc ( + NATIVE_CHAR *module_name, + u32 line_number, + u32 component_id); + +#define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t) +#define acpi_cm_allocate_object_desc() _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT) + +void +acpi_cm_delete_object_desc ( + ACPI_OPERAND_OBJECT *object); + +u8 +acpi_cm_valid_internal_object ( + void *object); + + +/* + * Acpi_cm_ref_cnt - Object reference count management + */ + +void +acpi_cm_add_reference ( + ACPI_OPERAND_OBJECT *object); + +void +acpi_cm_remove_reference ( + ACPI_OPERAND_OBJECT *object); + +/* + * Acpi_cm_size - Object size routines + */ + +ACPI_STATUS +acpi_cm_get_simple_object_size ( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + +ACPI_STATUS +acpi_cm_get_package_object_size ( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + +ACPI_STATUS +acpi_cm_get_object_size( + ACPI_OPERAND_OBJECT *obj, + u32 *obj_length); + + +/* + * Acpi_cm_state - Generic state creation/cache routines + */ + +void +acpi_cm_push_generic_state ( + ACPI_GENERIC_STATE **list_head, + ACPI_GENERIC_STATE *state); + +ACPI_GENERIC_STATE * +acpi_cm_pop_generic_state ( + ACPI_GENERIC_STATE **list_head); + + +ACPI_GENERIC_STATE * +acpi_cm_create_generic_state ( + void); + +ACPI_GENERIC_STATE * +acpi_cm_create_update_state ( + ACPI_OPERAND_OBJECT *object, + u16 action); + +ACPI_STATUS +acpi_cm_create_update_state_and_push ( + ACPI_OPERAND_OBJECT *object, + u16 action, + ACPI_GENERIC_STATE **state_list); + +ACPI_GENERIC_STATE * +acpi_cm_create_control_state ( + void); + +void +acpi_cm_delete_generic_state ( + ACPI_GENERIC_STATE *state); + +void +acpi_cm_delete_generic_state_cache ( + void); + +void +acpi_cm_delete_object_cache ( + void); + +/* + * Acpi_cmutils + */ + +u8 +acpi_cm_valid_acpi_name ( + u32 name); + +u8 +acpi_cm_valid_acpi_character ( + NATIVE_CHAR character); + + +/* + * Memory allocation functions and related macros. + * Macros that expand to include filename and line number + */ + +void * +_cm_allocate ( + u32 size, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void * +_cm_callocate ( + u32 size, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void +_cm_free ( + void *address, + u32 component, + NATIVE_CHAR *module, + u32 line); + +void +acpi_cm_init_static_object ( + ACPI_OPERAND_OBJECT *obj_desc); + +#define acpi_cm_allocate(a) _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__) + +#ifndef ACPI_DEBUG + +#define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f) +#define acpi_cm_delete_element_from_alloc_list(a,b,c,d) +#define acpi_cm_dump_current_allocations(a,b) +#define acpi_cm_dump_allocation_info() + +#define DECREMENT_OBJECT_METRICS(a) +#define INCREMENT_OBJECT_METRICS(a) +#define INITIALIZE_ALLOCATION_METRICS() +#define DECREMENT_NAME_TABLE_METRICS(a) +#define INCREMENT_NAME_TABLE_METRICS(a) + +#else + +#define INITIALIZE_ALLOCATION_METRICS() \ + acpi_gbl_current_object_count = 0; \ + acpi_gbl_current_object_size = 0; \ + acpi_gbl_running_object_count = 0; \ + acpi_gbl_running_object_size = 0; \ + acpi_gbl_max_concurrent_object_count = 0; \ + acpi_gbl_max_concurrent_object_size = 0; \ + acpi_gbl_current_alloc_size = 0; \ + acpi_gbl_current_alloc_count = 0; \ + acpi_gbl_running_alloc_size = 0; \ + acpi_gbl_running_alloc_count = 0; \ + acpi_gbl_max_concurrent_alloc_size = 0; \ + acpi_gbl_max_concurrent_alloc_count = 0; \ + acpi_gbl_current_node_count = 0; \ + acpi_gbl_current_node_size = 0; \ + acpi_gbl_max_concurrent_node_count = 0 + + +#define DECREMENT_OBJECT_METRICS(a) \ + acpi_gbl_current_object_count--; \ + acpi_gbl_current_object_size -= a + +#define INCREMENT_OBJECT_METRICS(a) \ + acpi_gbl_current_object_count++; \ + acpi_gbl_running_object_count++; \ + if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \ + { \ + acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \ + } \ + acpi_gbl_running_object_size += a; \ + acpi_gbl_current_object_size += a; \ + if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \ + { \ + acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \ + } + +#define DECREMENT_NAME_TABLE_METRICS(a) \ + acpi_gbl_current_node_count--; \ + acpi_gbl_current_node_size -= (a) + +#define INCREMENT_NAME_TABLE_METRICS(a) \ + acpi_gbl_current_node_count++; \ + acpi_gbl_current_node_size+= (a); \ + if (acpi_gbl_max_concurrent_node_count < acpi_gbl_current_node_count) \ + { \ + acpi_gbl_max_concurrent_node_count = acpi_gbl_current_node_count; \ + } \ + + +void +acpi_cm_dump_allocation_info ( + void); + +void +acpi_cm_dump_current_allocations ( + u32 component, + NATIVE_CHAR *module); + +#endif + + +#endif /* _ACCOMMON_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acconfig.h linux/drivers/acpi/include/acconfig.h --- v2.4.0-test8/linux/drivers/acpi/include/acconfig.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acconfig.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,186 @@ +/****************************************************************************** + * + * Name: acconfig.h - Global configuration constants + * $Revision: 42 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef _ACCONFIG_H +#define _ACCONFIG_H + + +/****************************************************************************** + * + * Compile-time options + * + *****************************************************************************/ + +/* + * ACPI_DEBUG - This switch enables all the debug facilities of the ACPI + * subsystem. This includes the DEBUG_PRINT output statements + * When disabled, all DEBUG_PRINT statements are compiled out. + * + * ACPI_APPLICATION - Use this switch if the subsystem is going to be run + * at the application level. + * + */ + + +/****************************************************************************** + * + * Subsystem Constants + * + *****************************************************************************/ + + +/* Version string */ + +#define ACPI_CA_VERSION __DATE__ + +/* Name of host operating system (returned by the _OS_ namespace object) */ + +#ifdef _LINUX +#define ACPI_OS_NAME "Linux" +#else +#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" +#endif + + +/* + * How and when control methods will be parsed + * The default action is to parse all methods at table load time to verify them, but delete the parse trees + * to conserve memory. Methods are parsed just in time before execution and the parse tree is deleted + * when execution completes. + */ +#define METHOD_PARSE_AT_INIT 0x0 /* Parse at table init, never delete the method parse tree */ +#define METHOD_PARSE_JUST_IN_TIME 0x1 /* Parse only when a method is invoked */ +#define METHOD_DELETE_AT_COMPLETION 0x2 /* Delete parse tree on method completion */ + +/* Default parsing configuration */ + +#define METHOD_PARSE_CONFIGURATION (METHOD_PARSE_JUST_IN_TIME | METHOD_DELETE_AT_COMPLETION) + + +/* Maximum objects in the various object caches */ + +#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ +#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ +#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ +#define MAX_WALK_CACHE_DEPTH 2 /* Objects for parse tree walks (method execution) */ + +/* + * Name_space Table size + * + * All tables are the same size to simplify the implementation. + * Tables may be extended by allocating additional tables that + * are in turn linked together to form a chain of tables. + */ + +#define NS_TABLE_SIZE 4 + +/* String size constants */ + +#define MAX_STRING_LENGTH 512 +#define PATHNAME_MAX 256 /* A full namespace pathname */ + + +/* Maximum count for a semaphore object */ + +#define MAX_SEMAPHORE_COUNT 256 + + +/* Max reference count (for debug only) */ + +#define MAX_REFERENCE_COUNT 0x200 + + +/* Size of cached memory mapping for system memory operation region */ + +#define SYSMEM_REGION_WINDOW_SIZE 4096 + + +/* + * Debugger threading model + * Use single threaded if the entire subsystem is contained in an application + * Use multiple threaded when the the subsystem is running in the kernel. + * + * By default the model is single threaded if ACPI_APPLICATION is set, + * multi-threaded if ACPI_APPLICATION is not set. + */ + +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + +#ifdef ACPI_APPLICATION +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED + +#else +#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED +#endif + + +/****************************************************************************** + * + * ACPI Specification constants (Do not change unless the specification changes) + * + *****************************************************************************/ + +/* + * Method info (in WALK_STATE), containing local variables and argumetns + */ + +#define MTH_NUM_LOCALS 8 +#define MTH_MAX_LOCAL 7 + +#define MTH_NUM_ARGS 7 +#define MTH_MAX_ARG 6 + +/* + * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG + */ + +#define OBJ_NUM_OPERANDS 8 +#define OBJ_MAX_OPERAND 7 + +/* Names within the namespace are 4 bytes long */ + +#define ACPI_NAME_SIZE 4 +#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 s8 for separator */ +#define PATH_SEPARATOR '.' + + +/* Constants used in searching for the RSDP in low memory */ + +#define LO_RSDP_WINDOW_BASE (void *) 0 +#define HI_RSDP_WINDOW_BASE (void *) 0xE0000 +#define LO_RSDP_WINDOW_SIZE 0x400 +#define HI_RSDP_WINDOW_SIZE 0x20000 +#define RSDP_SCAN_STEP 16 + + +/* Maximum nesting of package objects */ + +#define MAX_PACKAGE_DEPTH 16 + + +#endif /* _ACCONFIG_H */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acdebug.h linux/drivers/acpi/include/acdebug.h --- v2.4.0-test8/linux/drivers/acpi/include/acdebug.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acdebug.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,396 @@ +/****************************************************************************** + * + * Name: acdebug.h - ACPI/AML debugger + * $Revision: 35 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACDEBUG_H__ +#define __ACDEBUG_H__ + + +#define DB_MAX_ARGS 8 /* Must be max method args + 1 */ + +#define DB_COMMAND_PROMPT '-' +#define DB_EXECUTE_PROMPT '%' + + +extern int optind; +extern NATIVE_CHAR *optarg; +extern u8 *aml_ptr; +extern u32 acpi_aml_length; + +extern u8 opt_tables; +extern u8 opt_disasm; +extern u8 opt_stats; +extern u8 opt_parse_jit; +extern u8 opt_verbose; + + +extern NATIVE_CHAR *args[DB_MAX_ARGS]; +extern NATIVE_CHAR line_buf[80]; +extern NATIVE_CHAR scope_buf[40]; +extern NATIVE_CHAR debug_filename[40]; +extern u8 output_to_file; +extern NATIVE_CHAR *buffer; +extern NATIVE_CHAR *filename; +extern NATIVE_CHAR *INDENT_STRING; +extern u8 acpi_gbl_db_output_flags; +extern u32 acpi_gbl_db_debug_level; +extern u32 acpi_gbl_db_console_debug_level; + +extern u32 num_names; +extern u32 num_methods; +extern u32 num_regions; +extern u32 num_packages; +extern u32 num_aliases; +extern u32 num_devices; +extern u32 num_field_defs; +extern u32 num_thermal_zones; +extern u32 num_nodes; +extern u32 num_grammar_elements; +extern u32 num_method_elements ; +extern u32 num_mutexes; +extern u32 num_power_resources; +extern u32 num_bank_fields ; +extern u32 num_index_fields; +extern u32 num_events; + +extern u32 size_of_parse_tree; +extern u32 size_of_method_trees; +extern u32 size_of_nTes; +extern u32 size_of_acpi_objects; + + +#define BUFFER_SIZE 4196 + +#define DB_REDIRECTABLE_OUTPUT 0x01 +#define DB_CONSOLE_OUTPUT 0x02 +#define DB_DUPLICATE_OUTPUT 0x03 + + +typedef struct command_info +{ + NATIVE_CHAR *name; /* Command Name */ + u8 min_args; /* Minimum arguments required */ + +} COMMAND_INFO; + + +typedef struct argument_info +{ + NATIVE_CHAR *name; /* Argument Name */ + +} ARGUMENT_INFO; + + +#define PARAM_LIST(pl) pl + +#define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose) + +#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ + acpi_os_printf PARAM_LIST(fp);} + +#define EX_NO_SINGLE_STEP 1 +#define EX_SINGLE_STEP 2 + + +/* Prototypes */ + + +/* + * dbapi - external debugger interfaces + */ + +int +acpi_db_initialize ( + void); + +ACPI_STATUS +acpi_db_single_step ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + u8 op_type); + + +/* + * dbcmds - debug commands and output routines + */ + + +void +acpi_db_display_table_info ( + NATIVE_CHAR *table_arg); + +void +acpi_db_unload_acpi_table ( + NATIVE_CHAR *table_arg, + NATIVE_CHAR *instance_arg); + +void +acpi_db_set_method_breakpoint ( + NATIVE_CHAR *location, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_set_method_call_breakpoint ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_disassemble_aml ( + NATIVE_CHAR *statements, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_dump_namespace ( + NATIVE_CHAR *start_arg, + NATIVE_CHAR *depth_arg); + +void +acpi_db_dump_namespace_by_owner ( + NATIVE_CHAR *owner_arg, + NATIVE_CHAR *depth_arg); + +void +acpi_db_send_notify ( + NATIVE_CHAR *name, + u32 value); + +void +acpi_db_set_method_data ( + NATIVE_CHAR *type_arg, + NATIVE_CHAR *index_arg, + NATIVE_CHAR *value_arg); + +ACPI_STATUS +acpi_db_display_objects ( + NATIVE_CHAR *obj_type_arg, + NATIVE_CHAR *display_count_arg); + +ACPI_STATUS +acpi_db_find_name_in_namespace ( + NATIVE_CHAR *name_arg); + +void +acpi_db_set_scope ( + NATIVE_CHAR *name); + +void +acpi_db_find_references ( + NATIVE_CHAR *object_arg); + + +/* + * dbdisasm - AML disassembler + */ + +void +acpi_db_display_op ( + ACPI_PARSE_OBJECT *origin, + u32 num_opcodes); + +void +acpi_db_display_namestring ( + NATIVE_CHAR *name); + +void +acpi_db_display_path ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_display_opcode ( + ACPI_PARSE_OBJECT *op); + + +/* + * dbdisply - debug display commands + */ + + +void +acpi_db_display_method_info ( + ACPI_PARSE_OBJECT *op); + +void +acpi_db_decode_and_display_object ( + NATIVE_CHAR *target, + NATIVE_CHAR *output_type); + +void +acpi_db_display_result_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_db_display_all_methods ( + NATIVE_CHAR *display_count_arg); + +void +acpi_db_display_internal_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + +void +acpi_db_display_arguments ( + void); + +void +acpi_db_display_locals ( + void); + +void +acpi_db_display_results ( + void); + +void +acpi_db_display_calling_tree ( + void); + +void +acpi_db_display_argument_object ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_WALK_STATE *walk_state); + + +/* + * dbexec - debugger control method execution + */ + +void +acpi_db_execute ( + NATIVE_CHAR *name, + NATIVE_CHAR **args, + u32 flags); + +void +acpi_db_create_execution_threads ( + NATIVE_CHAR *num_threads_arg, + NATIVE_CHAR *num_loops_arg, + NATIVE_CHAR *method_name_arg); + + +/* + * dbfileio - Debugger file I/O commands + */ + +OBJECT_TYPE_INTERNAL +acpi_db_match_argument ( + NATIVE_CHAR *user_argument, + ARGUMENT_INFO *arguments); + + +void +acpi_db_close_debug_file ( + void); + +void +acpi_db_open_debug_file ( + NATIVE_CHAR *name); + +ACPI_STATUS +acpi_db_load_acpi_table ( + NATIVE_CHAR *filename); + + +/* + * dbhistry - debugger HISTORY command + */ + +void +acpi_db_add_to_history ( + NATIVE_CHAR *command_line); + +void +acpi_db_display_history (void); + +NATIVE_CHAR * +acpi_db_get_from_history ( + NATIVE_CHAR *command_num_arg); + + +/* + * dbinput - user front-end to the AML debugger + */ + +ACPI_STATUS +acpi_db_command_dispatch ( + NATIVE_CHAR *input_buffer, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +void +acpi_db_execute_thread ( + void *context); + +ACPI_STATUS +acpi_db_user_commands ( + NATIVE_CHAR prompt, + ACPI_PARSE_OBJECT *op); + + +/* + * dbstats - Generation and display of ACPI table statistics + */ + +void +acpi_db_generate_statistics ( + ACPI_PARSE_OBJECT *root, + u8 is_method); + + +ACPI_STATUS +acpi_db_display_statistics ( + NATIVE_CHAR *type_arg); + + +/* + * dbutils - AML debugger utilities + */ + +void +acpi_db_set_output_destination ( + u32 where); + +void +acpi_db_dump_buffer ( + u32 address); + +void +acpi_db_dump_object ( + ACPI_OBJECT *obj_desc, + u32 level); + +void +acpi_db_prep_namestring ( + NATIVE_CHAR *name); + + +ACPI_STATUS +acpi_db_second_pass_parse ( + ACPI_PARSE_OBJECT *root); + +ACPI_NAMESPACE_NODE * +acpi_db_local_ns_lookup ( + NATIVE_CHAR *name); + + +#endif /* __ACDEBUG_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acdispat.h linux/drivers/acpi/include/acdispat.h --- v2.4.0-test8/linux/drivers/acpi/include/acdispat.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acdispat.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,401 @@ +/****************************************************************************** + * + * Name: acdispat.h - dispatcher (parser to interpreter interface) + * $Revision: 29 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#ifndef _ACDISPAT_H_ +#define _ACDISPAT_H_ + + +#define NAMEOF_LOCAL_NTE "__L0" +#define NAMEOF_ARG_NTE "__A0" + + +/* For Acpi_ds_method_data_set_value */ + +#define MTH_TYPE_LOCAL 0 +#define MTH_TYPE_ARG 1 + + +/* Common interfaces */ + +ACPI_STATUS +acpi_ds_obj_stack_push ( + void *object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop ( + u32 pop_count, + ACPI_WALK_STATE *walk_state); + +void * +acpi_ds_obj_stack_get_value ( + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop_object ( + ACPI_OPERAND_OBJECT **object, + ACPI_WALK_STATE *walk_state); + + +/* dsregion - Op region support */ + +ACPI_STATUS +acpi_ds_get_region_arguments ( + ACPI_OPERAND_OBJECT *rgn_desc); + + +/* dsctrl - Parser/Interpreter interface, control stack routines */ + + +ACPI_STATUS +acpi_ds_exec_begin_control_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_exec_end_control_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + + +/* dsexec - Parser/Interpreter interface, method execution callbacks */ + +ACPI_STATUS +acpi_ds_exec_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_exec_end_op ( + ACPI_WALK_STATE *state, + ACPI_PARSE_OBJECT *op); + + +/* dsfield - Parser/Interpreter interface for AML fields */ + + +ACPI_STATUS +acpi_ds_create_field ( + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_bank_field ( + ACPI_PARSE_OBJECT *op, + ACPI_NAMESPACE_NODE *region_node, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_index_field ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE region_node, + ACPI_WALK_STATE *walk_state); + + +/* dsload - Parser/Interpreter interface, namespace load callbacks */ + +ACPI_STATUS +acpi_ds_load1_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_load1_end_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_load2_begin_op ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +ACPI_STATUS +acpi_ds_load2_end_op ( + ACPI_WALK_STATE *state, + ACPI_PARSE_OBJECT *op); + + +/* dsmthdat - method data (locals/args) */ + + +ACPI_STATUS +acpi_ds_method_data_get_entry ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT ***node); + +ACPI_STATUS +acpi_ds_method_data_delete_all ( + ACPI_WALK_STATE *walk_state); + +u8 +acpi_ds_is_method_value ( + ACPI_OPERAND_OBJECT *obj_desc); + +OBJECT_TYPE_INTERNAL +acpi_ds_method_data_get_type ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_get_value ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **dest_desc); + +ACPI_STATUS +acpi_ds_method_data_set_value ( + u32 type, + u32 index, + ACPI_OPERAND_OBJECT *src_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_delete_value ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_init_args ( + ACPI_OPERAND_OBJECT **params, + u32 max_param_count, + ACPI_WALK_STATE *walk_state); + +ACPI_NAMESPACE_NODE * +acpi_ds_method_data_get_nte ( + u32 type, + u32 index, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_init ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_method_data_set_entry ( + u32 type, + u32 index, + ACPI_OPERAND_OBJECT *object, + ACPI_WALK_STATE *walk_state); + + +/* dsmethod - Parser/Interpreter interface - control method parsing */ + +ACPI_STATUS +acpi_ds_parse_method ( + ACPI_HANDLE obj_handle); + +ACPI_STATUS +acpi_ds_call_control_method ( + ACPI_WALK_LIST *walk_list, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_restart_control_method ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT *return_desc); + +ACPI_STATUS +acpi_ds_terminate_control_method ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_begin_method_execution ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT *obj_desc); + + +/* dsobj - Parser/Interpreter interface - object initialization and conversion */ + +ACPI_STATUS +acpi_ds_init_one_object ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +ACPI_STATUS +acpi_ds_initialize_objects ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *start_node); + +ACPI_STATUS +acpi_ds_build_internal_package_obj ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc); + +ACPI_STATUS +acpi_ds_build_internal_object ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT **obj_desc_ptr); + +ACPI_STATUS +acpi_ds_init_object_from_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + u16 opcode, + ACPI_OPERAND_OBJECT **obj_desc); + +ACPI_STATUS +acpi_ds_create_node ( + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *node, + ACPI_PARSE_OBJECT *op); + + +/* dsregn - Parser/Interpreter interface - Op Region parsing */ + +ACPI_STATUS +acpi_ds_eval_region_operands ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op); + +ACPI_STATUS +acpi_ds_initialize_region ( + ACPI_HANDLE obj_handle); + + +/* dsutils - Parser/Interpreter interface utility routines */ + +u8 +acpi_ds_is_result_used ( + ACPI_PARSE_OBJECT *op); + +void +acpi_ds_delete_result_if_not_used ( + ACPI_PARSE_OBJECT *op, + ACPI_OPERAND_OBJECT *result_obj, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_create_operand ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *arg); + +ACPI_STATUS +acpi_ds_create_operands ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *first_arg); + +ACPI_STATUS +acpi_ds_resolve_operands ( + ACPI_WALK_STATE *walk_state); + +OBJECT_TYPE_INTERNAL +acpi_ds_map_opcode_to_data_type ( + u16 opcode, + u32 *out_flags); + +OBJECT_TYPE_INTERNAL +acpi_ds_map_named_opcode_to_data_type ( + u16 opcode); + + +/* + * dswscope - Scope Stack manipulation + */ + +ACPI_STATUS +acpi_ds_scope_stack_push ( + ACPI_NAMESPACE_NODE *node, + OBJECT_TYPE_INTERNAL type, + ACPI_WALK_STATE *walk_state); + + +ACPI_STATUS +acpi_ds_scope_stack_pop ( + ACPI_WALK_STATE *walk_state); + +void +acpi_ds_scope_stack_clear ( + ACPI_WALK_STATE *walk_state); + + +/* Acpi_dswstate - parser WALK_STATE management routines */ + +ACPI_WALK_STATE * +acpi_ds_create_walk_state ( + ACPI_OWNER_ID owner_id, + ACPI_PARSE_OBJECT *origin, + ACPI_OPERAND_OBJECT *mth_desc, + ACPI_WALK_LIST *walk_list); + +ACPI_STATUS +acpi_ds_obj_stack_delete_all ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_obj_stack_pop_and_delete ( + u32 pop_count, + ACPI_WALK_STATE *walk_state); + +void +acpi_ds_delete_walk_state ( + ACPI_WALK_STATE *walk_state); + +ACPI_WALK_STATE * +acpi_ds_pop_walk_state ( + ACPI_WALK_LIST *walk_list); + +ACPI_STATUS +acpi_ds_result_stack_pop ( + ACPI_OPERAND_OBJECT **object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_stack_push ( + void *object, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ds_result_stack_clear ( + ACPI_WALK_STATE *walk_state); + +ACPI_WALK_STATE * +acpi_ds_get_current_walk_state ( + ACPI_WALK_LIST *walk_list); + +void +acpi_ds_delete_walk_state_cache ( + void); + + +#endif /* _ACDISPAT_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acenv.h linux/drivers/acpi/include/acenv.h --- v2.4.0-test8/linux/drivers/acpi/include/acenv.h Thu Jul 6 01:22:24 2000 +++ linux/drivers/acpi/include/acenv.h Fri Sep 15 21:37:23 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acenv.h - Generation environment specific items + * $Revision: 53 $ * *****************************************************************************/ @@ -75,10 +75,7 @@ #include #include #include - -/* Single threaded */ - -#define ACPI_APPLICATION +#include /* Use native Linux string library */ @@ -88,13 +85,27 @@ #define strtoul simple_strtoul +/* Linux clib doesn't to strupr, but we do. */ +char * +strupr(char *str); + +#else + +#ifdef _AED_EFI + +#include +#include +#include + #else + /* All other environments */ #define ACPI_USE_STANDARD_HEADERS #endif +#endif /****************************************************************************** @@ -117,6 +128,7 @@ #include #include #include +#include #endif /* ACPI_USE_STANDARD_HEADERS */ @@ -124,20 +136,20 @@ * We will be linking to the standard Clib functions */ -#define STRSTR(s1,s2) strstr((char *) (s1), (char *) (s2)) -#define STRUPR(s) strupr((char *) (s)) -#define STRLEN(s) strlen((char *) (s)) -#define STRCPY(d,s) strcpy((char *) (d), (char *) (s)) -#define STRNCPY(d,s,n) strncpy((char *) (d), (char *) (s), (n)) -#define STRNCMP(d,s,n) strncmp((char *) (d), (char *) (s), (n)) -#define STRCMP(d,s) strcmp((char *) (d), (char *) (s)) -#define STRCAT(d,s) strcat((char *) (d), (char *) (s)) -#define STRNCAT(d,s,n) strncat((char *) (d), (char *) (s), (n)) -#define STRTOUL(d,s,n) strtoul((char *) (d), (char **) (s), (n)) -#define MEMCPY(d,s,n) memcpy(d, s, (size_t) n) -#define MEMSET(d,s,n) memset(d, s, (size_t) n) -#define TOUPPER toupper -#define TOLOWER tolower +#define STRSTR(s1,s2) strstr((s1), (s2)) +#define STRUPR(s) strupr((s)) +#define STRLEN(s) strlen((s)) +#define STRCPY(d,s) strcpy((d), (s)) +#define STRNCPY(d,s,n) strncpy((d), (s), (n)) +#define STRNCMP(d,s,n) strncmp((d), (s), (n)) +#define STRCMP(d,s) strcmp((d), (s)) +#define STRCAT(d,s) strcat((d), (s)) +#define STRNCAT(d,s,n) strncat((d), (s), (n)) +#define STRTOUL(d,s,n) strtoul((d), (s), (n)) +#define MEMCPY(d,s,n) memcpy((d), (s), (n)) +#define MEMSET(d,s,n) memset((d), (s), (n)) +#define TOUPPER toupper +#define TOLOWER tolower /****************************************************************************** @@ -165,37 +177,35 @@ * Storage alignment properties */ -#define _AUPBND (sizeof(int) - 1) -#define _ADNBND (sizeof(int) - 1) +#define _AUPBND (sizeof(int) - 1) +#define _ADNBND (sizeof(int) - 1) /* * Variable argument list macro definitions */ -#define _bnd(X, bnd) (((sizeof(X)) + (bnd)) & (~(bnd))) -#define va_arg(ap, T) (*(T *)(((ap) += ((_bnd(T, _AUPBND))) \ - - (_bnd(T, _ADNBND))))) -#define va_end(ap) (void)0 -#define va_start(ap, A) (void) ((ap) = (((char *)&(A)) \ - + (_bnd(A, _AUPBND)))) +#define _bnd(X, bnd) (((sizeof(X)) + (bnd)) & (~(bnd))) +#define va_arg(ap, T) (*(T *)(((ap)+=((_bnd(T, _AUPBND)))-(_bnd(T,_ADNBND))))) +#define va_end(ap) (void)0 +#define va_start(ap, A) (void)((ap)=(((char*)&(A))+(_bnd(A,_AUPBND)))) #endif /* va_arg */ -#define STRSTR(s1,s2) acpi_cm_strstr ((char *) (s1), (char *) (s2)) -#define STRUPR(s) acpi_cm_strupr ((char *) (s)) -#define STRLEN(s) acpi_cm_strlen ((char *) (s)) -#define STRCPY(d,s) acpi_cm_strcpy ((char *) (d), (char *) (s)) -#define STRNCPY(d,s,n) acpi_cm_strncpy ((char *) (d), (char *) (s), (n)) -#define STRNCMP(d,s,n) acpi_cm_strncmp ((char *) (d), (char *) (s), (n)) -#define STRCMP(d,s) acpi_cm_strcmp ((char *) (d), (char *) (s)) -#define STRCAT(d,s) acpi_cm_strcat ((char *) (d), (char *) (s)) -#define STRNCAT(d,s,n) acpi_cm_strncat ((char *) (d), (char *) (s), (n)) -#define STRTOUL(d,s,n) acpi_cm_strtoul ((char *) (d), (char **) (s), (n)) -#define MEMCPY(d,s,n) acpi_cm_memcpy ((void *) (d), (const void *) (s), (n)) -#define MEMSET(d,v,n) acpi_cm_memset ((void *) (d), (v), (n)) -#define TOUPPER acpi_cm_to_upper -#define TOLOWER acpi_cm_to_lower +#define STRSTR(s1,s2) acpi_cm_strstr ((s1), (s2)) +#define STRUPR(s) acpi_cm_strupr ((s)) +#define STRLEN(s) acpi_cm_strlen ((s)) +#define STRCPY(d,s) acpi_cm_strcpy ((d), (s)) +#define STRNCPY(d,s,n) acpi_cm_strncpy ((d), (s), (n)) +#define STRNCMP(d,s,n) acpi_cm_strncmp ((d), (s), (n)) +#define STRCMP(d,s) acpi_cm_strcmp ((d), (s)) +#define STRCAT(d,s) acpi_cm_strcat ((d), (s)) +#define STRNCAT(d,s,n) acpi_cm_strncat ((d), (s), (n)) +#define STRTOUL(d,s,n) acpi_cm_strtoul ((d), (s),(n)) +#define MEMCPY(d,s,n) acpi_cm_memcpy ((d), (s), (n)) +#define MEMSET(d,v,n) acpi_cm_memset ((d), (v), (n)) +#define TOUPPER acpi_cm_to_upper +#define TOLOWER acpi_cm_to_lower #endif /* ACPI_USE_SYSTEM_CLIBRARY */ @@ -217,27 +227,90 @@ #ifdef __GNUC__ + #ifdef __ia64__ -#define _IA64 -#endif + +/* Single threaded */ +#define ACPI_APPLICATION #define ACPI_ASM_MACROS #define causeinterrupt(level) #define BREAKPOINT3 #define disable() __cli() #define enable() __sti() -#define halt() __asm__ __volatile__ ("sti; hlt":::"memory") #define wbinvd() +/*! [Begin] no source code translation */ +#include + +/* PAL_HALT[_LIGHT] */ +#define halt() ia64_pal_halt_light() + +/* PAL_HALT */ +#define safe_halt() ia64_pal_halt(1) + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "shr.u r30=r29,1\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "add r29=2,r29\n" \ + "and r30=1,r30\n" \ + ";;\n" \ + "add r29=r29,r30\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "cmp.gt p8,p9=3,r29\n" \ + ";;\n" \ + "(p8) mov %0=-1\n" \ + "(p9) mov %0=r0\n" \ + :"=r"(Acq):"m" __atomic_fool_gcc((GLptr)):"r2","r29","r30","memory"); \ + } while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "and %0=1,r2\n" \ + ";;\n" \ + :"=r"(Acq):"m" __atomic_fool_gcc((GLptr)):"r2","r29","r30","memory"); \ + } while (0) +/*! [End] no source code translation !*/ + +#else /* DO IA32 */ + +#define ACPI_ASM_MACROS +#define causeinterrupt(level) +#define BREAKPOINT3 +#define disable() __cli() +#define enable() __sti() +#define halt() __asm__ __volatile__ ("sti; hlt":::"memory") +#define wbinvd() /*! [Begin] no source code translation * * A brief explanation as GNU inline assembly is a bit hairy * %0 is the output parameter in EAX ("=a") - * %1 and %2 are the input parameters in ECX ("c") and an immediate value ("i") respectively + * %1 and %2 are the input parameters in ECX ("c") + * and an immediate value ("i") respectively * All actual register references are preceded with "%%" as in "%%edx" * Immediate values in the assembly are preceded by "$" as in "$0x1" - * The final asm parameter is the non-output registers altered by the operation + * The final asm parameter are the operation altered non-output registers. */ #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ do { \ @@ -267,12 +340,12 @@ } while(0) /*! [End] no source code translation !*/ +#endif /* IA 32 */ #endif /* __GNUC__ */ -#ifndef ACPI_ASM_MACROS - /* Unrecognized compiler, use defaults */ +#ifndef ACPI_ASM_MACROS #define ACPI_ASM_MACROS #define causeinterrupt(level) @@ -280,7 +353,6 @@ #define disable() #define enable() #define halt() - #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq) #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acevents.h linux/drivers/acpi/include/acevents.h --- v2.4.0-test8/linux/drivers/acpi/include/acevents.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acevents.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,210 @@ +/****************************************************************************** + * + * Name: acevents.h - Event subcomponent prototypes and defines + * $Revision: 56 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACEVENTS_H__ +#define __ACEVENTS_H__ + + +/* + * Acpi_evfixed - Fixed event handling + */ + +ACPI_STATUS +acpi_ev_fixed_event_initialize ( + void); + +u32 +acpi_ev_fixed_event_detect ( + void); + +u32 +acpi_ev_fixed_event_dispatch ( + u32 acpi_event); + + +/* + * Acpi_evglock - Global Lock support + */ + +ACPI_STATUS +acpi_ev_acquire_global_lock( + void); + +void +acpi_ev_release_global_lock( + void); + +ACPI_STATUS +acpi_ev_init_global_lock_handler ( + void); + + +/* + * Acpi_evgpe - GPE handling and dispatch + */ + +ACPI_STATUS +acpi_ev_gpe_initialize ( + void); + +ACPI_STATUS +acpi_ev_init_gpe_control_methods ( + void); + +u32 +acpi_ev_gpe_dispatch ( + u32 gpe_number); + +u32 +acpi_ev_gpe_detect ( + void); + + +/* + * Acpi_evnotify - Device Notify handling and dispatch + */ + +void +acpi_ev_notify_dispatch ( + ACPI_HANDLE device, + u32 notify_value); + + +/* + * Acpi_evregion - Address Space handling + */ + +ACPI_STATUS +acpi_ev_install_default_address_space_handlers ( + void); + +ACPI_STATUS +acpi_ev_address_space_dispatch ( + ACPI_OPERAND_OBJECT *region_obj, + u32 function, + u32 address, + u32 bit_width, + u32 *value); + + +ACPI_STATUS +acpi_ev_addr_handler_helper ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +void +acpi_ev_disassociate_region_from_handler( + ACPI_OPERAND_OBJECT *region_obj); + + +ACPI_STATUS +acpi_ev_associate_region_and_handler ( + ACPI_OPERAND_OBJECT *handler_obj, + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_is_locked); + + +/* + * Acpi_evregini - Region initialization and setup + */ + +ACPI_STATUS +acpi_ev_system_memory_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_io_space_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_pci_config_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_default_region_setup ( + ACPI_HANDLE handle, + u32 function, + void *handler_context, + void **region_context); + +ACPI_STATUS +acpi_ev_initialize_region ( + ACPI_OPERAND_OBJECT *region_obj, + u8 acpi_ns_locked); + + +/* + * Evsci - SCI (System Control Interrupt) handling/dispatch + */ + +u32 +acpi_ev_install_sci_handler ( + void); + +ACPI_STATUS +acpi_ev_remove_sci_handler ( + void); + +u32 +acpi_ev_initialize_sCI ( + u32 program_sCI); + +void +acpi_ev_restore_acpi_state ( + void); + +void +acpi_ev_terminate ( + void); + + +/* Debug support */ + +#ifdef ACPI_DEBUG + +u32 +acpi_ev_sci_count ( + u32 acpi_event); + +#define DEBUG_INCREMENT_EVENT_COUNT(a) acpi_gbl_event_count[a]++; + +#else + +#define DEBUG_INCREMENT_EVENT_COUNT(a) +#endif + + +#endif /* __ACEVENTS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acexcep.h linux/drivers/acpi/include/acexcep.h --- v2.4.0-test8/linux/drivers/acpi/include/acexcep.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/acexcep.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem + * $Revision: 35 $ * *****************************************************************************/ @@ -31,65 +31,105 @@ * Exceptions returned by external ACPI interfaces */ +#define AE_CODE_ENVIRONMENTAL 0x0000 +#define AE_CODE_PROGRAMMER 0x1000 +#define AE_CODE_ACPI_TABLES 0x2000 +#define AE_CODE_AML 0x3000 +#define AE_CODE_CONTROL 0x4000 +#define AE_CODE_MASK 0xF000 + + #define ACPI_SUCCESS(a) (!(a)) #define ACPI_FAILURE(a) (a) + #define AE_OK (ACPI_STATUS) 0x0000 -#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) 0x0001 -#define AE_CTRL_PENDING (ACPI_STATUS) 0x0002 -#define AE_CTRL_TERMINATE (ACPI_STATUS) 0x0003 -#define AE_CTRL_TRUE (ACPI_STATUS) 0x0004 -#define AE_CTRL_FALSE (ACPI_STATUS) 0x0005 -#define AE_CTRL_DEPTH (ACPI_STATUS) 0x0006 -#define AE_CTRL_RESERVED (ACPI_STATUS) 0x0007 -#define AE_AML_ERROR (ACPI_STATUS) 0x0008 -#define AE_AML_PARSE (ACPI_STATUS) 0x0009 -#define AE_AML_BAD_OPCODE (ACPI_STATUS) 0x000A -#define AE_AML_NO_OPERAND (ACPI_STATUS) 0x000B -#define AE_AML_OPERAND_TYPE (ACPI_STATUS) 0x000C -#define AE_AML_OPERAND_VALUE (ACPI_STATUS) 0x000D -#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) 0x000E -#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) 0x000F -#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) 0x0010 -#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) 0x0011 -#define AE_AML_REGION_LIMIT (ACPI_STATUS) 0x0012 -#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) 0x0013 -#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) 0x0014 -#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) 0x0015 -#define AE_AML_BAD_NAME (ACPI_STATUS) 0x0016 -#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) 0x0017 -#define AE_AML_INTERNAL (ACPI_STATUS) 0x0018 -#define AE_AML_RESERVED (ACPI_STATUS) 0x0019 -#define AE_ERROR (ACPI_STATUS) 0x001A -#define AE_NO_ACPI_TABLES (ACPI_STATUS) 0x001B -#define AE_NO_NAMESPACE (ACPI_STATUS) 0x001C -#define AE_NO_MEMORY (ACPI_STATUS) 0x001D -#define AE_BAD_SIGNATURE (ACPI_STATUS) 0x001E -#define AE_BAD_HEADER (ACPI_STATUS) 0x001F -#define AE_BAD_CHECKSUM (ACPI_STATUS) 0x0020 -#define AE_BAD_PARAMETER (ACPI_STATUS) 0x0021 -#define AE_BAD_CHARACTER (ACPI_STATUS) 0x0022 -#define AE_BAD_PATHNAME (ACPI_STATUS) 0x0023 -#define AE_BAD_DATA (ACPI_STATUS) 0x0024 -#define AE_BAD_ADDRESS (ACPI_STATUS) 0x0025 -#define AE_NOT_FOUND (ACPI_STATUS) 0x0026 -#define AE_NOT_EXIST (ACPI_STATUS) 0x0027 -#define AE_EXIST (ACPI_STATUS) 0x0028 -#define AE_TYPE (ACPI_STATUS) 0x0029 -#define AE_NULL_OBJECT (ACPI_STATUS) 0x002A -#define AE_NULL_ENTRY (ACPI_STATUS) 0x002B -#define AE_BUFFER_OVERFLOW (ACPI_STATUS) 0x002C -#define AE_STACK_OVERFLOW (ACPI_STATUS) 0x002D -#define AE_STACK_UNDERFLOW (ACPI_STATUS) 0x002E -#define AE_NOT_IMPLEMENTED (ACPI_STATUS) 0x002F -#define AE_VERSION_MISMATCH (ACPI_STATUS) 0x0030 -#define AE_SUPPORT (ACPI_STATUS) 0x0031 -#define AE_SHARE (ACPI_STATUS) 0x0032 -#define AE_LIMIT (ACPI_STATUS) 0x0033 -#define AE_TIME (ACPI_STATUS) 0x0034 -#define AE_UNKNOWN_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_MAX_STATUS (ACPI_STATUS) 0x0035 -#define ACPI_NUM_STATUS (ACPI_STATUS) 0x0036 + +/* + * Environmental exceptions + */ +#define AE_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_ACPI_TABLES (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_NAMESPACE (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_MEMORY (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_FOUND (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_EXIST (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL) +#define AE_EXIST (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) +#define AE_TYPE (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_OBJECT (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL) +#define AE_NULL_ENTRY (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL) +#define AE_BUFFER_OVERFLOW (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_OVERFLOW (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL) +#define AE_STACK_UNDERFLOW (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_IMPLEMENTED (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL) +#define AE_VERSION_MISMATCH (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) +#define AE_SUPPORT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) +#define AE_SHARE (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) +#define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) +#define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) +#define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) + +#define AE_CODE_ENV_MAX 0x0014 + +/* + * Programmer exceptions + */ +#define AE_BAD_PARAMETER (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER) +#define AE_BAD_CHARACTER (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER) +#define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER) +#define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER) +#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) + +#define AE_CODE_PGM_MAX 0x0005 + + +/* + * Acpi table exceptions + */ +#define AE_BAD_SIGNATURE (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES) +#define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES) +#define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) + +#define AE_CODE_TBL_MAX 0x0003 + + +/* + * AML exceptions. These are caused by problems with + * the actual AML byte stream + */ +#define AE_AML_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_AML) +#define AE_AML_PARSE (ACPI_STATUS) (0x0002 | AE_CODE_AML) +#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0003 | AE_CODE_AML) +#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0004 | AE_CODE_AML) +#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0005 | AE_CODE_AML) +#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0006 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0007 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0008 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0009 | AE_CODE_AML) +#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x000A | AE_CODE_AML) +#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML) +#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000C | AE_CODE_AML) +#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000D | AE_CODE_AML) +#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000E | AE_CODE_AML) +#define AE_AML_BAD_NAME (ACPI_STATUS) (0x000F | AE_CODE_AML) +#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML) +#define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML) + +#define AE_CODE_AML_MAX 0x0011 + +/* + * Internal exceptions used for control + */ +#define AE_CTRL_RETURN_VALUE (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL) +#define AE_CTRL_PENDING (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL) +#define AE_CTRL_TERMINATE (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL) +#define AE_CTRL_TRUE (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL) +#define AE_CTRL_FALSE (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL) +#define AE_CTRL_DEPTH (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL) +#define AE_CTRL_END (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL) +#define AE_CTRL_TRANSFER (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL) + +#define AE_CODE_CTRL_MAX 0x0008 #ifdef DEFINE_ACPI_GLOBALS @@ -98,46 +138,13 @@ * String versions of the exception codes above * These strings must match the corresponding defines exactly */ -static char *acpi_gbl_exception_names[] = +static NATIVE_CHAR *acpi_gbl_exception_names_env[] = { "AE_OK", - "AE_CTRL_RETURN_VALUE", - "AE_CTRL_PENDING", - "AE_CTRL_TERMINATE", - "AE_CTRL_TRUE", - "AE_CTRL_FALSE", - "AE_CTRL_DEPTH", - "AE_CTRL_RESERVED", - "AE_AML_ERROR", - "AE_AML_PARSE", - "AE_AML_BAD_OPCODE", - "AE_AML_NO_OPERAND", - "AE_AML_OPERAND_TYPE", - "AE_AML_OPERAND_VALUE", - "AE_AML_UNINITIALIZED_LOCAL", - "AE_AML_UNINITIALIZED_ARG", - "AE_AML_UNINITIALIZED_ELEMENT", - "AE_AML_NUMERIC_OVERFLOW", - "AE_AML_REGION_LIMIT", - "AE_AML_BUFFER_LIMIT", - "AE_AML_PACKAGE_LIMIT", - "AE_AML_DIVIDE_BY_ZERO", - "AE_AML_BAD_NAME", - "AE_AML_NAME_NOT_FOUND", - "AE_AML_INTERNAL", - "AE_AML_RESERVED", "AE_ERROR", "AE_NO_ACPI_TABLES", "AE_NO_NAMESPACE", "AE_NO_MEMORY", - "AE_BAD_SIGNATURE", - "AE_BAD_HEADER", - "AE_BAD_CHECKSUM", - "AE_BAD_PARAMETER", - "AE_BAD_CHARACTER", - "AE_BAD_PATHNAME", - "AE_BAD_DATA", - "AE_BAD_ADDRESS", "AE_NOT_FOUND", "AE_NOT_EXIST", "AE_EXIST", @@ -153,8 +160,58 @@ "AE_SHARE", "AE_LIMIT", "AE_TIME", - "AE_UNKNOWN_STATUS" + "AE_UNKNOWN_STATUS", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_pgm[] = +{ + "AE_BAD_PARAMETER", + "AE_BAD_CHARACTER", + "AE_BAD_PATHNAME", + "AE_BAD_DATA", + "AE_BAD_ADDRESS", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_tbl[] = +{ + "AE_BAD_SIGNATURE", + "AE_BAD_HEADER", + "AE_BAD_CHECKSUM", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_aml[] = +{ + "AE_AML_ERROR", + "AE_AML_PARSE", + "AE_AML_BAD_OPCODE", + "AE_AML_NO_OPERAND", + "AE_AML_OPERAND_TYPE", + "AE_AML_OPERAND_VALUE", + "AE_AML_UNINITIALIZED_LOCAL", + "AE_AML_UNINITIALIZED_ARG", + "AE_AML_UNINITIALIZED_ELEMENT", + "AE_AML_NUMERIC_OVERFLOW", + "AE_AML_REGION_LIMIT", + "AE_AML_BUFFER_LIMIT", + "AE_AML_PACKAGE_LIMIT", + "AE_AML_DIVIDE_BY_ZERO", + "AE_AML_BAD_NAME", + "AE_AML_NAME_NOT_FOUND", + "AE_AML_INTERNAL", +}; + +static NATIVE_CHAR *acpi_gbl_exception_names_ctrl[] = +{ + "AE_CTRL_RETURN_VALUE", + "AE_CTRL_PENDING", + "AE_CTRL_TERMINATE", + "AE_CTRL_TRUE", + "AE_CTRL_FALSE", + "AE_CTRL_DEPTH", + "AE_CTRL_END", + "AE_CTRL_TRANSFER", }; + #endif /* DEFINE_ACPI_GLOBALS */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acglobal.h linux/drivers/acpi/include/acglobal.h --- v2.4.0-test8/linux/drivers/acpi/include/acglobal.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acglobal.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,320 @@ +/****************************************************************************** + * + * Name: acglobal.h - Declarations for global variables + * $Revision: 84 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACGLOBAL_H__ +#define __ACGLOBAL_H__ + + +/* + * Ensure that the globals are actually defined only once. + * + * The use of these defines allows a single list of globals (here) in order + * to simplify maintenance of the code. + */ +#ifdef DEFINE_ACPI_GLOBALS +#define ACPI_EXTERN +#else +#define ACPI_EXTERN extern +#endif + + +extern NATIVE_CHAR *msg_acpi_error_break; + +/***************************************************************************** + * + * Debug support + * + ****************************************************************************/ + +/* Runtime configuration of debug print levels */ + +extern u32 acpi_dbg_level; +extern u32 acpi_dbg_layer; + + +/* Procedure nesting level for debug output */ + +extern u32 acpi_gbl_nesting_level; + + +/***************************************************************************** + * + * ACPI Table globals + * + ****************************************************************************/ + +/* + * Table pointers. + * Although these pointers are somewhat redundant with the global Acpi_table, + * they are convenient because they are typed pointers. + * + * These tables are single-table only; meaning that there can be at most one + * of each in the system. Each global points to the actual table. + * + */ +ACPI_EXTERN ROOT_SYSTEM_DESCRIPTOR_POINTER *acpi_gbl_RSDP; +ACPI_EXTERN ROOT_SYSTEM_DESCRIPTION_TABLE *acpi_gbl_RSDT; +ACPI_EXTERN FIRMWARE_ACPI_CONTROL_STRUCTURE *acpi_gbl_FACS; +ACPI_EXTERN FIXED_ACPI_DESCRIPTION_TABLE *acpi_gbl_FACP; +ACPI_EXTERN APIC_TABLE *acpi_gbl_APIC; +ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_DSDT; +ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_SBST; +/* + * Since there may be multiple SSDTs and PSDTS, a single pointer is not + * sufficient; Therefore, there isn't one! + */ + + +/* + * ACPI Table info arrays + */ +extern ACPI_TABLE_DESC acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; +extern ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES]; + +/* + * Predefined mutex objects. This array contains the + * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. + * (The table maps local handles to the real OS handles) + */ +ACPI_EXTERN ACPI_MUTEX_INFO acpi_gbl_acpi_mutex_info [NUM_MTX]; +extern ACPI_INIT_DATA acpi_gbl_acpi_init_data; + + +/***************************************************************************** + * + * Miscellaneous globals + * + ****************************************************************************/ + + +ACPI_EXTERN u8 *acpi_gbl_gpe0enable_register_save; +ACPI_EXTERN u8 *acpi_gbl_gpe1_enable_register_save; +ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_breakpoint_walk; +ACPI_EXTERN ACPI_GENERIC_STATE *acpi_gbl_generic_state_cache; +ACPI_EXTERN ACPI_PARSE_OBJECT *acpi_gbl_parse_cache; +ACPI_EXTERN ACPI_PARSE2_OBJECT *acpi_gbl_ext_parse_cache; +ACPI_EXTERN ACPI_OPERAND_OBJECT *acpi_gbl_object_cache; +ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_walk_state_cache; +ACPI_EXTERN ACPI_HANDLE acpi_gbl_global_lock_semaphore; + + +ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; +ACPI_EXTERN u32 acpi_gbl_restore_acpi_chipset; +ACPI_EXTERN u32 acpi_gbl_original_mode; +ACPI_EXTERN u32 acpi_gbl_edge_level_save; +ACPI_EXTERN u32 acpi_gbl_irq_enable_save; +ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; + +ACPI_EXTERN u32 acpi_gbl_state_cache_requests; +ACPI_EXTERN u32 acpi_gbl_state_cache_hits; +ACPI_EXTERN u32 acpi_gbl_parse_cache_requests; +ACPI_EXTERN u32 acpi_gbl_parse_cache_hits; +ACPI_EXTERN u32 acpi_gbl_ext_parse_cache_requests; +ACPI_EXTERN u32 acpi_gbl_ext_parse_cache_hits; +ACPI_EXTERN u32 acpi_gbl_object_cache_requests; +ACPI_EXTERN u32 acpi_gbl_object_cache_hits; +ACPI_EXTERN u32 acpi_gbl_walk_state_cache_requests; +ACPI_EXTERN u32 acpi_gbl_walk_state_cache_hits; +ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; +ACPI_EXTERN u32 acpi_gbl_ps_find_count; + + +ACPI_EXTERN u16 acpi_gbl_generic_state_cache_depth; +ACPI_EXTERN u16 acpi_gbl_parse_cache_depth; +ACPI_EXTERN u16 acpi_gbl_ext_parse_cache_depth; +ACPI_EXTERN u16 acpi_gbl_object_cache_depth; +ACPI_EXTERN u16 acpi_gbl_walk_state_cache_depth; +ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; +ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; +ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; + +ACPI_EXTERN u8 acpi_gbl_debugger_configuration; +ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; +ACPI_EXTERN u8 acpi_gbl_global_lock_set; /* TBD: [Restructure] OBSOLETE?? */ +ACPI_EXTERN u8 acpi_gbl_step_to_next_call; +ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; + + +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify; +ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; + + +extern u8 acpi_gbl_shutdown; +extern u32 acpi_gbl_system_flags; +extern u32 acpi_gbl_startup_flags; + + +/***************************************************************************** + * + * Namespace globals + * + ****************************************************************************/ + +#define NUM_NS_TYPES INTERNAL_TYPE_INVALID+1 +#define NUM_PREDEFINED_NAMES 9 + + +ACPI_EXTERN ACPI_NAMESPACE_NODE acpi_gbl_root_node_struct; +ACPI_EXTERN ACPI_NAMESPACE_NODE *acpi_gbl_root_node; + +extern u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; +extern PREDEFINED_NAMES acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; + + +/* Used to detect memory leaks (DEBUG ONLY) */ + +#ifdef ACPI_DEBUG +ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_head_alloc_ptr; +ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_tail_alloc_ptr; +#endif + + +/***************************************************************************** + * + * Interpreter globals + * + ****************************************************************************/ + + +ACPI_EXTERN u32 acpi_gbl_when_to_parse_methods; +ACPI_EXTERN ACPI_WALK_LIST *acpi_gbl_current_walk_list; + +/* Base of AML block, and pointer to current location in it */ + +ACPI_EXTERN u8 *acpi_gbl_Pcode_base; +ACPI_EXTERN u8 *acpi_gbl_Pcode; + +/* + * Length of AML block, and remaining length of current package. + */ +ACPI_EXTERN u32 acpi_gbl_Pcode_block_len; +ACPI_EXTERN u32 acpi_gbl_Pcode_len; + +ACPI_EXTERN u32 acpi_gbl_buf_seq; /* Counts allocated Buffer descriptors */ +ACPI_EXTERN u32 acpi_gbl_node_err; /* Indicate if inc_error should be called */ + +/* + * Handle to the last method found - used during pass1 of load + */ +ACPI_EXTERN ACPI_HANDLE acpi_gbl_last_method; + +/* + * Table of Address Space handlers + */ + +ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES]; + + +/* Control method single step flag */ + +ACPI_EXTERN u8 acpi_gbl_cm_single_step; + + +/***************************************************************************** + * + * Parser globals + * + ****************************************************************************/ + +ACPI_EXTERN ACPI_PARSE_OBJECT *acpi_gbl_parsed_namespace_root; + +extern ACPI_OPCODE_INFO acpi_gbl_aml_op_info[]; +extern u8 acpi_gbl_aml_op_info_index[256]; + + +/***************************************************************************** + * + * Hardware globals + * + ****************************************************************************/ + +extern ACPI_C_STATE_HANDLER acpi_hw_cx_handlers[MAX_CX_STATES]; +extern u32 acpi_hw_active_cx_state; + + +/***************************************************************************** + * + * Event globals + * + ****************************************************************************/ + +ACPI_EXTERN ACPI_FIXED_EVENT_INFO acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS]; + +ACPI_EXTERN ACPI_HANDLE acpi_gbl_gpe_obj_handle; +ACPI_EXTERN u32 acpi_gbl_gpe_register_count; +ACPI_EXTERN ACPI_GPE_REGISTERS *acpi_gbl_gpe_registers; +ACPI_EXTERN ACPI_GPE_LEVEL_INFO *acpi_gbl_gpe_info; + +/* + * Gpe validation and translation table + * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported. + * Otherwise, returns a valid index into the global GPE table. + * + * This table is needed because the GPE numbers supported by block 1 do not + * have to be contiguous with the GPE numbers supported by block 0. + */ +ACPI_EXTERN u8 acpi_gbl_gpe_valid [NUM_GPE]; + +/* Acpi_event counter for debug only */ + +#ifdef ACPI_DEBUG +ACPI_EXTERN u32 acpi_gbl_event_count[NUM_FIXED_EVENTS]; +#endif + + +/***************************************************************************** + * + * Debugger globals + * + ****************************************************************************/ + +ACPI_EXTERN u8 acpi_gbl_method_executing; +ACPI_EXTERN u8 acpi_gbl_db_terminate_threads; + + +/* Memory allocation metrics - Debug Only! */ + +#ifdef ACPI_DEBUG + +ACPI_EXTERN u32 acpi_gbl_current_alloc_size; +ACPI_EXTERN u32 acpi_gbl_current_alloc_count; +ACPI_EXTERN u32 acpi_gbl_running_alloc_size; +ACPI_EXTERN u32 acpi_gbl_running_alloc_count; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_count; +ACPI_EXTERN u32 acpi_gbl_current_object_count; +ACPI_EXTERN u32 acpi_gbl_current_object_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_count; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_size; +ACPI_EXTERN u32 acpi_gbl_running_object_count; +ACPI_EXTERN u32 acpi_gbl_running_object_size; +ACPI_EXTERN u32 acpi_gbl_current_node_count; +ACPI_EXTERN u32 acpi_gbl_current_node_size; +ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; + +#endif + + +#endif /* __ACGLOBAL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/achware.h linux/drivers/acpi/include/achware.h --- v2.4.0-test8/linux/drivers/acpi/include/achware.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/achware.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,169 @@ +/****************************************************************************** + * + * Name: achware.h -- hardware specific interfaces + * $Revision: 41 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACHWARE_H__ +#define __ACHWARE_H__ + + +/* Prototypes */ + + +ACPI_STATUS +acpi_hw_initialize( + void); + +ACPI_STATUS +acpi_hw_shutdown( + void); + +ACPI_STATUS +acpi_hw_initialize_system_info( + void); + +ACPI_STATUS +acpi_hw_set_mode ( + u32 mode); + +u32 +acpi_hw_get_mode ( + void); + +u32 +acpi_hw_get_mode_capabilities ( + void); + +/* Register I/O Prototypes */ + +u32 +acpi_hw_register_access ( + NATIVE_UINT read_write, + u8 use_lock, + u32 register_id, ... /* DWORD Value */); + +void +acpi_hw_clear_acpi_status ( + void); + + +/* GPE support */ + +void +acpi_hw_enable_gpe ( + u32 gpe_index); + +void +acpi_hw_disable_gpe ( + u32 gpe_index); + +void +acpi_hw_clear_gpe ( + u32 gpe_index); + +void +acpi_hw_get_gpe_status ( + u32 gpe_number, + ACPI_EVENT_STATUS *event_status); + +/* Sleep Prototypes */ + +ACPI_STATUS +acpi_hw_obtain_sleep_type_register_data ( + u8 sleep_state, + u8 *slp_typ_a, + u8 *slp_typ_b); + + +/* Cx State Prototypes */ + +ACPI_STATUS +acpi_hw_enter_c1( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_c2( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_c3( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_enter_cx ( + ACPI_IO_ADDRESS pblk_address, + u32 *pm_timer_ticks); + +ACPI_STATUS +acpi_hw_set_cx ( + u32 cx_state); + +ACPI_STATUS +acpi_hw_get_cx_info ( + u32 cx_states[]); + + +/* Throttling Prototypes */ + +void +acpi_hw_enable_throttling ( + ACPI_IO_ADDRESS pblk_address); + +void +acpi_hw_disable_throttling ( + ACPI_IO_ADDRESS pblk_address); + +u32 +acpi_hw_get_duty_cycle ( + u8 duty_offset, + ACPI_IO_ADDRESS pblk_address, + u32 num_throttle_states); + +void +acpi_hw_program_duty_cycle ( + u8 duty_offset, + u32 duty_cycle, + ACPI_IO_ADDRESS pblk_address, + u32 num_throttle_states); + +NATIVE_UINT +acpi_hw_local_pow ( + NATIVE_UINT x, + NATIVE_UINT y); + + +/* ACPI Timer prototypes */ + +u32 +acpi_hw_pmt_ticks ( + void); + +u32 +acpi_hw_pmt_resolution ( + void); + + +#endif /* __ACHWARE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acinterp.h linux/drivers/acpi/include/acinterp.h --- v2.4.0-test8/linux/drivers/acpi/include/acinterp.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acinterp.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,526 @@ +/****************************************************************************** + * + * Name: acinterp.h - Interpreter subcomponent prototypes and defines + * $Revision: 79 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACINTERP_H__ +#define __ACINTERP_H__ + + +#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1]) + + +/* Interpreter constants */ + +#define AML_END_OF_BLOCK -1 +#define PUSH_PKG_LENGTH 1 +#define DO_NOT_PUSH_PKG_LENGTH 0 + + +#define STACK_TOP 0 +#define STACK_BOTTOM (u32) -1 + +/* Constants for global "When_to_parse_methods" */ + +#define METHOD_PARSE_AT_INIT 0x0 +#define METHOD_PARSE_JUST_IN_TIME 0x1 +#define METHOD_DELETE_AT_COMPLETION 0x2 + + +ACPI_STATUS +acpi_aml_resolve_operands ( + u16 opcode, + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + + +/* + * amxface - External interpreter interfaces + */ + +ACPI_STATUS +acpi_aml_load_table ( + ACPI_TABLE_TYPE table_id); + +ACPI_STATUS +acpi_aml_execute_method ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +/* + * amfield - ACPI AML (p-code) execution - field manipulation + */ + + +ACPI_STATUS +acpi_aml_read_field ( + ACPI_OPERAND_OBJECT *obj_desc, + void *buffer, + u32 buffer_length, + u32 byte_length, + u32 datum_length, + u32 bit_granularity, + u32 byte_granularity); + +ACPI_STATUS +acpi_aml_write_field ( + ACPI_OPERAND_OBJECT *obj_desc, + void *buffer, + u32 buffer_length, + u32 byte_length, + u32 datum_length, + u32 bit_granularity, + u32 byte_granularity); + +ACPI_STATUS +acpi_aml_setup_field ( + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT *rgn_desc, + u32 field_bit_width); + +ACPI_STATUS +acpi_aml_read_field_data ( + ACPI_OPERAND_OBJECT *obj_desc, + u32 field_byte_offset, + u32 field_bit_width, + u32 *value); + +ACPI_STATUS +acpi_aml_access_named_field ( + u32 mode, + ACPI_HANDLE named_field, + void *buffer, + u32 length); + +/* + * ammisc - ACPI AML (p-code) execution - specific opcodes + */ + +ACPI_STATUS +acpi_aml_exec_create_field ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_reconfiguration ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_fatal ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_index ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_match ( + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_create_mutex ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_processor ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE processor_nTE); + +ACPI_STATUS +acpi_aml_exec_create_power_resource ( + ACPI_PARSE_OBJECT *op, + ACPI_HANDLE processor_nTE); + +ACPI_STATUS +acpi_aml_exec_create_region ( + u8 *aml_ptr, + u32 acpi_aml_length, + u32 region_space, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_event ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_alias ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_create_method ( + u8 *aml_ptr, + u32 acpi_aml_length, + u32 method_flags, + ACPI_HANDLE method); + + +/* + * amprep - ACPI AML (p-code) execution - prep utilities + */ + +ACPI_STATUS +acpi_aml_prep_def_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE region, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + +ACPI_STATUS +acpi_aml_prep_bank_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE region, + ACPI_HANDLE bank_reg, + u32 bank_val, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + +ACPI_STATUS +acpi_aml_prep_index_field_value ( + ACPI_NAMESPACE_NODE *node, + ACPI_HANDLE index_reg, + ACPI_HANDLE data_reg, + u8 field_flags, + u8 field_attribute, + u32 field_position, + u32 field_length); + + +/* + * amsystem - Interface to OS services + */ + +u16 +acpi_aml_system_thread_id ( + void); + +ACPI_STATUS +acpi_aml_system_do_notify_op ( + ACPI_OPERAND_OBJECT *value, + ACPI_OPERAND_OBJECT *obj_desc); + +void +acpi_aml_system_do_suspend( + u32 time); + +void +acpi_aml_system_do_stall ( + u32 time); + +ACPI_STATUS +acpi_aml_system_acquire_mutex( + ACPI_OPERAND_OBJECT *time, + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_release_mutex( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_signal_event( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_wait_event( + ACPI_OPERAND_OBJECT *time, + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_reset_event( + ACPI_OPERAND_OBJECT *obj_desc); + +ACPI_STATUS +acpi_aml_system_wait_semaphore ( + ACPI_HANDLE semaphore, + u32 timeout); + + +/* + * ammonadic - ACPI AML (p-code) execution, monadic operators + */ + +ACPI_STATUS +acpi_aml_exec_monadic1 ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_monadic2 ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_monadic2_r ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + + +/* + * amdyadic - ACPI AML (p-code) execution, dyadic operators + */ + +ACPI_STATUS +acpi_aml_exec_dyadic1 ( + u16 opcode, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_exec_dyadic2 ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_dyadic2_r ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + +ACPI_STATUS +acpi_aml_exec_dyadic2_s ( + u16 opcode, + ACPI_WALK_STATE *walk_state, + ACPI_OPERAND_OBJECT **return_desc); + + +/* + * amresolv - Object resolution and get value functions + */ + +ACPI_STATUS +acpi_aml_resolve_to_value ( + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_resolve_node_to_value ( + ACPI_NAMESPACE_NODE **stack_ptr); + +ACPI_STATUS +acpi_aml_resolve_object_to_value ( + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_get_field_unit_value ( + ACPI_OPERAND_OBJECT *field_desc, + ACPI_OPERAND_OBJECT *result_desc); + + +/* + * amdump - Scanner debug output routines + */ + +void +acpi_aml_show_hex_value ( + u32 byte_count, + u8 *aml_ptr, + u32 lead_space); + + +ACPI_STATUS +acpi_aml_dump_operand ( + ACPI_OPERAND_OBJECT *entry_desc); + +void +acpi_aml_dump_operands ( + ACPI_OPERAND_OBJECT **operands, + OPERATING_MODE interpreter_mode, + NATIVE_CHAR *ident, + u32 num_levels, + NATIVE_CHAR *note, + NATIVE_CHAR *module_name, + u32 line_number); + +void +acpi_aml_dump_object_descriptor ( + ACPI_OPERAND_OBJECT *object, + u32 flags); + + +void +acpi_aml_dump_node ( + ACPI_NAMESPACE_NODE *node, + u32 flags); + + +/* + * amnames - interpreter/scanner name load/execute + */ + +NATIVE_CHAR * +acpi_aml_allocate_name_string ( + u32 prefix_count, + u32 num_name_segs); + +u32 +acpi_aml_good_char ( + u32 character); + +ACPI_STATUS +acpi_aml_exec_name_segment ( + u8 **in_aml_address, + NATIVE_CHAR *name_string); + +ACPI_STATUS +acpi_aml_get_name_string ( + OBJECT_TYPE_INTERNAL data_type, + u8 *in_aml_address, + NATIVE_CHAR **out_name_string, + u32 *out_name_length); + +ACPI_STATUS +acpi_aml_do_name ( + ACPI_OBJECT_TYPE data_type, + OPERATING_MODE load_exec_mode); + + +/* + * amstore - Object store support + */ + +ACPI_STATUS +acpi_aml_exec_store ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_store_object_to_object ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_aml_store_object_to_node ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_NAMESPACE_NODE *node, + ACPI_WALK_STATE *walk_state); + + +/* + * amutils - interpreter/scanner utilities + */ + +void +acpi_aml_enter_interpreter ( + void); + +void +acpi_aml_exit_interpreter ( + void); + +u8 +acpi_aml_validate_object_type ( + ACPI_OBJECT_TYPE type); + +u8 +acpi_aml_acquire_global_lock ( + u32 rule); + +ACPI_STATUS +acpi_aml_release_global_lock ( + u8 locked); + +u32 +acpi_aml_buf_seq ( + void); + +u32 +acpi_aml_digits_needed ( + u32 value, + u32 base); + +ACPI_STATUS +acpi_aml_eisa_id_to_string ( + u32 numeric_id, + NATIVE_CHAR *out_string); + +ACPI_STATUS +acpi_aml_build_copy_internal_package_object ( + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj, + ACPI_WALK_STATE *walk_state); + + +/* + * amregion - default Op_region handlers + */ + +ACPI_STATUS +acpi_aml_system_memory_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_system_io_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_pci_config_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_embedded_controller_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + +ACPI_STATUS +acpi_aml_sm_bus_space_handler ( + u32 function, + u32 address, + u32 bit_width, + u32 *value, + void *handler_context, + void *region_context); + + +#endif /* __INTERP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/aclocal.h linux/drivers/acpi/include/aclocal.h --- v2.4.0-test8/linux/drivers/acpi/include/aclocal.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/aclocal.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,851 @@ +/****************************************************************************** + * + * Name: aclocal.h - Internal data types used across the ACPI subsystem + * $Revision: 77 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACLOCAL_H__ +#define __ACLOCAL_H__ + + +#define WAIT_FOREVER ((u32) -1) + +typedef void* ACPI_MUTEX; +typedef u32 ACPI_MUTEX_HANDLE; + + +/* Object descriptor types */ + +#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x22 +#define ACPI_DESC_TYPE_WALK 0x44 +#define ACPI_DESC_TYPE_PARSER 0x66 +#define ACPI_DESC_TYPE_INTERNAL 0x88 +#define ACPI_DESC_TYPE_NAMED 0xAA + + +/***************************************************************************** + * + * Mutex typedefs and structs + * + ****************************************************************************/ + + +/* + * Predefined handles for the mutex objects used within the subsystem + * All mutex objects are automatically created by Acpi_cm_mutex_initialize. + * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also! + */ + +#define ACPI_MTX_HARDWARE 0 +#define ACPI_MTX_MEMORY 1 +#define ACPI_MTX_CACHES 2 +#define ACPI_MTX_TABLES 3 +#define ACPI_MTX_PARSER 4 +#define ACPI_MTX_DISPATCHER 5 +#define ACPI_MTX_INTERPRETER 6 +#define ACPI_MTX_EXECUTE 7 +#define ACPI_MTX_NAMESPACE 8 +#define ACPI_MTX_EVENTS 9 +#define ACPI_MTX_OP_REGIONS 10 +#define ACPI_MTX_DEBUG_CMD_READY 11 +#define ACPI_MTX_DEBUG_CMD_COMPLETE 12 + +#define MAX_MTX 12 +#define NUM_MTX MAX_MTX+1 + + +#ifdef ACPI_DEBUG +#ifdef DEFINE_ACPI_GLOBALS + +/* Names for the mutexes used in the subsystem */ + +static NATIVE_CHAR *acpi_gbl_mutex_names[] = +{ + "ACPI_MTX_Hardware", + "ACPI_MTX_Memory", + "ACPI_MTX_Caches", + "ACPI_MTX_Tables", + "ACPI_MTX_Parser", + "ACPI_MTX_Dispatcher", + "ACPI_MTX_Interpreter", + "ACPI_MTX_Execute", + "ACPI_MTX_Namespace", + "ACPI_MTX_Events", + "ACPI_MTX_Op_regions", + "ACPI_MTX_Debug_cmd_ready", + "ACPI_MTX_Debug_cmd_complete" +}; + +#endif +#endif + + +/* Table for the global mutexes */ + +typedef struct acpi_mutex_info +{ + ACPI_MUTEX mutex; + u32 use_count; + u8 locked; + +} ACPI_MUTEX_INFO; + + +/* Lock flag parameter for various interfaces */ + +#define ACPI_MTX_DO_NOT_LOCK 0 +#define ACPI_MTX_LOCK 1 + + +typedef u16 ACPI_OWNER_ID; +#define OWNER_TYPE_TABLE 0x0 +#define OWNER_TYPE_METHOD 0x1 +#define FIRST_METHOD_ID 0x0000 +#define FIRST_TABLE_ID 0x8000 + +/* TBD: [Restructure] get rid of the need for this! */ + +#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0xD1D1 + +/***************************************************************************** + * + * Namespace typedefs and structs + * + ****************************************************************************/ + + +/* Operational modes of the AML interpreter/scanner */ + +typedef enum +{ + IMODE_LOAD_PASS1 = 0x01, + IMODE_LOAD_PASS2 = 0x02, + IMODE_EXECUTE = 0x0E + +} OPERATING_MODE; + + +/* + * The Node describes a named object that appears in the AML + * An Acpi_node is used to store Nodes. + * + * Data_type is used to differentiate between internal descriptors, and MUST + * be the first byte in this structure. + */ + +typedef struct acpi_node +{ + u8 data_type; + u8 type; /* Type associated with this name */ + u32 name; /* ACPI Name, always 4 chars per ACPI spec */ + u16 owner_id; + + + void *object; /* Pointer to attached ACPI object (optional) */ + struct acpi_node *child; /* first child */ + struct acpi_node *peer; /* Next peer*/ + u16 reference_count; /* Current count of references and children */ + u8 flags; + +} ACPI_NAMESPACE_NODE; + + +#define ENTRY_NOT_FOUND NULL + + +/* Node flags */ + +#define ANOBJ_AML_ATTACHMENT 0x1 +#define ANOBJ_END_OF_PEER_LIST 0x2 + + +/* + * ACPI Table Descriptor. One per ACPI table + */ +typedef struct acpi_table_desc +{ + struct acpi_table_desc *prev; + struct acpi_table_desc *next; + struct acpi_table_desc *installed_desc; + ACPI_TABLE_HEADER *pointer; + void *base_pointer; + u8 *aml_pointer; + u32 aml_length; + u32 length; + u32 count; + ACPI_OWNER_ID table_id; + u8 type; + u8 allocation; + u8 loaded_into_namespace; + +} ACPI_TABLE_DESC; + + +typedef struct +{ + NATIVE_CHAR *search_for; + ACPI_HANDLE *list; + u32 *count; + +} FIND_CONTEXT; + + +typedef struct +{ + ACPI_NAMESPACE_NODE *node; +} NS_SEARCH_DATA; + + +/* + * Predefined Namespace items + */ +#define ACPI_MAX_ADDRESS_SPACE 255 +#define ACPI_NUM_ADDRESS_SPACES 256 + + +typedef struct +{ + NATIVE_CHAR *name; + ACPI_OBJECT_TYPE type; + NATIVE_CHAR *val; + +} PREDEFINED_NAMES; + + +/***************************************************************************** + * + * Event typedefs and structs + * + ****************************************************************************/ + + +/* Status bits. */ + +#define ACPI_STATUS_PMTIMER 0x0001 +#define ACPI_STATUS_GLOBAL 0x0020 +#define ACPI_STATUS_POWER_BUTTON 0x0100 +#define ACPI_STATUS_SLEEP_BUTTON 0x0200 +#define ACPI_STATUS_RTC_ALARM 0x0400 + +/* Enable bits. */ + +#define ACPI_ENABLE_PMTIMER 0x0001 +#define ACPI_ENABLE_GLOBAL 0x0020 +#define ACPI_ENABLE_POWER_BUTTON 0x0100 +#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 +#define ACPI_ENABLE_RTC_ALARM 0x0400 + + +/* + * Entry in the Address_space (AKA Operation Region) table + */ + +typedef struct +{ + ADDRESS_SPACE_HANDLER handler; + void *context; + +} ACPI_ADDRESS_SPACE_INFO; + + +/* Values and addresses of the GPE registers (both banks) */ + +typedef struct +{ + u8 status; /* Current value of status reg */ + u8 enable; /* Current value of enable reg */ + u16 status_addr; /* Address of status reg */ + u16 enable_addr; /* Address of enable reg */ + u8 gpe_base; /* Base GPE number */ + +} ACPI_GPE_REGISTERS; + + +#define ACPI_GPE_LEVEL_TRIGGERED 1 +#define ACPI_GPE_EDGE_TRIGGERED 2 + + +/* Information about each particular GPE level */ + +typedef struct +{ + u8 type; /* Level or Edge */ + + ACPI_HANDLE method_handle; /* Method handle for direct (fast) execution */ + GPE_HANDLER handler; /* Address of handler, if any */ + void *context; /* Context to be passed to handler */ + +} ACPI_GPE_LEVEL_INFO; + + +/* Information about each particular fixed event */ + +typedef struct +{ + FIXED_EVENT_HANDLER handler; /* Address of handler. */ + void *context; /* Context to be passed to handler */ + +} ACPI_FIXED_EVENT_INFO; + + +/* Information used during field processing */ + +typedef struct +{ + u8 skip_field; + u8 field_flag; + u32 pkg_length; + +} ACPI_FIELD_INFO; + + +/***************************************************************************** + * + * Generic "state" object for stacks + * + ****************************************************************************/ + + +#define CONTROL_NORMAL 0xC0 +#define CONTROL_CONDITIONAL_EXECUTING 0xC1 +#define CONTROL_PREDICATE_EXECUTING 0xC2 +#define CONTROL_PREDICATE_FALSE 0xC3 +#define CONTROL_PREDICATE_TRUE 0xC4 + + +/* Forward declaration */ +struct acpi_walk_state; +struct acpi_parse_obj ; + + +#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ + u8 data_type; /* To differentiate various internal objs */\ + u8 flags; \ + u16 value; \ + u16 state; \ + u16 acpi_eval; \ + void *next; \ + +typedef struct acpi_common_state +{ + ACPI_STATE_COMMON +} ACPI_COMMON_STATE; + + +/* + * Update state - used to traverse complex objects such as packages + */ +typedef struct acpi_update_state +{ + ACPI_STATE_COMMON + union acpi_operand_obj *object; + +} ACPI_UPDATE_STATE; + +/* + * Control state - one per if/else and while constructs. + * Allows nesting of these constructs + */ +typedef struct acpi_control_state +{ + ACPI_STATE_COMMON + struct acpi_parse_obj *predicate_op; + u8 *aml_predicate_start; /* Start of if/while predicate */ + +} ACPI_CONTROL_STATE; + + +/* + * Scope state - current scope during namespace lookups + */ + +typedef struct acpi_scope_state +{ + ACPI_STATE_COMMON + ACPI_NAMESPACE_NODE *node; + +} ACPI_SCOPE_STATE; + + +typedef struct acpi_pscope_state +{ + ACPI_STATE_COMMON + struct acpi_parse_obj *op; /* current op being parsed */ + u8 *arg_end; /* current argument end */ + u8 *pkg_end; /* current package end */ + u32 arg_list; /* next argument to parse */ + u32 arg_count; /* Number of fixed arguments */ + +} ACPI_PSCOPE_STATE; + + +typedef union acpi_gen_state +{ + ACPI_COMMON_STATE common; + ACPI_CONTROL_STATE control; + ACPI_UPDATE_STATE update; + ACPI_SCOPE_STATE scope; + ACPI_PSCOPE_STATE parse_scope; + +} ACPI_GENERIC_STATE; + + +typedef +ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( + u16 opcode, + struct acpi_parse_obj *op, + struct acpi_walk_state *walk_state, + struct acpi_parse_obj **out_op); + +typedef +ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( + struct acpi_walk_state *walk_state, + struct acpi_parse_obj *op); + + +/***************************************************************************** + * + * Parser typedefs and structs + * + ****************************************************************************/ + + +#define ACPI_OP_CLASS_MASK 0x1F +#define ACPI_OP_ARGS_MASK 0x20 +#define ACPI_OP_TYPE_MASK 0xC0 + +#define ACPI_OP_TYPE_OPCODE 0x00 +#define ACPI_OP_TYPE_ASCII 0x40 +#define ACPI_OP_TYPE_PREFIX 0x80 +#define ACPI_OP_TYPE_UNKNOWN 0xC0 + +#define ACPI_GET_OP_CLASS(a) ((a)->flags & ACPI_OP_CLASS_MASK) +#define ACPI_GET_OP_ARGS(a) ((a)->flags & ACPI_OP_ARGS_MASK) +#define ACPI_GET_OP_TYPE(a) ((a)->flags & ACPI_OP_TYPE_MASK) + + +/* + * AML opcode, name, and argument layout + */ +typedef struct acpi_opcode_info +{ + u8 flags; /* Opcode type, Has_args flag */ + u32 parse_args; /* Grammar/Parse time arguments */ + u32 runtime_args; /* Interpret time arguments */ + + DEBUG_ONLY_MEMBERS ( + NATIVE_CHAR *name) /* op name (debug only) */ + +} ACPI_OPCODE_INFO; + + +typedef union acpi_parse_val +{ + u32 integer; /* integer constant */ + u32 size; /* bytelist or field size */ + NATIVE_CHAR *string; /* NULL terminated string */ + u8 *buffer; /* buffer or string */ + NATIVE_CHAR *name; /* NULL terminated string */ + struct acpi_parse_obj *arg; /* arguments and contained ops */ + +} ACPI_PARSE_VALUE; + + +#define ACPI_PARSE_COMMON \ + u8 data_type; /* To differentiate various internal objs */\ + u8 flags; /* Type of Op */\ + u16 opcode; /* AML opcode */\ + u32 aml_offset; /* offset of declaration in AML */\ + struct acpi_parse_obj *parent; /* parent op */\ + struct acpi_parse_obj *next; /* next op */\ + DEBUG_ONLY_MEMBERS (\ + NATIVE_CHAR op_name[16]) /* op name (debug only) */\ + /* NON-DEBUG members below: */\ + ACPI_NAMESPACE_NODE *node;/* for use by interpreter */\ + ACPI_PARSE_VALUE value; /* Value or args associated with the opcode */\ + + +/* + * generic operation (eg. If, While, Store) + */ +typedef struct acpi_parse_obj +{ + ACPI_PARSE_COMMON +} ACPI_PARSE_OBJECT; + + +/* + * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and Op_regions), + * and bytelists. + */ +typedef struct acpi_parse2_obj +{ + ACPI_PARSE_COMMON + u8 *data; /* AML body or bytelist data */ + u32 length; /* AML length */ + u32 name; /* 4-byte name or zero if no name */ + +} ACPI_PARSE2_OBJECT; + + +/* + * Parse state - one state per parser invocation and each control + * method. + */ + +typedef struct acpi_parse_state +{ + u8 *aml_start; /* first AML byte */ + u8 *aml; /* next AML byte */ + u8 *aml_end; /* (last + 1) AML byte */ + u8 *pkg_start; /* current package begin */ + u8 *pkg_end; /* current package end */ + ACPI_PARSE_OBJECT *start_op; /* root of parse tree */ + struct acpi_node *start_node; + ACPI_GENERIC_STATE *scope; /* current scope */ + struct acpi_parse_state *next; + +} ACPI_PARSE_STATE; + + +/***************************************************************************** + * + * Tree walking typedefs and structs + * + ****************************************************************************/ + + +/* + * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through + * the tree (for whatever reason), and for control method execution. + */ + +#define NEXT_OP_DOWNWARD 1 +#define NEXT_OP_UPWARD 2 + +#define WALK_METHOD 1 +#define WALK_NON_METHOD 0 + +typedef struct acpi_walk_state +{ + u8 data_type; /* To differentiate various internal objs */\ + ACPI_OWNER_ID owner_id; /* Owner of objects created during the walk */ + u8 last_predicate; /* Result of last predicate */ + u8 next_op_info; /* Info about Next_op */ + u8 num_operands; /* Stack pointer for Operands[] array */ + u8 num_results; /* Stack pointer for Results[] array */ + u8 current_result; /* */ + + struct acpi_walk_state *next; /* Next Walk_state in list */ + ACPI_PARSE_OBJECT *origin; /* Start of walk */ + +/* TBD: Obsolete with removal of WALK procedure ? */ + ACPI_PARSE_OBJECT *prev_op; /* Last op that was processed */ + ACPI_PARSE_OBJECT *next_op; /* next op to be processed */ + + + ACPI_GENERIC_STATE *control_state; /* List of control states (nested IFs) */ + ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ + ACPI_PARSE_STATE *parser_state; /* Current state of parser */ + u8 *aml_last_while; + ACPI_PARSE_DOWNWARDS descending_callback; + ACPI_PARSE_UPWARDS ascending_callback; + + union acpi_operand_obj *return_desc; /* Return object, if any */ + union acpi_operand_obj *method_desc; /* Method descriptor if running a method */ + struct acpi_node *method_node; /* Method Node if running a method */ + ACPI_PARSE_OBJECT *method_call_op; /* Method_call Op if running a method */ + struct acpi_node *method_call_node; /* Called method Node*/ + union acpi_operand_obj *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ + union acpi_operand_obj *results[OBJ_NUM_OPERANDS]; /* Accumulated results */ + struct acpi_node arguments[MTH_NUM_ARGS]; /* Control method arguments */ + struct acpi_node local_variables[MTH_NUM_LOCALS]; /* Control method locals */ + u32 parse_flags; + u8 walk_type; + u8 return_used; + u32 prev_arg_types; + + /* Debug support */ + + u32 method_breakpoint; + + +} ACPI_WALK_STATE; + + +/* + * Walk list - head of a tree of walk states. Multiple walk states are created when there + * are nested control methods executing. + */ +typedef struct acpi_walk_list +{ + + ACPI_WALK_STATE *walk_state; + +} ACPI_WALK_LIST; + + +/* Info used by Acpi_ps_init_objects */ + +typedef struct init_walk_info +{ + u32 method_count; + u32 op_region_count; + ACPI_TABLE_DESC *table_desc; + +} INIT_WALK_INFO; + + +/* TBD: [Restructure] Merge with struct above */ + +typedef struct acpi_walk_info +{ + u32 debug_level; + u32 owner_id; + +} ACPI_WALK_INFO; + + +/***************************************************************************** + * + * Hardware and PNP + * + ****************************************************************************/ + + +/* Sleep states */ + +#define SLWA_DEBUG_LEVEL 4 +#define GTS_CALL 0 +#define GTS_WAKE 1 + +/* Cx States */ + +#define MAX_CX_STATE_LATENCY 0xFFFFFFFF +#define MAX_CX_STATES 4 + +/* + * The #define's and enum below establish an abstract way of identifying what + * register block and register is to be accessed. Do not change any of the + * values as they are used in switch statements and offset calculations. + */ + +#define REGISTER_BLOCK_MASK 0xFF00 +#define BIT_IN_REGISTER_MASK 0x00FF +#define PM1_EVT 0x0100 +#define PM1_CONTROL 0x0200 +#define PM2_CONTROL 0x0300 +#define PM_TIMER 0x0400 +#define PROCESSOR_BLOCK 0x0500 +#define GPE0_STS_BLOCK 0x0600 +#define GPE0_EN_BLOCK 0x0700 +#define GPE1_STS_BLOCK 0x0800 +#define GPE1_EN_BLOCK 0x0900 + +enum +{ + /* PM1 status register ids */ + + TMR_STS = (PM1_EVT | 0x01), + BM_STS, + GBL_STS, + PWRBTN_STS, + SLPBTN_STS, + RTC_STS, + WAK_STS, + + /* PM1 enable register ids */ + + TMR_EN, + /* need to skip 1 enable number since there's no bus master enable register */ + GBL_EN = (PM1_EVT | 0x0A), + PWRBTN_EN, + SLPBTN_EN, + RTC_EN, + + /* PM1 control register ids */ + + SCI_EN = (PM1_CONTROL | 0x01), + BM_RLD, + GBL_RLS, + SLP_TYPE_A, + SLP_TYPE_B, + SLP_EN, + + /* PM2 control register ids */ + + ARB_DIS = (PM2_CONTROL | 0x01), + + /* PM Timer register ids */ + + TMR_VAL = (PM_TIMER | 0x01), + + GPE0_STS = (GPE0_STS_BLOCK | 0x01), + GPE0_EN = (GPE0_EN_BLOCK | 0x01), + + GPE1_STS = (GPE1_STS_BLOCK | 0x01), + GPE1_EN = (GPE0_EN_BLOCK | 0x01), + + /* Last register value is one less than LAST_REG */ + + LAST_REG +}; + + +#define TMR_STS_MASK 0x0001 +#define BM_STS_MASK 0x0010 +#define GBL_STS_MASK 0x0020 +#define PWRBTN_STS_MASK 0x0100 +#define SLPBTN_STS_MASK 0x0200 +#define RTC_STS_MASK 0x0400 +#define WAK_STS_MASK 0x8000 + +#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK | PWRBTN_STS_MASK | \ + SLPBTN_STS_MASK | RTC_STS_MASK | WAK_STS_MASK) + +#define TMR_EN_MASK 0x0001 +#define GBL_EN_MASK 0x0020 +#define PWRBTN_EN_MASK 0x0100 +#define SLPBTN_EN_MASK 0x0200 +#define RTC_EN_MASK 0x0400 + +#define SCI_EN_MASK 0x0001 +#define BM_RLD_MASK 0x0002 +#define GBL_RLS_MASK 0x0004 +#define SLP_TYPE_X_MASK 0x1C00 +#define SLP_EN_MASK 0x2000 + +#define ARB_DIS_MASK 0x0001 + +#define GPE0_STS_MASK +#define GPE0_EN_MASK + +#define GPE1_STS_MASK +#define GPE1_EN_MASK + + +#define ACPI_READ 1 +#define ACPI_WRITE 2 + +#define LOW_BYTE 0x00FF +#define ONE_BYTE 0x08 + +#ifndef SET + #define SET 1 +#endif +#ifndef CLEAR + #define CLEAR 0 +#endif + + +/* Plug and play */ + +/* Pnp and ACPI data */ + +#define VERSION_NO 0x01 +#define LOGICAL_DEVICE_ID 0x02 +#define COMPATIBLE_DEVICE_ID 0x03 +#define IRQ_FORMAT 0x04 +#define DMA_FORMAT 0x05 +#define START_DEPENDENT_TAG 0x06 +#define END_DEPENDENT_TAG 0x07 +#define IO_PORT_DESCRIPTOR 0x08 +#define FIXED_LOCATION_IO_DESCRIPTOR 0x09 +#define RESERVED_TYPE0 0x0A +#define RESERVED_TYPE1 0x0B +#define RESERVED_TYPE2 0x0C +#define RESERVED_TYPE3 0x0D +#define SMALL_VENDOR_DEFINED 0x0E +#define END_TAG 0x0F + +/* Pnp and ACPI data */ + +#define MEMORY_RANGE_24 0x81 +#define ISA_MEMORY_RANGE 0x81 +#define LARGE_VENDOR_DEFINED 0x84 +#define EISA_MEMORY_RANGE 0x85 +#define MEMORY_RANGE_32 0x85 +#define FIXED_EISA_MEMORY_RANGE 0x86 +#define FIXED_MEMORY_RANGE_32 0x86 + +/* ACPI only data */ + +#define DWORD_ADDRESS_SPACE 0x87 +#define WORD_ADDRESS_SPACE 0x88 +#define EXTENDED_IRQ 0x89 + +/* MUST HAVES */ + + +typedef enum +{ + DWORD_DEVICE_ID, + STRING_PTR_DEVICE_ID, + STRING_DEVICE_ID + +} DEVICE_ID_TYPE; + +typedef struct +{ + DEVICE_ID_TYPE type; + union + { + u32 number; + NATIVE_CHAR *string_ptr; + NATIVE_CHAR buffer[9]; + } data; + +} DEVICE_ID; + + +/***************************************************************************** + * + * Debug + * + ****************************************************************************/ + + +/* Entry for a memory allocation (debug only) */ + +#ifdef ACPI_DEBUG + +#define MEM_MALLOC 0 +#define MEM_CALLOC 1 +#define MAX_MODULE_NAME 16 + +typedef struct allocation_info +{ + struct allocation_info *previous; + struct allocation_info *next; + void *address; + u32 size; + u32 component; + u32 line; + NATIVE_CHAR module[MAX_MODULE_NAME]; + u8 alloc_type; + +} ALLOCATION_INFO; + +#endif + +#endif /* __ACLOCAL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acmacros.h linux/drivers/acpi/include/acmacros.h --- v2.4.0-test8/linux/drivers/acpi/include/acmacros.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acmacros.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,435 @@ +/****************************************************************************** + * + * Name: acmacros.h - C macros for the entire subsystem. + * $Revision: 48 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACMACROS_H__ +#define __ACMACROS_H__ + +/* + * Data manipulation macros + */ + +#ifndef LOWORD +#define LOWORD(l) ((u16)(NATIVE_UINT)(l)) +#endif + +#ifndef HIWORD +#define HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) +#endif + +#ifndef LOBYTE +#define LOBYTE(l) ((u8)(u16)(l)) +#endif + +#ifndef HIBYTE +#define HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) +#endif + +#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) +#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) +#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) + +#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) +#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) +#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) +#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) +#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) + +#define LOW_BASE(w) ((u16) ((w) & 0x0000FFFF)) +#define MID_BASE(b) ((u8) (((b) & 0x00FF0000) >> 16)) +#define HI_BASE(b) ((u8) (((b) & 0xFF000000) >> 24)) +#define LOW_LIMIT(w) ((u16) ((w) & 0x0000FFFF)) +#define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16)) + + + /* + * Extract a byte of data using a pointer. Any more than a byte and we + * get into potential aligment issues -- see the STORE macros below + */ +#define GET8(addr) (*(u8*)(addr)) + + +/* + * Macros for moving data around to/from buffers that are possibly unaligned. + * If the hardware supports the transfer of unaligned data, just do the store. + * Otherwise, we have to move one byte at a time. + */ + +#ifdef _HW_ALIGNMENT_SUPPORT + +/* The hardware supports unaligned transfers, just do the move */ + +#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s) +#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s) +#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s) + +#else +/* + * The hardware does not support unaligned transfers. We must move the + * data one byte at a time. These macros work whether the source or + * the destination (or both) is/are unaligned. + */ + +#define MOVE_UNALIGNED16_TO_16(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\ + ((u8 *)(d))[1] = ((u8 *)(s))[1];} + +#define MOVE_UNALIGNED32_TO_32(d,s) {((u8 *)(d))[0] = ((u8 *)(s))[0];\ + ((u8 *)(d))[1] = ((u8 *)(s))[1];\ + ((u8 *)(d))[2] = ((u8 *)(s))[2];\ + ((u8 *)(d))[3] = ((u8 *)(s))[3];} + +#define MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} + +#endif + + +/* + * Fast power-of-two math macros for non-optimized compilers + */ + +#define _DIV(value,power_of2) ((u32) ((value) >> (power_of2))) +#define _MUL(value,power_of2) ((u32) ((value) << (power_of2))) +#define _MOD(value,divisor) ((u32) ((value) & ((divisor) -1))) + +#define DIV_2(a) _DIV(a,1) +#define MUL_2(a) _MUL(a,1) +#define MOD_2(a) _MOD(a,2) + +#define DIV_4(a) _DIV(a,2) +#define MUL_4(a) _MUL(a,2) +#define MOD_4(a) _MOD(a,4) + +#define DIV_8(a) _DIV(a,3) +#define MUL_8(a) _MUL(a,3) +#define MOD_8(a) _MOD(a,8) + +#define DIV_16(a) _DIV(a,4) +#define MUL_16(a) _MUL(a,4) +#define MOD_16(a) _MOD(a,16) + + +/* + * Rounding macros (Power of two boundaries only) + */ + +#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) +#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) + +#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4) +#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) + +#define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4) +#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) + + +#ifdef DEBUG_ASSERT +#undef DEBUG_ASSERT +#endif + + +/* + * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts, + * such as on ap_obj_stack, where a pointer to an ACPI_OPERAND_OBJECT can also + * appear. This macro is used to distinguish them. + * + * The Data_type field is the first field in both structures. + */ + +#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->data_type == t) + + +/* Macro to test the object type */ + +#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OPERAND_OBJECT *)d)->common.type == (u8)t) + +/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ + +#define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) + +/* + * Macro to check if a pointer is within an ACPI table. + * Parameter (a) is the pointer to check. Parameter (b) must be defined + * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, + * and ((u8 *)b+b->Length) points one byte past the end of the table. + */ + +#ifndef _IA16 +#define IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\ + ((u8 *)(a) < ((u8 *)b + b->length))) + +#else +#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ + (((u8 *)(a) >= (u8 *)(b + 1)) &&\ + ((u8 *)(a) < ((u8 *)b + b->length))) +#endif + +/* + * Macros for the master AML opcode table + */ + +#ifdef ACPI_DEBUG +#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs,name} +#else +#define OP_INFO_ENTRY(flags,name,Pargs,Iargs) {flags,Pargs,Iargs} +#endif + +#define ARG_TYPE_WIDTH 5 +#define ARG_1(x) ((u32)(x)) +#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) +#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) +#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) +#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) +#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) + +#define ARGI_LIST1(a) (ARG_1(a)) +#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) +#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) +#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) +#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) +#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) + +#define ARGP_LIST1(a) (ARG_1(a)) +#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) +#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) +#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) +#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) +#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) + +#define GET_CURRENT_ARG_TYPE(list) (list & 0x1F) +#define INCREMENT_ARG_LIST(list) (list >>= ARG_TYPE_WIDTH) + + +/* + * Reporting macros that are never compiled out + */ + +/* + * Error reporting. These versions add callers module and line#. Since + * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only + * use it in debug mode. + */ + +#ifdef ACPI_DEBUG + +#define REPORT_INFO(a) _report_info(_THIS_MODULE,__LINE__,_COMPONENT,a) +#define REPORT_ERROR(a) _report_error(_THIS_MODULE,__LINE__,_COMPONENT,a) +#define REPORT_WARNING(a) _report_warning(_THIS_MODULE,__LINE__,_COMPONENT,a) + +#else + +#define REPORT_INFO(a) _report_info("",__LINE__,_COMPONENT,a) +#define REPORT_ERROR(a) _report_error("",__LINE__,_COMPONENT,a) +#define REPORT_WARNING(a) _report_warning("",__LINE__,_COMPONENT,a) + +#endif + +/* Error reporting. These versions pass thru the module and line# */ + +#define _REPORT_INFO(a,b,c,d) _report_info(a,b,c,d) +#define _REPORT_ERROR(a,b,c,d) _report_error(a,b,c,d) +#define _REPORT_WARNING(a,b,c,d) _report_warning(a,b,c,d) + +/* Buffer dump macros */ + +#define DUMP_BUFFER(a,b) acpi_cm_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) + +/* + * Debug macros that are conditionally compiled + */ + +#ifdef ACPI_DEBUG + +#define MODULE_NAME(name) static char *_THIS_MODULE = name; + +/* + * Function entry tracing. + * The first parameter should be the procedure name as a quoted string. This is declared + * as a local string ("_Proc_name) so that it can be also used by the function exit macros below. + */ + +#define FUNCTION_TRACE(a) char * _proc_name = a;\ + function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a) +#define FUNCTION_TRACE_PTR(a,b) char * _proc_name = a;\ + function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) +#define FUNCTION_TRACE_U32(a,b) char * _proc_name = a;\ + function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b) +#define FUNCTION_TRACE_STR(a,b) char * _proc_name = a;\ + function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(NATIVE_CHAR *)b) +/* + * Function exit tracing. + * WARNING: These macros include a return statement. This is usually considered + * bad form, but having a separate exit macro is very ugly and difficult to maintain. + * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros + * so that "_Proc_name" is defined. + */ +#define return_VOID {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;} +#define return_ACPI_STATUS(s) {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);} +#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(NATIVE_UINT)s);return(s);} +#define return_PTR(s) {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(u8 *)s);return(s);} + + +/* Conditional execution */ + +#define DEBUG_EXEC(a) a; +#define NORMAL_EXEC(a) + +#define DEBUG_DEFINE(a) a; +#define DEBUG_ONLY_MEMBERS(a) a; + + +/* Stack and buffer dumping */ + +#define DUMP_STACK_ENTRY(a) acpi_aml_dump_operand(a) +#define DUMP_OPERANDS(a,b,c,d,e) acpi_aml_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) + + +#define DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) +#define DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) +#define DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) +#define DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) +#define BREAK_MSG(a) acpi_os_breakpoint (a) + +/* + * Generate INT3 on ACPI_ERROR (Debug only!) + */ + +#define ERROR_BREAK +#ifdef ERROR_BREAK +#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n") +#else +#define BREAK_ON_ERROR(lvl) +#endif + +/* + * Master debug print macros + * Print iff: + * 1) Debug print for the current component is enabled + * 2) Debug error level or trace level for the print statement is enabled + * + */ + +#define PARAM_LIST(pl) pl + +#define TEST_DEBUG_SWITCH(lvl) if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)) + +#define DEBUG_PRINT(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ + debug_print_prefix (_THIS_MODULE,__LINE__);\ + debug_print_raw PARAM_LIST(fp);\ + BREAK_ON_ERROR(lvl);} + +#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ + debug_print_raw PARAM_LIST(fp);} + + +/* Assert macros */ + +#define ACPI_ASSERT(exp) if(!(exp)) \ + acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion") + +#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ + acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg) + + +#else +/* + * This is the non-debug case -- make everything go away, + * leaving no executable debug code! + */ + +#define MODULE_NAME(name) +#define _THIS_MODULE "" + +#define DEBUG_EXEC(a) +#define NORMAL_EXEC(a) a; + +#define DEBUG_DEFINE(a) +#define DEBUG_ONLY_MEMBERS(a) +#define FUNCTION_TRACE(a) +#define FUNCTION_TRACE_PTR(a,b) +#define FUNCTION_TRACE_U32(a,b) +#define FUNCTION_TRACE_STR(a,b) +#define FUNCTION_EXIT +#define FUNCTION_STATUS_EXIT(s) +#define FUNCTION_VALUE_EXIT(s) +#define DUMP_STACK_ENTRY(a) +#define DUMP_OPERANDS(a,b,c,d,e) +#define DUMP_ENTRY(a,b) +#define DUMP_TABLES(a,b) +#define DUMP_PATHNAME(a,b,c,d) +#define DUMP_RESOURCE_LIST(a) +#define DEBUG_PRINT(l,f) +#define DEBUG_PRINT_RAW(l,f) +#define BREAK_MSG(a) + +#define return_VOID return +#define return_ACPI_STATUS(s) return(s) +#define return_VALUE(s) return(s) +#define return_PTR(s) return(s) + +#define ACPI_ASSERT(exp) +#define DEBUG_ASSERT(msg, exp) + +#endif + +/* + * Some code only gets executed when the debugger is built in. + * Note that this is entirely independent of whether the + * DEBUG_PRINT stuff (set by ACPI_DEBUG) is on, or not. + */ +#ifdef ENABLE_DEBUGGER +#define DEBUGGER_EXEC(a) a; +#else +#define DEBUGGER_EXEC(a) +#endif + + +/* + * For 16-bit code, we want to shrink some things even though + * we are using ACPI_DEBUG to get the debug output + */ +#ifdef _IA16 +#undef DEBUG_ONLY_MEMBERS +#define DEBUG_ONLY_MEMBERS(a) +#undef OP_INFO_ENTRY +#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs} +#endif + + +#ifdef ACPI_DEBUG + +/* + * 1) Set name to blanks + * 2) Copy the object name + */ + +#define ADD_OBJECT_NAME(a,b) MEMSET (a->common.name, ' ', sizeof (a->common.name));\ + STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) + +#else + +#define ADD_OBJECT_NAME(a,b) + +#endif + +#endif /* ACMACROS_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acnamesp.h linux/drivers/acpi/include/acnamesp.h --- v2.4.0-test8/linux/drivers/acpi/include/acnamesp.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acnamesp.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,393 @@ +/****************************************************************************** + * + * Name: acnamesp.h - Namespace subcomponent prototypes and defines + * $Revision: 94 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACNAMESP_H__ +#define __ACNAMESP_H__ + + +/* To search the entire name space, pass this as Search_base */ + +#define NS_ALL ((ACPI_HANDLE)0) + +/* + * Elements of Acpi_ns_properties are bit significant + * and should be one-to-one with values of ACPI_OBJECT_TYPE + */ +#define NSP_NORMAL 0 +#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */ +#define NSP_LOCAL 2 /* suppress search of enclosing scopes */ + + +/* Definitions of the predefined namespace names */ + +#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */ +#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ + +#define NS_ROOT_PATH "/" +#define NS_SYSTEM_BUS "_SB_" + + +/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */ + +#define NS_NO_UPSEARCH 0 +#define NS_SEARCH_PARENT 0x01 +#define NS_DONT_OPEN_SCOPE 0x02 +#define NS_NO_PEER_SEARCH 0x04 + +#define NS_WALK_UNLOCK TRUE +#define NS_WALK_NO_UNLOCK FALSE + + +ACPI_STATUS +acpi_ns_walk_namespace ( + OBJECT_TYPE_INTERNAL type, + ACPI_HANDLE start_object, + u32 max_depth, + u8 unlock_before_callback, + WALK_CALLBACK user_function, + void *context, + void **return_value); + + +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_object ( + OBJECT_TYPE_INTERNAL type, + ACPI_NAMESPACE_NODE *parent, + ACPI_NAMESPACE_NODE *child); + + +ACPI_STATUS +acpi_ns_delete_namespace_by_owner ( + u16 table_id); + + +/* Namespace loading - nsload */ + +ACPI_STATUS +acpi_ns_parse_table ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *scope); + +ACPI_STATUS +acpi_ns_load_table ( + ACPI_TABLE_DESC *table_desc, + ACPI_NAMESPACE_NODE *node); + +ACPI_STATUS +acpi_ns_load_table_by_type ( + ACPI_TABLE_TYPE table_type); + + +/* + * Top-level namespace access - nsaccess + */ + + +ACPI_STATUS +acpi_ns_root_initialize ( + void); + +ACPI_STATUS +acpi_ns_lookup ( + ACPI_GENERIC_STATE *scope_info, + NATIVE_CHAR *name, + OBJECT_TYPE_INTERNAL type, + OPERATING_MODE interpreter_mode, + u32 flags, + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE **ret_node); + + +/* + * Named object allocation/deallocation - nsalloc + */ + + +ACPI_NAMESPACE_NODE * +acpi_ns_create_node ( + u32 acpi_name); + +void +acpi_ns_delete_node ( + ACPI_NAMESPACE_NODE *node); + +ACPI_STATUS +acpi_ns_delete_namespace_subtree ( + ACPI_NAMESPACE_NODE *parent_handle); + +void +acpi_ns_detach_object ( + ACPI_NAMESPACE_NODE *node); + +void +acpi_ns_delete_children ( + ACPI_NAMESPACE_NODE *parent); + + +/* + * Namespace modification - nsmodify + */ + +ACPI_STATUS +acpi_ns_unload_namespace ( + ACPI_HANDLE handle); + +ACPI_STATUS +acpi_ns_delete_subtree ( + ACPI_HANDLE start_handle); + + +/* + * Namespace dump/print utilities - nsdump + */ + +void +acpi_ns_dump_tables ( + ACPI_HANDLE search_base, + u32 max_depth); + +void +acpi_ns_dump_entry ( + ACPI_HANDLE handle, + u32 debug_level); + +ACPI_STATUS +acpi_ns_dump_pathname ( + ACPI_HANDLE handle, + NATIVE_CHAR *msg, + u32 level, + u32 component); + +void +acpi_ns_dump_root_devices ( + void); + +void +acpi_ns_dump_objects ( + OBJECT_TYPE_INTERNAL type, + u32 max_depth, + u32 ownder_id, + ACPI_HANDLE start_handle); + + +/* + * Namespace evaluation functions - nseval + */ + +ACPI_STATUS +acpi_ns_evaluate_by_handle ( + ACPI_NAMESPACE_NODE *prefix_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_evaluate_by_name ( + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_evaluate_relative ( + ACPI_NAMESPACE_NODE *prefix_node, + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object); + +ACPI_STATUS +acpi_ns_execute_control_method ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + +ACPI_STATUS +acpi_ns_get_object_value ( + ACPI_NAMESPACE_NODE *object_node, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +/* + * Parent/Child/Peer utility functions - nsfamily + */ + +ACPI_NAME +acpi_ns_find_parent_name ( + ACPI_NAMESPACE_NODE *node_to_search); + +u8 +acpi_ns_exist_downstream_sibling ( + ACPI_NAMESPACE_NODE *this_node); + + +/* + * Scope manipulation - nsscope + */ + +u32 +acpi_ns_opens_scope ( + OBJECT_TYPE_INTERNAL type); + +NATIVE_CHAR * +acpi_ns_get_table_pathname ( + ACPI_NAMESPACE_NODE *node); + +NATIVE_CHAR * +acpi_ns_name_of_current_scope ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ns_handle_to_pathname ( + ACPI_HANDLE obj_handle, + u32 *buf_size, + NATIVE_CHAR *user_buffer); + +u8 +acpi_ns_pattern_match ( + ACPI_NAMESPACE_NODE *obj_node, + NATIVE_CHAR *search_for); + +ACPI_STATUS +acpi_ns_name_compare ( + ACPI_HANDLE obj_handle, + u32 level, + void *context, + void **return_value); + +ACPI_STATUS +acpi_ns_get_node ( + NATIVE_CHAR *pathname, + ACPI_NAMESPACE_NODE *in_prefix_node, + ACPI_NAMESPACE_NODE **out_node); + +/* + * Object management for NTEs - nsobject + */ + +ACPI_STATUS +acpi_ns_attach_object ( + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT *object, + OBJECT_TYPE_INTERNAL type); + + +void * +acpi_ns_compare_value ( + ACPI_HANDLE obj_handle, + u32 level, + void *obj_desc); + + +/* + * Namespace searching and entry - nssearch + */ + +ACPI_STATUS +acpi_ns_search_and_enter ( + u32 entry_name, + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *node, + OPERATING_MODE interpreter_mode, + OBJECT_TYPE_INTERNAL type, + u32 flags, + ACPI_NAMESPACE_NODE **ret_node); + +ACPI_STATUS +acpi_ns_search_node ( + u32 entry_name, + ACPI_NAMESPACE_NODE *node, + OBJECT_TYPE_INTERNAL type, + ACPI_NAMESPACE_NODE **ret_node); + +ACPI_NAMESPACE_NODE * +acpi_ns_create_node ( + u32 acpi_name); + +void +acpi_ns_install_node ( + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *parent_node, /* Parent */ + ACPI_NAMESPACE_NODE *node, /* New Child*/ + OBJECT_TYPE_INTERNAL type); + + +/* + * Utility functions - nsutils + */ + +u8 +acpi_ns_valid_root_prefix ( + NATIVE_CHAR prefix); + +u8 +acpi_ns_valid_path_separator ( + NATIVE_CHAR sep); + +OBJECT_TYPE_INTERNAL +acpi_ns_get_type ( + ACPI_HANDLE obj_handle); + +void * +acpi_ns_get_attached_object ( + ACPI_HANDLE obj_handle); + +u32 +acpi_ns_local ( + OBJECT_TYPE_INTERNAL type); + +ACPI_STATUS +acpi_ns_internalize_name ( + NATIVE_CHAR *dotted_name, + NATIVE_CHAR **converted_name); + +ACPI_STATUS +acpi_ns_externalize_name ( + u32 internal_name_length, + NATIVE_CHAR *internal_name, + u32 *converted_name_length, + NATIVE_CHAR **converted_name); + +ACPI_NAMESPACE_NODE * +acpi_ns_convert_handle_to_entry ( + ACPI_HANDLE handle); + +ACPI_HANDLE +acpi_ns_convert_entry_to_handle( + ACPI_NAMESPACE_NODE *node); + +void +acpi_ns_terminate ( + void); + +ACPI_NAMESPACE_NODE * +acpi_ns_get_parent_object ( + ACPI_NAMESPACE_NODE *node); + + +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_valid_object ( + ACPI_NAMESPACE_NODE *node); + + +#endif /* __ACNAMESP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acobject.h linux/drivers/acpi/include/acobject.h --- v2.4.0-test8/linux/drivers/acpi/include/acobject.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/acobject.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * - * Name: acobject.h - Definition of ACPI_OBJECT_INTERNAL (Internal object only) + * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) + * $Revision: 71 $ * *****************************************************************************/ @@ -26,17 +27,14 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H -#include "actypes.h" -#include "macros.h" -#include "internal.h" /* - * The ACPI_OBJECT_INTERNAL is used to pass AML operands from the dispatcher + * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher * to the interpreter, and to keep track of the various handlers such as * address space handlers and notify handlers. The object is a constant * size in order to allow them to be cached and reused. * - * All variants of the ACPI_OBJECT_INTERNAL are defined with the same + * All variants of the ACPI_OPERAND_OBJECT are defined with the same * sequence of field types, with fields that are not used in a particular * variant being named "Reserved". This is not strictly necessary, but * may in some circumstances simplify understanding if these structures @@ -60,32 +58,31 @@ */ -#define ACPI_OBJECT_COMMON_HEADER /* Two 32-bit fields */\ - u8 data_type; /* To differentiate various internal objs */\ - u8 type; /* ACPI_OBJECT_TYPE */\ - u8 size; /* Size of entire descriptor */\ - u8 flags;\ - u16 reference_count; /* For object deletion management */\ - u16 acpi_cm_fill2;\ - union acpi_obj_internal *next; \ +#define ACPI_OBJECT_COMMON_HEADER /* Two 32-bit fields, one pointer, 8-bit flag */\ + u8 data_type; /* To differentiate various internal objs */\ + u8 type; /* ACPI_OBJECT_TYPE */\ + u16 reference_count; /* For object deletion management */\ + u8 flags; \ /* Defines for flag byte above */ -#define AO_STATIC_ALLOCATION 0x1 +#define AOPOBJ_STATIC_ALLOCATION 0x1 +#define AOPOBJ_DATA_VALID 0x2 +#define AOPOBJ_INITIALIZED 0x4 /* * Common bitfield for the field objects */ #define ACPI_COMMON_FIELD_INFO /* Three 32-bit values */\ - u32 offset; /* Byte offset within containing object */\ - u16 length; /* # of bits in buffer */ \ - u8 granularity;\ - u8 bit_offset; /* Bit offset within min read/write data unit */\ - u8 access; /* Access_type */\ - u8 lock_rule;\ - u8 update_rule;\ - u8 access_attribute; + u8 granularity;\ + u16 length; \ + u32 offset; /* Byte offset within containing object */\ + u8 bit_offset; /* Bit offset within min read/write data unit */\ + u8 access; /* Access_type */\ + u8 lock_rule;\ + u8 update_rule;\ + u8 access_attribute; /****************************************************************************** @@ -98,25 +95,23 @@ typedef struct /* COMMON */ { ACPI_OBJECT_COMMON_HEADER - UCHAR first_non_common_byte; } ACPI_OBJECT_COMMON; +typedef struct /* CACHE_LIST */ +{ + ACPI_OBJECT_COMMON_HEADER + union acpi_operand_obj *next; /* Link for object cache and internal lists*/ + +} ACPI_OBJECT_CACHE_LIST; + + typedef struct /* NUMBER - has value */ { ACPI_OBJECT_COMMON_HEADER - u32 value; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - void *reserved_p1; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 value; } ACPI_OBJECT_NUMBER; @@ -125,16 +120,8 @@ { ACPI_OBJECT_COMMON_HEADER - u32 length; /* # of bytes in string, excluding trailing null */ - u32 reserved2; - u32 reserved3; - u32 reserved4; - - char *pointer; /* String value in AML stream or in allocated space */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 length; + NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */ } ACPI_OBJECT_STRING; @@ -143,16 +130,10 @@ { ACPI_OBJECT_COMMON_HEADER - u32 length; /* # of bytes in buffer */ - u32 sequence; /* Sequential count of buffers created */ - u32 reserved3; - u32 reserved4; - - u8 *pointer; /* points to the buffer in allocated space */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 length; + u32 sequence; /* Sequential count of buffers created */ + + u8 *pointer; /* points to the buffer in allocated space */ } ACPI_OBJECT_BUFFER; @@ -161,16 +142,10 @@ { ACPI_OBJECT_COMMON_HEADER - u32 count; /* # of elements in package */ - u32 reserved2; - u32 reserved3; - u32 reserved4; - - union acpi_obj_internal **elements; /* Array of pointers to Acpi_objects */ - union acpi_obj_internal **next_element; /* used only while initializing */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + u32 count; /* # of elements in package */ + + union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */ + union acpi_operand_obj **next_element; /* used only while initializing */ } ACPI_OBJECT_PACKAGE; @@ -180,13 +155,9 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 sequence; /* Container's sequence number */ + u32 sequence; /* Container's sequence number */ - union acpi_obj_internal *container; /* Containing object (Buffer) */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + union acpi_operand_obj *container; /* Containing object (Buffer) */ } ACPI_OBJECT_FIELD_UNIT; @@ -195,16 +166,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_DEVICE; @@ -213,18 +177,7 @@ { ACPI_OBJECT_COMMON_HEADER - u16 lock_count; - u16 thread_id; - u16 signal_count; - u16 fill1; - u32 reserved3; - u32 reserved4; - - void *semaphore; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + void *semaphore; } ACPI_OBJECT_EVENT; @@ -234,21 +187,17 @@ typedef struct /* METHOD */ { ACPI_OBJECT_COMMON_HEADER + u8 method_flags; + u8 param_count; + + u32 pcode_length; - u8 method_flags; - u8 param_count; - u8 concurrency; - u8 fill1; - u32 pcode_length; - u32 table_length; - ACPI_OWNER_ID owning_id; - u16 reserved4; - - u8 *pcode; - u8 *acpi_table; - void *parser_op; - void *semaphore; - void *reserved_p5; + void *semaphore; + u8 *pcode; + + u8 concurrency; + u8 thread_count; + ACPI_OWNER_ID owning_id; } ACPI_OBJECT_METHOD; @@ -256,45 +205,31 @@ typedef struct /* MUTEX */ { ACPI_OBJECT_COMMON_HEADER + u16 sync_level; - u16 lock_count; - u16 thread_id; - u16 sync_level; - u16 fill1; - u32 reserved3; - u32 reserved4; - - void *semaphore; - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + void *semaphore; } ACPI_OBJECT_MUTEX; -/* Flags for Region */ - -#define INITIAL_REGION_FLAGS 0x0000 /* value set when the region is created */ -#define REGION_AGRUMENT_DATA_VALID 0x0001 /* Addr/Len are set */ -#define REGION_INITIALIZED 0x0002 /* region init handler has been called */ - /* this includes _REG method, if any */ typedef struct /* REGION */ { ACPI_OBJECT_COMMON_HEADER - u16 space_id; - u16 region_flags; /* bits defined above */ - u32 address; - u32 length; - u32 reserved4; /* Region Specific data (PCI _ADR) */ - - union acpi_obj_internal *method; /* Associated control method */ - union acpi_obj_internal *addr_handler; /* Handler for system notifies */ - union acpi_obj_internal *link; /* Link in list of regions */ - /* list is owned by Addr_handler */ - ACPI_NAMED_OBJECT *REGmethod; /* _REG method for this region (if any) */ - ACPI_NAMED_OBJECT *nte; /* containing object */ + u8 space_id; + u32 length; + u32 address; + void *region_context; /* Region Specific data (Handler->Context + optional things like PCI _ADR) */ + + /* TBD: [Restructure] This field can go away when Pass3 is implemented */ + union acpi_operand_obj *method; /* Associated control method */ + + + union acpi_operand_obj *addr_handler; /* Handler for system notifies */ + ACPI_NAMESPACE_NODE *REGmethod; /* _REG method for this region (if any) */ + ACPI_NAMESPACE_NODE *node; /* containing object */ + union acpi_operand_obj *next; } ACPI_OBJECT_REGION; @@ -303,16 +238,11 @@ { ACPI_OBJECT_COMMON_HEADER - u32 system_level; - u32 resource_order; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - void *reserved_p4; - void *reserved_p5; + u32 system_level; + u32 resource_order; + + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ } ACPI_OBJECT_POWER_RESOURCE; @@ -321,17 +251,13 @@ { ACPI_OBJECT_COMMON_HEADER - u32 proc_id; - ACPI_IO_ADDRESS pblk_address; - u16 fill1; - u32 pblk_length; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + u32 proc_id; + u32 length; + ACPI_IO_ADDRESS address; + + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_PROCESSOR; @@ -340,16 +266,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_HANDLE handle; - union acpi_obj_internal *sys_handler; /* Handler for system notifies */ - union acpi_obj_internal *drv_handler; /* Handler for driver notifies */ - union acpi_obj_internal *addr_handler; /* Handler for Address space */ - void *reserved_p5; + union acpi_operand_obj *sys_handler; /* Handler for system notifies */ + union acpi_operand_obj *drv_handler; /* Handler for driver notifies */ + union acpi_operand_obj *addr_handler; /* Handler for Address space */ } ACPI_OBJECT_THERMAL_ZONE; @@ -358,18 +277,14 @@ * Internal types */ + typedef struct /* FIELD */ { ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 reserved4; - union acpi_obj_internal *container; /* Containing object */ - void *reserved_p2; - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + union acpi_operand_obj *container; /* Containing object */ } ACPI_OBJECT_FIELD; @@ -379,13 +294,10 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 value; /* Value to store into Bank_select */ + u32 value; /* Value to store into Bank_select */ - ACPI_HANDLE bank_select; /* Bank select register */ - union acpi_obj_internal *container; /* Containing object */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + ACPI_HANDLE bank_select; /* Bank select register */ + union acpi_operand_obj *container; /* Containing object */ } ACPI_OBJECT_BANK_FIELD; @@ -399,13 +311,10 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - u32 value; /* Value to store into Index register */ + u32 value; /* Value to store into Index register */ - ACPI_HANDLE index; /* Index register */ - ACPI_HANDLE data; /* Data register */ - void *reserved_p3; - void *reserved_p4; - void *reserved_p5; + ACPI_HANDLE index; /* Index register */ + ACPI_HANDLE data; /* Data register */ } ACPI_OBJECT_INDEX_FIELD; @@ -414,16 +323,9 @@ { ACPI_OBJECT_COMMON_HEADER - u32 reserved1; - u32 reserved2; - u32 reserved3; - u32 reserved4; - - ACPI_NAMED_OBJECT *nte; /* Parent device */ - NOTIFY_HANDLER handler; - void *context; - void *reserved_p4; - void *reserved_p5; + ACPI_NAMESPACE_NODE *node; /* Parent device */ + NOTIFY_HANDLER handler; + void *context; } ACPI_OBJECT_NOTIFY_HANDLER; @@ -432,19 +334,20 @@ #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1 + typedef struct /* ADDRESS HANDLER */ { ACPI_OBJECT_COMMON_HEADER - u16 space_id; - u16 hflags; - ADDRESS_SPACE_HANDLER handler; - - ACPI_NAMED_OBJECT *nte; /* Parent device */ - void *context; - ADDRESS_SPACE_SETUP setup; - union acpi_obj_internal *link; /* Link to next handler on device */ - union acpi_obj_internal *region_list; /* regions using this handler */ + u8 space_id; + u16 hflags; + ADDRESS_SPACE_HANDLER handler; + + ACPI_NAMESPACE_NODE *node; /* Parent device */ + void *context; + ADDRESS_SPACE_SETUP setup; + union acpi_operand_obj *region_list; /* regions using this handler */ + union acpi_operand_obj *next; } ACPI_OBJECT_ADDR_HANDLER; @@ -458,31 +361,27 @@ { ACPI_OBJECT_COMMON_HEADER - u16 op_code; - u8 fill1; - u8 target_type; /* Used for Index_op */ - u32 offset; /* Used for Arg_op, Local_op, and Index_op */ - u32 reserved3; - u32 reserved4; - - void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OBJECT_INTERNAL */ - ACPI_NAMED_OBJECT *nte; - union acpi_obj_internal **where; - void *reserved_p4; - void *reserved_p5; + u8 target_type; /* Used for Index_op */ + u16 op_code; + u32 offset; /* Used for Arg_op, Local_op, and Index_op */ + + void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *node; + union acpi_operand_obj **where; } ACPI_OBJECT_REFERENCE; /****************************************************************************** * - * ACPI_OBJECT_INTERNAL Descriptor - a giant union of all of the above + * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above * *****************************************************************************/ -typedef union acpi_obj_internal +typedef union acpi_operand_obj { ACPI_OBJECT_COMMON common; + ACPI_OBJECT_CACHE_LIST cache; ACPI_OBJECT_NUMBER number; ACPI_OBJECT_STRING string; ACPI_OBJECT_BUFFER buffer; @@ -503,6 +402,6 @@ ACPI_OBJECT_NOTIFY_HANDLER notify_handler; ACPI_OBJECT_ADDR_HANDLER addr_handler; -} ACPI_OBJECT_INTERNAL; +} ACPI_OPERAND_OBJECT; #endif /* _ACOBJECT_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acoutput.h linux/drivers/acpi/include/acoutput.h --- v2.4.0-test8/linux/drivers/acpi/include/acoutput.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acoutput.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,124 @@ +/****************************************************************************** + * + * Name: acoutput.h -- debug output + * $Revision: 63 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACOUTPUT_H__ +#define __ACOUTPUT_H__ + +/* + * Debug levels and component IDs. These are used to control the + * granularity of the output of the DEBUG_PRINT macro -- on a per- + * component basis and a per-exception-type basis. + */ + +/* Component IDs -- used in the global "Debug_layer" */ + +#define GLOBAL 0x00000001 +#define COMMON 0x00000002 +#define PARSER 0x00000004 +#define DISPATCHER 0x00000008 +#define INTERPRETER 0x00000010 +#define NAMESPACE 0x00000020 +#define RESOURCE_MANAGER 0x00000040 +#define TABLE_MANAGER 0x00000080 +#define EVENT_HANDLING 0x00000100 +#define HARDWARE 0x00000200 +#define MISCELLANEOUS 0x00000400 +#define OS_DEPENDENT 0x00000800 + +#define BUS_MANAGER 0x00001000 + +#define PROCESSOR_CONTROL 0x00002000 +#define SYSTEM_CONTROL 0x00004000 +#define THERMAL_CONTROL 0x00008000 +#define POWER_CONTROL 0x00010000 + +#define EMBEDDED_CONTROLLER 0x00020000 +#define BATTERY 0x00040000 + +#define DEBUGGER 0x00100000 +#define ALL_COMPONENTS 0x001FFFFF + + +/* Exception level -- used in the global "Debug_level" */ + +#define ACPI_OK 0x00000001 +#define ACPI_INFO 0x00000002 +#define ACPI_WARN 0x00000004 +#define ACPI_ERROR 0x00000008 +#define ACPI_FATAL 0x00000010 +#define ACPI_DEBUG_OBJECT 0x00000020 +#define ACPI_ALL 0x0000003F + + +/* Trace level -- also used in the global "Debug_level" */ + +#define TRACE_PARSE 0x00000100 +#define TRACE_DISPATCH 0x00000200 +#define TRACE_LOAD 0x00000400 +#define TRACE_EXEC 0x00000800 +#define TRACE_NAMES 0x00001000 +#define TRACE_OPREGION 0x00002000 +#define TRACE_BFIELD 0x00004000 +#define TRACE_TRASH 0x00008000 +#define TRACE_TABLES 0x00010000 +#define TRACE_FUNCTIONS 0x00020000 +#define TRACE_VALUES 0x00040000 +#define TRACE_OBJECTS 0x00080000 +#define TRACE_ALLOCATIONS 0x00100000 +#define TRACE_RESOURCES 0x00200000 +#define TRACE_IO 0x00400000 +#define TRACE_INTERRUPTS 0x00800000 +#define TRACE_USER_REQUESTS 0x01000000 +#define TRACE_PACKAGE 0x02000000 +#define TRACE_MUTEX 0x04000000 + +#define TRACE_ALL 0x0FFFFF00 + + +/* Exceptionally verbose output -- also used in the global "Debug_level" */ + +#define VERBOSE_AML_DISASSEMBLE 0x10000000 +#define VERBOSE_INFO 0x20000000 +#define VERBOSE_TABLES 0x40000000 +#define VERBOSE_EVENTS 0x80000000 + +#define VERBOSE_ALL 0x70000000 + + +/* Defaults for Debug_level, debug and normal */ + +#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO) +#define NORMAL_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) +#define DEBUG_ALL (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL) + +/* Misc defines */ + +#define HEX 0x01 +#define ASCII 0x02 +#define FULL_ADDRESS 0x04 +#define CHARS_PER_LINE 16 /* used in Dump_buf function */ + + +#endif /* __ACOUTPUT_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acparser.h linux/drivers/acpi/include/acparser.h --- v2.4.0-test8/linux/drivers/acpi/include/acparser.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acparser.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,345 @@ +/****************************************************************************** + * + * Module Name: acparser.h - AML Parser subcomponent prototypes and defines + * $Revision: 46 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#ifndef __ACPARSER_H__ +#define __ACPARSER_H__ + + +#define OP_HAS_RETURN_VALUE 1 + +/* variable # arguments */ + +#define ACPI_VAR_ARGS ACPI_UINT32_MAX + +/* maximum virtual address */ + +#define ACPI_MAX_AML ((u8 *)(~0UL)) + + +#define ACPI_PARSE_DELETE_TREE 0x0001 +#define ACPI_PARSE_NO_TREE_DELETE 0x0000 +#define ACPI_PARSE_TREE_MASK 0x0001 + +#define ACPI_PARSE_LOAD_PASS1 0x0010 +#define ACPI_PARSE_LOAD_PASS2 0x0020 +#define ACPI_PARSE_EXECUTE 0x0030 +#define ACPI_PARSE_MODE_MASK 0x0030 + +/* psapi - Parser external interfaces */ + +ACPI_STATUS +acpi_psx_load_table ( + u8 *pcode_addr, + u32 pcode_length); + +ACPI_STATUS +acpi_psx_execute ( + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc); + + +u8 +acpi_ps_is_namespace_object_op ( + u16 opcode); +u8 +acpi_ps_is_namespace_op ( + u16 opcode); + + +/****************************************************************************** + * + * Parser interfaces + * + *****************************************************************************/ + + +/* psargs - Parse AML opcode arguments */ + +u8 * +acpi_ps_get_next_package_end ( + ACPI_PARSE_STATE *parser_state); + +u32 +acpi_ps_get_next_package_length ( + ACPI_PARSE_STATE *parser_state); + +NATIVE_CHAR * +acpi_ps_get_next_namestring ( + ACPI_PARSE_STATE *parser_state); + +void +acpi_ps_get_next_simple_arg ( + ACPI_PARSE_STATE *parser_state, + u32 arg_type, /* type of argument */ + ACPI_PARSE_OBJECT *arg); /* (OUT) argument data */ + +void +acpi_ps_get_next_namepath ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *arg, + u32 *arg_count, + u8 method_call); + +ACPI_PARSE_OBJECT * +acpi_ps_get_next_field ( + ACPI_PARSE_STATE *parser_state); + +ACPI_PARSE_OBJECT * +acpi_ps_get_next_arg ( + ACPI_PARSE_STATE *parser_state, + u32 arg_type, + u32 *arg_count); + + +/* psopcode - AML Opcode information */ + +ACPI_OPCODE_INFO * +acpi_ps_get_opcode_info ( + u16 opcode); + +NATIVE_CHAR * +acpi_ps_get_opcode_name ( + u16 opcode); + + +/* psparse - top level parsing routines */ + +ACPI_STATUS +acpi_ps_find_object ( + u16 opcode, + ACPI_PARSE_OBJECT *op, + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT **out_op); + +void +acpi_ps_delete_parse_tree ( + ACPI_PARSE_OBJECT *root); + +ACPI_STATUS +acpi_ps_parse_loop ( + ACPI_WALK_STATE *walk_state); + +ACPI_STATUS +acpi_ps_parse_aml ( + ACPI_PARSE_OBJECT *start_scope, + u8 *aml, + u32 aml_size, + u32 parse_flags, + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback); + +ACPI_STATUS +acpi_ps_parse_table ( + u8 *aml, + u32 aml_size, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback, + ACPI_PARSE_OBJECT **root_object); + +u16 +acpi_ps_peek_opcode ( + ACPI_PARSE_STATE *state); + + +/* psscope - Scope stack management routines */ + + +ACPI_STATUS +acpi_ps_init_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *root); + +ACPI_PARSE_OBJECT * +acpi_ps_get_parent_scope ( + ACPI_PARSE_STATE *state); + +u8 +acpi_ps_has_completed_scope ( + ACPI_PARSE_STATE *parser_state); + +void +acpi_ps_pop_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT **op, + u32 *arg_list); + +ACPI_STATUS +acpi_ps_push_scope ( + ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *op, + u32 remaining_args, + u32 arg_count); + +void +acpi_ps_cleanup_scope ( + ACPI_PARSE_STATE *state); + + +/* pstree - parse tree manipulation routines */ + +void +acpi_ps_append_arg( + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_OBJECT *arg); + +ACPI_PARSE_OBJECT* +acpi_ps_find ( + ACPI_PARSE_OBJECT *scope, + NATIVE_CHAR *path, + u16 opcode, + u32 create); + +ACPI_PARSE_OBJECT * +acpi_ps_get_arg( + ACPI_PARSE_OBJECT *op, + u32 argn); + +ACPI_PARSE_OBJECT * +acpi_ps_get_child ( + ACPI_PARSE_OBJECT *op); + +ACPI_PARSE_OBJECT * +acpi_ps_get_depth_next ( + ACPI_PARSE_OBJECT *origin, + ACPI_PARSE_OBJECT *op); + + +/* pswalk - parse tree walk routines */ + +ACPI_STATUS +acpi_ps_walk_parsed_aml ( + ACPI_PARSE_OBJECT *start_op, + ACPI_PARSE_OBJECT *end_op, + ACPI_OPERAND_OBJECT *mth_desc, + ACPI_NAMESPACE_NODE *start_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, + ACPI_OWNER_ID owner_id, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback); + +ACPI_STATUS +acpi_ps_get_next_walk_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_UPWARDS ascending_callback); + + +/* psutils - parser utilities */ + + +ACPI_PARSE_STATE * +acpi_ps_create_state ( + u8 *aml, + u32 aml_size); + +void +acpi_ps_init_op ( + ACPI_PARSE_OBJECT *op, + u16 opcode); + +ACPI_PARSE_OBJECT * +acpi_ps_alloc_op ( + u16 opcode); + +void +acpi_ps_free_op ( + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_delete_parse_cache ( + void); + +u8 +acpi_ps_is_leading_char ( + u32 c); + +u8 +acpi_ps_is_prefix_char ( + u32 c); + +u8 +acpi_ps_is_named_op ( + u16 opcode); + +u8 +acpi_ps_is_node_op ( + u16 opcode); + +u8 +acpi_ps_is_deferred_op ( + u16 opcode); + +u8 +acpi_ps_is_bytelist_op( + u16 opcode); + +u8 +acpi_ps_is_field_op( + u16 opcode); + +u8 +acpi_ps_is_create_field_op ( + u16 opcode); + +ACPI_PARSE2_OBJECT* +acpi_ps_to_extended_op( + ACPI_PARSE_OBJECT *op); + +u32 +acpi_ps_get_name( + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_set_name( + ACPI_PARSE_OBJECT *op, + u32 name); + + +/* psdump - display parser tree */ + +u32 +acpi_ps_sprint_path ( + NATIVE_CHAR *buffer_start, + u32 buffer_size, + ACPI_PARSE_OBJECT *op); + +u32 +acpi_ps_sprint_op ( + NATIVE_CHAR *buffer_start, + u32 buffer_size, + ACPI_PARSE_OBJECT *op); + +void +acpi_ps_show ( + ACPI_PARSE_OBJECT *op); + + +#endif /* __ACPARSER_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpi.h linux/drivers/acpi/include/acpi.h --- v2.4.0-test8/linux/drivers/acpi/include/acpi.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/acpi.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. + * $Revision: 48 $ * *****************************************************************************/ @@ -31,20 +31,20 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ -#include "config.h" /* Configuration constants */ +#include "acconfig.h" /* Configuration constants */ #include "acenv.h" /* Target environment specific items */ #include "actypes.h" /* Fundamental data types */ #include "acexcep.h" /* Local exception codes */ -#include "macros.h" /* C macros */ -#include "actables.h" /* Acpi table definitions */ -#include "internal.h" /* Internal data types */ -#include "output.h" /* Error output and Debug macros */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* Acpi table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ #include "acpiosxf.h" /* Interfaces to the Acpi-to-OS layer*/ #include "acpixf.h" /* Acpi core external interfaces */ #include "acobject.h" /* Acpi internal object */ -#include "globals.h" /* All global variables */ -#include "hardware.h" /* Hardware defines and interfaces */ -#include "common.h" /* Common (global) interfaces */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "accommon.h" /* Common (global) interfaces */ #endif /* __ACPI_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpiosxf.h linux/drivers/acpi/include/acpiosxf.h --- v2.4.0-test8/linux/drivers/acpi/include/acpiosxf.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/acpiosxf.h Fri Sep 15 14:30:30 2000 @@ -244,7 +244,7 @@ ACPI_STATUS acpi_os_breakpoint ( - char *message); + NATIVE_CHAR *message); u8 acpi_os_readable ( @@ -264,12 +264,12 @@ s32 acpi_os_printf ( - const char *format, + const NATIVE_CHAR *format, ...); s32 acpi_os_vprintf ( - const char *format, + const NATIVE_CHAR *format, va_list args); /* @@ -278,7 +278,7 @@ u32 acpi_os_get_line ( - char *buffer); + NATIVE_CHAR *buffer); /* @@ -290,7 +290,7 @@ void *failed_assertion, void *file_name, u32 line_number, - char *message); + NATIVE_CHAR *message); #endif /* __ACPIOSD_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acpixf.h linux/drivers/acpi/include/acpixf.h --- v2.4.0-test8/linux/drivers/acpi/include/acpixf.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/acpixf.h Fri Sep 15 14:30:30 2000 @@ -28,7 +28,7 @@ #define __ACXFACE_H__ #include "actypes.h" -#include "actables.h" +#include "actbl.h" /* * Global interfaces diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/acresrc.h linux/drivers/acpi/include/acresrc.h --- v2.4.0-test8/linux/drivers/acpi/include/acresrc.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/acresrc.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,304 @@ +/****************************************************************************** + * + * Name: acresrc.h - Resource Manager function prototypes + * $Revision: 20 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACRESRC_H__ +#define __ACRESRC_H__ + + +/* + * Function prototypes called from Acpi* APIs + */ + +ACPI_STATUS +acpi_rs_get_prt_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + + +ACPI_STATUS +acpi_rs_get_crs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_get_prs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_set_srs_method_data ( + ACPI_HANDLE handle, + ACPI_BUFFER *ret_buffer); + +ACPI_STATUS +acpi_rs_create_resource_list ( + ACPI_OPERAND_OBJECT *byte_stream_buffer, + u8 *output_buffer, + u32 *output_buffer_length); + +ACPI_STATUS +acpi_rs_create_byte_stream ( + RESOURCE *linked_list_buffer, + u8 *output_buffer, + u32 *output_buffer_length); + +ACPI_STATUS +acpi_rs_create_pci_routing_table ( + ACPI_OPERAND_OBJECT *method_return_object, + u8 *output_buffer, + u32 *output_buffer_length); + + +/* + *Function prototypes called from Acpi_rs_create*APIs + */ + +void +acpi_rs_dump_resource_list ( + RESOURCE *resource); + +void +acpi_rs_dump_irq_list ( + u8 *route_table); + +ACPI_STATUS +acpi_rs_get_byte_stream_start ( + u8 *byte_stream_buffer, + u8 **byte_stream_start, + u32 *size); + +ACPI_STATUS +acpi_rs_calculate_list_length ( + u8 *byte_stream_buffer, + u32 byte_stream_buffer_length, + u32 *size_needed); + +ACPI_STATUS +acpi_rs_calculate_byte_stream_length ( + RESOURCE *linked_list_buffer, + u32 *size_needed); + +ACPI_STATUS +acpi_rs_calculate_pci_routing_table_length ( + ACPI_OPERAND_OBJECT *package_object, + u32 *buffer_size_needed); + +ACPI_STATUS +acpi_rs_byte_stream_to_list ( + u8 *byte_stream_buffer, + u32 byte_stream_buffer_length, + u8 **output_buffer); + +ACPI_STATUS +acpi_rs_list_to_byte_stream ( + RESOURCE *linked_list, + u32 byte_stream_size_needed, + u8 **output_buffer); + +ACPI_STATUS +acpi_rs_io_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_fixed_io_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_io_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_fixed_io_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_irq_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_irq_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_dma_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_dma_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_address16_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_address16_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_address32_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_address32_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_start_dependent_functions_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_end_dependent_functions_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_start_dependent_functions_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_end_dependent_functions_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_memory24_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_memory24_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_memory32_range_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size +); + +ACPI_STATUS +acpi_rs_fixed_memory32_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_memory32_range_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_fixed_memory32_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_extended_irq_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_extended_irq_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_end_tag_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_end_tag_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + +ACPI_STATUS +acpi_rs_vendor_resource ( + u8 *byte_stream_buffer, + u32 *bytes_consumed, + u8 **output_buffer, + u32 *structure_size); + +ACPI_STATUS +acpi_rs_vendor_stream ( + RESOURCE *linked_list, + u8 **output_buffer, + u32 *bytes_consumed); + + +#endif /* __ACRESRC_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actables.h linux/drivers/acpi/include/actables.h --- v2.4.0-test8/linux/drivers/acpi/include/actables.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/actables.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * - * Name: actables.h - Table data structures defined in ACPI specification + * Name: actables.h - ACPI table management + * $Revision: 20 $ * *****************************************************************************/ @@ -27,162 +27,139 @@ #define __ACTABLES_H__ -/* - * Values for description table header signatures - */ - -#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ -#define APIC_SIG "APIC" /* Multiple APIC Description Table */ -#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ -#define FACP_SIG "FACP" /* Fixed ACPI Description Table */ -#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ -#define PSDT_SIG "PSDT" /* Persistent System Description Table */ -#define RSDT_SIG "RSDT" /* Root System Description Table */ -#define SSDT_SIG "SSDT" /* Secondary System Description Table */ -#define SBST_SIG "SBST" /* Smart Battery Specification Table */ -#define BOOT_SIG "BOOT" /* Boot table */ - - -#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ +/* Used in Acpi_tb_map_acpi_table for size parameter if table header is to be used */ -/* values of Mapic.Model */ +#define SIZE_IN_HEADER 0 -#define DUAL_PIC 0 -#define MULTIPLE_APIC 1 -/* values of Type in APIC_HEADER */ - -#define APIC_PROC 0 -#define APIC_IO 1 +ACPI_STATUS +acpi_tb_handle_to_object ( + u16 table_id, + ACPI_TABLE_DESC **table_desc); /* - * Architecture-independent tables - * The architecture dependent tables are in separate files + * Acpi_tbfac - FACP, FACS utilities */ -typedef struct /* Root System Descriptor Pointer */ -{ - char signature [8]; /* contains "RSD PTR " */ - u8 checksum; /* to make sum of struct == 0 */ - char oem_id [6]; /* OEM identification */ - u8 reserved; /* reserved - must be zero */ - u32 rsdt_physical_address; /* physical address of RSDT */ - -} ROOT_SYSTEM_DESCRIPTOR_POINTER; +ACPI_STATUS +acpi_tb_get_table_facs ( + ACPI_TABLE_HEADER *buffer_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* ACPI common table header */ -{ - char signature [4]; /* identifies type of table */ - u32 length; /* length of table, in bytes, - * including header */ - u8 revision; /* specification minor version # */ - u8 checksum; /* to make sum of entire table == 0 */ - char oem_id [6]; /* OEM identification */ - char oem_table_id [8]; /* OEM table identification */ - u32 oem_revision; /* OEM revision number */ - char asl_compiler_id [4]; /* ASL compiler vendor ID */ - u32 asl_compiler_revision; /* ASL compiler revision number */ +/* + * Acpi_tbget - Table "get" routines + */ -} ACPI_TABLE_HEADER; +ACPI_STATUS +acpi_tb_get_table_ptr ( + ACPI_TABLE_TYPE table_type, + u32 instance, + ACPI_TABLE_HEADER **table_ptr_loc); +ACPI_STATUS +acpi_tb_get_table ( + void *physical_address, + ACPI_TABLE_HEADER *buffer_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* APIC Table */ -{ - ACPI_TABLE_HEADER header; /* table header */ - u32 local_apic_address; /* Physical address for accessing local APICs */ - u32 PCATcompat : 1; /* a one indicates system also has dual 8259s */ - u32 reserved1 : 31; -} APIC_TABLE; +/* + * Acpi_tbgetall - Get all firmware ACPI tables + */ +ACPI_STATUS +acpi_tb_get_all_tables ( + u32 number_of_tables, + ACPI_TABLE_HEADER *buffer_ptr); -typedef struct /* APIC Header */ -{ - u8 type; /* APIC type. Either APIC_PROC or APIC_IO */ - u8 length; /* Length of APIC structure */ -} APIC_HEADER; +/* + * Acpi_tbinstall - Table installation + */ +ACPI_STATUS +acpi_tb_install_table ( + ACPI_TABLE_HEADER *table_ptr, + ACPI_TABLE_DESC *table_info); -typedef struct /* Processor APIC */ -{ - APIC_HEADER header; - u8 processor_apic_id; /* ACPI processor id */ - u8 local_apic_id; /* processor's local APIC id */ - u32 processor_enabled: 1; /* Processor is usable if set */ - u32 reserved1 : 32; +ACPI_STATUS +acpi_tb_recognize_table ( + ACPI_TABLE_HEADER *table_ptr, + ACPI_TABLE_DESC *table_info); -} PROCESSOR_APIC; +ACPI_STATUS +acpi_tb_init_table_descriptor ( + ACPI_TABLE_TYPE table_type, + ACPI_TABLE_DESC *table_info); -typedef struct /* IO APIC */ -{ - APIC_HEADER header; - u8 io_apic_id; /* I/O APIC ID */ - u8 reserved; /* reserved - must be zero */ - u32 io_apic_address; /* APIC's physical address */ - u32 vector; /* interrupt vector index where INTI - * lines start */ -} IO_APIC; +/* + * Acpi_tbremove - Table removal and deletion + */ +void +acpi_tb_delete_acpi_tables ( + void); -/* -** IA64 TODO: Add SAPIC Tables -*/ +void +acpi_tb_delete_acpi_table ( + ACPI_TABLE_TYPE type); -/* -** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64 -** extensions. -*/ -typedef struct /* Smart Battery Description Table */ -{ - ACPI_TABLE_HEADER header; - u32 warning_level; - u32 low_level; - u32 critical_level; +ACPI_TABLE_DESC * +acpi_tb_delete_single_table ( + ACPI_TABLE_DESC *table_desc); -} SMART_BATTERY_DESCRIPTION_TABLE; +void +acpi_tb_free_acpi_tables_of_type ( + ACPI_TABLE_DESC *table_info); /* - * ACPI Table information. We save the table address, length, - * and type of memory allocation (mapped or allocated) for each - * table for 1) when we exit, and 2) if a new table is installed + * Acpi_tbrsd - RSDP, RSDT utilities */ -#define ACPI_MEM_NOT_ALLOCATED 0 -#define ACPI_MEM_ALLOCATED 1 -#define ACPI_MEM_MAPPED 2 - -#define ACPI_TABLE_SINGLE 0 -#define ACPI_TABLE_MULTIPLE 1 - - -/* Data about each known table type */ +ACPI_STATUS +acpi_tb_get_table_rsdt ( + u32 *number_of_tables); -typedef struct _acpi_table_support -{ - char *name; - char *signature; - u8 sig_length; - u8 flags; - u16 status; - void **global_ptr; +u8 * +acpi_tb_scan_memory_for_rsdp ( + u8 *start_address, + u32 length); -} ACPI_TABLE_SUPPORT; +ACPI_STATUS +acpi_tb_find_rsdp ( + ACPI_TABLE_DESC *table_info); /* - * Get the architecture-specific tables + * Acpi_tbutils - common table utilities */ -#ifdef IA64 -#include "actbl64.h" -#else -#include "actbl32.h" -#endif +u8 +acpi_tb_system_table_pointer ( + void *where); + +ACPI_STATUS +acpi_tb_map_acpi_table ( + void *physical_address, + u32 *size, + void **logical_address); + +ACPI_STATUS +acpi_tb_verify_table_checksum ( + ACPI_TABLE_HEADER *table_header); + +u8 +acpi_tb_checksum ( + void *buffer, + u32 length); + +ACPI_STATUS +acpi_tb_validate_table_header ( + ACPI_TABLE_HEADER *table_header); #endif /* __ACTABLES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl.h linux/drivers/acpi/include/actbl.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/include/actbl.h Fri Sep 15 14:30:30 2000 @@ -0,0 +1,190 @@ +/****************************************************************************** + * + * Name: actbl.h - Table data structures defined in ACPI specification + * $Revision: 34 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + +#ifndef __ACTBL_H__ +#define __ACTBL_H__ + + +/* + * Values for description table header signatures + */ + +#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ +#define APIC_SIG "APIC" /* Multiple APIC Description Table */ +#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ +#define FACP_SIG "FACP" /* Fixed ACPI Description Table */ +#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ +#define PSDT_SIG "PSDT" /* Persistent System Description Table */ +#define RSDT_SIG "RSDT" /* Root System Description Table */ +#define SSDT_SIG "SSDT" /* Secondary System Description Table */ +#define SBST_SIG "SBST" /* Smart Battery Specification Table */ +#define BOOT_SIG "BOOT" /* Boot table */ + + +#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ + +/* values of Mapic.Model */ + +#define DUAL_PIC 0 +#define MULTIPLE_APIC 1 + +/* values of Type in APIC_HEADER */ + +#define APIC_PROC 0 +#define APIC_IO 1 + + +/* + * Architecture-independent tables + * The architecture dependent tables are in separate files + */ + +typedef struct /* Root System Descriptor Pointer */ +{ + NATIVE_CHAR signature [8]; /* contains "RSD PTR " */ + u8 checksum; /* to make sum of struct == 0 */ + NATIVE_CHAR oem_id [6]; /* OEM identification */ + u8 reserved; /* reserved - must be zero */ + u32 rsdt_physical_address; /* physical address of RSDT */ + +} ROOT_SYSTEM_DESCRIPTOR_POINTER; + + +typedef struct /* ACPI common table header */ +{ + NATIVE_CHAR signature [4]; /* identifies type of table */ + u32 length; /* length of table, in bytes, + * including header */ + u8 revision; /* specification minor version # */ + u8 checksum; /* to make sum of entire table == 0 */ + NATIVE_CHAR oem_id [6]; /* OEM identification */ + NATIVE_CHAR oem_table_id [8]; /* OEM table identification */ + u32 oem_revision; /* OEM revision number */ + NATIVE_CHAR asl_compiler_id [4]; /* ASL compiler vendor ID */ + u32 asl_compiler_revision; /* ASL compiler revision number */ + +} ACPI_TABLE_HEADER; + + +typedef struct /* APIC Table */ +{ + ACPI_TABLE_HEADER header; /* table header */ + u32 local_apic_address; /* Physical address for accessing local APICs */ + u32 PCATcompat : 1; /* a one indicates system also has dual 8259s */ + u32 reserved1 : 31; + +} APIC_TABLE; + + +typedef struct /* APIC Header */ +{ + u8 type; /* APIC type. Either APIC_PROC or APIC_IO */ + u8 length; /* Length of APIC structure */ + +} APIC_HEADER; + + +typedef struct /* Processor APIC */ +{ + APIC_HEADER header; + u8 processor_apic_id; /* ACPI processor id */ + u8 local_apic_id; /* processor's local APIC id */ + u32 processor_enabled: 1; /* Processor is usable if set */ + u32 reserved1 : 32; + +} PROCESSOR_APIC; + + +typedef struct /* IO APIC */ +{ + APIC_HEADER header; + u8 io_apic_id; /* I/O APIC ID */ + u8 reserved; /* reserved - must be zero */ + u32 io_apic_address; /* APIC's physical address */ + u32 vector; /* interrupt vector index where INTI + * lines start */ +} IO_APIC; + + +/* +** IA64 TODO: Add SAPIC Tables +*/ + +/* +** IA64 TODO: Modify Smart Battery Description to comply with ACPI IA64 +** extensions. +*/ +typedef struct /* Smart Battery Description Table */ +{ + ACPI_TABLE_HEADER header; + u32 warning_level; + u32 low_level; + u32 critical_level; + +} SMART_BATTERY_DESCRIPTION_TABLE; + + +/* + * ACPI Table information. We save the table address, length, + * and type of memory allocation (mapped or allocated) for each + * table for 1) when we exit, and 2) if a new table is installed + */ + +#define ACPI_MEM_NOT_ALLOCATED 0 +#define ACPI_MEM_ALLOCATED 1 +#define ACPI_MEM_MAPPED 2 + +/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */ + +#define ACPI_TABLE_SINGLE 0 +#define ACPI_TABLE_MULTIPLE 1 + + +/* Data about each known table type */ + +typedef struct _acpi_table_support +{ + NATIVE_CHAR *name; + NATIVE_CHAR *signature; + u8 sig_length; + u8 flags; + u16 status; + void **global_ptr; + +} ACPI_TABLE_SUPPORT; + + +/* + * Get the architecture-specific tables + */ + +#ifdef IA64 +#include "actbl64.h" +#else +#include "actbl32.h" +#endif + + +#endif /* __ACTBL_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl32.h linux/drivers/acpi/include/actbl32.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl32.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/actbl32.h Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Name: actbl32.h - ACPI tables specific to IA32 + * $Revision: 11 $ * *****************************************************************************/ @@ -40,7 +41,7 @@ typedef struct { - char signature[4]; /* signature "FACS" */ + NATIVE_CHAR signature[4]; /* signature "FACS" */ u32 length; /* length of structure, in bytes */ u32 hardware_signature; /* hardware configuration signature */ u32 firmware_waking_vector; /* ACPI OS waking vector */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actbl64.h linux/drivers/acpi/include/actbl64.h --- v2.4.0-test8/linux/drivers/acpi/include/actbl64.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/actbl64.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: actbl64.h - ACPI tables specific to IA64 + * $Revision: 12 $ * *****************************************************************************/ @@ -45,7 +45,7 @@ typedef struct { - char signature[4]; /* signature "FACS" */ + NATIVE_CHAR signature[4]; /* signature "FACS" */ u32 length; /* length of structure, in bytes */ u32 hardware_signature; /* hardware configuration signature */ u32 reserved4; /* must be 0 */ @@ -65,7 +65,7 @@ ACPI_TABLE_HEADER header; /* table header */ u32 reserved_pad; /* IA64 alignment, must be 0 */ ACPI_TBLPTR firmware_ctrl; /* Physical address of FACS */ - ACPI_TBLPTR acpi_dsdt; /* Physical address of DSDT */ + ACPI_TBLPTR dsdt; /* Physical address of DSDT */ u8 model; /* System Interrupt Model */ u8 address_space; /* Address Space Bitmask */ u16 sci_int; /* System vector of SCI interrupt */ @@ -90,8 +90,8 @@ u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ u8 gpe1_base; /* offset in gpe model where gpe1 events start */ u8 reserved3; /* reserved */ - u16 Plvl2_lat; /* worst case HW latency to enter/exit C2 state */ - u16 Plvl3_lat; /* worst case HW latency to enter/exit C3 state */ + u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */ + u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */ u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */ u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */ u8 century; /* index to century in RTC CMOS RAM */ @@ -99,11 +99,11 @@ u32 flush_cash : 1; /* PAL_FLUSH_CACHE is correctly supported */ u32 reserved5 : 1; /* reserved - must be zero */ u32 proc_c1 : 1; /* all processors support C1 state */ - u32 Plvl2_up : 1; /* C2 state works on MP system */ + u32 plvl2_up : 1; /* C2 state works on MP system */ u32 pwr_button : 1; /* Power button is handled as a generic feature */ u32 sleep_button : 1; /* Sleep button is handled as a generic feature, or not present */ u32 fixed_rTC : 1; /* RTC wakeup stat not in fixed register space */ - u32 RTCS4 : 1; /* RTC wakeup stat not possible from S4 */ + u32 rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ u32 tmr_val_ext : 1; /* tmr_val is 32 bits */ u32 dock_cap : 1; /* Supports Docking */ u32 reserved6 : 22; /* reserved - must be zero */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/actypes.h linux/drivers/acpi/include/actypes.h --- v2.4.0-test8/linux/drivers/acpi/include/actypes.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/actypes.h Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem + * $Revision: 131 $ * *****************************************************************************/ @@ -23,15 +23,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _ACTYPES_H -#define _ACTYPES_H +#ifndef __ACTYPES_H__ +#define __ACTYPES_H__ /*! [Begin] no source code translation (keep the typedefs) */ /* * Data types - Fixed across all compilation models * - * BOOLEAN Logical Boolean. 1 byte value containing a 0 for FALSE or a 1 for TRUE. Other values are undefined. + * BOOLEAN Logical Boolean. + * 1 byte value containing a 0 for FALSE or a 1 for TRUE. + * Other values are undefined. + * * INT8 8-bit (1 byte) signed value * UINT8 8-bit (1 byte) unsigned value * INT16 16-bit (2 byte) signed value @@ -45,14 +48,17 @@ * UCHAR Character. 1 byte unsigned value. */ +#ifdef __ia64__ +#define _IA64 +#endif + #ifdef _IA64 /* * 64-bit type definitions */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef short INT16; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; @@ -74,10 +80,9 @@ /* * 16-bit type definitions */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef int INT16; typedef unsigned int UINT16; typedef long INT32; typedef unsigned long UINT32; @@ -96,10 +101,9 @@ /* * 32-bit type definitions (default) */ -typedef signed char INT8; typedef unsigned char UINT8; +typedef unsigned char BOOLEAN; typedef unsigned char UCHAR; -typedef short INT16; typedef unsigned short UINT16; typedef int INT32; typedef unsigned int UINT32; @@ -113,19 +117,15 @@ #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define _HW_ALIGNMENT_SUPPORT - #endif - - /* * Miscellaneous common types */ -typedef UINT8 BOOLEAN; typedef UINT32 UINT32_BIT; -typedef NATIVE_INT ACPI_PTRDIFF; -typedef NATIVE_UINT ACPI_SIZE; +typedef NATIVE_UINT ACPI_PTRDIFF; +typedef char NATIVE_CHAR; /* @@ -133,7 +133,6 @@ */ #define ACPI_UCHAR_MAX (UCHAR) 0xFF -#define ACPI_INT32_MAX (INT32) 0x7FFFFFFF #define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF @@ -141,14 +140,11 @@ /* * Types used only in translated source */ -typedef INT8 s8; -typedef INT16 s16; typedef INT32 s32; typedef UINT8 u8; typedef UINT16 u16; typedef UINT32 u32; #endif - /*! [End] no source code translation !*/ @@ -176,9 +172,9 @@ */ typedef u32 ACPI_STATUS; /* All ACPI Exceptions */ -typedef u32 ACPI_NAME; /* 4-char ACPI name */ +typedef u32 ACPI_NAME; /* 4-s8 ACPI name */ typedef char* ACPI_STRING; /* Null terminated ASCII string */ -typedef void* ACPI_HANDLE; /* Actually a ptr to an NTE */ +typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */ /* @@ -223,10 +219,12 @@ /* * Types associated with names. The first group of - * values correspond to the definition of the ACPI Object_type operator (See the ACPI Spec). - * Therefore, only add to the first group if the spec changes! + * values correspond to the definition of the ACPI + * Object_type operator (See the ACPI Spec). Therefore, + * only add to the first group if the spec changes! * - * Types must be kept in sync with the Acpi_ns_properties and Acpi_ns_type_names arrays + * Types must be kept in sync with the Acpi_ns_properties + * and Acpi_ns_type_names arrays */ typedef u32 ACPI_OBJECT_TYPE; @@ -238,14 +236,14 @@ #define ACPI_TYPE_BUFFER 3 /* 0x03 */ #define ACPI_TYPE_PACKAGE 4 /* 0x04 Byte_const, multiple Data_term/Constant/Super_name */ #define ACPI_TYPE_FIELD_UNIT 5 /* 0x05 */ -#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Named_object */ +#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Node */ #define ACPI_TYPE_EVENT 7 /* 0x07 */ #define ACPI_TYPE_METHOD 8 /* 0x08 Name, Byte_const, multiple Code */ #define ACPI_TYPE_MUTEX 9 /* 0x09 */ #define ACPI_TYPE_REGION 10 /* 0x0A */ -#define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Named_object */ +#define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Node */ #define ACPI_TYPE_PROCESSOR 12 /* 0x0C Name,Byte_const,DWord_const,Byte_const,multi Nm_o */ -#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Named_object */ +#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Node */ #define ACPI_TYPE_BUFFER_FIELD 14 /* 0x0E */ #define ACPI_TYPE_DDB_HANDLE 15 /* 0x0F */ #define ACPI_TYPE_DEBUG_OBJECT 16 /* 0x10 */ @@ -254,32 +252,39 @@ /* * This section contains object types that do not relate to the ACPI Object_type operator. - * They are used for various internal purposes only. A numerical gap is provided in - * case additional "official" Object_types are added in the future. Also, values exceeding - * the largest official ACPI Object_type must not overlap with defined AML opcodes. - */ -#define INTERNAL_TYPE_BEGIN 25 -#define INTERNAL_TYPE_DEF_FIELD 25 /* 0x19 */ -#define INTERNAL_TYPE_BANK_FIELD 26 /* 0x1A */ -#define INTERNAL_TYPE_INDEX_FIELD 27 /* 0x1B */ -#define INTERNAL_TYPE_DEF_FIELD_DEFN 28 /* 0x1C Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_BANK_FIELD_DEFN 29 /* 0x1D 2 Name,DWord_const,Byte_const,multi Field_element */ -#define INTERNAL_TYPE_INDEX_FIELD_DEFN 30 /* 0x1E 2 Name, Byte_const, multiple Field_element */ -#define INTERNAL_TYPE_IF 31 /* 0x1F Op_code, multiple Code */ -#define INTERNAL_TYPE_ELSE 32 /* 0x20 multiple Code */ -#define INTERNAL_TYPE_WHILE 33 /* 0x21 Op_code, multiple Code */ -#define INTERNAL_TYPE_SCOPE 34 /* 0x22 Name, multiple Named_object */ -#define INTERNAL_TYPE_DEF_ANY 35 /* 0x23 type is Any, suppress search of enclosing scopes */ -#define INTERNAL_TYPE_REFERENCE 36 /* 0x24 Arg#, Local#, Name, Debug; used only in descriptors */ -#define INTERNAL_TYPE_ALIAS 37 /* 0x25 */ -#define INTERNAL_TYPE_NOTIFY 38 /* 0x26 */ -#define INTERNAL_TYPE_ADDRESS_HANDLER 39 /* 0x27 */ -#define INTERNAL_TYPE_METHOD_ARGUMENT 40 /* 0x28 */ -#define INTERNAL_TYPE_METHOD_LOCAL_VAR 41 /* 0x29 */ + * They are used for various internal purposes only. If new predefined ACPI_TYPEs are + * added (via the ACPI specification), these internal types must move upwards. + * Also, values exceeding the largest official ACPI Object_type must not overlap with + * defined AML opcodes. + */ +#define INTERNAL_TYPE_BEGIN 17 + +#define INTERNAL_TYPE_DEF_FIELD 17 /* 0x11 */ +#define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */ +#define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */ +#define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */ +#define INTERNAL_TYPE_ALIAS 21 /* 0x15 */ +#define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */ +#define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */ + +#define INTERNAL_TYPE_NODE_MAX 23 + +/* These are pseudo-types because there are never any namespace nodes with these types */ + +#define INTERNAL_TYPE_DEF_FIELD_DEFN 24 /* 0x18 Name, Byte_const, multiple Field_element */ +#define INTERNAL_TYPE_BANK_FIELD_DEFN 25 /* 0x19 2 Name,DWord_const,Byte_const,multi Field_element */ +#define INTERNAL_TYPE_INDEX_FIELD_DEFN 26 /* 0x1A 2 Name, Byte_const, multiple Field_element */ +#define INTERNAL_TYPE_IF 27 /* 0x1B Op_code, multiple Code */ +#define INTERNAL_TYPE_ELSE 28 /* 0x1C multiple Code */ +#define INTERNAL_TYPE_WHILE 29 /* 0x1D Op_code, multiple Code */ +#define INTERNAL_TYPE_SCOPE 30 /* 0x1E Name, multiple Node */ +#define INTERNAL_TYPE_DEF_ANY 31 /* 0x1F type is Any, suppress search of enclosing scopes */ +#define INTERNAL_TYPE_METHOD_ARGUMENT 32 /* 0x20 */ +#define INTERNAL_TYPE_METHOD_LOCAL_VAR 33 /* 0x21 */ -#define INTERNAL_TYPE_MAX 41 +#define INTERNAL_TYPE_MAX 33 -#define INTERNAL_TYPE_INVALID 42 +#define INTERNAL_TYPE_INVALID 34 #define ACPI_TYPE_NOT_FOUND 0xFF /* @@ -375,7 +380,7 @@ { ACPI_OBJECT_TYPE type; u32 length; /* # of bytes in string, excluding trailing null */ - char *pointer; /* points to the string value */ + NATIVE_CHAR *pointer; /* points to the string value */ } string; struct @@ -551,7 +556,8 @@ u32 address, u32 bit_width, u32 *value, - void *context); + void *handler_context, + void *region_context); #define ACPI_DEFAULT_HANDLER ((ADDRESS_SPACE_HANDLER) NULL) @@ -561,7 +567,7 @@ ACPI_HANDLE region_handle, u32 function, void *handler_context, - void **return_context); + void **region_context); #define ACPI_REGION_ACTIVATE 0 #define ACPI_REGION_DEACTIVATE 1 @@ -589,13 +595,11 @@ #define ACPI_COMMON_OBJ_INFO \ - ACPI_OBJECT_TYPE type; /* ACPI object type */\ - ACPI_NAME name; /* ACPI object Name */\ - /*\ - * TBD: [Restructure] Do we want or need these next two??\ - */\ - ACPI_HANDLE parent; /* Parent object */\ - ACPI_HANDLE children; /* Linked list of children */\ + ACPI_OBJECT_TYPE type; /* ACPI object type */ \ + ACPI_NAME name; /* ACPI object Name */ \ + /* TBD: [Restructure] Do we want or need these next two??*/ \ + ACPI_HANDLE parent; /* Parent object */ \ + ACPI_HANDLE children; /* Linked list of children */ \ u32 valid /* ????? */ typedef struct @@ -611,8 +615,8 @@ /* * TBD: [Restructure]: a HID or a _UID can return either a number or a string */ - char hardware_id [9]; /* _HID value if any */ - char unique_id[9]; /* _UID value if any */ + NATIVE_CHAR hardware_id [9]; /* _HID value if any */ + NATIVE_CHAR unique_id[9]; /* _UID value if any */ u32 address; /* _ADR value if any */ u32 current_status; /* _STA value */ } ACPI_DEVICE_INFO; @@ -622,7 +626,6 @@ typedef struct { - void *handler_context; u32 seg; u32 bus; u32 dev_func; @@ -631,11 +634,9 @@ typedef struct { - void *handler_context; - char *mapped_physical_address; - char *mapped_logical_address; + u8 *mapped_physical_address; + u8 *mapped_logical_address; u32 mapped_length; - } MEM_HANDLER_CONTEXT; @@ -858,7 +859,7 @@ u32 address_length; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } ADDRESS16_RESOURCE; @@ -877,7 +878,7 @@ u32 address_length; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } ADDRESS32_RESOURCE; @@ -891,7 +892,7 @@ u32 interrupts[1]; u32 resource_source_index; u32 resource_source_string_length; - u8 resource_source[1]; + NATIVE_CHAR resource_source[1]; } EXTENDED_IRQ_RESOURCE; @@ -951,7 +952,7 @@ u32 address; u32 pin; u32 source_index; - u8 source[1]; + NATIVE_CHAR source[1]; } PRT_ENTRY; @@ -967,4 +968,4 @@ * END: Definitions for PCI Routing tables */ -#endif /* ACTYPES_H */ +#endif /* __ACTYPES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/amlcode.h linux/drivers/acpi/include/amlcode.h --- v2.4.0-test8/linux/drivers/acpi/include/amlcode.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/amlcode.h Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - /****************************************************************************** * * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. + * $Revision: 39 $ * *****************************************************************************/ @@ -108,7 +108,7 @@ #define AML_IF_OP (u16) 0xa0 #define AML_ELSE_OP (u16) 0xa1 #define AML_WHILE_OP (u16) 0xa2 -#define AML_NOOP_CODE (u16) 0xa3 +#define AML_NOOP_OP (u16) 0xa3 #define AML_RETURN_OP (u16) 0xa4 #define AML_BREAK_OP (u16) 0xa5 #define AML_BREAK_POINT_OP (u16) 0xcc @@ -133,9 +133,9 @@ #define AML_WAIT_OP (u16) 0x5b25 #define AML_RESET_OP (u16) 0x5b26 #define AML_RELEASE_OP (u16) 0x5b27 -#define AML_FROM_BCDOP (u16) 0x5b28 -#define AML_TO_BCDOP (u16) 0x5b29 -#define AML_UN_LOAD_OP (u16) 0x5b2a +#define AML_FROM_BCD_OP (u16) 0x5b28 +#define AML_TO_BCD_OP (u16) 0x5b29 +#define AML_UNLOAD_OP (u16) 0x5b2a #define AML_REVISION_OP (u16) 0x5b30 #define AML_DEBUG_OP (u16) 0x5b31 #define AML_FATAL_OP (u16) 0x5b32 @@ -156,7 +156,11 @@ #define AML_LNOTEQUAL_OP (u16) 0x9293 -/* Internal opcodes */ +/* + * Internal opcodes + * Use only "Unknown" AML opcodes, don't attempt to use + * any valid ACPI ASCII values (A-Z, 0-9, '-') + */ #define AML_NAMEPATH_OP (u16) 0x002d #define AML_NAMEDFIELD_OP (u16) 0x0030 @@ -165,29 +169,7 @@ #define AML_BYTELIST_OP (u16) 0x0033 #define AML_STATICSTRING_OP (u16) 0x0034 #define AML_METHODCALL_OP (u16) 0x0035 - - -/* - * argument types - */ - -/* -#define AML_ASCIICHARLIST_ARG 'A' -#define AML_BYTEDATA_ARG 'b' -#define AML_BYTELIST_ARG 'B' -#define AML_DWORDDATA_ARG 'd' -#define AML_DATAOBJECT_ARG 'o' -#define AML_DATAOBJECTLIST_ARG 'O' -#define AML_FIELDLIST_ARG 'F' -#define AML_NAMESTRING_ARG 'n' -#define AML_OBJECTLIST_ARG 'P' -#define AML_PKGLENGTH_ARG 'p' -#define AML_SUPERNAME_ARG 's' -#define AML_TARGET_ARG 'l' -#define AML_TERMARG_ARG 't' -#define AML_TERMLIST_ARG 'T' -#define AML_WORDDATA_ARG 'w' -*/ +#define AML_RETURN_VALUE_OP (u16) 0x0036 #define ARG_NONE 0x0 @@ -229,7 +211,7 @@ #define ARGI_STRING 0x06 #define ARGI_BUFFER 0x07 #define ARGI_PACKAGE 0x08 -#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or NTE reference - Used only by Size_of operator*/ +#define ARGI_DATAOBJECT 0x09 /* Buffer, string, package or reference to a Node - Used only by Size_of operator*/ #define ARGI_COMPLEXOBJ 0x0A /* Buffer or package */ #define ARGI_MUTEX 0x0B #define ARGI_EVENT 0x0C @@ -291,8 +273,9 @@ #define OPTYPE_CONTROL 18 #define OPTYPE_RECONFIGURATION 19 #define OPTYPE_NAMED_OBJECT 20 +#define OPTYPE_RETURN 21 -#define OPTYPE_BOGUS 21 +#define OPTYPE_BOGUS 22 /* Comparison operation codes for Match_op operator */ @@ -375,13 +358,11 @@ extern u8 acpi_gbl_aml [NUM_OPCODES]; extern u16 acpi_gbl_pfx [NUM_OPCODES]; -extern char *acpi_gbl_short_ops [NUM_OPCODES]; -extern char *acpi_gbl_long_ops [NUM_OPCODES]; -extern char *acpi_gbl_region_types [NUM_REGION_TYPES]; -extern char *acpi_gbl_match_ops [NUM_MATCH_OPS]; -extern char *acpi_gbl_access_types [NUM_ACCESS_TYPES]; -extern char *acpi_gbl_update_rules [NUM_UPDATE_RULES]; -extern char *acpi_gbl_FEnames [NUM_FIELD_NAMES]; +extern NATIVE_CHAR *acpi_gbl_region_types [NUM_REGION_TYPES]; +extern NATIVE_CHAR *acpi_gbl_match_ops [NUM_MATCH_OPS]; +extern NATIVE_CHAR *acpi_gbl_access_types [NUM_ACCESS_TYPES]; +extern NATIVE_CHAR *acpi_gbl_update_rules [NUM_UPDATE_RULES]; +extern NATIVE_CHAR *acpi_gbl_FEnames [NUM_FIELD_NAMES]; /* @@ -392,7 +373,7 @@ /* Data used in keeping track of fields */ -char *acpi_gbl_FEnames[NUM_FIELD_NAMES] = +NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] = { "skip", "?access?" @@ -401,7 +382,7 @@ /* Region type decoding */ -char *acpi_gbl_region_types[NUM_REGION_TYPES] = +NATIVE_CHAR *acpi_gbl_region_types[NUM_REGION_TYPES] = { "System_memory", "System_iO", @@ -411,7 +392,7 @@ }; -char *acpi_gbl_match_ops[NUM_MATCH_OPS] = +NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] = { "Error", "MTR", @@ -425,7 +406,7 @@ /* Access type decoding */ -char *acpi_gbl_access_types[NUM_ACCESS_TYPES] = +NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] = { "Any_acc", "Byte_acc", @@ -439,7 +420,7 @@ /* Update rule decoding */ -char *acpi_gbl_update_rules[NUM_UPDATE_RULES] = +NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] = { "Preserve", "Write_as_ones", diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/common.h linux/drivers/acpi/include/common.h --- v2.4.0-test8/linux/drivers/acpi/include/common.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/common.h Wed Dec 31 16:00:00 1969 @@ -1,650 +0,0 @@ - -/****************************************************************************** - * - * Name: common.h -- prototypes for the common (subsystem-wide) procedures - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef _COMMON_H -#define _COMMON_H - - -#define REF_INCREMENT (u16) 0 -#define REF_DECREMENT (u16) 1 -#define REF_FORCE_DELETE (u16) 2 - -/* Acpi_cm_dump_buffer */ - -#define DB_BYTE_DISPLAY 1 -#define DB_WORD_DISPLAY 2 -#define DB_DWORD_DISPLAY 4 -#define DB_QWORD_DISPLAY 8 - - -/* Global initialization interfaces */ - -void -acpi_cm_init_globals ( - ACPI_INIT_DATA *init_data); - -void -acpi_cm_terminate ( - void); - - -/* - * Acpi_cm_init - miscellaneous initialization and shutdown - */ - -ACPI_STATUS -acpi_cm_hardware_initialize ( - void); - -ACPI_STATUS -acpi_cm_subsystem_shutdown ( - void); - -/* - * Acpi_cm_global - Global data structures and procedures - */ - -char * -acpi_cm_get_mutex_name ( - u32 mutex_id); - -char * -acpi_cm_get_type_name ( - u32 type); - -u8 -acpi_cm_valid_object_type ( - u32 type); - -ACPI_OWNER_ID -acpi_cm_allocate_owner_id ( - u32 id_type); - - -/* - * Acpi_cm_clib - Local implementations of C library functions - */ - -ACPI_SIZE -acpi_cm_strlen ( - const char *string); - -char * -acpi_cm_strcpy ( - char *dst_string, - const char *src_string); - -char * -acpi_cm_strncpy ( - char *dst_string, - const char *src_string, - ACPI_SIZE count); - -u32 -acpi_cm_strncmp ( - const char *string1, - const char *string2, - ACPI_SIZE count); - -u32 -acpi_cm_strcmp ( - const char *string1, - const char *string2); - -char * -acpi_cm_strcat ( - char *dst_string, - const char *src_string); - -char * -acpi_cm_strncat ( - char *dst_string, - const char *src_string, - ACPI_SIZE count); - -u32 -acpi_cm_strtoul ( - const char *string, - char **terminator, - s32 base); - -char * -acpi_cm_strstr ( - char *string1, - char *string2); - -char * -acpi_cm_strupr ( - char *src_string); - -void * -acpi_cm_memcpy ( - void *dest, - const void *src, - ACPI_SIZE count); - -void * -acpi_cm_memset ( - void *dest, - s32 value, - ACPI_SIZE count); - -s32 -acpi_cm_to_upper ( - s32 c); - -s32 -acpi_cm_to_lower ( - s32 c); - - -/* - * Acpi_cm_copy - Object construction and conversion interfaces - */ - -ACPI_STATUS -acpi_cm_build_simple_object( - ACPI_OBJECT_INTERNAL *obj, - ACPI_OBJECT *user_obj, - char *data_space, - u32 *buffer_space_used); - -ACPI_STATUS -acpi_cm_build_package_object ( - ACPI_OBJECT_INTERNAL *obj, - char *buffer, - u32 *space_used); - -ACPI_STATUS -acpi_cm_build_external_object ( - ACPI_OBJECT_INTERNAL *obj, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_cm_build_internal_simple_object( - ACPI_OBJECT *user_obj, - ACPI_OBJECT_INTERNAL *obj); - -ACPI_STATUS -acpi_cm_build_internal_object ( - ACPI_OBJECT *obj, - ACPI_OBJECT_INTERNAL *internal_obj); - -ACPI_STATUS -acpi_cm_copy_internal_simple_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - -ACPI_STATUS -acpi_cm_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - - -/* - * Acpi_cm_create - Object creation - */ - -ACPI_STATUS -acpi_cm_update_object_reference ( - ACPI_OBJECT_INTERNAL *object, - u16 action); - -ACPI_OBJECT_INTERNAL * -_cm_create_internal_object ( - char *module_name, - s32 line_number, - s32 component_id, - OBJECT_TYPE_INTERNAL type); - - -/* - * Acpi_cm_debug - Debug interfaces - */ - -s32 -get_debug_level ( - void); - -void -set_debug_level ( - s32 level); - -void -function_trace ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name); - -void -function_trace_ptr ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - void *pointer); - -void -function_trace_u32 ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - u32 integer); - -void -function_trace_str ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - char *string); - -void -function_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name); - -void -function_status_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - ACPI_STATUS status); - -void -function_value_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - NATIVE_UINT value); - -void -function_ptr_exit ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING function_name, - char *ptr); - -void -debug_print_prefix ( - ACPI_STRING module_name, - s32 line_number); - -void -debug_print ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - s32 print_level, - char *format, ...); - -void -debug_print_raw ( - char *format, ...); - -void -_report_info ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_error ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_warning ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -_report_success ( - ACPI_STRING module_name, - s32 line_number, - s32 component_id, - ACPI_STRING message); - -void -acpi_cm_dump_buffer ( - char *buffer, - u32 count, - u32 display, - s32 component_id); - - -/* - * Acpi_cm_delete - Object deletion - */ - -void -acpi_cm_delete_internal_obj ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_delete_internal_package_object ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_delete_internal_simple_object ( - ACPI_OBJECT_INTERNAL *object); - -ACPI_STATUS -acpi_cm_delete_internal_object_list ( - ACPI_OBJECT_INTERNAL **obj_list); - - -/* - * Acpi_cm_eval - object evaluation - */ - -/* Method name strings */ - -#define METHOD_NAME__HID "_HID" -#define METHOD_NAME__UID "_UID" -#define METHOD_NAME__ADR "_ADR" -#define METHOD_NAME__STA "_STA" -#define METHOD_NAME__REG "_REG" -#define METHOD_NAME__SEG "_SEG" -#define METHOD_NAME__BBN "_BBN" - - -ACPI_STATUS -acpi_cm_evaluate_numeric_object ( - char *method_name, - ACPI_NAMED_OBJECT *acpi_device, - u32 *address); - -ACPI_STATUS -acpi_cm_execute_HID ( - ACPI_NAMED_OBJECT *acpi_device, - DEVICE_ID *hid); - -ACPI_STATUS -acpi_cm_execute_STA ( - ACPI_NAMED_OBJECT *acpi_device, - u32 *status_flags); - -ACPI_STATUS -acpi_cm_execute_UID ( - ACPI_NAMED_OBJECT *acpi_device, - DEVICE_ID *uid); - - -/* - * Acpi_cm_error - exception interfaces - */ - -char * -acpi_cm_format_exception ( - ACPI_STATUS status); - - -/* - * Acpi_cm_mutex - mutual exclusion interfaces - */ - -ACPI_STATUS -acpi_cm_mutex_initialize ( - void); - -void -acpi_cm_mutex_terminate ( - void); - -ACPI_STATUS -acpi_cm_create_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_delete_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_acquire_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - -ACPI_STATUS -acpi_cm_release_mutex ( - ACPI_MUTEX_HANDLE mutex_id); - - -/* - * Acpi_cm_object - internal object create/delete/cache routines - */ - -#define acpi_cm_create_internal_object(t) _cm_create_internal_object(_THIS_MODULE,__LINE__,_COMPONENT,t) -#define acpi_cm_allocate_object_desc() _cm_allocate_object_desc(_THIS_MODULE,__LINE__,_COMPONENT) - -void * -_cm_allocate_object_desc ( - char *module_name, - s32 line_number, - s32 component_id); - -void -acpi_cm_delete_object_desc ( - ACPI_OBJECT_INTERNAL *object); - -u8 -acpi_cm_valid_internal_object ( - void *object); - - -/* - * Acpi_cm_ref_cnt - Object reference count management - */ - -void -acpi_cm_add_reference ( - ACPI_OBJECT_INTERNAL *object); - -void -acpi_cm_remove_reference ( - ACPI_OBJECT_INTERNAL *object); - -/* - * Acpi_cm_size - Object size routines - */ - -ACPI_STATUS -acpi_cm_get_simple_object_size ( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - -ACPI_STATUS -acpi_cm_get_package_object_size ( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - -ACPI_STATUS -acpi_cm_get_object_size( - ACPI_OBJECT_INTERNAL *obj, - u32 *obj_length); - - -/* - * Acpi_cm_state - Generic state creation/cache routines - */ - -void -acpi_cm_push_generic_state ( - ACPI_GENERIC_STATE **list_head, - ACPI_GENERIC_STATE *state); - -ACPI_GENERIC_STATE * -acpi_cm_pop_generic_state ( - ACPI_GENERIC_STATE **list_head); - - -ACPI_GENERIC_STATE * -acpi_cm_create_generic_state ( - void); - -ACPI_GENERIC_STATE * -acpi_cm_create_update_state ( - ACPI_OBJECT_INTERNAL *object, - u16 action); - -ACPI_STATUS -acpi_cm_create_update_state_and_push ( - ACPI_OBJECT_INTERNAL *object, - u16 action, - ACPI_GENERIC_STATE **state_list); - -ACPI_GENERIC_STATE * -acpi_cm_create_control_state ( - void); - -void -acpi_cm_delete_generic_state ( - ACPI_GENERIC_STATE *state); - -void -acpi_cm_delete_generic_state_cache ( - void); - -void -acpi_cm_delete_object_cache ( - void); - -/* - * Acpi_cmutils - */ - -u8 -acpi_cm_valid_acpi_name ( - u32 name); - -u8 -acpi_cm_valid_acpi_character ( - char character); - - -/* - * Memory allocation functions and related macros. - * Macros that expand to include filename and line number - */ - -void * -_cm_allocate ( - u32 size, - u32 component, - ACPI_STRING module, - s32 line); - -void * -_cm_callocate ( - u32 size, - u32 component, - ACPI_STRING module, - s32 line); - -void -_cm_free ( - void *address, - u32 component, - ACPI_STRING module, - s32 line); - -void -acpi_cm_init_static_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - -#define acpi_cm_allocate(a) _cm_allocate(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define acpi_cm_callocate(a) _cm_callocate(a, _COMPONENT,_THIS_MODULE,__LINE__) -#define acpi_cm_free(a) _cm_free(a,_COMPONENT,_THIS_MODULE,__LINE__) - -#ifndef ACPI_DEBUG - -#define acpi_cm_add_element_to_alloc_list(a,b,c,d,e,f) -#define acpi_cm_delete_element_from_alloc_list(a,b,c,d) -#define acpi_cm_dump_current_allocations(a,b) -#define acpi_cm_dump_allocation_info() - -#define DECREMENT_OBJECT_METRICS(a) -#define INCREMENT_OBJECT_METRICS(a) -#define INITIALIZE_ALLOCATION_METRICS() - -#else - -#define INITIALIZE_ALLOCATION_METRICS() \ - acpi_gbl_current_object_count = 0; \ - acpi_gbl_current_object_size = 0; \ - acpi_gbl_running_object_count = 0; \ - acpi_gbl_running_object_size = 0; \ - acpi_gbl_max_concurrent_object_count = 0; \ - acpi_gbl_max_concurrent_object_size = 0; \ - acpi_gbl_current_alloc_size = 0; \ - acpi_gbl_current_alloc_count = 0; \ - acpi_gbl_running_alloc_size = 0; \ - acpi_gbl_running_alloc_count = 0; \ - acpi_gbl_max_concurrent_alloc_size = 0; \ - acpi_gbl_max_concurrent_alloc_count = 0 - -#define DECREMENT_OBJECT_METRICS(a) \ - acpi_gbl_current_object_count--; \ - acpi_gbl_current_object_size -= a - -#define INCREMENT_OBJECT_METRICS(a) \ - acpi_gbl_current_object_count++; \ - acpi_gbl_running_object_count++; \ - if (acpi_gbl_max_concurrent_object_count < acpi_gbl_current_object_count) \ - { \ - acpi_gbl_max_concurrent_object_count = acpi_gbl_current_object_count; \ - } \ - acpi_gbl_running_object_size += a; \ - acpi_gbl_current_object_size += a; \ - if (acpi_gbl_max_concurrent_object_size < acpi_gbl_current_object_size) \ - { \ - acpi_gbl_max_concurrent_object_size = acpi_gbl_current_object_size; \ - } - - -void -acpi_cm_dump_allocation_info ( - void); - -void -acpi_cm_dump_current_allocations ( - u32 component, - ACPI_STRING module); - -#endif - - -#endif /* _COMMON_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/config.h linux/drivers/acpi/include/config.h --- v2.4.0-test8/linux/drivers/acpi/include/config.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/config.h Wed Dec 31 16:00:00 1969 @@ -1,185 +0,0 @@ - -/****************************************************************************** - * - * Name: config.h - Global configuration constants - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef _CONFIG_H -#define _CONFIG_H - - -/****************************************************************************** - * - * Compile-time options - * - *****************************************************************************/ - -/* - * ACPI_DEBUG - This switch enables all the debug facilities of the ACPI - * subsystem. This includes the DEBUG_PRINT output statements - * When disabled, all DEBUG_PRINT statements are compiled out. - * - * ACPI_APPLICATION - Use this switch if the subsystem is going to be run - * at the application level. - * - */ - - -/****************************************************************************** - * - * Subsystem Constants - * - *****************************************************************************/ - - -/* Version string */ - -#define ACPI_CA_VERSION __DATE__ - -/* Name of host operating system (returned by the _OS_ namespace object) */ - -#ifdef _LINUX -#define ACPI_OS_NAME "Linux" -#else -#define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" -#endif - - -/* - * How and when control methods will be parsed - * The default action is to parse all methods at table load time to verify them, but delete the parse trees - * to conserve memory. Methods are parsed just in time before execution and the parse tree is deleted - * when execution completes. - */ -#define METHOD_PARSE_AT_INIT 0x0 /* Parse at table init, never delete the method parse tree */ -#define METHOD_PARSE_JUST_IN_TIME 0x1 /* Parse only when a method is invoked */ -#define METHOD_DELETE_AT_COMPLETION 0x2 /* Delete parse tree on method completion */ - -/* Default parsing configuration */ - -#define METHOD_PARSE_CONFIGURATION (METHOD_PARSE_JUST_IN_TIME | METHOD_DELETE_AT_COMPLETION) - - -/* Maximum objects in the various object caches */ - -#define MAX_STATE_CACHE_DEPTH 24 /* State objects for stacks */ -#define MAX_PARSE_CACHE_DEPTH 512 /* Parse tree objects */ -#define MAX_OBJECT_CACHE_DEPTH 32 /* Interpreter operand objects */ -#define MAX_WALK_CACHE_DEPTH 2 /* Objects for parse tree walks (method execution) */ - -/* - * Name_space Table size - * - * All tables are the same size to simplify the implementation. - * Tables may be extended by allocating additional tables that - * are in turn linked together to form a chain of tables. - */ - -#define NS_TABLE_SIZE 16 - -/* String size constants */ - -#define MAX_STRING_LENGTH 512 -#define PATHNAME_MAX 256 /* A full namespace pathname */ - - -/* Maximum count for a semaphore object */ - -#define MAX_SEMAPHORE_COUNT 256 - - -/* Max reference count (for debug only) */ - -#define MAX_REFERENCE_COUNT 0x200 - - -/* Size of cached memory mapping for system memory operation region */ - -#define SYSMEM_REGION_WINDOW_SIZE 4096 - - -/* - * Debugger threading model - * Use single threaded if the entire subsystem is contained in an application - * Use multiple threaded when the the subsystem is running in the kernel. - * - * By default the model is single threaded if ACPI_APPLICATION is set, - * multi-threaded if ACPI_APPLICATION is not set. - */ - -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - -#ifdef ACPI_APPLICATION -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED - -#else -#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED -#endif - - -/****************************************************************************** - * - * ACPI Specification constants (Do not change unless the specification changes) - * - *****************************************************************************/ - -/* - * Method info (in WALK_STATE), containing local variables and argumetns - */ - -#define MTH_NUM_LOCALS 8 -#define MTH_MAX_LOCAL 7 - -#define MTH_NUM_ARGS 7 -#define MTH_MAX_ARG 6 - -/* - * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG - */ - -#define OBJ_NUM_OPERANDS 8 -#define OBJ_MAX_OPERAND 7 - -/* Names within the namespace are 4 bytes long */ - -#define ACPI_NAME_SIZE 4 -#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ -#define PATH_SEPARATOR '.' - - -/* Constants used in searching for the RSDP in low memory */ - -#define LO_RSDP_WINDOW_BASE (void *) 0 -#define HI_RSDP_WINDOW_BASE (void *) 0xE0000 -#define LO_RSDP_WINDOW_SIZE 0x400 -#define HI_RSDP_WINDOW_SIZE 0x20000 -#define RSDP_SCAN_STEP 16 - - -/* Maximum nesting of package objects */ - -#define MAX_PACKAGE_DEPTH 16 - - -#endif /* _CONFIG_H */ - diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/debugger.h linux/drivers/acpi/include/debugger.h --- v2.4.0-test8/linux/drivers/acpi/include/debugger.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/debugger.h Wed Dec 31 16:00:00 1969 @@ -1,394 +0,0 @@ - -/****************************************************************************** - * - * Name: debugger.h - ACPI/AML debugger - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __DEBUGGER_H__ -#define __DEBUGGER_H__ - - -#define DB_MAX_ARGS 8 /* Must be max method args + 1 */ - -#define DB_COMMAND_PROMPT '-' -#define DB_EXECUTE_PROMPT '%' - - -extern int optind; -extern char *optarg; -extern u8 *aml_ptr; -extern u32 acpi_aml_length; - -extern u8 opt_tables; -extern u8 opt_disasm; -extern u8 opt_stats; -extern u8 opt_parse_jit; -extern u8 opt_verbose; - - -extern char *args[DB_MAX_ARGS]; -extern char line_buf[80]; -extern char scope_buf[40]; -extern char debug_filename[40]; -extern u8 output_to_file; -extern char *buffer; -extern char *filename; -extern char *INDENT_STRING; -extern u32 acpi_gbl_method_breakpoint; -extern u8 acpi_gbl_db_output_flags; -extern u32 acpi_gbl_db_debug_level; -extern u32 acpi_gbl_db_console_debug_level; - -extern u32 num_names; -extern u32 num_methods; -extern u32 num_regions; -extern u32 num_packages; -extern u32 num_aliases; -extern u32 num_devices; -extern u32 num_field_defs; -extern u32 num_thermal_zones; -extern u32 num_named_objects; -extern u32 num_grammar_elements; -extern u32 num_method_elements ; -extern u32 num_mutexes; -extern u32 num_power_resources; -extern u32 num_bank_fields ; -extern u32 num_index_fields; -extern u32 num_events; - -extern u32 size_of_parse_tree; -extern u32 size_of_method_trees; -extern u32 size_of_nTes; -extern u32 size_of_acpi_objects; - - -#define BUFFER_SIZE 4196 - -#define DB_REDIRECTABLE_OUTPUT 0x01 -#define DB_CONSOLE_OUTPUT 0x02 -#define DB_DUPLICATE_OUTPUT 0x03 - - -typedef struct command_info -{ - char *name; /* Command Name */ - char min_args; /* Minimum arguments required */ - -} COMMAND_INFO; - - -typedef struct argument_info -{ - char *name; /* Argument Name */ - -} ARGUMENT_INFO; - - -#define PARAM_LIST(pl) pl - -#define DBTEST_OUTPUT_LEVEL(lvl) if (opt_verbose) - -#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ - acpi_os_printf PARAM_LIST(fp);} - -#define EX_NO_SINGLE_STEP 1 -#define EX_SINGLE_STEP 2 - - -/* Prototypes */ - - -/* - * dbapi - external debugger interfaces - */ - -int -acpi_db_initialize ( - void); - -ACPI_STATUS -acpi_db_single_step ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - u8 op_type); - - -/* - * dbcmds - debug commands and output routines - */ - - -void -acpi_db_display_table_info ( - char *table_arg); - -void -acpi_db_unload_acpi_table ( - char *table_arg, - char *instance_arg); - -void -acpi_db_set_method_breakpoint ( - char *location, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -void -acpi_db_set_method_call_breakpoint ( - ACPI_GENERIC_OP *op); - -void -acpi_db_disassemble_aml ( - char *statements, - ACPI_GENERIC_OP *op); - -void -acpi_db_dump_namespace ( - char *start_arg, - char *depth_arg); - -void -acpi_db_dump_namespace_by_owner ( - char *owner_arg, - char *depth_arg); - -void -acpi_db_send_notify ( - char *name, - u32 value); - -void -acpi_db_set_method_data ( - char *type_arg, - char *index_arg, - char *value_arg); - -ACPI_STATUS -acpi_db_display_objects ( - char *obj_type_arg, - char *display_count_arg); - -ACPI_STATUS -acpi_db_find_name_in_namespace ( - char *name_arg); - -void -acpi_db_set_scope ( - char *name); - -void -acpi_db_find_references ( - char *object_arg); - - -/* - * dbdisasm - AML disassembler - */ - -void -acpi_db_display_op ( - ACPI_GENERIC_OP *origin, - u32 num_opcodes); - -void -acpi_db_display_namestring ( - char *name); - -void -acpi_db_display_path ( - ACPI_GENERIC_OP *op); - -void -acpi_db_display_opcode ( - ACPI_GENERIC_OP *op); - - -/* - * dbdisply - debug display commands - */ - - -void -acpi_db_display_method_info ( - ACPI_GENERIC_OP *op); - -void -acpi_db_decode_and_display_object ( - char *target, - char *output_type); - -void -acpi_db_display_result_object ( - ACPI_OBJECT_INTERNAL *ret_desc); - -ACPI_STATUS -acpi_db_display_all_methods ( - char *display_count_arg); - -void -acpi_db_display_internal_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - -void -acpi_db_display_arguments ( - void); - -void -acpi_db_display_locals ( - void); - -void -acpi_db_display_results ( - void); - -void -acpi_db_display_calling_tree ( - void); - -void -acpi_db_display_argument_object ( - ACPI_OBJECT_INTERNAL *obj_desc); - - -/* - * dbexec - debugger control method execution - */ - -void -acpi_db_execute ( - char *name, - char **args, - u32 flags); - -void -acpi_db_create_execution_threads ( - char *num_threads_arg, - char *num_loops_arg, - char *method_name_arg); - - -/* - * dbfileio - Debugger file I/O commands - */ - -OBJECT_TYPE_INTERNAL -acpi_db_match_argument ( - char *user_argument, - ARGUMENT_INFO *arguments); - - -void -acpi_db_close_debug_file ( - void); - -void -acpi_db_open_debug_file ( - char *name); - -ACPI_STATUS -acpi_db_load_acpi_table ( - char *filename); - - -/* - * dbhistry - debugger HISTORY command - */ - -void -acpi_db_add_to_history ( - char *command_line); - -void -acpi_db_display_history (void); - -char * -acpi_db_get_from_history ( - char *command_num_arg); - - -/* - * dbinput - user front-end to the AML debugger - */ - -ACPI_STATUS -acpi_db_command_dispatch ( - char *input_buffer, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -void -acpi_db_execute_thread ( - void *context); - -ACPI_STATUS -acpi_db_user_commands ( - char prompt, - ACPI_GENERIC_OP *op); - - -/* - * dbstats - Generation and display of ACPI table statistics - */ - -void -acpi_db_generate_statistics ( - ACPI_GENERIC_OP *root, - u8 is_method); - - -ACPI_STATUS -acpi_db_display_statistics ( - char *type_arg); - - -/* - * dbutils - AML debugger utilities - */ - -void -acpi_db_set_output_destination ( - s32 where); - -void -acpi_db_dump_buffer ( - u32 address); - -void -acpi_db_dump_object ( - ACPI_OBJECT *obj_desc, - u32 level); - -void -acpi_db_prep_namestring ( - char *name); - - -ACPI_STATUS -acpi_db_second_pass_parse ( - ACPI_GENERIC_OP *root); - -ACPI_NAMED_OBJECT* -acpi_db_local_ns_lookup ( - char *name); - - -#endif /* __DEBUGGER_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/dispatch.h linux/drivers/acpi/include/dispatch.h --- v2.4.0-test8/linux/drivers/acpi/include/dispatch.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/dispatch.h Wed Dec 31 16:00:00 1969 @@ -1,383 +0,0 @@ -/****************************************************************************** - * - * Module Name: dispatch.h - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - - -#ifndef _DISPATCH_H_ -#define _DISPATCH_H_ - - -#define NAMEOF_LOCAL_NTE "__L0" -#define NAMEOF_ARG_NTE "__A0" - - -/* For Acpi_ds_method_data_set_value */ - -#define MTH_TYPE_LOCAL 0 -#define MTH_TYPE_ARG 1 - - -/* Common interfaces */ - -ACPI_STATUS -acpi_ds_obj_stack_push ( - void *object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop ( - u32 pop_count, - ACPI_WALK_STATE *walk_state); - -void * -acpi_ds_obj_stack_get_value ( - u32 index, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop_object ( - ACPI_OBJECT_INTERNAL **object, - ACPI_WALK_STATE *walk_state); - - -/* dsregion - Op region support */ - -ACPI_STATUS -acpi_ds_get_region_arguments ( - ACPI_OBJECT_INTERNAL *rgn_desc); - - -/* dsctrl - Parser/Interpreter interface, control stack routines */ - -/* -ACPI_CTRL_STATE * -Acpi_ds_create_control_state (void); - -void -Acpi_ds_push_control_state ( - ACPI_CTRL_STATE *Control_state, - ACPI_WALK_STATE *Walk_state); - -ACPI_CTRL_STATE * -Acpi_ds_pop_control_state ( - ACPI_WALK_STATE *Walk_state); -*/ - -ACPI_STATUS -acpi_ds_exec_begin_control_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_exec_end_control_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - - -/* dsexec - Parser/Interpreter interface, method execution callbacks */ - -ACPI_STATUS -acpi_ds_exec_begin_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_exec_end_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* dsfield - Parser/Interpreter interface for AML fields */ - - -ACPI_STATUS -acpi_ds_create_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_bank_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_index_field ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE region, - ACPI_WALK_STATE *walk_state); - - -/* dsload - Parser/Interpreter interface, namespace load callbacks */ - -ACPI_STATUS -acpi_ds_load1_begin_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load1_end_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load2_begin_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_load2_end_op ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* dsmthdat - method data (locals/args) */ - - -ACPI_STATUS -acpi_ds_method_data_delete_all ( - ACPI_WALK_STATE *walk_state); - -u8 -acpi_ds_is_method_value ( - ACPI_OBJECT_INTERNAL *obj_desc); - -OBJECT_TYPE_INTERNAL -acpi_ds_method_data_get_type ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_get_value ( - u32 type, - u32 index, - ACPI_OBJECT_INTERNAL **obj_desc); - -ACPI_STATUS -acpi_ds_method_data_set_value ( - u32 type, - u32 index, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_ds_method_data_delete_value ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_init_args ( - ACPI_OBJECT_INTERNAL **params, - u32 param_count); - -ACPI_NAMED_OBJECT* -acpi_ds_method_data_get_nte ( - u32 type, - u32 index); - -ACPI_STATUS -acpi_ds_method_data_init ( - ACPI_WALK_STATE *walk_state); - - -/* dsmethod - Parser/Interpreter interface - control method parsing */ - -ACPI_STATUS -acpi_ds_parse_method ( - ACPI_HANDLE obj_handle); - -ACPI_STATUS -acpi_ds_call_control_method ( - ACPI_WALK_LIST *walk_list, - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_restart_control_method ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL *return_desc); - -ACPI_STATUS -acpi_ds_terminate_control_method ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_begin_method_execution ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL *obj_desc); - - -/* dsobj - Parser/Interpreter interface - object initialization and conversion */ - -ACPI_STATUS -acpi_ds_init_one_object ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -ACPI_STATUS -acpi_ds_initialize_objects ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *start_entry); - -ACPI_STATUS -acpi_ds_build_internal_package_obj ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc); - -ACPI_STATUS -acpi_ds_build_internal_object ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL **obj_desc_ptr); - -ACPI_STATUS -acpi_ds_init_object_from_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - u16 opcode, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_ds_create_named_object ( - ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT *entry, - ACPI_GENERIC_OP *op); - - -/* dsregn - Parser/Interpreter interface - Op Region parsing */ - -ACPI_STATUS -acpi_ds_eval_region_operands ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op); - -ACPI_STATUS -acpi_ds_initialize_region ( - ACPI_HANDLE obj_handle); - - -/* dsutils - Parser/Interpreter interface utility routines */ - -void -acpi_ds_delete_result_if_not_used ( - ACPI_GENERIC_OP *op, - ACPI_OBJECT_INTERNAL *result_obj, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_create_operand ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *arg); - -ACPI_STATUS -acpi_ds_create_operands ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *first_arg); - -ACPI_STATUS -acpi_ds_resolve_operands ( - ACPI_WALK_STATE *walk_state); - -OBJECT_TYPE_INTERNAL -acpi_ds_map_opcode_to_data_type ( - u16 opcode, - u32 *out_flags); - -OBJECT_TYPE_INTERNAL -acpi_ds_map_named_opcode_to_data_type ( - u16 opcode); - - -/* - * dswscope - Scope Stack manipulation - */ - -ACPI_STATUS -acpi_ds_scope_stack_push ( - ACPI_NAME_TABLE *new_scope, - OBJECT_TYPE_INTERNAL type, - ACPI_WALK_STATE *walk_state); - - -ACPI_STATUS -acpi_ds_scope_stack_pop ( - ACPI_WALK_STATE *walk_state); - -void -acpi_ds_scope_stack_clear ( - ACPI_WALK_STATE *walk_state); - - -/* Acpi_dswstate - parser WALK_STATE management routines */ - -ACPI_WALK_STATE * -acpi_ds_create_walk_state ( - ACPI_OWNER_ID owner_id, - ACPI_GENERIC_OP *origin, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_WALK_LIST *walk_list); - -ACPI_STATUS -acpi_ds_obj_stack_delete_all ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_obj_stack_pop_and_delete ( - u32 pop_count, - ACPI_WALK_STATE *walk_state); - -void -acpi_ds_delete_walk_state ( - ACPI_WALK_STATE *walk_state); - -ACPI_WALK_STATE * -acpi_ds_pop_walk_state ( - ACPI_WALK_LIST *walk_list); - -ACPI_STATUS -acpi_ds_result_stack_pop ( - ACPI_OBJECT_INTERNAL **object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_result_stack_push ( - void *object, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ds_result_stack_clear ( - ACPI_WALK_STATE *walk_state); - -ACPI_WALK_STATE * -acpi_ds_get_current_walk_state ( - ACPI_WALK_LIST *walk_list); - -void -acpi_ds_delete_walk_state_cache ( - void); - - -#endif /* _DISPATCH_H_ */ \ No newline at end of file diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/events.h linux/drivers/acpi/include/events.h --- v2.4.0-test8/linux/drivers/acpi/include/events.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/events.h Wed Dec 31 16:00:00 1969 @@ -1,209 +0,0 @@ - -/****************************************************************************** - * - * Name: events.h - Acpi_event subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __EVENTS_H__ -#define __EVENTS_H__ - - -/* - * Acpi_evfixed - Fixed event handling - */ - -ACPI_STATUS -acpi_ev_fixed_event_initialize ( - void); - -u32 -acpi_ev_fixed_event_detect ( - void); - -u32 -acpi_ev_fixed_event_dispatch ( - u32 acpi_event); - - -/* - * Acpi_evglock - Global Lock support - */ - -ACPI_STATUS -acpi_ev_acquire_global_lock( - void); - -void -acpi_ev_release_global_lock( - void); - -ACPI_STATUS -acpi_ev_init_global_lock_handler ( - void); - - -/* - * Acpi_evgpe - GPE handling and dispatch - */ - -ACPI_STATUS -acpi_ev_gpe_initialize ( - void); - -ACPI_STATUS -acpi_ev_init_gpe_control_methods ( - void); - -u32 -acpi_ev_gpe_dispatch ( - u32 gpe_number); - -u32 -acpi_ev_gpe_detect ( - void); - - -/* - * Acpi_evnotify - Device Notify handling and dispatch - */ - -void -acpi_ev_notify_dispatch ( - ACPI_HANDLE device, - u32 notify_value); - - -/* - * Acpi_evregion - Address Space handling - */ - -ACPI_STATUS -acpi_ev_install_default_address_space_handlers ( - void); - -ACPI_STATUS -acpi_ev_address_space_dispatch ( - ACPI_OBJECT_INTERNAL *region_obj, - u32 function, - u32 address, - u32 bit_width, - u32 *value); - - -ACPI_STATUS -acpi_ev_addr_handler_helper ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -void -acpi_ev_disassociate_region_from_handler( - ACPI_OBJECT_INTERNAL *region_obj); - - -ACPI_STATUS -acpi_ev_associate_region_and_handler( - ACPI_OBJECT_INTERNAL *handler_obj, - ACPI_OBJECT_INTERNAL *region_obj); - - -/* - * Acpi_evregini - Region initialization and setup - */ - -ACPI_STATUS -acpi_ev_system_memory_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_io_space_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_pci_config_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_default_region_setup ( - ACPI_HANDLE handle, - u32 function, - void *handler_context, - void **return_context); - -ACPI_STATUS -acpi_ev_initialize_region ( - ACPI_OBJECT_INTERNAL *region_obj, - u8 acpi_ns_locked); - - -/* - * Acpi_evsci - SCI (System Control Interrupt) handling/dispatch - */ - -u32 -acpi_ev_install_sci_handler ( - void); - -ACPI_STATUS -acpi_ev_remove_sci_handler ( - void); - -s32 -acpi_ev_initialize_sCI ( - s32 program_sCI); - -void -acpi_ev_restore_acpi_state ( - void); - -void -acpi_ev_terminate ( - void); - - -/* Debug support */ - -#ifdef ACPI_DEBUG - -s32 -acpi_ev_sci_count ( - u32 acpi_event); - -#define DEBUG_INCREMENT_EVENT_COUNT(a) acpi_gbl_event_count[a]++; - -#else - -#define DEBUG_INCREMENT_EVENT_COUNT(a) -#endif - - -#endif /* __EVENTS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/globals.h linux/drivers/acpi/include/globals.h --- v2.4.0-test8/linux/drivers/acpi/include/globals.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/globals.h Wed Dec 31 16:00:00 1969 @@ -1,311 +0,0 @@ - -/****************************************************************************** - * - * Name: globals.h - Declarations for global variables - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __GLOBALS_H__ -#define __GLOBALS_H__ - - -/* - * Ensure that the globals are actually defined only once - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_EXTERN -#else -#define ACPI_EXTERN extern -#endif - - -extern char *msg_acpi_error_break; - -/***************************************************************************** - * - * Debug support - * - ****************************************************************************/ - -/* Runtime configuration of debug print levels */ - -extern u32 acpi_dbg_level; -extern u32 acpi_dbg_layer; - - -/* Procedure nesting level for debug output */ - -extern u32 acpi_gbl_nesting_level; - - -/***************************************************************************** - * - * ACPI Table globals - * - ****************************************************************************/ - -/* - * Table pointers. - * Although these pointers are somewhat redundant with the global Acpi_table, - * they are convenient because they are typed pointers. - * - * These tables are single-table only; meaning that there can be at most one - * of each in the system. Each global points to the actual table. - * - */ -ACPI_EXTERN ROOT_SYSTEM_DESCRIPTOR_POINTER *acpi_gbl_RSDP; -ACPI_EXTERN ROOT_SYSTEM_DESCRIPTION_TABLE *acpi_gbl_RSDT; -ACPI_EXTERN FIRMWARE_ACPI_CONTROL_STRUCTURE *acpi_gbl_FACS; -ACPI_EXTERN FIXED_ACPI_DESCRIPTION_TABLE *acpi_gbl_FACP; -ACPI_EXTERN APIC_TABLE *acpi_gbl_APIC; -ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_DSDT; -ACPI_EXTERN ACPI_TABLE_HEADER *acpi_gbl_SBST; -/* - * Since there may be multiple SSDTs and PSDTS, a single pointer is not - * sufficient; Therefore, there isn't one! - */ - - -/* - * ACPI Table info arrays - */ -extern ACPI_TABLE_DESC acpi_gbl_acpi_tables[NUM_ACPI_TABLES]; -extern ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES]; - -/* - * Predefined mutex objects. This array contains the - * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. - * (The table maps local handles to the real OS handles) - */ -ACPI_EXTERN ACPI_MUTEX_INFO acpi_gbl_acpi_mutex_info [NUM_MTX]; -extern ACPI_INIT_DATA acpi_gbl_acpi_init_data; - - -/***************************************************************************** - * - * Miscellaneous globals - * - ****************************************************************************/ - - -ACPI_EXTERN u8 *acpi_gbl_gpe0enable_register_save; -ACPI_EXTERN u8 *acpi_gbl_gpe1_enable_register_save; -ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_breakpoint_walk; -ACPI_EXTERN ACPI_GENERIC_STATE *acpi_gbl_generic_state_cache; -ACPI_EXTERN ACPI_GENERIC_OP *acpi_gbl_parse_cache; -ACPI_EXTERN ACPI_OBJECT_INTERNAL *acpi_gbl_object_cache; -ACPI_EXTERN ACPI_WALK_STATE *acpi_gbl_walk_state_cache; -ACPI_EXTERN ACPI_HANDLE acpi_gbl_global_lock_semaphore; - - -ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count; -ACPI_EXTERN u32 acpi_gbl_restore_acpi_chipset; -ACPI_EXTERN u32 acpi_gbl_original_mode; -ACPI_EXTERN u32 acpi_gbl_edge_level_save; -ACPI_EXTERN u32 acpi_gbl_irq_enable_save; -ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; - -ACPI_EXTERN u32 acpi_gbl_state_cache_requests; -ACPI_EXTERN u32 acpi_gbl_state_cache_hits; -ACPI_EXTERN u32 acpi_gbl_parse_cache_requests; -ACPI_EXTERN u32 acpi_gbl_parse_cache_hits; -ACPI_EXTERN u32 acpi_gbl_object_cache_requests; -ACPI_EXTERN u32 acpi_gbl_object_cache_hits; -ACPI_EXTERN u32 acpi_gbl_walk_state_cache_requests; -ACPI_EXTERN u32 acpi_gbl_walk_state_cache_hits; -ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; -ACPI_EXTERN u32 acpi_gbl_ps_find_count; - - -ACPI_EXTERN u16 acpi_gbl_generic_state_cache_depth; -ACPI_EXTERN u16 acpi_gbl_parse_cache_depth; -ACPI_EXTERN u16 acpi_gbl_object_cache_depth; -ACPI_EXTERN u16 acpi_gbl_walk_state_cache_depth; -ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; -ACPI_EXTERN u16 acpi_gbl_next_table_owner_id; -ACPI_EXTERN u16 acpi_gbl_next_method_owner_id; - -ACPI_EXTERN u8 acpi_gbl_debugger_configuration; -ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; -ACPI_EXTERN u8 acpi_gbl_global_lock_set; /* TBD: [Restructure] OBSOLETE?? */ -ACPI_EXTERN u8 acpi_gbl_step_to_next_call; -ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; - - -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_drv_notify; -ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER acpi_gbl_sys_notify; - - -extern u8 acpi_gbl_shutdown; -extern u32 acpi_gbl_system_flags; -extern u32 acpi_gbl_startup_flags; - - -/***************************************************************************** - * - * Namespace globals - * - ****************************************************************************/ - -#define NUM_NS_TYPES INTERNAL_TYPE_INVALID+1 -#define NUM_PREDEFINED_NAMES 9 - - -ACPI_EXTERN ACPI_NAME_TABLE acpi_gbl_root_name_table; -ACPI_EXTERN ACPI_NAMED_OBJECT *acpi_gbl_root_object; - -extern u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; -extern PREDEFINED_NAMES acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES]; - - -/* Used to detect memory leaks (DEBUG ONLY) */ - -#ifdef ACPI_DEBUG -ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_head_alloc_ptr; -ACPI_EXTERN ALLOCATION_INFO *acpi_gbl_tail_alloc_ptr; -#endif - - -/***************************************************************************** - * - * Interpreter globals - * - ****************************************************************************/ - - -ACPI_EXTERN u32 acpi_gbl_when_to_parse_methods; -ACPI_EXTERN ACPI_WALK_LIST *acpi_gbl_current_walk_list; - -/* Base of AML block, and pointer to current location in it */ - -ACPI_EXTERN u8 *acpi_gbl_Pcode_base; -ACPI_EXTERN u8 *acpi_gbl_Pcode; - -/* - * Length of AML block, and remaining length of current package. - */ -ACPI_EXTERN u32 acpi_gbl_Pcode_block_len; -ACPI_EXTERN u32 acpi_gbl_Pcode_len; - -ACPI_EXTERN u32 acpi_gbl_buf_seq; /* Counts allocated Buffer descriptors */ -ACPI_EXTERN s32 acpi_gbl_named_object_err; /* Indicate if inc_error should be called */ - -/* - * Handle to the last method found - used during pass1 of load - */ -ACPI_EXTERN ACPI_HANDLE acpi_gbl_last_method; - -/* - * Table of Address Space handlers - */ - -ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO acpi_gbl_address_spaces[ACPI_NUM_ADDRESS_SPACES]; - - -/* Control method single step flag */ - -ACPI_EXTERN u8 acpi_gbl_cm_single_step; - - -/***************************************************************************** - * - * Parser globals - * - ****************************************************************************/ - -ACPI_EXTERN ACPI_GENERIC_OP *acpi_gbl_parsed_namespace_root; - -extern ACPI_OP_INFO acpi_gbl_aml_op_info[]; -extern u8 acpi_gbl_aml_op_info_index[256]; -extern char *acpi_gbl_parser_id; - - -/***************************************************************************** - * - * Hardware globals - * - ****************************************************************************/ - -extern ACPI_C_STATE_HANDLER acpi_hw_cx_handlers[MAX_CX_STATES]; -extern u32 acpi_hw_active_cx_state; - - -/***************************************************************************** - * - * Event globals - * - ****************************************************************************/ - -ACPI_EXTERN ACPI_FIXED_EVENT_INFO acpi_gbl_fixed_event_handlers[NUM_FIXED_EVENTS]; - -ACPI_EXTERN ACPI_HANDLE acpi_gbl_gpe_obj_handle; -ACPI_EXTERN u32 acpi_gbl_gpe_register_count; -ACPI_EXTERN ACPI_GPE_REGISTERS *acpi_gbl_gpe_registers; -ACPI_EXTERN ACPI_GPE_LEVEL_INFO *acpi_gbl_gpe_info; - -/* - * Gpe validation and translation table - * Indexed by the GPE number, returns GPE_INVALID if the GPE is not supported. - * Otherwise, returns a valid index into the global GPE table. - * - * This table is needed because the GPE numbers supported by block 1 do not - * have to be contiguous with the GPE numbers supported by block 0. - */ -ACPI_EXTERN u8 acpi_gbl_gpe_valid [NUM_GPE]; - -/* Acpi_event counter for debug only */ - -#ifdef ACPI_DEBUG -ACPI_EXTERN u32 acpi_gbl_event_count[NUM_FIXED_EVENTS]; -#endif - - -/***************************************************************************** - * - * Debugger globals - * - ****************************************************************************/ - -ACPI_EXTERN u8 acpi_gbl_method_executing; -ACPI_EXTERN u8 acpi_gbl_db_terminate_threads; - - -/* Memory allocation metrics - Debug Only! */ - -#ifdef ACPI_DEBUG - -ACPI_EXTERN u32 acpi_gbl_current_alloc_size; -ACPI_EXTERN u32 acpi_gbl_current_alloc_count; -ACPI_EXTERN u32 acpi_gbl_running_alloc_size; -ACPI_EXTERN u32 acpi_gbl_running_alloc_count; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_alloc_count; -ACPI_EXTERN u32 acpi_gbl_current_object_count; -ACPI_EXTERN u32 acpi_gbl_current_object_size; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_count; -ACPI_EXTERN u32 acpi_gbl_max_concurrent_object_size; -ACPI_EXTERN u32 acpi_gbl_running_object_count; -ACPI_EXTERN u32 acpi_gbl_running_object_size; - -#endif - - -#endif /* __GLOBALS_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/hardware.h linux/drivers/acpi/include/hardware.h --- v2.4.0-test8/linux/drivers/acpi/include/hardware.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/hardware.h Wed Dec 31 16:00:00 1969 @@ -1,169 +0,0 @@ - -/****************************************************************************** - * - * Name: hardware.h -- hardware specific interfaces - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __HARDWARE_H__ -#define __HARDWARE_H__ - - -/* Prototypes */ - - -ACPI_STATUS -acpi_hw_initialize( - void); - -ACPI_STATUS -acpi_hw_shutdown( - void); - -ACPI_STATUS -acpi_hw_initialize_system_info( - void); - -ACPI_STATUS -acpi_hw_set_mode ( - u32 mode); - -u32 -acpi_hw_get_mode ( - void); - -u32 -acpi_hw_get_mode_capabilities ( - void); - -/* Register I/O Prototypes */ - -u32 -acpi_hw_register_access ( - NATIVE_UINT read_write, - u8 use_lock, - u32 register_id, ... /* DWORD Value */); - -void -acpi_hw_clear_acpi_status ( - void); - - -/* GPE support */ - -void -acpi_hw_enable_gpe ( - u32 gpe_index); - -void -acpi_hw_disable_gpe ( - u32 gpe_index); - -void -acpi_hw_clear_gpe ( - u32 gpe_index); - -void -acpi_hw_get_gpe_status ( - u32 gpe_number, - ACPI_EVENT_STATUS *event_status); - -/* Sleep Prototypes */ - -ACPI_STATUS -acpi_hw_obtain_sleep_type_register_data ( - u8 sleep_state, - u8 *slp_typ_a, - u8 *slp_typ_b); - - -/* Cx State Prototypes */ - -ACPI_STATUS -acpi_hw_enter_c1( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c2( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_c3( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_enter_cx ( - ACPI_IO_ADDRESS pblk_address, - u32 *pm_timer_ticks); - -ACPI_STATUS -acpi_hw_set_cx ( - u32 cx_state); - -ACPI_STATUS -acpi_hw_get_cx_info ( - u32 cx_states[]); - - -/* Throttling Prototypes */ - -void -acpi_hw_enable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -void -acpi_hw_disable_throttling ( - ACPI_IO_ADDRESS pblk_address); - -u32 -acpi_hw_get_duty_cycle ( - u8 duty_offset, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -void -acpi_hw_program_duty_cycle ( - u8 duty_offset, - u32 duty_cycle, - ACPI_IO_ADDRESS pblk_address, - u32 num_throttle_states); - -NATIVE_UINT -acpi_hw_local_pow ( - NATIVE_UINT x, - NATIVE_UINT y); - - -/* ACPI Timer prototypes */ - -u32 -acpi_hw_pmt_ticks ( - void); - -u32 -acpi_hw_pmt_resolution ( - void); - - -#endif /* __HARDWARE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/internal.h linux/drivers/acpi/include/internal.h --- v2.4.0-test8/linux/drivers/acpi/include/internal.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/internal.h Wed Dec 31 16:00:00 1969 @@ -1,850 +0,0 @@ - -/****************************************************************************** - * - * Name: internal.h - Internal data types used across the ACPI subsystem - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef _ACPI_INTERNAL_H -#define _ACPI_INTERNAL_H - -#include "config.h" - - -#define WAIT_FOREVER ((u32) -1) - -typedef void* ACPI_MUTEX; -typedef u32 ACPI_MUTEX_HANDLE; - - -/* Object descriptor types */ - -#define ACPI_DESC_TYPE_INTERNAL 0xAA -#define ACPI_DESC_TYPE_PARSER 0xBB -#define ACPI_DESC_TYPE_STATE 0xCC -#define ACPI_DESC_TYPE_WALK 0xDD -#define ACPI_DESC_TYPE_NAMED 0xEE - - -/***************************************************************************** - * - * Mutex typedefs and structs - * - ****************************************************************************/ - - -/* - * Predefined handles for the mutex objects used within the subsystem - * All mutex objects are automatically created by Acpi_cm_mutex_initialize. - * NOTE: any changes here must be reflected in the Acpi_gbl_Mutex_names table also! - */ - -#define ACPI_MTX_HARDWARE 0 -#define ACPI_MTX_MEMORY 1 -#define ACPI_MTX_CACHES 2 -#define ACPI_MTX_TABLES 3 -#define ACPI_MTX_PARSER 4 -#define ACPI_MTX_DISPATCHER 5 -#define ACPI_MTX_INTERPRETER 6 -#define ACPI_MTX_EXECUTE 7 -#define ACPI_MTX_NAMESPACE 8 -#define ACPI_MTX_EVENTS 9 -#define ACPI_MTX_OP_REGIONS 10 -#define ACPI_MTX_DEBUG_CMD_READY 11 -#define ACPI_MTX_DEBUG_CMD_COMPLETE 12 - -#define MAX_MTX 12 -#define NUM_MTX MAX_MTX+1 - - -#ifdef ACPI_DEBUG -#ifdef DEFINE_ACPI_GLOBALS - -/* Names for the mutexes used in the subsystem */ - -static char *acpi_gbl_mutex_names[] = -{ - "ACPI_MTX_Hardware", - "ACPI_MTX_Memory", - "ACPI_MTX_Caches", - "ACPI_MTX_Tables", - "ACPI_MTX_Parser", - "ACPI_MTX_Dispatcher", - "ACPI_MTX_Interpreter", - "ACPI_MTX_Execute", - "ACPI_MTX_Namespace", - "ACPI_MTX_Events", - "ACPI_MTX_Op_regions", - "ACPI_MTX_Debug_cmd_ready", - "ACPI_MTX_Debug_cmd_complete" -}; - -#endif -#endif - - -/* Table for the global mutexes */ - -typedef struct acpi_mutex_info -{ - ACPI_MUTEX mutex; - u32 use_count; - u8 locked; - -} ACPI_MUTEX_INFO; - - -/* Lock flag parameter for various interfaces */ - -#define ACPI_MTX_DO_NOT_LOCK 0 -#define ACPI_MTX_LOCK 1 - - -typedef u16 ACPI_OWNER_ID; -#define OWNER_TYPE_TABLE 0x0 -#define OWNER_TYPE_METHOD 0x1 -#define FIRST_METHOD_ID 0x0000 -#define FIRST_TABLE_ID 0x8000 - -/* TBD: [Restructure] get rid of the need for this! */ - -#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0xD1D1 - -/***************************************************************************** - * - * Namespace typedefs and structs - * - ****************************************************************************/ - - -/* Operational modes of the AML interpreter/scanner */ - -typedef enum -{ - IMODE_LOAD_PASS1 = 0x01, - IMODE_LOAD_PASS2 = 0x02, - IMODE_EXECUTE = 0x0E - -} OPERATING_MODE; - - -/* - * The Acpi_named_object describes a named object that appears in the AML - * An Acpi_name_table is used to store Acpi_named_objects. - * - * Data_type is used to differentiate between internal descriptors, and MUST - * be the first byte in this structure. - */ - -typedef struct acpi_named_object -{ - u8 data_type; - u8 type; /* Type associated with this name */ - u8 this_index; /* Entry number */ - u8 flags; - u32 name; /* ACPI Name, always 4 chars per ACPI spec */ - - - void *object; /* Pointer to attached ACPI object (optional) */ - struct acpi_name_table *child_table; /* Scope owned by this name (optional) */ - ACPI_OWNER_ID owner_id; /* ID of owner - either an ACPI table or a method */ - u16 reference_count; /* Current count of references and children */ - -#ifdef _IA64 - u32 fill1; /* 64-bit alignment */ -#endif - -} ACPI_NAMED_OBJECT; - - -typedef struct acpi_name_table -{ - struct acpi_name_table *next_table; - struct acpi_name_table *parent_table; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_NAMED_OBJECT entries[1]; - -} ACPI_NAME_TABLE; - - -#define ENTRY_NOT_FOUND NULL - - -/* NTE flags */ - -#define NTE_AML_ATTACHMENT 0x1 - - -/* - * ACPI Table Descriptor. One per ACPI table - */ -typedef struct acpi_table_desc -{ - struct acpi_table_desc *prev; - struct acpi_table_desc *next; - struct acpi_table_desc *installed_desc; - ACPI_TABLE_HEADER *pointer; - void *base_pointer; - u8 *aml_pointer; - u32 aml_length; - u32 length; - u32 count; - ACPI_OWNER_ID table_id; - u8 type; - u8 allocation; - u8 loaded_into_namespace; - -} ACPI_TABLE_DESC; - - -typedef struct -{ - char *search_for; - ACPI_HANDLE *list; - s32 *count; - -} FIND_CONTEXT; - - -typedef struct -{ - ACPI_NAME_TABLE *name_table; - u32 position; - u8 table_full; - -} NS_SEARCH_DATA; - - -/* - * Predefined Namespace items - */ -#define ACPI_MAX_ADDRESS_SPACE 255 -#define ACPI_NUM_ADDRESS_SPACES 256 - - -typedef struct -{ - char *name; - ACPI_OBJECT_TYPE type; - char *val; - -} PREDEFINED_NAMES; - - -/***************************************************************************** - * - * Event typedefs and structs - * - ****************************************************************************/ - - -/* Status bits. */ - -#define ACPI_STATUS_PMTIMER 0x0001 -#define ACPI_STATUS_GLOBAL 0x0020 -#define ACPI_STATUS_POWER_BUTTON 0x0100 -#define ACPI_STATUS_SLEEP_BUTTON 0x0200 -#define ACPI_STATUS_RTC_ALARM 0x0400 - -/* Enable bits. */ - -#define ACPI_ENABLE_PMTIMER 0x0001 -#define ACPI_ENABLE_GLOBAL 0x0020 -#define ACPI_ENABLE_POWER_BUTTON 0x0100 -#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 -#define ACPI_ENABLE_RTC_ALARM 0x0400 - - -/* - * Entry in the Address_space (AKA Operation Region) table - */ - -typedef struct -{ - ADDRESS_SPACE_HANDLER handler; - void *context; - -} ACPI_ADDRESS_SPACE_INFO; - - -/* Values and addresses of the GPE registers (both banks) */ - -typedef struct -{ - u8 status; /* Current value of status reg */ - u8 enable; /* Current value of enable reg */ - u16 status_addr; /* Address of status reg */ - u16 enable_addr; /* Address of enable reg */ - u8 gpe_base; /* Base GPE number */ - -} ACPI_GPE_REGISTERS; - - -#define ACPI_GPE_LEVEL_TRIGGERED 1 -#define ACPI_GPE_EDGE_TRIGGERED 2 - - -/* Information about each particular GPE level */ - -typedef struct -{ - u8 type; /* Level or Edge */ - - ACPI_HANDLE method_handle; /* Method handle for direct (fast) execution */ - GPE_HANDLER handler; /* Address of handler, if any */ - void *context; /* Context to be passed to handler */ - -} ACPI_GPE_LEVEL_INFO; - - -/* Information about each particular fixed event */ - -typedef struct -{ - FIXED_EVENT_HANDLER handler; /* Address of handler. */ - void *context; /* Context to be passed to handler */ - -} ACPI_FIXED_EVENT_INFO; - - -/* Information used during field processing */ - -typedef struct -{ - u8 skip_field; - u8 field_flag; - u32 pkg_length; - -} ACPI_FIELD_INFO; - - -/***************************************************************************** - * - * Parser typedefs and structs - * - ****************************************************************************/ - - -#define OP_INFO_TYPE 0x1F -#define OP_INFO_HAS_ARGS 0x20 -#define OP_INFO_CHILD_LOCATION 0xC0 - -/* - * AML opcode, name, and argument layout - */ -typedef struct acpi_op_info -{ - u16 opcode; /* AML opcode */ - u8 flags; /* Opcode type, Has_args flag */ - u32 parse_args; /* Grammar/Parse time arguments */ - u32 runtime_args; /* Interpret time arguments */ - - DEBUG_ONLY_MEMBERS ( - char *name) /* op name (debug only) */ - -} ACPI_OP_INFO; - - -typedef union acpi_op_value -{ - u32 integer; /* integer constant */ - u32 size; /* bytelist or field size */ - char *string; /* NULL terminated string */ - u8 *buffer; /* buffer or string */ - char *name; /* NULL terminated string */ - struct acpi_generic_op *arg; /* arguments and contained ops */ - ACPI_NAMED_OBJECT *entry; /* entry in interpreter namespace tbl */ - -} ACPI_OP_VALUE; - - -#define ACPI_COMMON_OP \ - u8 data_type; /* To differentiate various internal objs */\ - u8 flags; /* Type of Op */\ - u16 opcode; /* AML opcode */\ - u32 aml_offset; /* offset of declaration in AML */\ - struct acpi_generic_op *parent; /* parent op */\ - struct acpi_generic_op *next; /* next op */\ - DEBUG_ONLY_MEMBERS (\ - char op_name[16]) /* op name (debug only) */\ - /* NON-DEBUG members below: */\ - void *acpi_named_object;/* for use by interpreter */\ - ACPI_OP_VALUE value; /* Value or args associated with the opcode */\ - - -/* - * generic operation (eg. If, While, Store) - */ -typedef struct acpi_generic_op -{ - ACPI_COMMON_OP -} ACPI_GENERIC_OP; - - -/* - * operation with a name (eg. Scope, Method, Name, Named_field, ...) - */ -typedef struct acpi_named_op -{ - ACPI_COMMON_OP - u32 name; /* 4-byte name or zero if no name */ - -} ACPI_NAMED_OP; - - -/* - * special operation for methods and regions (parsing must be deferred - * until a first pass parse is completed) - */ -typedef struct acpi_deferred_op -{ - ACPI_COMMON_OP - u32 name; /* 4-byte name or 0 if none */ - u32 body_length; /* AML body size */ - u8 *body; /* AML body */ - u16 thread_count; /* Count of threads currently executing a method */ - -} ACPI_DEFERRED_OP; - - -/* - * special operation for bytelists (Byte_list only) - */ -typedef struct acpi_bytelist_op -{ - ACPI_COMMON_OP - u8 *data; /* bytelist data */ - -} ACPI_BYTELIST_OP; - - -/* - * Parse state - one state per parser invocation and each control - * method. - */ - -typedef struct acpi_parse_state -{ - u8 *aml_start; /* first AML byte */ - u8 *aml; /* next AML byte */ - u8 *aml_end; /* (last + 1) AML byte */ - u8 *pkg_end; /* current package end */ - ACPI_GENERIC_OP *start_op; /* root of parse tree */ - struct acpi_parse_scope *scope; /* current scope */ - struct acpi_parse_scope *scope_avail; /* unused (extra) scope structs */ - struct acpi_parse_state *next; - -} ACPI_PARSE_STATE; - - -/* - * Parse scope - one per ACPI scope - */ - -typedef struct acpi_parse_scope -{ - ACPI_GENERIC_OP *op; /* current op being parsed */ - u8 *arg_end; /* current argument end */ - u8 *pkg_end; /* current package end */ - struct acpi_parse_scope *parent; /* parent scope */ - u32 arg_list; /* next argument to parse */ - u32 arg_count; /* Number of fixed arguments */ - -} ACPI_PARSE_SCOPE; - - -/***************************************************************************** - * - * Generic "state" object for stacks - * - ****************************************************************************/ - - -#define CONTROL_NORMAL 0xC0 -#define CONTROL_CONDITIONAL_EXECUTING 0xC1 -#define CONTROL_PREDICATE_EXECUTING 0xC2 -#define CONTROL_PREDICATE_FALSE 0xC3 -#define CONTROL_PREDICATE_TRUE 0xC4 - - -#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ - u8 data_type; /* To differentiate various internal objs */\ - u8 flags; \ - u16 value; \ - u16 state; \ - u16 acpi_eval; \ - void *next; \ - -typedef struct acpi_common_state -{ - ACPI_STATE_COMMON -} ACPI_COMMON_STATE; - - -/* - * Update state - used to traverse complex objects such as packages - */ -typedef struct acpi_update_state -{ - ACPI_STATE_COMMON - union acpi_obj_internal *object; - -} ACPI_UPDATE_STATE; - -/* - * Control state - one per if/else and while constructs. - * Allows nesting of these constructs - */ -typedef struct acpi_control_state -{ - ACPI_STATE_COMMON - ACPI_GENERIC_OP *predicate_op; /* Start of if/while predicate */ - -} ACPI_CONTROL_STATE; - - -/* - * Scope state - current scope during namespace lookups - */ - -typedef struct acpi_scope_state -{ - ACPI_STATE_COMMON - ACPI_NAME_TABLE *name_table; - -} ACPI_SCOPE_STATE; - - -typedef union acpi_gen_state -{ - ACPI_COMMON_STATE common; - ACPI_CONTROL_STATE control; - ACPI_UPDATE_STATE update; - ACPI_SCOPE_STATE scope; - -} ACPI_GENERIC_STATE; - - -/***************************************************************************** - * - * Tree walking typedefs and structs - * - ****************************************************************************/ - - -/* - * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through - * the tree (for whatever reason), and for control method execution. - */ - -#define NEXT_OP_DOWNWARD 1 -#define NEXT_OP_UPWARD 2 - -typedef struct acpi_walk_state -{ - u8 data_type; /* To differentiate various internal objs */\ - ACPI_OWNER_ID owner_id; /* Owner of objects created during the walk */ - u8 last_predicate; /* Result of last predicate */ - u8 next_op_info; /* Info about Next_op */ - u8 num_operands; /* Stack pointer for Operands[] array */ - u8 num_results; /* Stack pointer for Results[] array */ - u8 current_result; /* */ - - struct acpi_walk_state *next; /* Next Walk_state in list */ - ACPI_GENERIC_OP *origin; /* Start of walk */ - ACPI_GENERIC_OP *prev_op; /* Last op that was processed */ - ACPI_GENERIC_OP *next_op; /* next op to be processed */ - ACPI_GENERIC_STATE *control_state; /* List of control states (nested IFs) */ - ACPI_GENERIC_STATE *scope_info; /* Stack of nested scopes */ - union acpi_obj_internal *return_desc; /* Return object, if any */ - union acpi_obj_internal *method_desc; /* Method descriptor if running a method */ - ACPI_GENERIC_OP *method_call_op; /* Method_call Op if running a method */ - union acpi_obj_internal *operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ - union acpi_obj_internal *results[OBJ_NUM_OPERANDS]; /* Accumulated results */ - struct acpi_named_object arguments[MTH_NUM_ARGS]; /* Control method arguments */ - struct acpi_named_object local_variables[MTH_NUM_LOCALS]; /* Control method locals */ - - -} ACPI_WALK_STATE; - - -/* - * Walk list - head of a tree of walk states. Multiple walk states are created when there - * are nested control methods executing. - */ -typedef struct acpi_walk_list -{ - - ACPI_WALK_STATE *walk_state; - -} ACPI_WALK_LIST; - - -typedef -ACPI_STATUS (*INTERPRETER_CALLBACK) ( - ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op); - - -/* Info used by Acpi_ps_init_objects */ - -typedef struct init_walk_info -{ - u32 method_count; - u32 op_region_count; - ACPI_TABLE_DESC *table_desc; - -} INIT_WALK_INFO; - - -/* TBD: [Restructure] Merge with struct above */ - -typedef struct acpi_walk_info -{ - u32 debug_level; - u32 owner_id; - -} ACPI_WALK_INFO; - - -/***************************************************************************** - * - * Hardware and PNP - * - ****************************************************************************/ - - -/* Sleep states */ - -#define SLWA_DEBUG_LEVEL 4 -#define GTS_CALL 0 -#define GTS_WAKE 1 - -/* Cx States */ - -#define MAX_CX_STATE_LATENCY 0xFFFFFFFF -#define MAX_CX_STATES 4 - -/* - * The #define's and enum below establish an abstract way of identifying what - * register block and register is to be accessed. Do not change any of the - * values as they are used in switch statements and offset calculations. - */ - -#define REGISTER_BLOCK_MASK 0xFF00 -#define BIT_IN_REGISTER_MASK 0x00FF -#define PM1_EVT 0x0100 -#define PM1_CONTROL 0x0200 -#define PM2_CONTROL 0x0300 -#define PM_TIMER 0x0400 -#define PROCESSOR_BLOCK 0x0500 -#define GPE0_STS_BLOCK 0x0600 -#define GPE0_EN_BLOCK 0x0700 -#define GPE1_STS_BLOCK 0x0800 -#define GPE1_EN_BLOCK 0x0900 - -enum -{ - /* PM1 status register ids */ - - TMR_STS = (PM1_EVT | 0x01), - BM_STS, - GBL_STS, - PWRBTN_STS, - SLPBTN_STS, - RTC_STS, - WAK_STS, - - /* PM1 enable register ids */ - - TMR_EN, - /* need to skip 1 enable number since there's no bus master enable register */ - GBL_EN = (PM1_EVT | 0x0A), - PWRBTN_EN, - SLPBTN_EN, - RTC_EN, - - /* PM1 control register ids */ - - SCI_EN = (PM1_CONTROL | 0x01), - BM_RLD, - GBL_RLS, - SLP_TYPE_A, - SLP_TYPE_B, - SLP_EN, - - /* PM2 control register ids */ - - ARB_DIS = (PM2_CONTROL | 0x01), - - /* PM Timer register ids */ - - TMR_VAL = (PM_TIMER | 0x01), - - GPE0_STS = (GPE0_STS_BLOCK | 0x01), - GPE0_EN = (GPE0_EN_BLOCK | 0x01), - - GPE1_STS = (GPE1_STS_BLOCK | 0x01), - GPE1_EN = (GPE0_EN_BLOCK | 0x01), - - /* Last register value is one less than LAST_REG */ - - LAST_REG -}; - - -#define TMR_STS_MASK 0x0001 -#define BM_STS_MASK 0x0010 -#define GBL_STS_MASK 0x0020 -#define PWRBTN_STS_MASK 0x0100 -#define SLPBTN_STS_MASK 0x0200 -#define RTC_STS_MASK 0x0400 -#define WAK_STS_MASK 0x8000 - -#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK | PWRBTN_STS_MASK | \ - SLPBTN_STS_MASK | RTC_STS_MASK | WAK_STS_MASK) - -#define TMR_EN_MASK 0x0001 -#define GBL_EN_MASK 0x0020 -#define PWRBTN_EN_MASK 0x0100 -#define SLPBTN_EN_MASK 0x0200 -#define RTC_EN_MASK 0x0400 - -#define SCI_EN_MASK 0x0001 -#define BM_RLD_MASK 0x0002 -#define GBL_RLS_MASK 0x0004 -#define SLP_TYPE_X_MASK 0x1C00 -#define SLP_EN_MASK 0x2000 - -#define ARB_DIS_MASK 0x0001 - -#define GPE0_STS_MASK -#define GPE0_EN_MASK - -#define GPE1_STS_MASK -#define GPE1_EN_MASK - - -#define ACPI_READ 1 -#define ACPI_WRITE 2 - -#define LOW_BYTE 0x00FF -#define ONE_BYTE 0x08 - -#ifndef SET - #define SET 1 -#endif -#ifndef CLEAR - #define CLEAR 0 -#endif - - -/* Plug and play */ - -/* Pnp and ACPI data */ - -#define VERSION_NO 0x01 -#define LOGICAL_DEVICE_ID 0x02 -#define COMPATIBLE_DEVICE_ID 0x03 -#define IRQ_FORMAT 0x04 -#define DMA_FORMAT 0x05 -#define START_DEPENDENT_TAG 0x06 -#define END_DEPENDENT_TAG 0x07 -#define IO_PORT_DESCRIPTOR 0x08 -#define FIXED_LOCATION_IO_DESCRIPTOR 0x09 -#define RESERVED_TYPE0 0x0A -#define RESERVED_TYPE1 0x0B -#define RESERVED_TYPE2 0x0C -#define RESERVED_TYPE3 0x0D -#define SMALL_VENDOR_DEFINED 0x0E -#define END_TAG 0x0F - -/* Pnp and ACPI data */ - -#define MEMORY_RANGE_24 0x81 -#define ISA_MEMORY_RANGE 0x81 -#define LARGE_VENDOR_DEFINED 0x84 -#define EISA_MEMORY_RANGE 0x85 -#define MEMORY_RANGE_32 0x85 -#define FIXED_EISA_MEMORY_RANGE 0x86 -#define FIXED_MEMORY_RANGE_32 0x86 - -/* ACPI only data */ - -#define DWORD_ADDRESS_SPACE 0x87 -#define WORD_ADDRESS_SPACE 0x88 -#define EXTENDED_IRQ 0x89 - -/* MUST HAVES */ - - -typedef enum -{ - DWORD_DEVICE_ID, - STRING_PTR_DEVICE_ID, - STRING_DEVICE_ID - -} DEVICE_ID_TYPE; - -typedef struct -{ - DEVICE_ID_TYPE type; - union - { - u32 number; - char *string_ptr; - char buffer[9]; - } data; - -} DEVICE_ID; - - -/***************************************************************************** - * - * Debug - * - ****************************************************************************/ - - -/* Entry for a memory allocation (debug only) */ - -#ifdef ACPI_DEBUG - -#define MEM_MALLOC 0 -#define MEM_CALLOC 1 -#define MAX_MODULE_NAME 16 - -typedef struct allocation_info -{ - struct allocation_info *previous; - struct allocation_info *next; - void *address; - u32 size; - u32 component; - u32 line; - char module[MAX_MODULE_NAME]; - u8 alloc_type; - -} ALLOCATION_INFO; - -#endif - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/interp.h linux/drivers/acpi/include/interp.h --- v2.4.0-test8/linux/drivers/acpi/include/interp.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/interp.h Wed Dec 31 16:00:00 1969 @@ -1,660 +0,0 @@ - -/****************************************************************************** - * - * Name: interp.h - Interpreter subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __INTERP_H__ -#define __INTERP_H__ - - -#include "actypes.h" -#include "acobject.h" - - -#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1]) - - -/* Interpreter constants */ - -#define AML_END_OF_BLOCK -1 -#define PUSH_PKG_LENGTH 1 -#define DO_NOT_PUSH_PKG_LENGTH 0 - - -#define STACK_TOP 0 -#define STACK_BOTTOM (u32) -1 - -/* Constants for global "When_to_parse_methods" */ - -#define METHOD_PARSE_AT_INIT 0x0 -#define METHOD_PARSE_JUST_IN_TIME 0x1 -#define METHOD_DELETE_AT_COMPLETION 0x2 - - -ACPI_STATUS -acpi_aml_resolve_operands ( - u16 opcode, - ACPI_OBJECT_INTERNAL **stack_ptr); - - -/* - * amxface - External interpreter interfaces - */ - -ACPI_STATUS -acpi_aml_load_table ( - ACPI_TABLE_TYPE table_id); - -ACPI_STATUS -acpi_aml_execute_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -/* - * amcopy - Interpreter object copy support - */ - -ACPI_STATUS -acpi_aml_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj); - - -/* - * amfield - ACPI AML (p-code) execution - field manipulation - */ - - -ACPI_STATUS -acpi_aml_read_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - void *buffer, - u32 buffer_length, - u32 byte_length, - u32 datum_length, - u32 bit_granularity, - u32 byte_granularity); - -ACPI_STATUS -acpi_aml_write_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - void *buffer, - u32 buffer_length, - u32 byte_length, - u32 datum_length, - u32 bit_granularity, - u32 byte_granularity); - -ACPI_STATUS -acpi_aml_setup_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL *rgn_desc, - s32 field_bit_width); - -ACPI_STATUS -acpi_aml_read_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, - u32 field_byte_offset, - u32 field_bit_width, - u32 *value); - -ACPI_STATUS -acpi_aml_access_named_field ( - s32 mode, - ACPI_HANDLE named_field, - void *buffer, - u32 length); - -ACPI_STATUS -acpi_aml_set_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 length); - -ACPI_STATUS -acpi_aml_get_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 length); - - -/* - * ammisc - ACPI AML (p-code) execution - specific opcodes - */ - -ACPI_STATUS -acpi_aml_exec_create_field ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_reconfiguration ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_fatal ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_index ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_match ( - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_create_mutex ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_processor ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE processor_nTE); - -ACPI_STATUS -acpi_aml_exec_create_power_resource ( - ACPI_GENERIC_OP *op, - ACPI_HANDLE processor_nTE); - -ACPI_STATUS -acpi_aml_exec_create_region ( - u8 *aml_ptr, - u32 acpi_aml_length, - u32 region_space, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_event ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_alias ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_create_method ( - u8 *aml_ptr, - u32 acpi_aml_length, - u32 method_flags, - ACPI_HANDLE method); - - -/* - * amprep - ACPI AML (p-code) execution - prep utilities - */ - -ACPI_STATUS -acpi_aml_prep_def_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE region, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_bank_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE region, - ACPI_HANDLE bank_reg, - u32 bank_val, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_index_field_value ( - ACPI_NAMED_OBJECT *this_entry, - ACPI_HANDLE index_reg, - ACPI_HANDLE data_reg, - u8 field_flags, - u8 field_attribute, - u32 field_position, - u32 field_length); - -ACPI_STATUS -acpi_aml_prep_operands ( - char *types, - ACPI_OBJECT_INTERNAL **stack_ptr); - - -/* - * iepstack - package stack utilities - */ - -/* -u32 -Acpi_aml_pkg_stack_level ( - void); - -void -Acpi_aml_clear_pkg_stack ( - void); - -ACPI_STATUS -Acpi_aml_pkg_push_length ( - u32 Length, - OPERATING_MODE Load_exec_mode); - -ACPI_STATUS -Acpi_aml_pkg_push_exec_length ( - u32 Length); - -ACPI_STATUS -Acpi_aml_pkg_push_exec ( - u8 *Code, - u32 Len); - -ACPI_STATUS -Acpi_aml_pkg_pop_length ( - s32 No_err_under, - OPERATING_MODE Load_exec_mode); - -ACPI_STATUS -Acpi_aml_pkg_pop_exec_length ( - void); - -ACPI_STATUS -Acpi_aml_pkg_pop_exec ( - void); - -*/ - -/* - * amsystem - Interface to OS services - */ - -u16 -acpi_aml_system_thread_id ( - void); - -ACPI_STATUS -acpi_aml_system_do_notify_op ( - ACPI_OBJECT_INTERNAL *value, - ACPI_OBJECT_INTERNAL *obj_desc); - -void -acpi_aml_system_do_suspend( - u32 time); - -void -acpi_aml_system_do_stall ( - u32 time); - -ACPI_STATUS -acpi_aml_system_acquire_mutex( - ACPI_OBJECT_INTERNAL *time, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_release_mutex( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_signal_event( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_wait_event( - ACPI_OBJECT_INTERNAL *time, - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_reset_event( - ACPI_OBJECT_INTERNAL *obj_desc); - -ACPI_STATUS -acpi_aml_system_wait_semaphore ( - ACPI_HANDLE semaphore, - u32 timeout); - - -/* - * ammonadic - ACPI AML (p-code) execution, monadic operators - */ - -ACPI_STATUS -acpi_aml_exec_monadic1 ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_monadic2 ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_monadic2_r ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - - -/* - * amdyadic - ACPI AML (p-code) execution, dyadic operators - */ - -ACPI_STATUS -acpi_aml_exec_dyadic1 ( - u16 opcode, - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_aml_exec_dyadic2 ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_dyadic2_r ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - -ACPI_STATUS -acpi_aml_exec_dyadic2_s ( - u16 opcode, - ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc); - - -/* - * amresolv - Object resolution and get value functions - */ - -ACPI_STATUS -acpi_aml_resolve_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr); - -ACPI_STATUS -acpi_aml_resolve_entry_to_value ( - ACPI_NAMED_OBJECT **stack_ptr); - -ACPI_STATUS -acpi_aml_resolve_object_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr); - -ACPI_STATUS -acpi_aml_get_field_unit_value ( - ACPI_OBJECT_INTERNAL *field_desc, - ACPI_OBJECT_INTERNAL *result_desc); - - -/* - * amcode - Scanner AML code manipulation routines - */ - -s32 -acpi_aml_avail ( - ACPI_SIZE n); - -s32 -acpi_aml_peek ( - void); - -s32 -acpi_aml_get_pcode_byte ( - u8 *pcode); - -u16 -acpi_aml_peek_op ( - void); - -u8 * -acpi_aml_consume_bytes ( - ACPI_SIZE bytes); - -ACPI_SIZE -acpi_aml_consume_stream_bytes ( - ACPI_SIZE bytes_to_get, - u8 *aml_buffer); - -void -acpi_aml_consume_package ( - OPERATING_MODE load_exec_mode); - -void -acpi_aml_set_pcode_input ( - u8 *base, - u32 length); - -ACPI_STATUS -acpi_aml_set_method ( - void *object); - -ACPI_STATUS -acpi_aml_prep_exec ( - u8 *pcode, - u32 pcode_length); - -ACPI_HANDLE -acpi_aml_get_pcode_handle ( - void); - -void -acpi_aml_get_current_location ( - ACPI_OBJECT_INTERNAL *method_desc); - -void -acpi_aml_set_current_location ( - ACPI_OBJECT_INTERNAL *method_desc); - - -/* - * amdump - Scanner debug output routines - */ - -void -acpi_aml_show_hex_value ( - s32 byte_count, - u8 *aml_ptr, - s32 lead_space); - -void -acpi_aml_dump_buffer ( - ACPI_SIZE length); - - -ACPI_STATUS -acpi_aml_dump_operand ( - ACPI_OBJECT_INTERNAL *entry_desc); - -void -acpi_aml_dump_operands ( - ACPI_OBJECT_INTERNAL **operands, - OPERATING_MODE interpreter_mode, - char *ident, - s32 num_levels, - char *note, - char *module_name, - s32 line_number); - -void -acpi_aml_dump_object_descriptor ( - ACPI_OBJECT_INTERNAL *object, - u32 flags); - - -void -acpi_aml_dump_acpi_named_object ( - ACPI_NAMED_OBJECT *entry, - u32 flags); - - -/* - * amnames - interpreter/scanner name load/execute - */ - -char * -acpi_aml_allocate_name_string ( - u32 prefix_count, - u32 num_name_segs); - -s32 -acpi_aml_good_char ( - s32 character); - -ACPI_STATUS -acpi_aml_exec_name_segment ( - u8 **in_aml_address, - char *name_string); - -ACPI_STATUS -acpi_aml_get_name_string ( - OBJECT_TYPE_INTERNAL data_type, - u8 *in_aml_address, - char **out_name_string, - u32 *out_name_length); - -u32 -acpi_aml_decode_package_length ( - u32 last_pkg_len); - - -ACPI_STATUS -acpi_aml_do_name ( - ACPI_OBJECT_TYPE data_type, - OPERATING_MODE load_exec_mode); - - -/* - * amstore - Object store support - */ - -ACPI_STATUS -acpi_aml_exec_store ( - ACPI_OBJECT_INTERNAL *op1, - ACPI_OBJECT_INTERNAL *res); - -ACPI_STATUS -acpi_aml_store_object_to_object ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc); - -ACPI_STATUS -acpi_aml_store_object_to_nte ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_NAMED_OBJECT *entry); - - -/* - * amutils - interpreter/scanner utilities - */ - -void -acpi_aml_enter_interpreter ( - void); - -void -acpi_aml_exit_interpreter ( - void); - -u8 -acpi_aml_validate_object_type ( - ACPI_OBJECT_TYPE type); - -u8 -acpi_aml_acquire_global_lock ( - u32 rule); - -ACPI_STATUS -acpi_aml_release_global_lock ( - u8 locked); - -void -acpi_aml_append_operand_diag( - char *name, - s32 line, - u16 op_code, - ACPI_OBJECT_INTERNAL **operands, - s32 Noperands); - -u32 -acpi_aml_buf_seq ( - void); - -s32 -acpi_aml_digits_needed ( - s32 value, - s32 base); - -ACPI_STATUS -acpi_aml_eisa_id_to_string ( - u32 numeric_id, - char *out_string); - - -/* - * amregion - default Op_region handlers - */ - -ACPI_STATUS -acpi_aml_system_memory_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_system_io_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_pci_config_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_embedded_controller_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - -ACPI_STATUS -acpi_aml_sm_bus_space_handler ( - u32 function, - u32 address, - u32 bit_width, - u32 *value, - void *context); - - -#endif /* __INTERP_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/macros.h linux/drivers/acpi/include/macros.h --- v2.4.0-test8/linux/drivers/acpi/include/macros.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/macros.h Wed Dec 31 16:00:00 1969 @@ -1,423 +0,0 @@ - -/****************************************************************************** - * - * Name: macros.h - C macros for the entire subsystem. - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __MACROS_H__ -#define __MACROS_H__ - -/* - * Data manipulation macros - */ - -#ifndef LOWORD -#define LOWORD(l) ((u16)(NATIVE_UINT)(l)) -#endif - -#ifndef HIWORD -#define HIWORD(l) ((u16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) -#endif - -#ifndef LOBYTE -#define LOBYTE(l) ((u8)(u16)(l)) -#endif - -#ifndef HIBYTE -#define HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) -#endif - -#define BIT0(x) ((((x) & 0x01) > 0) ? 1 : 0) -#define BIT1(x) ((((x) & 0x02) > 0) ? 1 : 0) -#define BIT2(x) ((((x) & 0x04) > 0) ? 1 : 0) - -#define BIT3(x) ((((x) & 0x08) > 0) ? 1 : 0) -#define BIT4(x) ((((x) & 0x10) > 0) ? 1 : 0) -#define BIT5(x) ((((x) & 0x20) > 0) ? 1 : 0) -#define BIT6(x) ((((x) & 0x40) > 0) ? 1 : 0) -#define BIT7(x) ((((x) & 0x80) > 0) ? 1 : 0) - -#define LOW_BASE(w) ((u16) ((w) & 0x0000FFFF)) -#define MID_BASE(b) ((u8) (((b) & 0x00FF0000) >> 16)) -#define HI_BASE(b) ((u8) (((b) & 0xFF000000) >> 24)) -#define LOW_LIMIT(w) ((u16) ((w) & 0x0000FFFF)) -#define HI_LIMIT(b) ((u8) (((b) & 0x00FF0000) >> 16)) - - - /* - * Extract a byte of data using a pointer. Any more than a byte and we - * get into potential aligment issues -- see the STORE macros below - */ -#define GET8(addr) (*(u8*)(addr)) - - -/* - * Macros for moving data around to/from buffers that are possibly unaligned. - * If the hardware supports the transfer of unaligned data, just do the store. - * Otherwise, we have to move one byte at a time. - */ - -#ifdef _HW_ALIGNMENT_SUPPORT - -/* The hardware supports unaligned transfers, just do the move */ - -#define MOVE_UNALIGNED16_TO_16(d,s) *(u16*)(d) = *(u16*)(s) -#define MOVE_UNALIGNED32_TO_32(d,s) *(u32*)(d) = *(u32*)(s) -#define MOVE_UNALIGNED16_TO_32(d,s) *(u32*)(d) = *(u16*)(s) - -#else -/* - * The hardware does not support unaligned transfers. We must move the - * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. - */ - -#define MOVE_UNALIGNED16_TO_16(d,s) {((char *)(d))[0] = ((char *)(s))[0];\ - ((char *)(d))[1] = ((char *)(s))[1];} - -#define MOVE_UNALIGNED32_TO_32(d,s) {((char *)(d))[0] = ((char *)(s))[0];\ - ((char *)(d))[1] = ((char *)(s))[1];\ - ((char *)(d))[2] = ((char *)(s))[2];\ - ((char *)(d))[3] = ((char *)(s))[3];} - -#define MOVE_UNALIGNED16_TO_32(d,s) {(*(u32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} - -#endif - - -/* - * Fast power-of-two math macros for non-optimized compilers - */ - -#define _DIV(value,power_of2) ((value) >> (power_of2)) -#define _MUL(value,power_of2) ((value) << (power_of2)) -#define _MOD(value,divisor) ((value) & ((divisor) -1)) - -#define DIV_2(a) _DIV(a,1) -#define MUL_2(a) _MUL(a,1) -#define MOD_2(a) _MOD(a,2) - -#define DIV_4(a) _DIV(a,2) -#define MUL_4(a) _MUL(a,2) -#define MOD_4(a) _MOD(a,4) - -#define DIV_8(a) _DIV(a,3) -#define MUL_8(a) _MUL(a,3) -#define MOD_8(a) _MOD(a,8) - -#define DIV_16(a) _DIV(a,4) -#define MUL_16(a) _MUL(a,4) -#define MOD_16(a) _MOD(a,16) - - -/* - * Rounding macros (Power of two boundaries only) - */ - -#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) -#define ROUND_UP(value,boundary) (((value) + ((boundary)-1)) & (~((boundary)-1))) - -#define ROUND_DOWN_TO_32_BITS(a) ROUND_DOWN(a,4) -#define ROUND_DOWN_TO_NATIVE_WORD(a) ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) - -#define ROUND_UP_TO_32_bITS(a) ROUND_UP(a,4) -#define ROUND_UP_TO_NATIVE_WORD(a) ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) - - -#ifdef DEBUG_ASSERT -#undef DEBUG_ASSERT -#endif - - -/* - * An ACPI_HANDLE (which is actually an ACPI_NAMED_OBJECT*) can appear in some contexts, - * such as on ap_obj_stack, where a pointer to an ACPI_OBJECT_INTERNAL can also - * appear. This macro is used to distinguish them. - * - * The Data_type field is the first field in both structures. - */ - -#define VALID_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMED_OBJECT*)d)->data_type == t) - - -/* Macro to test the object type */ - -#define IS_THIS_OBJECT_TYPE(d,t) (((ACPI_OBJECT_INTERNAL *)d)->common.type == (u8)t) - - -/* - * Macro to check if a pointer is within an ACPI table. - * Parameter (a) is the pointer to check. Parameter (b) must be defined - * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, - * and ((u8 *)b+b->Length) points one byte past the end of the table. - */ - -#ifndef _IA16 -#define IS_IN_ACPI_TABLE(a,b) (((u8 *)(a) >= (u8 *)(b + 1)) &&\ - ((u8 *)(a) < ((u8 *)b + b->length))) - -#else -#define IS_IN_ACPI_TABLE(a,b) (_segment)(a) == (_segment)(b) &&\ - (((u8 *)(a) >= (u8 *)(b + 1)) &&\ - ((u8 *)(a) < ((u8 *)b + b->length))) -#endif - -/* - * Macros for the master AML opcode table - */ - -#ifdef ACPI_DEBUG -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs,name} -#else -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs} -#endif - -#define ARG_TYPE_WIDTH 5 -#define ARG_1(x) ((u32)(x)) -#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) -#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) -#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) -#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) -#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) - -#define ARGI_LIST1(a) (ARG_1(a)) -#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) -#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) -#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) -#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) -#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) - -#define ARGP_LIST1(a) (ARG_1(a)) -#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) -#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) -#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) -#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) -#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) - -#define GET_CURRENT_ARG_TYPE(list) (list & 0x1F) -#define INCREMENT_ARG_LIST(list) (list >>= ARG_TYPE_WIDTH) - - -/* - * Reporting macros that are never compiled out - */ - -/* - * Error reporting. These versions add callers module and line#. Since - * _THIS_MODULE gets compiled out when ACPI_DEBUG isn't defined, only - * use it in debug mode. - */ - -#ifdef ACPI_DEBUG - -#define REPORT_INFO(a) _report_info(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define REPORT_ERROR(a) _report_error(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define REPORT_WARNING(a) _report_warning(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define REPORT_SUCCESS(a) _report_success(_THIS_MODULE,__LINE__,_COMPONENT,a) - -#else - -#define REPORT_INFO(a) _report_info("",__LINE__,_COMPONENT,a) -#define REPORT_ERROR(a) _report_error("",__LINE__,_COMPONENT,a) -#define REPORT_WARNING(a) _report_warning("",__LINE__,_COMPONENT,a) -#define REPORT_SUCCESS(a) _report_success("",__LINE__,_COMPONENT,a) - -#endif - -/* Error reporting. These versions pass thru the module and line# */ - -#define _REPORT_INFO(a,b,c,d) _report_info(a,b,c,d) -#define _REPORT_ERROR(a,b,c,d) _report_error(a,b,c,d) -#define _REPORT_WARNING(a,b,c,d) _report_warning(a,b,c,d) - -/* Buffer dump macros */ - -#define DUMP_BUFFER(a,b) acpi_cm_dump_buffer((char *)a,b,DB_BYTE_DISPLAY,_COMPONENT) - -/* - * Debug macros that are conditionally compiled - */ - -#ifdef ACPI_DEBUG - -#define MODULE_NAME(name) static char *_THIS_MODULE = name - -/* - * Function entry tracing. - * The first parameter should be the procedure name as a quoted string. This is declared - * as a local string ("_Proc_name) so that it can be also used by the function exit macros below. - */ - -#define FUNCTION_TRACE(a) char * _proc_name = a;\ - function_trace(_THIS_MODULE,__LINE__,_COMPONENT,a) -#define FUNCTION_TRACE_PTR(a,b) char * _proc_name = a;\ - function_trace_ptr(_THIS_MODULE,__LINE__,_COMPONENT,a,(void *)b) -#define FUNCTION_TRACE_U32(a,b) char * _proc_name = a;\ - function_trace_u32(_THIS_MODULE,__LINE__,_COMPONENT,a,(u32)b) -#define FUNCTION_TRACE_STR(a,b) char * _proc_name = a;\ - function_trace_str(_THIS_MODULE,__LINE__,_COMPONENT,a,(char *)b) -/* - * Function exit tracing. - * WARNING: These macros include a return statement. This is usually considered - * bad form, but having a separate exit macro is very ugly and difficult to maintain. - * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros - * so that "_Proc_name" is defined. - */ -#define return_VOID {function_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name);return;} -#define return_ACPI_STATUS(s) {function_status_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,s);return(s);} -#define return_VALUE(s) {function_value_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(NATIVE_UINT)s);return(s);} -#define return_PTR(s) {function_ptr_exit(_THIS_MODULE,__LINE__,_COMPONENT,_proc_name,(char *)s);return(s);} - - -/* Conditional execution */ - -#define DEBUG_EXEC(a) a; -#define NORMAL_EXEC(a) - -#define DEBUG_DEFINE(a) a; -#define DEBUG_ONLY_MEMBERS(a) a; - - -/* Stack and buffer dumping */ - -#define DUMP_STACK_ENTRY(a) acpi_aml_dump_operand(a) -#define DUMP_OPERANDS(a,b,c,d,e) acpi_aml_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) - - -#define DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) -#define DUMP_TABLES(a,b) acpi_ns_dump_tables(a,b) -#define DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) -#define BREAK_MSG(a) acpi_os_breakpoint (a) - -/* - * Generate INT3 on ACPI_ERROR (Debug only!) - */ - -#define ERROR_BREAK -#ifdef ERROR_BREAK -#define BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) acpi_os_breakpoint("Fatal error encountered\n") -#else -#define BREAK_ON_ERROR(lvl) -#endif - -/* - * Master debug print macros - * Print iff: - * 1) Debug print for the current component is enabled - * 2) Debug error level or trace level for the print statement is enabled - * - */ - -#define PARAM_LIST(pl) pl - -#define TEST_DEBUG_SWITCH(lvl) if (((lvl) & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)) - -#define DEBUG_PRINT(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ - debug_print_prefix (_THIS_MODULE,__LINE__);\ - debug_print_raw PARAM_LIST(fp);\ - BREAK_ON_ERROR(lvl);} - -#define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ - debug_print_raw PARAM_LIST(fp);} - - -/* Assert macros */ - -#define ACPI_ASSERT(exp) if(!(exp)) \ - acpi_os_dbg_assert(#exp, __FILE__, __LINE__, "Failed Assertion") - -#define DEBUG_ASSERT(msg, exp) if(!(exp)) \ - acpi_os_dbg_assert(#exp, __FILE__, __LINE__, msg) - - -#else -/* - * This is the non-debug case -- make everything go away, - * leaving no executable debug code! - */ - -#define MODULE_NAME(name) -#define _THIS_MODULE "" - -#define DEBUG_EXEC(a) -#define NORMAL_EXEC(a) a; - -#define DEBUG_DEFINE(a) -#define DEBUG_ONLY_MEMBERS(a) -#define FUNCTION_TRACE(a) -#define FUNCTION_TRACE_PTR(a,b) -#define FUNCTION_TRACE_U32(a,b) -#define FUNCTION_TRACE_STR(a,b) -#define FUNCTION_EXIT -#define FUNCTION_STATUS_EXIT(s) -#define FUNCTION_VALUE_EXIT(s) -#define DUMP_STACK_ENTRY(a) -#define DUMP_OPERANDS(a,b,c,d,e) -#define DUMP_ENTRY(a,b) -#define DUMP_TABLES(a,b) -#define DUMP_PATHNAME(a,b,c,d) -#define DEBUG_PRINT(l,f) -#define DEBUG_PRINT_RAW(l,f) -#define BREAK_MSG(a) - -#define return_VOID return -#define return_ACPI_STATUS(s) return(s) -#define return_VALUE(s) return(s) -#define return_PTR(s) return(s) - -#define ACPI_ASSERT(exp) -#define DEBUG_ASSERT(msg, exp) - -#endif - - -/* - * For 16-bit code, we want to shrink some things even though - * we are using ACPI_DEBUG to get the debug output - */ -#ifdef _IA16 -#undef DEBUG_ONLY_MEMBERS -#define DEBUG_ONLY_MEMBERS(a) -#undef OP_INFO_ENTRY -#define OP_INFO_ENTRY(opcode,flags,name,Pargs,Iargs) {opcode,flags,Pargs,Iargs} -#endif - - -#ifndef ACPI_DEBUG - -#define ADD_OBJECT_NAME(a,b) - -#else - - -/* - * 1) Set name to blanks - * 2) Copy the object name - */ - -#define ADD_OBJECT_NAME(a,b) MEMSET (a->common.name, ' ', sizeof (a->common.name));\ - STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) - -#endif - - -#endif /* MACROS_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/namesp.h linux/drivers/acpi/include/namesp.h --- v2.4.0-test8/linux/drivers/acpi/include/namesp.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/namesp.h Wed Dec 31 16:00:00 1969 @@ -1,424 +0,0 @@ - -/****************************************************************************** - * - * Name: namesp.h - Namespace subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __NAMESPACE_H__ -#define __NAMESPACE_H__ - -#include "actables.h" - - -/* To search the entire name space, pass this as Search_base */ - -#define NS_ALL ((ACPI_HANDLE)0) - -/* - * Elements of Acpi_ns_properties are bit significant - * and should be one-to-one with values of ACPI_OBJECT_TYPE - */ -#define NSP_NORMAL 0 -#define NSP_NEWSCOPE 1 /* a definition of this type opens a name scope */ -#define NSP_LOCAL 2 /* suppress search of enclosing scopes */ - - -/* Definitions of the predefined namespace names */ - -#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (u32) 0x2F202020 /* Root name is "/ " */ -#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */ - -#define NS_ROOT_PATH "/" -#define NS_SYSTEM_BUS "_SB_" - - -/* Flags for Acpi_ns_lookup, Acpi_ns_search_and_enter */ - -#define NS_NO_UPSEARCH 0 -#define NS_SEARCH_PARENT 0x01 -#define NS_DONT_OPEN_SCOPE 0x02 -#define NS_NO_PEER_SEARCH 0x04 - -#define NS_WALK_UNLOCK TRUE -#define NS_WALK_NO_UNLOCK FALSE - - -ACPI_STATUS -acpi_ns_walk_namespace ( - OBJECT_TYPE_INTERNAL type, - ACPI_HANDLE start_object, - u32 max_depth, - u8 unlock_before_callback, - WALK_CALLBACK user_function, - void *context, - void **return_value); - - -ACPI_NAMED_OBJECT* -acpi_ns_get_next_object ( - OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT *parent, - ACPI_NAMED_OBJECT *child); - - -ACPI_STATUS -acpi_ns_delete_namespace_by_owner ( - u16 table_id); - -void -acpi_ns_free_table_entry ( - ACPI_NAMED_OBJECT *entry); - - -/* Namespace loading - nsload */ - -ACPI_STATUS -acpi_ns_parse_table ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAME_TABLE *scope); - -ACPI_STATUS -acpi_ns_load_table ( - ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *entry); - -ACPI_STATUS -acpi_ns_load_table_by_type ( - ACPI_TABLE_TYPE table_type); - - -/* - * Top-level namespace access - nsaccess - */ - - -ACPI_STATUS -acpi_ns_root_initialize ( - void); - -ACPI_STATUS -acpi_ns_lookup ( - ACPI_GENERIC_STATE *scope_info, - char *name, - OBJECT_TYPE_INTERNAL type, - OPERATING_MODE interpreter_mode, - u32 flags, - ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT **ret_entry); - - -/* - * Table allocation/deallocation - nsalloc - */ - -ACPI_NAME_TABLE * -acpi_ns_allocate_name_table ( - u32 num_entries); - -ACPI_STATUS -acpi_ns_delete_namespace_subtree ( - ACPI_NAMED_OBJECT *parent_handle); - -void -acpi_ns_detach_object ( - ACPI_HANDLE object); - -void -acpi_ns_delete_name_table ( - ACPI_NAME_TABLE *name_table); - - -/* - * Namespace modification - nsmodify - */ - -ACPI_STATUS -acpi_ns_unload_namespace ( - ACPI_HANDLE handle); - -ACPI_STATUS -acpi_ns_delete_subtree ( - ACPI_HANDLE start_handle); - - -/* - * Namespace dump/print utilities - nsdump - */ - -void -acpi_ns_dump_tables ( - ACPI_HANDLE search_base, - s32 max_depth); - -void -acpi_ns_dump_entry ( - ACPI_HANDLE handle, - u32 debug_level); - -ACPI_STATUS -acpi_ns_dump_pathname ( - ACPI_HANDLE handle, - char *msg, - u32 level, - u32 component); - -void -acpi_ns_dump_root_devices ( - void); - -void -acpi_ns_dump_objects ( - OBJECT_TYPE_INTERNAL type, - u32 max_depth, - u32 ownder_id, - ACPI_HANDLE start_handle); - - -/* - * Namespace evaluation functions - nseval - */ - -ACPI_STATUS -acpi_ns_evaluate_by_handle ( - ACPI_NAMED_OBJECT *object_nte, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_evaluate_by_name ( - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_evaluate_relative ( - ACPI_NAMED_OBJECT *object_nte, - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object); - -ACPI_STATUS -acpi_ns_execute_control_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - -ACPI_STATUS -acpi_ns_get_object_value ( - ACPI_NAMED_OBJECT *object_entry, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -/* - * Parent/Child/Peer utility functions - nsfamily - */ - -ACPI_NAME -acpi_ns_find_parent_name ( - ACPI_NAMED_OBJECT *entry_to_search); - -u8 -acpi_ns_exist_downstream_sibling ( - ACPI_NAMED_OBJECT *this_entry); - - -/* - * Scope manipulation - nsscope - */ - -s32 -acpi_ns_opens_scope ( - OBJECT_TYPE_INTERNAL type); - -char * -acpi_ns_name_of_scope ( - ACPI_NAME_TABLE *scope); - -char * -acpi_ns_name_of_current_scope ( - ACPI_WALK_STATE *walk_state); - -ACPI_STATUS -acpi_ns_handle_to_pathname ( - ACPI_HANDLE obj_handle, - u32 *buf_size, - char *user_buffer); - -u8 -acpi_ns_pattern_match ( - ACPI_NAMED_OBJECT *obj_entry, - char *search_for); - -ACPI_STATUS -acpi_ns_name_compare ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value); - -void -acpi_ns_low_find_names ( - ACPI_NAMED_OBJECT *this_entry, - char *search_for, - s32 *count, - ACPI_HANDLE list[], - s32 max_depth); - -ACPI_HANDLE * -acpi_ns_find_names ( - char *search_for, - ACPI_HANDLE search_base, - s32 max_depth); - -ACPI_STATUS -acpi_ns_get_named_object ( - char *pathname, - ACPI_NAME_TABLE *in_scope, - ACPI_NAMED_OBJECT **out_nte); - -/* - * Object management for NTEs - nsobject - */ - -ACPI_STATUS -acpi_ns_attach_method ( - ACPI_HANDLE obj_handle, - u8 *pcode_addr, - u32 pcode_length); - -ACPI_STATUS -acpi_ns_attach_object ( - ACPI_HANDLE obj_handle, - ACPI_HANDLE value, - OBJECT_TYPE_INTERNAL type); - - -void * -acpi_ns_compare_value ( - ACPI_HANDLE obj_handle, - u32 level, - void *obj_desc); - -ACPI_HANDLE -acpi_ns_find_attached_object ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_HANDLE search_base, - s32 max_depth); - - -/* - * Namespace searching and entry - nssearch - */ - -ACPI_STATUS -acpi_ns_search_and_enter ( - u32 entry_name, - ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, - OPERATING_MODE interpreter_mode, - OBJECT_TYPE_INTERNAL type, - u32 flags, - ACPI_NAMED_OBJECT **ret_entry); - -void -acpi_ns_initialize_table ( - ACPI_NAME_TABLE *new_table, - ACPI_NAME_TABLE *parent_scope, - ACPI_NAMED_OBJECT *parent_entry); - -ACPI_STATUS -acpi_ns_search_one_scope ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, - OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry, - NS_SEARCH_DATA *ret_info); - - -/* - * Utility functions - nsutils - */ - -u8 -acpi_ns_valid_root_prefix ( - char prefix); - -u8 -acpi_ns_valid_path_separator ( - char sep); - -OBJECT_TYPE_INTERNAL -acpi_ns_get_type ( - ACPI_HANDLE obj_handle); - -void * -acpi_ns_get_attached_object ( - ACPI_HANDLE obj_handle); - -s32 -acpi_ns_local ( - OBJECT_TYPE_INTERNAL type); - -ACPI_STATUS -acpi_ns_internalize_name ( - char *dotted_name, - char **converted_name); - -ACPI_STATUS -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name); - -s32 -is_ns_object ( - ACPI_OBJECT_INTERNAL *p_oD); - -s32 -acpi_ns_mark_nS( - void); - -ACPI_NAMED_OBJECT* -acpi_ns_convert_handle_to_entry ( - ACPI_HANDLE handle); - -ACPI_HANDLE -acpi_ns_convert_entry_to_handle( - ACPI_NAMED_OBJECT*nte); - -void -acpi_ns_terminate ( - void); - -ACPI_NAMED_OBJECT * -acpi_ns_get_parent_entry ( - ACPI_NAMED_OBJECT *this_entry); - - -ACPI_NAMED_OBJECT * -acpi_ns_get_next_valid_entry ( - ACPI_NAMED_OBJECT *this_entry); - - -#endif /* __NAMESPACE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/output.h linux/drivers/acpi/include/output.h --- v2.4.0-test8/linux/drivers/acpi/include/output.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/output.h Wed Dec 31 16:00:00 1969 @@ -1,124 +0,0 @@ - -/****************************************************************************** - * - * Name: output.h -- debug output - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef _OUTPUT_H -#define _OUTPUT_H - -/* - * Debug levels and component IDs. These are used to control the - * granularity of the output of the DEBUG_PRINT macro -- on a per- - * component basis and a per-exception-type basis. - */ - -/* Component IDs -- used in the global "Debug_layer" */ - -#define GLOBAL 0x00000001 -#define COMMON 0x00000002 -#define PARSER 0x00000004 -#define DISPATCHER 0x00000008 -#define INTERPRETER 0x00000010 -#define NAMESPACE 0x00000020 -#define RESOURCE_MANAGER 0x00000040 -#define TABLE_MANAGER 0x00000080 -#define EVENT_HANDLING 0x00000100 -#define HARDWARE 0x00000200 -#define MISCELLANEOUS 0x00000400 -#define OS_DEPENDENT 0x00000800 - -#define BUS_MANAGER 0x00001000 - -#define PROCESSOR_CONTROL 0x00002000 -#define SYSTEM_CONTROL 0x00004000 -#define THERMAL_CONTROL 0x00008000 -#define POWER_CONTROL 0x00010000 - -#define EMBEDDED_CONTROLLER 0x00020000 -#define BATTERY 0x00040000 - -#define DEBUGGER 0x00100000 -#define ALL_COMPONENTS 0x001FFFFF - - -/* Exception level -- used in the global "Debug_level" */ - -#define ACPI_OK 0x00000001 -#define ACPI_INFO 0x00000002 -#define ACPI_WARN 0x00000004 -#define ACPI_ERROR 0x00000008 -#define ACPI_FATAL 0x00000010 -#define ACPI_DEBUG_OBJECT 0x00000020 -#define ACPI_ALL 0x0000003F - - -/* Trace level -- also used in the global "Debug_level" */ - -#define TRACE_PARSE 0x00000100 -#define TRACE_DISPATCH 0x00000200 -#define TRACE_LOAD 0x00000400 -#define TRACE_EXEC 0x00000800 -#define TRACE_NAMES 0x00001000 -#define TRACE_OPREGION 0x00002000 -#define TRACE_BFIELD 0x00004000 -#define TRACE_TRASH 0x00008000 -#define TRACE_TABLES 0x00010000 -#define TRACE_FUNCTIONS 0x00020000 -#define TRACE_VALUES 0x00040000 -#define TRACE_OBJECTS 0x00080000 -#define TRACE_ALLOCATIONS 0x00100000 -#define TRACE_RESOURCES 0x00200000 -#define TRACE_IO 0x00400000 -#define TRACE_INTERRUPTS 0x00800000 -#define TRACE_USER_REQUESTS 0x01000000 -#define TRACE_PACKAGE 0x02000000 -#define TRACE_MUTEX 0x04000000 - -#define TRACE_ALL 0x0FFFFF00 - - -/* Exceptionally verbose output -- also used in the global "Debug_level" */ - -#define VERBOSE_AML_DISASSEMBLE 0x10000000 -#define VERBOSE_INFO 0x20000000 -#define VERBOSE_TABLES 0x40000000 -#define VERBOSE_EVENTS 0x80000000 - -#define VERBOSE_ALL 0x70000000 - - -/* Defaults for Debug_level, debug and normal */ - -#define DEBUG_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT | TRACE_TABLES | TRACE_IO) -#define NORMAL_DEFAULT (ACPI_OK | ACPI_WARN | ACPI_ERROR | ACPI_DEBUG_OBJECT) -#define DEBUG_ALL (VERBOSE_AML_DISASSEMBLE | TRACE_ALL | ACPI_ALL) - -/* Misc defines */ - -#define HEX 0x01 -#define ASCII 0x02 -#define FULL_ADDRESS 0x04 -#define CHARS_PER_LINE 16 /* used in Dump_buf function */ - - -#endif /* _OUTPUT_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/parser.h linux/drivers/acpi/include/parser.h --- v2.4.0-test8/linux/drivers/acpi/include/parser.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/parser.h Wed Dec 31 16:00:00 1969 @@ -1,327 +0,0 @@ -/****************************************************************************** - * - * Module Name: parser.h - AML Parser subcomponent prototypes and defines - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - - -#ifndef _PARSER_H_ -#define _PARSER_H_ - - -#define OP_HAS_RETURN_VALUE 1 - -/* variable # arguments */ - -#define ACPI_VAR_ARGS ACPI_UINT32_MAX - -/* maximum virtual address */ - -#define ACPI_MAX_AML ((u8 *)(~0UL)) - - -#define PARSE_DELETE_TREE 1 - - -/* psapi - Parser external interfaces */ - -ACPI_STATUS -acpi_psx_load_table ( - u8 *pcode_addr, - s32 pcode_length); - -ACPI_STATUS -acpi_psx_execute ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc); - - -u8 -acpi_ps_is_namespace_object_op ( - u16 opcode); -u8 -acpi_ps_is_namespace_op ( - u16 opcode); - - -/****************************************************************************** - * - * Parser interfaces - * - *****************************************************************************/ - - -/* psargs - Parse AML opcode arguments */ - -u8 * -acpi_ps_get_next_package_end ( - ACPI_PARSE_STATE *parser_state); - -char * -acpi_ps_get_next_namestring ( - ACPI_PARSE_STATE *parser_state); - -void -acpi_ps_get_next_simple_arg ( - ACPI_PARSE_STATE *parser_state, - s32 arg_type, /* type of argument */ - ACPI_GENERIC_OP *arg); /* (OUT) argument data */ - -void -acpi_ps_get_next_namepath ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, - u32 *arg_count, - u8 method_call); - -ACPI_GENERIC_OP * -acpi_ps_get_next_field ( - ACPI_PARSE_STATE *parser_state); - -ACPI_GENERIC_OP * -acpi_ps_get_next_arg ( - ACPI_PARSE_STATE *parser_state, - s32 arg_type, - u32 *arg_count); - - -/* psopcode - AML Opcode information */ - -ACPI_OP_INFO * -acpi_ps_get_opcode_info ( - u16 opcode); - -char * -acpi_ps_get_opcode_name ( - u16 opcode); - - -/* psparse - top level parsing routines */ - -void -acpi_ps_delete_parse_tree ( - ACPI_GENERIC_OP *root); - -ACPI_STATUS -acpi_ps_parse_loop ( - ACPI_PARSE_STATE *parser_state, - ACPI_WALK_STATE *walk_state, - u32 parse_flags); - - -ACPI_STATUS -acpi_ps_parse_aml ( - ACPI_GENERIC_OP *start_scope, - u8 *aml, - u32 acpi_aml_size, - u32 parse_flags); - -ACPI_STATUS -acpi_ps_parse_table ( - u8 *aml, - s32 aml_size, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback, - ACPI_GENERIC_OP **root_object); - -u16 -acpi_ps_peek_opcode ( - ACPI_PARSE_STATE *state); - - -/* psscope - Scope stack management routines */ - - -ACPI_STATUS -acpi_ps_init_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *root); - -ACPI_GENERIC_OP * -acpi_ps_get_parent_scope ( - ACPI_PARSE_STATE *state); - -u8 -acpi_ps_has_completed_scope ( - ACPI_PARSE_STATE *parser_state); - -void -acpi_ps_pop_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP **op, - u32 *arg_list); - -ACPI_STATUS -acpi_ps_push_scope ( - ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *op, - u32 remaining_args, - u32 arg_count); - -void -acpi_ps_cleanup_scope ( - ACPI_PARSE_STATE *state); - - -/* pstree - parse tree manipulation routines */ - -void -acpi_ps_append_arg( - ACPI_GENERIC_OP *op, - ACPI_GENERIC_OP *arg); - -ACPI_GENERIC_OP* -acpi_ps_find ( - ACPI_GENERIC_OP *scope, - char *path, - u16 opcode, - u32 create); - -ACPI_GENERIC_OP * -acpi_ps_get_arg( - ACPI_GENERIC_OP *op, - u32 argn); - -ACPI_GENERIC_OP * -acpi_ps_get_child ( - ACPI_GENERIC_OP *op); - -ACPI_GENERIC_OP * -acpi_ps_get_depth_next ( - ACPI_GENERIC_OP *origin, - ACPI_GENERIC_OP *op); - - -/* pswalk - parse tree walk routines */ - -ACPI_STATUS -acpi_ps_walk_parsed_aml ( - ACPI_GENERIC_OP *start_op, - ACPI_GENERIC_OP *end_op, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_NAME_TABLE *start_scope, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **caller_return_desc, - ACPI_OWNER_ID owner_id, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback); - -ACPI_STATUS -acpi_ps_get_next_walk_op ( - ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - INTERPRETER_CALLBACK ascending_callback); - - -/* psutils - parser utilities */ - -void -acpi_ps_init_op ( - ACPI_GENERIC_OP *op, - u16 opcode); - -ACPI_GENERIC_OP * -acpi_ps_alloc_op ( - u16 opcode); - -void -acpi_ps_free_op ( - ACPI_GENERIC_OP *op); - -void -acpi_ps_delete_parse_cache ( - void); - -u8 -acpi_ps_is_leading_char ( - s32 c); - -u8 -acpi_ps_is_prefix_char ( - s32 c); - -u8 -acpi_ps_is_named_op ( - u16 opcode); - -u8 -acpi_ps_is_named_object_op ( - u16 opcode); - -u8 -acpi_ps_is_deferred_op ( - u16 opcode); - -u8 -acpi_ps_is_bytelist_op( - u16 opcode); - -u8 -acpi_ps_is_field_op( - u16 opcode); - -u8 -acpi_ps_is_create_field_op ( - u16 opcode); - -ACPI_NAMED_OP* -acpi_ps_to_named_op( - ACPI_GENERIC_OP *op); - -ACPI_DEFERRED_OP * -acpi_ps_to_deferred_op ( - ACPI_GENERIC_OP *op); - -ACPI_BYTELIST_OP* -acpi_ps_to_bytelist_op( - ACPI_GENERIC_OP *op); - -u32 -acpi_ps_get_name( - ACPI_GENERIC_OP *op); - -void -acpi_ps_set_name( - ACPI_GENERIC_OP *op, - u32 name); - - -/* psdump - display parser tree */ - -s32 -acpi_ps_sprint_path ( - char *buffer_start, - u32 buffer_size, - ACPI_GENERIC_OP *op); - -s32 -acpi_ps_sprint_op ( - char *buffer_start, - u32 buffer_size, - ACPI_GENERIC_OP *op); - -void -acpi_ps_show ( - ACPI_GENERIC_OP *op); - - -#endif /* _PARSER_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/resource.h linux/drivers/acpi/include/resource.h --- v2.4.0-test8/linux/drivers/acpi/include/resource.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/resource.h Wed Dec 31 16:00:00 1969 @@ -1,300 +0,0 @@ -/****************************************************************************** - * - * Name: resource.h - Resource Manager function prototypes - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __RESOURCE_H__ -#define __RESOURCE_H__ - -#include "actypes.h" -#include "acobject.h" - -/* - * Function prototypes called from Acpi* APIs - */ - -ACPI_STATUS -acpi_rs_get_prt_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - - -ACPI_STATUS -acpi_rs_get_crs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_get_prs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_set_srs_method_data ( - ACPI_HANDLE handle, - ACPI_BUFFER *ret_buffer); - -ACPI_STATUS -acpi_rs_create_resource_list ( - ACPI_OBJECT_INTERNAL *byte_stream_buffer, - u8 *output_buffer, - u32 *output_buffer_length); - -ACPI_STATUS -acpi_rs_create_byte_stream ( - RESOURCE *linked_list_buffer, - u8 *output_buffer, - u32 *output_buffer_length); - -ACPI_STATUS -acpi_rs_create_pci_routing_table ( - ACPI_OBJECT_INTERNAL *method_return_object, - u8 *output_buffer, - u32 *output_buffer_length); - - -/* - *Function prototypes called from Acpi_rs_create*APIs - */ - -void -acpi_rs_dump_resource_list ( - RESOURCE *resource); - -void -acpi_rs_dump_irq_list ( - u8 *route_table); - -ACPI_STATUS -acpi_rs_get_byte_stream_start ( - u8 *byte_stream_buffer, - u8 **byte_stream_start, - u32 *size); - -ACPI_STATUS -acpi_rs_calculate_list_length ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u32 *size_needed); - -ACPI_STATUS -acpi_rs_calculate_byte_stream_length ( - RESOURCE *linked_list_buffer, - u32 *size_needed); - -ACPI_STATUS -acpi_rs_byte_stream_to_list ( - u8 *byte_stream_buffer, - u32 byte_stream_buffer_length, - u8 **output_buffer); - -ACPI_STATUS -acpi_rs_list_to_byte_stream ( - RESOURCE *linked_list, - u32 byte_stream_size_needed, - u8 **output_buffer); - -ACPI_STATUS -acpi_rs_io_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_fixed_io_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_io_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_fixed_io_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_irq_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_irq_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_dma_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_dma_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_address16_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_address16_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_address32_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_address32_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_start_dependent_functions_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_end_dependent_functions_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_start_dependent_functions_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_end_dependent_functions_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_memory24_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_memory24_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_memory32_range_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size -); - -ACPI_STATUS -acpi_rs_fixed_memory32_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_memory32_range_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_fixed_memory32_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_extended_irq_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_extended_irq_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_end_tag_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_end_tag_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - -ACPI_STATUS -acpi_rs_vendor_resource ( - u8 *byte_stream_buffer, - u32 *bytes_consumed, - u8 **output_buffer, - u32 *structure_size); - -ACPI_STATUS -acpi_rs_vendor_stream ( - RESOURCE *linked_list, - u8 **output_buffer, - u32 *bytes_consumed); - - -#endif /*__RESOURCE_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/include/tables.h linux/drivers/acpi/include/tables.h --- v2.4.0-test8/linux/drivers/acpi/include/tables.h Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/include/tables.h Wed Dec 31 16:00:00 1969 @@ -1,168 +0,0 @@ - -/****************************************************************************** - * - * Name: tables.h - ACPI table management - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 R. Byron Moore - * - * 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 - */ - -#ifndef __TABLES_H__ -#define __TABLES_H__ - -#include "actypes.h" -#include "actables.h" - - -/* Used in Acpi_tb_map_acpi_table for size parameter if table header is to be used */ - -#define SIZE_IN_HEADER 0 - - -ACPI_STATUS -acpi_tb_handle_to_object ( - u16 table_id, - ACPI_TABLE_DESC **table_desc); - - -/* - * Acpi_tbfac - FACP, FACS utilities - */ - -ACPI_STATUS -acpi_tb_get_table_facs ( - char *buffer_ptr, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbget - Table "get" routines - */ - -ACPI_STATUS -acpi_tb_get_table_ptr ( - ACPI_TABLE_TYPE table_type, - u32 instance, - ACPI_TABLE_HEADER **table_ptr_loc); - -ACPI_STATUS -acpi_tb_get_table ( - void *physical_address, - char *buffer_ptr, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbgetall - Get all firmware ACPI tables - */ - -ACPI_STATUS -acpi_tb_get_all_tables ( - u32 number_of_tables, - char *buffer_ptr); - - -/* - * Acpi_tbinstall - Table installation - */ - -ACPI_STATUS -acpi_tb_install_table ( - char *table_ptr, - ACPI_TABLE_DESC *table_info); - -ACPI_STATUS -acpi_tb_recognize_table ( - char *table_ptr, - ACPI_TABLE_DESC *table_info); - -ACPI_STATUS -acpi_tb_init_table_descriptor ( - ACPI_TABLE_TYPE table_type, - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbremove - Table removal and deletion - */ - -void -acpi_tb_delete_acpi_tables ( - void); - -void -acpi_tb_delete_acpi_table ( - ACPI_TABLE_TYPE type); - -ACPI_TABLE_DESC * -acpi_tb_delete_single_table ( - ACPI_TABLE_DESC *table_desc); - -void -acpi_tb_free_acpi_tables_of_type ( - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbrsd - RSDP, RSDT utilities - */ - -ACPI_STATUS -acpi_tb_get_table_rsdt ( - u32 *number_of_tables); - -char * -acpi_tb_scan_memory_for_rsdp ( - char *start_address, - u32 length); - -ACPI_STATUS -acpi_tb_find_rsdp ( - ACPI_TABLE_DESC *table_info); - - -/* - * Acpi_tbutils - common table utilities - */ - -u8 -acpi_tb_system_table_pointer ( - void *where); - -ACPI_STATUS -acpi_tb_map_acpi_table ( - void *physical_address, - u32 *size, - void **logical_address); - -ACPI_STATUS -acpi_tb_verify_table_checksum ( - ACPI_TABLE_HEADER *table_header); - -u8 -acpi_tb_checksum ( - void *buffer, - u32 length); - -ACPI_STATUS -acpi_tb_validate_table_header ( - ACPI_TABLE_HEADER *table_header); - - -#endif /* __TABLES_H__ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/Makefile linux/drivers/acpi/interpreter/Makefile --- v2.4.0-test8/linux/drivers/acpi/interpreter/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/interpreter/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amconfig.c linux/drivers/acpi/interpreter/amconfig.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amconfig.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amconfig.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes) + * $Revision: 23 $ * *****************************************************************************/ @@ -25,17 +25,17 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" -#include "tables.h" -#include "dispatch.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amconfig"); + MODULE_NAME ("amconfig") /***************************************************************************** @@ -53,13 +53,13 @@ ACPI_STATUS acpi_aml_exec_load_table ( - ACPI_OBJECT_INTERNAL *rgn_desc, + ACPI_OPERAND_OBJECT *rgn_desc, ACPI_HANDLE *ddb_handle) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *table_desc = NULL; - char *table_ptr; - char *table_data_ptr; + ACPI_OPERAND_OBJECT *table_desc = NULL; + u8 *table_ptr; + u8 *table_data_ptr; ACPI_TABLE_HEADER table_header; ACPI_TABLE_DESC table_info; u32 i; @@ -73,7 +73,7 @@ table_header.length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, - i, 8, (u32 *) ((char *) &table_header + i)); + i, 8, (u32 *) ((u8 *) &table_header + i)); if (ACPI_FAILURE (status)) { return (status); } @@ -184,16 +184,19 @@ ACPI_HANDLE ddb_handle) { ACPI_STATUS status = AE_NOT_IMPLEMENTED; - ACPI_OBJECT_INTERNAL *table_desc = (ACPI_OBJECT_INTERNAL *) ddb_handle; + ACPI_OPERAND_OBJECT *table_desc = (ACPI_OPERAND_OBJECT *) ddb_handle; ACPI_TABLE_DESC *table_info; /* Validate the handle */ - /* TBD: [Errors] Wasn't this done earlier? */ + /* Although the handle is partially validated in Acpi_aml_exec_reconfiguration(), + * when it calls Acpi_aml_resolve_operands(), the handle is more completely + * validated here. + */ if ((!ddb_handle) || (!VALID_DESCRIPTOR_TYPE (ddb_handle, ACPI_DESC_TYPE_INTERNAL)) || - (((ACPI_OBJECT_INTERNAL *)ddb_handle)->common.type != + (((ACPI_OPERAND_OBJECT *)ddb_handle)->common.type != INTERNAL_TYPE_REFERENCE)) { return (AE_BAD_PARAMETER); @@ -205,7 +208,7 @@ table_info = (ACPI_TABLE_DESC *) table_desc->reference.object; /* - * Delete the entire namespace under this table NTE + * Delete the entire namespace under this table Node * (Offset contains the Table_id) */ @@ -245,16 +248,16 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *region_desc = NULL; + ACPI_OPERAND_OBJECT *region_desc = NULL; ACPI_HANDLE *ddb_handle; /* Resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the table handle, common for both opcodes */ - status |= acpi_ds_obj_stack_pop_object ((ACPI_OBJECT_INTERNAL **) &ddb_handle, + status |= acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &ddb_handle, walk_state); switch (opcode) @@ -265,22 +268,19 @@ /* Get the region or field descriptor */ status |= acpi_ds_obj_stack_pop_object (®ion_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); - goto cleanup2; + if (ACPI_FAILURE (status)) { + acpi_cm_remove_reference (region_desc); + return (status); } status = acpi_aml_exec_load_table (region_desc, ddb_handle); break; - case AML_UN_LOAD_OP: + case AML_UNLOAD_OP: - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 1); - goto cleanup1; + if (ACPI_FAILURE (status)) { + return (status); } status = acpi_aml_exec_unload_table (ddb_handle); @@ -294,10 +294,6 @@ } -cleanup2: - acpi_cm_remove_reference (region_desc); - -cleanup1: return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amcreate.c linux/drivers/acpi/interpreter/amcreate.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amcreate.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amcreate.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amcreate - Named object creation + * $Revision: 44 $ * *****************************************************************************/ @@ -25,19 +25,19 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" -#include "dispatch.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amcreate"); + MODULE_NAME ("amcreate") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_aml_exec_create_field * @@ -64,19 +64,19 @@ * Num_bits := Term_arg=>Integer * Source_buff := Term_arg=>Buffer * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_aml_exec_create_field ( u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *res_desc = NULL; - ACPI_OBJECT_INTERNAL *cnt_desc = NULL; - ACPI_OBJECT_INTERNAL *off_desc = NULL; - ACPI_OBJECT_INTERNAL *src_desc = NULL; - ACPI_OBJECT_INTERNAL *field_desc; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *res_desc = NULL; + ACPI_OPERAND_OBJECT *cnt_desc = NULL; + ACPI_OPERAND_OBJECT *off_desc = NULL; + ACPI_OPERAND_OBJECT *src_desc = NULL; + ACPI_OPERAND_OBJECT *field_desc; + ACPI_OPERAND_OBJECT *obj_desc; OBJECT_TYPE_INTERNAL res_type; ACPI_STATUS status; u32 num_operands = 3; @@ -88,7 +88,7 @@ /* Resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the operands */ @@ -101,11 +101,9 @@ status |= acpi_ds_obj_stack_pop_object (&off_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&src_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 3); goto cleanup; } @@ -288,16 +286,17 @@ if (obj_desc) { /* * There is an existing object here; delete it and zero out the - * NTE + * object field within the Node */ acpi_cm_remove_reference (obj_desc); - acpi_ns_attach_object (res_desc, NULL, ACPI_TYPE_ANY); + acpi_ns_attach_object ((ACPI_NAMESPACE_NODE *) res_desc, NULL, + ACPI_TYPE_ANY); } /* Set the type to ANY (or the store below will fail) */ - ((ACPI_NAMED_OBJECT*) res_desc)->type = ACPI_TYPE_ANY; + ((ACPI_NAMESPACE_NODE *) res_desc)->type = ACPI_TYPE_ANY; break; @@ -310,7 +309,7 @@ /* Store constructed field descriptor in result location */ - status = acpi_aml_exec_store (field_desc, res_desc); + status = acpi_aml_exec_store (field_desc, res_desc, walk_state); /* * If the field descriptor was not physically stored (or if a failure @@ -358,39 +357,41 @@ acpi_aml_exec_create_alias ( ACPI_WALK_STATE *walk_state) { - ACPI_NAMED_OBJECT *src_entry; - ACPI_NAMED_OBJECT *alias_entry; + ACPI_NAMESPACE_NODE *source_node; + ACPI_NAMESPACE_NODE *alias_node; ACPI_STATUS status; /* Get the source/alias operands (both NTEs) */ - status = acpi_ds_obj_stack_pop_object ((ACPI_OBJECT_INTERNAL **) &src_entry, + status = acpi_ds_obj_stack_pop_object ((ACPI_OPERAND_OBJECT **) &source_node, walk_state); if (ACPI_FAILURE (status)) { return (status); } - /* Don't pop it, it gets popped later */ + /* + * Don't pop it, it gets removed in the calling routine + */ - alias_entry = acpi_ds_obj_stack_get_value (0, walk_state); + alias_node = acpi_ds_obj_stack_get_value (0, walk_state); /* Add an additional reference to the object */ - acpi_cm_add_reference (src_entry->object); + acpi_cm_add_reference (source_node->object); /* - * Attach the original source NTE to the new Alias NTE. + * Attach the original source Node to the new Alias Node. */ - status = acpi_ns_attach_object (alias_entry, src_entry->object, - src_entry->type); + status = acpi_ns_attach_object (alias_node, source_node->object, + source_node->type); /* * The new alias assumes the type of the source, but it points * to the same object. The reference count of the object has two * additional references to prevent deletion out from under either the - * source or the alias NTE + * source or the alias Node */ /* Since both operands are NTEs, we don't need to delete them */ @@ -416,7 +417,7 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; BREAKPOINT3; @@ -438,7 +439,7 @@ goto cleanup; } - /* Attach object to the NTE */ + /* Attach object to the Node */ status = acpi_ns_attach_object (acpi_ds_obj_stack_get_value (0, walk_state), obj_desc, (u8) ACPI_TYPE_EVENT); @@ -473,8 +474,8 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *sync_desc; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *sync_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* Get the operand */ @@ -546,22 +547,27 @@ ACPI_WALK_STATE *walk_state) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc_region; - ACPI_HANDLE *entry; + ACPI_OPERAND_OBJECT *obj_desc_region; + ACPI_NAMESPACE_NODE *node; if (region_space >= NUM_REGION_TYPES) { - /* TBD: [Errors] should this return an error, or should we just keep - * going? */ + /* TBD: [Future] In ACPI 2.0, valid region space + * includes types 0-6 (Adding CMOS and PCIBARTarget). + * Also, types 0x80-0xff are defined as "OEM Region + * Space handler" + * + * Should this return an error, or should we just keep + * going? How do we handle the OEM region handlers? + */ REPORT_WARNING ("Unable to decode the Region_space"); } - /* Get the NTE from the object stack */ - - entry = acpi_ds_obj_stack_get_value (0, walk_state); + /* Get the Node from the object stack */ + node = (ACPI_NAMESPACE_NODE *) acpi_ds_obj_stack_get_value (0, walk_state); /* Create the region descriptor */ @@ -583,10 +589,9 @@ /* Init the region from the operands */ - obj_desc_region->region.space_id = (u16) region_space; + obj_desc_region->region.space_id = (u8) region_space; obj_desc_region->region.address = 0; obj_desc_region->region.length = 0; - obj_desc_region->region.region_flags = 0; /* * Remember location in AML stream of address & length @@ -596,19 +601,38 @@ obj_desc_region->region.method->method.pcode_length = aml_length; - /* Install the new region object in the parent NTE */ + /* Install the new region object in the parent Node */ - obj_desc_region->region.nte = (ACPI_NAMED_OBJECT*) entry; + obj_desc_region->region.node = node; - status = acpi_ns_attach_object (entry, obj_desc_region, + status = acpi_ns_attach_object (node, obj_desc_region, (u8) ACPI_TYPE_REGION); + if (ACPI_FAILURE (status)) { goto cleanup; } + /* + * If we have a valid region, initialize it + * Namespace is NOT locked at this point. + */ + + status = acpi_ev_initialize_region (obj_desc_region, FALSE); + + if (ACPI_FAILURE (status)) { + /* + * If AE_NOT_EXIST is returned, it is not fatal + * because many regions get created before a handler + * is installed for said region. + */ + if (AE_NOT_EXIST == status) { + status = AE_OK; + } + } + cleanup: - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Delete region object and method subobject */ if (obj_desc_region) { @@ -619,22 +643,6 @@ } } - - /* - * If we have a valid region, initialize it - */ - if (obj_desc_region) { - /* - * TBD: [Errors] Is there anything we can or could do when this - * fails? - * We need to do something useful with a failure. - */ - /* Namespace IS locked */ - - (void *) acpi_ev_initialize_region (obj_desc_region, TRUE); - - } - return (status); } @@ -645,7 +653,7 @@ * * PARAMETERS: Op - Op containing the Processor definition and * args - * Processor_nTE - NTE for the containing NTE + * Processor_nTE - Node for the containing Node * * RETURN: Status * @@ -655,12 +663,12 @@ ACPI_STATUS acpi_aml_exec_create_processor ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, ACPI_HANDLE processor_nTE) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_PROCESSOR); @@ -669,7 +677,7 @@ return (status); } - /* Install the new processor object in the parent NTE */ + /* Install the new processor object in the parent Node */ status = acpi_ns_attach_object (processor_nTE, obj_desc, (u8) ACPI_TYPE_PROCESSOR); @@ -700,7 +708,7 @@ /* Second arg is the PBlock Address */ - obj_desc->processor.pblk_address = (ACPI_IO_ADDRESS) arg->value.integer; + obj_desc->processor.address = (ACPI_IO_ADDRESS) arg->value.integer; /* Move to next arg and check existence */ @@ -712,7 +720,7 @@ /* Third arg is the PBlock Length */ - obj_desc->processor.pblk_length = (u8) arg->value.integer; + obj_desc->processor.length = (u8) arg->value.integer; return (AE_OK); } @@ -724,7 +732,7 @@ * * PARAMETERS: Op - Op containing the Power_resource definition * and args - * Power_res_nTE - NTE for the containing NTE + * Power_res_nTE - Node for the containing Node * * RETURN: Status * @@ -734,12 +742,12 @@ ACPI_STATUS acpi_aml_exec_create_power_resource ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, ACPI_HANDLE power_res_nTE) { ACPI_STATUS status; - ACPI_GENERIC_OP *arg; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_PARSE_OBJECT *arg; + ACPI_OPERAND_OBJECT *obj_desc; obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_POWER); @@ -748,7 +756,7 @@ return (status); } - /* Install the new power resource object in the parent NTE */ + /* Install the new power resource object in the parent Node */ status = acpi_ns_attach_object (power_res_nTE, obj_desc, (u8) ACPI_TYPE_POWER); @@ -789,11 +797,14 @@ * * FUNCTION: Acpi_aml_exec_create_method * - * PARAMETERS: Interpreter_mode - Current running mode (load1/Load2/Exec) + * PARAMETERS: Aml_ptr - First byte of the method's AML + * Aml_length - AML byte count for this method + * Method_flags - AML method flag byte + * Method - Method Node * * RETURN: Status * - * DESCRIPTION: Create a new mutex object + * DESCRIPTION: Create a new method object * ****************************************************************************/ @@ -804,7 +815,7 @@ u32 method_flags, ACPI_HANDLE method) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -830,9 +841,8 @@ METHOD_FLAGS_ARG_COUNT); /* - * Get the concurrency count - * If required, a semaphore will be created for this method when it is - * parsed. + * Get the concurrency count. If required, a semaphore will be + * created for this method when it is parsed. * * TBD: [Future] for APCI 2.0, there will be a Sync_level value, not * just a flag @@ -842,27 +852,16 @@ if (method_flags & METHOD_FLAGS_SERIALIZED) { obj_desc->method.concurrency = 1; } + else { obj_desc->method.concurrency = INFINITE_CONCURRENCY; } - /* Mark the Method as not parsed yet */ - - obj_desc->method.parser_op = NULL; - - /* - * Another +1 gets added when Acpi_psx_execute is called, - * no need for: Obj_desc->Method.Pcode++; - */ - - obj_desc->method.acpi_table = NULL; /* TBD: [Restructure] was (u8 *) Pcode_addr; */ - obj_desc->method.table_length = 0; /* TBD: [Restructure] needed? (u32) (Walk_state->aml_end - Pcode_addr); */ - - /* Attach the new object to the method NTE */ + /* Attach the new object to the method Node */ status = acpi_ns_attach_object (method, obj_desc, (u8) ACPI_TYPE_METHOD); if (ACPI_FAILURE (status)) { - acpi_cm_free (obj_desc); + acpi_cm_delete_object_desc (obj_desc); } return (status); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amdump.c linux/drivers/acpi/interpreter/amdump.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amdump.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/interpreter/amdump.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,41 @@ +/****************************************************************************** + * + * Module Name: amdump - Interpreter debug output routines + * $Revision: 90 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#include "acpi.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "actables.h" + +#define _COMPONENT INTERPRETER + MODULE_NAME ("amdump") + + +/* + * The following routines are used for debug output only + */ + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amdyadic.c linux/drivers/acpi/interpreter/amdyadic.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amdyadic.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amdyadic.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators + * $Revision: 63 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "parser.h" -#include "namesp.h" -#include "interp.h" -#include "events.h" +#include "acparser.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "acevents.h" #include "amlcode.h" -#include "dispatch.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amdyadic"); + MODULE_NAME ("amdyadic") /***************************************************************************** @@ -57,15 +57,15 @@ u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_OBJECT_INTERNAL *val_desc = NULL; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_OPERAND_OBJECT *val_desc = NULL; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get the operands */ status |= acpi_ds_obj_stack_pop_object (&val_desc, walk_state); @@ -73,8 +73,6 @@ if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -88,15 +86,15 @@ case AML_NOTIFY_OP: - /* The Obj_desc is actually an NTE */ + /* The Obj_desc is actually an Node */ - entry = (ACPI_NAMED_OBJECT*) obj_desc; + node = (ACPI_NAMESPACE_NODE *) obj_desc; obj_desc = NULL; /* Object must be a device or thermal zone */ - if (entry && val_desc) { - switch (entry->type) + if (node && val_desc) { + switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: @@ -108,7 +106,7 @@ /* Dispatch the notify to the appropriate handler */ - acpi_ev_notify_dispatch (entry, val_desc->number.value); + acpi_ev_notify_dispatch (node, val_desc->number.value); break; default: @@ -118,6 +116,8 @@ break; default: + + REPORT_ERROR ("Acpi_aml_exec_dyadic1: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; } @@ -153,23 +153,23 @@ acpi_aml_exec_dyadic2_r ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_OBJECT_INTERNAL *obj_desc2 = NULL; - ACPI_OBJECT_INTERNAL *res_desc = NULL; - ACPI_OBJECT_INTERNAL *res_desc2 = NULL; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *ret_desc2 = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc2 = NULL; + ACPI_OPERAND_OBJECT *res_desc = NULL; + ACPI_OPERAND_OBJECT *res_desc2 = NULL; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *ret_desc2 = NULL; ACPI_STATUS status = AE_OK; u32 remainder; - s32 num_operands = 3; - char *new_buf; + u32 num_operands = 3; + NATIVE_CHAR *new_buf; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ if (AML_DIVIDE_OP == opcode) { @@ -180,10 +180,7 @@ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - &(walk_state->operands [walk_state->num_operands -1]), - num_operands); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -368,9 +365,9 @@ goto cleanup; } - STRCPY (new_buf, (char *) obj_desc->string.pointer); + STRCPY (new_buf, obj_desc->string.pointer); STRCPY (new_buf + obj_desc->string.length, - (char *) obj_desc2->string.pointer); + obj_desc2->string.pointer); /* Point the return object to the new string */ @@ -391,16 +388,8 @@ new_buf = acpi_cm_allocate (obj_desc->buffer.length + obj_desc2->buffer.length); if (!new_buf) { - /* Only bail out if the buffer is small */ - - /* TBD: [Investigate] what is the point of this code? */ - - if (obj_desc->buffer.length + obj_desc2->buffer.length < 1024) { - REPORT_ERROR - ("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure"); - return (AE_NO_MEMORY); - } - + REPORT_ERROR + ("Aml_exec_dyadic2_r/Concat_op: Buffer allocation failure"); status = AE_NO_MEMORY; goto cleanup; } @@ -423,6 +412,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2_r: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -434,12 +424,13 @@ * descriptor (Res_desc). */ - if ((status = acpi_aml_exec_store (ret_desc, res_desc)) != AE_OK) { + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } if (AML_DIVIDE_OP == opcode) { - status = acpi_aml_exec_store (ret_desc2, res_desc2); + status = acpi_aml_exec_store (ret_desc2, res_desc2, walk_state); /* * Since the remainder is not returned, remove a reference to @@ -499,26 +490,24 @@ acpi_aml_exec_dyadic2_s ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *time_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *time_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&time_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -559,6 +548,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2_s: Unknown dyadic synchronization opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -619,27 +609,25 @@ acpi_aml_exec_dyadic2 ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *obj_desc2; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc2; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; u8 lboolean; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&obj_desc2, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, opcode, - WALK_OPERANDS, 2); goto cleanup; } @@ -707,6 +695,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_dyadic2: Unknown dyadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amfield.c linux/drivers/acpi/interpreter/amfield.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amfield.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amfield.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: amfield - ACPI AML (p-code) execution - field manipulation + * $Revision: 70 $ * *****************************************************************************/ @@ -24,16 +25,16 @@ #include "acpi.h" -#include "dispatch.h" -#include "interp.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amfield"); + MODULE_NAME ("amfield") /******************************************************************************* @@ -67,12 +68,12 @@ ACPI_STATUS acpi_aml_setup_field ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL *rgn_desc, - s32 field_bit_width) + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT *rgn_desc, + u32 field_bit_width) { ACPI_STATUS status = AE_OK; - s32 field_byte_width; + u32 field_byte_width; /* Parameter validation */ @@ -87,6 +88,8 @@ /* + * TBD: [Future] Acpi 2.0 supports Qword fields + * * Init and validate Field width * Possible values are 1, 2, 4 */ @@ -105,7 +108,7 @@ * If the address and length have not been previously evaluated, * evaluate them and save the results. */ - if (!(rgn_desc->region.region_flags & REGION_AGRUMENT_DATA_VALID)) { + if (!(rgn_desc->region.flags & AOPOBJ_DATA_VALID)) { status = acpi_ds_get_region_arguments (rgn_desc); if (ACPI_FAILURE (status)) { @@ -113,12 +116,6 @@ } } - - /* - * If (offset rounded up to next multiple of field width) - * exceeds region length, indicate an error. - */ - if (rgn_desc->region.length < (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + field_byte_width) @@ -152,12 +149,12 @@ ACPI_STATUS acpi_aml_access_named_field ( - s32 mode, + u32 mode, ACPI_HANDLE named_field, void *buffer, u32 buffer_length) { - ACPI_OBJECT_INTERNAL *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; ACPI_STATUS status = AE_OK; u8 locked = FALSE; u32 bit_granularity = 0; @@ -167,6 +164,11 @@ u32 byte_field_length; + /* Basic data checking */ + if ((!named_field) || (ACPI_READ == mode && !buffer)) { + return (AE_AML_INTERNAL); + } + /* Get the attached field object */ obj_desc = acpi_ns_get_attached_object (named_field); @@ -256,72 +258,6 @@ acpi_aml_release_global_lock (locked); - return (status); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_set_named_field_value - * - * PARAMETERS: Named_field - Handle for field to be set - * Buffer - Bytes to be stored - * Buffer_length - Number of bytes to be stored - * - * RETURN: Status - * - * DESCRIPTION: Store the given value into the field - * - ******************************************************************************/ - -ACPI_STATUS -acpi_aml_set_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 buffer_length) -{ - ACPI_STATUS status; - - - if (!named_field) { - return (AE_AML_INTERNAL); - } - - status = acpi_aml_access_named_field (ACPI_WRITE, named_field, buffer, - buffer_length); - return (status); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_get_named_field_value - * - * PARAMETERS: Named_field - Handle for field to be read - * *Buffer - Where to store value read from field - * Buffer_length - Max length to read - * - * RETURN: Status - * - * DESCRIPTION: Retrieve the value of the given field - * - ******************************************************************************/ - -ACPI_STATUS -acpi_aml_get_named_field_value ( - ACPI_HANDLE named_field, - void *buffer, - u32 buffer_length) -{ - ACPI_STATUS status; - - - if ((!named_field) || (!buffer)) { - return (AE_AML_INTERNAL); - } - - status = acpi_aml_access_named_field (ACPI_READ, named_field, buffer, - buffer_length); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amfldio.c linux/drivers/acpi/interpreter/amfldio.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amfldio.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amfldio.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: amfldio - Aml Field I/O + * $Revision: 26 $ * *****************************************************************************/ @@ -24,15 +25,15 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amfldio"); + MODULE_NAME ("amfldio") /******************************************************************************* @@ -51,16 +52,16 @@ ACPI_STATUS acpi_aml_read_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 field_byte_offset, u32 field_bit_width, u32 *value) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *rgn_desc = NULL; + ACPI_OPERAND_OBJECT *rgn_desc = NULL; u32 address; u32 local_value = 0; - s32 field_byte_width; + u32 field_byte_width; /* Obj_desc is validated by callers */ @@ -72,7 +73,7 @@ field_byte_width = DIV_8 (field_bit_width); status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -84,17 +85,17 @@ /* - * Round offset down to next multiple of - * field width, add region base address and offset within the field + * Set offset to next multiple of field width, + * add region base address and offset within the field */ - address = rgn_desc->region.address + - (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + + (obj_desc->field.offset * field_byte_width) + field_byte_offset; + /* Invoke the appropriate Address_space/Op_region handler */ status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_READ, @@ -122,7 +123,7 @@ ACPI_STATUS acpi_aml_read_field ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, void *buffer, u32 buffer_length, u32 byte_length, @@ -236,6 +237,7 @@ * field datum */ + if (obj_desc->field.bit_offset != 0) { merged_datum = (previous_raw_datum >> obj_desc->field.bit_offset) | @@ -247,10 +249,27 @@ } /* + * Prepare the merged datum for storing into the caller's + * buffer. It is possible to have a 32-bit buffer + * (Byte_granularity == 4), but a Obj_desc->Field.Length + * of 8 or 16, meaning that the upper bytes of merged data + * are undesired. This section fixes that. + */ + switch (obj_desc->field.length) + { + case 8: + merged_datum &= 0x000000FF; + break; + + case 16: + merged_datum &= 0x0000FFFF; + break; + } + + /* * Now store the datum in the caller's buffer, according to * the data type */ - switch (byte_granularity) { case 1: @@ -266,7 +285,6 @@ break; } - /* * Save the most recent datum since it contains bits of * the *next* field datum @@ -302,15 +320,15 @@ ACPI_STATUS acpi_aml_write_field_data ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 field_byte_offset, u32 field_bit_width, u32 value) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *rgn_desc = NULL; + ACPI_OPERAND_OBJECT *rgn_desc = NULL; u32 address; - s32 field_byte_width; + u32 field_byte_width; /* Obj_desc is validated by callers */ @@ -321,21 +339,21 @@ field_byte_width = DIV_8 (field_bit_width); status = acpi_aml_setup_field (obj_desc, rgn_desc, field_bit_width); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* - * Round offset down to next multiple of - * field width, add region base address and offset within the field + * Set offset to next multiple of field width, + * add region base address and offset within the field */ - address = rgn_desc->region.address + - (obj_desc->field.offset & ~((u32) field_byte_width - 1)) + + (obj_desc->field.offset * field_byte_width) + field_byte_offset; + /* Invoke the appropriate Address_space/Op_region handler */ status = acpi_ev_address_space_dispatch (rgn_desc, ADDRESS_SPACE_WRITE, @@ -363,7 +381,7 @@ ACPI_STATUS acpi_aml_write_field_data_with_update_rule ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u32 mask, u32 field_value, u32 this_field_byte_offset, @@ -426,7 +444,7 @@ bit_granularity, merged_value); } - return status; + return (status); } @@ -446,7 +464,7 @@ ACPI_STATUS acpi_aml_write_field ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, void *buffer, u32 buffer_length, u32 byte_length, @@ -638,7 +656,8 @@ field_value = (previous_raw_datum >> (bit_granularity - obj_desc->field.bit_offset)) & mask; - status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value, this_field_byte_offset + 1, + status = acpi_aml_write_field_data_with_update_rule (obj_desc, mask, field_value, + this_field_byte_offset + byte_granularity, bit_granularity); if (ACPI_FAILURE (status)) { goto cleanup; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/ammisc.c linux/drivers/acpi/interpreter/ammisc.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/ammisc.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/ammisc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes + * $Revision: 67 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "dispatch.h" +#include "acdispat.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("ammisc"); + MODULE_NAME ("ammisc") /******************************************************************************* @@ -58,25 +59,23 @@ acpi_aml_exec_fatal ( ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *type_desc; - ACPI_OBJECT_INTERNAL *code_desc; - ACPI_OBJECT_INTERNAL *arg_desc; + ACPI_OPERAND_OBJECT *type_desc; + ACPI_OPERAND_OBJECT *code_desc; + ACPI_OPERAND_OBJECT *arg_desc; ACPI_STATUS status; /* Resolve operands */ - status = acpi_aml_resolve_operands (AML_FATAL_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_FATAL_OP, WALK_OPERANDS, walk_state); /* Get operands */ status |= acpi_ds_obj_stack_pop_object (&arg_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&code_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&type_desc, walk_state); - if (status != AE_OK) { - /* invalid parameters on object stack */ + if (ACPI_FAILURE (status)) { + /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_FATAL_OP, WALK_OPERANDS, 3); goto cleanup; } @@ -130,30 +129,28 @@ ACPI_STATUS acpi_aml_exec_index ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *idx_desc; - ACPI_OBJECT_INTERNAL *res_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *tmp_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *idx_desc; + ACPI_OPERAND_OBJECT *res_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *tmp_desc; ACPI_STATUS status; /* Resolve operands */ /* First operand can be either a package or a buffer */ - status = acpi_aml_resolve_operands (AML_INDEX_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_INDEX_OP, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&idx_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_INDEX_OP, WALK_OPERANDS, 3); goto cleanup; } @@ -202,7 +199,7 @@ ret_desc->reference.target_type = tmp_desc->common.type; ret_desc->reference.object = tmp_desc; - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); ret_desc->reference.object = NULL; } @@ -228,7 +225,7 @@ ret_desc->reference.object = obj_desc; ret_desc->reference.offset = idx_desc->number.value; - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); } @@ -282,15 +279,15 @@ ACPI_STATUS acpi_aml_exec_match ( ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *pkg_desc; - ACPI_OBJECT_INTERNAL *op1_desc; - ACPI_OBJECT_INTERNAL *V1_desc; - ACPI_OBJECT_INTERNAL *op2_desc; - ACPI_OBJECT_INTERNAL *V2_desc; - ACPI_OBJECT_INTERNAL *start_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *pkg_desc; + ACPI_OPERAND_OBJECT *op1_desc; + ACPI_OPERAND_OBJECT *V1_desc; + ACPI_OPERAND_OBJECT *op2_desc; + ACPI_OPERAND_OBJECT *V2_desc; + ACPI_OPERAND_OBJECT *start_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; ACPI_STATUS status; u32 index; u32 match_value = (u32) -1; @@ -298,7 +295,7 @@ /* Resolve all operands */ - status = acpi_aml_resolve_operands (AML_MATCH_OP, WALK_OPERANDS); + status = acpi_aml_resolve_operands (AML_MATCH_OP, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&start_desc, walk_state); @@ -308,11 +305,9 @@ status |= acpi_ds_obj_stack_pop_object (&op1_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&pkg_desc, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Invalid parameters on object stack */ - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - (u16) AML_MATCH_OP, WALK_OPERANDS, 6); goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/ammonad.c linux/drivers/acpi/interpreter/ammonad.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/ammonad.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/ammonad.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators + * $Revision: 79 $ * *****************************************************************************/ @@ -25,15 +26,15 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("ammonad"); + MODULE_NAME ("ammonad") /******************************************************************************* @@ -52,8 +53,9 @@ ACPI_STATUS acpi_aml_get_object_reference ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_OBJECT_INTERNAL **ret_desc) + ACPI_OPERAND_OBJECT *obj_desc, + ACPI_OPERAND_OBJECT **ret_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; @@ -74,14 +76,14 @@ case AML_LOCAL_OP: *ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_LOCAL, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; case AML_ARG_OP: *ret_desc = (void *) acpi_ds_method_data_get_nte (MTH_TYPE_ARG, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; @@ -95,7 +97,7 @@ } else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* Must be a named object; Just return the NTE */ + /* Must be a named object; Just return the Node */ *ret_desc = obj_desc; } @@ -130,19 +132,17 @@ u16 opcode, ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -196,6 +196,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic1: Unknown monadic opcode"); status = AE_AML_BAD_OPCODE; break; @@ -229,30 +230,28 @@ acpi_aml_exec_monadic2_r ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *res_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; - ACPI_OBJECT_INTERNAL *ret_desc2 = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *res_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_OPERAND_OBJECT *ret_desc2 = NULL; u32 res_val; ACPI_STATUS status; - s32 d0; - s32 d1; - s32 d2; - s32 d3; + u32 d0; + u32 d1; + u32 d2; + u32 d3; /* Resolve all operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); + status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); /* Get all operands */ status |= acpi_ds_obj_stack_pop_object (&res_desc, walk_state); status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 2); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -264,8 +263,8 @@ case AML_BIT_NOT_OP: case AML_FIND_SET_LEFT_BIT_OP: case AML_FIND_SET_RIGHT_BIT_OP: - case AML_FROM_BCDOP: - case AML_TO_BCDOP: + case AML_FROM_BCD_OP: + case AML_TO_BCD_OP: case AML_COND_REF_OF_OP: ret_desc = acpi_cm_create_internal_object (ACPI_TYPE_NUMBER); @@ -293,7 +292,13 @@ case AML_FIND_SET_LEFT_BIT_OP: ret_desc->number.value = obj_desc->number.value; - for (res_val = 0; ret_desc->number.value && res_val < 33; ++res_val) { + + /* + * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit + * little endian unsigned value, so this boundry condition + * is valid. + */ + for (res_val = 0; ret_desc->number.value && res_val < 32; ++res_val) { ret_desc->number.value >>= 1; } @@ -306,22 +311,29 @@ case AML_FIND_SET_RIGHT_BIT_OP: ret_desc->number.value = obj_desc->number.value; - for (res_val = 0; ret_desc->number.value && res_val < 33; ++res_val) { + + /* + * Acpi x1.94 spec, Chapter 16 describes Integer as a 32-bit + * little endian unsigned value, so this boundry condition + * is valid. + */ + for (res_val = 0; ret_desc->number.value && res_val < 32; ++res_val) { ret_desc->number.value <<= 1; } + /* Since returns must be 1-based, subtract from 33 */ ret_desc->number.value = res_val == 0 ? 0 : 33 - res_val; break; /* Def_from_bDC := From_bCDOp BCDValue Result */ - case AML_FROM_BCDOP: + case AML_FROM_BCD_OP: - d0 = (s32) (obj_desc->number.value & 15); - d1 = (s32) (obj_desc->number.value >> 4 & 15); - d2 = (s32) (obj_desc->number.value >> 8 & 15); - d3 = (s32) (obj_desc->number.value >> 12 & 15); + d0 = (u32) (obj_desc->number.value & 15); + d1 = (u32) (obj_desc->number.value >> 4 & 15); + d2 = (u32) (obj_desc->number.value >> 8 & 15); + d3 = (u32) (obj_desc->number.value >> 12 & 15); if (d0 > 9 || d1 > 9 || d2 > 9 || d3 > 9) { status = AE_AML_NUMERIC_OVERFLOW; @@ -334,7 +346,7 @@ /* Def_to_bDC := To_bCDOp Operand Result */ - case AML_TO_BCDOP: + case AML_TO_BCD_OP: if (obj_desc->number.value > 9999) { @@ -361,7 +373,7 @@ * (There are really two return values) */ - if ((ACPI_NAMED_OBJECT*) obj_desc == acpi_gbl_root_object) { + if ((ACPI_NAMESPACE_NODE *) obj_desc == acpi_gbl_root_node) { /* * This means that the object does not exist in the namespace, * return FALSE @@ -380,12 +392,12 @@ /* Get the object reference and store it */ - status = acpi_aml_get_object_reference (obj_desc, &ret_desc2); + status = acpi_aml_get_object_reference (obj_desc, &ret_desc2, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } - status = acpi_aml_exec_store (ret_desc2, res_desc); + status = acpi_aml_exec_store (ret_desc2, res_desc, walk_state); /* The object exists in the namespace, return TRUE */ @@ -406,7 +418,7 @@ * since the object itself may have been stored. */ - status = acpi_aml_exec_store (obj_desc, res_desc); + status = acpi_aml_exec_store (obj_desc, res_desc, walk_state); if (ACPI_FAILURE (status)) { /* On failure, just delete the Obj_desc */ @@ -454,12 +466,13 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic2_r: Unknown monadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } - status = acpi_aml_exec_store (ret_desc, res_desc); + status = acpi_aml_exec_store (ret_desc, res_desc, walk_state); cleanup: @@ -502,25 +515,32 @@ acpi_aml_exec_monadic2 ( u16 opcode, ACPI_WALK_STATE *walk_state, - ACPI_OBJECT_INTERNAL **return_desc) + ACPI_OPERAND_OBJECT **return_desc) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *tmp_desc; - ACPI_OBJECT_INTERNAL *ret_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *tmp_desc; + ACPI_OPERAND_OBJECT *ret_desc = NULL; + ACPI_STATUS resolve_status; ACPI_STATUS status; u32 type; u32 value; - /* Resolve all operands */ + /* Attempt to resolve the operands */ - status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS); - /* Get all operands */ + resolve_status = acpi_aml_resolve_operands (opcode, WALK_OPERANDS, walk_state); + /* Always get all operands */ - status |= acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + status = acpi_ds_obj_stack_pop_object (&obj_desc, walk_state); + + + /* Now we can check the status codes */ + + if (ACPI_FAILURE (resolve_status)) { + goto cleanup; + } + + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -553,7 +573,7 @@ /* * Since we are expecting an Reference on the top of the stack, it - * can be either an NTE or an internal object. + * can be either an Node or an internal object. * * TBD: [Future] This may be the prototype code for all cases where * an Reference is expected!! 10/99 @@ -586,10 +606,8 @@ * (This deletes the original Ret_desc) */ - status = acpi_aml_resolve_operands (AML_LNOT_OP, &ret_desc); - if (status != AE_OK) { - acpi_aml_append_operand_diag (_THIS_MODULE, __LINE__, - opcode, WALK_OPERANDS, 1); + status = acpi_aml_resolve_operands (AML_LNOT_OP, &ret_desc, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -604,7 +622,7 @@ /* Store the result back in the original descriptor */ - status = acpi_aml_exec_store (ret_desc, obj_desc); + status = acpi_aml_exec_store (ret_desc, obj_desc, walk_state); /* Objdesc was just deleted (because it is an Reference) */ @@ -662,19 +680,20 @@ case AML_LOCAL_OP: type = acpi_ds_method_data_get_type (MTH_TYPE_LOCAL, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; case AML_ARG_OP: type = acpi_ds_method_data_get_type (MTH_TYPE_ARG, - (obj_desc->reference.offset)); + (obj_desc->reference.offset), walk_state); break; default: + REPORT_ERROR ("Acpi_aml_exec_monadic2/Type_op:internal error: Unknown Reference subtype"); status = AE_AML_INTERNAL; goto cleanup; } @@ -682,8 +701,7 @@ else { /* - * Since we passed Acpi_aml_resolve_operands("l") and it's not a - * Reference, it must be a direct name pointer. + * It's not a Reference, so it must be a direct name pointer. */ type = acpi_ns_get_type ((ACPI_HANDLE) obj_desc); } @@ -764,7 +782,7 @@ case AML_REF_OF_OP: - status = acpi_aml_get_object_reference (obj_desc, &ret_desc); + status = acpi_aml_get_object_reference (obj_desc, &ret_desc, walk_state); if (ACPI_FAILURE (status)) { goto cleanup; } @@ -789,7 +807,7 @@ case AML_LOCAL_OP: acpi_ds_method_data_get_value (MTH_TYPE_LOCAL, - (obj_desc->reference.offset), &tmp_desc); + (obj_desc->reference.offset), walk_state, &tmp_desc); /* * Delete our reference to the input object and @@ -803,7 +821,7 @@ case AML_ARG_OP: acpi_ds_method_data_get_value (MTH_TYPE_ARG, - (obj_desc->reference.offset), &tmp_desc); + (obj_desc->reference.offset), walk_state, &tmp_desc); /* * Delete our reference to the input object and @@ -824,9 +842,9 @@ /* Obj_desc may have changed from the code above */ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* Get the actual object from the NTE (This is the dereference) */ + /* Get the actual object from the Node (This is the dereference) */ - ret_desc = ((ACPI_NAMED_OBJECT*) obj_desc)->object; + ret_desc = ((ACPI_NAMESPACE_NODE *) obj_desc)->object; /* Returning a pointer to the object, add another reference! */ @@ -928,6 +946,7 @@ default: + REPORT_ERROR ("Acpi_aml_exec_monadic2: Internal error, unknown monadic opcode"); status = AE_AML_BAD_OPCODE; goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amnames.c linux/drivers/acpi/interpreter/amnames.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amnames.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amnames.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amnames - interpreter/scanner name load/execute + * $Revision: 70 $ * *****************************************************************************/ @@ -25,12 +26,12 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amnames"); + MODULE_NAME ("amnames") /* AML Package Length encodings */ @@ -57,13 +58,13 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_aml_allocate_name_string ( u32 prefix_count, u32 num_name_segs) { - char *temp_ptr; - char *name_string; + NATIVE_CHAR *temp_ptr; + NATIVE_CHAR *name_string; u32 size_needed; @@ -87,7 +88,7 @@ * This buffer must be deleted by the caller! */ - name_string = acpi_cm_allocate ((ACPI_SIZE) size_needed); + name_string = acpi_cm_allocate (size_needed); if (!name_string) { REPORT_ERROR ("Aml_allocate_name_string: name allocation failure"); return (NULL); @@ -133,52 +134,6 @@ return (name_string); } - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_decode_package_length - * - * PARAMETERS: Last_pkg_len - latest value decoded by Do_pkg_length() for - * most recently examined package or field - * - * RETURN: Number of bytes contained in package length encoding - * - * DESCRIPTION: Decodes the Package Length. Upper 2 bits are are used to - * tell if type 1, 2, 3, or 4. - * 0x3F = Max 1 byte encoding, - * 0xFFF = Max 2 byte encoding, - * 0xFFFFF = Max 3 Byte encoding, - * 0xFFFFFFFFF = Max 4 Byte encoding. - * - ******************************************************************************/ - -u32 -acpi_aml_decode_package_length ( - u32 last_pkg_len) -{ - u32 num_bytes = 0; - - - if (last_pkg_len < ACPI_AML_PACKAGE_TYPE1) { - num_bytes = 1; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE2) { - num_bytes = 2; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE3) { - num_bytes = 3; - } - - else if (last_pkg_len < ACPI_AML_PACKAGE_TYPE4) { - num_bytes = 4; - } - - return (num_bytes); -} - - /******************************************************************************* * * FUNCTION: Acpi_aml_exec_name_segment @@ -194,12 +149,12 @@ ACPI_STATUS acpi_aml_exec_name_segment ( u8 **in_aml_address, - char *name_string) + NATIVE_CHAR *name_string) { u8 *aml_address = *in_aml_address; ACPI_STATUS status = AE_OK; - s32 index; - char char_buf[5]; + u32 index; + NATIVE_CHAR char_buf[5]; /* @@ -271,15 +226,16 @@ acpi_aml_get_name_string ( OBJECT_TYPE_INTERNAL data_type, u8 *in_aml_address, - char **out_name_string, + NATIVE_CHAR **out_name_string, u32 *out_name_length) { ACPI_STATUS status = AE_OK; u8 *aml_address = in_aml_address; - char *name_string = NULL; - s32 num_segments; - s32 prefix_count = 0; + NATIVE_CHAR *name_string = NULL; + u32 num_segments; + u32 prefix_count = 0; u8 prefix = 0; + u8 has_prefix = FALSE; if (INTERNAL_TYPE_DEF_FIELD == data_type || @@ -313,7 +269,8 @@ * Remember that we have a Root_prefix -- * see comment in Acpi_aml_allocate_name_string() */ - prefix_count = -1; + prefix_count = (u32) -1; + has_prefix = TRUE; break; @@ -327,7 +284,7 @@ ++prefix_count; } while (*aml_address == AML_PARENT_PREFIX); - + has_prefix = TRUE; break; @@ -351,9 +308,8 @@ break; } - /* Ensure Prefix_count != 0 to remember processing a prefix */ - - prefix_count += 2; + /* Indicate that we processed a prefix */ + has_prefix = TRUE; status = acpi_aml_exec_name_segment (&aml_address, name_string); if (ACPI_SUCCESS (status)) { @@ -375,9 +331,8 @@ break; } - /* Ensure Prefix_count != 0 to remember processing a prefix */ - - prefix_count += 2; + /* Indicate that we processed a prefix */ + has_prefix = TRUE; while (num_segments && (status = acpi_aml_exec_name_segment (&aml_address, name_string)) == AE_OK) @@ -422,7 +377,7 @@ } - if (AE_CTRL_PENDING == status && prefix_count != 0) { + if (AE_CTRL_PENDING == status && has_prefix) { /* Ran out of segments after processing a prefix */ REPORT_ERROR ("Ran out of segments after processing a prefix"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amprep.c linux/drivers/acpi/interpreter/amprep.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amprep.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amprep.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities + * $Revision: 67 $ * *****************************************************************************/ @@ -25,14 +26,14 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "parser.h" +#include "acnamesp.h" +#include "acparser.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amprep"); + MODULE_NAME ("amprep") /******************************************************************************* @@ -55,25 +56,25 @@ switch (access) { case ACCESS_ANY_ACC: - return 8; + return (8); break; case ACCESS_BYTE_ACC: - return 8; + return (8); break; case ACCESS_WORD_ACC: - return 16; + return (16); break; case ACCESS_DWORD_ACC: - return 32; + return (32); break; default: /* Invalid field access type */ - return 0; + return (0); } } @@ -98,7 +99,7 @@ ACPI_STATUS acpi_aml_prep_common_field_object ( - ACPI_OBJECT_INTERNAL *obj_desc, + ACPI_OPERAND_OBJECT *obj_desc, u8 field_flags, u8 field_attribute, u32 field_position, @@ -150,7 +151,7 @@ * * FUNCTION: Acpi_aml_prep_def_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Region - Region in which field is being defined * Field_flags - Access, Lock_rule, or Update_rule. * The format of a Field_flag is described @@ -160,22 +161,22 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Def_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Def_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_def_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE region, u8 field_flags, u8 field_attribute, u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; - s32 type; + ACPI_OPERAND_OBJECT *obj_desc; + u32 type; ACPI_STATUS status; @@ -220,11 +221,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } @@ -234,7 +235,7 @@ * * FUNCTION: Acpi_aml_prep_bank_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Region - Region in which field is being defined * Bank_reg - Bank selection register * Bank_val - Value to store in selection register @@ -244,14 +245,14 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Bank_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Bank_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_bank_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE region, ACPI_HANDLE bank_reg, u32 bank_val, @@ -260,8 +261,8 @@ u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; - s32 type; + ACPI_OPERAND_OBJECT *obj_desc; + u32 type; ACPI_STATUS status; @@ -308,11 +309,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } @@ -322,7 +323,7 @@ * * FUNCTION: Acpi_aml_prep_index_field_value * - * PARAMETERS: This_entry - Owning NTE + * PARAMETERS: Node - Owning Node * Index_reg - Index register * Data_reg - Data register * Field_flags - Access, Lock_rule, or Update_rule @@ -331,14 +332,14 @@ * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OBJECT_INTERNAL of type Index_field and - * connect it to the parent NTE. + * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type Index_field and + * connect it to the parent Node. * ******************************************************************************/ ACPI_STATUS acpi_aml_prep_index_field_value ( - ACPI_NAMED_OBJECT *this_entry, + ACPI_NAMESPACE_NODE *node, ACPI_HANDLE index_reg, ACPI_HANDLE data_reg, u8 field_flags, @@ -346,7 +347,7 @@ u32 field_position, u32 field_length) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status; @@ -381,11 +382,11 @@ /* Debug info */ /* - * Store the constructed descriptor (Obj_desc) into the nte whose - * handle is on TOS, preserving the current type of that nte. + * Store the constructed descriptor (Obj_desc) into the Named_obj whose + * handle is on TOS, preserving the current type of that Named_obj. */ - status = acpi_ns_attach_object ((ACPI_HANDLE) this_entry, obj_desc, - (u8) acpi_ns_get_type ((ACPI_HANDLE) this_entry)); + status = acpi_ns_attach_object ((ACPI_HANDLE) node, obj_desc, + (u8) acpi_ns_get_type ((ACPI_HANDLE) node)); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amregion.c linux/drivers/acpi/interpreter/amregion.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amregion.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amregion.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,8 @@ + /****************************************************************************** * * Module Name: amregion - ACPI default Op_region (address space) handlers + * $Revision: 35 $ * *****************************************************************************/ @@ -24,15 +26,15 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amregion"); + MODULE_NAME ("amregion") /******************************************************************************* @@ -43,7 +45,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -57,11 +61,12 @@ u32 address, /* TBD: [Future] Should this be A POINTER for 64-bit support? */ u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; void *logical_addr_ptr = NULL; - MEM_HANDLER_CONTEXT *mem_info = context; + MEM_HANDLER_CONTEXT *mem_info = region_context; u32 length; @@ -93,8 +98,8 @@ * 2) Address beyond the current mapping? */ - if (((char *) address < mem_info->mapped_physical_address) || - (((char *) address + length) > + if (((u8 *) address < mem_info->mapped_physical_address) || + (((u8 *) address + length) > (mem_info->mapped_physical_address + mem_info->mapped_length))) { /* @@ -119,7 +124,7 @@ return (status); } - mem_info->mapped_physical_address = (char *) address; + mem_info->mapped_physical_address = (u8 *) address; mem_info->mapped_length = SYSMEM_REGION_WINDOW_SIZE; } @@ -130,7 +135,7 @@ */ logical_addr_ptr = mem_info->mapped_logical_address + - ((char *) address - mem_info->mapped_physical_address); + ((u8 *) address - mem_info->mapped_physical_address); /* Perform the memory read or write */ @@ -194,7 +199,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -208,7 +215,8 @@ u32 address, u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; @@ -283,7 +291,9 @@ * Address - Where in the space to read or write * Bit_width - Field width in bits (8, 16, or 32) * Value - Pointer to in or out value - * Context - Context pointer + * Handler_context - Pointer to Handler's context + * Region_context - Pointer to context specific to the + * accessed region * * RETURN: Status * @@ -297,7 +307,8 @@ u32 address, u32 bit_width, u32 *value, - void *context) + void *handler_context, + void *region_context) { ACPI_STATUS status = AE_OK; u32 pci_bus; @@ -321,7 +332,7 @@ * */ - PCIcontext = (PCI_HANDLER_CONTEXT *) context; + PCIcontext = (PCI_HANDLER_CONTEXT *) region_context; pci_bus = LOWORD(PCIcontext->seg) << 16; pci_bus |= LOWORD(PCIcontext->bus); @@ -365,7 +376,6 @@ case ADDRESS_SPACE_WRITE: - switch (bit_width) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresnte.c linux/drivers/acpi/interpreter/amresnte.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresnte.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amresnte.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresnte - AML Interpreter object resolution + * $Revision: 21 $ * *****************************************************************************/ @@ -26,32 +27,33 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresnte"); + MODULE_NAME ("amresnte") /******************************************************************************* * - * FUNCTION: Acpi_aml_resolve_entry_to_value + * FUNCTION: Acpi_aml_resolve_node_to_value * * PARAMETERS: Stack_ptr - Pointer to a location on a stack that contains - * a ptr to an NTE + * a pointer to an Node * * RETURN: Status * - * DESCRIPTION: Resolve a ACPI_NAMED_OBJECT(nte, A.K.A. a "direct name pointer") + * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node, + * A.K.A. a "direct name pointer") * - * Note: for some of the data types, the pointer attached to the NTE can be - * either a pointer to an actual internal object or a pointer into the AML - * stream itself. These types are currently: + * Note: for some of the data types, the pointer attached to the Node + * can be either a pointer to an actual internal object or a pointer into the + * AML stream itself. These types are currently: * * ACPI_TYPE_NUMBER * ACPI_TYPE_STRING @@ -62,13 +64,13 @@ ******************************************************************************/ ACPI_STATUS -acpi_aml_resolve_entry_to_value ( - ACPI_NAMED_OBJECT **stack_ptr) +acpi_aml_resolve_node_to_value ( + ACPI_NAMESPACE_NODE **stack_ptr) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *val_desc = NULL; - ACPI_OBJECT_INTERNAL *obj_desc = NULL; - ACPI_NAMED_OBJECT *stack_entry; + ACPI_OPERAND_OBJECT *val_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; + ACPI_NAMESPACE_NODE *node; u8 *aml_pointer = NULL; OBJECT_TYPE_INTERNAL entry_type; u8 locked; @@ -78,20 +80,20 @@ OBJECT_TYPE_INTERNAL object_type; - stack_entry = *stack_ptr; + node = *stack_ptr; /* * The stack pointer is a "Direct name ptr", and points to a - * a ACPI_NAMED_OBJECT(nte). Get the pointer that is attached to - * the nte. + * a ACPI_NAMESPACE_NODE (Node). Get the pointer that is attached to + * the Node. */ - val_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) stack_entry); - entry_type = acpi_ns_get_type ((ACPI_HANDLE) stack_entry); + val_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) node); + entry_type = acpi_ns_get_type ((ACPI_HANDLE) node); /* - * The Val_desc attached to the NTE can be either: + * The Val_desc attached to the Node can be either: * 1) An internal ACPI object * 2) A pointer into the AML stream (into one of the ACPI system tables) */ @@ -105,7 +107,25 @@ /* - * Action is based on the type of the NTE, which indicates the type + * Several Entry_types do not require further processing, so + * we will return immediately + */ + /* Devices rarely have an attached object, return the Node + * and Method locals and arguments have a pseudo-Node + */ + if (entry_type == ACPI_TYPE_DEVICE || + entry_type == INTERNAL_TYPE_METHOD_ARGUMENT || + entry_type == INTERNAL_TYPE_METHOD_LOCAL_VAR) + { + return (AE_OK); + } + + if (!val_desc) { + return (AE_AML_NO_OPERAND); + } + + /* + * Action is based on the type of the Node, which indicates the type * of the attached object or pointer */ switch (entry_type) @@ -113,15 +133,6 @@ case ACPI_TYPE_PACKAGE: - /* - * Val_desc should point to either an ACPI_OBJECT_INTERNAL of - * type Package, or an initialization in the AML stream. - */ - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - - if (attached_aml_pointer) { /* * This means that the package initialization is not parsed @@ -132,7 +143,7 @@ /* Val_desc is an internal object in all cases by the time we get here */ - if (!val_desc || (ACPI_TYPE_PACKAGE != val_desc->common.type)) { + if (ACPI_TYPE_PACKAGE != val_desc->common.type) { return (AE_AML_OPERAND_TYPE); } @@ -145,10 +156,6 @@ case ACPI_TYPE_BUFFER: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { /* * This means that the buffer initialization is not parsed @@ -159,7 +166,7 @@ /* Val_desc is an internal object in all cases by the time we get here */ - if (!val_desc || (ACPI_TYPE_BUFFER != val_desc->common.type)) { + if (ACPI_TYPE_BUFFER != val_desc->common.type) { return (AE_AML_OPERAND_TYPE); } @@ -183,8 +190,8 @@ /* Init the internal object */ - obj_desc->string.pointer = (char *) aml_pointer; - obj_desc->string.length = STRLEN (aml_pointer); + obj_desc->string.pointer = (NATIVE_CHAR *) aml_pointer; + obj_desc->string.length = STRLEN (obj_desc->string.pointer); } else { @@ -203,11 +210,6 @@ case ACPI_TYPE_NUMBER: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - - /* * An ACPI_TYPE_NUMBER can be either an object or an AML pointer */ @@ -279,7 +281,7 @@ else { /* - * The NTE has an attached internal object, make sure that it's a + * The Node has an attached internal object, make sure that it's a * number */ @@ -337,18 +339,21 @@ obj_desc->buffer.length = val_desc->field.length; - status = acpi_aml_get_named_field_value ((ACPI_HANDLE) stack_entry, - obj_desc->buffer.pointer, obj_desc->buffer.length); + status = acpi_aml_access_named_field (ACPI_READ, + (ACPI_HANDLE) node, + obj_desc->buffer.pointer, + obj_desc->buffer.length); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } } else { - status = acpi_aml_get_named_field_value ((ACPI_HANDLE) stack_entry, + status = acpi_aml_access_named_field (ACPI_READ, + (ACPI_HANDLE) node, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -361,10 +366,6 @@ case INTERNAL_TYPE_BANK_FIELD: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -376,30 +377,30 @@ /* Get the global lock if needed */ - obj_desc = (ACPI_OBJECT_INTERNAL *) *stack_ptr; + obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr; locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule); - { - /* Set Index value to select proper Data register */ - /* perform the update */ + /* Set Index value to select proper Data register */ + /* perform the update */ + + status = acpi_aml_access_named_field (ACPI_WRITE, + val_desc->bank_field.bank_select, + &val_desc->bank_field.value, + sizeof (val_desc->bank_field.value)); - status = acpi_aml_set_named_field_value (val_desc->bank_field.bank_select, - &val_desc->bank_field.value, - sizeof (val_desc->bank_field.value)); - } acpi_aml_release_global_lock (locked); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* Read Data value */ - status = acpi_aml_get_named_field_value ( + status = acpi_aml_access_named_field (ACPI_READ, (ACPI_HANDLE) val_desc->bank_field.container, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -414,10 +415,6 @@ case INTERNAL_TYPE_INDEX_FIELD: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -430,25 +427,27 @@ /* Set Index value to select proper Data register */ /* Get the global lock if needed */ - obj_desc = (ACPI_OBJECT_INTERNAL *) *stack_ptr; + obj_desc = (ACPI_OPERAND_OBJECT *) *stack_ptr; locked = acpi_aml_acquire_global_lock (obj_desc->field_unit.lock_rule); - { - /* Perform the update */ - status = acpi_aml_set_named_field_value (val_desc->index_field.index, - &val_desc->index_field.value, - sizeof (val_desc->index_field.value)); - } + /* Perform the update */ + status = acpi_aml_access_named_field (ACPI_WRITE, + val_desc->index_field.index, + &val_desc->index_field.value, + sizeof (val_desc->index_field.value)); + acpi_aml_release_global_lock (locked); - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* Read Data value */ - status = acpi_aml_get_named_field_value (val_desc->index_field.data, &temp_val, sizeof (temp_val)); - if (AE_OK != status) { + status = acpi_aml_access_named_field (ACPI_READ, + val_desc->index_field.data, + &temp_val, sizeof (temp_val)); + if (ACPI_FAILURE (status)) { return (status); } @@ -463,10 +462,6 @@ case ACPI_TYPE_FIELD_UNIT: - if (!val_desc) { - return (AE_AML_NO_OPERAND); - } - if (attached_aml_pointer) { return (AE_AML_OPERAND_TYPE); } @@ -481,7 +476,8 @@ return (AE_NO_MEMORY); } - if ((status = acpi_aml_get_field_unit_value (val_desc, obj_desc)) != AE_OK) { + status = acpi_aml_get_field_unit_value (val_desc, obj_desc); + if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (obj_desc); return (status); } @@ -490,7 +486,7 @@ /* - * For these objects, just return the object attached to the NTE + * For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: @@ -502,32 +498,11 @@ case ACPI_TYPE_REGION: - /* There must be an object attached to this NTE */ - - if (!val_desc) { - return (AE_AML_INTERNAL); - } - /* Return an additional reference to the object */ obj_desc = val_desc; acpi_cm_add_reference (obj_desc); break; - - - /* Devices rarely have an attached object, return the NTE */ - - case ACPI_TYPE_DEVICE: - - - /* Method locals and arguments have a pseudo-NTE, just return it */ - - case INTERNAL_TYPE_METHOD_ARGUMENT: - case INTERNAL_TYPE_METHOD_LOCAL_VAR: - - return (AE_OK); - break; - /* TYPE_Any is untyped, and thus there is no object associated with it */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresolv.c linux/drivers/acpi/interpreter/amresolv.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresolv.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amresolv.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresolv - AML Interpreter object resolution + * $Revision: 74 $ * *****************************************************************************/ @@ -26,16 +27,16 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresolv"); + MODULE_NAME ("amresolv") /******************************************************************************* @@ -55,8 +56,8 @@ ACPI_STATUS acpi_aml_get_field_unit_value ( - ACPI_OBJECT_INTERNAL *field_desc, - ACPI_OBJECT_INTERNAL *result_desc) + ACPI_OPERAND_OBJECT *field_desc, + ACPI_OPERAND_OBJECT *result_desc) { ACPI_STATUS status = AE_OK; u32 mask; @@ -143,7 +144,7 @@ * FUNCTION: Acpi_aml_resolve_to_value * * PARAMETERS: **Stack_ptr - Points to entry on Obj_stack, which can - * be either an (ACPI_OBJECT_INTERNAL *) + * be either an (ACPI_OPERAND_OBJECT *) * or an ACPI_HANDLE. * * RETURN: Status @@ -154,7 +155,8 @@ ACPI_STATUS acpi_aml_resolve_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; @@ -166,13 +168,13 @@ /* * The entity pointed to by the Stack_ptr can be either - * 1) A valid ACPI_OBJECT_INTERNAL, or - * 2) A ACPI_NAMED_OBJECT(nte) + * 1) A valid ACPI_OPERAND_OBJECT, or + * 2) A ACPI_NAMESPACE_NODE (Named_obj) */ if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_INTERNAL)) { - status = acpi_aml_resolve_object_to_value (stack_ptr); + status = acpi_aml_resolve_object_to_value (stack_ptr, walk_state); if (ACPI_FAILURE (status)) { return (status); } @@ -184,7 +186,7 @@ */ if (VALID_DESCRIPTOR_TYPE (*stack_ptr, ACPI_DESC_TYPE_NAMED)) { - status = acpi_aml_resolve_entry_to_value ((ACPI_NAMED_OBJECT**) stack_ptr); + status = acpi_aml_resolve_node_to_value ((ACPI_NAMESPACE_NODE **) stack_ptr); } @@ -208,19 +210,20 @@ ACPI_STATUS acpi_aml_resolve_object_to_value ( - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *stack_desc; + ACPI_OPERAND_OBJECT *stack_desc; ACPI_STATUS status = AE_OK; ACPI_HANDLE temp_handle = NULL; - ACPI_OBJECT_INTERNAL *obj_desc = NULL; + ACPI_OPERAND_OBJECT *obj_desc = NULL; u32 index = 0; u16 opcode; stack_desc = *stack_ptr; - /* This is an ACPI_OBJECT_INTERNAL */ + /* This is an ACPI_OPERAND_OBJECT */ switch (stack_desc->common.type) { @@ -236,7 +239,7 @@ /* * Convert indirect name ptr to a direct name ptr. - * Then, Acpi_aml_resolve_entry_to_value can be used to get the value + * Then, Acpi_aml_resolve_node_to_value can be used to get the value */ temp_handle = stack_desc->reference.object; @@ -256,24 +259,26 @@ index = stack_desc->reference.offset; - /* Delete the Reference Object */ - - acpi_cm_remove_reference (stack_desc); - /* * Get the local from the method's state info - * Note: this increments the object reference count + * Note: this increments the local's object reference count */ status = acpi_ds_method_data_get_value (MTH_TYPE_LOCAL, index, - stack_ptr); + walk_state, &obj_desc); if (ACPI_FAILURE (status)) { return (status); } - stack_desc = *stack_ptr; + /* + * Now we can delete the original Reference Object and + * replace it with the resolve value + */ + + acpi_cm_remove_reference (stack_desc); + *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == stack_desc->common.type) { + if (ACPI_TYPE_NUMBER == obj_desc->common.type) { /* Value is a Number */ } @@ -285,9 +290,6 @@ index = stack_desc->reference.offset; - /* Delete the Reference Object*/ - - acpi_cm_remove_reference (stack_desc); /* * Get the argument from the method's state info @@ -295,14 +297,20 @@ */ status = acpi_ds_method_data_get_value (MTH_TYPE_ARG, index, - stack_ptr); + walk_state, &obj_desc); if (ACPI_FAILURE (status)) { return (status); } - stack_desc = *stack_ptr; + /* + * Now we can delete the original Reference Object and + * replace it with the resolve value + */ + + acpi_cm_remove_reference (stack_desc); + *stack_ptr = obj_desc; - if (ACPI_TYPE_NUMBER == stack_desc->common.type) { + if (ACPI_TYPE_NUMBER == obj_desc->common.type) { /* Value is a Number */ } @@ -392,7 +400,7 @@ } /* switch (Opcode) */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amresop.c linux/drivers/acpi/interpreter/amresop.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amresop.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amresop.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amresop - AML Interpreter operand/object resolution + * $Revision: 15 $ * *****************************************************************************/ @@ -26,16 +27,16 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" -#include "namesp.h" -#include "tables.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amresop"); + MODULE_NAME ("amresop") /******************************************************************************* @@ -60,19 +61,20 @@ ACPI_STATUS acpi_aml_resolve_operands ( u16 opcode, - ACPI_OBJECT_INTERNAL **stack_ptr) + ACPI_OPERAND_OBJECT **stack_ptr, + ACPI_WALK_STATE *walk_state) { - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; ACPI_STATUS status = AE_OK; u8 object_type; ACPI_HANDLE temp_handle; u32 arg_types; - ACPI_OP_INFO *op_info; + ACPI_OPCODE_INFO *op_info; u32 this_arg_type; op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_AML_BAD_OPCODE); } @@ -105,9 +107,9 @@ /* Decode the descriptor type */ if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_NAMED)) { - /* NTE */ + /* Node */ - object_type = ((ACPI_NAMED_OBJECT*) obj_desc)->type; + object_type = ((ACPI_NAMESPACE_NODE *) obj_desc)->type; } else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) { @@ -128,7 +130,7 @@ */ op_info = acpi_ps_get_opcode_info (opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { return (AE_AML_BAD_OPCODE); } @@ -205,7 +207,8 @@ /* Need an operand of type ACPI_TYPE_NUMBER */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -220,7 +223,8 @@ /* Need an operand of type ACPI_TYPE_STRING or ACPI_TYPE_BUFFER */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -237,7 +241,8 @@ /* Need an operand of type ACPI_TYPE_BUFFER */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -252,7 +257,8 @@ /* Need an operand of type ACPI_TYPE_MUTEX */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -267,7 +273,8 @@ /* Need an operand of type ACPI_TYPE_EVENT */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -282,7 +289,8 @@ /* Need an operand of type ACPI_TYPE_REGION */ - if ((status = acpi_aml_resolve_to_value(stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -308,7 +316,8 @@ /* Need an operand of type ACPI_TYPE_PACKAGE */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -337,7 +346,8 @@ /* All others must be resolved */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -352,15 +362,16 @@ * * The ACPI specification allows Size_of to return the size of * a Buffer, String or Package. However, the MS ACPI.SYS AML - * Interpreter also allows an NTE reference to return without + * Interpreter also allows an Node reference to return without * error with a size of 4. */ - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } - /* Need a buffer, string, package or NTE reference */ + /* Need a buffer, string, package or Node reference */ if (((*stack_ptr)->common.type != ACPI_TYPE_BUFFER) && ((*stack_ptr)->common.type != ACPI_TYPE_STRING) && @@ -372,10 +383,10 @@ } /* - * If this is a reference, only allow a reference to an NTE. + * If this is a reference, only allow a reference to an Node. */ if ((*stack_ptr)->common.type == INTERNAL_TYPE_REFERENCE) { - if (!(*stack_ptr)->reference.nte) { + if (!(*stack_ptr)->reference.node) { status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -386,7 +397,8 @@ case ARGI_COMPLEXOBJ: - if ((status = acpi_aml_resolve_to_value (stack_ptr)) != AE_OK) { + status = acpi_aml_resolve_to_value (stack_ptr, walk_state); + if (ACPI_FAILURE (status)) { goto cleanup; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstore.c linux/drivers/acpi/interpreter/amstore.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstore.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amstore.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amstore - AML Interpreter object store support + * $Revision: 116 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstore"); + MODULE_NAME ("amstore") /******************************************************************************* @@ -43,7 +44,7 @@ * * PARAMETERS: *Val_desc - Value to be stored * *Dest_desc - Where to store it 0 Must be (ACPI_HANDLE) - * or an ACPI_OBJECT_INTERNAL of type + * or an ACPI_OPERAND_OBJECT of type * Reference; if the latter the descriptor * will be either reused or deleted. * @@ -58,13 +59,14 @@ ACPI_STATUS acpi_aml_exec_store ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc) + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *delete_dest_desc = NULL; - ACPI_OBJECT_INTERNAL *tmp_desc; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_OPERAND_OBJECT *delete_dest_desc = NULL; + ACPI_OPERAND_OBJECT *tmp_desc; + ACPI_NAMESPACE_NODE *node = NULL; u8 value = 0; u32 length; u32 i; @@ -81,7 +83,7 @@ if (VALID_DESCRIPTOR_TYPE (dest_desc, ACPI_DESC_TYPE_NAMED)) { /* Dest is an ACPI_HANDLE, create a new object */ - entry = (ACPI_NAMED_OBJECT*) dest_desc; + node = (ACPI_NAMESPACE_NODE *) dest_desc; dest_desc = acpi_cm_create_internal_object (INTERNAL_TYPE_REFERENCE); if (!dest_desc) { /* Allocation failure */ @@ -92,7 +94,7 @@ /* Build a new Reference wrapper around the handle */ dest_desc->reference.op_code = AML_NAME_OP; - dest_desc->reference.object = entry; + dest_desc->reference.object = node; } @@ -115,7 +117,8 @@ * Storing into a Name */ delete_dest_desc = dest_desc; - status = acpi_aml_store_object_to_nte (val_desc, dest_desc->reference.object); + status = acpi_aml_store_object_to_node (val_desc, dest_desc->reference.object, + walk_state); break; /* Case Name_op */ @@ -182,7 +185,7 @@ */ if (ACPI_TYPE_PACKAGE == tmp_desc->common.type) { status = acpi_aml_build_copy_internal_package_object ( - val_desc, tmp_desc); + val_desc, tmp_desc, walk_state); if (ACPI_FAILURE (status)) { acpi_cm_remove_reference (tmp_desc); tmp_desc = NULL; @@ -206,7 +209,8 @@ * convert the contents of the source (Val_desc) and copy into * the destination (Tmp_desc) */ - status = acpi_aml_store_object_to_object(val_desc, tmp_desc); + status = acpi_aml_store_object_to_object (val_desc, tmp_desc, + walk_state); if (ACPI_FAILURE (status)) { /* * An error occurrered when copying the internal object @@ -299,7 +303,7 @@ /* * If we had an error, break out of this case statement. */ - if(AE_OK != status) { + if (ACPI_FAILURE (status)) { break; } @@ -315,7 +319,7 @@ case AML_ONES_OP: /* - * Storing to a constant is a no-op -- see spec sec 15.2.3.3.1. + * Storing to a constant is a no-op -- see ACPI Specification * Delete the result descriptor. */ @@ -326,7 +330,7 @@ case AML_LOCAL_OP: status = acpi_ds_method_data_set_value (MTH_TYPE_LOCAL, - (dest_desc->reference.offset), val_desc); + (dest_desc->reference.offset), val_desc, walk_state); delete_dest_desc = dest_desc; break; @@ -334,7 +338,7 @@ case AML_ARG_OP: status = acpi_ds_method_data_set_value (MTH_TYPE_ARG, - (dest_desc->reference.offset), val_desc); + (dest_desc->reference.offset), val_desc, walk_state); delete_dest_desc = dest_desc; break; @@ -343,7 +347,7 @@ /* * Storing to the Debug object causes the value stored to be - * displayed and otherwise has no effect -- see sec. 15.2.3.3.3. + * displayed and otherwise has no effect -- see ACPI Specification */ delete_dest_desc = dest_desc; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstoren.c linux/drivers/acpi/interpreter/amstoren.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstoren.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amstoren.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,9 @@ /****************************************************************************** * - * Module Name: amstoren - AML Interpreter object store support, store to NTE + * Module Name: amstoren - AML Interpreter object store support, + * Store to Node (namespace object) + * $Revision: 21 $ * *****************************************************************************/ @@ -25,24 +27,24 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstoren"); + MODULE_NAME ("amstoren") /******************************************************************************* * - * FUNCTION: Acpi_aml_store_object_to_nte + * FUNCTION: Acpi_aml_store_object_to_node * * PARAMETERS: *Val_desc - Value to be stored - * *Entry - Named object to recieve the value + * *Node - Named object to recieve the value * * RETURN: Status * @@ -65,9 +67,10 @@ ******************************************************************************/ ACPI_STATUS -acpi_aml_store_object_to_nte ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_NAMED_OBJECT *entry) +acpi_aml_store_object_to_node ( + ACPI_OPERAND_OBJECT *val_desc, + ACPI_NAMESPACE_NODE *node, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; u8 *buffer = NULL; @@ -76,16 +79,16 @@ u32 new_value; u8 locked = FALSE; u8 *location=NULL; - ACPI_OBJECT_INTERNAL *dest_desc; + ACPI_OPERAND_OBJECT *dest_desc; OBJECT_TYPE_INTERNAL destination_type = ACPI_TYPE_ANY; /* * Assuming the parameters are valid!!! */ - ACPI_ASSERT((entry) && (val_desc)); + ACPI_ASSERT((node) && (val_desc)); - destination_type = acpi_ns_get_type (entry); + destination_type = acpi_ns_get_type (node); /* * First ensure we have a value that can be stored in the target @@ -120,8 +123,8 @@ /* * Initially not a number, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER)) { /* @@ -151,8 +154,8 @@ /* * Initially not a valid type, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER) && (val_desc->common.type != ACPI_TYPE_BUFFER) && (val_desc->common.type != ACPI_TYPE_STRING)) @@ -184,7 +187,7 @@ * Val_desc reference count is incremented by Attach_object. */ - status = acpi_ns_attach_object (entry, val_desc, val_desc->common.type); + status = acpi_ns_attach_object (node, val_desc, val_desc->common.type); goto clean_up_and_bail_out; break; @@ -192,24 +195,24 @@ /* Exit now if failure above */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto clean_up_and_bail_out; } /* - * Get descriptor for object attached to NTE + * Get descriptor for object attached to Node */ - dest_desc = acpi_ns_get_attached_object (entry); + dest_desc = acpi_ns_get_attached_object (node); if (!dest_desc) { /* - * There is no existing object attached to this NTE + * There is no existing object attached to this Node */ status = AE_AML_INTERNAL; goto clean_up_and_bail_out; } /* - * Make sure the destination Object is the same as the NTE + * Make sure the destination Object is the same as the Node */ if (dest_desc->common.type != (u8) destination_type) { status = AE_AML_INTERNAL; @@ -237,15 +240,17 @@ * Perform the update (Set Bank Select) */ - status = acpi_aml_set_named_field_value (dest_desc->bank_field.bank_select, - &dest_desc->bank_field.value, - sizeof (dest_desc->bank_field.value)); - if (status == AE_OK) { + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->bank_field.bank_select, + &dest_desc->bank_field.value, + sizeof (dest_desc->bank_field.value)); + if (ACPI_SUCCESS (status)) { /* Set bank select successful, set data value */ - status = acpi_aml_set_named_field_value (dest_desc->bank_field.bank_select, - &val_desc->bank_field.value, - sizeof (val_desc->bank_field.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->bank_field.bank_select, + &val_desc->bank_field.value, + sizeof (val_desc->bank_field.value)); } break; @@ -280,7 +285,9 @@ break; } - status = acpi_aml_set_named_field_value (entry, buffer, length); + status = acpi_aml_access_named_field (ACPI_WRITE, + node, buffer, length); + break; /* Global Lock released below */ @@ -405,16 +412,18 @@ * perform the update (Set index) */ - status = acpi_aml_set_named_field_value (dest_desc->index_field.index, - &dest_desc->index_field.value, - sizeof (dest_desc->index_field.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->index_field.index, + &dest_desc->index_field.value, + sizeof (dest_desc->index_field.value)); - if (AE_OK == status) { + if (ACPI_SUCCESS (status)) { /* set index successful, next set Data value */ - status = acpi_aml_set_named_field_value (dest_desc->index_field.data, - &val_desc->number.value, - sizeof (val_desc->number.value)); + status = acpi_aml_access_named_field (ACPI_WRITE, + dest_desc->index_field.data, + &val_desc->number.value, + sizeof (val_desc->number.value)); } break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amstorob.c linux/drivers/acpi/interpreter/amstorob.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amstorob.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amstorob.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amstorob - AML Interpreter object store support, store to object + * $Revision: 16 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "tables.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amstorob"); + MODULE_NAME ("amstorob") /******************************************************************************* @@ -65,8 +66,9 @@ ACPI_STATUS acpi_aml_store_object_to_object ( - ACPI_OBJECT_INTERNAL *val_desc, - ACPI_OBJECT_INTERNAL *dest_desc) + ACPI_OPERAND_OBJECT *val_desc, + ACPI_OPERAND_OBJECT *dest_desc, + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; u8 *buffer = NULL; @@ -99,8 +101,8 @@ /* * Initially not a number, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER)) { /* @@ -129,8 +131,8 @@ /* * Initially not a valid type, convert */ - status = acpi_aml_resolve_to_value (&val_desc); - if ((status == AE_OK) && + status = acpi_aml_resolve_to_value (&val_desc, walk_state); + if (ACPI_SUCCESS (status) && (val_desc->common.type != ACPI_TYPE_NUMBER) && (val_desc->common.type != ACPI_TYPE_BUFFER) && (val_desc->common.type != ACPI_TYPE_STRING)) @@ -155,7 +157,7 @@ /* Exit now if failure above */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto clean_up_and_bail_out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amsystem.c linux/drivers/acpi/interpreter/amsystem.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amsystem.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amsystem.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amsystem - Interface to OS services + * $Revision: 51 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "hardware.h" -#include "events.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "achware.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amsystem"); + MODULE_NAME ("amsystem") /******************************************************************************* @@ -181,8 +182,8 @@ ACPI_STATUS acpi_aml_system_acquire_mutex ( - ACPI_OBJECT_INTERNAL *time_desc, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *time_desc, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -223,7 +224,7 @@ ACPI_STATUS acpi_aml_system_release_mutex ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -260,7 +261,7 @@ ACPI_STATUS acpi_aml_system_signal_event ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -290,8 +291,8 @@ ACPI_STATUS acpi_aml_system_wait_event ( - ACPI_OBJECT_INTERNAL *time_desc, - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *time_desc, + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; @@ -321,7 +322,7 @@ ACPI_STATUS acpi_aml_system_reset_event ( - ACPI_OBJECT_INTERNAL *obj_desc) + ACPI_OPERAND_OBJECT *obj_desc) { ACPI_STATUS status = AE_OK; void *temp_semaphore; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amutils.c linux/drivers/acpi/interpreter/amutils.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amutils.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amutils.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ /****************************************************************************** * * Module Name: amutils - interpreter/scanner utilities + * $Revision: 53 $ * *****************************************************************************/ @@ -25,21 +26,21 @@ #include "acpi.h" -#include "parser.h" -#include "interp.h" +#include "acparser.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" -#include "events.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amutils"); + MODULE_NAME ("amutils") typedef struct internal_search_st { - ACPI_OBJECT_INTERNAL *dest_obj; + ACPI_OPERAND_OBJECT *dest_obj; u32 index; - ACPI_OBJECT_INTERNAL *source_obj; + ACPI_OPERAND_OBJECT *source_obj; } INTERNAL_PKG_SEARCH_INFO; @@ -49,7 +50,7 @@ INTERNAL_PKG_SEARCH_INFO copy_level[MAX_PACKAGE_DEPTH]; -static char hex[] = +static NATIVE_CHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; @@ -121,41 +122,10 @@ if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) || (type > INTERNAL_TYPE_MAX)) { - return FALSE; + return (FALSE); } - return TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_aml_append_operand_diag - * - * PARAMETERS: *File_name - Name of source file - * Line_num - Line Number in file - * Op_code - Op_code being executed - * Num_operands - Number of operands Prep_stack tried to check - * - * DESCRIPTION: Print diagnostic information about operands. - * This function is intended to be called after Prep_stack - * has returned S_ERROR. - * - ******************************************************************************/ - -void -acpi_aml_append_operand_diag ( - char *file_name, - s32 line_num, - u16 op_code, - ACPI_OBJECT_INTERNAL **operands, - s32 num_operands) -{ - - /* - * This function outputs debug information only - */ - + return (TRUE); } @@ -178,7 +148,7 @@ acpi_aml_buf_seq (void) { - return ++acpi_gbl_buf_seq; + return (++acpi_gbl_buf_seq); } @@ -270,12 +240,12 @@ * ******************************************************************************/ -s32 +u32 acpi_aml_digits_needed ( - s32 val, - s32 base) + u32 val, + u32 base) { - s32 num_digits = 0; + u32 num_digits = 0; if (base < 1) { @@ -309,13 +279,13 @@ union { u32 value; - char bytes[4]; + u8 bytes[4]; } out; union { u32 value; - char bytes[4]; + u8 bytes[4]; } in; @@ -326,7 +296,7 @@ out.bytes[2] = in.bytes[1]; out.bytes[3] = in.bytes[0]; - return out.value; + return (out.value); } @@ -344,7 +314,7 @@ ACPI_STATUS acpi_aml_eisa_id_to_string ( u32 numeric_id, - char *out_string) + NATIVE_CHAR *out_string) { u32 id; @@ -361,7 +331,7 @@ out_string[6] = hex[id & 0xf]; out_string[7] = 0; - return AE_OK; + return (AE_OK); } @@ -381,16 +351,17 @@ ACPI_STATUS acpi_aml_build_copy_internal_package_object ( - ACPI_OBJECT_INTERNAL *source_obj, - ACPI_OBJECT_INTERNAL *dest_obj) + ACPI_OPERAND_OBJECT *source_obj, + ACPI_OPERAND_OBJECT *dest_obj, + ACPI_WALK_STATE *walk_state) { u32 current_depth = 0; ACPI_STATUS status = AE_OK; u32 length = 0; u32 this_index; u32 object_space = 0; - ACPI_OBJECT_INTERNAL *this_dest_obj; - ACPI_OBJECT_INTERNAL *this_source_obj; + ACPI_OPERAND_OBJECT *this_dest_obj; + ACPI_OPERAND_OBJECT *this_source_obj; INTERNAL_PKG_SEARCH_INFO *level_ptr; @@ -429,8 +400,8 @@ while (1) { this_index = level_ptr->index; - this_dest_obj = (ACPI_OBJECT_INTERNAL *) level_ptr->dest_obj->package.elements[this_index]; - this_source_obj = (ACPI_OBJECT_INTERNAL *) level_ptr->source_obj->package.elements[this_index]; + this_dest_obj = (ACPI_OPERAND_OBJECT *) level_ptr->dest_obj->package.elements[this_index]; + this_source_obj = (ACPI_OPERAND_OBJECT *) level_ptr->source_obj->package.elements[this_index]; if (IS_THIS_OBJECT_TYPE (this_source_obj, ACPI_TYPE_PACKAGE)) { /* @@ -458,7 +429,7 @@ * update the buffer length counter */ object_space = this_dest_obj->package.count * - sizeof (ACPI_OBJECT_INTERNAL); + sizeof (ACPI_OPERAND_OBJECT); length += object_space; current_depth++; level_ptr = ©_level[current_depth]; @@ -474,9 +445,9 @@ this_source_obj->common.type); level_ptr->dest_obj->package.elements[this_index] = this_dest_obj; - status = acpi_aml_store_object_to_object(this_source_obj, this_dest_obj); + status = acpi_aml_store_object_to_object(this_source_obj, this_dest_obj, walk_state); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* * Failure get out */ @@ -511,12 +482,6 @@ } } /* else object is NOT a package */ } /* while (1) */ - - - /* - * We'll never get here, but the compiler whines about return value - */ - return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/interpreter/amxface.c linux/drivers/acpi/interpreter/amxface.c --- v2.4.0-test8/linux/drivers/acpi/interpreter/amxface.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/interpreter/amxface.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,8 @@ /****************************************************************************** * - * Module Name: ixface - External interpreter interfaces + * Module Name: amxface - External interpreter interfaces + * $Revision: 22 $ * *****************************************************************************/ @@ -25,11 +26,11 @@ #include "acpi.h" -#include "interp.h" +#include "acinterp.h" #define _COMPONENT INTERPRETER - MODULE_NAME ("amxface"); + MODULE_NAME ("amxface") /* @@ -48,8 +49,8 @@ #define DEFINE_AML_GLOBALS #include "amlcode.h" -#include "parser.h" -#include "namesp.h" +#include "acparser.h" +#include "acnamesp.h" /******************************************************************************* @@ -70,9 +71,9 @@ ACPI_STATUS acpi_aml_execute_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; @@ -84,7 +85,7 @@ acpi_aml_enter_interpreter (); - status = acpi_psx_execute (method_entry, params, return_obj_desc); + status = acpi_psx_execute (method_node, params, return_obj_desc); acpi_aml_exit_interpreter (); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/Makefile linux/drivers/acpi/namespace/Makefile --- v2.4.0-test8/linux/drivers/acpi/namespace/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/namespace/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsaccess.c linux/drivers/acpi/namespace/nsaccess.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsaccess.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsaccess.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace + * $Revision: 108 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,59 +26,16 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" -#include "dispatch.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsaccess"); + MODULE_NAME ("nsaccess") -/**************************************************************************** - * - * FUNCTION: Acpi_ns_root_create_scope - * - * PARAMETERS: Entry - NTE for which a scope will be created - * - * RETURN: Status - * - * DESCRIPTION: Create a scope table for the given name table entry - * - * MUTEX: Expects namespace to be locked - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_root_create_scope ( - ACPI_NAMED_OBJECT *entry) -{ - - /* Allocate a scope table */ - - if (entry->child_table) { - return (AE_EXIST); - } - - entry->child_table = acpi_ns_allocate_name_table (NS_TABLE_SIZE); - if (!entry->child_table) { - /* root name table allocation failure */ - - REPORT_ERROR ("Root name table allocation failure"); - return (AE_NO_MEMORY); - } - - /* - * Init the scope first entry -- since it is the exemplar of - * the scope (Some fields are duplicated to new entries!) - */ - acpi_ns_initialize_table (entry->child_table, NULL, entry); - return (AE_OK); - -} - - -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_root_initialize * @@ -86,40 +43,41 @@ * * RETURN: Status * - * DESCRIPTION: Allocate and initialize the root name table + * DESCRIPTION: Allocate and initialize the default root named objects * * MUTEX: Locks namespace for entire execution * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_root_initialize (void) { ACPI_STATUS status = AE_OK; PREDEFINED_NAMES *init_val = NULL; - ACPI_NAMED_OBJECT *new_entry; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_NAMESPACE_NODE *new_node; + ACPI_OPERAND_OBJECT *obj_desc; acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); /* - * Root is initially NULL, so a non-NULL value indicates + * The global root ptr is initially NULL, so a non-NULL value indicates * that Acpi_ns_root_initialize() has already been called; just return. */ - if (acpi_gbl_root_object->child_table) { + if (acpi_gbl_root_node) { status = AE_OK; goto unlock_and_exit; } - /* Create the root scope */ + /* + * Tell the rest of the subsystem that the root is initialized + * (This is OK because the namespace is locked) + */ + + acpi_gbl_root_node = &acpi_gbl_root_node_struct; - status = acpi_ns_root_create_scope (acpi_gbl_root_object); - if (ACPI_FAILURE (status)) { - goto unlock_and_exit; - } /* Enter the pre-defined names in the name table */ @@ -127,25 +85,25 @@ status = acpi_ns_lookup (NULL, init_val->name, (OBJECT_TYPE_INTERNAL) init_val->type, IMODE_LOAD_PASS2, NS_NO_UPSEARCH, - NULL, &new_entry); + NULL, &new_node); + + if (ACPI_FAILURE (status) || + (!new_node)) /* - * if name entered successfully - * && its entry in Pre_defined_names[] specifies an - * initial value + * Name entered successfully. + * If entry in Pre_defined_names[] specifies an + * initial value, create the initial value. */ - if ((status == AE_OK) && - new_entry && init_val->val) - { + if (init_val->val) { /* * Entry requests an initial value, allocate a * descriptor for it. */ - obj_desc = - acpi_cm_create_internal_object ( - (OBJECT_TYPE_INTERNAL) init_val->type); + obj_desc = acpi_cm_create_internal_object ( + (OBJECT_TYPE_INTERNAL) init_val->type); if (!obj_desc) { status = AE_NO_MEMORY; @@ -164,23 +122,22 @@ case ACPI_TYPE_NUMBER: obj_desc->number.value = - (u32) STRTOUL (init_val->val, NULL, 10); + (u32) STRTOUL (init_val->val, NULL, 10); break; case ACPI_TYPE_STRING: obj_desc->string.length = - (u16) STRLEN (init_val->val); + (u16) STRLEN (init_val->val); /* * Allocate a buffer for the string. All * String.Pointers must be allocated buffers! * (makes deletion simpler) */ - obj_desc->string.pointer = - acpi_cm_allocate ((ACPI_SIZE) - (obj_desc->string.length + 1)); + obj_desc->string.pointer = acpi_cm_allocate ( + (obj_desc->string.length + 1)); if (!obj_desc->string.pointer) { REPORT_ERROR ("Initial value string" @@ -191,24 +148,22 @@ goto unlock_and_exit; } - STRCPY ((char *) obj_desc->string.pointer, - init_val->val); + STRCPY (obj_desc->string.pointer, init_val->val); break; case ACPI_TYPE_MUTEX: obj_desc->mutex.sync_level = - (u16) STRTOUL (init_val->val, NULL, 10); + (u16) STRTOUL (init_val->val, NULL, 10); if (STRCMP (init_val->name, "_GL_") == 0) { /* * Create a counting semaphore for the * global lock */ - status = - acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, - 1, &obj_desc->mutex.semaphore); + status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, + 1, &obj_desc->mutex.semaphore); if (ACPI_FAILURE (status)) { goto unlock_and_exit; @@ -218,8 +173,7 @@ * global lock, save it */ - acpi_gbl_global_lock_semaphore = - obj_desc->mutex.semaphore; + acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore; } else { @@ -232,11 +186,6 @@ goto unlock_and_exit; } } - - /* TBD: [Restructure] These fields may be obsolete */ - - obj_desc->mutex.lock_count = 0; - obj_desc->mutex.thread_id = 0; break; @@ -247,9 +196,9 @@ continue; } - /* Store pointer to value descriptor in nte */ + /* Store pointer to value descriptor in the Node */ - acpi_ns_attach_object (new_entry, obj_desc, + acpi_ns_attach_object (new_node, obj_desc, obj_desc->common.type); } } @@ -261,16 +210,19 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_lookup * - * PARAMETERS: Prefix_scope - Search scope if name is not fully qualified + * PARAMETERS: Prefix_node - Search scope if name is not fully qualified * Pathname - Search pathname, in internal format * (as represented in the AML stream) * Type - Type associated with name * Interpreter_mode - IMODE_LOAD_PASS2 => add name if not found - * Ret_entry - Where the new entry (NTE) is placed + * Flags - Flags describing the search restrictions + * Walk_state - Current state of the walk + * Return_node - Where the Node is placed (if found + * or created successfully) * * RETURN: Status * @@ -279,55 +231,42 @@ * * MUTEX: Assumes namespace is locked. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_lookup ( ACPI_GENERIC_STATE *scope_info, - char *pathname, + NATIVE_CHAR *pathname, OBJECT_TYPE_INTERNAL type, OPERATING_MODE interpreter_mode, u32 flags, ACPI_WALK_STATE *walk_state, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { ACPI_STATUS status; - ACPI_NAME_TABLE *prefix_scope; - ACPI_NAME_TABLE *table_to_search = NULL; - ACPI_NAME_TABLE *scope_to_push = NULL; - ACPI_NAMED_OBJECT *this_entry = NULL; + ACPI_NAMESPACE_NODE *prefix_node; + ACPI_NAMESPACE_NODE *current_node = NULL; + ACPI_NAMESPACE_NODE *scope_to_push = NULL; + ACPI_NAMESPACE_NODE *this_node = NULL; u32 num_segments; ACPI_NAME simple_name; u8 null_name_path = FALSE; OBJECT_TYPE_INTERNAL type_to_check_for; OBJECT_TYPE_INTERNAL this_search_type; - if (!ret_entry) { + if (!return_node) { return (AE_BAD_PARAMETER); } acpi_gbl_ns_lookup_count++; - *ret_entry = ENTRY_NOT_FOUND; - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized: - * - In Pass1 of Load mode, we need to initialize it - * before trying to define a name. - * - In Exec mode, there are no names to be found. - */ + *return_node = ENTRY_NOT_FOUND; - if (IMODE_LOAD_PASS1 == interpreter_mode) { - if ((status = acpi_ns_root_initialize ()) != AE_OK) { - return (status); - } - } - else { - return (AE_NOT_FOUND); - } - } + if (!acpi_gbl_root_node) { + return (AE_NO_NAMESPACE); + } /* * Get the prefix scope. @@ -335,12 +274,12 @@ */ if ((!scope_info) || - (!scope_info->scope.name_table)) + (!scope_info->scope.node)) { - prefix_scope = acpi_gbl_root_object->child_table; + prefix_node = acpi_gbl_root_node; } else { - prefix_scope = scope_info->scope.name_table; + prefix_node = scope_info->scope.node; } @@ -369,6 +308,8 @@ } + /* TBD: [Restructure] - Move the pathname stuff into a new procedure */ + /* Examine the name pointer */ if (!pathname) { @@ -376,7 +317,7 @@ null_name_path = TRUE; num_segments = 0; - this_entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; } @@ -403,14 +344,16 @@ if (*pathname == AML_ROOT_PREFIX) { /* Pathname is fully qualified, look in root name table */ - table_to_search = acpi_gbl_root_object->child_table; + current_node = acpi_gbl_root_node; + /* point to segment part */ + pathname++; /* Direct reference to root, "\" */ if (!(*pathname)) { - this_entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; goto check_for_new_scope_and_exit; } } @@ -418,7 +361,7 @@ else { /* Pathname is relative to current scope, start there */ - table_to_search = prefix_scope; + current_node = prefix_node; /* * Handle up-prefix (carat). More than one prefix @@ -426,23 +369,22 @@ */ while (*pathname == AML_PARENT_PREFIX) { - /* Point to segment part or next Parent_prefix */ pathname++; /* Backup to the parent's scope */ - table_to_search = table_to_search->parent_table; - if (!table_to_search) { + this_node = acpi_ns_get_parent_object (current_node); + if (!this_node) { /* Current scope has no parent scope */ - REPORT_ERROR ("Ns_lookup: Too many parent" - "prefixes or scope has no parent"); - + REPORT_ERROR ("Too many parent prefixes (^) - reached root"); return (AE_NOT_FOUND); } + + current_node = this_node; } } @@ -454,14 +396,18 @@ if (*pathname == AML_DUAL_NAME_PREFIX) { num_segments = 2; + /* point to first segment */ + pathname++; } else if (*pathname == AML_MULTI_NAME_PREFIX_OP) { - num_segments = (s32)* (u8 *) ++pathname; + num_segments = (u32)* (u8 *) ++pathname; + /* point to first segment */ + pathname++; } @@ -484,32 +430,32 @@ */ - while (num_segments-- && table_to_search) { + while (num_segments-- && current_node) { /* - * Search for the current segment in the table where - * it should be. - * Type is significant only at the last (topmost) level. + * Search for the current name segment under the current + * named object. The Type is significant only at the last (topmost) + * level. (We don't care about the types along the path, only + * the type of the final target object.) */ this_search_type = ACPI_TYPE_ANY; if (!num_segments) { this_search_type = type; } + /* Pluck and ACPI name from the front of the pathname */ + MOVE_UNALIGNED32_TO_32 (&simple_name, pathname); + + /* Try to find the ACPI name */ + status = acpi_ns_search_and_enter (simple_name, walk_state, - table_to_search, interpreter_mode, + current_node, interpreter_mode, this_search_type, flags, - &this_entry); + &this_node); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { if (status == AE_NOT_FOUND) { - /* Name not in ACPI namespace */ - - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - REPORT_ERROR ("Name table overflow"); - } + /* Name not found in ACPI namespace */ } @@ -518,92 +464,54 @@ /* - * If 1) last segment (Num_segments == 0) + * If 1) This is the last segment (Num_segments == 0) * 2) and looking for a specific type * (Not checking for TYPE_ANY) * 3) which is not a local type (TYPE_DEF_ANY) * 4) which is not a local type (TYPE_SCOPE) * 5) which is not a local type (TYPE_INDEX_FIELD_DEFN) - * 6) and type of entry is known (not TYPE_ANY) - * 7) and entry does not match request + * 6) and type of object is known (not TYPE_ANY) + * 7) and object does not match request * * Then we have a type mismatch. Just warn and ignore it. */ - if ((num_segments == 0) && - (type_to_check_for != ACPI_TYPE_ANY) && - (type_to_check_for != INTERNAL_TYPE_DEF_ANY) && - (type_to_check_for != INTERNAL_TYPE_SCOPE) && - (type_to_check_for != INTERNAL_TYPE_INDEX_FIELD_DEFN) && - (this_entry->type != ACPI_TYPE_ANY) && - (this_entry->type != type_to_check_for)) + if ((num_segments == 0) && + (type_to_check_for != ACPI_TYPE_ANY) && + (type_to_check_for != INTERNAL_TYPE_DEF_ANY) && + (type_to_check_for != INTERNAL_TYPE_SCOPE) && + (type_to_check_for != INTERNAL_TYPE_INDEX_FIELD_DEFN) && + (this_node->type != ACPI_TYPE_ANY) && + (this_node->type != type_to_check_for)) { - /* Complain about type mismatch */ + /* Complain about a type mismatch */ REPORT_WARNING ("Type mismatch"); } /* - * If last segment and not looking for a specific type, but type of - * found entry is known, use that type to see if it opens a scope. + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that type + * to see if it opens a scope. */ if ((0 == num_segments) && (ACPI_TYPE_ANY == type)) { - type = this_entry->type; + type = this_node->type; } if ((num_segments || acpi_ns_opens_scope (type)) && - (this_entry->child_table == NULL)) + (this_node->child == NULL)) { /* * More segments or the type implies enclosed scope, * and the next scope has not been allocated. */ - if ((IMODE_LOAD_PASS1 == interpreter_mode) || - (IMODE_LOAD_PASS2 == interpreter_mode)) - { - /* - * First or second pass load mode - * ==> locate the next scope - */ - - this_entry->child_table = - acpi_ns_allocate_name_table (NS_TABLE_SIZE); - - if (!this_entry->child_table) { - return (AE_NO_MEMORY); - } - } - - /* Now complain if there is no next scope */ - - if (this_entry->child_table == NULL) { - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - REPORT_ERROR ("Name Table allocation failure"); - return (AE_NOT_FOUND); - } - - return (AE_NOT_FOUND); - } - - - /* Scope table initialization */ - - if (IMODE_LOAD_PASS1 == interpreter_mode || - IMODE_LOAD_PASS2 == interpreter_mode) - { - /* Initialize the new table */ - - acpi_ns_initialize_table (this_entry->child_table, - table_to_search, - this_entry); - } } - table_to_search = this_entry->child_table; + current_node = this_node; + /* point to next name segment */ + pathname += ACPI_NAME_SIZE; } @@ -629,7 +537,7 @@ scope_to_push = NULL; } else { - scope_to_push = this_entry->child_table; + scope_to_push = this_node; } status = acpi_ds_scope_stack_push (scope_to_push, type, @@ -641,7 +549,7 @@ } } - *ret_entry = this_entry; + *return_node = this_node; return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsalloc.c linux/drivers/acpi/namespace/nsalloc.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsalloc.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsalloc.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities + * $Revision: 41 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -25,46 +25,303 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsalloc"); + MODULE_NAME ("nsalloc") + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_create_node + * + * PARAMETERS: + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_NAMESPACE_NODE * +acpi_ns_create_node ( + u32 acpi_name) +{ + ACPI_NAMESPACE_NODE *node; + + + node = acpi_cm_callocate (sizeof (ACPI_NAMESPACE_NODE)); + if (!node) { + return (NULL); + } + + INCREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); + + node->data_type = ACPI_DESC_TYPE_NAMED; + node->name = acpi_name; + node->reference_count = 1; + + return (node); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_delete_node + * + * PARAMETERS: + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +acpi_ns_delete_node ( + ACPI_NAMESPACE_NODE *node) +{ + ACPI_NAMESPACE_NODE *parent_node; + ACPI_NAMESPACE_NODE *prev_node; + ACPI_NAMESPACE_NODE *next_node; + + + parent_node = acpi_ns_get_parent_object (node); + + prev_node = NULL; + next_node = parent_node->child; + + while (next_node != node) { + prev_node = next_node; + next_node = prev_node->peer; + } + + if (prev_node) { + prev_node->peer = next_node->peer; + if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + prev_node->flags |= ANOBJ_END_OF_PEER_LIST; + } + } + else { + parent_node->child = next_node->peer; + } + + + DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); + + /* + * Detach an object if there is one + */ + + if (node->object) { + acpi_ns_detach_object (node); + } + + acpi_cm_free (node); + + + return; +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ns_install_node + * + * PARAMETERS: Walk_state - Current state of the walk + * Parent_node - The parent of the new Node + * Node - The new Node to install + * Type - ACPI object type of the new Node + * + * RETURN: None + * + * DESCRIPTION: Initialize a new entry within a namespace table. + * + ******************************************************************************/ + +void +acpi_ns_install_node ( + ACPI_WALK_STATE *walk_state, + ACPI_NAMESPACE_NODE *parent_node, /* Parent */ + ACPI_NAMESPACE_NODE *node, /* New Child*/ + OBJECT_TYPE_INTERNAL type) +{ + u16 owner_id = TABLE_ID_DSDT; + ACPI_NAMESPACE_NODE *child_node; + + + /* + * Get the owner ID from the Walk state + * The owner ID is used to track table deletion and + * deletion of objects created by methods + */ + if (walk_state) { + owner_id = walk_state->owner_id; + } + + + /* link the new entry into the parent and existing children */ + + /* TBD: Could be first, last, or alphabetic */ + + child_node = parent_node->child; + if (!child_node) { + parent_node->child = node; + } + + else { + while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { + child_node = child_node->peer; + } + + child_node->peer = node; + + /* Clear end-of-list flag */ + + child_node->flags &= ~ANOBJ_END_OF_PEER_LIST; + } + + /* Init the new entry */ + + node->owner_id = owner_id; + node->flags |= ANOBJ_END_OF_PEER_LIST; + node->peer = parent_node; + + + /* + * If adding a name with unknown type, or having to + * add the region in order to define fields in it, we + * have a forward reference. + */ + + if ((ACPI_TYPE_ANY == type) || + (INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + /* + * We don't want to abort here, however! + * We will fill in the actual type when the + * real definition is found later. + */ + + } + + /* + * The Def_field_defn and Bank_field_defn cases are actually + * looking up the Region in which the field will be defined + */ + + if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + type = ACPI_TYPE_REGION; + } + + /* + * Scope, Def_any, and Index_field_defn are bogus "types" which do + * not actually have anything to do with the type of the name + * being looked up. Save any other value of Type as the type of + * the entry. + */ + + if ((type != INTERNAL_TYPE_SCOPE) && + (type != INTERNAL_TYPE_DEF_ANY) && + (type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) + { + node->type = (u8) type; + } + + /* + * Increment the reference count(s) of all parents up to + * the root! + */ + + while ((node = acpi_ns_get_parent_object (node)) != NULL) { + node->reference_count++; + } + + return; +} -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_allocate_name_table + * FUNCTION: Acpi_ns_delete_children * - * PARAMETERS: Nte_count - Count of NTEs to allocate + * PARAMETERS: Parent_node - Delete this objects children * - * RETURN: The address of the first nte in the array, or NULL + * RETURN: None. * - * DESCRIPTION: Allocate an array of nte, including prepended link space - * Array is set to all zeros via Acpi_os_callcate(). + * DESCRIPTION: Delete all children of the parent object. Deletes a + * "scope". * - ***************************************************************************/ + ******************************************************************************/ -ACPI_NAME_TABLE * -acpi_ns_allocate_name_table ( - u32 num_entries) +void +acpi_ns_delete_children ( + ACPI_NAMESPACE_NODE *parent_node) { - ACPI_NAME_TABLE *name_table = NULL; - ACPI_SIZE alloc_size; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *next_node; + u8 flags; + + + if (!parent_node) { + return; + } + + /* If no children, all done! */ + + child_node = parent_node->child; + if (!child_node) { + return; + } + + /* + * Deallocate all children at this level + */ + do + { + /* Get the things we need */ + + next_node = child_node->peer; + flags = child_node->flags; + + /* Grandchildren should have all been deleted already */ + + /* Now we can free this child object */ - alloc_size = sizeof (ACPI_NAME_TABLE) + ((num_entries - 1) * - sizeof (ACPI_NAMED_OBJECT)); + DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); - name_table = acpi_cm_callocate (alloc_size); + /* + * Detach an object if there is one + */ + + if (child_node->object) { + acpi_ns_detach_object (child_node); + } + + acpi_cm_free (child_node); + + /* And move on to the next child in the list */ + + child_node = next_node; + } while (!(flags & ANOBJ_END_OF_PEER_LIST)); - return (name_table); + + /* Clear the parent's child pointer */ + + parent_node->child = NULL; + + return; } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_delete_namespace_subtree * @@ -72,22 +329,27 @@ * * RETURN: None. * - * DESCRIPTION: Delete a subtree of the namespace. This includes all objects stored - * within the subtree. Scope tables are deleted also + * DESCRIPTION: Delete a subtree of the namespace. This includes all objects + * stored within the subtree. Scope tables are deleted also * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_delete_namespace_subtree ( - ACPI_NAMED_OBJECT *parent_entry) + ACPI_NAMESPACE_NODE *parent_node) { - ACPI_NAMED_OBJECT *child_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_OPERAND_OBJECT *obj_desc; u32 level; - ACPI_OBJECT_INTERNAL *obj_desc; - child_entry = 0; - level = 1; + if (!parent_node) { + return (AE_OK); + } + + + child_node = 0; + level = 1; /* * Traverse the tree of objects until we bubble back up @@ -100,53 +362,32 @@ * Null returned if not found */ - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); - - if (child_entry) { + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node, + child_node); + if (child_node) { /* * Found an object - delete the object within * the Value field */ - obj_desc = acpi_ns_get_attached_object (child_entry); + obj_desc = acpi_ns_get_attached_object (child_node); if (obj_desc) { - acpi_ns_detach_object (child_entry); + acpi_ns_detach_object (child_node); acpi_cm_remove_reference (obj_desc); } - /* - * Clear the NTE in case this scope is reused - * (e.g., a control method scope) - */ - - child_entry->type = ACPI_TYPE_ANY; - child_entry->name = 0; - /* Check if this object has any children */ - if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_entry, 0)) { + if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) { /* * There is at least one child of this object, * visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; - } - - else { - /* - * There may be a name table even if there are - * no children - */ - - acpi_ns_delete_name_table (child_entry->child_table); - child_entry->child_table = NULL; - + parent_node = child_node; + child_node = 0; } } @@ -158,26 +399,18 @@ level--; /* - * Delete the scope (Name Table) associated with - * the parent object + * Now delete all of the children of this parent + * all at the same time. */ - /* Don't delete the top level scope, this allows - * the dynamic deletion of objects created underneath - * control methods! - */ - - if (level != 0) { - acpi_ns_delete_name_table (parent_entry->child_table); - parent_entry->child_table = NULL; - } + acpi_ns_delete_children (parent_node); /* New "last child" is this parent object */ - child_entry = parent_entry; + child_node = parent_node; /* Now we can move up the tree to the grandparent */ - parent_entry = acpi_ns_get_parent_entry (parent_entry); + parent_node = acpi_ns_get_parent_object (parent_node); } } @@ -186,70 +419,55 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_remove_reference * - * PARAMETERS: Entry - NTE whose reference count is to be decremented + * PARAMETERS: Node - Named object whose reference count is to be + * decremented * * RETURN: None. * - * DESCRIPTION: Remove an NTE reference. Decrements the reference count of - * all parent NTEs up to the root. Any NTE along the way that - * reaches zero references is freed. + * DESCRIPTION: Remove a Node reference. Decrements the reference count + * of all parent Nodes up to the root. Any object along + * the way that reaches zero references is freed. * - ***************************************************************************/ + ******************************************************************************/ void acpi_ns_remove_reference ( - ACPI_NAMED_OBJECT *entry) + ACPI_NAMESPACE_NODE *node) { - ACPI_NAMED_OBJECT *this_entry; - - - /* There may be a name table even if there are no children */ - - acpi_ns_delete_name_table (entry->child_table); - entry->child_table = NULL; + ACPI_NAMESPACE_NODE *next_node; /* - * Decrement the reference count(s) of all parents up to the root, - * And delete anything with zero remaining references. + * Decrement the reference count(s) of this object and all + * objects up to the root, Delete anything with zero remaining references. */ - this_entry = entry; - while (this_entry) { - /* Decrement the reference */ + next_node = node; + while (next_node) { + /* Decrement the reference count on this object*/ - this_entry->reference_count--; + next_node->reference_count--; - /* Delete entry if no more references */ - - if (!this_entry->reference_count) { - /* Delete the scope if present */ - - if (this_entry->child_table) { - acpi_ns_delete_name_table (this_entry->child_table); - this_entry->child_table = NULL; - } - - /* - * Mark the entry free - * (This doesn't deallocate anything) - */ + /* Delete the object if no more references */ - acpi_ns_free_table_entry (this_entry); + if (!next_node->reference_count) { + /* Delete all children and delete the object */ + acpi_ns_delete_children (next_node); + acpi_ns_delete_node (next_node); } /* Move up to parent */ - this_entry = acpi_ns_get_parent_entry (this_entry); + next_node = acpi_ns_get_parent_object (next_node); } } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_delete_namespace_by_owner * @@ -261,21 +479,21 @@ * specific ID. Used to delete entire ACPI tables. All * reference counts are updated. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_delete_namespace_by_owner ( u16 owner_id) { - ACPI_NAMED_OBJECT *child_entry; + ACPI_NAMESPACE_NODE *child_node; u32 level; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *parent_node; - parent_entry = acpi_gbl_root_object; - child_entry = 0; - level = 1; + parent_node = acpi_gbl_root_node; + child_node = 0; + level = 1; /* * Traverse the tree of objects until we bubble back up @@ -288,124 +506,65 @@ * Null returned if not found */ - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, parent_node, + child_node); - if (child_entry) { - if (child_entry->owner_id == owner_id) { + if (child_node) { + if (child_node->owner_id == owner_id) { /* * Found an object - delete the object within * the Value field */ - obj_desc = acpi_ns_get_attached_object (child_entry); + obj_desc = acpi_ns_get_attached_object (child_node); if (obj_desc) { - acpi_ns_detach_object (child_entry); + acpi_ns_detach_object (child_node); acpi_cm_remove_reference (obj_desc); } } /* Check if this object has any children */ - if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_entry, 0)) { + if (acpi_ns_get_next_object (ACPI_TYPE_ANY, child_node, 0)) { /* * There is at least one child of this object, * visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; + parent_node = child_node; + child_node = 0; } - else if (child_entry->owner_id == owner_id) { - acpi_ns_remove_reference (child_entry); + else if (child_node->owner_id == owner_id) { + acpi_ns_remove_reference (child_node); } } else { /* - * No more children in this object. - * We will move up to the grandparent. + * No more children in this object. Move up to grandparent. */ level--; - /* - * Delete the scope (Name Table) associated with - * the parent object - */ - /* Don't delete the top level scope, this allows - * the dynamic deletion of objects created underneath - * control methods! - */ - - if (level != 0) { - if (parent_entry->owner_id == owner_id) { - acpi_ns_remove_reference (parent_entry); + if (parent_node->owner_id == owner_id) { + acpi_ns_remove_reference (parent_node); } } - /* New "last child" is this parent object */ - child_entry = parent_entry; + child_node = parent_node; /* Now we can move up the tree to the grandparent */ - parent_entry = acpi_ns_get_parent_entry (parent_entry); + parent_node = acpi_ns_get_parent_object (parent_node); } } return (AE_OK); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_delete_name_table - * - * PARAMETERS: Scope - A handle to the scope to be deleted - * - * RETURN: None. - * - * DESCRIPTION: Delete a namespace Name Table with zero or - * more appendages. The table and all appendages are deleted. - * - ***************************************************************************/ - -void -acpi_ns_delete_name_table ( - ACPI_NAME_TABLE *name_table) -{ - ACPI_NAME_TABLE *this_table; - ACPI_NAME_TABLE *next_table; - - - if (!name_table) { - return; - } - - this_table = name_table; - - - /* - * Deallocate the name table and all appendages - */ - do - { - next_table = this_table->next_table; - - /* Now we can free the table */ - - acpi_cm_free (this_table); - this_table = next_table; - - } while (this_table); - - return; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsdump.c linux/drivers/acpi/namespace/nsdump.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsdump.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/namespace/nsdump.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,36 @@ +/****************************************************************************** + * + * Module Name: nsdump - table dumping routines for debug + * $Revision: 78 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#include "acpi.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" + + +#define _COMPONENT NAMESPACE + MODULE_NAME ("nsdump") + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nseval.c linux/drivers/acpi/namespace/nseval.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nseval.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nseval.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. + * $Revision: 76 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -27,20 +27,20 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "interp.h" -#include "namesp.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nseval"); + MODULE_NAME ("nseval") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_relative * - * PARAMETERS: Rel_obj_entry - NTE of the relative containing object + * PARAMETERS: Handle - The relative containing object * *Pathname - Name of method to execute, If NULL, the * handle is the object to execute * **Params - List of parameters to pass to the method, @@ -56,19 +56,19 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_relative ( - ACPI_NAMED_OBJECT *handle, - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + ACPI_NAMESPACE_NODE *handle, + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { - ACPI_NAMED_OBJECT *rel_obj_entry; + ACPI_NAMESPACE_NODE *prefix_node; ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + NATIVE_CHAR *internal_path = NULL; ACPI_GENERIC_STATE scope_info; @@ -86,12 +86,12 @@ return (status); } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - rel_obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!rel_obj_entry) { + prefix_node = acpi_ns_convert_handle_to_entry (handle); + if (!prefix_node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); status = AE_BAD_PARAMETER; goto cleanup; @@ -99,15 +99,14 @@ /* Lookup the name in the namespace */ - scope_info.scope.name_table = rel_obj_entry->child_table; + scope_info.scope.node = prefix_node->child; status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &obj_entry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &node); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -116,7 +115,7 @@ * to evaluate it. */ - status = acpi_ns_evaluate_by_handle (obj_entry, params, return_object); + status = acpi_ns_evaluate_by_handle (node, params, return_object); cleanup: @@ -128,7 +127,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_by_name * @@ -146,26 +145,24 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_by_name ( - char *pathname, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + NATIVE_CHAR *pathname, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + NATIVE_CHAR *internal_path = NULL; /* Build an internal name string for the method */ - if (pathname[0] != '\\' || pathname[1] != '/') { - status = acpi_ns_internalize_name (pathname, &internal_path); - if (ACPI_FAILURE (status)) { - return (status); - } + status = acpi_ns_internalize_name (pathname, &internal_path); + if (ACPI_FAILURE (status)) { + return (status); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); @@ -173,13 +170,12 @@ /* Lookup the name in the namespace */ status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &obj_entry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &node); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto cleanup; } @@ -188,7 +184,7 @@ * to evaluate it. */ - status = acpi_ns_evaluate_by_handle (obj_entry, params, return_object); + status = acpi_ns_evaluate_by_handle (node, params, return_object); cleanup: @@ -203,16 +199,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_evaluate_by_handle * - * PARAMETERS: Obj_entry - NTE of method to execute - * *Return_object - Where to put method's return value (if - * any). If NULL, no value is returned. + * PARAMETERS: Handle - Method Node to execute * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. + * *Return_object - Where to put method's return value (if + * any). If NULL, no value is returned. * * RETURN: Status * @@ -220,22 +216,22 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_evaluate_by_handle ( - ACPI_NAMED_OBJECT *handle, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_object) + ACPI_NAMESPACE_NODE *handle, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_object) { - ACPI_NAMED_OBJECT *obj_entry; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *local_return_object; + ACPI_OPERAND_OBJECT *local_return_object; /* Check if namespace has been initialized */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } @@ -251,12 +247,12 @@ *return_object = NULL; } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -271,14 +267,11 @@ * In both cases, the namespace is unlocked by the * Acpi_ns* procedure */ - - if (acpi_ns_get_type (obj_entry) == ACPI_TYPE_METHOD) { + if (acpi_ns_get_type (node) == ACPI_TYPE_METHOD) { /* * Case 1) We have an actual control method to execute */ - - status = acpi_ns_execute_control_method (obj_entry, - params, + status = acpi_ns_execute_control_method (node, params, &local_return_object); } @@ -287,9 +280,7 @@ * Case 2) Object is NOT a method, just return its * current value */ - - status = acpi_ns_get_object_value (obj_entry, - &local_return_object); + status = acpi_ns_get_object_value (node, &local_return_object); } @@ -297,7 +288,6 @@ * Check if there is a return value on the stack that must * be dealt with */ - if (status == AE_CTRL_RETURN_VALUE) { /* * If the Method returned a value and the caller @@ -305,13 +295,11 @@ * the returned value to the object descriptor provided * by the caller. */ - if (return_object) { /* * Valid return object, copy the pointer to * the returned object */ - *return_object = local_return_object; } @@ -327,7 +315,6 @@ * Namespace was unlocked by the handling Acpi_ns* function, * so we just return */ - return (status); @@ -338,14 +325,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_execute_control_method * - * PARAMETERS: Method_entry - The Nte of the object/method + * PARAMETERS: Method_node - The object/method * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. + * **Return_obj_desc - List of result objects to be returned + * from the method. * * RETURN: Status * @@ -353,36 +342,31 @@ * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_execute_control_method ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; /* Verify that there is a method associated with this object */ - obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) method_entry); + obj_desc = acpi_ns_get_attached_object ((ACPI_HANDLE) method_node); if (!obj_desc) { return (AE_ERROR); } - /* - * Valid method, Set the current scope to that of the Method, - * and execute it. - */ - /* * Unlock the namespace before execution. This allows namespace access * via the external Acpi* interfaces while a method is being executed. * However, any namespace deletion must acquire both the namespace and - * interpter locks to ensure that no thread is using the portion of the + * interpreter locks to ensure that no thread is using the portion of the * namespace that is being deleted. */ @@ -391,17 +375,17 @@ /* * Excecute the method via the interpreter */ - status = acpi_aml_execute_method (method_entry, params, return_obj_desc); + status = acpi_aml_execute_method (method_node, params, return_obj_desc); return (status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_get_object_value * - * PARAMETERS: Object_entry - The Nte of the object + * PARAMETERS: Node - The object * * RETURN: Status * @@ -409,30 +393,29 @@ * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_get_object_value ( - ACPI_NAMED_OBJECT *object_entry, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status = AE_OK; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *val_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *val_desc; /* * We take the value from certain objects directly */ - if ((object_entry->type == ACPI_TYPE_PROCESSOR) || - (object_entry->type == ACPI_TYPE_POWER)) + if ((node->type == ACPI_TYPE_PROCESSOR) || + (node->type == ACPI_TYPE_POWER)) { - /* * Create a Reference object to contain the object */ - obj_desc = acpi_cm_create_internal_object (object_entry->type); + obj_desc = acpi_cm_create_internal_object (node->type); if (!obj_desc) { status = AE_NO_MEMORY; goto unlock_and_exit; @@ -442,7 +425,7 @@ * Get the attached object */ - val_desc = acpi_ns_get_attached_object (object_entry); + val_desc = acpi_ns_get_attached_object (node); if (!val_desc) { status = AE_NULL_OBJECT; goto unlock_and_exit; @@ -452,10 +435,25 @@ * Just copy from the original to the return object */ - MEMCPY (&obj_desc->common.first_non_common_byte, - &val_desc->common.first_non_common_byte, - (sizeof(ACPI_OBJECT_COMMON) - - sizeof(obj_desc->common.first_non_common_byte))); + switch (node->type) + { + case ACPI_TYPE_PROCESSOR: + obj_desc->processor.proc_id = val_desc->processor.proc_id; + obj_desc->processor.address = val_desc->processor.address; + obj_desc->processor.sys_handler = val_desc->processor.sys_handler; + obj_desc->processor.drv_handler = val_desc->processor.drv_handler; + obj_desc->processor.addr_handler = val_desc->processor.addr_handler; + + break; + + case ACPI_TYPE_POWER: + obj_desc->power_resource.system_level = val_desc->power_resource.system_level; + obj_desc->power_resource.resource_order = val_desc->power_resource.resource_order; + obj_desc->power_resource.sys_handler = val_desc->power_resource.sys_handler; + obj_desc->power_resource.drv_handler = val_desc->power_resource.drv_handler; + + break; + } } @@ -475,15 +473,19 @@ /* Construct a descriptor pointing to the name */ obj_desc->reference.op_code = (u8) AML_NAME_OP; - obj_desc->reference.object = (void *) object_entry; + obj_desc->reference.object = (void *) node; /* * Use Acpi_aml_resolve_to_value() to get the associated value. * The call to Acpi_aml_resolve_to_value causes * Obj_desc (allocated above) to always be deleted. + * + * NOTE: we can get away with passing in NULL for a walk state + * because Obj_desc is guaranteed to not be a reference to either + * a method local or a method argument */ - status = acpi_aml_resolve_to_value (&obj_desc); + status = acpi_aml_resolve_to_value (&obj_desc, NULL); } /* @@ -491,7 +493,7 @@ * placed in Obj_desc. */ - if (status == AE_OK) { + if (ACPI_SUCCESS (status)) { status = AE_CTRL_RETURN_VALUE; *return_obj_desc = obj_desc; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsload.c linux/drivers/acpi/namespace/nsload.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsload.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsload.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures + * $Revision: 28 $ * *****************************************************************************/ @@ -25,16 +25,16 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "debugger.h" +#include "acparser.h" +#include "acdispat.h" +#include "acdebug.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsload"); + MODULE_NAME ("nsload") /******************************************************************************* @@ -42,7 +42,7 @@ * FUNCTION: Acpi_ns_parse_table * * PARAMETERS: Table_desc - An ACPI table descriptor for table to parse - * Scope - Where to enter the table into the namespace + * Start_node - Where to enter the table into the namespace * * RETURN: Status * @@ -53,50 +53,85 @@ ACPI_STATUS acpi_ns_parse_table ( ACPI_TABLE_DESC *table_desc, - ACPI_NAME_TABLE *scope) + ACPI_NAMESPACE_NODE *start_node) { ACPI_STATUS status; - /* Create the root object */ + /* + * AML Parse, pass 1 + * + * In this pass, we load most of the namespace. Control methods + * are not parsed until later. A parse tree is not created. Instead, + * each Parser Op subtree is deleted when it is finished. This saves + * a great deal of memory, and allows a small cache of parse objects + * to service the entire parse. The second pass of the parse then + * performs another complete parse of the AML.. + */ + + /* Create and init a Root Node */ acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP); if (!acpi_gbl_parsed_namespace_root) { return (AE_NO_MEMORY); } - /* Initialize the root object */ + ((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME; - ((ACPI_NAMED_OP *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME; /* Pass 1: Parse everything except control method bodies */ status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root, table_desc->aml_pointer, - table_desc->aml_length, 0); + table_desc->aml_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + NULL, NULL, NULL, + acpi_ds_load1_begin_op, + acpi_ds_load1_end_op); if (ACPI_FAILURE (status)) { return (status); } - -#ifndef PARSER_ONLY - status = acpi_ps_walk_parsed_aml (acpi_ps_get_child (acpi_gbl_parsed_namespace_root), - acpi_gbl_parsed_namespace_root, NULL, - scope, NULL, NULL, - table_desc->table_id, - acpi_ds_load2_begin_op, - acpi_ds_load2_end_op); + acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root); /* - * Now that the internal namespace has been constructed, we can delete the - * parsed namespace, since it is no longer needed + * AML Parse, pass 2 + * + * In this pass, we resolve forward references and other things + * that could not be completed during the first pass. + * Another complete parse of the AML is performed, but the + * overhead of this is compensated for by the fact that the + * parse objects are all cached. */ + /* Create and init a Root Node */ + + acpi_gbl_parsed_namespace_root = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!acpi_gbl_parsed_namespace_root) { + return (AE_NO_MEMORY); + } + + ((ACPI_PARSE2_OBJECT *) acpi_gbl_parsed_namespace_root)->name = ACPI_ROOT_NAME; + + + /* Pass 2: Resolve forward references */ + + status = acpi_ps_parse_aml (acpi_gbl_parsed_namespace_root, + table_desc->aml_pointer, + table_desc->aml_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + NULL, NULL, NULL, + acpi_ds_load2_begin_op, + acpi_ds_load2_end_op); + + if (ACPI_FAILURE (status)) { + return (status); + } + acpi_ps_delete_parse_tree (acpi_gbl_parsed_namespace_root); acpi_gbl_parsed_namespace_root = NULL; -#endif return (status); @@ -120,7 +155,7 @@ ACPI_STATUS acpi_ns_load_table ( ACPI_TABLE_DESC *table_desc, - ACPI_NAMED_OBJECT *entry) + ACPI_NAMESPACE_NODE *node) { ACPI_STATUS status; @@ -146,7 +181,7 @@ */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - status = acpi_ns_parse_table (table_desc, entry->child_table); + status = acpi_ns_parse_table (table_desc, node->child); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (status)) { @@ -160,7 +195,7 @@ * parse trees. */ - status = acpi_ds_initialize_objects (table_desc, entry); + status = acpi_ds_initialize_objects (table_desc, node); return (status); } @@ -222,7 +257,7 @@ /* Now load the single DSDT */ - status = acpi_ns_load_table (table_desc, acpi_gbl_root_object); + status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); if (ACPI_SUCCESS (status)) { table_desc->loaded_into_namespace = TRUE; } @@ -247,7 +282,7 @@ if (!table_desc->loaded_into_namespace) { status = acpi_ns_load_table (table_desc, - acpi_gbl_root_object); + acpi_gbl_root_node); if (ACPI_FAILURE (status)) { break; } @@ -276,7 +311,7 @@ if (!table_desc->loaded_into_namespace) { status = acpi_ns_load_table (table_desc, - acpi_gbl_root_object); + acpi_gbl_root_node); if (ACPI_FAILURE (status)) { break; } @@ -306,52 +341,6 @@ /****************************************************************************** * - * FUNCTION: Acpi_ns_free_table_entry - * - * PARAMETERS: Entry - The entry to be deleted - * - * RETURNS None - * - * DESCRIPTION: Free an entry in a namespace table. Delete any objects contained - * in the entry, unlink the entry, then mark it unused. - * - ******************************************************************************/ - -void -acpi_ns_free_table_entry ( - ACPI_NAMED_OBJECT *entry) -{ - - if (!entry) { - return; - } - - /* - * Need to delete - * 1) The scope, if any - * 2) An attached object, if any - */ - - if (entry->child_table) { - acpi_cm_free (entry->child_table); - entry->child_table = NULL; - } - - if (entry->object) { - acpi_ns_detach_object (entry->object); - entry->object = NULL; - } - - /* Mark the entry unallocated */ - - entry->name = 0; - - return; -} - - -/****************************************************************************** - * * FUNCTION: Acpi_ns_delete_subtree * * PARAMETERS: Start_handle - Handle in namespace where search begins @@ -394,15 +383,6 @@ child_handle, &next_child_handle); - /* - * Regardless of the success or failure of the - * previous operation, we are done with the previous - * object (if there was one), and any children it - * may have had. So we can now safely delete it (and - * its scope, if any) - */ - - acpi_ns_free_table_entry (child_handle); child_handle = next_child_handle; @@ -432,6 +412,11 @@ * the object's parent */ level--; + + /* Delete all children now */ + + acpi_ns_delete_children (child_handle); + child_handle = parent_handle; acpi_get_parent (parent_handle, &parent_handle); } @@ -439,7 +424,7 @@ /* Now delete the starting object, and we are done */ - acpi_ns_free_table_entry ((ACPI_NAMED_OBJECT*) child_handle); + acpi_ns_delete_node (child_handle); return (AE_OK); @@ -469,7 +454,7 @@ /* Parameter validation */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsnames.c linux/drivers/acpi/namespace/nsnames.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsnames.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsnames.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsnames - Name manipulation and search + * $Revision: 48 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,42 +26,40 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsnames"); + MODULE_NAME ("nsnames") -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_name_of_scope + * FUNCTION: Acpi_ns_get_table_pathname * - * PARAMETERS: Scope - Scope whose name is needed + * PARAMETERS: Node - Scope whose name is needed * * RETURN: Pointer to storage containing the fully qualified name of * the scope, in Label format (all segments strung together * with no separators) * - * DESCRIPTION: Used via Acpi_ns_name_of_current_scope() and Acpi_ns_last_fQN() - * for label generation in the interpreter, and for debug - * printing in Acpi_ns_search_table(). - * - ***************************************************************************/ - -char * -acpi_ns_name_of_scope ( - ACPI_NAME_TABLE *scope) + * DESCRIPTION: Used for debug printing in Acpi_ns_search_table(). + * + ******************************************************************************/ + +NATIVE_CHAR * +acpi_ns_get_table_pathname ( + ACPI_NAMESPACE_NODE *node) { - char *name_buffer; - ACPI_SIZE size; + NATIVE_CHAR *name_buffer; + u32 size; ACPI_NAME name; - ACPI_NAMED_OBJECT *entry_to_search; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *parent_node; - if (!acpi_gbl_root_object->child_table || !scope) { + if (!acpi_gbl_root_node || !node) { /* * If the name space has not been initialized, * this function should not have been called. @@ -69,26 +67,26 @@ return (NULL); } - entry_to_search = scope->entries; + child_node = node->child; - /* Calculate required buffer size based on depth below root NT */ + /* Calculate required buffer size based on depth below root */ size = 1; - parent_entry = entry_to_search; - while (parent_entry) { - parent_entry = acpi_ns_get_parent_entry (parent_entry); - if (parent_entry) { + parent_node = child_node; + while (parent_node) { + parent_node = acpi_ns_get_parent_object (parent_node); + if (parent_node) { size += ACPI_NAME_SIZE; } } - /* Allocate the buffer */ + /* Allocate a buffer to be returned to caller */ name_buffer = acpi_cm_callocate (size + 1); if (!name_buffer) { - REPORT_ERROR ("Ns_name_of_scope: allocation failure"); + REPORT_ERROR ("Ns_get_table_pathname: allocation failure"); return (NULL); } @@ -97,15 +95,15 @@ name_buffer[size] = '\0'; while ((size > ACPI_NAME_SIZE) && - acpi_ns_get_parent_entry (entry_to_search)) + acpi_ns_get_parent_object (child_node)) { size -= ACPI_NAME_SIZE; - name = acpi_ns_find_parent_name (entry_to_search); + name = acpi_ns_find_parent_name (child_node); /* Put the name into the buffer */ MOVE_UNALIGNED32_TO_32 ((name_buffer + size), &name); - entry_to_search = acpi_ns_get_parent_entry (entry_to_search); + child_node = acpi_ns_get_parent_object (child_node); } name_buffer[--size] = AML_ROOT_PREFIX; @@ -115,69 +113,39 @@ } -/**************************************************************************** - * - * FUNCTION: Acpi_ns_name_of_current_scope - * - * PARAMETERS: none - * - * RETURN: pointer to storage containing the name of the current scope - * - ***************************************************************************/ - -char * -acpi_ns_name_of_current_scope ( - ACPI_WALK_STATE *walk_state) -{ - char *scope_name; - - - if (walk_state && walk_state->scope_info) { - scope_name = - acpi_ns_name_of_scope (walk_state->scope_info->scope.name_table); - - return (scope_name); - } - - REPORT_ERROR ("Current scope pointer is invalid"); - - return (NULL); -} - - -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_handle_to_pathname * - * PARAMETERS: Target_handle - Handle of nte whose name is to be found + * PARAMETERS: Target_handle - Handle of named object whose name is + * to be found * Buf_size - Size of the buffer provided * User_buffer - Where the pathname is returned * - * RETURN: Status, Buffer is filled with pathname if status == AE_OK + * RETURN: Status, Buffer is filled with pathname if status is AE_OK * * DESCRIPTION: Build and return a full namespace pathname * * MUTEX: Locks Namespace * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_handle_to_pathname ( ACPI_HANDLE target_handle, u32 *buf_size, - char *user_buffer) + NATIVE_CHAR *user_buffer) { ACPI_STATUS status = AE_OK; - ACPI_NAMED_OBJECT *entry_to_search = NULL; - ACPI_NAMED_OBJECT *temp = NULL; - ACPI_SIZE path_length = 0; - ACPI_SIZE size; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *next_node; + u32 path_length; + u32 size; u32 user_buf_size; ACPI_NAME name; - u8 namespace_was_locked; - if (!acpi_gbl_root_object->child_table || !target_handle) { + if (!acpi_gbl_root_node || !target_handle) { /* * If the name space has not been initialized, * this function should not have been called. @@ -186,13 +154,8 @@ return (AE_NO_NAMESPACE); } - namespace_was_locked = acpi_gbl_acpi_mutex_info[ACPI_MTX_NAMESPACE].locked; - if (!namespace_was_locked) { - acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - } - - entry_to_search = acpi_ns_convert_handle_to_entry (target_handle); - if (!entry_to_search) { + node = acpi_ns_convert_handle_to_entry (target_handle); + if (!node) { return (AE_BAD_PARAMETER); } @@ -200,9 +163,9 @@ * Compute length of pathname as 5 * number of name segments. * Go back up the parent tree to the root */ - for (size = 0, temp = entry_to_search; - acpi_ns_get_parent_entry (temp); - temp = acpi_ns_get_parent_entry (temp)) + for (size = 0, next_node = node; + acpi_ns_get_parent_object (next_node); + next_node = acpi_ns_get_parent_object (next_node)) { size += PATH_SEGMENT_LENGTH; } @@ -217,7 +180,7 @@ if (path_length > user_buf_size) { status = AE_BUFFER_OVERFLOW; - goto unlock_and_exit; + goto exit; } /* Store null terminator */ @@ -228,19 +191,19 @@ /* Put the original ACPI name at the end of the path */ MOVE_UNALIGNED32_TO_32 ((user_buffer + size), - &entry_to_search->name); + &node->name); user_buffer[--size] = PATH_SEPARATOR; /* Build name backwards, putting "." between segments */ - while ((size > ACPI_NAME_SIZE) && entry_to_search) { + while ((size > ACPI_NAME_SIZE) && node) { size -= ACPI_NAME_SIZE; - name = acpi_ns_find_parent_name (entry_to_search); + name = acpi_ns_find_parent_name (node); MOVE_UNALIGNED32_TO_32 ((user_buffer + size), &name); user_buffer[--size] = PATH_SEPARATOR; - entry_to_search = acpi_ns_get_parent_entry (entry_to_search); + node = acpi_ns_get_parent_object (node); } /* @@ -250,254 +213,8 @@ user_buffer[size] = '\\'; - -unlock_and_exit: - - if (!namespace_was_locked) { - acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - } - +exit: return (status); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_pattern_match - * - * PARAMETERS: Obj_entry - A namespace entry - * Search_for - Wildcard pattern string - * - * DESCRIPTION: Matches a namespace name against a wildcard pattern. Only - * a very simple pattern - 4 chars, either a valid char or a "?" - * to match any. - * - ***************************************************************************/ - -u8 -acpi_ns_pattern_match ( - ACPI_NAMED_OBJECT *obj_entry, - char *search_for) -{ - s32 i; - - - for (i = 0; i < ACPI_NAME_SIZE; i++) { - if (search_for[i] != '?' && - search_for[i] != ((char *) &obj_entry->name)[i]) - { - /* No match */ - - return FALSE; - } - } - - /* name matches pattern */ - - return TRUE; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_name_compare - * - * PARAMETERS: Obj_handle - A namespace entry - * Level - Current nesting level - * Context - A FIND_CONTEXT structure - * - * DESCRIPTION: A User_function called by Acpi_ns_walk_namespace(). It performs - * a pattern match for Acpi_ns_low_find_names(), and updates the list - * and count as required. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_name_compare ( - ACPI_HANDLE obj_handle, - u32 level, - void *context, - void **return_value) -{ - FIND_CONTEXT *find = context; - - - /* Match, yes or no? */ - - if (acpi_ns_pattern_match ((ACPI_NAMED_OBJECT*) obj_handle, - find->search_for)) - { - /* Name matches pattern */ - - if (find->list) { - find->list[*(find->count)] = obj_handle; - } - - ++*(find->count); - } - - /* Don't terminate the walk */ - return AE_OK; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_low_find_names - * - * PARAMETERS: *This_entry - Table to be searched - * *Search_for - Pattern to be found. - * 4 bytes, ? matches any character. - * *Count - Output count of matches found. - * Outermost caller should preset to 0 - * List[] - Output array of handles. If - * null, only the count is obtained. - * Max_depth - Maximum depth of search. Use - * INT_MAX for an effectively - * unlimited depth. - * - * DESCRIPTION: Low-level find name. - * Traverse the name space finding names which match a search - * pattern, and return an array of handles in List[]. - * - ***************************************************************************/ - -void -acpi_ns_low_find_names ( - ACPI_NAMED_OBJECT *this_entry, - char *search_for, - s32 *count, - ACPI_HANDLE list[], - s32 max_depth) -{ - FIND_CONTEXT find; - - - if (0 == max_depth || !this_entry || !search_for || !count) { - /* - * Zero requested depth, nothing to search, - * nothing to search for, or count pointer bad - */ - - return; - } - - /* Init the context structure used by compare routine */ - - find.list = list; - find.count = count; - find.search_for = search_for; - - /* Walk the namespace and find all matches */ - - acpi_ns_walk_namespace (ACPI_TYPE_ANY, (ACPI_HANDLE) this_entry, - max_depth, NS_WALK_NO_UNLOCK, - acpi_ns_name_compare, &find, NULL); - - if (list) { - /* null-terminate the output array */ - - list[*count] = (ACPI_HANDLE) 0; - } - - return; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_find_names - - * - * PARAMETERS: *Search_for - pattern to be found. - * 4 bytes, ? matches any character. - * If NULL, "????" will be used. - * Start_handle - Root of subtree to be searched, or - * NS_ALL to search the entire namespace - * Max_depth - Maximum depth of search. Use INT_MAX - * for an effectively unlimited depth. - * - * DESCRIPTION: Traverse the name space finding names which match a search - * pattern, and return an array of handles. The end of the - * array is marked by the value (ACPI_HANDLE)0. A return value - * of (ACPI_HANDLE *)0 indicates that no matching names were - * found or that space for the list could not be allocated. - * if Start_handle is NS_ALL (null) search from the root, - * else it is a handle whose children are to be searched. - * - ***************************************************************************/ - -ACPI_HANDLE * -acpi_ns_find_names ( - char *search_for, - ACPI_HANDLE start_handle, - s32 max_depth) -{ - ACPI_HANDLE *list = NULL; - s32 count; - - - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized, - * there surely are no matching names. - */ - return (NULL); - } - - if (NS_ALL == start_handle) { - /* base is root */ - - start_handle = acpi_gbl_root_object; - } - - else if (((ACPI_NAMED_OBJECT *) start_handle)->child_table) { - /* base has children to search */ - - start_handle = - ((ACPI_NAMED_OBJECT *) start_handle)->child_table->entries; - } - - else { - /* - * If base is not the root and has no children, - * there is nothing to search. - */ - return (NULL); - } - - if (!search_for) { - /* Search name not specified */ - - search_for = "????"; - } - - - /* Pass 1. Get required buffer size, don't try to build list */ - - count = 0; - acpi_ns_low_find_names (start_handle, search_for, &count, - NULL, max_depth); - - if (0 == count) { - return (NULL); - } - - /* Allow for trailing null */ - count++; - - list = acpi_cm_callocate (count * sizeof(ACPI_HANDLE)); - if (!list) { - REPORT_ERROR ("Ns_find_names: allocation failure"); - return (NULL); - } - - /* Pass 2. Fill buffer */ - - count = 0; - acpi_ns_low_find_names (start_handle, search_for, &count, list, max_depth); - - return (list); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsobject.c linux/drivers/acpi/namespace/nsobject.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsobject.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsobject.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsobject - Utilities for objects attached to namespace - * table entries + * table entries + * $Revision: 44 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -27,20 +27,20 @@ #include "acpi.h" #include "amlcode.h" -#include "namesp.h" -#include "interp.h" -#include "tables.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "actables.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsobject"); + MODULE_NAME ("nsobject") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_attach_object * - * PARAMETERS: Handle - Handle of nte + * PARAMETERS: Node - Parent Node * Object - Object to be attached * Type - Type of object, or ACPI_TYPE_ANY if not * known @@ -51,17 +51,16 @@ * * MUTEX: Assumes namespace is locked * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_attach_object ( - ACPI_HANDLE handle, - ACPI_HANDLE object, + ACPI_NAMESPACE_NODE *node, + ACPI_OPERAND_OBJECT *object, OBJECT_TYPE_INTERNAL type) { - ACPI_NAMED_OBJECT *this_entry = (ACPI_NAMED_OBJECT*) handle; - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *previous_obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_OPERAND_OBJECT *previous_obj_desc; OBJECT_TYPE_INTERNAL obj_type = ACPI_TYPE_ANY; u8 flags; u16 opcode; @@ -71,17 +70,17 @@ * Parameter validation */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { /* Name space not initialized */ REPORT_ERROR ("Ns_attach_object: Name space not initialized"); return (AE_NO_NAMESPACE); } - if (!handle) { + if (!node) { /* Invalid handle */ - REPORT_ERROR ("Ns_attach_object: Null name handle"); + REPORT_ERROR ("Ns_attach_object: Null Named_obj handle"); return (AE_BAD_PARAMETER); } @@ -93,7 +92,7 @@ return (AE_BAD_PARAMETER); } - if (!VALID_DESCRIPTOR_TYPE (handle, ACPI_DESC_TYPE_NAMED)) { + if (!VALID_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED)) { /* Not a name handle */ REPORT_ERROR ("Ns_attach_object: Invalid handle"); @@ -102,15 +101,15 @@ /* Check if this object is already attached */ - if (this_entry->object == object) { + if (node->object == object) { return (AE_OK); } - /* Get the current flags field of the NTE */ + /* Get the current flags field of the Node */ - flags = this_entry->flags; - flags &= ~NTE_AML_ATTACHMENT; + flags = node->flags; + flags &= ~ANOBJ_AML_ATTACHMENT; /* If null object, we will just install it */ @@ -121,27 +120,27 @@ } /* - * If the object is an NTE with an attached object, + * If the object is an Node with an attached object, * we will use that (attached) object */ else if (VALID_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_NAMED) && - ((ACPI_NAMED_OBJECT*) object)->object) + ((ACPI_NAMESPACE_NODE *) object)->object) { /* * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - obj_desc = ((ACPI_NAMED_OBJECT*) object)->object; - obj_type = ((ACPI_NAMED_OBJECT*) object)->type; + obj_desc = ((ACPI_NAMESPACE_NODE *) object)->object; + obj_type = ((ACPI_NAMESPACE_NODE *) object)->type; /* * Copy appropriate flags */ - if (((ACPI_NAMED_OBJECT*) object)->flags & NTE_AML_ATTACHMENT) { - flags |= NTE_AML_ATTACHMENT; + if (((ACPI_NAMESPACE_NODE *) object)->flags & ANOBJ_AML_ATTACHMENT) { + flags |= ANOBJ_AML_ATTACHMENT; } } @@ -152,7 +151,7 @@ */ else { - obj_desc = (ACPI_OBJECT_INTERNAL *) object; + obj_desc = (ACPI_OPERAND_OBJECT *) object; /* If a valid type (non-ANY) was given, just use it */ @@ -173,10 +172,10 @@ else if (acpi_tb_system_table_pointer (object)) { /* * Object points into the AML stream. - * Set a flag bit in the NTE to indicate this + * Set a flag bit in the Node to indicate this */ - flags |= NTE_AML_ATTACHMENT; + flags |= ANOBJ_AML_ATTACHMENT; /* * The next byte (perhaps the next two bytes) @@ -263,13 +262,13 @@ /* Save the existing object (if any) for deletion later */ - previous_obj_desc = this_entry->object; + previous_obj_desc = node->object; /* Install the object and set the type, flags */ - this_entry->object = obj_desc; - this_entry->type = (u8) obj_type; - this_entry->flags = flags; + node->object = obj_desc; + node->type = (u8) obj_type; + node->flags |= flags; /* @@ -277,86 +276,12 @@ */ if (previous_obj_desc) { - /* One for the attach to the NTE */ - acpi_cm_remove_reference (previous_obj_desc); - /* Now delete */ - acpi_cm_remove_reference (previous_obj_desc); - } + /* One for the attach to the Node */ - return (AE_OK); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_attach_method - * - * PARAMETERS: Handle - Handle of nte to be set - * Offset - Value to be set - * Length - Length associated with value - * - * DESCRIPTION: Record the given offset and p-code length of the method - * whose handle is passed - * - * MUTEX: Assumes namespace is locked - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_attach_method ( - ACPI_HANDLE handle, - u8 *pcode_addr, - u32 pcode_length) -{ - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_OBJECT_INTERNAL *previous_obj_desc; - ACPI_NAMED_OBJECT *this_entry = (ACPI_NAMED_OBJECT*) handle; - - - /* Parameter validation */ - - if (!acpi_gbl_root_object->child_table) { - /* Name space uninitialized */ - - REPORT_ERROR ("Ns_attach_method: name space uninitialized"); - return (AE_NO_NAMESPACE); - } - - if (!handle) { - /* Null name handle */ - - REPORT_ERROR ("Ns_attach_method: null name handle"); - return (AE_BAD_PARAMETER); - } - - - /* Allocate a method descriptor */ - - obj_desc = acpi_cm_create_internal_object (ACPI_TYPE_METHOD); - if (!obj_desc) { - /* Method allocation failure */ - - REPORT_ERROR ("Ns_attach_method: allocation failure"); - return (AE_NO_MEMORY); - } - - /* Init the method info */ - - obj_desc->method.pcode = pcode_addr; - obj_desc->method.pcode_length = pcode_length; - - /* Update reference count and install */ - - acpi_cm_add_reference (obj_desc); - - previous_obj_desc = this_entry->object; - this_entry->object = obj_desc; + acpi_cm_remove_reference (previous_obj_desc); + /* Now delete */ - /* - * Delete an existing object. Don't try to re-use in case it is shared - */ - if (previous_obj_desc) { acpi_cm_remove_reference (previous_obj_desc); } @@ -364,11 +289,11 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_detach_object * - * PARAMETERS: Object - An object whose Value will be deleted + * PARAMETERS: Node - An object whose Value will be deleted * * RETURN: None. * @@ -376,24 +301,23 @@ * Value is an allocated object, it is freed. Otherwise, the * field is simply cleared. * - ***************************************************************************/ + ******************************************************************************/ void acpi_ns_detach_object ( - ACPI_HANDLE object) + ACPI_NAMESPACE_NODE *node) { - ACPI_NAMED_OBJECT *entry = object; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; - obj_desc = entry->object; + obj_desc = node->object; if (!obj_desc) { return; } /* Clear the entry in all cases */ - entry->object = NULL; + node->object = NULL; /* Found a valid value */ @@ -412,16 +336,16 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_get_attached_object * - * PARAMETERS: Handle - Handle of nte to be examined + * PARAMETERS: Handle - Parent Node to be examined * - * RETURN: Current value of the object field from nte whose handle is - * passed + * RETURN: Current value of the object field from the Node whose + * handle is passed * - ***************************************************************************/ + ******************************************************************************/ void * acpi_ns_get_attached_object ( @@ -435,122 +359,7 @@ return (NULL); } - return (((ACPI_NAMED_OBJECT*) handle)->object); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_compare_object - * - * PARAMETERS: Obj_handle - A namespace entry - * Level - Current nesting level - * Obj_desc - The value to be compared - * - * DESCRIPTION: A User_function called by Acpi_ns_walk_namespace(). It performs - * a comparison for Acpi_ns_find_attached_object(). The comparison is against - * the value in the value field of the Obj_handle (an NTE). - * If a match is found, the handle is returned, which aborts - * Acpi_ns_walk_namespace. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_compare_object ( - ACPI_HANDLE obj_handle, - u32 level, - void *obj_desc, - void **return_value) -{ - - if (((ACPI_NAMED_OBJECT*) obj_handle)->object == obj_desc) { - if (return_value) { - *return_value = obj_handle; - } - - /* Stop the walk */ - return AE_CTRL_TERMINATE; - } - - /* Not found, continue the walk */ - return AE_OK; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_find_attached_object - * - * PARAMETERS: *Obj_desc - Value to be found in ptr_val field. - * Start_handle - Root of subtree to be searched, or - * NS_ALL to search the entire namespace - * Max_depth - Maximum depth of search. Use INT_MAX - * for an effectively unlimited depth. - * - * DESCRIPTION: Traverse the name space until finding a name whose Value field - * matches the Obj_desc parameter, and return a handle to that - * name, or (ACPI_HANDLE)0 if none exists. - * if Start_handle is NS_ALL (null) search from the root, - * else it is a handle whose children are to be searched. - * - ***************************************************************************/ - -ACPI_HANDLE -acpi_ns_find_attached_object ( - ACPI_OBJECT_INTERNAL *obj_desc, - ACPI_HANDLE start_handle, - s32 max_depth) -{ - ACPI_HANDLE ret_object; - ACPI_STATUS status; - - - /* Parameter validation */ - - if (!obj_desc) { - return (NULL); - } - - if (0 == max_depth) { - return (NULL); - } - - if (!acpi_gbl_root_object->child_table) { - /* - * If the name space has not been initialized, - * there surely are no matching values. - */ - return (NULL); - } - - if (NS_ALL == start_handle) { - start_handle = acpi_gbl_root_object; - } - - else { - /* - * If base is not the root and has no children, - * there is nothing to search. - */ - return (NULL); - } - - - /* - * Walk namespace until a match is found. - * Either the matching object is returned, or NULL in case - * of no match. - */ - status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, start_handle, - max_depth, NS_WALK_NO_UNLOCK, - acpi_ns_compare_object, - obj_desc, &ret_object); - - if (ACPI_FAILURE (status)) { - ret_object = NULL; - } - - return (ret_object); + return (((ACPI_NAMESPACE_NODE *) handle)->object); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nssearch.c linux/drivers/acpi/namespace/nssearch.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nssearch.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nssearch.c Fri Sep 15 14:30:30 2000 @@ -1,9 +1,9 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nssearch - Namespace search + * $Revision: 57 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,192 +26,132 @@ #include "acpi.h" #include "amlcode.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nssearch"); + MODULE_NAME ("nssearch") -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: Acpi_ns_search_one_scope + * FUNCTION: Acpi_ns_search_node * - * PARAMETERS: *Entry_name - Ascii ACPI name to search for - * *Name_table - Starting table where search will begin + * PARAMETERS: *Target_name - Ascii ACPI name to search for + * *Node - Starting table where search will begin * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned - * *Ret_info - Where info about the search is returned + * **Return_node - Where the matched Named obj is returned * - * RETURN: Status and return information via NS_SEARCH_DATA + * RETURN: Status * * DESCRIPTION: Search a single namespace table. Performs a simple search, * does not add entries or search parents. * - ***************************************************************************/ + * + * Named object lists are built (and subsequently dumped) in the + * order in which the names are encountered during the namespace load; + * + * All namespace searching is linear in this implementation, but + * could be easily modified to support any improved search + * algorithm. However, the linear search was chosen for simplicity + * and because the trees are small and the other interpreter + * execution overhead is relatively high. + * + ******************************************************************************/ ACPI_STATUS -acpi_ns_search_one_scope ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, +acpi_ns_search_node ( + u32 target_name, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry, - NS_SEARCH_DATA *ret_info) + ACPI_NAMESPACE_NODE **return_node) { - u32 position; - ACPI_NAME_TABLE *this_table; - ACPI_NAME_TABLE *previous_table = name_table; - ACPI_NAMED_OBJECT *entries; - u8 table_full = TRUE; - ACPI_NAME_TABLE *table_with_empty_slots = NULL; - u32 empty_slot_position = 0; + ACPI_NAMESPACE_NODE *next_node; - /* - * Name tables are built (and subsequently dumped) in the - * order in which the names are encountered during the namespace load; - * - * All namespace searching will be linear; If a table overflows an - * additional segment will be allocated and added (chained). - * - * Start linear search at top of table - */ - position = 0; - this_table = name_table; - entries = this_table->entries; - - - /* Init return data */ - - if (ret_info) { - ret_info->name_table = this_table; - } - /* - * Search entire name table, including all linked appendages + * Search for name in this table, which is to say that we must search + * for the name among the children of this object */ - while (this_table) { - /* - * Search for name in table, starting at Position. Stop - * searching upon examining all entries in the table. - * - */ + next_node = node->child; + while (next_node) { + /* Check for match against the name */ - entries = this_table->entries; - while (position < NS_TABLE_SIZE) { - /* Check for a valid entry */ - - if (!entries[position].name) { - if (table_full) { - /* - * There is room in the table for more - * entries, if necessary - */ - - table_full = FALSE; - table_with_empty_slots = this_table; - empty_slot_position = position; - } - } - - /* Search for name in table */ + if (next_node->name == target_name) { + /* + * Found matching entry. Capture type if + * appropriate before returning the entry. + */ - else if (entries[position].name == entry_name) { - /* - * Found matching entry. Capture type if - * appropriate before returning the entry. - */ - - /* - * The Def_field_defn and Bank_field_defn cases - * are actually looking up the Region in which - * the field will be defined - */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { - type = ACPI_TYPE_REGION; - } - - /* - * Scope, Def_any, and Index_field_defn are bogus - * "types" which do not actually have anything - * to do with the type of the name being looked - * up. For any other value of Type, if the type - * stored in the entry is Any (i.e. unknown), - * save the actual type. - */ - - if (type != INTERNAL_TYPE_SCOPE && - type != INTERNAL_TYPE_DEF_ANY && - type != INTERNAL_TYPE_INDEX_FIELD_DEFN && - entries[position].type == ACPI_TYPE_ANY) - { - entries[position].type = (u8) type; - } + /* + * The Def_field_defn and Bank_field_defn cases + * are actually looking up the Region in which + * the field will be defined + */ - *ret_entry = &entries[position]; - return (AE_OK); + if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || + (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) + { + type = ACPI_TYPE_REGION; } + /* + * Scope, Def_any, and Index_field_defn are bogus + * "types" which do not actually have anything + * to do with the type of the name being looked + * up. For any other value of Type, if the type + * stored in the entry is Any (i.e. unknown), + * save the actual type. + */ - /* Didn't match name, move on to the next entry */ + if (type != INTERNAL_TYPE_SCOPE && + type != INTERNAL_TYPE_DEF_ANY && + type != INTERNAL_TYPE_INDEX_FIELD_DEFN && + next_node->type == ACPI_TYPE_ANY) + { + next_node->type = (u8) type; + } - position++; + *return_node = next_node; + return (AE_OK); } /* - * Just examined last slot in this table, move on - * to next appendate. - * All appendages, even to the root NT, contain - * NS_TABLE_SIZE entries. + * The last entry in the list points back to the parent, + * so a flag is used to indicate the end-of-list */ + if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { + /* Searched entire list, we are done */ + + break; + } - previous_table = this_table; - this_table = this_table->next_table; + /* Didn't match name, move on to the next peer object */ - position = 0; + next_node = next_node->peer; } /* Searched entire table, not found */ - if (ret_info) { - /* - * Save info on if/where a slot is available - * (name was not found) - */ - - ret_info->table_full = table_full; - if (table_full) { - ret_info->name_table = previous_table; - } - - else { - ret_info->position = empty_slot_position; - ret_info->name_table = table_with_empty_slots; - } - } - return (AE_NOT_FOUND); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_search_parent_tree * - * PARAMETERS: *Entry_name - Ascii ACPI name to search for - * *Name_table - Starting table where search will begin + * PARAMETERS: *Target_name - Ascii ACPI name to search for + * *Node - Starting table where search will begin * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned + * **Return_node - Where the matched Named Obj is returned * * RETURN: Status * @@ -227,274 +167,79 @@ * indicates that the name is not found" (From ACPI Specification, * section 5.3) * - ***************************************************************************/ - + ******************************************************************************/ ACPI_STATUS acpi_ns_search_parent_tree ( - u32 entry_name, - ACPI_NAME_TABLE *name_table, + u32 target_name, + ACPI_NAMESPACE_NODE *node, OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_NAMED_OBJECT *entries; + ACPI_NAMESPACE_NODE *parent_node; - entries = name_table->entries; + parent_node = acpi_ns_get_parent_object (node); /* - * If no parent or type is "local", we won't be searching the - * parent tree. + * If there is no parent (at the root) or type is "local", we won't be + * searching the parent tree. */ - - if (!acpi_ns_local (type) && - name_table->parent_entry) + if ((acpi_ns_local (type)) || + (!parent_node)) { - parent_entry = name_table->parent_entry; - /* - * Search parents until found or we have backed up to - * the root - */ - - while (parent_entry) { - /* Search parent scope */ - /* TBD: [Investigate] Why ACPI_TYPE_ANY? */ - - status = acpi_ns_search_one_scope (entry_name, - parent_entry->child_table, - ACPI_TYPE_ANY, - ret_entry, NULL); - if (status == AE_OK) { - return (status); - } - - /* - * Not found here, go up another level - * (until we reach the root) - */ - - parent_entry = acpi_ns_get_parent_entry (parent_entry); - } - - /* Not found in parent tree */ - } - - - return (AE_NOT_FOUND); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_create_and_link_new_table - * - * PARAMETERS: *Name_table - The table that is to be "extended" by - * the creation of an appendage table. - * - * RETURN: Status - * - * DESCRIPTION: Allocate a new namespace table, initialize it, and link it - * into the parent table. - * - * NOTE: We are in the first or second pass load mode, want to - * add a new table entry, and the current table is full. - * - ***************************************************************************/ - -ACPI_STATUS -acpi_ns_create_and_link_new_table ( - ACPI_NAME_TABLE *name_table) -{ - ACPI_NAME_TABLE *new_table; - ACPI_NAMED_OBJECT *parent_entry; - ACPI_STATUS status = AE_OK; - - - /* Sanity check on the data structure */ - - if (name_table->next_table) { - /* We should never get here (an appendage already allocated) */ - - return (AE_AML_INTERNAL); - } - - - /* - * We can use the parent entries from the current table - * Since the parent information remains the same. - */ - parent_entry = name_table->parent_entry; - - - /* Allocate and chain an appendage to the filled table */ - - new_table = acpi_ns_allocate_name_table (NS_TABLE_SIZE); - if (!new_table) { - REPORT_ERROR ("Name Table appendage allocation failure"); - return (AE_NO_MEMORY); - } - /* - * Allocation successful. Init the new table. - */ - name_table->next_table = new_table; - acpi_ns_initialize_table (new_table, parent_entry->child_table, - parent_entry); - - return (status); -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_initialize_table - * - * PARAMETERS: New_table - The new table to be initialized - * Parent_table - The parent (owner) scope - * Parent_entry - The NTE for the parent - * - * RETURN: None - * - * DESCRIPTION: Initialize a new namespace table. Simple, but called - * from several places -- code should be kept in one place. - * - ***************************************************************************/ - -void -acpi_ns_initialize_table ( - ACPI_NAME_TABLE *new_table, - ACPI_NAME_TABLE *parent_table, - ACPI_NAMED_OBJECT *parent_entry) -{ - u8 i; - - - new_table->parent_entry = parent_entry; - new_table->parent_table = parent_table; - - - /* Init each named object entry in the table */ - - for (i = 0; i < NS_TABLE_SIZE; i++) { - new_table->entries[i].this_index = i; - new_table->entries[i].data_type = ACPI_DESC_TYPE_NAMED; + return (AE_NOT_FOUND); } -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_initialize_entry - * - * PARAMETERS: Name_table - The containing table for the new NTE - * Position - Position (index) of the new NTE in the table - * Entry_name - ACPI name of the new entry - * Type - ACPI object type of the new entry - * Previous_entry - Link back to the previous entry (can span - * multiple tables) - * - * RETURN: None - * - * DESCRIPTION: Initialize a new entry within a namespace table. - * - ***************************************************************************/ - -void -acpi_ns_initialize_entry ( - ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, - u32 position, - u32 entry_name, - OBJECT_TYPE_INTERNAL type) -{ - ACPI_NAMED_OBJECT *new_entry; - u16 owner_id = TABLE_ID_DSDT; - ACPI_NAMED_OBJECT *entries; + /* Search the parent tree */ /* - * Get the owner ID from the Walk state - * The owner ID is used to track table deletion and - * deletion of objects created by methods + * Search parents until found the target or we have backed up to + * the root */ - if (walk_state) { - owner_id = walk_state->owner_id; - } - - /* The new entry is given by two parameters */ - - entries = name_table->entries; - new_entry = &entries[position]; - - /* Init the new entry */ - new_entry->data_type = ACPI_DESC_TYPE_NAMED; - new_entry->name = entry_name; - new_entry->owner_id = owner_id; - new_entry->reference_count = 1; + while (parent_node) { + /* Search parent scope */ + /* TBD: [Investigate] Why ACPI_TYPE_ANY? */ + status = acpi_ns_search_node (target_name, parent_node, + ACPI_TYPE_ANY, return_node); - /* - * If adding a name with unknown type, or having to - * add the region in order to define fields in it, we - * have a forward reference. - */ + if (ACPI_SUCCESS (status)) { + return (status); + } - if ((ACPI_TYPE_ANY == type) || - (INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { /* - * We don't want to abort here, however! - * We will fill in the actual type when the - * real definition is found later. + * Not found here, go up another level + * (until we reach the root) */ + parent_node = acpi_ns_get_parent_object (parent_node); } - /* - * The Def_field_defn and Bank_field_defn cases are actually - * looking up the Region in which the field will be defined - */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == type) || - (INTERNAL_TYPE_BANK_FIELD_DEFN == type)) - { - type = ACPI_TYPE_REGION; - } - /* - * Scope, Def_any, and Index_field_defn are bogus "types" which do - * not actually have anything to do with the type of the name - * being looked up. Save any other value of Type as the type of - * the entry. - */ + /* Not found in parent tree */ - if ((type != INTERNAL_TYPE_SCOPE) && - (type != INTERNAL_TYPE_DEF_ANY) && - (type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) - { - new_entry->type = (u8) type; - } - - return; + return (AE_NOT_FOUND); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_ns_search_and_enter * - * PARAMETERS: Entry_name - Ascii ACPI name to search for (4 chars) - * *Name_table - Starting table where search will begin - * Interpreter_mode - Add names only in MODE_Load_pass_x. Otherwise, - * search only. + * PARAMETERS: Target_name - Ascii ACPI name to search for (4 chars) + * Walk_state - Current state of the walk + * *Node - Starting table where search will begin + * Interpreter_mode - Add names only in MODE_Load_pass_x. + * Otherwise,search only. * Type - Object type to match - * **Ret_entry - Where the matched NTE is returned + * Flags - Flags describing the search restrictions + * **Return_node - Where the Node is returned * * RETURN: Status * @@ -506,51 +251,48 @@ * In IMODE_EXECUTE, search only. * In other modes, search and add if not found. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_ns_search_and_enter ( - u32 entry_name, + u32 target_name, ACPI_WALK_STATE *walk_state, - ACPI_NAME_TABLE *name_table, + ACPI_NAMESPACE_NODE *node, OPERATING_MODE interpreter_mode, OBJECT_TYPE_INTERNAL type, u32 flags, - ACPI_NAMED_OBJECT **ret_entry) + ACPI_NAMESPACE_NODE **return_node) { - u32 position; /* position in table */ ACPI_STATUS status; - NS_SEARCH_DATA search_info; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *entries; + ACPI_NAMESPACE_NODE *new_node; /* Parameter validation */ - if (!name_table || !entry_name || !ret_entry) { - REPORT_ERROR ("Ns_search_and_enter: bad parameter"); + if (!node || !target_name || !return_node) { + REPORT_ERROR ("Ns_search_and_enter: bad (null)parameter"); return (AE_BAD_PARAMETER); } /* Name must consist of printable characters */ - if (!acpi_cm_valid_acpi_name (entry_name)) { + if (!acpi_cm_valid_acpi_name (target_name)) { + REPORT_ERROR ("Ns_search_and_enter: Bad character in ACPI Name"); return (AE_BAD_CHARACTER); } /* Try to find the name in the table specified by the caller */ - *ret_entry = ENTRY_NOT_FOUND; - status = acpi_ns_search_one_scope (entry_name, name_table, - type, ret_entry, &search_info); + *return_node = ENTRY_NOT_FOUND; + status = acpi_ns_search_node (target_name, node, + type, return_node); if (status != AE_NOT_FOUND) { /* * Either found it or there was an error * -- finished either way */ - return (status); } @@ -573,10 +315,9 @@ * to ACPI specification */ - status = acpi_ns_search_parent_tree (entry_name, name_table, - type, ret_entry); - - if (status == AE_OK) { + status = acpi_ns_search_parent_tree (target_name, node, + type, return_node); + if (ACPI_SUCCESS (status)) { return (status); } } @@ -585,61 +326,22 @@ /* * In execute mode, just search, never add names. Exit now. */ - if (interpreter_mode == IMODE_EXECUTE) { return (AE_NOT_FOUND); } - /* - * Extract the pertinent info from the search result struct. - * Name_table and position might now point to an appendage - */ - name_table = search_info.name_table; - position = search_info.position; + /* Create the new named object */ - - /* - * This block handles the case where the existing table is full. - * we must allocate a new table before we can initialize a new entry - */ - - if (search_info.table_full) { - status = acpi_ns_create_and_link_new_table (name_table); - if (status != AE_OK) { - return (status); - } - - /* Point to the first slot in the new table */ - - name_table = name_table->next_table; - position = 0; + new_node = acpi_ns_create_node (target_name); + if (!new_node) { + return (AE_NO_MEMORY); } + /* Install the new object into the parent's list of children */ - /* - * There is room in the table (or we have just allocated a new one.) - * Initialize the new entry - */ - - acpi_ns_initialize_entry (walk_state, name_table, position, - entry_name, type); - - - entries = name_table->entries; - *ret_entry = &entries[position]; - entry = &entries[position]; - - /* - * Increment the reference count(s) of all parents up to - * the root! - */ - - while (acpi_ns_get_parent_entry (entry)) { - entry = acpi_ns_get_parent_entry (entry); - entry->reference_count++; - } - + acpi_ns_install_node (walk_state, node, new_node, type); + *return_node = new_node; return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsutils.c linux/drivers/acpi/namespace/nsutils.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsutils.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsutils.c Fri Sep 15 14:30:30 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing - * parents and siblings and Scope manipulation + * parents and siblings and Scope manipulation + * $Revision: 69 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" +#include "acnamesp.h" +#include "acinterp.h" #include "amlcode.h" -#include "tables.h" +#include "actables.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsutils"); + MODULE_NAME ("nsutils") /**************************************************************************** @@ -49,7 +49,7 @@ u8 acpi_ns_valid_root_prefix ( - char prefix) + NATIVE_CHAR prefix) { return ((u8) (prefix == '\\')); @@ -70,7 +70,7 @@ u8 acpi_ns_valid_path_separator ( - char sep) + NATIVE_CHAR sep) { return ((u8) (sep == '.')); @@ -81,9 +81,9 @@ * * FUNCTION: Acpi_ns_get_type * - * PARAMETERS: Handle - Handle of nte to be examined + * PARAMETERS: Handle - Parent Node to be examined * - * RETURN: Type field from nte whose handle is passed + * RETURN: Type field from Node whose handle is passed * ***************************************************************************/ @@ -93,13 +93,11 @@ { if (!handle) { - /* Handle invalid */ - REPORT_WARNING ("Ns_get_type: Null handle"); return (ACPI_TYPE_ANY); } - return (((ACPI_NAMED_OBJECT*) handle)->type); + return (((ACPI_NAMESPACE_NODE *) handle)->type); } @@ -114,19 +112,19 @@ * ***************************************************************************/ -s32 +u32 acpi_ns_local ( OBJECT_TYPE_INTERNAL type) { if (!acpi_cm_valid_object_type (type)) { - /* type code out of range */ + /* Type code out of range */ REPORT_WARNING ("Ns_local: Invalid Object Type"); return (NSP_NORMAL); } - return ((s32) acpi_gbl_ns_properties[type] & NSP_LOCAL); + return ((u32) acpi_gbl_ns_properties[type] & NSP_LOCAL); } @@ -147,12 +145,12 @@ ACPI_STATUS acpi_ns_internalize_name ( - char *external_name, - char **converted_name) + NATIVE_CHAR *external_name, + NATIVE_CHAR **converted_name) { - char *result = NULL; - char *internal_name; - ACPI_SIZE num_segments; + NATIVE_CHAR *result = NULL; + NATIVE_CHAR *internal_name; + u32 num_segments; u8 fully_qualified = FALSE; u32 i; @@ -235,7 +233,7 @@ } else { - /* Convert char to uppercase and save it */ + /* Convert s8 to uppercase and save it */ result[i] = (char) TOUPPER (*external_name); external_name++; @@ -273,166 +271,17 @@ /**************************************************************************** * - * FUNCTION: Acpi_ns_externalize_name - * - * PARAMETERS: *Internal_name - Internal representation of name - * **Converted_name - Where to return the resulting - * external representation of name - * - * RETURN: Status - * - * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) - * to its external form (e.g. "\_PR_.CPU0") - * - ****************************************************************************/ - -ACPI_STATUS -acpi_ns_externalize_name ( - u32 internal_name_length, - char *internal_name, - u32 *converted_name_length, - char **converted_name) -{ - u32 prefix_length = 0; - u32 names_index = 0; - u32 names_count = 0; - u32 i = 0; - u32 j = 0; - - if (internal_name_length < 0 || - !internal_name || - !converted_name_length || - !converted_name) - { - return (AE_BAD_PARAMETER); - } - - /* - * Check for a prefix (one '\' | one or more '^'). - */ - switch (internal_name[0]) - { - case '\\': - prefix_length = 1; - break; - - case '^': - for (i = 0; i < internal_name_length; i++) { - if (internal_name[i] != '^') { - prefix_length = i + 1; - } - } - - if (i == internal_name_length) { - prefix_length = i; - } - - break; - } - - /* - * Check for object names. Note that there could be 0-255 of these - * 4-byte elements. - */ - if (prefix_length < internal_name_length) { - switch (internal_name[prefix_length]) - { - - /* 4-byte names */ - - case AML_MULTI_NAME_PREFIX_OP: - names_index = prefix_length + 2; - names_count = (u32) internal_name[prefix_length + 1]; - break; - - - /* two 4-byte names */ - - case AML_DUAL_NAME_PREFIX: - names_index = prefix_length + 1; - names_count = 2; - break; - - - /* Null_name */ - - case 0: - names_index = 0; - names_count = 0; - break; - - - /* one 4-byte name */ - - default: - names_index = prefix_length; - names_count = 1; - break; - } - } - - /* - * Calculate the length of Converted_name, which equals the length - * of the prefix, length of all object names, length of any required - * punctuation ('.') between object names, plus the NULL terminator. - */ - *converted_name_length = prefix_length + (4 * names_count) + - ((names_count > 0) ? (names_count - 1) : 0) + 1; - - /* - * Check to see if we're still in bounds. If not, there's a problem - * with Internal_name (invalid format). - */ - if (*converted_name_length > internal_name_length) { - REPORT_ERROR ("Ns_externalize_name: Invalid internal name.\n"); - return (AE_BAD_PATHNAME); - } - - /* - * Build Converted_name... - */ - - (*converted_name) = acpi_cm_callocate (*converted_name_length); - if (!(*converted_name)) { - return (AE_NO_MEMORY); - } - - j = 0; - - for (i = 0; i < prefix_length; i++) { - (*converted_name)[j++] = internal_name[i]; - } - - if (names_count > 0) { - for (i = 0; i < names_count; i++) { - if (i > 0) { - (*converted_name)[j++] = '.'; - } - - (*converted_name)[j++] = internal_name[names_index++]; - (*converted_name)[j++] = internal_name[names_index++]; - (*converted_name)[j++] = internal_name[names_index++]; - (*converted_name)[j++] = internal_name[names_index++]; - } - } - - return (AE_OK); -} - - -/**************************************************************************** - * * FUNCTION: Acpi_ns_convert_handle_to_entry * - * PARAMETERS: Handle - Handle to be converted to an NTE + * PARAMETERS: Handle - Handle to be converted to an Node * * RETURN: A Name table entry pointer * - * DESCRIPTION: Convert a namespace handle to a real NTE + * DESCRIPTION: Convert a namespace handle to a real Node * ****************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ns_convert_handle_to_entry ( ACPI_HANDLE handle) { @@ -444,21 +293,21 @@ */ if (!handle) { - return NULL; + return (NULL); } if (handle == ACPI_ROOT_OBJECT) { - return acpi_gbl_root_object; + return (acpi_gbl_root_node); } /* We can at least attempt to verify the handle */ if (!VALID_DESCRIPTOR_TYPE (handle, ACPI_DESC_TYPE_NAMED)) { - return NULL; + return (NULL); } - return (ACPI_NAMED_OBJECT*) handle; + return ((ACPI_NAMESPACE_NODE *) handle); } @@ -466,16 +315,17 @@ * * FUNCTION: Acpi_ns_convert_entry_to_handle * - * PARAMETERS: Nte - NTE to be converted to a Handle + * PARAMETERS: Node - Node to be converted to a Handle * * RETURN: An USER ACPI_HANDLE * - * DESCRIPTION: Convert a real NTE to a namespace handle + * DESCRIPTION: Convert a real Node to a namespace handle * ****************************************************************************/ ACPI_HANDLE -acpi_ns_convert_entry_to_handle(ACPI_NAMED_OBJECT*nte) +acpi_ns_convert_entry_to_handle ( + ACPI_NAMESPACE_NODE *node) { @@ -485,21 +335,21 @@ * and keep all pointers within this subsystem! */ - return (ACPI_HANDLE) nte; + return ((ACPI_HANDLE) node); /* --------------------------------------------------- - if (!Nte) { - return NULL; + if (!Node) { + return (NULL); } - if (Nte == Acpi_gbl_Root_object) { - return ACPI_ROOT_OBJECT; + if (Node == Acpi_gbl_Root_node) { + return (ACPI_ROOT_OBJECT); } - return (ACPI_HANDLE) Nte; + return ((ACPI_HANDLE) Node); ------------------------------------------------------*/ } @@ -519,11 +369,11 @@ void acpi_ns_terminate (void) { - ACPI_OBJECT_INTERNAL *obj_desc; - ACPI_NAMED_OBJECT *entry; + ACPI_OPERAND_OBJECT *obj_desc; + ACPI_NAMESPACE_NODE *this_node; - entry = acpi_gbl_root_object; + this_node = acpi_gbl_root_node; /* * 1) Free the entire namespace -- all objects, tables, and stacks @@ -533,22 +383,19 @@ * (additional table descriptors) */ - acpi_ns_delete_namespace_subtree (entry); + acpi_ns_delete_namespace_subtree (this_node); /* Detach any object(s) attached to the root */ - obj_desc = acpi_ns_get_attached_object (entry); + obj_desc = acpi_ns_get_attached_object (this_node); if (obj_desc) { - acpi_ns_detach_object (entry); + acpi_ns_detach_object (this_node); acpi_cm_remove_reference (obj_desc); } - acpi_ns_delete_name_table (entry->child_table); - entry->child_table = NULL; + acpi_ns_delete_children (this_node); - REPORT_SUCCESS ("Entire namespace and objects deleted"); - /* * 2) Now we can delete the ACPI tables */ @@ -570,7 +417,7 @@ * ***************************************************************************/ -s32 +u32 acpi_ns_opens_scope ( OBJECT_TYPE_INTERNAL type) { @@ -582,47 +429,46 @@ return (NSP_NORMAL); } - return (((s32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE); + return (((u32) acpi_gbl_ns_properties[type]) & NSP_NEWSCOPE); } /**************************************************************************** * - * FUNCTION: Acpi_ns_get_named_object + * FUNCTION: Acpi_ns_get_node * * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The * \ (backslash) and ^ (carat) prefixes, and the * . (period) to separate segments are supported. - * In_scope - Root of subtree to be searched, or NS_ALL for the + * Start_node - Root of subtree to be searched, or NS_ALL for the * root of the name space. If Name is fully - * qualified (first char is '\'), the passed value + * qualified (first s8 is '\'), the passed value * of Scope will not be accessed. - * Out_nte - Where the Nte is returned + * Return_node - Where the Node is returned * * DESCRIPTION: Look up a name relative to a given scope and return the - * corresponding NTE. NOTE: Scope can be null. + * corresponding Node. NOTE: Scope can be null. * * MUTEX: Locks namespace * ***************************************************************************/ ACPI_STATUS -acpi_ns_get_named_object ( - char *pathname, - ACPI_NAME_TABLE *in_scope, - ACPI_NAMED_OBJECT **out_nte) +acpi_ns_get_node ( + NATIVE_CHAR *pathname, + ACPI_NAMESPACE_NODE *start_node, + ACPI_NAMESPACE_NODE **return_node) { ACPI_GENERIC_STATE scope_info; ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry = NULL; - char *internal_path = NULL; + NATIVE_CHAR *internal_path = NULL; - scope_info.scope.name_table = in_scope; + scope_info.scope.node = start_node; /* Ensure that the namespace has been initialized */ - if (!acpi_gbl_root_object->child_table) { + if (!acpi_gbl_root_node) { return (AE_NO_NAMESPACE); } @@ -643,13 +489,13 @@ /* NS_ALL means start from the root */ - if (NS_ALL == scope_info.scope.name_table) { - scope_info.scope.name_table = acpi_gbl_root_object->child_table; + if (NS_ALL == scope_info.scope.node) { + scope_info.scope.node = acpi_gbl_root_node; } else { - scope_info.scope.name_table = in_scope; - if (!scope_info.scope.name_table) { + scope_info.scope.node = start_node; + if (!scope_info.scope.node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -660,12 +506,8 @@ status = acpi_ns_lookup (&scope_info, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &obj_entry); - + NULL, return_node); - /* Return what was wanted - the NTE that matches the name */ - - *out_nte = obj_entry; unlock_and_exit: @@ -684,11 +526,11 @@ * * FUNCTION: Acpi_ns_find_parent_name * - * PARAMETERS: *Child_entry - nte whose name is to be found + * PARAMETERS: *Child_node - Named Obj whose name is to be found * * RETURN: The ACPI name * - * DESCRIPTION: Search for the given nte in its parent scope and return the + * DESCRIPTION: Search for the given obj in its parent scope and return the * name segment, or "????" if the parent name can't be found * (which "should not happen"). * @@ -696,18 +538,18 @@ ACPI_NAME acpi_ns_find_parent_name ( - ACPI_NAMED_OBJECT *child_entry) + ACPI_NAMESPACE_NODE *child_node) { - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *parent_node; - if (child_entry) { - /* Valid entry. Get the parent Nte */ + if (child_node) { + /* Valid entry. Get the parent Node */ - parent_entry = acpi_ns_get_parent_entry (child_entry); - if (parent_entry) { - if (parent_entry->name) { - return (parent_entry->name); + parent_node = acpi_ns_get_parent_object (child_node); + if (parent_node) { + if (parent_node->name) { + return (parent_node->name); } } @@ -717,92 +559,12 @@ return (ACPI_UNKNOWN_NAME); } -/**************************************************************************** - * - * FUNCTION: Acpi_ns_exist_downstream_sibling - * - * PARAMETERS: *This_entry - pointer to first nte to examine - * - * RETURN: TRUE if sibling is found, FALSE otherwise - * - * DESCRIPTION: Searches remainder of scope being processed to determine - * whether there is a downstream sibling to the current - * object. This function is used to determine what type of - * line drawing character to use when displaying namespace - * trees. - * - ***************************************************************************/ - -u8 -acpi_ns_exist_downstream_sibling ( - ACPI_NAMED_OBJECT *this_entry) -{ - - if (!this_entry) { - return FALSE; - } - - if (this_entry->name) { - return TRUE; - } - - -/* TBD: what did this really do? - if (This_entry->Next_entry) { - return TRUE; - } -*/ - return FALSE; -} - - -/**************************************************************************** - * - * FUNCTION: Acpi_ns_get_owner_table - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: - * - ***************************************************************************/ - - -ACPI_NAME_TABLE * -acpi_ns_get_owner_table ( - ACPI_NAMED_OBJECT *this_entry) -{ - - /* - * Given an entry in the Name_table->Entries field of a name table, - * we can create a pointer to the beginning of the table as follows: - * - * 1) Starting with the the pointer to the entry, - * 2) Subtract the entry index * size of each entry to get a - * pointer to Entries[0] - * 3) Subtract the size of NAME_TABLE structure to get a pointer - * to the start. - * - * This saves having to put a pointer in every entry that points - * back to the beginning of the table and/or a pointer back to - * the parent. - */ - - return (ACPI_NAME_TABLE *) ((char *) this_entry - - (this_entry->this_index * - sizeof (ACPI_NAMED_OBJECT)) - - (sizeof (ACPI_NAME_TABLE) - - sizeof (ACPI_NAMED_OBJECT))); - -} - /**************************************************************************** * - * FUNCTION: Acpi_ns_get_parent_entry + * FUNCTION: Acpi_ns_get_parent_object * - * PARAMETERS: This_entry - Current table entry + * PARAMETERS: Node - Current table entry * * RETURN: Parent entry of the given entry * @@ -811,76 +573,58 @@ ***************************************************************************/ -ACPI_NAMED_OBJECT * -acpi_ns_get_parent_entry ( - ACPI_NAMED_OBJECT *this_entry) +ACPI_NAMESPACE_NODE * +acpi_ns_get_parent_object ( + ACPI_NAMESPACE_NODE *node) { - ACPI_NAME_TABLE *name_table; - name_table = acpi_ns_get_owner_table (this_entry); - /* - * Now that we have a pointer to the name table, we can just pluck - * the parent + * Walk to the end of this peer list. + * The last entry is marked with a flag and the peer + * pointer is really a pointer back to the parent. + * This saves putting a parent back pointer in each and + * every named object! */ - return (name_table->parent_entry); + while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) { + node = node->peer; + } + + + return (node->peer); } /**************************************************************************** * - * FUNCTION: Acpi_ns_get_next_valid_entry + * FUNCTION: Acpi_ns_get_next_valid_object * - * PARAMETERS: This_entry - Current table entry + * PARAMETERS: Node - Current table entry * * RETURN: Next valid object in the table. NULL if no more valid * objects * * DESCRIPTION: Find the next valid object within a name table. + * Useful for implementing NULL-end-of-list loops. * ***************************************************************************/ -ACPI_NAMED_OBJECT * -acpi_ns_get_next_valid_entry ( - ACPI_NAMED_OBJECT *this_entry) +ACPI_NAMESPACE_NODE * +acpi_ns_get_next_valid_object ( + ACPI_NAMESPACE_NODE *node) { - ACPI_NAME_TABLE *name_table; - u32 index; - - - index = this_entry->this_index + 1; - name_table = acpi_ns_get_owner_table (this_entry); - - - while (name_table) { - if (index >= NS_TABLE_SIZE) { - /* We are at the end of this table */ - name_table = name_table->next_table; - index = 0; - continue; - } - - - /* Is this a valid (occupied) slot? */ - - if (name_table->entries[index].name) { - /* Found a valid entry, all done */ + /* If we are at the end of this peer list, return NULL */ - return (&name_table->entries[index]); - } - - /* Go to the next slot */ - - index++; + if (node->flags & ANOBJ_END_OF_PEER_LIST) { + return NULL; } - /* No more valid entries in this name table */ + /* Otherwise just return the next peer */ - return NULL; + return (node->peer); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nswalk.c linux/drivers/acpi/namespace/nswalk.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nswalk.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nswalk.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: nswalk - Functions for walking the APCI namespace + * $Revision: 17 $ * *****************************************************************************/ @@ -25,90 +25,85 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nswalk"); + MODULE_NAME ("nswalk") /**************************************************************************** * * FUNCTION: Acpi_get_next_object * - * PARAMETERS: Type - Type of object to be searched for - * Parent - Parent object whose children we are getting - * Last_child - Previous child that was found. - * The NEXT child will be returned - * Ret_handle - Where handle to the next object is placed - * - * RETURN: Status - * - * DESCRIPTION: Return the next peer object within the namespace. If Handle is - * valid, Scope is ignored. Otherwise, the first object within - * Scope is returned. + * PARAMETERS: Type - Type of object to be searched for + * Parent - Parent object whose children we are + * getting + * Last_child - Previous child that was found. + * The NEXT child will be returned + * + * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if + * none is found. + * + * DESCRIPTION: Return the next peer object within the namespace. If Handle + * is valid, Scope is ignored. Otherwise, the first object + * within Scope is returned. * - ******************************************************************************/ + ****************************************************************************/ -ACPI_NAMED_OBJECT* +ACPI_NAMESPACE_NODE * acpi_ns_get_next_object ( OBJECT_TYPE_INTERNAL type, - ACPI_NAMED_OBJECT *parent, - ACPI_NAMED_OBJECT *child) + ACPI_NAMESPACE_NODE *parent_node, + ACPI_NAMESPACE_NODE *child_node) { - ACPI_NAMED_OBJECT *this_entry = NULL; + ACPI_NAMESPACE_NODE *next_node = NULL; - if (!child) { + if (!child_node) { /* It's really the parent's _scope_ that we want */ - if (parent->child_table) { - this_entry = parent->child_table->entries; + if (parent_node->child) { + next_node = parent_node->child; } } else { /* Start search at the NEXT object */ - this_entry = acpi_ns_get_next_valid_entry (child); + next_node = acpi_ns_get_next_valid_object (child_node); } /* If any type is OK, we are done */ if (type == ACPI_TYPE_ANY) { - /* Make sure this is valid entry first */ - - if ((!this_entry) || - (!this_entry->name)) - { - return NULL; - } + /* Next_node is NULL if we are at the end-of-list */ - return (this_entry); + return (next_node); } /* Must search for the object -- but within this scope only */ - while (this_entry) { + while (next_node) { /* If type matches, we are done */ - if (this_entry->type == type) { - return (this_entry); + if (next_node->type == type) { + return (next_node); } /* Otherwise, move on to the next object */ - this_entry = acpi_ns_get_next_valid_entry (this_entry); + next_node = acpi_ns_get_next_valid_object (next_node); } /* Not found */ - return NULL; + return (NULL); } @@ -117,7 +112,7 @@ * FUNCTION: Acpi_ns_walk_namespace * * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for - * Start_object - Handle in namespace where search begins + * Start_node - Handle in namespace where search begins * Max_depth - Depth to which search is to reach * Unlock_before_callback- Whether to unlock the NS before invoking * the callback routine @@ -145,7 +140,7 @@ ACPI_STATUS acpi_ns_walk_namespace ( OBJECT_TYPE_INTERNAL type, - ACPI_HANDLE start_object, + ACPI_HANDLE start_node, u32 max_depth, u8 unlock_before_callback, WALK_CALLBACK user_function, @@ -153,25 +148,25 @@ void **return_value) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *child_entry; - ACPI_NAMED_OBJECT *parent_entry; + ACPI_NAMESPACE_NODE *child_node; + ACPI_NAMESPACE_NODE *parent_node; OBJECT_TYPE_INTERNAL child_type; u32 level; - /* Special case for the namespace root object */ + /* Special case for the namespace Root Node */ - if (start_object == ACPI_ROOT_OBJECT) { - start_object = acpi_gbl_root_object; + if (start_node == ACPI_ROOT_OBJECT) { + start_node = acpi_gbl_root_node; } /* Null child means "get first object" */ - parent_entry = start_object; - child_entry = 0; - child_type = ACPI_TYPE_ANY; - level = 1; + parent_node = start_node; + child_node = 0; + child_type = ACPI_TYPE_ANY; + level = 1; /* * Traverse the tree of objects until we bubble back up to where we @@ -186,18 +181,18 @@ */ status = AE_OK; - child_entry = acpi_ns_get_next_object (ACPI_TYPE_ANY, - parent_entry, - child_entry); + child_node = acpi_ns_get_next_object (ACPI_TYPE_ANY, + parent_node, + child_node); - if (child_entry) { + if (child_node) { /* * Found an object, Get the type if we are not * searching for ANY */ if (type != ACPI_TYPE_ANY) { - child_type = child_entry->type; + child_type = child_node->type; } if (child_type == type) { @@ -210,7 +205,7 @@ acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); } - status = user_function (child_entry, level, + status = user_function (child_node, level, context, return_value); if (unlock_before_callback) { @@ -247,15 +242,15 @@ if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { if (acpi_ns_get_next_object (ACPI_TYPE_ANY, - child_entry, 0)) + child_node, 0)) { /* * There is at least one child of this * object, visit the object */ level++; - parent_entry = child_entry; - child_entry = 0; + parent_node = child_node; + child_node = 0; } } } @@ -267,8 +262,8 @@ * the object's parent. */ level--; - child_entry = parent_entry; - parent_entry = acpi_ns_get_parent_entry (parent_entry); + child_node = parent_node; + parent_node = acpi_ns_get_parent_object (parent_node); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsxfname.c linux/drivers/acpi/namespace/nsxfname.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsxfname.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsxfname.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces + * $Revision: 64 $ * *****************************************************************************/ @@ -25,16 +26,16 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "events.h" +#include "acparser.h" +#include "acdispat.h" +#include "acevents.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsxfname"); + MODULE_NAME ("nsxfname") /****************************************************************************** @@ -64,21 +65,6 @@ } - /* Init the hardware */ - - /* - * TBD: [Restructure] Should this should be moved elsewhere, - * like Acpi_enable! ?? - */ - - /* we need to be able to call this interface repeatedly! */ - /* Does H/W require init before loading the namespace? */ - - status = acpi_cm_hardware_initialize (); - if (ACPI_FAILURE (status)) { - return (status); - } - /* * Load the namespace. The DSDT is required, * but the SSDT and PSDT tables are optional. @@ -131,24 +117,24 @@ ACPI_HANDLE *ret_handle) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *this_entry; - ACPI_NAME_TABLE *scope = NULL; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *prefix_node = NULL; if (!ret_handle || !pathname) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (parent) { acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - this_entry = acpi_ns_convert_handle_to_entry (parent); - if (!this_entry) { + node = acpi_ns_convert_handle_to_entry (parent); + if (!node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - scope = this_entry->child_table; + prefix_node = node->child; acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); } @@ -156,17 +142,20 @@ /* TBD: [Investigate] Check for both forward and backslash?? */ if (STRCMP (pathname, NS_ROOT_PATH) == 0) { - *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_object); - return AE_OK; + *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); + return (AE_OK); } /* - * Find the Nte and convert to the user format + * Find the Node and convert to the user format */ - this_entry = NULL; - status = acpi_ns_get_named_object (pathname, scope, &this_entry); + node = NULL; + status = acpi_ns_get_node (pathname, prefix_node, &node); - *ret_handle = acpi_ns_convert_entry_to_handle (this_entry); + *ret_handle = NULL; + if(ACPI_SUCCESS(status)) { + *ret_handle = acpi_ns_convert_entry_to_handle (node); + } return (status); } @@ -195,13 +184,13 @@ ACPI_BUFFER *ret_path_ptr) { ACPI_STATUS status; - ACPI_NAMED_OBJECT *obj_entry; + ACPI_NAMESPACE_NODE *node; /* Buffer pointer must be valid always */ if (!ret_path_ptr || (name_type > ACPI_NAME_TYPE_MAX)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Allow length to be zero and ignore the pointer */ @@ -209,7 +198,7 @@ if ((ret_path_ptr->length) && (!ret_path_ptr->pointer)) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (name_type == ACPI_FULL_PATHNAME) { @@ -217,17 +206,17 @@ status = acpi_ns_handle_to_pathname (handle, &ret_path_ptr->length, ret_path_ptr->pointer); - return status; + return (status); } /* * Wants the single segment ACPI name. - * Validate handle and convert to an NTE + * Validate handle and convert to an Node */ acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - obj_entry = acpi_ns_convert_handle_to_entry (handle); - if (!obj_entry) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -240,18 +229,18 @@ goto unlock_and_exit; } - /* Just copy the ACPI name from the NTE and zero terminate it */ + /* Just copy the ACPI name from the Node and zero terminate it */ - STRNCPY (ret_path_ptr->pointer, (char *) &obj_entry->name, + STRNCPY (ret_path_ptr->pointer, (NATIVE_CHAR *) &node->name, ACPI_NAME_SIZE); - ((char *) ret_path_ptr->pointer) [ACPI_NAME_SIZE] = 0; + ((NATIVE_CHAR *) ret_path_ptr->pointer) [ACPI_NAME_SIZE] = 0; status = AE_OK; unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return status; + return (status); } @@ -279,27 +268,27 @@ ACPI_STATUS status; u32 device_status = 0; u32 address = 0; - ACPI_NAMED_OBJECT *device_entry; + ACPI_NAMESPACE_NODE *device_node; /* Parameter validation */ if (!device || !info) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); - device_entry = acpi_ns_convert_handle_to_entry (device); - if (!device_entry) { + device_node = acpi_ns_convert_handle_to_entry (device); + if (!device_node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - info->type = device_entry->type; - info->name = device_entry->name; - info->parent = - acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_entry (device_entry)); + info->type = device_node->type; + info->name = device_node->name; + info->parent = acpi_ns_convert_entry_to_handle ( + acpi_ns_get_parent_object (device_node)); acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); @@ -307,17 +296,17 @@ * If not a device, we are all done. */ if (info->type != ACPI_TYPE_DEVICE) { - return AE_OK; + return (AE_OK); } /* Get extra info for ACPI devices */ - info->valid = 0; + info->valid = 0; /* Execute the _HID method and save the result */ - status = acpi_cm_execute_HID (device_entry, &hid); + status = acpi_cm_execute_HID (device_node, &hid); if (ACPI_SUCCESS (status)) { if (hid.type == STRING_PTR_DEVICE_ID) { STRCPY (info->hardware_id, hid.data.string_ptr); @@ -331,7 +320,7 @@ /* Execute the _UID method and save the result */ - status = acpi_cm_execute_UID (device_entry, &uid); + status = acpi_cm_execute_UID (device_node, &uid); if (ACPI_SUCCESS (status)) { if (hid.type == STRING_PTR_DEVICE_ID) { STRCPY (info->unique_id, uid.data.string_ptr); @@ -348,7 +337,7 @@ * _STA is not always present */ - status = acpi_cm_execute_STA (device_entry, &device_status); + status = acpi_cm_execute_STA (device_node, &device_status); if (ACPI_SUCCESS (status)) { info->current_status = device_status; info->valid |= ACPI_VALID_STA; @@ -360,13 +349,13 @@ */ status = acpi_cm_evaluate_numeric_object (METHOD_NAME__ADR, - device_entry, &address); + device_node, &address); if (ACPI_SUCCESS (status)) { info->address = address; info->valid |= ACPI_VALID_ADR; } - return AE_OK; + return (AE_OK); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/namespace/nsxfobj.c linux/drivers/acpi/namespace/nsxfobj.c --- v2.4.0-test8/linux/drivers/acpi/namespace/nsxfobj.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/namespace/nsxfobj.c Fri Sep 15 14:30:30 2000 @@ -1,10 +1,10 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces + * $Revision: 65 $ * - *****************************************************************************/ + ******************************************************************************/ /* * Copyright (C) 2000 R. Byron Moore @@ -26,15 +26,15 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT NAMESPACE - MODULE_NAME ("nsxfobj"); + MODULE_NAME ("nsxfobj") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_evaluate_object * @@ -54,7 +54,7 @@ * parameters if necessary. One of "Handle" or "Pathname" must * be valid (non-null) * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_evaluate_object ( @@ -64,9 +64,9 @@ ACPI_BUFFER *return_buffer) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL **param_ptr = NULL; - ACPI_OBJECT_INTERNAL *return_obj = NULL; - ACPI_OBJECT_INTERNAL *object_ptr = NULL; + ACPI_OPERAND_OBJECT **param_ptr = NULL; + ACPI_OPERAND_OBJECT *return_obj = NULL; + ACPI_OPERAND_OBJECT *object_ptr = NULL; u32 buffer_space_needed; u32 user_buffer_length; u32 count; @@ -85,12 +85,11 @@ /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list - * TBD: [Restructure] merge into single allocation! */ count = param_objects->count; param_length = (count + 1) * sizeof (void *); - object_length = count * sizeof (ACPI_OBJECT_INTERNAL); + object_length = count * sizeof (ACPI_OPERAND_OBJECT); param_ptr = acpi_cm_callocate (param_length + /* Parameter List part */ object_length); /* Actual objects */ @@ -98,7 +97,7 @@ return (AE_NO_MEMORY); } - object_ptr = (ACPI_OBJECT_INTERNAL *) ((u8 *) param_ptr + + object_ptr = (ACPI_OPERAND_OBJECT *) ((u8 *) param_ptr + param_length); /* @@ -169,18 +168,15 @@ * The null pathname case means the handle is for * the actual object to be evaluated */ - status = acpi_ns_evaluate_by_handle (handle, - param_ptr, - &return_obj); + status = acpi_ns_evaluate_by_handle (handle, param_ptr, &return_obj); } else { /* * Both a Handle and a relative Pathname */ - status = acpi_ns_evaluate_relative (handle, pathname, - param_ptr, - &return_obj); + status = acpi_ns_evaluate_relative (handle, pathname, param_ptr, + &return_obj); } } @@ -195,11 +191,9 @@ return_buffer->length = 0; if (return_obj) { - if (VALID_DESCRIPTOR_TYPE (return_obj, - ACPI_DESC_TYPE_NAMED)) - { + if (VALID_DESCRIPTOR_TYPE (return_obj, ACPI_DESC_TYPE_NAMED)) { /* - * If we got an NTE as a return object, + * If we got an Node as a return object, * this means the object we are evaluating * has nothing interesting to return (such * as a mutex, etc.) We return an error @@ -210,7 +204,7 @@ * types at a later date if necessary. */ status = AE_TYPE; - return_obj = NULL; /* No need to delete an NTE */ + return_obj = NULL; /* No need to delete an Node */ } if (ACPI_SUCCESS (status)) { @@ -241,9 +235,8 @@ /* * We have enough space for the object, build it */ - status = - acpi_cm_build_external_object (return_obj, - return_buffer); + status = acpi_cm_build_external_object (return_obj, + return_buffer); return_buffer->length = buffer_space_needed; } } @@ -276,7 +269,7 @@ } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_next_object * @@ -302,15 +295,15 @@ ACPI_HANDLE *ret_handle) { ACPI_STATUS status = AE_OK; - ACPI_NAMED_OBJECT *entry; - ACPI_NAMED_OBJECT *parent_entry = NULL; - ACPI_NAMED_OBJECT *child_entry = NULL; + ACPI_NAMESPACE_NODE *node; + ACPI_NAMESPACE_NODE *parent_node = NULL; + ACPI_NAMESPACE_NODE *child_node = NULL; /* Parameter validation */ if (type > ACPI_TYPE_MAX) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); @@ -320,8 +313,8 @@ if (!child) { /* Start search at the beginning of the specified scope */ - parent_entry = acpi_ns_convert_handle_to_entry (parent); - if (!parent_entry) { + parent_node = acpi_ns_convert_handle_to_entry (parent); + if (!parent_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -332,8 +325,8 @@ else { /* Convert and validate the handle */ - child_entry = acpi_ns_convert_handle_to_entry (child); - if (!child_entry) { + child_node = acpi_ns_convert_handle_to_entry (child); + if (!child_node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -342,26 +335,26 @@ /* Internal function does the real work */ - entry = acpi_ns_get_next_object ((OBJECT_TYPE_INTERNAL) type, - parent_entry, child_entry); - if (!entry) { + node = acpi_ns_get_next_object ((OBJECT_TYPE_INTERNAL) type, + parent_node, child_node); + if (!node) { status = AE_NOT_FOUND; goto unlock_and_exit; } if (ret_handle) { - *ret_handle = acpi_ns_convert_entry_to_handle (entry); + *ret_handle = acpi_ns_convert_entry_to_handle (node); } unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return status; + return (status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_type * @@ -379,44 +372,43 @@ ACPI_HANDLE handle, ACPI_OBJECT_TYPE *ret_type) { - ACPI_NAMED_OBJECT *object; + ACPI_NAMESPACE_NODE *node; /* Parameter Validation */ if (!ret_type) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* - * Special case for the predefined Root Object + * Special case for the predefined Root Node * (return type ANY) */ - if (handle == ACPI_ROOT_OBJECT) { *ret_type = ACPI_TYPE_ANY; - return AE_OK; + return (AE_OK); } acpi_cm_acquire_mutex (ACPI_MTX_NAMESPACE); /* Convert and validate the handle */ - object = acpi_ns_convert_handle_to_entry (handle); - if (!object) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - *ret_type = object->type; + *ret_type = node->type; acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_OK; + return (AE_OK); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_get_parent * @@ -435,7 +427,7 @@ ACPI_HANDLE handle, ACPI_HANDLE *ret_handle) { - ACPI_NAMED_OBJECT *object; + ACPI_NAMESPACE_NODE *node; ACPI_STATUS status = AE_OK; @@ -443,13 +435,13 @@ if (!ret_handle) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - /* Special case for the predefined Root Object (no parent) */ + /* Special case for the predefined Root Node (no parent) */ if (handle == ACPI_ROOT_OBJECT) { - return AE_NULL_ENTRY; + return (AE_NULL_ENTRY); } @@ -457,8 +449,8 @@ /* Convert and validate the handle */ - object = acpi_ns_convert_handle_to_entry (handle); - if (!object) { + node = acpi_ns_convert_handle_to_entry (handle); + if (!node) { status = AE_BAD_PARAMETER; goto unlock_and_exit; } @@ -467,11 +459,11 @@ /* Get the parent entry */ *ret_handle = - acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_entry (object)); + acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_object (node)); /* Return exeption if parent is null */ - if (!acpi_ns_get_parent_entry (object)) { + if (!acpi_ns_get_parent_object (node)) { status = AE_NULL_ENTRY; } @@ -479,11 +471,11 @@ unlock_and_exit: acpi_cm_release_mutex (ACPI_MTX_NAMESPACE); - return AE_OK; + return (status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: Acpi_walk_namespace * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/os.c linux/drivers/acpi/os.c --- v2.4.0-test8/linux/drivers/acpi/os.c Thu Jul 13 09:39:49 2000 +++ linux/drivers/acpi/os.c Fri Sep 15 14:30:30 2000 @@ -29,6 +29,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("os") + static int acpi_irq_irq = 0; static OSD_HANDLER acpi_irq_handler = NULL; static void *acpi_irq_context = NULL; @@ -61,7 +64,7 @@ } s32 -acpi_os_printf(const char *fmt,...) +acpi_os_printf(const NATIVE_CHAR *fmt,...) { s32 size; va_list args; @@ -72,11 +75,11 @@ } s32 -acpi_os_vprintf(const char *fmt, va_list args) +acpi_os_vprintf(const NATIVE_CHAR *fmt, va_list args) { static char buffer[512]; int size = vsprintf(buffer, fmt, args); - printk(KERN_DEBUG "ACPI: %s", buffer); + printk("%s", buffer); return size; } @@ -137,7 +140,7 @@ acpi_irq_context = context; if (request_irq(irq, acpi_irq, - SA_INTERRUPT | SA_SHIRQ, + SA_SHIRQ, "acpi", acpi_irq)) { printk(KERN_ERR "ACPI: SCI (IRQ%d) allocation failed\n", irq); @@ -338,7 +341,7 @@ } ACPI_STATUS -acpi_os_breakpoint(char *msg) +acpi_os_breakpoint(NATIVE_CHAR *msg) { acpi_os_printf("breakpoint: %s", msg); return AE_OK; @@ -351,13 +354,13 @@ } void -acpi_os_dbg_assert(void *failure, void *file, u32 line, char *msg) +acpi_os_dbg_assert(void *failure, void *file, u32 line, NATIVE_CHAR *msg) { acpi_os_printf("assert: %s", msg); } u32 -acpi_os_get_line(char *buffer) +acpi_os_get_line(NATIVE_CHAR *buffer) { return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/Makefile linux/drivers/acpi/parser/Makefile --- v2.4.0-test8/linux/drivers/acpi/parser/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/parser/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psargs.c linux/drivers/acpi/parser/psargs.c --- v2.4.0-test8/linux/drivers/acpi/parser/psargs.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/parser/psargs.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments + * $Revision: 35 $ * *****************************************************************************/ @@ -24,12 +25,26 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT PARSER - MODULE_NAME ("psargs"); + MODULE_NAME ("psargs") + + +u32 +acpi_ps_pkg_length_encoding_size ( + u32 first_byte) +{ + + /* + * Bits 6-7 contain the number of bytes + * in the encoded package length (-1) + */ + + return ((first_byte >> 6) + 1); +} /******************************************************************************* @@ -46,14 +61,63 @@ ******************************************************************************/ u32 +xxx_acpi_ps_get_next_package_length ( + ACPI_PARSE_STATE *parser_state) +{ + u32 encoding_length; + u32 package_length = 0; + u8 *aml_ptr = parser_state->aml; + + + encoding_length = acpi_ps_pkg_length_encoding_size ((u32) GET8 (aml_ptr)); + + + switch (encoding_length) + { + case 1: /* 1-byte encoding (bits 0-5) */ + + package_length = ((u32) GET8 (aml_ptr) & 0x3f); + break; + + + case 2: /* 2-byte encoding (next byte + bits 0-3) */ + + package_length = ((((u32) GET8 (aml_ptr + 1)) << 4) | + (((u32) GET8 (aml_ptr)) & 0x0f)); + break; + + + case 3: /* 3-byte encoding (next 2 bytes + bits 0-3) */ + + package_length = ((((u32) GET8 (aml_ptr + 2)) << 12) | + (((u32) GET8 (aml_ptr + 1)) << 4) | + (((u32) GET8 (aml_ptr)) & 0x0f)); + break; + + + case 4: /* 4-byte encoding (next 3 bytes + bits 0-3) */ + + package_length = ((((u32) GET8 (aml_ptr + 3)) << 20) | + (((u32) GET8 (aml_ptr + 2)) << 12) | + (((u32) GET8 (aml_ptr + 1)) << 4) | + (((u32) GET8 (aml_ptr)) & 0x0f)); + break; + } + + parser_state->aml += encoding_length; + + return (package_length); +} + +u32 acpi_ps_get_next_package_length ( ACPI_PARSE_STATE *parser_state) { - s32 encoded_length; - s32 length = 0; + u32 encoded_length; + u32 length = 0; - encoded_length = (s32) GET8 (parser_state->aml); + encoded_length = (u32) GET8 (parser_state->aml); parser_state->aml++; @@ -137,13 +201,13 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_ps_get_next_namestring ( ACPI_PARSE_STATE *parser_state) { - char *start = (char *) parser_state->aml; - char *end = (char *) parser_state->aml; - s32 length; + u8 *start = parser_state->aml; + u8 *end = parser_state->aml; + u32 length; /* Handle multiple prefix characters */ @@ -181,7 +245,7 @@ /* multiple name segments */ - length = (s32) GET8 (end + 1) * 4; + length = (u32) GET8 (end + 1) * 4; end += 2 + length; break; @@ -197,7 +261,7 @@ parser_state->aml = (u8*) end; - return (start); + return ((NATIVE_CHAR *) start); } @@ -228,14 +292,14 @@ void acpi_ps_get_next_namepath ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, + ACPI_PARSE_OBJECT *arg, u32 *arg_count, u8 method_call) { - char *path; - ACPI_GENERIC_OP *name; - ACPI_GENERIC_OP *op; - ACPI_GENERIC_OP *count; + NATIVE_CHAR *path; + ACPI_PARSE_OBJECT *name_op; + ACPI_PARSE_OBJECT *op; + ACPI_PARSE_OBJECT *count; path = acpi_ps_get_next_namestring (parser_state); @@ -270,18 +334,18 @@ count = acpi_ps_get_arg (op, 0); if (count && count->opcode == AML_BYTE_OP) { - name = acpi_ps_alloc_op (AML_NAMEPATH_OP); - if (name) { + name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP); + if (name_op) { /* Change arg into a METHOD CALL and attach the name */ acpi_ps_init_op (arg, AML_METHODCALL_OP); - name->value.name = path; + name_op->value.name = path; - /* Point METHODCALL/NAME to the METHOD NTE */ + /* Point METHODCALL/NAME to the METHOD Node */ - name->acpi_named_object = op; - acpi_ps_append_arg (arg, name); + name_op->node = (ACPI_NAMESPACE_NODE *) op; + acpi_ps_append_arg (arg, name_op); *arg_count = count->value.integer & METHOD_FLAGS_ARG_COUNT; @@ -320,15 +384,15 @@ void acpi_ps_get_next_namepath ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *arg, + ACPI_PARSE_OBJECT *arg, u32 *arg_count, u8 method_call) { - char *path; - ACPI_GENERIC_OP *name; + NATIVE_CHAR *path; + ACPI_PARSE_OBJECT *name_op; ACPI_STATUS status; - ACPI_NAMED_OBJECT *method = NULL; - ACPI_NAMED_OBJECT *entry; + ACPI_NAMESPACE_NODE *method_node = NULL; + ACPI_NAMESPACE_NODE *node; ACPI_GENERIC_STATE scope_info; @@ -346,10 +410,10 @@ /* * Lookup the name in the internal namespace */ - scope_info.scope.name_table = NULL; - entry = parser_state->start_op->acpi_named_object; - if (entry) { - scope_info.scope.name_table = entry->child_table; + scope_info.scope.node = NULL; + node = parser_state->start_node; + if (node) { + scope_info.scope.node = node; } /* @@ -361,24 +425,24 @@ status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, - &entry); + &node); if (ACPI_SUCCESS (status)) { - if (entry->type == ACPI_TYPE_METHOD) { - method = entry; - name = acpi_ps_alloc_op (AML_NAMEPATH_OP); - if (name) { + if (node->type == ACPI_TYPE_METHOD) { + method_node = node; + name_op = acpi_ps_alloc_op (AML_NAMEPATH_OP); + if (name_op) { /* Change arg into a METHOD CALL and attach name to it */ acpi_ps_init_op (arg, AML_METHODCALL_OP); - name->value.name = path; + name_op->value.name = path; - /* Point METHODCALL/NAME to the METHOD NTE */ + /* Point METHODCALL/NAME to the METHOD Node */ - name->acpi_named_object = method; - acpi_ps_append_arg (arg, name); + name_op->node = method_node; + acpi_ps_append_arg (arg, name_op); - *arg_count = ((ACPI_OBJECT_INTERNAL *) method->object)->method.param_count; + *arg_count = ((ACPI_OPERAND_OBJECT *) method_node->object)->method.param_count; } return; @@ -424,8 +488,8 @@ void acpi_ps_get_next_simple_arg ( ACPI_PARSE_STATE *parser_state, - s32 arg_type, - ACPI_GENERIC_OP *arg) + u32 arg_type, + ACPI_PARSE_OBJECT *arg) { @@ -498,13 +562,13 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_next_field ( ACPI_PARSE_STATE *parser_state) { ACPI_PTRDIFF aml_offset = parser_state->aml - parser_state->aml_start; - ACPI_GENERIC_OP *field; + ACPI_PARSE_OBJECT *field; u16 opcode; u32 name; @@ -598,16 +662,16 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_next_arg ( ACPI_PARSE_STATE *parser_state, - s32 arg_type, + u32 arg_type, u32 *arg_count) { - ACPI_GENERIC_OP *arg = NULL; - ACPI_GENERIC_OP *prev = NULL; - ACPI_GENERIC_OP *field; - s32 subop; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_PARSE_OBJECT *prev = NULL; + ACPI_PARSE_OBJECT *field; + u32 subop; switch (arg_type) @@ -675,7 +739,7 @@ /* fill in bytelist data */ arg->value.size = (parser_state->pkg_end - parser_state->aml); - acpi_ps_to_bytelist_op (arg)->data = parser_state->aml; + ((ACPI_PARSE2_OBJECT *) arg)->data = parser_state->aml; } /* skip to End of byte data */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psfind.c linux/drivers/acpi/parser/psfind.c --- v2.4.0-test8/linux/drivers/acpi/parser/psfind.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/parser/psfind.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,319 @@ + +/****************************************************************************** + * + * Module Name: psfind - Parse tree search routine + * $Revision: 16 $ + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 R. Byron Moore + * + * 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 + */ + + +#include "acpi.h" +#include "acparser.h" +#include "amlcode.h" + +#define _COMPONENT PARSER + MODULE_NAME ("psfind") + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_get_parent + * + * PARAMETERS: Op - Get the parent of this Op + * + * RETURN: The Parent op. + * + * DESCRIPTION: Get op's parent + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT* +acpi_ps_get_parent ( + ACPI_PARSE_OBJECT *op) +{ + ACPI_PARSE_OBJECT *parent = op; + + + /* Traverse the tree upward (to root if necessary) */ + + while (parent) { + switch (parent->opcode) + { + case AML_SCOPE_OP: + case AML_PACKAGE_OP: + case AML_METHOD_OP: + case AML_DEVICE_OP: + case AML_POWER_RES_OP: + case AML_THERMAL_ZONE_OP: + + return (parent->parent); + } + + parent = parent->parent; + } + + return (parent); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_find_name + * + * PARAMETERS: Scope - Scope to search + * Name - ACPI name to search for + * Opcode - Opcode to search for + * + * RETURN: Op containing the name + * + * DESCRIPTION: Find name segment from a list of acpi_ops. Searches a single + * scope, no more. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +acpi_ps_find_name ( + ACPI_PARSE_OBJECT *scope, + u32 name, + u32 opcode) +{ + ACPI_PARSE_OBJECT *op; + ACPI_PARSE_OBJECT *field; + + + /* search scope level for matching name segment */ + + op = acpi_ps_get_child (scope); + + while (op) { + + if (acpi_ps_is_field_op (op->opcode)) { + /* Field, search named fields */ + + field = acpi_ps_get_child (op); + while (field) { + if (acpi_ps_is_named_op (field->opcode) && + acpi_ps_get_name (field) == name && + (!opcode || field->opcode == opcode)) + { + return (field); + } + + field = field->next; + } + } + + else if (acpi_ps_is_create_field_op (op->opcode)) { + if (op->opcode == AML_CREATE_FIELD_OP) { + field = acpi_ps_get_arg (op, 3); + } + + else { + /* Create_xXXField, check name */ + + field = acpi_ps_get_arg (op, 2); + } + + if ((field) && + (field->value.string) && + (!STRNCMP (field->value.string, (char *) &name, ACPI_NAME_SIZE))) + { + return (op); + } + } + + else if ((acpi_ps_is_named_op (op->opcode)) && + (acpi_ps_get_name (op) == name) && + (!opcode || op->opcode == opcode)) + { + break; + } + + op = op->next; + } + + return (op); +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_find + * + * PARAMETERS: Scope - Where to begin the search + * Path - ACPI Path to the named object + * Opcode - Opcode associated with the object + * Create - if TRUE, create the object if not found. + * + * RETURN: Op if found, NULL otherwise. + * + * DESCRIPTION: Find object within scope + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT* +acpi_ps_find ( + ACPI_PARSE_OBJECT *scope, + NATIVE_CHAR *path, + u16 opcode, + u32 create) +{ + u32 seg_count; + u32 name; + u32 name_op; + ACPI_PARSE_OBJECT *op = NULL; + u8 unprefixed = TRUE; + + + if (!scope || !path) { + return (NULL); + } + + + acpi_gbl_ps_find_count++; + + + /* Handle all prefixes in the name path */ + + while (acpi_ps_is_prefix_char (GET8 (path))) { + switch (GET8 (path)) + { + + case '\\': + + /* Could just use a global for "root scope" here */ + + while (scope->parent) { + scope = scope->parent; + } + + /* get first object within the scope */ + /* TBD: [Investigate] OR - set next in root scope to point to the same value as arg */ + + /* Scope = Scope->Value.Arg; */ + + break; + + + case '^': + + /* Go up to the next valid scoping Op (method, scope, etc.) */ + + if (acpi_ps_get_parent (scope)) { + scope = acpi_ps_get_parent (scope); + } + + break; + } + + unprefixed = FALSE; + path++; + } + + /* get name segment count */ + + switch (GET8 (path)) + { + case '\0': + seg_count = 0; + + /* Null name case */ + + if (unprefixed) { + op = NULL; + } + else { + op = scope; + } + + + return (op); + break; + + case AML_DUAL_NAME_PREFIX: + seg_count = 2; + path++; + break; + + case AML_MULTI_NAME_PREFIX_OP: + seg_count = GET8 (path + 1); + path += 2; + break; + + default: + seg_count = 1; + break; + } + + /* match each name segment */ + + while (scope && seg_count) { + MOVE_UNALIGNED32_TO_32 (&name, path); + path += 4; + seg_count --; + + if (seg_count) { + name_op = 0; + } + else { + name_op = opcode; + } + + op = acpi_ps_find_name (scope, name, name_op); + + if (!op) { + if (create) { + /* Create a new Scope level */ + + if (seg_count) { + op = acpi_ps_alloc_op (AML_SCOPE_OP); + } + else { + op = acpi_ps_alloc_op (opcode); + } + + if (op) { + acpi_ps_set_name (op, name); + acpi_ps_append_arg (scope, op); + + } + } + + else if (unprefixed) { + /* Search higher scopes for unprefixed name */ + + while (!op && scope->parent) { + scope = scope->parent; + op = acpi_ps_find_name (scope, name, opcode); + + } + } + + } + + unprefixed = FALSE; + scope = op; + } + + return (op); +} + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psopcode.c linux/drivers/acpi/parser/psopcode.c --- v2.4.0-test8/linux/drivers/acpi/parser/psopcode.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/parser/psopcode.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser opcode information table + * $Revision: 20 $ * *****************************************************************************/ @@ -24,12 +25,32 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("psopcode"); + MODULE_NAME ("psopcode") + + +u8 acpi_gbl_aml_short_op_info_index[]; +u8 acpi_gbl_aml_long_op_info_index[]; + +#define _UNK 0x6B +/* + * Reserved ASCII characters. Do not use any of these for + * internal opcodes, since they are used to differentiate + * name strings from AML opcodes + */ +#define _ASC 0x6C +#define _NAM 0x6C +#define _PFX 0x6D +#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ + +#define MAX_EXTENDED_OPCODE 0x87 +#define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1 +#define MAX_INTERNAL_OPCODE +#define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1 /******************************************************************************* @@ -41,27 +62,41 @@ * RETURN: A pointer to the info about the opcode. NULL if the opcode was * not found in the table. * - * DESCRIPTION: Find AML opcode description based on the opcode + * DESCRIPTION: Find AML opcode description based on the opcode. + * NOTE: This procedure must ALWAYS return a valid pointer! * ******************************************************************************/ -ACPI_OP_INFO * +ACPI_OPCODE_INFO * acpi_ps_get_opcode_info ( u16 opcode) { - ACPI_OP_INFO *op; - s32 hash; + ACPI_OPCODE_INFO *op_info; + u8 upper_opcode; + u8 lower_opcode; + + + /* Split the 16-bit opcode into separate bytes */ + + upper_opcode = (u8) (opcode >> 8); + lower_opcode = (u8) opcode; + + /* Default is "unknown opcode" */ + op_info = &acpi_gbl_aml_op_info [_UNK]; - /* compute hash/index into the Acpi_aml_op_index table */ - switch (opcode >> 8) + /* + * Detect normal 8-bit opcode or extended 16-bit opcode + */ + + switch (upper_opcode) { case 0: - /* Simple (8-bit) opcode */ + /* Simple (8-bit) opcode: 0-255, can't index beyond table */ - hash = opcode; + op_info = &acpi_gbl_aml_op_info [acpi_gbl_aml_short_op_info_index [lower_opcode]]; break; @@ -69,38 +104,29 @@ /* Extended (16-bit, prefix+opcode) opcode */ - hash = (opcode + AML_EXTOP_HASH_OFFSET) & 0xff; + if (lower_opcode <= MAX_EXTENDED_OPCODE) { + op_info = &acpi_gbl_aml_op_info [acpi_gbl_aml_long_op_info_index [lower_opcode]]; + } break; case AML_LNOT_OP: /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */ + /* TBD: [Investigate] remove this case? */ - hash = (opcode + AML_LNOT_HASH_OFFSET) & 0xff; break; default: - return NULL; + break; } /* Get the Op info pointer for this opcode */ - op = &acpi_gbl_aml_op_info [(s32) acpi_gbl_aml_op_info_index [hash]]; - - - /* If the returned opcode matches, we have a valid opcode */ - - if (op->opcode == opcode) { - return op; - } - - /* Otherwise, the opcode is an ASCII char or other non-opcode value */ - - return NULL; + return (op_info); } @@ -117,21 +143,19 @@ * ******************************************************************************/ -char * +NATIVE_CHAR * acpi_ps_get_opcode_name ( u16 opcode) { - ACPI_OP_INFO *op; + ACPI_OPCODE_INFO *op; op = acpi_ps_get_opcode_info (opcode); - if (!op) { - return "*ERROR*"; - } + /* Always guaranteed to return a valid pointer */ DEBUG_ONLY_MEMBERS (return op->name); - return "AE_NOT_CONFIGURED"; + return ("AE_NOT_CONFIGURED"); } @@ -153,7 +177,7 @@ * 6-7 (2 bits) = Reserved */ #define AML_NO_ARGS 0 -#define AML_HAS_ARGS OP_INFO_HAS_ARGS +#define AML_HAS_ARGS ACPI_OP_ARGS_MASK /* * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed @@ -225,7 +249,7 @@ #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_NOOP_CODE ARG_NONE +#define ARGP_NOOP_OP ARG_NONE #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) #define ARGP_BREAK_OP ARG_NONE #define ARGP_BREAK_POINT_OP ARG_NONE @@ -242,9 +266,9 @@ #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) #define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_FROM_BCDOP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_BCDOP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_UN_LOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_REVISION_OP ARG_NONE #define ARGP_DEBUG_OP ARG_NONE #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) @@ -340,7 +364,7 @@ #define ARGI_IF_OP ARGI_INVALID_OPCODE #define ARGI_ELSE_OP ARGI_INVALID_OPCODE #define ARGI_WHILE_OP ARGI_INVALID_OPCODE -#define ARGI_NOOP_CODE ARG_NONE +#define ARGI_NOOP_OP ARG_NONE #define ARGI_RETURN_OP ARGI_INVALID_OPCODE #define ARGI_BREAK_OP ARG_NONE #define ARGI_BREAK_POINT_OP ARG_NONE @@ -357,9 +381,9 @@ #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_NUMBER) #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) -#define ARGI_FROM_BCDOP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_TO_BCDOP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) -#define ARGI_UN_LOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_NUMBER, ARGI_TARGETREF) +#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) #define ARGI_REVISION_OP ARG_NONE #define ARGI_DEBUG_OP ARG_NONE #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_NUMBER, ARGI_NUMBER, ARGI_NUMBER) @@ -388,157 +412,156 @@ */ -ACPI_OP_INFO acpi_gbl_aml_op_info[] = +ACPI_OPCODE_INFO acpi_gbl_aml_op_info[] = { -/* Opcode Opcode Type Has Arguments? Child Name Parser Args Interpreter Args */ +/* Index Opcode Type Class Has Arguments? Name Parser Args Interpreter Args */ -/* 00 */ OP_INFO_ENTRY (AML_ZERO_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Zero_op", ARGP_ZERO_OP, ARGI_ZERO_OP), -/* 01 */ OP_INFO_ENTRY (AML_ONE_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "One_op", ARGP_ONE_OP, ARGI_ONE_OP), -/* 02 */ OP_INFO_ENTRY (AML_ALIAS_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), -/* 03 */ OP_INFO_ENTRY (AML_NAME_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Name", ARGP_NAME_OP, ARGI_NAME_OP), -/* 04 */ OP_INFO_ENTRY (AML_BYTE_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP), -/* 05 */ OP_INFO_ENTRY (AML_WORD_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Word_const", ARGP_WORD_OP, ARGI_WORD_OP), -/* 06 */ OP_INFO_ENTRY (AML_DWORD_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP), -/* 07 */ OP_INFO_ENTRY (AML_STRING_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "String", ARGP_STRING_OP, ARGI_STRING_OP), -/* 08 */ OP_INFO_ENTRY (AML_SCOPE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), -/* 09 */ OP_INFO_ENTRY (AML_BUFFER_OP, OPTYPE_DATA_TERM| AML_HAS_ARGS| 0, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), -/* 0A */ OP_INFO_ENTRY (AML_PACKAGE_OP, OPTYPE_DATA_TERM| AML_HAS_ARGS| 0, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), -/* 0B */ OP_INFO_ENTRY (AML_METHOD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), -/* 0C */ OP_INFO_ENTRY (AML_LOCAL0, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), -/* 0D */ OP_INFO_ENTRY (AML_LOCAL1, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), -/* 0E */ OP_INFO_ENTRY (AML_LOCAL2, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), -/* 0F */ OP_INFO_ENTRY (AML_LOCAL3, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), -/* 10 */ OP_INFO_ENTRY (AML_LOCAL4, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), -/* 11 */ OP_INFO_ENTRY (AML_LOCAL5, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), -/* 12 */ OP_INFO_ENTRY (AML_LOCAL6, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), -/* 13 */ OP_INFO_ENTRY (AML_LOCAL7, OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS| 0, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), -/* 14 */ OP_INFO_ENTRY (AML_ARG0, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg0", ARGP_ARG0, ARGI_ARG0), -/* 15 */ OP_INFO_ENTRY (AML_ARG1, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg1", ARGP_ARG1, ARGI_ARG1), -/* 16 */ OP_INFO_ENTRY (AML_ARG2, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg2", ARGP_ARG2, ARGI_ARG2), -/* 17 */ OP_INFO_ENTRY (AML_ARG3, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg3", ARGP_ARG3, ARGI_ARG3), -/* 18 */ OP_INFO_ENTRY (AML_ARG4, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg4", ARGP_ARG4, ARGI_ARG4), -/* 19 */ OP_INFO_ENTRY (AML_ARG5, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg5", ARGP_ARG5, ARGI_ARG5), -/* 1_a */ OP_INFO_ENTRY (AML_ARG6, OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS| 0, "Arg6", ARGP_ARG6, ARGI_ARG6), -/* 1_b */ OP_INFO_ENTRY (AML_STORE_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Store", ARGP_STORE_OP, ARGI_STORE_OP), -/* 1_c */ OP_INFO_ENTRY (AML_REF_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP), -/* 1_d */ OP_INFO_ENTRY (AML_ADD_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Add", ARGP_ADD_OP, ARGI_ADD_OP), -/* 1_e */ OP_INFO_ENTRY (AML_CONCAT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Concat", ARGP_CONCAT_OP, ARGI_CONCAT_OP), -/* 1_f */ OP_INFO_ENTRY (AML_SUBTRACT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), -/* 20 */ OP_INFO_ENTRY (AML_INCREMENT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), -/* 21 */ OP_INFO_ENTRY (AML_DECREMENT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), -/* 22 */ OP_INFO_ENTRY (AML_MULTIPLY_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), -/* 23 */ OP_INFO_ENTRY (AML_DIVIDE_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), -/* 24 */ OP_INFO_ENTRY (AML_SHIFT_LEFT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), -/* 25 */ OP_INFO_ENTRY (AML_SHIFT_RIGHT_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), -/* 26 */ OP_INFO_ENTRY (AML_BIT_AND_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), -/* 27 */ OP_INFO_ENTRY (AML_BIT_NAND_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), -/* 28 */ OP_INFO_ENTRY (AML_BIT_OR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), -/* 29 */ OP_INFO_ENTRY (AML_BIT_NOR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), -/* 2_a */ OP_INFO_ENTRY (AML_BIT_XOR_OP, OPTYPE_DYADIC2_r| AML_HAS_ARGS| 0, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), -/* 2_b */ OP_INFO_ENTRY (AML_BIT_NOT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), -/* 2_c */ OP_INFO_ENTRY (AML_FIND_SET_LEFT_BIT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP), -/* 2_d */ OP_INFO_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP), -/* 2_e */ OP_INFO_ENTRY (AML_DEREF_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), -/* 2_f */ OP_INFO_ENTRY (AML_NOTIFY_OP, OPTYPE_DYADIC1| AML_HAS_ARGS| 0, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), -/* 30 */ OP_INFO_ENTRY (AML_SIZE_OF_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), -/* 31 */ OP_INFO_ENTRY (AML_INDEX_OP, OPTYPE_INDEX| AML_HAS_ARGS| 0, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), -/* 32 */ OP_INFO_ENTRY (AML_MATCH_OP, OPTYPE_MATCH| AML_HAS_ARGS| 0, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), -/* 33 */ OP_INFO_ENTRY (AML_DWORD_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_dWord_field", ARGP_DWORD_FIELD_OP, ARGI_DWORD_FIELD_OP), -/* 34 */ OP_INFO_ENTRY (AML_WORD_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_word_field", ARGP_WORD_FIELD_OP, ARGI_WORD_FIELD_OP), -/* 35 */ OP_INFO_ENTRY (AML_BYTE_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_byte_field", ARGP_BYTE_FIELD_OP, ARGI_BYTE_FIELD_OP), -/* 36 */ OP_INFO_ENTRY (AML_BIT_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_bit_field", ARGP_BIT_FIELD_OP, ARGI_BIT_FIELD_OP), -/* 37 */ OP_INFO_ENTRY (AML_TYPE_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP), -/* 38 */ OP_INFO_ENTRY (AML_LAND_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), -/* 39 */ OP_INFO_ENTRY (AML_LOR_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), -/* 3_a */ OP_INFO_ENTRY (AML_LNOT_OP, OPTYPE_MONADIC2| AML_HAS_ARGS| 0, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), -/* 3_b */ OP_INFO_ENTRY (AML_LEQUAL_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), -/* 3_c */ OP_INFO_ENTRY (AML_LGREATER_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), -/* 3_d */ OP_INFO_ENTRY (AML_LLESS_OP, OPTYPE_DYADIC2| AML_HAS_ARGS| 0, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), -/* 3_e */ OP_INFO_ENTRY (AML_IF_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "If", ARGP_IF_OP, ARGI_IF_OP), -/* 3_f */ OP_INFO_ENTRY (AML_ELSE_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), -/* 40 */ OP_INFO_ENTRY (AML_WHILE_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), -/* 41 */ OP_INFO_ENTRY (AML_NOOP_CODE, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Noop", ARGP_NOOP_CODE, ARGI_NOOP_CODE), -/* 42 */ OP_INFO_ENTRY (AML_RETURN_OP, OPTYPE_CONTROL| AML_HAS_ARGS| 0, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), -/* 43 */ OP_INFO_ENTRY (AML_BREAK_OP, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), -/* 44 */ OP_INFO_ENTRY (AML_BREAK_POINT_OP, OPTYPE_CONTROL| AML_NO_ARGS| 0, "Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), -/* 45 */ OP_INFO_ENTRY (AML_ONES_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Ones_op", ARGP_ONES_OP, ARGI_ONES_OP), +/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero_op", ARGP_ZERO_OP, ARGI_ZERO_OP), +/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One_op", ARGP_ONE_OP, ARGI_ONE_OP), +/* 02 */ /* AML_ALIAS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), +/* 03 */ /* AML_NAME_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Name", ARGP_NAME_OP, ARGI_NAME_OP), +/* 04 */ /* AML_BYTE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Byte_const", ARGP_BYTE_OP, ARGI_BYTE_OP), +/* 05 */ /* AML_WORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Word_const", ARGP_WORD_OP, ARGI_WORD_OP), +/* 06 */ /* AML_DWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Dword_const", ARGP_DWORD_OP, ARGI_DWORD_OP), +/* 07 */ /* AML_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "String", ARGP_STRING_OP, ARGI_STRING_OP), +/* 08 */ /* AML_SCOPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), +/* 09 */ /* AML_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), +/* 0A */ /* AML_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), +/* 0B */ /* AML_METHOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), +/* 0C */ /* AML_LOCAL0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), +/* 0D */ /* AML_LOCAL1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), +/* 0E */ /* AML_LOCAL2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), +/* 0F */ /* AML_LOCAL3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), +/* 10 */ /* AML_LOCAL4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), +/* 11 */ /* AML_LOCAL5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), +/* 12 */ /* AML_LOCAL6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), +/* 13 */ /* AML_LOCAL7 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), +/* 14 */ /* AML_ARG0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg0", ARGP_ARG0, ARGI_ARG0), +/* 15 */ /* AML_ARG1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg1", ARGP_ARG1, ARGI_ARG1), +/* 16 */ /* AML_ARG2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg2", ARGP_ARG2, ARGI_ARG2), +/* 17 */ /* AML_ARG3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg3", ARGP_ARG3, ARGI_ARG3), +/* 18 */ /* AML_ARG4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg4", ARGP_ARG4, ARGI_ARG4), +/* 19 */ /* AML_ARG5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg5", ARGP_ARG5, ARGI_ARG5), +/* 1_a */ /* AML_ARG6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg6", ARGP_ARG6, ARGI_ARG6), +/* 1_b */ /* AML_STORE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Store", ARGP_STORE_OP, ARGI_STORE_OP), +/* 1_c */ /* AML_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Ref_of", ARGP_REF_OF_OP, ARGI_REF_OF_OP), +/* 1_d */ /* AML_ADD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Add", ARGP_ADD_OP, ARGI_ADD_OP), +/* 1_e */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Concat", ARGP_CONCAT_OP, ARGI_CONCAT_OP), +/* 1_f */ /* AML_SUBTRACT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), +/* 20 */ /* AML_INCREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), +/* 21 */ /* AML_DECREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), +/* 22 */ /* AML_MULTIPLY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), +/* 23 */ /* AML_DIVIDE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), +/* 24 */ /* AML_SHIFT_LEFT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Shift_left", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), +/* 25 */ /* AML_SHIFT_RIGHT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Shift_right", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), +/* 26 */ /* AML_BIT_AND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), +/* 27 */ /* AML_BIT_NAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), +/* 28 */ /* AML_BIT_OR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), +/* 29 */ /* AML_BIT_NOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), +/* 2_a */ /* AML_BIT_XOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_r| AML_HAS_ARGS, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), +/* 2_b */ /* AML_BIT_NOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), +/* 2_c */ /* AML_FIND_SET_LEFT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Find_set_left_bit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP), +/* 2_d */ /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Find_set_right_bit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP), +/* 2_e */ /* AML_DEREF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Deref_of", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), +/* 2_f */ /* AML_NOTIFY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), +/* 30 */ /* AML_SIZE_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Size_of", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), +/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), +/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), +/* 33 */ /* AML_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_dWord_field", ARGP_DWORD_FIELD_OP, ARGI_DWORD_FIELD_OP), +/* 34 */ /* AML_WORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_word_field", ARGP_WORD_FIELD_OP, ARGI_WORD_FIELD_OP), +/* 35 */ /* AML_BYTE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_byte_field", ARGP_BYTE_FIELD_OP, ARGI_BYTE_FIELD_OP), +/* 36 */ /* AML_BIT_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_bit_field", ARGP_BIT_FIELD_OP, ARGI_BIT_FIELD_OP), +/* 37 */ /* AML_TYPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Object_type", ARGP_TYPE_OP, ARGI_TYPE_OP), +/* 38 */ /* AML_LAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), +/* 39 */ /* AML_LOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), +/* 3_a */ /* AML_LNOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), +/* 3_b */ /* AML_LEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), +/* 3_c */ /* AML_LGREATER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), +/* 3_d */ /* AML_LLESS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), +/* 3_e */ /* AML_IF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "If", ARGP_IF_OP, ARGI_IF_OP), +/* 3_f */ /* AML_ELSE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), +/* 40 */ /* AML_WHILE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), +/* 41 */ /* AML_NOOP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Noop", ARGP_NOOP_OP, ARGI_NOOP_OP), +/* 42 */ /* AML_RETURN_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), +/* 43 */ /* AML_BREAK_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), +/* 44 */ /* AML_BREAK_POINT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break_point", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), +/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones_op", ARGP_ONES_OP, ARGI_ONES_OP), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ -/* 46 */ OP_INFO_ENTRY (AML_MUTEX_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), -/* 47 */ OP_INFO_ENTRY (AML_EVENT_OP, OPTYPE_NAMED_OBJECT| AML_NO_ARGS| 0, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), -/* 48 */ OP_INFO_ENTRY (AML_COND_REF_OF_OP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), -/* 49 */ OP_INFO_ENTRY (AML_CREATE_FIELD_OP, OPTYPE_CREATE_FIELD| AML_HAS_ARGS| 0, "Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), -/* 4_a */ OP_INFO_ENTRY (AML_LOAD_OP, OPTYPE_RECONFIGURATION| AML_HAS_ARGS| 0, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), -/* 4_b */ OP_INFO_ENTRY (AML_STALL_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), -/* 4_c */ OP_INFO_ENTRY (AML_SLEEP_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), -/* 4_d */ OP_INFO_ENTRY (AML_ACQUIRE_OP, OPTYPE_DYADIC2_s| AML_HAS_ARGS| 0, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), -/* 4_e */ OP_INFO_ENTRY (AML_SIGNAL_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), -/* 4_f */ OP_INFO_ENTRY (AML_WAIT_OP, OPTYPE_DYADIC2_s| AML_HAS_ARGS| 0, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), -/* 50 */ OP_INFO_ENTRY (AML_RESET_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), -/* 51 */ OP_INFO_ENTRY (AML_RELEASE_OP, OPTYPE_MONADIC1| AML_HAS_ARGS| 0, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), -/* 52 */ OP_INFO_ENTRY (AML_FROM_BCDOP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "From_bCD", ARGP_FROM_BCDOP, ARGI_FROM_BCDOP), -/* 53 */ OP_INFO_ENTRY (AML_TO_BCDOP, OPTYPE_MONADIC2_r| AML_HAS_ARGS| 0, "To_bCD", ARGP_TO_BCDOP, ARGI_TO_BCDOP), -/* 54 */ OP_INFO_ENTRY (AML_UN_LOAD_OP, OPTYPE_RECONFIGURATION| AML_HAS_ARGS| 0, "Unload", ARGP_UN_LOAD_OP, ARGI_UN_LOAD_OP), -/* 55 */ OP_INFO_ENTRY (AML_REVISION_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), -/* 56 */ OP_INFO_ENTRY (AML_DEBUG_OP, OPTYPE_CONSTANT| AML_NO_ARGS| 0, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), -/* 57 */ OP_INFO_ENTRY (AML_FATAL_OP, OPTYPE_FATAL| AML_HAS_ARGS| 0, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), -/* 58 */ OP_INFO_ENTRY (AML_REGION_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Op_region", ARGP_REGION_OP, ARGI_REGION_OP), -/* 59 */ OP_INFO_ENTRY (AML_DEF_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), -/* 5_a */ OP_INFO_ENTRY (AML_DEVICE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), -/* 5_b */ OP_INFO_ENTRY (AML_PROCESSOR_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), -/* 5_c */ OP_INFO_ENTRY (AML_POWER_RES_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Power_res", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), -/* 5_d */ OP_INFO_ENTRY (AML_THERMAL_ZONE_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), -/* 5_e */ OP_INFO_ENTRY (AML_INDEX_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), -/* 5_f */ OP_INFO_ENTRY (AML_BANK_FIELD_OP, OPTYPE_NAMED_OBJECT| AML_HAS_ARGS| 0, "Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), +/* 46 */ /* AML_MUTEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), +/* 47 */ /* AML_EVENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_NO_ARGS, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), +/* 48 */ /* AML_COND_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "Cond_ref_of", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), +/* 49 */ /* AML_CREATE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "Create_field", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), +/* 4_a */ /* AML_LOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), +/* 4_b */ /* AML_STALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), +/* 4_c */ /* AML_SLEEP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), +/* 4_d */ /* AML_ACQUIRE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), +/* 4_e */ /* AML_SIGNAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), +/* 4_f */ /* AML_WAIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2_s| AML_HAS_ARGS, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), +/* 50 */ /* AML_RESET_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), +/* 51 */ /* AML_RELEASE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), +/* 52 */ /* AML_FROM_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "From_bCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP), +/* 53 */ /* AML_TO_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2_r| AML_HAS_ARGS, "To_bCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP), +/* 54 */ /* AML_UNLOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP), +/* 55 */ /* AML_REVISION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), +/* 56 */ /* AML_DEBUG_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), +/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), +/* 58 */ /* AML_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Op_region", ARGP_REGION_OP, ARGI_REGION_OP), +/* 59 */ /* AML_DEF_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), +/* 5_a */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), +/* 5_b */ /* AML_PROCESSOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), +/* 5_c */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Power_res", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), +/* 5_d */ /* AML_THERMAL_ZONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Thermal_zone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), +/* 5_e */ /* AML_INDEX_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Index_field", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), +/* 5_f */ /* AML_BANK_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Bank_field", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ OP_INFO_ENTRY (AML_LNOTEQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), -/* 61 */ OP_INFO_ENTRY (AML_LLESSEQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), -/* 62 */ OP_INFO_ENTRY (AML_LGREATEREQUAL_OP, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), -/* 63 */ OP_INFO_ENTRY (AML_NAMEPATH_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Name_path", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), -/* 64 */ OP_INFO_ENTRY (AML_METHODCALL_OP, OPTYPE_METHOD_CALL| AML_HAS_ARGS| 0, "Method_call", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), -/* 65 */ OP_INFO_ENTRY (AML_BYTELIST_OP, OPTYPE_LITERAL| AML_NO_ARGS| 0, "Byte_list", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), -/* 66 */ OP_INFO_ENTRY (AML_RESERVEDFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Reserved_field", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), -/* 67 */ OP_INFO_ENTRY (AML_NAMEDFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Named_field", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), -/* 68 */ OP_INFO_ENTRY (AML_ACCESSFIELD_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Access_field", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), -/* 69 */ OP_INFO_ENTRY (AML_STATICSTRING_OP, OPTYPE_BOGUS| AML_NO_ARGS| 0, "Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), -/* 6_a */ OP_INFO_ENTRY (0, OPTYPE_BOGUS| AML_HAS_ARGS| 0, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), - OP_INFO_ENTRY (0, 0| AML_HAS_ARGS| 0, NULL, ARG_NONE, ARG_NONE) +/* 60 */ /* AML_LNOTEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LNot_equal", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), +/* 61 */ /* AML_LLESSEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LLess_equal", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), +/* 62 */ /* AML_LGREATEREQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LGreater_equal", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), +/* 63 */ /* AML_NAMEPATH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Name_path", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), +/* 64 */ /* AML_METHODCALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL| AML_HAS_ARGS, "Method_call", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), +/* 65 */ /* AML_BYTELIST_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "Byte_list", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), +/* 66 */ /* AML_RESERVEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Reserved_field", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), +/* 67 */ /* AML_NAMEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Named_field", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), +/* 68 */ /* AML_ACCESSFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Access_field", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), +/* 69 */ /* AML_STATICSTRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "Static_string", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), +/* 6_a */ /* AML_RETURN_VALUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN| AML_HAS_ARGS, "[Return Value]", ARG_NONE, ARG_NONE), +/* 6_b */ /* UNKNOWN OPCODES */ OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), +/* 6_c */ /* ASCII CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS, "ASCII_ONLY!", ARG_NONE, ARG_NONE), +/* 6_d */ /* PREFIX CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS, "PREFIX_ONLY!", ARG_NONE, ARG_NONE), }; -#define _UNK 0x6A -#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ - /* * This table is directly indexed by the opcodes, and returns an * index into the table above */ -u8 acpi_gbl_aml_op_info_index[256] = +u8 acpi_gbl_aml_short_op_info_index[256] = { /* 0 1 2 3 4 5 6 7 */ /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, _UNK, _UNK, -/* 0x10 */ 0x08, 0x09, 0x0a, _UNK, 0x0b, _UNK, _UNK, 0x46, -/* 0x18 */ 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x10 */ 0x08, 0x09, 0x0a, _UNK, 0x0b, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x28 */ 0x48, 0x49, _UNK, _UNK, _UNK, 0x63, _UNK, _UNK, -/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x4a, 0x4b, -/* 0x38 */ 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, -/* 0x40 */ 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, 0x55, 0x56, -/* 0x48 */ 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, -/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, +/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, _UNK, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, +/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, /* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, /* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, _UNK, _UNK, 0x2f, 0x30, /* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, _UNK, -/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x58, 0x59, -/* 0x98 */ 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, _UNK, _UNK, +/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, _UNK, _UNK, +/* 0x98 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, @@ -552,3 +575,32 @@ /* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, }; + + +u8 acpi_gbl_aml_long_op_info_index[NUM_EXTENDED_OPCODE] = +{ +/* 0 1 2 3 4 5 6 7 */ +/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, +/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, +/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x30 */ 0x55, 0x56, 0x57, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, +/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +}; + + +/* 0 1 2 3 4 5 6 7 */ +/* 0x00 */ + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psparse.c linux/drivers/acpi/parser/psparse.c --- v2.4.0-test8/linux/drivers/acpi/parser/psparse.c Wed Jul 5 11:23:12 2000 +++ linux/drivers/acpi/parser/psparse.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines + * $Revision: 51 $ * *****************************************************************************/ @@ -33,14 +34,14 @@ */ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" +#include "acparser.h" +#include "acdispat.h" #include "amlcode.h" -#include "namesp.h" -#include "debugger.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT PARSER - MODULE_NAME ("psparse"); + MODULE_NAME ("psparse") u32 acpi_gbl_depth = 0; @@ -65,11 +66,11 @@ ACPI_STATUS acpi_ps_delete_completed_op ( ACPI_WALK_STATE *state, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { acpi_ps_free_op (op); - return AE_OK; + return (AE_OK); } @@ -78,7 +79,7 @@ * * FUNCTION: Acpi_ps_delete_parse_tree * - * PARAMETERS: Root - Root of tree (or subtree) to delete + * PARAMETERS: Subtree_root - Root of tree (or subtree) to delete * * RETURN: None * @@ -88,33 +89,54 @@ void acpi_ps_delete_parse_tree ( - ACPI_GENERIC_OP *root) + ACPI_PARSE_OBJECT *subtree_root) { - ACPI_GENERIC_OP *op; - ACPI_WALK_STATE walk_state; + ACPI_WALK_STATE *walk_state; + ACPI_WALK_LIST walk_list; - walk_state.origin = root; - op = root; + if (!subtree_root) { + return; + } - /* TBD: [Restructure] hack for root case */ + /* Create and initialize a new walk list */ - if (op == acpi_gbl_parsed_namespace_root) { - op = acpi_ps_get_child (op); + walk_list.walk_state = NULL; + walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list); + if (!walk_state) { + return; } - /* Save root until last, so that we know when the tree has been walked */ + walk_state->parser_state = NULL; + walk_state->parse_flags = 0; + walk_state->descending_callback = NULL; + walk_state->ascending_callback = NULL; + - walk_state.next_op = op; - walk_state.next_op_info = NEXT_OP_DOWNWARD; + walk_state->origin = subtree_root; + walk_state->next_op = subtree_root; - while (walk_state.next_op) { - acpi_ps_get_next_walk_op (&walk_state, walk_state.next_op, + + /* Head downward in the tree */ + + walk_state->next_op_info = NEXT_OP_DOWNWARD; + + /* Visit all nodes in the subtree */ + + while (walk_state->next_op) { + acpi_ps_get_next_walk_op (walk_state, walk_state->next_op, acpi_ps_delete_completed_op); } + + /* We are done with this walk */ + + acpi_ds_delete_walk_state (walk_state); + + return; } #endif + /******************************************************************************* * * FUNCTION: Acpi_ps_peek_opcode @@ -135,12 +157,12 @@ /* Extended (2-byte) opcode if > 255 */ if (opcode > 0x00FF) { - return 2; + return (2); } /* Otherwise, just a single byte opcode */ - return 1; + return (1); } @@ -194,7 +216,7 @@ /* don't convert bare name to a namepath */ - return opcode; + return (opcode); } @@ -214,7 +236,7 @@ ACPI_PARSE_STATE * acpi_ps_create_state ( u8 *aml, - s32 aml_size) + u32 aml_size) { ACPI_PARSE_STATE *parser_state; @@ -257,88 +279,270 @@ ACPI_STATUS acpi_ps_find_object ( u16 opcode, - ACPI_PARSE_STATE *parser_state, + ACPI_PARSE_OBJECT *op, ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP **op) + ACPI_PARSE_OBJECT **out_op) { - char *path; + NATIVE_CHAR *path; + /* We are only interested in opcodes that have an associated name */ + + if (!acpi_ps_is_named_op (opcode)) { + *out_op = op; + return (AE_OK); + } + /* Find the name in the parse tree */ - path = acpi_ps_get_next_namestring (parser_state); + path = acpi_ps_get_next_namestring (walk_state->parser_state); - *op = acpi_ps_find (acpi_ps_get_parent_scope (parser_state), + *out_op = acpi_ps_find (acpi_ps_get_parent_scope (walk_state->parser_state), path, opcode, 1); - if (!(*op)) { - return AE_NOT_FOUND; + if (!(*out_op)) { + return (AE_NOT_FOUND); } - return AE_OK; + return (AE_OK); } + +#endif + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_complete_this_op + * + * PARAMETERS: Walk_state - Current State + * Op - Op to complete + * + * RETURN: TRUE if Op and subtree was deleted + * + * DESCRIPTION: Perform any cleanup at the completion of an Op. + * + ******************************************************************************/ + +u8 +acpi_ps_complete_this_op ( + ACPI_WALK_STATE *walk_state, + ACPI_PARSE_OBJECT *op) +{ +#ifndef PARSER_ONLY + ACPI_PARSE_OBJECT *prev; + ACPI_PARSE_OBJECT *next; + ACPI_OPCODE_INFO *op_info; + ACPI_OPCODE_INFO *parent_info; + u32 opcode_class; + ACPI_PARSE_OBJECT *replacement_op = NULL; + + + op_info = acpi_ps_get_opcode_info (op->opcode); + opcode_class = ACPI_GET_OP_CLASS (op_info); + + + /* Delete this op and the subtree below it if asked to */ + + if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) == ACPI_PARSE_DELETE_TREE) && + (opcode_class != OPTYPE_CONSTANT) && + (opcode_class != OPTYPE_LITERAL) && + (opcode_class != OPTYPE_LOCAL_VARIABLE) && + (opcode_class != OPTYPE_METHOD_ARGUMENT) && + (opcode_class != OPTYPE_DATA_TERM) && + (op->opcode != AML_NAMEPATH_OP)) + { + /* Make sure that we only delete this subtree */ + + if (op->parent) { + /* + * Check if we need to replace the operator and its subtree + * with a return value op + */ + + parent_info = acpi_ps_get_opcode_info (op->parent->opcode); + + switch (ACPI_GET_OP_CLASS (parent_info)) + { + case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ + case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */ + break; + + default: + replacement_op = acpi_ps_alloc_op (AML_RETURN_VALUE_OP); + if (!replacement_op) { + return (FALSE); + } + } + + /* We must unlink this op from the parent tree */ + + prev = op->parent->value.arg; + if (prev == op) { + /* This op is the first in the list */ + + if (replacement_op) { + replacement_op->parent = op->parent; + replacement_op->value.arg = NULL; + op->parent->value.arg = replacement_op; + replacement_op->next = op->next; + } + else { + op->parent->value.arg = op->next; + } + } + + /* Search the parent list */ + + else while (prev) { + /* Traverse all siblings in the parent's argument list */ + + next = prev->next; + if (next == op) { + if (replacement_op) { + replacement_op->parent = op->parent; + replacement_op->value.arg = NULL; + prev->next = replacement_op; + replacement_op->next = op->next; + next = NULL; + } + else { + prev->next = op->next; + next = NULL; + } + } + + prev = next; + } + + } + + /* Now we can actually delete the subtree rooted at op */ + + acpi_ps_delete_parse_tree (op); + + return (TRUE); + } + + return (FALSE); + #else + return (FALSE); +#endif +} + + +/******************************************************************************* + * + * FUNCTION: Acpi_ps_next_parse_state + * + * PARAMETERS: Parser_state - Current parser state object + * + * RETURN: + * + * DESCRIPTION: + * + ******************************************************************************/ + ACPI_STATUS -acpi_ps_find_object ( - u16 opcode, - ACPI_PARSE_STATE *parser_state, +acpi_ps_next_parse_state ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP **out_op) + ACPI_PARSE_OBJECT *op, + ACPI_STATUS callback_status) { - char *path; - ACPI_GENERIC_OP *op; - OBJECT_TYPE_INTERNAL data_type; - ACPI_STATUS status; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_PARSE_STATE *parser_state = walk_state->parser_state; + ACPI_STATUS status = AE_CTRL_PENDING; - /* - * The full parse tree has already been deleted -- therefore, we are parsing - * a control method. We can lookup the name in the namespace instead of - * the parse tree! - */ + switch (callback_status) + { + case AE_CTRL_TERMINATE: + /* + * A control method was terminated via a RETURN statement. + * The walk of this method is complete. + */ - path = acpi_ps_get_next_namestring (parser_state); + parser_state->aml = parser_state->aml_end; + status = AE_CTRL_TERMINATE; + break; - /* Map the raw opcode into an internal object type */ - data_type = acpi_ds_map_named_opcode_to_data_type (opcode); + case AE_CTRL_PENDING: - /* - * Enter the object into the namespace - * LOAD_PASS1 means Create if not found - */ + /* + * Predicate of a WHILE was true and the loop just completed an + * execution. Go back to the start of the loop and reevaluate the + * predicate. + */ +/* Walk_state->Control_state->Common.State = + CONTROL_PREDICATE_EXECUTING;*/ - status = acpi_ns_lookup (walk_state->scope_info, path, data_type, - IMODE_LOAD_PASS1, - NS_NO_UPSEARCH, walk_state, &entry); - if (ACPI_FAILURE (status)) { - return (status); - } + /* TBD: How to handle a break within a while. */ + /* This code attempts it */ - /* Create a new op */ + parser_state->aml = walk_state->aml_last_while; + break; - op = acpi_ps_alloc_op (opcode); - if (!op) { - return (AE_NO_MEMORY); - } - /* Initialize */ + case AE_CTRL_TRUE: + /* + * Predicate of an IF was true, and we are at the matching ELSE. + * Just close out this package + * + * Parser_state->Aml is modified by the package length procedure + */ + parser_state->aml = (parser_state->aml + + acpi_ps_get_next_package_length (parser_state)) -1; + break; + - ((ACPI_NAMED_OP *)op)->name = entry->name; - op->acpi_named_object = entry; + case AE_CTRL_FALSE: + /* + * Either an IF/WHILE Predicate was false or we encountered a BREAK + * opcode. In both cases, we do not execute the rest of the + * package; We simply close out the parent (finishing the walk of + * this branch of the tree) and continue execution at the parent + * level. + */ - acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + parser_state->aml = parser_state->scope->parse_scope.pkg_end; - *out_op = op; + /* In the case of a BREAK, just force a predicate (if any) to FALSE */ + walk_state->control_state->common.value = FALSE; + status = AE_CTRL_END; + break; - return (AE_OK); + + case AE_CTRL_TRANSFER: + + /* + * A method call (invocation) -- transfer control + */ + status = AE_CTRL_TRANSFER; + walk_state->prev_op = op; + walk_state->method_call_op = op; + walk_state->method_call_node = (op->value.arg)->node; + + /* Will return value (if any) be used by the caller? */ + + walk_state->return_used = acpi_ds_is_result_used (op); + break; + + + default: + status = callback_status; + if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { + status = AE_OK; + } + break; + } + + + return (status); } -#endif /******************************************************************************* @@ -356,26 +560,27 @@ ACPI_STATUS acpi_ps_parse_loop ( - ACPI_PARSE_STATE *parser_state, - ACPI_WALK_STATE *walk_state, - u32 parse_flags) + ACPI_WALK_STATE *walk_state) { ACPI_STATUS status = AE_OK; - ACPI_GENERIC_OP *op = NULL; /* current op */ - ACPI_OP_INFO *op_info; - ACPI_GENERIC_OP *arg = NULL; - ACPI_DEFERRED_OP *deferred_op; + ACPI_PARSE_OBJECT *op = NULL; /* current op */ + ACPI_OPCODE_INFO *op_info; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_PARSE2_OBJECT *deferred_op; u32 arg_count; /* push for fixed or var args */ u32 arg_types = 0; ACPI_PTRDIFF aml_offset; u16 opcode; - ACPI_GENERIC_OP pre_op; + ACPI_PARSE_OBJECT pre_op; + ACPI_PARSE_STATE *parser_state; -#ifndef PARSER_ONLY - OBJECT_TYPE_INTERNAL data_type; -#endif + parser_state = walk_state->parser_state; + if (walk_state->prev_op) { + op = walk_state->prev_op; + arg_types = walk_state->prev_arg_types; + } /* * Iterative parsing loop, while there is more aml to process: @@ -384,9 +589,8 @@ if (!op) { /* Get the next opcode from the AML stream */ - aml_offset = parser_state->aml - parser_state->aml_start; - opcode = acpi_ps_peek_opcode (parser_state); - op_info = acpi_ps_get_opcode_info (opcode); + aml_offset = parser_state->aml - parser_state->aml_start; + opcode = acpi_ps_peek_opcode (parser_state); /* * First cut to determine what we have found: @@ -395,16 +599,19 @@ * 3) An unknown/invalid opcode */ - if (op_info) { + op_info = acpi_ps_get_opcode_info (opcode); + switch (ACPI_GET_OP_TYPE (op_info)) + { + case ACPI_OP_TYPE_OPCODE: + /* Found opcode info, this is a normal opcode */ parser_state->aml += acpi_ps_get_opcode_size (opcode); arg_types = op_info->parse_args; - } + break; - else if (acpi_ps_is_prefix_char (opcode) || - acpi_ps_is_leading_char (opcode)) - { + case ACPI_OP_TYPE_ASCII: + case ACPI_OP_TYPE_PREFIX: /* * Starts with a valid prefix or ASCII char, this is a name * string. Convert the bare name string to a namepath. @@ -412,9 +619,10 @@ opcode = AML_NAMEPATH_OP; arg_types = ARGP_NAMESTRING; - } + break; + + case ACPI_OP_TYPE_UNKNOWN: - else { /* The opcode is unrecognized. Just skip unknown opcodes */ parser_state->aml += acpi_ps_get_opcode_size (opcode); @@ -441,9 +649,24 @@ INCREMENT_ARG_LIST (arg_types); - status = acpi_ps_find_object (opcode, parser_state, walk_state, &op); - if (ACPI_FAILURE (status)) { - return (AE_NOT_FOUND); + if (walk_state->descending_callback != NULL) { + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + status = walk_state->descending_callback (opcode, NULL, walk_state, &op); + if (op == NULL) { + continue; + } + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } } acpi_ps_append_arg (op, pre_op.value.arg); @@ -451,7 +674,7 @@ if (op->opcode == AML_REGION_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -464,13 +687,15 @@ * Body_length is unknown until we parse the body */ - deferred_op->body = parser_state->aml - 6; - deferred_op->body_length = 0; + deferred_op->data = parser_state->aml - 6; + deferred_op->length = 0; } } } else { + + /* Not a named opcode, just allocate Op and append to parent */ op = acpi_ps_alloc_op (opcode); @@ -479,6 +704,23 @@ } acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op); + + if ((walk_state->descending_callback != NULL)) { + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + status = walk_state->descending_callback (opcode, op, walk_state, &op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (ACPI_FAILURE (status)) { + goto close_this_op; + } + } } op->aml_offset = aml_offset; @@ -532,7 +774,7 @@ /* For a method, save the length and address of the body */ if (op->opcode == AML_METHOD_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -540,8 +782,8 @@ * to parse them correctly. */ - deferred_op->body = parser_state->aml; - deferred_op->body_length = parser_state->pkg_end - + deferred_op->data = parser_state->aml; + deferred_op->length = parser_state->pkg_end - parser_state->aml; /* @@ -549,8 +791,8 @@ * parsing because the opregion is not a standalone * package (We don't know where the end is). */ - parser_state->aml = parser_state->pkg_end; - arg_count = 0; + parser_state->aml = parser_state->pkg_end; + arg_count = 0; } } @@ -567,7 +809,7 @@ } if (op->opcode == AML_REGION_OP) { - deferred_op = acpi_ps_to_deferred_op (op); + deferred_op = acpi_ps_to_extended_op (op); if (deferred_op) { /* * Skip parsing of control method or opregion body, @@ -578,46 +820,75 @@ * know the length. */ - deferred_op->body_length = parser_state->aml - - deferred_op->body; + deferred_op->length = parser_state->aml - + deferred_op->data; } } + } -#ifndef PARSER_ONLY - data_type = acpi_ds_map_named_opcode_to_data_type (op->opcode); + /* This op complete, notify the dispatcher */ - if (op->opcode == AML_NAME_OP) { - if (op->value.arg) { - data_type = acpi_ds_map_opcode_to_data_type ( - (op->value.arg)->opcode, NULL); - ((ACPI_NAMED_OBJECT*)op->acpi_named_object)->type = - (u8) data_type; - } + if (walk_state->ascending_callback != NULL) { + status = walk_state->ascending_callback (walk_state, op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; } + } - /* Pop the scope stack */ - if (acpi_ns_opens_scope (data_type)) { +close_this_op: - acpi_ds_scope_stack_pop (walk_state); - } -#endif + parser_state->scope->parse_scope.arg_count--; + + /* Close this Op (may result in parse subtree deletion) */ + + if (acpi_ps_complete_this_op (walk_state, op)) { + op = NULL; + } + + + if (status == AE_CTRL_END) { + acpi_ps_pop_scope (parser_state, &op, &arg_types); + status = walk_state->ascending_callback (walk_state, op); + status = acpi_ps_next_parse_state (walk_state, op, status); + acpi_ps_complete_this_op (walk_state, op); + op = NULL; + status = AE_OK; } + else if (ACPI_FAILURE (status)) { + if (op == NULL) { + acpi_ps_pop_scope (parser_state, &op, &arg_types); + } + walk_state->prev_op = op; + walk_state->prev_arg_types = arg_types; - parser_state->scope->arg_count--; + /* + * TEMP: + */ + if (status == AE_CTRL_TERMINATE) { + status = AE_OK; - /* Delete op if asked to */ + /* Clean up */ + do + { + if (op) { + acpi_ps_complete_this_op (walk_state, op); + } -#ifndef PARSER_ONLY - if (parse_flags & PARSE_DELETE_TREE) { - acpi_ps_delete_parse_tree (op); + acpi_ps_pop_scope (parser_state, &op, &arg_types); + } while (op); + } + return (status); } -#endif + /* This scope complete? */ + if (acpi_ps_has_completed_scope (parser_state)) { acpi_ps_pop_scope (parser_state, &op, &arg_types); } @@ -625,6 +896,7 @@ else { op = NULL; } + } else { @@ -637,6 +909,54 @@ } /* while Parser_state->Aml */ + /* + * Complete the last Op (if not completed), and clear the scope stack. + * It is easily possible to end an AML "package" with an unbounded number + * of open scopes (such as when several AML blocks are closed with + * sequential closing braces). We want to terminate each one cleanly. + */ + + do + { + if (op) { + if (walk_state->ascending_callback != NULL) { + status = walk_state->ascending_callback (walk_state, op); + status = acpi_ps_next_parse_state (walk_state, op, status); + if (status == AE_CTRL_PENDING) { + status = AE_OK; + goto close_this_op; + } + + if (status == AE_CTRL_TERMINATE) { + status = AE_OK; + + /* Clean up */ + do + { + if (op) { + acpi_ps_complete_this_op (walk_state, op); + } + + acpi_ps_pop_scope (parser_state, &op, &arg_types); + + } while (op); + + return (status); + } + + else if (ACPI_FAILURE (status)) { + acpi_ps_complete_this_op (walk_state, op); + return (status); + } + } + + acpi_ps_complete_this_op (walk_state, op); + } + + acpi_ps_pop_scope (parser_state, &op, &arg_types); + + } while (op); + return (status); } @@ -658,19 +978,28 @@ ACPI_STATUS acpi_ps_parse_aml ( - ACPI_GENERIC_OP *start_scope, + ACPI_PARSE_OBJECT *start_scope, u8 *aml, u32 aml_size, - u32 parse_flags) + u32 parse_flags, + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { ACPI_STATUS status; ACPI_PARSE_STATE *parser_state; ACPI_WALK_STATE *walk_state; ACPI_WALK_LIST walk_list; - ACPI_NAMED_OBJECT *entry = NULL; + ACPI_NAMESPACE_NODE *node = NULL; + ACPI_WALK_LIST *prev_walk_list = acpi_gbl_current_walk_list; + ACPI_OPERAND_OBJECT *return_desc; + ACPI_OPERAND_OBJECT *mth_desc = NULL; + ACPI_NAMESPACE_NODE *start_node; - /* Initialize parser state and scope */ + /* Create and initialize a new parser state */ parser_state = acpi_ps_create_state (aml, aml_size); if (!parser_state) { @@ -679,36 +1008,166 @@ acpi_ps_init_scope (parser_state, start_scope); + if (method_node) { + mth_desc = acpi_ns_get_attached_object (method_node); + } - /* Initialize a new walk list */ + /* Create and initialize a new walk list */ walk_list.walk_state = NULL; - walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, NULL, NULL, &walk_list); + walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, parser_state->start_op, mth_desc, &walk_list); if (!walk_state) { status = AE_NO_MEMORY; goto cleanup; } + walk_state->method_node = method_node; + walk_state->parser_state = parser_state; + walk_state->parse_flags = parse_flags; + walk_state->descending_callback = descending_callback; + walk_state->ascending_callback = ascending_callback; + + /* TBD: [Restructure] TEMP until we pass Walk_state to the interpreter + */ + acpi_gbl_current_walk_list = &walk_list; + - /* Setup the current scope */ + if (method_node) { + start_node = method_node; + parser_state->start_node = method_node; + walk_state->walk_type = WALK_METHOD; - entry = parser_state->start_op->acpi_named_object; - if (entry) { - /* Push start scope on scope stack and make it current */ + if (start_node) { + /* Push start scope on scope stack and make it current */ + + status = acpi_ds_scope_stack_push (start_node, ACPI_TYPE_METHOD, walk_state); + if (ACPI_FAILURE (status)) { + return (status); + } - status = acpi_ds_scope_stack_push (entry->child_table, entry->type, - walk_state); - if (ACPI_FAILURE (status)) { - goto cleanup; } + /* Init arguments if this is a control method */ + /* TBD: [Restructure] add walkstate as a param */ + acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); } + else { + /* Setup the current scope */ - /* Create the parse tree */ + node = parser_state->start_op->node; + if (node) { + /* Push start scope on scope stack and make it current */ + + status = acpi_ds_scope_stack_push (node, node->type, + walk_state); + if (ACPI_FAILURE (status)) { + goto cleanup; + } + + } + } - status = acpi_ps_parse_loop (parser_state, walk_state, parse_flags); + + status = AE_OK; + + /* + * Execute the walk loop as long as there is a valid Walk State. This + * handles nested control method invocations without recursion. + */ + + while (walk_state) { + if (ACPI_SUCCESS (status)) { + status = acpi_ps_parse_loop (walk_state); + } + + if (status == AE_CTRL_TRANSFER) { + /* + * A method call was detected. + * Transfer control to the called control method + */ + + status = acpi_ds_call_control_method (&walk_list, walk_state, NULL); + + /* + * If the transfer to the new method method call worked, a new walk + * state was created -- get it + */ + + walk_state = acpi_ds_get_current_walk_state (&walk_list); + continue; + } + + else if (status == AE_CTRL_TERMINATE) { + status = AE_OK; + } + + /* We are done with this walk, move on to the parent if any */ + + + walk_state = acpi_ds_pop_walk_state (&walk_list); + + /* Extract return value before we delete Walk_state */ + + return_desc = walk_state->return_desc; + + /* Reset the current scope to the beginning of scope stack */ + + acpi_ds_scope_stack_clear (walk_state); + + /* + * If we just returned from the execution of a control method, + * there's lots of cleanup to do + */ + + if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { + acpi_ds_terminate_control_method (walk_state); + } + + /* Delete this walk state and all linked control states */ + + acpi_ps_cleanup_scope (walk_state->parser_state); + acpi_cm_free (walk_state->parser_state); + acpi_ds_delete_walk_state (walk_state); + + /* Check if we have restarted a preempted walk */ + + walk_state = acpi_ds_get_current_walk_state (&walk_list); + if (walk_state && + ACPI_SUCCESS (status)) + { + /* There is another walk state, restart it */ + + /* + * If the method returned value is not used by the parent, + * The object is deleted + */ + + acpi_ds_restart_control_method (walk_state, return_desc); + } + + /* + * Just completed a 1st-level method, save the final internal return + * value (if any) + */ + + else if (caller_return_desc) { + *caller_return_desc = return_desc; /* NULL if no return value */ + } + + else if (return_desc) { + /* Caller doesn't want it, must delete it */ + + acpi_cm_remove_reference (return_desc); + } + } + + + /* Normal exit */ + + acpi_gbl_current_walk_list = prev_walk_list; + return (status); cleanup: @@ -719,6 +1178,7 @@ acpi_ps_cleanup_scope (parser_state); acpi_cm_free (parser_state); + acpi_gbl_current_walk_list = prev_walk_list; return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psscope.c linux/drivers/acpi/parser/psscope.c --- v2.4.0-test8/linux/drivers/acpi/parser/psscope.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/parser/psscope.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines + * $Revision: 18 $ * *****************************************************************************/ @@ -24,10 +25,10 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #define _COMPONENT PARSER - MODULE_NAME ("psscope"); + MODULE_NAME ("psscope") /******************************************************************************* @@ -42,11 +43,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_parent_scope ( ACPI_PARSE_STATE *parser_state) { - return parser_state->scope->op; + return (parser_state->scope->parse_scope.op); } @@ -68,8 +69,8 @@ acpi_ps_has_completed_scope ( ACPI_PARSE_STATE *parser_state) { - return (u8) ((parser_state->aml >= parser_state->scope->arg_end || - !parser_state->scope->arg_count)); + return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || + !parser_state->scope->parse_scope.arg_count))); } @@ -78,7 +79,7 @@ * FUNCTION: Acpi_ps_init_scope * * PARAMETERS: Parser_state - Current parser state object - * Root - the root object of this new scope + * Root - the Root Node of this new scope * * RETURN: Status * @@ -89,24 +90,25 @@ ACPI_STATUS acpi_ps_init_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *root) + ACPI_PARSE_OBJECT *root_op) { - ACPI_PARSE_SCOPE *scope; + ACPI_GENERIC_STATE *scope; - scope = acpi_cm_callocate (sizeof (ACPI_PARSE_SCOPE)); + scope = acpi_cm_create_generic_state (); if (!scope) { - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } - scope->op = root; - scope->arg_count = ACPI_VAR_ARGS; - scope->arg_end = parser_state->aml_end; - scope->pkg_end = parser_state->aml_end; - parser_state->scope = scope; - parser_state->start_op = root; + scope->parse_scope.op = root_op; + scope->parse_scope.arg_count = ACPI_VAR_ARGS; + scope->parse_scope.arg_end = parser_state->aml_end; + scope->parse_scope.pkg_end = parser_state->aml_end; - return AE_OK; + parser_state->scope = scope; + parser_state->start_op = root_op; + + return (AE_OK); } @@ -128,49 +130,39 @@ ACPI_STATUS acpi_ps_push_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 remaining_args, u32 arg_count) { - ACPI_PARSE_SCOPE *scope = parser_state->scope_avail; - + ACPI_GENERIC_STATE *scope; - if (scope) { - /* grabbed scope from available list */ - parser_state->scope_avail = scope->parent; + scope = acpi_cm_create_generic_state (); + if (!scope) { + return (AE_NO_MEMORY); } - else { - /* allocate scope from the heap */ - scope = (ACPI_PARSE_SCOPE*) acpi_cm_allocate (sizeof (ACPI_PARSE_SCOPE)); - if (!scope) { - return (AE_NO_MEMORY); - } - } + scope->parse_scope.op = op; + scope->parse_scope.arg_list = remaining_args; + scope->parse_scope.arg_count = arg_count; + scope->parse_scope.pkg_end = parser_state->pkg_end; - /* Always zero out the scope before init */ + /* Push onto scope stack */ - MEMSET (scope, 0, sizeof (*scope)); + acpi_cm_push_generic_state (&parser_state->scope, scope); - scope->op = op; - scope->arg_list = remaining_args; - scope->arg_count = arg_count; - scope->pkg_end = parser_state->pkg_end; - scope->parent = parser_state->scope; - parser_state->scope = scope; if (arg_count == ACPI_VAR_ARGS) { /* multiple arguments */ - scope->arg_end = parser_state->pkg_end; + scope->parse_scope.arg_end = parser_state->pkg_end; } else { /* single argument */ - scope->arg_end = ACPI_MAX_AML; + scope->parse_scope.arg_end = ACPI_MAX_AML; } return (AE_OK); @@ -195,24 +187,28 @@ void acpi_ps_pop_scope ( ACPI_PARSE_STATE *parser_state, - ACPI_GENERIC_OP **op, + ACPI_PARSE_OBJECT **op, u32 *arg_list) { - ACPI_PARSE_SCOPE *scope = parser_state->scope; + ACPI_GENERIC_STATE *scope = parser_state->scope; + + + /* + * Only pop the scope if there is in fact a next scope + */ + if (scope->common.next) { + scope = acpi_cm_pop_generic_state (&parser_state->scope); - if (scope->parent) { /* return to parsing previous op */ - *op = scope->op; - *arg_list = scope->arg_list; - parser_state->pkg_end = scope->pkg_end; - parser_state->scope = scope->parent; + *op = scope->parse_scope.op; + *arg_list = scope->parse_scope.arg_list; + parser_state->pkg_end = scope->parse_scope.pkg_end; - /* add scope to available list */ + /* All done with this scope state structure */ - scope->parent = parser_state->scope_avail; - parser_state->scope_avail = scope; + acpi_cm_delete_generic_state (scope); } else { @@ -222,6 +218,7 @@ *arg_list = 0; } + return; } @@ -243,27 +240,19 @@ acpi_ps_cleanup_scope ( ACPI_PARSE_STATE *parser_state) { - ACPI_PARSE_SCOPE *scope; + ACPI_GENERIC_STATE *scope; if (!parser_state) { return; } - /* destroy available list */ - - while (parser_state->scope_avail) { - scope = parser_state->scope_avail; - parser_state->scope_avail = scope->parent; - acpi_cm_free (scope); - } - /* destroy scope stack */ + /* Delete anything on the scope stack */ while (parser_state->scope) { - scope = parser_state->scope; - parser_state->scope = scope->parent; - acpi_cm_free (scope); + scope = acpi_cm_pop_generic_state (&parser_state->scope); + acpi_cm_delete_generic_state (scope); } return; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/pstree.c linux/drivers/acpi/parser/pstree.c --- v2.4.0-test8/linux/drivers/acpi/parser/pstree.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/parser/pstree.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search + * $Revision: 23 $ * *****************************************************************************/ @@ -24,11 +25,11 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("pstree"); + MODULE_NAME ("pstree") /******************************************************************************* @@ -44,30 +45,30 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_arg ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 argn) { - ACPI_GENERIC_OP *arg = NULL; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *arg = NULL; + ACPI_OPCODE_INFO *op_info; /* Get the info structure for this opcode */ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { - /* Invalid opcode */ + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { + /* Invalid opcode or ASCII character */ - return NULL; + return (NULL); } /* Check if this opcode requires argument sub-objects */ - if (!(op_info->flags & OP_INFO_HAS_ARGS)) { + if (!(ACPI_GET_OP_ARGS (op_info))) { /* Has no linked argument objects */ - return NULL; + return (NULL); } /* Get the requested argument object */ @@ -78,7 +79,7 @@ arg = arg->next; } - return arg; + return (arg); } @@ -97,11 +98,11 @@ void acpi_ps_append_arg ( - ACPI_GENERIC_OP *op, - ACPI_GENERIC_OP *arg) + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_OBJECT *arg) { - ACPI_GENERIC_OP *prev_arg; - ACPI_OP_INFO *op_info; + ACPI_PARSE_OBJECT *prev_arg; + ACPI_OPCODE_INFO *op_info; if (!op) { @@ -111,7 +112,7 @@ /* Get the info structure for this opcode */ op_info = acpi_ps_get_opcode_info (op->opcode); - if (!op_info) { + if (ACPI_GET_OP_TYPE (op_info) != ACPI_OP_TYPE_OPCODE) { /* Invalid opcode */ return; @@ -119,7 +120,7 @@ /* Check if this opcode requires argument sub-objects */ - if (!(op_info->flags & OP_INFO_HAS_ARGS)) { + if (!(ACPI_GET_OP_ARGS (op_info))) { /* Has no linked argument objects */ return; @@ -166,11 +167,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_child ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { - ACPI_GENERIC_OP *child = NULL; + ACPI_PARSE_OBJECT *child = NULL; switch (op->opcode) @@ -211,7 +212,7 @@ } - return child; + return (child); } @@ -229,32 +230,32 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_get_depth_next ( - ACPI_GENERIC_OP *origin, - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *origin, + ACPI_PARSE_OBJECT *op) { - ACPI_GENERIC_OP *next = NULL; - ACPI_GENERIC_OP *parent; - ACPI_GENERIC_OP *arg; + ACPI_PARSE_OBJECT *next = NULL; + ACPI_PARSE_OBJECT *parent; + ACPI_PARSE_OBJECT *arg; if (!op) { - return NULL; + return (NULL); } /* look for an argument or child */ next = acpi_ps_get_arg (op, 0); if (next) { - return next; + return (next); } /* look for a sibling */ next = op->next; if (next) { - return next; + return (next); } /* look for a sibling of parent */ @@ -270,19 +271,19 @@ if (arg == origin) { /* reached parent of origin, end search */ - return NULL; + return (NULL); } if (parent->next) { /* found sibling of parent */ - return parent->next; + return (parent->next); } op = parent; parent = parent->parent; } - return next; + return (next); } @@ -300,10 +301,10 @@ * ******************************************************************************/ -ACPI_GENERIC_OP * +ACPI_PARSE_OBJECT * acpi_ps_fetch_prefix ( - ACPI_GENERIC_OP *scope, - char **path, + ACPI_PARSE_OBJECT *scope, + NATIVE_CHAR **path, u32 io) { u32 prefix = io ? GET8 (*path):**path; @@ -338,7 +339,7 @@ scope = acpi_ps_get_child (scope); } - return scope; + return (scope); } @@ -349,7 +350,7 @@ * PARAMETERS: Path - A string containing the name segment * io - Direction flag * - * RETURN: The 4-char ASCII ACPI Name as a u32 + * RETURN: The 4-s8 ASCII ACPI Name as a u32 * * DESCRIPTION: Fetch ACPI name segment (dot-delimited) * @@ -357,13 +358,13 @@ u32 acpi_ps_fetch_name ( - char **path, + NATIVE_CHAR **path, u32 io) { u32 name = 0; - char *nm; + NATIVE_CHAR *nm; u32 i; - char ch; + NATIVE_CHAR ch; if (io) { @@ -378,7 +379,7 @@ *path += 1; } - nm = (char*) &name; + nm = (NATIVE_CHAR *) &name; for (i = 0; i < 4; i++) { ch = **path; if (ch && ch != '.') { @@ -393,7 +394,7 @@ } } - return name; + return (name); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psutils.c linux/drivers/acpi/parser/psutils.c --- v2.4.0-test8/linux/drivers/acpi/parser/psutils.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/parser/psutils.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) + * $Revision: 29 $ * *****************************************************************************/ @@ -24,17 +25,18 @@ #include "acpi.h" -#include "parser.h" +#include "acparser.h" #include "amlcode.h" #define _COMPONENT PARSER - MODULE_NAME ("psutils"); + MODULE_NAME ("psutils") -#define PARSEOP_GENERIC 1 -#define PARSEOP_NAMED 2 -#define PARSEOP_DEFERRED 3 -#define PARSEOP_BYTELIST 4 +#define PARSEOP_GENERIC 0x01 +#define PARSEOP_NAMED 0x02 +#define PARSEOP_DEFERRED 0x03 +#define PARSEOP_BYTELIST 0x04 +#define PARSEOP_IN_CACHE 0x80 /******************************************************************************* @@ -53,21 +55,19 @@ void acpi_ps_init_op ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u16 opcode) { - ACPI_OP_INFO *aml_op; + ACPI_OPCODE_INFO *aml_op; op->data_type = ACPI_DESC_TYPE_PARSER; op->opcode = opcode; - aml_op = acpi_ps_get_opcode_info (opcode); - if (aml_op) { - DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name, - sizeof (op->op_name))); - } + + DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name, + sizeof (op->op_name))); } @@ -85,11 +85,11 @@ * ******************************************************************************/ -ACPI_GENERIC_OP* +ACPI_PARSE_OBJECT* acpi_ps_alloc_op ( u16 opcode) { - ACPI_GENERIC_OP *op = NULL; + ACPI_PARSE_OBJECT *op = NULL; u32 size; u8 flags; @@ -97,24 +97,27 @@ /* Allocate the minimum required size object */ if (acpi_ps_is_deferred_op (opcode)) { - size = sizeof (ACPI_DEFERRED_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_DEFERRED; } else if (acpi_ps_is_named_op (opcode)) { - size = sizeof (ACPI_NAMED_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_NAMED; } else if (acpi_ps_is_bytelist_op (opcode)) { - size = sizeof (ACPI_BYTELIST_OP); + size = sizeof (ACPI_PARSE2_OBJECT); flags = PARSEOP_BYTELIST; } else { - size = sizeof (ACPI_GENERIC_OP); + size = sizeof (ACPI_PARSE_OBJECT); flags = PARSEOP_GENERIC; + } + + if (size == sizeof (ACPI_PARSE_OBJECT)) { /* * The generic op is by far the most common (16 to 1), and therefore * the op cache is implemented with this type. @@ -133,13 +136,44 @@ op = acpi_gbl_parse_cache; acpi_gbl_parse_cache = op->next; + + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT)); + + } + acpi_cm_release_mutex (ACPI_MTX_CACHES); + } + + else { + /* + * The generic op is by far the most common (16 to 1), and therefore + * the op cache is implemented with this type. + * + * Check if there is an Op already available in the cache + */ + + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); + acpi_gbl_ext_parse_cache_requests++; + if (acpi_gbl_ext_parse_cache) { + /* Extract an op from the front of the cache list */ + + acpi_gbl_ext_parse_cache_depth--; + acpi_gbl_ext_parse_cache_hits++; + + op = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache; + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op->next; + + /* Clear the previously used Op */ - MEMSET (op, 0, sizeof (ACPI_GENERIC_OP)); + MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT)); + } acpi_cm_release_mutex (ACPI_MTX_CACHES); } + /* Allocate a new Op if necessary */ if (!op) { @@ -152,7 +186,7 @@ op->flags = flags; } - return op; + return (op); } @@ -171,16 +205,22 @@ void acpi_ps_free_op ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { + if (op->flags == PARSEOP_GENERIC) { /* Is the cache full? */ if (acpi_gbl_parse_cache_depth < MAX_PARSE_CACHE_DEPTH) { /* Put a GENERIC_OP back into the cache */ + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE_OBJECT)); + op->flags = PARSEOP_IN_CACHE; + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); acpi_gbl_parse_cache_depth++; @@ -192,6 +232,29 @@ } } + else { + /* Is the cache full? */ + + if (acpi_gbl_ext_parse_cache_depth < MAX_EXTPARSE_CACHE_DEPTH) { + /* Put a GENERIC_OP back into the cache */ + + /* Clear the previously used Op */ + + MEMSET (op, 0, sizeof (ACPI_PARSE2_OBJECT)); + op->flags = PARSEOP_IN_CACHE; + + acpi_cm_acquire_mutex (ACPI_MTX_CACHES); + acpi_gbl_ext_parse_cache_depth++; + + op->next = (ACPI_PARSE_OBJECT *) acpi_gbl_ext_parse_cache; + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) op; + + acpi_cm_release_mutex (ACPI_MTX_CACHES); + return; + } + } + + /* * Not a GENERIC OP, or the cache is full, just free the Op */ @@ -216,7 +279,7 @@ acpi_ps_delete_parse_cache ( void) { - ACPI_GENERIC_OP *next; + ACPI_PARSE_OBJECT *next; /* Traverse the global cache list */ @@ -227,6 +290,18 @@ next = acpi_gbl_parse_cache->next; acpi_cm_free (acpi_gbl_parse_cache); acpi_gbl_parse_cache = next; + acpi_gbl_parse_cache_depth--; + } + + /* Traverse the global cache list */ + + while (acpi_gbl_ext_parse_cache) { + /* Delete one cached state object */ + + next = acpi_gbl_ext_parse_cache->next; + acpi_cm_free (acpi_gbl_ext_parse_cache); + acpi_gbl_ext_parse_cache = (ACPI_PARSE2_OBJECT *) next; + acpi_gbl_ext_parse_cache_depth--; } return; @@ -253,7 +328,7 @@ u8 acpi_ps_is_leading_char ( - s32 c) + u32 c) { return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); } @@ -264,7 +339,7 @@ */ u8 acpi_ps_is_prefix_char ( - s32 c) + u32 c) { return ((u8) (c == '\\' || c == '^')); } @@ -329,7 +404,7 @@ * TBD: [Restructure] Need a better way than this brute force approach! */ u8 -acpi_ps_is_named_object_op ( +acpi_ps_is_node_op ( u16 opcode) { return ((u8) @@ -433,38 +508,16 @@ /* - * Cast an acpi_op to an acpi_deferred_op if possible - */ -ACPI_DEFERRED_OP * -acpi_ps_to_deferred_op ( - ACPI_GENERIC_OP *op) -{ - return (acpi_ps_is_deferred_op (op->opcode) - ? ( (ACPI_DEFERRED_OP *) op) : NULL); -} - - -/* - * Cast an acpi_op to an acpi_named_op if possible + * Cast an acpi_op to an acpi_extended_op if possible */ -ACPI_NAMED_OP* -acpi_ps_to_named_op ( - ACPI_GENERIC_OP *op) -{ - return (acpi_ps_is_named_op (op->opcode) - ? ( (ACPI_NAMED_OP *) op) : NULL); -} - -/* - * Cast an acpi_op to an acpi_bytelist_op if possible - */ -ACPI_BYTELIST_OP* -acpi_ps_to_bytelist_op ( - ACPI_GENERIC_OP *op) +/* TBD: This is very inefficient, fix */ +ACPI_PARSE2_OBJECT * +acpi_ps_to_extended_op ( + ACPI_PARSE_OBJECT *op) { - return (acpi_ps_is_bytelist_op (op->opcode) - ? ( (ACPI_BYTELIST_OP*) op) : NULL); + return ((acpi_ps_is_deferred_op (op->opcode) || acpi_ps_is_named_op (op->opcode) || acpi_ps_is_bytelist_op (op->opcode)) + ? ( (ACPI_PARSE2_OBJECT *) op) : NULL); } @@ -473,9 +526,9 @@ */ u32 acpi_ps_get_name ( - ACPI_GENERIC_OP *op) + ACPI_PARSE_OBJECT *op) { - ACPI_NAMED_OP *named = acpi_ps_to_named_op (op); + ACPI_PARSE2_OBJECT *named = acpi_ps_to_extended_op (op); return (named ? named->name : 0); } @@ -486,10 +539,10 @@ */ void acpi_ps_set_name ( - ACPI_GENERIC_OP *op, + ACPI_PARSE_OBJECT *op, u32 name) { - ACPI_NAMED_OP *named = acpi_ps_to_named_op (op); + ACPI_PARSE2_OBJECT *named = acpi_ps_to_extended_op (op); if (named) { named->name = name; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/pswalk.c linux/drivers/acpi/parser/pswalk.c --- v2.4.0-test8/linux/drivers/acpi/parser/pswalk.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/parser/pswalk.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) + * $Revision: 45 $ * *****************************************************************************/ @@ -25,13 +26,13 @@ #include "acpi.h" #include "amlcode.h" -#include "parser.h" -#include "dispatch.h" -#include "namesp.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT PARSER - MODULE_NAME ("pswalk"); + MODULE_NAME ("pswalk") /******************************************************************************* @@ -53,12 +54,12 @@ ACPI_STATUS acpi_ps_get_next_walk_op ( ACPI_WALK_STATE *walk_state, - ACPI_GENERIC_OP *op, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_OBJECT *op, + ACPI_PARSE_UPWARDS ascending_callback) { - ACPI_GENERIC_OP *next; - ACPI_GENERIC_OP *parent; - ACPI_GENERIC_OP *grand_parent; + ACPI_PARSE_OBJECT *next; + ACPI_PARSE_OBJECT *parent; + ACPI_PARSE_OBJECT *grand_parent; ACPI_STATUS status; @@ -146,6 +147,18 @@ default: /* + * If we are back to the starting point, the walk is complete. + */ + if (op == walk_state->origin) { + /* Reached the point of origin, the walk is complete */ + + walk_state->prev_op = op; + walk_state->next_op = NULL; + + return (status); + } + + /* * Check for a sibling to the current op. A sibling means * we are still going "downward" in the tree. */ @@ -166,7 +179,7 @@ * No sibling, but check status. * Abort on error from callback routine */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { /* Next op will be the parent */ walk_state->prev_op = op; @@ -302,7 +315,7 @@ * No sibling, check for an error from closing the parent * (Also, AE_PENDING if a method call was encountered) */ - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { walk_state->prev_op = parent; walk_state->next_op = grand_parent; walk_state->next_op_info = NEXT_OP_UPWARD; @@ -347,13 +360,13 @@ ACPI_STATUS acpi_ps_walk_loop ( ACPI_WALK_LIST *walk_list, - ACPI_GENERIC_OP *start_op, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_OBJECT *start_op, + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { ACPI_STATUS status = AE_OK; ACPI_WALK_STATE *walk_state; - ACPI_GENERIC_OP *op = start_op; + ACPI_PARSE_OBJECT *op = start_op; walk_state = acpi_ds_get_current_walk_state (walk_list); @@ -363,7 +376,7 @@ while (op) { if (walk_state->next_op_info != NEXT_OP_UPWARD) { - status = descending_callback (walk_state, op); + status = descending_callback (op->opcode, op, walk_state, NULL); } /* @@ -437,19 +450,19 @@ ACPI_STATUS acpi_ps_walk_parsed_aml ( - ACPI_GENERIC_OP *start_op, - ACPI_GENERIC_OP *end_op, - ACPI_OBJECT_INTERNAL *mth_desc, - ACPI_NAME_TABLE *start_scope, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **caller_return_desc, + ACPI_PARSE_OBJECT *start_op, + ACPI_PARSE_OBJECT *end_op, + ACPI_OPERAND_OBJECT *mth_desc, + ACPI_NAMESPACE_NODE *start_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **caller_return_desc, ACPI_OWNER_ID owner_id, - INTERPRETER_CALLBACK descending_callback, - INTERPRETER_CALLBACK ascending_callback) + ACPI_PARSE_DOWNWARDS descending_callback, + ACPI_PARSE_UPWARDS ascending_callback) { - ACPI_GENERIC_OP *op; + ACPI_PARSE_OBJECT *op; ACPI_WALK_STATE *walk_state; - ACPI_OBJECT_INTERNAL *return_desc; + ACPI_OPERAND_OBJECT *return_desc; ACPI_STATUS status; ACPI_WALK_LIST walk_list; ACPI_WALK_LIST *prev_walk_list; @@ -458,7 +471,7 @@ /* Parameter Validation */ if (!start_op || !end_op) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Initialize a new walk list */ @@ -475,10 +488,10 @@ prev_walk_list = acpi_gbl_current_walk_list; acpi_gbl_current_walk_list = &walk_list; - if (start_scope) { + if (start_node) { /* Push start scope on scope stack and make it current */ - status = acpi_ds_scope_stack_push (start_scope, ACPI_TYPE_METHOD, walk_state); + status = acpi_ds_scope_stack_push (start_node, ACPI_TYPE_METHOD, walk_state); if (ACPI_FAILURE (status)) { return (status); } @@ -489,7 +502,7 @@ /* Init arguments if this is a control method */ /* TBD: [Restructure] add walkstate as a param */ - acpi_ds_method_data_init_args (params, MTH_NUM_ARGS); + acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state); } op = start_op; @@ -502,7 +515,7 @@ */ while (walk_state) { - if (status == AE_OK) { + if (ACPI_SUCCESS (status)) { status = acpi_ps_walk_loop (&walk_list, op, descending_callback, ascending_callback); } @@ -526,9 +539,7 @@ * there's lots of cleanup to do */ - if (walk_state->method_desc && - walk_state->method_desc->method.parser_op) - { + if (walk_state->method_desc) { acpi_ds_terminate_control_method (walk_state); } @@ -540,7 +551,7 @@ walk_state = acpi_ds_get_current_walk_state (&walk_list); if (walk_state && - status == AE_OK) + ACPI_SUCCESS (status)) { /* There is another walk state, restart it */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/parser/psxface.c linux/drivers/acpi/parser/psxface.c --- v2.4.0-test8/linux/drivers/acpi/parser/psxface.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/parser/psxface.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: psxface - Parser external interfaces + * $Revision: 36 $ * *****************************************************************************/ @@ -25,18 +25,15 @@ #include "acpi.h" -#include "parser.h" -#include "dispatch.h" -#include "interp.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" #include "amlcode.h" -#include "namesp.h" +#include "acnamesp.h" #define _COMPONENT PARSER - MODULE_NAME ("psxface"); - - -char *acpi_gbl_parser_id = "Non-recursive AML Parser"; + MODULE_NAME ("psxface") /***************************************************************************** @@ -57,29 +54,30 @@ ACPI_STATUS acpi_psx_execute ( - ACPI_NAMED_OBJECT *method_entry, - ACPI_OBJECT_INTERNAL **params, - ACPI_OBJECT_INTERNAL **return_obj_desc) + ACPI_NAMESPACE_NODE *method_node, + ACPI_OPERAND_OBJECT **params, + ACPI_OPERAND_OBJECT **return_obj_desc) { ACPI_STATUS status; - ACPI_OBJECT_INTERNAL *obj_desc; + ACPI_OPERAND_OBJECT *obj_desc; u32 i; + ACPI_PARSE_OBJECT *op; - /* Validate the NTE and get the attached object */ + /* Validate the Node and get the attached object */ - if (!method_entry) { + if (!method_node) { return (AE_NULL_ENTRY); } - obj_desc = acpi_ns_get_attached_object (method_entry); + obj_desc = acpi_ns_get_attached_object (method_node); if (!obj_desc) { return (AE_NULL_OBJECT); } - /* Parse method if necessary, wait on concurrency semaphore */ + /* Init for new method, wait on concurrency semaphore */ - status = acpi_ds_begin_method_execution (method_entry, obj_desc); + status = acpi_ds_begin_method_execution (method_node, obj_desc); if (ACPI_FAILURE (status)) { return (status); } @@ -96,15 +94,40 @@ } /* - * Method is parsed and ready to execute - * The walk of the parse tree is where we actually execute the method + * Perform the first pass parse of the method to enter any + * named objects that it creates into the namespace */ - status = acpi_ps_walk_parsed_aml (obj_desc->method.parser_op, - obj_desc->method.parser_op, obj_desc, - method_entry->child_table, params, return_obj_desc, - obj_desc->method.owning_id, acpi_ds_exec_begin_op, - acpi_ds_exec_end_op); + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, + method_node, params, return_obj_desc, + acpi_ds_load1_begin_op, acpi_ds_load1_end_op); + acpi_ps_delete_parse_tree (op); + + /* Create and init a Root Node */ + + op = acpi_ps_alloc_op (AML_SCOPE_OP); + if (!op) { + return (AE_NO_MEMORY); + } + + /* + * The walk of the parse tree is where we actually execute the method + */ + status = acpi_ps_parse_aml (op, obj_desc->method.pcode, + obj_desc->method.pcode_length, + ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, + method_node, params, return_obj_desc, + acpi_ds_exec_begin_op, acpi_ds_exec_end_op); + acpi_ps_delete_parse_tree (op); if (params) { /* Take away the extra reference that we gave the parameters above */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/Makefile linux/drivers/acpi/resources/Makefile --- v2.4.0-test8/linux/drivers/acpi/resources/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/resources/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsaddr.c linux/drivers/acpi/resources/rsaddr.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsaddr.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsaddr.c Fri Sep 15 14:30:30 2000 @@ -4,6 +4,7 @@ * Acpi_rs_address16_stream * Acpi_rs_address32_resource * Acpi_rs_address32_stream + * $Revision: 9 $ * *****************************************************************************/ @@ -29,7 +30,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsaddr"); + MODULE_NAME ("rsaddr") /*************************************************************************** @@ -63,8 +64,8 @@ { u8 *buffer = byte_stream_buffer; RESOURCE *output_struct = (RESOURCE *) * output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; + u16 temp16; + u8 temp8; u32 index; u32 struct_size = sizeof(ADDRESS16_RESOURCE) + RESOURCE_LENGTH_NO_DATA; @@ -75,7 +76,7 @@ */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; @@ -91,7 +92,7 @@ /* Values 0-2 are valid */ if (temp8 > 2) { - return (AE_ERROR); + return (AE_AML_ERROR); } output_struct->data.address16.resource_type = temp8 & 0x03; @@ -235,6 +236,7 @@ */ temp8 = (u8) (index + 1); struct_size += ROUND_UP_TO_32_bITS (temp8); + output_struct->length = struct_size; } else { output_struct->data.address16.resource_source_index = 0x00; @@ -243,11 +245,6 @@ } /* - * Set the Length parameter - */ - output_struct->length = struct_size; - - /* * Return the final size of the structure */ *structure_size = struct_size; @@ -281,8 +278,8 @@ { u8 *buffer = *output_buffer; u8 *length_field; - u8 temp8 = 0; - u8 *temp_pointer = NULL; + u8 temp8; + NATIVE_CHAR *temp_pointer = NULL; u32 actual_bytes; @@ -389,7 +386,7 @@ *buffer = temp8; buffer += 1; - temp_pointer = buffer; + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string @@ -450,15 +447,21 @@ u8 **output_buffer, u32 *structure_size) { - u8 *buffer = byte_stream_buffer; - RESOURCE *output_struct = (RESOURCE *) * output_buffer; - u16 temp16 = 0; - u8 temp8 = 0; - u32 struct_size = sizeof (ADDRESS32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + u8 *buffer; + RESOURCE *output_struct; + u16 temp16; + u8 temp8; + u32 struct_size; u32 index; + buffer = byte_stream_buffer; + + output_struct = (RESOURCE *) *output_buffer; + + struct_size = sizeof (ADDRESS32_RESOURCE) + + RESOURCE_LENGTH_NO_DATA; + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -477,7 +480,7 @@ /* Values 0-2 are valid */ if(temp8 > 2) { - return (AE_ERROR); + return (AE_AML_ERROR); } output_struct->data.address32.resource_type = temp8 & 0x03; @@ -661,11 +664,13 @@ u8 **output_buffer, u32 *bytes_consumed) { - u8 *buffer = *output_buffer; + u8 *buffer; u16 *length_field; - u8 temp8 = 0; - u8 *temp_pointer = NULL; + u8 temp8; + NATIVE_CHAR *temp_pointer; + + buffer = *output_buffer; /* * The descriptor field is static @@ -779,7 +784,7 @@ buffer += 1; - temp_pointer = buffer; + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rscalc.c linux/drivers/acpi/resources/rscalc.c --- v2.4.0-test8/linux/drivers/acpi/resources/rscalc.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rscalc.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: rscalc - Acpi_rs_calculate_byte_stream_length * Acpi_rs_calculate_list_length + * $Revision: 9 $ * *****************************************************************************/ @@ -27,7 +28,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rscalc"); + MODULE_NAME ("rscalc") /*************************************************************************** @@ -51,9 +52,8 @@ RESOURCE *linked_list, u32 *size_needed) { - ACPI_STATUS status = AE_OK; u32 byte_stream_size_needed = 0; - u32 size_of_this_bit; + u32 segment_size; EXTENDED_IRQ_RESOURCE *ex_irq = NULL; u8 done = FALSE; @@ -64,7 +64,7 @@ * Init the variable that will hold the size to add to the * total. */ - size_of_this_bit = 0; + segment_size = 0; switch (linked_list->id) { @@ -76,7 +76,7 @@ * For an IRQ Resource, Byte 3, although optional, will * always be created - it holds IRQ information. */ - size_of_this_bit = 4; + segment_size = 4; break; case dma: @@ -86,7 +86,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 3; + segment_size = 3; break; case start_dependent_functions: @@ -97,7 +97,7 @@ * For a Start_dependent_functions Resource, Byte 1, * although optional, will always be created. */ - size_of_this_bit = 2; + segment_size = 2; break; case end_dependent_functions: @@ -107,7 +107,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 1; + segment_size = 1; break; case io: @@ -117,7 +117,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 8; + segment_size = 8; break; case fixed_io: @@ -127,7 +127,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 4; + segment_size = 4; break; case vendor_specific: @@ -141,12 +141,12 @@ * Resource data type. */ if(linked_list->data.vendor_specific.length > 7) { - size_of_this_bit = 3; + segment_size = 3; } else { - size_of_this_bit = 1; + segment_size = 1; } - size_of_this_bit += + segment_size += linked_list->data.vendor_specific.length; break; @@ -157,7 +157,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 2; + segment_size = 2; done = TRUE; break; @@ -168,7 +168,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 12; + segment_size = 12; break; case memory32: @@ -178,7 +178,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 20; + segment_size = 20; break; case fixed_memory32: @@ -188,7 +188,7 @@ /* * For this resource the size is static */ - size_of_this_bit = 12; + segment_size = 12; break; case address16: @@ -201,10 +201,10 @@ * the Index + the length of the null terminated * string Resource Source + 1 for the null. */ - size_of_this_bit = 16; + segment_size = 16; if(NULL != linked_list->data.address16.resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.address16.resource_source_string_length); } break; @@ -219,10 +219,10 @@ * length of the null terminated string Resource Source + * 1 for the null. */ - size_of_this_bit = 26; + segment_size = 26; if(NULL != linked_list->data.address16.resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.address16.resource_source_string_length); } break; @@ -239,14 +239,14 @@ * Index + the length of the null terminated string * Resource Source + 1 for the null. */ - size_of_this_bit = 9; + segment_size = 9; - size_of_this_bit += + segment_size += (linked_list->data.extended_irq.number_of_interrupts - 1) * 4; if(NULL != ex_irq->resource_source) { - size_of_this_bit += (1 + + segment_size += (1 + linked_list->data.extended_irq.resource_source_string_length); } break; @@ -256,7 +256,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch (Linked_list->Id) */ @@ -264,7 +264,7 @@ /* * Update the total */ - byte_stream_size_needed += size_of_this_bit; + byte_stream_size_needed += segment_size; /* * Point to the next object @@ -278,7 +278,7 @@ */ *size_needed = byte_stream_size_needed; - return (status); + return (AE_OK); } /* Acpi_rs_calculate_byte_stream_length */ @@ -309,16 +309,16 @@ { u32 buffer_size = 0; u32 bytes_parsed = 0; - u8 resource_type = 0; - u32 structure_size = 0; - u32 bytes_consumed = 0; - u8 *buffer; u8 number_of_interrupts = 0; + u8 number_of_channels = 0; + u8 resource_type; + u32 structure_size; + u32 bytes_consumed; + u8 *buffer; u8 temp8; u16 temp16; u8 index; - u8 number_of_channels = 0; - u8 additional_bytes = 0; + u8 additional_bytes; while (bytes_parsed < byte_stream_buffer_length) { @@ -532,7 +532,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } } @@ -723,7 +723,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch */ @@ -752,3 +752,116 @@ } /* Acpi_rs_calculate_list_length */ +/*************************************************************************** + * FUNCTION: Acpi_rs_calculate_pci_routing_table_length + * + * PARAMETERS: + * Package_object - Pointer to the package object + * Buffer_size_needed - u32 pointer of the size buffer + * needed to properly return the + * parsed data + * + * RETURN: Status AE_OK + * + * DESCRIPTION: Given a package representing a PCI routing table, this + * calculates the size of the corresponding linked list of + * descriptions. + * + ***************************************************************************/ + +ACPI_STATUS +acpi_rs_calculate_pci_routing_table_length ( + ACPI_OPERAND_OBJECT *package_object, + u32 *buffer_size_needed) +{ + u32 number_of_elements; + u32 temp_size_needed; + ACPI_OPERAND_OBJECT **top_object_list; + u32 index; + + number_of_elements = package_object->package.count; + + /* + * Calculate the size of the return buffer. + * The base size is the number of elements * the sizes of the + * structures. Additional space for the strings is added below. + * The minus one is to subtract the size of the u8 Source[1] + * member because it is added below. + * + * NOTE: The Number_of_elements is incremented by one to add an end + * table structure that is essentially a structure of zeros. + */ + temp_size_needed = (number_of_elements + 1) * + (sizeof (PCI_ROUTING_TABLE) - 1); + + /* + * But each PRT_ENTRY structure has a pointer to a string and + * the size of that string must be found. + */ + top_object_list = package_object->package.elements; + + for (index = 0; index < number_of_elements; index++) { + ACPI_OPERAND_OBJECT *package_element; + ACPI_OPERAND_OBJECT **sub_object_list; + u8 name_found; + u32 table_index; + + /* + * Dereference the sub-package + */ + package_element = *top_object_list; + + /* + * The Sub_object_list will now point to an array of the + * four IRQ elements: Address, Pin, Source and Source_index + */ + sub_object_list = package_element->package.elements; + + /* + * Scan the Irq_table_elements for the Source Name String + */ + name_found = FALSE; + + for (table_index = 0; table_index < 4 && !name_found; table_index++) { + if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { + name_found = TRUE; + } + + else { + /* + * Look at the next element + */ + sub_object_list++; + } + } + + /* + * Was a String type found? + */ + if (TRUE == name_found) { + /* + * The length String.Length field includes the + * terminating NULL + */ + temp_size_needed += (*sub_object_list)->string.length; + temp_size_needed = ROUND_UP_TO_32_bITS (temp_size_needed); + } + + else { + /* + * If no name was found, then this is a NULL, which is + * translated as a u32 zero. + */ + temp_size_needed += sizeof(u32); + } + + /* + * Point to the next ACPI_OPERAND_OBJECT + */ + top_object_list++; + } + + *buffer_size_needed = temp_size_needed; + + return (AE_OK); +} \ No newline at end of file diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rscreate.c linux/drivers/acpi/resources/rscreate.c --- v2.4.0-test8/linux/drivers/acpi/resources/rscreate.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rscreate.c Fri Sep 15 14:30:30 2000 @@ -3,6 +3,7 @@ * Module Name: rscreate - Acpi_rs_create_resource_list * Acpi_rs_create_pci_routing_table * Acpi_rs_create_byte_stream + * $Revision: 16 $ * *****************************************************************************/ @@ -26,13 +27,14 @@ #include "acpi.h" -#include "resource.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rscreate"); + MODULE_NAME ("rscreate") -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_resource_list * * PARAMETERS: @@ -40,53 +42,40 @@ * Output_buffer - Pointer to the user's buffer * Output_buffer_length - Pointer to the size of Output_buffer * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code - * If Output_buffer is not large enough, Output_buffer_length - * indicates how large Output_buffer should be, else it - * indicates how may u8 elements of Output_buffer are - * valid. + * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code + * If Output_buffer is not large enough, Output_buffer_length + * indicates how large Output_buffer should be, else it + * indicates how may u8 elements of Output_buffer are valid. * * DESCRIPTION: Takes the byte stream returned from a _CRS, _PRS control method - * execution and parses the stream to create a linked list - * of device resources. + * execution and parses the stream to create a linked list + * of device resources. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_resource_list ( - ACPI_OBJECT_INTERNAL *byte_stream_buffer, + ACPI_OPERAND_OBJECT *byte_stream_buffer, u8 *output_buffer, u32 *output_buffer_length) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u8 *byte_stream_start = NULL; u32 list_size_needed = 0; u32 byte_stream_buffer_length = 0; /* - * Validate parameters: - * - * 1. If Byte_stream_buffer is NULL after we know that - * Byte_steam_length is not zero, or - * 2. If Output_buffer is NULL and Output_buffer_length - * is not zero - * - * Return an error + * Params already validated, so we don't re-validate here */ - if (!byte_stream_buffer || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } byte_stream_buffer_length = byte_stream_buffer->buffer.length; byte_stream_start = byte_stream_buffer->buffer.pointer; /* * Pass the Byte_stream_buffer into a module that can calculate - * the buffer size needed for the linked list + * the buffer size needed for the linked list */ status = acpi_rs_calculate_list_length (byte_stream_start, byte_stream_buffer_length, @@ -95,13 +84,13 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* * If the linked list will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (list_size_needed <= *output_buffer_length) { @@ -117,7 +106,7 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } @@ -134,138 +123,53 @@ } -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_pci_routing_table * * PARAMETERS: - * Package_object - Pointer to an ACPI_OBJECT_INTERNAL + * Package_object - Pointer to an ACPI_OPERAND_OBJECT * package * Output_buffer - Pointer to the user's buffer * Output_buffer_length - Size of Output_buffer * * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. * If the Output_buffer is too small, the error will be - * AE_BUFFER_OVERFLOW and Output_buffer_length will point - * to the size buffer needed. + * AE_BUFFER_OVERFLOW and Output_buffer_length will point + * to the size buffer needed. * - * DESCRIPTION: Takes the ACPI_OBJECT_INTERNAL package and creates a - * linked list of PCI interrupt descriptions + * DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a + * linked list of PCI interrupt descriptions * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_pci_routing_table ( - ACPI_OBJECT_INTERNAL *package_object, + ACPI_OPERAND_OBJECT *package_object, u8 *output_buffer, u32 *output_buffer_length) { u8 *buffer = output_buffer; - ACPI_OBJECT_INTERNAL **top_object_list = NULL; - ACPI_OBJECT_INTERNAL **sub_object_list = NULL; - ACPI_OBJECT_INTERNAL *package_element = NULL; + ACPI_OPERAND_OBJECT **top_object_list = NULL; + ACPI_OPERAND_OBJECT **sub_object_list = NULL; + ACPI_OPERAND_OBJECT *package_element = NULL; u32 buffer_size_needed = 0; u32 number_of_elements = 0; u32 index = 0; - u8 table_index = 0; - u8 name_found = FALSE; PCI_ROUTING_TABLE *user_prt = NULL; + ACPI_STATUS status; /* - * Validate parameters: - * - * 1. If Method_return_object is NULL, or - * 2. If Output_buffer is NULL and Output_buffer_length is not zero - * - * Return an error + * Params already validated, so we don't re-validate here */ - if (!package_object || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } - /* - * Calculate the buffer size needed for the routing table. - */ - number_of_elements = package_object->package.count; - - /* - * Properly calculate the size of the return buffer. - * The base size is the number of elements * the sizes of the - * structures. Additional space for the strings is added below. - * The minus one is to subtract the size of the u8 Source[1] - * member because it is added below. - * NOTE: The Number_of_elements is incremented by one to add an end - * table structure that is essentially a structure of zeros. - */ - buffer_size_needed = (number_of_elements + 1) * - (sizeof (PCI_ROUTING_TABLE) - 1); - - /* - * But each PRT_ENTRY structure has a pointer to a string and - * the size of that string must be found. - */ - top_object_list = package_object->package.elements; - - for (index = 0; index < number_of_elements; index++) { - /* - * Dereference the sub-package - */ - package_element = *top_object_list; - - /* - * The Sub_object_list will now point to an array of the - * four IRQ elements: Address, Pin, Source and Source_index - */ - sub_object_list = package_element->package.elements; - - /* - * Scan the Irq_table_elements for the Source Name String - */ - name_found = FALSE; - - for (table_index = 0; table_index < 4 && !name_found; table_index++) { - if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { - name_found = TRUE; - } - - else { - /* - * Look at the next element - */ - sub_object_list++; - } - } - - /* - * Was a String type found? - */ - if (TRUE == name_found) { - /* - * The length String.Length field includes the - * terminating NULL - */ - buffer_size_needed += ((*sub_object_list)->string.length); - } - - else { - /* - * If no name was found, then this is a NULL, which is - * translated as a u32 zero. - */ - buffer_size_needed += sizeof(u32); - } - - /* - * Point to the next ACPI_OBJECT_INTERNAL - */ - top_object_list++; - } + status = acpi_rs_calculate_pci_routing_table_length(package_object, + &buffer_size_needed); /* * If the data will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (buffer_size_needed <= *output_buffer_length) { /* @@ -275,34 +179,32 @@ /* * Loop through the ACPI_INTERNAL_OBJECTS - Each object should - * contain a u32 Address, a u8 Pin, a Name and a u8 - * Source_index. + * contain a u32 Address, a u8 Pin, a Name and a u8 + * Source_index. */ top_object_list = package_object->package.elements; number_of_elements = package_object->package.count; - user_prt = (PCI_ROUTING_TABLE *)buffer; + user_prt = (PCI_ROUTING_TABLE *) buffer; for (index = 0; index < number_of_elements; index++) { /* * Point User_prt past this current structure * * NOTE: On the first iteration, User_prt->Length will - * be zero because we zero'ed out the return buffer - * earlier + * be zero because we cleared the return buffer earlier */ buffer += user_prt->length; - - user_prt = (PCI_ROUTING_TABLE *)buffer; + user_prt = (PCI_ROUTING_TABLE *) buffer; /* * Fill in the Length field with the information we - * have at this point. - * The minus one is to subtract the size of the - * u8 Source[1] member because it is added below. + * have at this point. + * The minus one is to subtract the size of the + * u8 Source[1] member because it is added below. */ - user_prt->length = (sizeof(PCI_ROUTING_TABLE) - 1); + user_prt->length = (sizeof (PCI_ROUTING_TABLE) - 1); /* * Dereference the sub-package @@ -311,8 +213,8 @@ /* * The Sub_object_list will now point to an array of - * the four IRQ elements: Address, Pin, Source and - * Source_index + * the four IRQ elements: Address, Pin, Source and + * Source_index */ sub_object_list = package_element->package.elements; @@ -348,27 +250,29 @@ sub_object_list++; if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) { - STRCPY(user_prt->data.source, + STRCPY (user_prt->data.source, (*sub_object_list)->string.pointer); /* * Add to the Length field the length of the string */ user_prt->length += (*sub_object_list)->string.length; + user_prt->length = + ROUND_UP_TO_32_bITS (user_prt->length); } else { /* * If this is a number, then the Source Name - * is NULL, since the entire buffer was zeroed - * out, we can leave this alone. + * is NULL, since the entire buffer was zeroed + * out, we can leave this alone. */ if (ACPI_TYPE_NUMBER == (*sub_object_list)->common.type) { /* * Add to the Length field the length of - * the u32 NULL + * the u32 NULL */ - user_prt->length += sizeof(u32); + user_prt->length += sizeof (u32); } else { @@ -391,7 +295,7 @@ } /* - * Point to the next ACPI_OBJECT_INTERNAL + * Point to the next ACPI_OPERAND_OBJECT */ top_object_list++; } @@ -414,7 +318,8 @@ } -/*************************************************************************** +/******************************************************************************* + * * FUNCTION: Acpi_rs_create_byte_stream * * PARAMETERS: @@ -431,7 +336,7 @@ * creates a bytestream to be used as input for the * _SRS control method. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS acpi_rs_create_byte_stream ( @@ -439,27 +344,15 @@ u8 *output_buffer, u32 *output_buffer_length) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u32 byte_stream_size_needed = 0; /* - * Validate parameters: + * Params already validated, so we don't re-validate here * - * 1. If Linked_list_buffer is NULL, or - * 2. If Output_buffer is NULL and Output_buffer_length is not zero - * - * Return an error - */ - if (!linked_list_buffer || - (!output_buffer && 0 != *output_buffer_length)) - { - return (AE_BAD_PARAMETER); - } - - /* * Pass the Linked_list_buffer into a module that can calculate - * the buffer size needed for the byte stream. + * the buffer size needed for the byte stream. */ status = acpi_rs_calculate_byte_stream_length (linked_list_buffer, &byte_stream_size_needed); @@ -467,13 +360,13 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } /* * If the linked list will fit into the available buffer - * call to fill in the list + * call to fill in the list */ if (byte_stream_size_needed <= *output_buffer_length) { @@ -489,7 +382,7 @@ /* * Exit with the error passed back */ - if (AE_OK != status) { + if (ACPI_FAILURE (status)) { return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsdump.c linux/drivers/acpi/resources/rsdump.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsdump.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsdump.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsdump - Functions do dump out the resource structures. + * $Revision: 10 $ * *****************************************************************************/ @@ -26,7 +27,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsdump"); + MODULE_NAME ("rsdump") /****************************************************************************** @@ -120,7 +121,7 @@ break; } - acpi_os_printf ("\t\t%s_bus Master\n", + acpi_os_printf ("\t\t%sBus Master\n", BUS_MASTER == dma_data->bus_master ? "" : "Not a "); @@ -802,7 +803,7 @@ acpi_rs_dump_resource_list ( RESOURCE *resource) { - s8 count = 0; + u8 count = 0; u8 done = FALSE; @@ -902,7 +903,7 @@ u8 *route_table) { u8 *buffer = route_table; - s8 count = 0; + u8 count = 0; u8 done = FALSE; PCI_ROUTING_TABLE *prt_element; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsio.c linux/drivers/acpi/resources/rsio.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsio.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsio.c Fri Sep 15 14:30:30 2000 @@ -6,6 +6,7 @@ * Acpi_rs_fixed_io_stream * Acpi_rs_dma_resource * Acpi_rs_dma_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -31,7 +32,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsio"); + MODULE_NAME ("rsio") /*************************************************************************** @@ -90,7 +91,7 @@ * Check Min_base Address */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.io.min_base_address = temp16; @@ -98,7 +99,7 @@ * Check Max_base Address */ buffer += 2; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.io.max_base_address = temp16; @@ -255,7 +256,7 @@ */ temp16 = (u16) linked_list->data.io.min_base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -264,7 +265,7 @@ */ temp16 = (u16) linked_list->data.io.max_base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -336,7 +337,7 @@ */ temp16 = (u16) linked_list->data.fixed_io.base_address; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsirq.c linux/drivers/acpi/resources/rsirq.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsirq.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsirq.c Fri Sep 15 14:30:30 2000 @@ -4,6 +4,7 @@ * Acpi_rs_irq_stream * Acpi_rs_extended_irq_resource * Acpi_rs_extended_irq_stream + * $Revision: 8 $ * *****************************************************************************/ @@ -29,7 +30,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsirq"); + MODULE_NAME ("rsirq") /*************************************************************************** @@ -85,7 +86,7 @@ * Point to the 16-bits of Bytes 1 and 2 */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.irq.number_of_interrupts = 0; @@ -226,7 +227,7 @@ temp16 |= 0x1 << temp8; } - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -306,7 +307,7 @@ * Point past the Descriptor to get the number of bytes consumed */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); *bytes_consumed = temp16 + 3; output_struct->id = extended_irq; @@ -476,7 +477,7 @@ u16 *length_field; u8 temp8 = 0; u8 index; - u8 *temp_pointer = NULL; + NATIVE_CHAR *temp_pointer = NULL; /* @@ -533,11 +534,10 @@ * Resource Source Index and Resource Source are optional */ if (0 != linked_list->data.extended_irq.resource_source_string_length) { - temp8 = (u8) linked_list->data.extended_irq.resource_source_index; - - *buffer = temp8; + *buffer = (u8) linked_list->data.extended_irq.resource_source_index; buffer += 1; - temp_pointer = buffer; + + temp_pointer = (NATIVE_CHAR *) buffer; /* * Copy the string diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rslist.c linux/drivers/acpi/resources/rslist.c --- v2.4.0-test8/linux/drivers/acpi/resources/rslist.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rslist.c Fri Sep 15 14:30:30 2000 @@ -2,6 +2,7 @@ * * Module Name: rslist - Acpi_rs_byte_stream_to_list * Acpi_list_to_byte_stream + * $Revision: 6 $ * *****************************************************************************/ @@ -25,10 +26,10 @@ #include "acpi.h" -#include "resource.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rslist"); + MODULE_NAME ("rslist") /*************************************************************************** @@ -53,7 +54,7 @@ u32 byte_stream_buffer_length, u8 **output_buffer) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u32 bytes_parsed = 0; u8 resource_type = 0; u32 bytes_consumed = 0; @@ -167,7 +168,7 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } } @@ -275,11 +276,11 @@ * If we get here, everything is out of sync, * so exit with an error */ - return (AE_ERROR); + return (AE_AML_ERROR); break; } /* switch */ - } /* if(Resource_type & 0x80) */ + } /* end else */ /* * Update the return value and counter @@ -296,14 +297,15 @@ */ *buffer += structure_size; - } /* while (Bytes_parsed < Byte_stream_buffer_length && - FALSE == End_tag_processed) */ + } /* end while */ /* * Check the reason for exiting the while loop */ - if (byte_stream_buffer_length != bytes_parsed || TRUE != end_tag_processed) { - return (AE_ERROR); + if (!(byte_stream_buffer_length == bytes_parsed) || + (TRUE != end_tag_processed)) + { + return (AE_AML_ERROR); } return (AE_OK); @@ -338,7 +340,7 @@ u32 byte_stream_size_needed, u8 **output_buffer) { - ACPI_STATUS status = AE_UNKNOWN_STATUS; + ACPI_STATUS status; u8 *buffer = *output_buffer; u32 bytes_consumed = 0; u8 done = FALSE; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsmemory.c linux/drivers/acpi/resources/rsmemory.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsmemory.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsmemory.c Fri Sep 15 14:30:30 2000 @@ -6,6 +6,7 @@ * Acpi_rs_fixed_memory32_resource * Acpi_rs_memory32_range_stream * Acpi_rs_fixed_memory32_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -31,7 +32,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsmemory"); + MODULE_NAME ("rsmemory") /*************************************************************************** @@ -76,7 +77,7 @@ */ buffer += 1; - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -96,7 +97,7 @@ /* * Get Min_base_address (Bytes 4-5) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -105,7 +106,7 @@ /* * Get Max_base_address (Bytes 6-7) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -114,7 +115,7 @@ /* * Get Alignment (Bytes 8-9) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; @@ -123,7 +124,7 @@ /* * Get Range_length (Bytes 10-11) */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); output_struct->data.memory24.range_length = temp16; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsmisc.c linux/drivers/acpi/resources/rsmisc.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsmisc.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsmisc.c Fri Sep 15 14:30:30 2000 @@ -8,6 +8,7 @@ * Acpi_rs_end_dependent_functions_resource * Acpi_rs_start_dependent_functions_stream * Acpi_rs_end_dependent_functions_stream + * $Revision: 7 $ * *****************************************************************************/ @@ -33,7 +34,7 @@ #include "acpi.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsmisc"); + MODULE_NAME ("rsmisc") /*************************************************************************** @@ -199,7 +200,7 @@ /* Dereference */ - temp16 = *(u16 *)buffer; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); /* Calculate bytes consumed */ @@ -304,7 +305,7 @@ temp16 = (u16) linked_list->data.vendor_specific.length; - *(u16 *)buffer = temp16; + MOVE_UNALIGNED16_TO_16 (&temp16, buffer); buffer += 2; } @@ -404,7 +405,7 @@ temp8 & 0x03; if (3 == output_struct->data.start_dependent_functions.compatibility_priority) { - return (AE_ERROR); + return (AE_AML_ERROR); } /* @@ -414,7 +415,7 @@ (temp8 >> 2) & 0x03; if (3 == output_struct->data.start_dependent_functions.performance_robustness) { - return (AE_ERROR); + return (AE_AML_ERROR); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsutils.c linux/drivers/acpi/resources/rsutils.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsutils.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsutils.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsutils - Utilities for the resource manager + * $Revision: 10 $ * *****************************************************************************/ @@ -24,19 +25,19 @@ #include "acpi.h" -#include "namesp.h" -#include "resource.h" +#include "acnamesp.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsutils"); + MODULE_NAME ("rsutils") /****************************************************************************** * * FUNCTION: Acpi_rs_get_prt_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -55,28 +56,20 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; - u32 buffer_space_needed = ret_buffer->length; + u32 buffer_space_needed; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ + + buffer_space_needed = ret_buffer->length; /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -128,7 +121,7 @@ * * FUNCTION: Acpi_rs_get_crs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -147,28 +140,18 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; u32 buffer_space_needed = ret_buffer->length; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -198,9 +181,7 @@ ret_buffer->pointer, &buffer_space_needed); - if (AE_OK == status) { - acpi_rs_dump_resource_list((RESOURCE *)ret_buffer->pointer); - } + /* * Tell the user how much of the buffer we have used or is needed @@ -223,7 +204,7 @@ * * FUNCTION: Acpi_rs_get_prs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object + * PARAMETERS: Handle - a handle to the containing object * Ret_buffer - a pointer to a buffer structure for the * results * @@ -242,28 +223,18 @@ ACPI_HANDLE handle, ACPI_BUFFER *ret_buffer) { - ACPI_OBJECT_INTERNAL *ret_obj; + ACPI_OPERAND_OBJECT *ret_obj; ACPI_STATUS status; u32 buffer_space_needed = ret_buffer->length; - /* - * Must have a valid handle and buffer, So we have to have a handle - * a return buffer structure and if there is a non-zero buffer length - * we also need a valid pointer in the buffer - */ - if ((!handle) || - (!ret_buffer) || - ((!ret_buffer->pointer) && (ret_buffer->length))) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * Execute the method, no parameters */ status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -314,9 +285,7 @@ * * FUNCTION: Acpi_rs_set_srs_method_data * - * PARAMETERS: Device_handle - a handle to the containing object - * *Method_name - Name of method to execute, If NULL, the - * handle is the object to execute + * PARAMETERS: Handle - a handle to the containing object * In_buffer - a pointer to a buffer structure of the * parameter * @@ -335,22 +304,13 @@ ACPI_HANDLE handle, ACPI_BUFFER *in_buffer) { - ACPI_OBJECT_INTERNAL *params[2]; - ACPI_OBJECT_INTERNAL param_obj; + ACPI_OPERAND_OBJECT *params[2]; + ACPI_OPERAND_OBJECT param_obj; ACPI_STATUS status; u8 *byte_stream = NULL; u32 buffer_size_needed = 0; - /* - * Must have a valid handle and buffer - */ - if ((!handle) || - (!in_buffer) || - (!in_buffer->pointer) || - (!in_buffer->length)) - { - return (AE_BAD_PARAMETER); - } + /* already validated params, so we won't repeat here */ /* * The In_buffer parameter will point to a linked list of @@ -390,12 +350,8 @@ byte_stream, &buffer_size_needed); - if(AE_OK != status) { - /* - * Failed the call - */ - acpi_cm_free (byte_stream); - return (status); + if (ACPI_FAILURE (status)) { + goto cleanup; } /* @@ -424,6 +380,9 @@ /* * Clean up and return the status from Acpi_ns_evaluate_relative */ + +cleanup: + acpi_cm_free (byte_stream); return (status); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/resources/rsxface.c linux/drivers/acpi/resources/rsxface.c --- v2.4.0-test8/linux/drivers/acpi/resources/rsxface.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/resources/rsxface.c Fri Sep 15 14:30:30 2000 @@ -1,6 +1,7 @@ /****************************************************************************** * * Module Name: rsxface - Public interfaces to the ACPI subsystem + * $Revision: 7 $ * *****************************************************************************/ @@ -24,12 +25,12 @@ #include "acpi.h" -#include "interp.h" -#include "namesp.h" -#include "resource.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acresrc.h" #define _COMPONENT RESOURCE_MANAGER - MODULE_NAME ("rsxface"); + MODULE_NAME ("rsxface") /****************************************************************************** @@ -37,19 +38,18 @@ * FUNCTION: Acpi_get_irq_routing_table * * PARAMETERS: Device_handle - a handle to the Bus device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * current resources for the device - * Buffer_length - the number of bytes available in the buffer * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get the IRQ routing table for a * specific bus. The caller must first acquire a handle for the * desired bus. The routine table is placed in the buffer pointed - * to by the Out_buffer variable parameter. + * to by the Ret_buffer variable parameter. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * * This function attempts to execute the _PRT method contained in * the object indicated by the passed Device_handle. @@ -64,6 +64,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((!ret_buffer->pointer) && (ret_buffer->length))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); return (status); @@ -76,19 +89,18 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * current resources for the device - * Buffer_length - the number of bytes available in the buffer * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get the current resources for a * specific device. The caller must first acquire a handle for * the desired device. The resource data is placed in the buffer - * pointed to by the Out_buffer variable parameter. + * pointed to by the Ret_buffer variable parameter. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * * This function attempts to execute the _CRS method contained in * the object indicated by the passed Device_handle. @@ -103,6 +115,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((ret_buffer->length) && (!ret_buffer->pointer))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); return (status); @@ -115,19 +140,18 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are querying - * Out_buffer - a pointer to a buffer to receive the + * Ret_buffer - a pointer to a buffer to receive the * resources for the device - * Buffer_length - the number of bytes available in the buffer - * + * * RETURN: Status - the status of the call * * DESCRIPTION: This function is called to get a list of the possible resources * for a specific device. The caller must first acquire a handle * for the desired device. The resource data is placed in the - * buffer pointed to by the Out_buffer variable. + * buffer pointed to by the Ret_buffer variable. * * If the function fails an appropriate status will be returned - * and the value of Out_buffer is undefined. + * and the value of Ret_buffer is undefined. * ******************************************************************************/ @@ -139,6 +163,19 @@ ACPI_STATUS status; + /* + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. + */ + if ((!device_handle) || + (!ret_buffer) || + ((ret_buffer->length) && (!ret_buffer->pointer))) + { + return (AE_BAD_PARAMETER); + } + status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); return (status); @@ -151,7 +188,7 @@ * * PARAMETERS: Device_handle - a handle to the device object for the * device we are changing the resources of - * Out_buffer - a pointer to a buffer containing the + * In_buffer - a pointer to a buffer containing the * resources to be set for the device * * RETURN: Status - the status of the call @@ -170,6 +207,17 @@ { ACPI_STATUS status; + + /* + * Must have a valid handle and buffer + */ + if ((!device_handle) || + (!in_buffer) || + (!in_buffer->pointer) || + (!in_buffer->length)) + { + return (AE_BAD_PARAMETER); + } status = acpi_rs_set_srs_method_data (device_handle, in_buffer); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/sys.c linux/drivers/acpi/sys.c --- v2.4.0-test8/linux/drivers/acpi/sys.c Thu Jul 13 09:39:49 2000 +++ linux/drivers/acpi/sys.c Fri Sep 15 14:30:30 2000 @@ -24,6 +24,9 @@ #include "acpi.h" #include "driver.h" +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("sys") + #define ACPI_SLP_TYP(typa, typb) (((int)(typa) << 8) | (int)(typb)) #define ACPI_SLP_TYPA(value) \ ((((value) >> 8) << ACPI_SLP_TYP_SHIFT) & ACPI_SLP_TYP_MASK) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/table.c linux/drivers/acpi/table.c --- v2.4.0-test8/linux/drivers/acpi/table.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/table.c Fri Sep 15 14:30:30 2000 @@ -0,0 +1,306 @@ +/* + * tables.c - ACPI tables, chipset, and errata handling + * + * Copyright (C) 2000 Andrew Henroid + * + * 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 + */ + +#include +#include +#include +#include +#include +#include "acpi.h" +#include "driver.h" + +#define _COMPONENT OS_DEPENDENT + MODULE_NAME ("tables") + +struct acpi_facp acpi_facp; + +#define ACPI_DUMMY_CHECKSUM 9 +#define ACPI_DUMMY_PBLK 51 + +static u8 acpi_dummy_dsdt[] = +{ + 0x44, 0x53, 0x44, 0x54, // "DSDT" + 0x38, 0x00, 0x00, 0x00, // length + 0x01, // revision + 0x00, // checksum + 0x4c, 0x49, 0x4e, 0x55, 0x58, 0x00, // "LINUX" + 0x44, 0x55, 0x4d, 0x4d, 0x59, 0x00, 0x00, 0x00, // "DUMMY" + 0x01, 0x00, 0x00, 0x00, // OEM rev + 0x4c, 0x4e, 0x55, 0x58, // "LNUX" + 0x01, 0x00, 0x00, 0x00, // creator rev + 0x10, // Scope + 0x13, // PkgLength + 0x5c, 0x5f, 0x50, 0x52, 0x5f, // \_PR_ + 0x5b, 0x83, // Processor + 0x0b, // PkgLength + 0x43, 0x50, 0x55, 0x30, // CPU0 + 0x00, // ID + 0x00, 0x00, 0x00, 0x00, // PBLK + 0x06 // PBLK size +}; + +/* + * Calculate and set ACPI table checksum + */ +static void +acpi_set_checksum(u8 *table, int size) +{ + int i, sum = 0; + for (i = 0; i < size; i++) + sum += (int) table[i]; + sum = (0x100 - ((sum - table[ACPI_DUMMY_CHECKSUM]) & 0xff)); + table[ACPI_DUMMY_CHECKSUM] = sum; +} + +/* + * Init PIIX4 device, create a fake FACP + */ +static int +acpi_init_piix4(struct pci_dev *dev) +{ + u32 base, pblk; + u16 cmd; + u8 pmregmisc; + + pci_read_config_word(dev, PCI_COMMAND, &cmd); + if (!(cmd & PCI_COMMAND_IO)) + return -ENODEV; + + pci_read_config_byte(dev, ACPI_PIIX4_PMREGMISC, &pmregmisc); + if (!(pmregmisc & ACPI_PIIX4_PMIOSE)) + return -ENODEV; + + base = pci_resource_start (dev, PCI_BRIDGE_RESOURCES); + if (!base) + return -ENODEV; + + printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base); + + memset(&acpi_facp, 0, sizeof(acpi_facp)); + acpi_facp.hdr.signature = ACPI_FACP_SIG; + acpi_facp.hdr.length = sizeof(acpi_facp); + acpi_facp.int_model = ACPI_PIIX4_INT_MODEL; + acpi_facp.sci_int = ACPI_PIIX4_SCI_INT; + acpi_facp.smi_cmd = ACPI_PIIX4_SMI_CMD; + acpi_facp.acpi_enable = ACPI_PIIX4_ACPI_ENABLE; + acpi_facp.acpi_disable = ACPI_PIIX4_ACPI_DISABLE; + acpi_facp.s4bios_req = ACPI_PIIX4_S4BIOS_REQ; + acpi_facp.pm1a_evt = base + ACPI_PIIX4_PM1_EVT; + acpi_facp.pm1a_cnt = base + ACPI_PIIX4_PM1_CNT; + acpi_facp.pm2_cnt = ACPI_PIIX4_PM2_CNT; + acpi_facp.pm_tmr = base + ACPI_PIIX4_PM_TMR; + acpi_facp.gpe0 = base + ACPI_PIIX4_GPE0; + acpi_facp.pm1_evt_len = ACPI_PIIX4_PM1_EVT_LEN; + acpi_facp.pm1_cnt_len = ACPI_PIIX4_PM1_CNT_LEN; + acpi_facp.pm2_cnt_len = ACPI_PIIX4_PM2_CNT_LEN; + acpi_facp.pm_tm_len = ACPI_PIIX4_PM_TM_LEN; + acpi_facp.gpe0_len = ACPI_PIIX4_GPE0_LEN; + acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT; + acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT; + + acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp)); + acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp); + + pblk = base + ACPI_PIIX4_P_BLK; + memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk)); + acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt)); + acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt); + + return 0; +} + +/* + * Init VIA ACPI device and create a fake FACP + */ +static int +acpi_init_via(struct pci_dev *dev) +{ + u32 base, pblk; + u8 tmp, irq; + + pci_read_config_byte(dev, 0x41, &tmp); + if (!(tmp & 0x80)) + return -ENODEV; + + base = pci_resource_start(dev, PCI_BRIDGE_RESOURCES); + if (!base) { + base = pci_resource_start(dev, PCI_BASE_ADDRESS_4); + if (!base) + return -ENODEV; + } + + pci_read_config_byte(dev, 0x42, &irq); + + printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base); + + memset(&acpi_facp, 0, sizeof(acpi_facp)); + acpi_facp.hdr.signature = ACPI_FACP_SIG; + acpi_facp.hdr.length = sizeof(acpi_facp); + acpi_facp.int_model = ACPI_VIA_INT_MODEL; + acpi_facp.sci_int = irq; + acpi_facp.smi_cmd = base + ACPI_VIA_SMI_CMD; + acpi_facp.acpi_enable = ACPI_VIA_ACPI_ENABLE; + acpi_facp.acpi_disable = ACPI_VIA_ACPI_DISABLE; + acpi_facp.pm1a_evt = base + ACPI_VIA_PM1_EVT; + acpi_facp.pm1a_cnt = base + ACPI_VIA_PM1_CNT; + acpi_facp.pm_tmr = base + ACPI_VIA_PM_TMR; + acpi_facp.gpe0 = base + ACPI_VIA_GPE0; + + acpi_facp.pm1_evt_len = ACPI_VIA_PM1_EVT_LEN; + acpi_facp.pm1_cnt_len = ACPI_VIA_PM1_CNT_LEN; + acpi_facp.pm_tm_len = ACPI_VIA_PM_TM_LEN; + acpi_facp.gpe0_len = ACPI_VIA_GPE0_LEN; + acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT; + acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT; + + acpi_facp.duty_offset = ACPI_VIA_DUTY_OFFSET; + acpi_facp.duty_width = ACPI_VIA_DUTY_WIDTH; + + acpi_facp.day_alarm = ACPI_VIA_DAY_ALARM; + acpi_facp.mon_alarm = ACPI_VIA_MON_ALARM; + acpi_facp.century = ACPI_VIA_CENTURY; + + acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp)); + acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp); + + pblk = base + ACPI_VIA_P_BLK; + memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk)); + acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt)); + acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt); + + return 0; +} + +typedef enum +{ + CH_UNKNOWN = 0, + CH_INTEL_PIIX4, + CH_VIA_586, + CH_VIA_686A, +} acpi_chip_t; + +/* indexed by value of each enum in acpi_chip_t */ +const static struct +{ + int (*chip_init)(struct pci_dev *dev); +} acpi_chip_info[] = +{ + {NULL,}, + {acpi_init_piix4}, + {acpi_init_via}, + {acpi_init_via}, +}; + +static struct pci_device_id acpi_pci_tbl[] = +{ + {0x8086, 0x7113, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_INTEL_PIIX4}, + {0x1106, 0x3040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_586}, + {0x1106, 0x3057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_686A}, + {0,} /* terminate list */ +}; + +static int +acpi_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + return acpi_chip_info[id->driver_data].chip_init(dev); +} + +static struct pci_driver acpi_driver = +{ + name: "acpi", + id_table: acpi_pci_tbl, + probe: acpi_probe, +}; +static int acpi_driver_registered = 0; + +/* + * Locate a known ACPI chipset + */ +static int +acpi_find_chipset(void) +{ + if (pci_register_driver(&acpi_driver) < 1) + return -ENODEV; + acpi_driver_registered = 1; + return 0; +} + +/* + * Fetch the FACP information + */ +static int +acpi_fetch_facp(void) +{ + ACPI_BUFFER buffer; + + memset(&acpi_facp, 0, sizeof(acpi_facp)); + buffer.pointer = &acpi_facp; + buffer.length = sizeof(acpi_facp); + if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FACP, 1, &buffer))) { + printk(KERN_ERR "ACPI: missing FACP\n"); + return -ENODEV; + } + + if (acpi_facp.p_lvl2_lat + && acpi_facp.p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) { + acpi_c2_exit_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl2_lat); + acpi_c2_enter_latency + = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); + } + if (acpi_facp.p_lvl3_lat + && acpi_facp.p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) { + acpi_c3_exit_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat); + acpi_c3_enter_latency + = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat * 5); + } + + return 0; +} + +/* + * Find and load ACPI tables + */ +int +acpi_load_tables(void) +{ + if (ACPI_SUCCESS(acpi_load_firmware_tables())) + { + printk(KERN_INFO "ACPI: support found\n"); + } + else if (acpi_find_chipset()) { + acpi_terminate(); + return -1; + } + + if (acpi_fetch_facp()) { + acpi_terminate(); + return -1; + } + + if (!ACPI_SUCCESS(acpi_load_namespace())) { + printk(KERN_ERR "ACPI: namespace load failed\n"); + acpi_terminate(); + return -1; + } + + return 0; +} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/Makefile linux/drivers/acpi/tables/Makefile --- v2.4.0-test8/linux/drivers/acpi/tables/Makefile Wed Dec 31 16:00:00 1969 +++ linux/drivers/acpi/tables/Makefile Fri Sep 15 18:21:44 2000 @@ -0,0 +1,28 @@ +# +# Makefile for all Linux ACPI interpreter subdirectories +# + +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := +ALL_SUB_DIRS := $(SUB_DIRS) + +O_TARGET := ../$(shell basename `pwd`).o +O_OBJS := +M_OBJS := + +ACPI_OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) + +EXTRA_CFLAGS += -I../include + +EXTRA_CFLAGS += $(ACPI_CFLAGS) + +# if the interpreter is used, it overrides arch/i386/kernel/acpi.c +ifeq ($(CONFIG_ACPI_INTERPRETER),y) + O_OBJS := $(ACPI_OBJS) +endif + +include $(TOPDIR)/Rules.make + +clean: + $(RM) *.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbget.c linux/drivers/acpi/tables/tbget.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbget.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/tables/tbget.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines + * $Revision: 22 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbget"); + MODULE_NAME ("tbget") /******************************************************************************* @@ -90,10 +90,15 @@ return (AE_NOT_EXIST); } - /* Walk the list to get the table */ - + /* Walk the list to get the desired table + * Since the if (Instance == 1) check above checked for the + * first table, setting Table_desc equal to the .Next member + * is actually pointing to the second table. Therefore, we + * need to walk from the 2nd table until we reach the Instance + * that the user is looking for and return its table pointer. + */ table_desc = acpi_gbl_acpi_tables[table_type].next; - for (i = 1; i < acpi_gbl_acpi_tables[table_type].count; i++) { + for (i = 2; i < instance; i++) { table_desc = table_desc->next; } @@ -110,8 +115,8 @@ * FUNCTION: Acpi_tb_get_table * * PARAMETERS: Physical_address - Physical address of table to retrieve - * *Buffer_ptr - If == NULL, read data from buffer - * rather than searching memory + * *Buffer_ptr - If Buffer_ptr is valid, read data from + * buffer rather than searching memory * *Table_info - Where the table info is returned * * RETURN: Status @@ -123,7 +128,7 @@ ACPI_STATUS acpi_tb_get_table ( void *physical_address, - char *buffer_ptr, + ACPI_TABLE_HEADER *buffer_ptr, ACPI_TABLE_DESC *table_info) { ACPI_TABLE_HEADER *table_header = NULL; @@ -143,7 +148,7 @@ * Getting data from a buffer, not BIOS tables */ - table_header = (ACPI_TABLE_HEADER *) buffer_ptr; + table_header = buffer_ptr; status = acpi_tb_validate_table_header (table_header); if (ACPI_FAILURE (status)) { /* Table failed verification, map all errors to BAD_DATA */ @@ -160,7 +165,7 @@ /* Copy the entire table (including header) to the local buffer */ - size = (ACPI_SIZE) table_header->length; + size = table_header->length; MEMCPY (full_table, buffer_ptr, size); /* Save allocation type */ @@ -216,7 +221,7 @@ ACPI_STATUS acpi_tb_get_all_tables ( u32 number_of_tables, - char *table_ptr) + ACPI_TABLE_HEADER *table_ptr) { ACPI_STATUS status = AE_OK; u32 index; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbinstal.c linux/drivers/acpi/tables/tbinstal.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbinstal.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/tables/tbinstal.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal + * $Revision: 29 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbinstal"); + MODULE_NAME ("tbinstal") /******************************************************************************* @@ -50,11 +50,9 @@ ACPI_STATUS acpi_tb_install_table ( - char *table_ptr, + ACPI_TABLE_HEADER *table_ptr, ACPI_TABLE_DESC *table_info) { - ACPI_TABLE_TYPE table_type; - ACPI_TABLE_HEADER *table_header; ACPI_STATUS status; @@ -68,11 +66,6 @@ return (status); } - /* Table type is returned by Recognize_table */ - - table_type = table_info->type; - table_header = table_info->pointer; - /* Lock tables while installing */ acpi_cm_acquire_mutex (ACPI_MTX_TABLES); @@ -80,12 +73,9 @@ /* Install the table into the global data structure */ status = acpi_tb_init_table_descriptor (table_info->type, table_info); - if (ACPI_FAILURE (status)) { - return (status); - } acpi_cm_release_mutex (ACPI_MTX_TABLES); - return (AE_OK); + return (status); } @@ -112,7 +102,7 @@ ACPI_STATUS acpi_tb_recognize_table ( - char *table_ptr, + ACPI_TABLE_HEADER *table_ptr, ACPI_TABLE_DESC *table_info) { ACPI_TABLE_HEADER *table_header; @@ -215,9 +205,10 @@ * the table are allowed. This includes SSDT and PSDTs. */ - if (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE) { + if (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags)) { /* - * Only one table allowed, just update the list head + * Only one table allowed, and a table has alread been installed + * at this location, so return an error. */ if (list_head->pointer) { @@ -249,7 +240,7 @@ /* Update new entry */ table_desc->prev = list_head->prev; - table_desc->next = (ACPI_TABLE_DESC *) list_head; + table_desc->next = list_head; /* Update list head */ @@ -308,7 +299,7 @@ void acpi_tb_delete_acpi_tables (void) { - u32 i; + ACPI_TABLE_TYPE type; /* @@ -316,8 +307,8 @@ * Memory can either be mapped or allocated */ - for (i = 0; i < ACPI_TABLE_MAX; i++) { - acpi_tb_delete_acpi_table (i); + for (type = 0; type < ACPI_TABLE_MAX; type++) { + acpi_tb_delete_acpi_table (type); } } @@ -402,6 +393,46 @@ /******************************************************************************* * + * FUNCTION: Acpi_tb_free_acpi_tables_of_type + * + * PARAMETERS: Table_info - A table info struct + * + * RETURN: None. + * + * DESCRIPTION: Free the memory associated with an internal ACPI table + * Table mutex should be locked. + * + ******************************************************************************/ + +void +acpi_tb_free_acpi_tables_of_type ( + ACPI_TABLE_DESC *list_head) +{ + ACPI_TABLE_DESC *table_desc; + u32 count; + u32 i; + + + /* Get the head of the list */ + + table_desc = list_head; + count = list_head->count; + + /* + * Walk the entire list, deleting both the allocated tables + * and the table descriptors + */ + + for (i = 0; i < count; i++) { + table_desc = acpi_tb_delete_single_table (table_desc); + } + + return; +} + + +/******************************************************************************* + * * FUNCTION: Acpi_tb_delete_single_table * * PARAMETERS: Table_info - A table info struct @@ -488,46 +519,6 @@ return (next_desc); -} - - -/******************************************************************************* - * - * FUNCTION: Acpi_tb_free_acpi_tables_of_type - * - * PARAMETERS: Table_info - A table info struct - * - * RETURN: None. - * - * DESCRIPTION: Free the memory associated with an internal ACPI table - * Table mutex should be locked. - * - ******************************************************************************/ - -void -acpi_tb_free_acpi_tables_of_type ( - ACPI_TABLE_DESC *list_head) -{ - ACPI_TABLE_DESC *table_desc; - u32 count; - u32 i; - - - /* Get the head of the list */ - - table_desc = list_head; - count = list_head->count; - - /* - * Walk the entire list, deleting both the allocated tables - * and the table descriptors - */ - - for (i = 0; i < count; i++) { - table_desc = acpi_tb_delete_single_table (table_desc); - } - - return; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbtable.c linux/drivers/acpi/tables/tbtable.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbtable.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/tables/tbtable.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbtable - ACPI tables: FACP, FACS, and RSDP utilities + * $Revision: 24 $ * *****************************************************************************/ @@ -25,12 +25,12 @@ #include "acpi.h" -#include "hardware.h" -#include "tables.h" +#include "achware.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbtable"); + MODULE_NAME ("tbtable") /******************************************************************************* @@ -38,7 +38,6 @@ * FUNCTION: Acpi_tb_get_table_rsdt * * PARAMETERS: Number_of_tables - Where the table count is placed - * Table_ptr - Input buffer pointer, optional * * RETURN: Status * @@ -85,15 +84,15 @@ REPORT_ERROR ("Invalid signature where RSDP indicates RSDT should be located"); } + REPORT_ERROR ("Unable to locate RSDT"); + + return (status); } /* Always delete the RSDP mapping */ acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP); - if (ACPI_FAILURE (status)) { - return (status); - } /* Save the table pointers and allocation info */ @@ -109,10 +108,15 @@ status = acpi_tb_verify_table_checksum ((ACPI_TABLE_HEADER *) acpi_gbl_RSDT); - /* Determine the number of tables pointed to by the RSDT */ + /* + * Determine the number of tables pointed to by the RSDT. + * This is defined by the ACPI Specification to be the number of + * pointers contained within the RSDT. The size of the pointers + * is architecture-dependent. + */ - *number_of_tables = (s32) DIV_4 (acpi_gbl_RSDT->header.length - - sizeof (ACPI_TABLE_HEADER)); + *number_of_tables = ((acpi_gbl_RSDT->header.length - + sizeof (ACPI_TABLE_HEADER)) / sizeof (void *)); return (status); @@ -132,13 +136,13 @@ * ******************************************************************************/ -char * +u8 * acpi_tb_scan_memory_for_rsdp ( - char *start_address, + u8 *start_address, u32 length) { u32 offset; - char *mem_rover; + u8 *mem_rover; /* Search from given start addr for the requested length */ @@ -150,19 +154,19 @@ /* The signature and checksum must both be correct */ - if (STRNCMP (mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 && + if (STRNCMP ((NATIVE_CHAR *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) == 0 && acpi_tb_checksum (mem_rover, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)) == 0) { /* If so, we have found the RSDP */ - return mem_rover; + return (mem_rover); } } /* Searched entire block, no RSDP was found */ - return NULL; + return (NULL); } @@ -189,8 +193,8 @@ acpi_tb_find_rsdp ( ACPI_TABLE_DESC *table_info) { - char *table_ptr; - char *mem_rover; + u8 *table_ptr; + u8 *mem_rover; ACPI_STATUS status = AE_OK; if (acpi_gbl_acpi_init_data.RSDP_physical_address) { @@ -214,9 +218,9 @@ * The signature and checksum must both be correct */ - if (STRNCMP (table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { + if (STRNCMP ((NATIVE_CHAR *) table_ptr, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { /* Nope, BAD Signature */ - + acpi_os_unmap_memory (table_ptr, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)); return (AE_BAD_SIGNATURE); } @@ -226,7 +230,7 @@ sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)) != 0) { /* Nope, BAD Checksum */ - + acpi_os_unmap_memory (table_ptr, sizeof (ROOT_SYSTEM_DESCRIPTOR_POINTER)); return (AE_BAD_CHECKSUM); } @@ -309,12 +313,12 @@ } -/******************************************************************************* +/****************************************************************************** * * FUNCTION: Acpi_tb_get_table_facs * - * PARAMETERS: *Buffer_ptr - If == NULL, read data from buffer - * rather than searching memory + * PARAMETERS: *Buffer_ptr - If Buffer_ptr is valid, read data from + * buffer rather than searching memory * *Table_info - Where the table info is returned * * RETURN: Status @@ -324,11 +328,11 @@ * correctly initialized. The value of FACP->Firmware_ctrl * into a far pointer which is returned. * - ******************************************************************************/ + *****************************************************************************/ ACPI_STATUS acpi_tb_get_table_facs ( - char *buffer_ptr, + ACPI_TABLE_HEADER *buffer_ptr, ACPI_TABLE_DESC *table_info) { void *table_ptr = NULL; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbutils.c linux/drivers/acpi/tables/tbutils.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbutils.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/tables/tbutils.c Fri Sep 15 14:30:30 2000 @@ -1,7 +1,7 @@ - /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities + * $Revision: 26 $ * *****************************************************************************/ @@ -25,23 +25,24 @@ #include "acpi.h" -#include "tables.h" -#include "interp.h" +#include "actables.h" +#include "acinterp.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbutils"); + MODULE_NAME ("tbutils") /******************************************************************************* * - * FUNCTION: Acpi_tb_system_table_pointer + * FUNCTION: Acpi_tb_handle_to_object * - * PARAMETERS: *Where - Pointer to be examined + * PARAMETERS: Table_id - Id for which the function is searching + * Table_desc - Pointer to return the matching table + * descriptor. * - * RETURN: TRUE if Where is within the AML stream (in one of the ACPI - * system tables such as the DSDT or an SSDT.) - * FALSE otherwise + * RETURN: Search the tables to find one with a matching Table_id and + * return a pointer to that table descriptor. * ******************************************************************************/ @@ -60,7 +61,7 @@ { if (list_head->table_id == table_id) { *table_desc = list_head; - return AE_OK; + return (AE_OK); } list_head = list_head->next; @@ -69,7 +70,7 @@ } - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } @@ -177,7 +178,7 @@ /* Verify that this is a valid address */ if (!acpi_os_readable (table_header, sizeof (ACPI_TABLE_HEADER))) { - return AE_BAD_ADDRESS; + return (AE_BAD_ADDRESS); } @@ -186,7 +187,7 @@ MOVE_UNALIGNED32_TO_32 (&signature, &table_header->signature); if (!acpi_cm_valid_acpi_name (signature)) { REPORT_WARNING ("Invalid table signature found"); - return AE_BAD_SIGNATURE; + return (AE_BAD_SIGNATURE); } @@ -194,10 +195,10 @@ if (table_header->length < sizeof (ACPI_TABLE_HEADER)) { REPORT_WARNING ("Invalid table header length found"); - return AE_BAD_HEADER; + return (AE_BAD_HEADER); } - return AE_OK; + return (AE_OK); } @@ -236,7 +237,7 @@ status = acpi_os_map_memory (physical_address, sizeof (ACPI_TABLE_HEADER), (void **) &table); if (ACPI_FAILURE (status)) { - return status; + return (status); } /* Extract the full table length before we delete the mapping */ @@ -257,7 +258,7 @@ /* Exit if header invalid */ if (ACPI_FAILURE (status)) { - return status; + return (status); } } @@ -266,13 +267,13 @@ status = acpi_os_map_memory (physical_address, table_size, (void **) &table); if (ACPI_FAILURE (status)) { - return status; + return (status); } *size = table_size; *logical_address = table; - return status; + return (status); } @@ -346,7 +347,7 @@ } } - return sum; + return (sum); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables/tbxface.c linux/drivers/acpi/tables/tbxface.c --- v2.4.0-test8/linux/drivers/acpi/tables/tbxface.c Wed Jul 5 11:23:13 2000 +++ linux/drivers/acpi/tables/tbxface.c Fri Sep 15 14:30:30 2000 @@ -1,8 +1,8 @@ - /****************************************************************************** * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces + * $Revision: 24 $ * *****************************************************************************/ @@ -26,13 +26,13 @@ #include "acpi.h" -#include "namesp.h" -#include "interp.h" -#include "tables.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "actables.h" #define _COMPONENT TABLE_MANAGER - MODULE_NAME ("tbxface"); + MODULE_NAME ("tbxface") /******************************************************************************* @@ -57,7 +57,7 @@ /* Get the RSDT first */ status = acpi_tb_get_table_rsdt (&number_of_tables); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto error_exit; } @@ -65,7 +65,7 @@ /* Now get the rest of the tables */ status = acpi_tb_get_all_tables (number_of_tables, NULL); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { goto error_exit; } @@ -105,12 +105,12 @@ if (!table_ptr) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } /* Copy the table to a local buffer */ - status = acpi_tb_get_table (NULL, ((char *) table_ptr), &table_info); + status = acpi_tb_get_table (NULL, table_ptr, &table_info); if (ACPI_FAILURE (status)) { return (status); } @@ -157,7 +157,12 @@ list_head = &acpi_gbl_acpi_tables[table_type]; do { - /* Delete the entire namespace under this table NTE */ + /* + * Delete all namespace entries owned by this table. Note that these + * entries can appear anywhere in the namespace by virtue of the AML + * "Scope" operator. Thus, we need to track ownership by an ID, not + * simply a position within the hierarchy + */ acpi_ns_delete_namespace_by_owner (list_head->table_id); @@ -205,8 +210,6 @@ ACPI_STATUS status; - status = AE_OK; - if ((instance == 0) || (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) @@ -217,7 +220,7 @@ /* Check the table type and instance */ if ((table_type > ACPI_TABLE_MAX) || - (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE && + (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && instance > 1)) { return (AE_BAD_PARAMETER); @@ -227,7 +230,7 @@ /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } @@ -285,8 +288,6 @@ u32 ret_buf_len; - status = AE_OK; - /* * Must have a buffer */ @@ -301,7 +302,7 @@ /* Check the table type and instance */ if ((table_type > ACPI_TABLE_MAX) || - (acpi_gbl_acpi_table_data[table_type].flags == ACPI_TABLE_SINGLE && + (IS_SINGLE_TABLE (acpi_gbl_acpi_table_data[table_type].flags) && instance > 1)) { return (AE_BAD_PARAMETER); @@ -311,12 +312,13 @@ /* Get a pointer to the entire table */ status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); - if (status != AE_OK) { + if (ACPI_FAILURE (status)) { return (status); } /* - * The function will return a NULL pointer if the table is not loaded + * Acpi_tb_get_table_ptr will return a NULL pointer if the + * table is not loaded. */ if (tbl_ptr == NULL) { return (AE_NOT_EXIST); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/acpi/tables.c linux/drivers/acpi/tables.c --- v2.4.0-test8/linux/drivers/acpi/tables.c Thu Jul 13 09:39:49 2000 +++ linux/drivers/acpi/tables.c Wed Dec 31 16:00:00 1969 @@ -1,303 +0,0 @@ -/* - * tables.c - ACPI tables, chipset, and errata handling - * - * Copyright (C) 2000 Andrew Henroid - * - * 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 - */ - -#include -#include -#include -#include -#include -#include "acpi.h" -#include "driver.h" - -struct acpi_facp acpi_facp; - -#define ACPI_DUMMY_CHECKSUM 9 -#define ACPI_DUMMY_PBLK 51 - -static u8 acpi_dummy_dsdt[] = -{ - 0x44, 0x53, 0x44, 0x54, // "DSDT" - 0x38, 0x00, 0x00, 0x00, // length - 0x01, // revision - 0x00, // checksum - 0x4c, 0x49, 0x4e, 0x55, 0x58, 0x00, // "LINUX" - 0x44, 0x55, 0x4d, 0x4d, 0x59, 0x00, 0x00, 0x00, // "DUMMY" - 0x01, 0x00, 0x00, 0x00, // OEM rev - 0x4c, 0x4e, 0x55, 0x58, // "LNUX" - 0x01, 0x00, 0x00, 0x00, // creator rev - 0x10, // Scope - 0x13, // PkgLength - 0x5c, 0x5f, 0x50, 0x52, 0x5f, // \_PR_ - 0x5b, 0x83, // Processor - 0x0b, // PkgLength - 0x43, 0x50, 0x55, 0x30, // CPU0 - 0x00, // ID - 0x00, 0x00, 0x00, 0x00, // PBLK - 0x06 // PBLK size -}; - -/* - * Calculate and set ACPI table checksum - */ -static void -acpi_set_checksum(u8 *table, int size) -{ - int i, sum = 0; - for (i = 0; i < size; i++) - sum += (int) table[i]; - sum = (0x100 - ((sum - table[ACPI_DUMMY_CHECKSUM]) & 0xff)); - table[ACPI_DUMMY_CHECKSUM] = sum; -} - -/* - * Init PIIX4 device, create a fake FACP - */ -static int -acpi_init_piix4(struct pci_dev *dev) -{ - u32 base, pblk; - u16 cmd; - u8 pmregmisc; - - pci_read_config_word(dev, PCI_COMMAND, &cmd); - if (!(cmd & PCI_COMMAND_IO)) - return -ENODEV; - - pci_read_config_byte(dev, ACPI_PIIX4_PMREGMISC, &pmregmisc); - if (!(pmregmisc & ACPI_PIIX4_PMIOSE)) - return -ENODEV; - - base = pci_resource_start (dev, PCI_BRIDGE_RESOURCES); - if (!base) - return -ENODEV; - - printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base); - - memset(&acpi_facp, 0, sizeof(acpi_facp)); - acpi_facp.hdr.signature = ACPI_FACP_SIG; - acpi_facp.hdr.length = sizeof(acpi_facp); - acpi_facp.int_model = ACPI_PIIX4_INT_MODEL; - acpi_facp.sci_int = ACPI_PIIX4_SCI_INT; - acpi_facp.smi_cmd = ACPI_PIIX4_SMI_CMD; - acpi_facp.acpi_enable = ACPI_PIIX4_ACPI_ENABLE; - acpi_facp.acpi_disable = ACPI_PIIX4_ACPI_DISABLE; - acpi_facp.s4bios_req = ACPI_PIIX4_S4BIOS_REQ; - acpi_facp.pm1a_evt = base + ACPI_PIIX4_PM1_EVT; - acpi_facp.pm1a_cnt = base + ACPI_PIIX4_PM1_CNT; - acpi_facp.pm2_cnt = ACPI_PIIX4_PM2_CNT; - acpi_facp.pm_tmr = base + ACPI_PIIX4_PM_TMR; - acpi_facp.gpe0 = base + ACPI_PIIX4_GPE0; - acpi_facp.pm1_evt_len = ACPI_PIIX4_PM1_EVT_LEN; - acpi_facp.pm1_cnt_len = ACPI_PIIX4_PM1_CNT_LEN; - acpi_facp.pm2_cnt_len = ACPI_PIIX4_PM2_CNT_LEN; - acpi_facp.pm_tm_len = ACPI_PIIX4_PM_TM_LEN; - acpi_facp.gpe0_len = ACPI_PIIX4_GPE0_LEN; - acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT; - acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT; - - acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp)); - acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp); - - pblk = base + ACPI_PIIX4_P_BLK; - memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk)); - acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt)); - acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt); - - return 0; -} - -/* - * Init VIA ACPI device and create a fake FACP - */ -static int -acpi_init_via(struct pci_dev *dev) -{ - u32 base, pblk; - u8 tmp, irq; - - pci_read_config_byte(dev, 0x41, &tmp); - if (!(tmp & 0x80)) - return -ENODEV; - - base = pci_resource_start(dev, PCI_BRIDGE_RESOURCES); - if (!base) { - base = pci_resource_start(dev, PCI_BASE_ADDRESS_4); - if (!base) - return -ENODEV; - } - - pci_read_config_byte(dev, 0x42, &irq); - - printk(KERN_INFO "ACPI: found \"%s\" at 0x%04x\n", dev->name, base); - - memset(&acpi_facp, 0, sizeof(acpi_facp)); - acpi_facp.hdr.signature = ACPI_FACP_SIG; - acpi_facp.hdr.length = sizeof(acpi_facp); - acpi_facp.int_model = ACPI_VIA_INT_MODEL; - acpi_facp.sci_int = irq; - acpi_facp.smi_cmd = base + ACPI_VIA_SMI_CMD; - acpi_facp.acpi_enable = ACPI_VIA_ACPI_ENABLE; - acpi_facp.acpi_disable = ACPI_VIA_ACPI_DISABLE; - acpi_facp.pm1a_evt = base + ACPI_VIA_PM1_EVT; - acpi_facp.pm1a_cnt = base + ACPI_VIA_PM1_CNT; - acpi_facp.pm_tmr = base + ACPI_VIA_PM_TMR; - acpi_facp.gpe0 = base + ACPI_VIA_GPE0; - - acpi_facp.pm1_evt_len = ACPI_VIA_PM1_EVT_LEN; - acpi_facp.pm1_cnt_len = ACPI_VIA_PM1_CNT_LEN; - acpi_facp.pm_tm_len = ACPI_VIA_PM_TM_LEN; - acpi_facp.gpe0_len = ACPI_VIA_GPE0_LEN; - acpi_facp.p_lvl2_lat = (__u16) ACPI_INFINITE_LAT; - acpi_facp.p_lvl3_lat = (__u16) ACPI_INFINITE_LAT; - - acpi_facp.duty_offset = ACPI_VIA_DUTY_OFFSET; - acpi_facp.duty_width = ACPI_VIA_DUTY_WIDTH; - - acpi_facp.day_alarm = ACPI_VIA_DAY_ALARM; - acpi_facp.mon_alarm = ACPI_VIA_MON_ALARM; - acpi_facp.century = ACPI_VIA_CENTURY; - - acpi_set_checksum((u8*) &acpi_facp, sizeof(acpi_facp)); - acpi_load_table((ACPI_TABLE_HEADER*) &acpi_facp); - - pblk = base + ACPI_VIA_P_BLK; - memcpy(acpi_dummy_dsdt + ACPI_DUMMY_PBLK, &pblk, sizeof(pblk)); - acpi_set_checksum(acpi_dummy_dsdt, sizeof(acpi_dummy_dsdt)); - acpi_load_table((ACPI_TABLE_HEADER*) acpi_dummy_dsdt); - - return 0; -} - -typedef enum -{ - CH_UNKNOWN = 0, - CH_INTEL_PIIX4, - CH_VIA_586, - CH_VIA_686A, -} acpi_chip_t; - -/* indexed by value of each enum in acpi_chip_t */ -const static struct -{ - int (*chip_init)(struct pci_dev *dev); -} acpi_chip_info[] = -{ - {NULL,}, - {acpi_init_piix4}, - {acpi_init_via}, - {acpi_init_via}, -}; - -static struct pci_device_id acpi_pci_tbl[] = -{ - {0x8086, 0x7113, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_INTEL_PIIX4}, - {0x1106, 0x3040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_586}, - {0x1106, 0x3057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_VIA_686A}, - {0,} /* terminate list */ -}; - -static int -acpi_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - return acpi_chip_info[id->driver_data].chip_init(dev); -} - -static struct pci_driver acpi_driver = -{ - name: "acpi", - id_table: acpi_pci_tbl, - probe: acpi_probe, -}; -static int acpi_driver_registered = 0; - -/* - * Locate a known ACPI chipset - */ -static int -acpi_find_chipset(void) -{ - if (pci_register_driver(&acpi_driver) < 1) - return -ENODEV; - acpi_driver_registered = 1; - return 0; -} - -/* - * Fetch the FACP information - */ -static int -acpi_fetch_facp(void) -{ - ACPI_BUFFER buffer; - - memset(&acpi_facp, 0, sizeof(acpi_facp)); - buffer.pointer = &acpi_facp; - buffer.length = sizeof(acpi_facp); - if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FACP, 1, &buffer))) { - printk(KERN_ERR "ACPI: missing FACP\n"); - return -ENODEV; - } - - if (acpi_facp.p_lvl2_lat - && acpi_facp.p_lvl2_lat <= ACPI_MAX_P_LVL2_LAT) { - acpi_c2_exit_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl2_lat); - acpi_c2_enter_latency - = ACPI_uS_TO_TMR_TICKS(ACPI_TMR_HZ / 1000); - } - if (acpi_facp.p_lvl3_lat - && acpi_facp.p_lvl3_lat <= ACPI_MAX_P_LVL3_LAT) { - acpi_c3_exit_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat); - acpi_c3_enter_latency - = ACPI_uS_TO_TMR_TICKS(acpi_facp.p_lvl3_lat * 5); - } - - return 0; -} - -/* - * Find and load ACPI tables - */ -int -acpi_load_tables(void) -{ - if (ACPI_SUCCESS(acpi_load_firmware_tables())) - { - printk(KERN_INFO "ACPI: support found\n"); - } - else if (acpi_find_chipset()) { - acpi_terminate(); - return -1; - } - - if (acpi_fetch_facp()) { - acpi_terminate(); - return -1; - } - - if (!ACPI_SUCCESS(acpi_load_namespace())) { - printk(KERN_ERR "ACPI: namespace load failed\n"); - acpi_terminate(); - return -1; - } - - return 0; -} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/cpqarray.c linux/drivers/block/cpqarray.c --- v2.4.0-test8/linux/drivers/block/cpqarray.c Thu Jul 6 19:25:21 2000 +++ linux/drivers/block/cpqarray.c Mon Sep 18 14:57:02 2000 @@ -85,6 +85,7 @@ { 0x40330E11, "Smart Array 3100ES", &smart2_access }, { 0x40340E11, "Smart Array 221", &smart2_access }, { 0x40400E11, "Integrated Array", &smart4_access }, + { 0x40480E11, "Compaq Raid LC2", &smart4_access }, { 0x40500E11, "Smart Array 4200", &smart4_access }, { 0x40510E11, "Smart Array 4250ES", &smart4_access }, { 0x40580E11, "Smart Array 431", &smart4_access }, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/floppy.c linux/drivers/block/floppy.c --- v2.4.0-test8/linux/drivers/block/floppy.c Mon Aug 28 21:31:47 2000 +++ linux/drivers/block/floppy.c Mon Sep 18 15:18:15 2000 @@ -2288,6 +2288,7 @@ static void request_done(int uptodate) { int block; + unsigned long flags; probing = 0; reschedule_timeout(MAXTIMEOUT, "request done %d", uptodate); @@ -2306,6 +2307,7 @@ DRS->maxtrack = 1; /* unlock chained buffers */ + spin_lock_irqsave(&io_request_lock, flags); while (current_count_sectors && !QUEUE_EMPTY && current_count_sectors >= CURRENT->current_nr_sectors){ current_count_sectors -= CURRENT->current_nr_sectors; @@ -2313,6 +2315,8 @@ CURRENT->sector += CURRENT->current_nr_sectors; end_request(1); } + spin_unlock_irqrestore(&io_request_lock, flags); + if (current_count_sectors && !QUEUE_EMPTY){ /* "unlock" last subsector */ CURRENT->buffer += current_count_sectors <<9; @@ -2336,7 +2340,9 @@ DRWE->last_error_sector = CURRENT->sector; DRWE->last_error_generation = DRS->generation; } + spin_lock_irqsave(&io_request_lock, flags); end_request(0); + spin_unlock_irqrestore(&io_request_lock, flags); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/genhd.c linux/drivers/block/genhd.c --- v2.4.0-test8/linux/drivers/block/genhd.c Wed Apr 12 09:38:52 2000 +++ linux/drivers/block/genhd.c Sun Sep 17 23:16:35 2000 @@ -23,7 +23,6 @@ #ifdef CONFIG_BLK_DEV_DAC960 extern void DAC960_Initialize(void); #endif -extern int scsi_dev_init(void); extern int net_dev_init(void); extern void console_map_init(void); extern int soc_probe(void); @@ -49,9 +48,6 @@ #ifdef CONFIG_FC4_SOC /* This has to be done before scsi_dev_init */ soc_probe(); -#endif -#ifdef CONFIG_SCSI - scsi_dev_init(); #endif #ifdef CONFIG_IEEE1394 ieee1394_init(); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/lvm-snap.c linux/drivers/block/lvm-snap.c --- v2.4.0-test8/linux/drivers/block/lvm-snap.c Mon Aug 7 21:01:35 2000 +++ linux/drivers/block/lvm-snap.c Sun Sep 17 09:51:57 2000 @@ -118,7 +118,8 @@ or error on this snapshot --> release it */ invalidate_buffers(lv_snap->lv_dev); - for (i = last_dev = 0; i < lv_snap->lv_remap_ptr; i++) { + last_dev = 0; + for (i = 0; i < lv_snap->lv_remap_ptr; i++) { if ( lv_snap->lv_block_exception[i].rdev_new != last_dev) { last_dev = lv_snap->lv_block_exception[i].rdev_new; invalidate_buffers(last_dev); @@ -199,8 +200,9 @@ lv_t * lv_snap) { const char * reason; - unsigned long org_start, snap_start, snap_phys_dev, virt_start, pe_off; + unsigned long org_start, snap_start, virt_start, pe_off; int idx = lv_snap->lv_remap_ptr, chunk_size = lv_snap->lv_chunk_size; + kdev_t snap_phys_dev; struct kiobuf * iobuf; unsigned long blocks[KIO_MAX_SECTORS]; int blksize_snap, blksize_org, min_blksize, max_blksize; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/lvm.c linux/drivers/block/lvm.c --- v2.4.0-test8/linux/drivers/block/lvm.c Tue Sep 5 13:56:57 2000 +++ linux/drivers/block/lvm.c Sun Sep 17 09:51:57 2000 @@ -250,7 +250,7 @@ static int lvm_do_pv_status(vg_t *, void *); static void lvm_geninit(struct gendisk *); #ifdef LVM_GET_INODE -static struct inode *lvm_get_inode(int); +static struct inode *lvm_get_inode(kdev_t); void lvm_clear_inode(struct inode *); #endif /* END Internal function prototypes */ @@ -486,9 +486,8 @@ loadtime = CURRENT_TIME; pe_lock_req.lock = UNLOCK_PE; - pe_lock_req.data.lv_dev = \ - pe_lock_req.data.pv_dev = \ - pe_lock_req.data.pv_offset = 0; + pe_lock_req.data.lv_dev = pe_lock_req.data.pv_dev = 0; + pe_lock_req.data.pv_offset = 0; /* Initialize VG pointers */ for (v = 0; v < ABS_MAX_VG; v++) vg[v] = NULL; @@ -1561,8 +1560,7 @@ case UNLOCK_PE: pe_lock_req.lock = UNLOCK_PE; - pe_lock_req.data.lv_dev = \ - pe_lock_req.data.pv_dev = \ + pe_lock_req.data.lv_dev = pe_lock_req.data.pv_dev = 0; pe_lock_req.data.pv_offset = 0; wake_up(&lvm_map_wait); break; @@ -2542,7 +2540,7 @@ * If you can convince Linus that it's worth changing - fine, then you'll need * to do blkdev_get()/blkdev_put(). Until then... */ -struct inode *lvm_get_inode(int dev) +struct inode *lvm_get_inode(kdev_t dev) { struct inode *inode_this = NULL; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/block/swim3.c linux/drivers/block/swim3.c --- v2.4.0-test8/linux/drivers/block/swim3.c Tue Jun 20 07:24:52 2000 +++ linux/drivers/block/swim3.c Sun Sep 17 09:48:05 2000 @@ -246,6 +246,13 @@ static int swim3_add_device(struct device_node *swims); int swim3_init(void); +#ifndef CONFIG_PMAC_PBOOK +static inline int check_media_bay(struct device_node *which_bay, int what) +{ + return 1; +} +#endif + static void swim3_select(struct floppy_state *fs, int sel) { volatile struct swim3 *sw = fs->swim3; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/cdrom/mcd.c linux/drivers/cdrom/mcd.c --- v2.4.0-test8/linux/drivers/cdrom/mcd.c Wed Jul 26 09:09:39 2000 +++ linux/drivers/cdrom/mcd.c Sun Sep 17 09:45:06 2000 @@ -275,7 +275,7 @@ static int statusCmd(void) { - int st, retry; + int st = -1, retry; for (retry = 0; retry < MCD_RETRY_ATTEMPTS; retry++) { @@ -297,7 +297,7 @@ static int mcdPlay(struct mcd_Play_msf *arg) { - int retry, st; + int retry, st = -1; for (retry = 0; retry < MCD_RETRY_ATTEMPTS; retry++) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/Config.in linux/drivers/char/Config.in --- v2.4.0-test8/linux/drivers/char/Config.in Tue Aug 22 11:29:02 2000 +++ linux/drivers/char/Config.in Sun Sep 17 09:48:04 2000 @@ -90,8 +90,8 @@ dep_tristate ' ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE $CONFIG_BUSMOUSE dep_tristate ' Logitech busmouse support' CONFIG_LOGIBUSMOUSE $CONFIG_BUSMOUSE dep_tristate ' Microsoft busmouse support' CONFIG_MS_BUSMOUSE $CONFIG_BUSMOUSE - if [ "$CONFIG_ADB" = "y" ]; then - dep_tristate ' Apple Desktop Bus mouse support' CONFIG_ADBMOUSE $CONFIG_BUSMOUSE + if [ "$CONFIG_ADB" = "y" -a "$CONFIG_ADB_KEYBOARD" = "y" ]; then + dep_tristate ' Apple Desktop Bus mouse support (old driver)' CONFIG_ADBMOUSE $CONFIG_BUSMOUSE fi fi diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/Makefile linux/drivers/char/Makefile --- v2.4.0-test8/linux/drivers/char/Makefile Tue Aug 22 11:41:14 2000 +++ linux/drivers/char/Makefile Mon Sep 18 15:15:22 2000 @@ -101,6 +101,8 @@ obj-$(CONFIG_VT) += vt.o vc_screen.o consolemap.o consolemap_deftbl.o $(CONSOLE) selection.o obj-$(CONFIG_SERIAL) += $(SERIAL) obj-$(CONFIG_SERIAL_21285) += serial_21285.o +obj-$(CONFIG_SERIAL_SA1100) += serial_sa1100.o +obj-$(CONFIG_SERIAL_AMBA) += serial_amba.o ifndef CONFIG_SUN_KEYBOARD obj-$(CONFIG_VT) += keyboard.o $(KEYMAP) $(KEYBD) @@ -174,6 +176,7 @@ ifeq ($(CONFIG_PPC),) obj-$(CONFIG_NVRAM) += nvram.o endif +obj-$(CONFIG_TOSHIBA) += toshiba.o obj-$(CONFIG_21285_WATCHDOG) += wdt285.o obj-$(CONFIG_977_WATCHDOG) += wdt977.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/drmP.h linux/drivers/char/drm/drmP.h --- v2.4.0-test8/linux/drivers/char/drm/drmP.h Fri Sep 8 12:52:45 2000 +++ linux/drivers/char/drm/drmP.h Mon Sep 18 15:43:47 2000 @@ -33,6 +33,12 @@ #define _DRM_P_H_ #ifdef __KERNEL__ +#ifdef __alpha__ +/* add include of current.h so that "current" is defined + * before static inline funcs in wait.h. Doing this so we + * can build the DRM (part of PI DRI). 4/21/2000 S + B */ +#include +#endif /* __alpha__ */ #include #include #include @@ -47,6 +53,9 @@ #include #include /* For (un)lock_kernel */ #include +#ifdef __alpha__ +#include /* For pte_wrprotect */ +#endif #include #include #include @@ -147,6 +156,71 @@ #ifndef __HAVE_ARCH_CMPXCHG /* Include this here so that driver can be used with older kernels. */ +#if defined(__alpha__) +static __inline__ unsigned long +__cmpxchg_u32(volatile int *m, int old, int new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldl_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stl_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +static __inline__ unsigned long +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldq_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stq_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".subsection 2\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +static __inline__ unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + switch (size) { + case 4: + return __cmpxchg_u32(ptr, old, new); + case 8: + return __cmpxchg_u64(ptr, old, new); + } + return old; +} +#define cmpxchg(ptr,o,n) \ + ({ \ + __typeof__(*(ptr)) _o_ = (o); \ + __typeof__(*(ptr)) _n_ = (n); \ + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ + (unsigned long)_n_, sizeof(*(ptr))); \ + }) + +#elif __i386__ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) { @@ -177,6 +251,7 @@ #define cmpxchg(ptr,o,n) \ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \ (unsigned long)(n),sizeof(*(ptr)))) +#endif /* i386 & alpha */ #endif /* Macros to make printk easier */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/gamma_drv.c linux/drivers/char/drm/gamma_drv.c --- v2.4.0-test8/linux/drivers/char/drm/gamma_drv.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/gamma_drv.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith * @@ -42,7 +42,7 @@ #define GAMMA_NAME "gamma" #define GAMMA_DESC "3dlabs GMX 2000" -#define GAMMA_DATE "20000719" +#define GAMMA_DATE "20000910" #define GAMMA_MAJOR 1 #define GAMMA_MINOR 0 #define GAMMA_PATCHLEVEL 0 @@ -87,7 +87,7 @@ [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 }, @@ -120,7 +120,7 @@ * passed via the boot-loader (e.g., LILO). It calls the insmod option * routine, drm_parse_options. */ - + static int __init gamma_options(char *str) { @@ -134,7 +134,7 @@ static int gamma_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -179,22 +179,22 @@ #endif dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -209,15 +209,15 @@ DRM_DEBUG("\n"); if (dev->irq) gamma_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -231,7 +231,7 @@ } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } - + /* Clear vma list (only built for debugging) */ if (dev->vmalist) { for (vma = dev->vmalist; vma; vma = vma_next) { @@ -240,7 +240,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -278,7 +278,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -304,7 +304,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -349,7 +349,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(gamma); #endif @@ -374,7 +374,7 @@ GAMMA_DATE, gamma_misc.minor, devices); - + return 0; } @@ -385,7 +385,7 @@ drm_device_t *dev = &gamma_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&gamma_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -438,7 +438,7 @@ { drm_device_t *dev = &gamma_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -505,7 +505,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -525,7 +525,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -540,7 +540,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -565,7 +565,7 @@ atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - dev->lck_start)]); #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/i810_drv.c linux/drivers/char/drm/i810_drv.c --- v2.4.0-test8/linux/drivers/char/drm/i810_drv.c Tue Sep 5 13:51:30 2000 +++ linux/drivers/char/drm/i810_drv.c Fri Sep 15 14:24:55 2000 @@ -1,6 +1,6 @@ /* i810_drv.c -- I810 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * + * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -35,7 +35,7 @@ #define I810_NAME "i810" #define I810_DESC "Intel I810" -#define I810_DATE "20000719" +#define I810_DATE "20000910" #define I810_MAJOR 1 #define I810_MINOR 1 #define I810_PATCHLEVEL 0 @@ -143,7 +143,7 @@ static int i810_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -188,22 +188,22 @@ #endif dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -218,15 +218,15 @@ DRM_DEBUG("\n"); if (dev->irq) i810_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -244,7 +244,7 @@ if (dev->agp) { drm_agp_mem_t *entry; drm_agp_mem_t *nexte; - + /* Remove AGP resources, but leave dev->agp intact until r128_cleanup is called. */ for (entry = dev->agp->memory; entry; entry = nexte) { @@ -254,10 +254,10 @@ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; - + if (dev->agp->acquired && drm_agp.release) (*drm_agp.release)(); - + dev->agp->acquired = 0; dev->agp->enabled = 0; } @@ -269,7 +269,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -305,7 +305,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -331,7 +331,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -348,7 +348,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(i810); #endif @@ -402,7 +402,7 @@ drm_device_t *dev = &i810_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&i810_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -461,7 +461,7 @@ { drm_device_t *dev = &i810_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -498,7 +498,7 @@ drm_lock_free(dev, &dev->lock.hw_lock->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - + /* FIXME: may require heavy-handed reset of hardware at this point, possibly processed via a callback to the X @@ -519,7 +519,7 @@ dev->lock.lock_time = jiffies; atomic_inc(&dev->total_locks); break; /* Got lock */ - } + } /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -545,7 +545,7 @@ if (priv->next) priv->next->prev = priv->prev; else dev->file_last = priv->prev; up(&dev->struct_sem); - + drm_free(priv, sizeof(*priv), DRM_MEM_FILES); #if LINUX_VERSION_CODE < 0x020333 MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ @@ -585,7 +585,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -605,7 +605,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -619,7 +619,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -643,7 +643,7 @@ atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - dev->lck_start)]); #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_dma.c linux/drivers/char/drm/mga_dma.c --- v2.4.0-test8/linux/drivers/char/drm/mga_dma.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/mga_dma.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -51,7 +51,7 @@ static unsigned long mga_alloc_page(drm_device_t *dev) { unsigned long address; - + DRM_DEBUG("%s\n", __FUNCTION__); address = __get_free_page(GFP_KERNEL); if(address == 0UL) { @@ -59,7 +59,7 @@ } atomic_inc(&virt_to_page(address)->count); set_bit(PG_locked, &virt_to_page(address)->flags); - + return address; } @@ -82,23 +82,6 @@ return; } -#ifdef __i386__ -void mga_flush_write_combine(void) -{ - int xchangeDummy; - DRM_DEBUG("%s\n", __FUNCTION__); - - __asm__ volatile(" push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy)); - __asm__ volatile(" push %%eax ; push %%ebx ; push %%ecx ; push %%edx ;" - " movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;" - " pop %%eax" : /* no outputs */ : /* no inputs */ ); -} -#else -void mga_flush_write_combine(void) -{ -} -#endif - /* These are two age tags that will never be sent to * the hardware */ #define MGA_BUF_USED 0xffffffff @@ -119,7 +102,7 @@ if(dev_priv->head == NULL) return -ENOMEM; memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); dev_priv->head->age = MGA_BUF_USED; - + for (i = 0; i < dma->buf_count; i++) { buf = dma->buflist[ i ]; buf_priv = buf->dev_private; @@ -139,7 +122,7 @@ buf_priv->dispatched = 0; dev_priv->head->next = item; } - + return 0; } @@ -157,7 +140,7 @@ item = item->next; drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); } - + dev_priv->head = dev_priv->tail = NULL; } @@ -173,15 +156,15 @@ DRM_DEBUG("%s\n", __FUNCTION__); end = jiffies + (HZ*3); while(1) { - if(!test_and_set_bit(MGA_IN_DISPATCH, + if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { break; } if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); + DRM_ERROR("lockup\n"); goto out_nolock; } for (i = 0 ; i < 2000 ; i++) mga_delay(); @@ -190,13 +173,13 @@ DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS)); while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); + DRM_ERROR("lockup\n"); goto out_status; } - for (i = 0 ; i < 2000 ; i++) mga_delay(); + for (i = 0 ; i < 2000 ; i++) mga_delay(); } sarea_priv->dirty |= MGA_DMA_FLUSH; @@ -220,13 +203,13 @@ } /* Least recently used : - * These operations are not atomic b/c they are protected by the + * These operations are not atomic b/c they are protected by the * hardware lock */ drm_buf_t *mga_freelist_get(drm_device_t *dev) { DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; drm_mga_freelist_t *prev; drm_mga_freelist_t *next; @@ -234,17 +217,17 @@ DRM_DEBUG("%s : tail->age : %d last_prim_age : %d\n", __FUNCTION__, dev_priv->tail->age, dev_priv->last_prim_age); - + if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) { - DRM_DEBUG("I'm waiting on the freelist!!! %d\n", + DRM_DEBUG("I'm waiting on the freelist!!! %d\n", dev_priv->last_prim_age); set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); current->state = TASK_INTERRUPTIBLE; add_wait_queue(&dev_priv->buf_queue, &entry); for (;;) { mga_dma_schedule(dev, 0); - if(!test_bit(MGA_IN_GETBUF, - &dev_priv->dispatch_status)) + if(!test_bit(MGA_IN_GETBUF, + &dev_priv->dispatch_status)) break; atomic_inc(&dev->total_sleeps); schedule(); @@ -257,7 +240,7 @@ current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->buf_queue, &entry); } - + if(dev_priv->tail->age < dev_priv->last_prim_age) { prev = dev_priv->tail->prev; next = dev_priv->tail; @@ -276,7 +259,7 @@ int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf) { - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_freelist_t *prev; @@ -307,7 +290,7 @@ next->prev = head; next->next = prev; } - + return 0; } @@ -319,41 +302,41 @@ int offset = init->reserved_map_agpstart; DRM_DEBUG("%s\n", __FUNCTION__); - dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / + dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; size_of_buf = dev_priv->primary_size / MGA_NUM_PRIM_BUFS; dev_priv->warp_ucode_size = init->warp_ucode_size; - dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * - (MGA_NUM_PRIM_BUFS + 1), + dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * + (MGA_NUM_PRIM_BUFS + 1), DRM_MEM_DRIVER); if(dev_priv->prim_bufs == NULL) { DRM_ERROR("Unable to allocate memory for prim_buf\n"); return -ENOMEM; } - memset(dev_priv->prim_bufs, + memset(dev_priv->prim_bufs, 0, sizeof(drm_mga_prim_buf_t *) * (MGA_NUM_PRIM_BUFS + 1)); - + temp = init->warp_ucode_size + dev_priv->primary_size; temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; - - dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, + + dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, temp); if(dev_priv->ioremap == NULL) { DRM_DEBUG("Ioremap failed\n"); return -ENOMEM; } init_waitqueue_head(&dev_priv->wait_queue); - + for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), + prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), DRM_MEM_DRIVER); if(prim_buffer == NULL) return -ENOMEM; memset(prim_buffer, 0, sizeof(drm_mga_prim_buf_t)); prim_buffer->phys_head = offset + dev->agp->base; - prim_buffer->current_dma_ptr = - prim_buffer->head = - (u32 *) (dev_priv->ioremap + - offset - + prim_buffer->current_dma_ptr = + prim_buffer->head = + (u32 *) (dev_priv->ioremap + + offset - init->reserved_map_agpstart); prim_buffer->num_dwords = 0; prim_buffer->max_dwords = size_of_buf / sizeof(u32); @@ -365,11 +348,11 @@ dev_priv->prim_bufs[i] = prim_buffer; } dev_priv->current_prim_idx = 0; - dev_priv->next_prim = - dev_priv->last_prim = + dev_priv->next_prim = + dev_priv->last_prim = dev_priv->current_prim = dev_priv->prim_bufs[0]; - dev_priv->next_prim_age = 2; + dev_priv->next_prim_age = 2; dev_priv->last_prim_age = 1; set_bit(MGA_BUF_IN_USE, &dev_priv->current_prim->buffer_status); return 0; @@ -388,11 +371,11 @@ DRM_DEBUG("%s\n", __FUNCTION__); dev_priv->last_prim = prim; - + /* We never check for overflow, b/c there is always room */ PRIMPTR(prim); if(num_dwords <= 0) { - DRM_DEBUG("num_dwords == 0 when dispatched\n"); + DRM_ERROR("num_dwords == 0 when dispatched\n"); goto out_prim_wait; } PRIMOUTREG( MGAREG_DMAPAD, 0); @@ -403,17 +386,17 @@ end = jiffies + (HZ*3); if(sarea_priv->dirty & MGA_DMA_FLUSH) { - DRM_DEBUG("Dma top flush\n"); + DRM_DEBUG("Dma top flush\n"); while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup in fire primary " "(Dma Top Flush)\n"); goto out_prim_wait; } - + for (i = 0 ; i < 4096 ; i++) mga_delay(); } sarea_priv->dirty &= ~(MGA_DMA_FLUSH); @@ -421,14 +404,14 @@ DRM_DEBUG("Status wait\n"); while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) { if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), + DRM_ERROR("irqs: %d wanted %d\n", + atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup in fire primary " "(Status Wait)\n"); goto out_prim_wait; } - + for (i = 0 ; i < 4096 ; i++) mga_delay(); } } @@ -439,9 +422,9 @@ MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp); prim->num_dwords = 0; sarea_priv->last_enqueue = prim->prim_age; - + next_idx = prim->idx + 1; - if(next_idx >= MGA_NUM_PRIM_BUFS) + if(next_idx >= MGA_NUM_PRIM_BUFS) next_idx = 0; dev_priv->next_prim = dev_priv->prim_bufs[next_idx]; @@ -464,28 +447,28 @@ drm_device_dma_t *dma = dev->dma; int next_prim_idx; int ret = 0; - + /* This needs to reset the primary buffer if available, * we should collect stats on how many times it bites * it's tail */ DRM_DEBUG("%s\n", __FUNCTION__); - + next_prim_idx = dev_priv->current_prim_idx + 1; if(next_prim_idx >= MGA_NUM_PRIM_BUFS) next_prim_idx = 0; prim_buffer = dev_priv->prim_bufs[next_prim_idx]; set_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - + /* In use is cleared in interrupt handler */ - + if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) { add_wait_queue(&dev_priv->wait_queue, &entry); current->state = TASK_INTERRUPTIBLE; for (;;) { mga_dma_schedule(dev, 0); - if(!test_and_set_bit(MGA_BUF_IN_USE, - &prim_buffer->buffer_status)) + if(!test_and_set_bit(MGA_BUF_IN_USE, + &prim_buffer->buffer_status)) break; atomic_inc(&dev->total_sleeps); atomic_inc(&dma->total_missed_sched); @@ -547,9 +530,9 @@ atomic_inc(&dma->total_prio); return 1; } - + if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { - if(test_bit(MGA_BUF_SWAP_PENDING, + if(test_bit(MGA_BUF_SWAP_PENDING, &dev_priv->next_prim->buffer_status)) { atomic_inc(&dma->total_dmas); return 1; @@ -585,16 +568,16 @@ retval = -EBUSY; goto sch_out_wakeup; } - + DRM_DEBUG("%s\n", __FUNCTION__); - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || + if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || test_bit(MGA_IN_WAIT, &dev_priv->dispatch_status) || test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { locked = 1; } - - if (!locked && + + if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); @@ -608,7 +591,7 @@ /* Fire dma buffer */ if(mga_decide_to_fire(dev)) { DRM_DEBUG("idx :%d\n", dev_priv->next_prim->idx); - clear_bit(MGA_BUF_FORCE_FIRE, + clear_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status); if(dev_priv->current_prim == dev_priv->next_prim) { /* Schedule overflow for a later time */ @@ -622,7 +605,7 @@ } else { DRM_DEBUG("I can't get the dispatch lock\n"); } - + if (!locked) { if (drm_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { @@ -644,8 +627,8 @@ DRM_DEBUG("Waking up buf queue\n"); wake_up_interruptible(&dev_priv->buf_queue); } else if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - DRM_DEBUG("Not waking buf_queue on %d %d\n", - atomic_read(&dev->total_irq), + DRM_DEBUG("Not waking buf_queue on %d %d\n", + atomic_read(&dev->total_irq), dev_priv->last_prim_age); } @@ -666,7 +649,7 @@ last_prim_buffer = dev_priv->last_prim; last_prim_buffer->num_dwords = 0; last_prim_buffer->sec_used = 0; - dev_priv->sarea_priv->last_dispatch = + dev_priv->sarea_priv->last_dispatch = dev_priv->last_prim_age = last_prim_buffer->prim_age; clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); wake_up_interruptible(&dev_priv->wait_queue); @@ -688,12 +671,12 @@ DRM_DEBUG("%s\n", __FUNCTION__); if(dev->dev_private) { - drm_mga_private_t *dev_priv = + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; - + if(dev_priv->ioremap) { - int temp = (dev_priv->warp_ucode_size + - dev_priv->primary_size + + int temp = (dev_priv->warp_ucode_size + + dev_priv->primary_size + PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE; drm_ioremapfree((void *) dev_priv->ioremap, temp); @@ -714,7 +697,7 @@ } } drm_free(dev_priv->prim_bufs, sizeof(void *) * - (MGA_NUM_PRIM_BUFS + 1), + (MGA_NUM_PRIM_BUFS + 1), DRM_MEM_DRIVER); } if(dev_priv->head != NULL) { @@ -722,7 +705,7 @@ } - drm_free(dev->dev_private, sizeof(drm_mga_private_t), + drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; } @@ -749,12 +732,12 @@ DRM_DEBUG("reserved_map or buffer_map are invalid\n"); return -EINVAL; } - + dev_priv->reserved_map_idx = init->reserved_map_idx; dev_priv->buffer_map_idx = init->buffer_map_idx; sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_mga_sarea_t *) - ((u8 *)sarea_map->handle + + dev_priv->sarea_priv = (drm_mga_sarea_t *) + ((u8 *)sarea_map->handle + init->sarea_priv_offset); /* Scale primary size to the next page */ @@ -772,20 +755,21 @@ init_waitqueue_head(&dev_priv->flush_queue); init_waitqueue_head(&dev_priv->buf_queue); dev_priv->WarpPipe = 0xff000000; + dev_priv->vertexsize = 0; DRM_DEBUG("chipset: %d ucode_size: %d backOffset: %x depthOffset: %x\n", - dev_priv->chipset, dev_priv->warp_ucode_size, + dev_priv->chipset, dev_priv->warp_ucode_size, dev_priv->backOffset, dev_priv->depthOffset); DRM_DEBUG("cpp: %d sgram: %d stride: %d maccess: %x\n", - dev_priv->cpp, dev_priv->sgram, dev_priv->stride, + dev_priv->cpp, dev_priv->sgram, dev_priv->stride, dev_priv->mAccess); - - memcpy(&dev_priv->WarpIndex, &init->WarpIndex, + + memcpy(&dev_priv->WarpIndex, &init->WarpIndex, sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) + for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) DRM_DEBUG("warp pipe %d: installed: %d phys: %lx size: %x\n", - i, + i, dev_priv->WarpIndex[i].installed, dev_priv->WarpIndex[i].phys_addr, dev_priv->WarpIndex[i].size); @@ -802,7 +786,7 @@ return -ENOMEM; } - dev_priv->status_page = + dev_priv->status_page = ioremap_nocache(virt_to_bus((void *)dev_priv->real_status_page), PAGE_SIZE); @@ -813,15 +797,15 @@ } /* Write status page when secend or softrap occurs */ - MGA_WRITE(MGAREG_PRIMPTR, + MGA_WRITE(MGAREG_PRIMPTR, virt_to_bus((void *)dev_priv->real_status_page) | 0x00000003); - + /* Private is now filled in, initialize the hardware */ { PRIMLOCALS; PRIMGETPTR( dev_priv ); - + PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0x0100); @@ -829,13 +813,13 @@ /* Poll for the first buffer to insure that * the status register will be correct */ - + mga_flush_write_combine(); MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); - MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | + MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | PDEA_pagpxfer_enable)); - + while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ; } @@ -853,12 +837,12 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_mga_init_t init; - + DRM_DEBUG("%s\n", __FUNCTION__); if (copy_from_user(&init, (drm_mga_init_t *)arg, sizeof(init))) return -EFAULT; - + switch(init.func) { case MGA_INIT_DMA: return mga_dma_initialize(dev, &init); @@ -874,7 +858,7 @@ int retcode; if (!irq) return -EINVAL; - + down(&dev->struct_sem); if (dev->irq) { up(&dev->struct_sem); @@ -882,7 +866,7 @@ } dev->irq = irq; up(&dev->struct_sem); - + DRM_DEBUG("install irq handler %d\n", irq); dev->context_flag = 0; @@ -923,7 +907,7 @@ irq = dev->irq; dev->irq = 0; up(&dev->struct_sem); - + if (!irq) return -EINVAL; DRM_DEBUG("remove irq handler %d\n", irq); MGA_WRITE(MGAREG_ICLEAR, 0x00000001); @@ -938,7 +922,7 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_control_t ctl; - + if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) return -EFAULT; @@ -965,21 +949,21 @@ if(dev_priv == NULL) { return 0; } - + if(dev_priv->next_prim->num_dwords != 0) { current->state = TASK_INTERRUPTIBLE; add_wait_queue(&dev_priv->flush_queue, &entry); set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); mga_dma_schedule(dev, 0); for (;;) { - if (!test_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status)) + if (!test_bit(MGA_IN_FLUSH, + &dev_priv->dispatch_status)) break; atomic_inc(&dev->total_sleeps); schedule(); if (signal_pending(current)) { ret = -EINTR; /* Can't restart */ - clear_bit(MGA_IN_FLUSH, + clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); break; } @@ -1007,11 +991,11 @@ drm_buf_t *buf = dma->buflist[ i ]; drm_mga_buf_priv_t *buf_priv = buf->dev_private; - /* Only buffers that need to get reclaimed ever - * get set to free + /* Only buffers that need to get reclaimed ever + * get set to free */ if (buf->pid == pid && buf_priv) { - if(buf_priv->my_freelist->age == MGA_BUF_USED) + if(buf_priv->my_freelist->age == MGA_BUF_USED) buf_priv->my_freelist->age = MGA_BUF_FREE; } } @@ -1035,7 +1019,7 @@ current->pid, lock.context); return -EINVAL; } - + DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", lock.context, current->pid, dev->lock.hw_lock->lock, lock.flags); @@ -1043,7 +1027,7 @@ if (lock.context < 0) { return -EINVAL; } - + /* Only one queue: */ @@ -1062,7 +1046,7 @@ atomic_inc(&dev->total_locks); break; /* Got lock */ } - + /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -1075,7 +1059,7 @@ current->state = TASK_RUNNING; remove_wait_queue(&dev->lock.lock_queue, &entry); } - + if (!ret) { sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); @@ -1092,12 +1076,12 @@ mga_dma_quiescent(dev); } } - + DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); return ret; } - -int mga_flush_ioctl(struct inode *inode, struct file *filp, + +int mga_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drm.h linux/drivers/char/drm/mga_drm.h --- v2.4.0-test8/linux/drivers/char/drm/mga_drm.h Fri Jul 21 12:56:44 2000 +++ linux/drivers/char/drm/mga_drm.h Fri Sep 15 14:24:55 2000 @@ -73,17 +73,19 @@ /* 3d state excluding texture units: */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTX_SETUP_SIZE 10 +#define MGA_CTXREG_DSTORG 0 /* validated */ +#define MGA_CTXREG_MACCESS 1 +#define MGA_CTXREG_PLNWT 2 +#define MGA_CTXREG_DWGCTL 3 +#define MGA_CTXREG_ALPHACTRL 4 +#define MGA_CTXREG_FOGCOLOR 5 +#define MGA_CTXREG_WFLAG 6 +#define MGA_CTXREG_TDUAL0 7 +#define MGA_CTXREG_TDUAL1 8 +#define MGA_CTXREG_FCOL 9 +#define MGA_CTXREG_STENCIL 10 +#define MGA_CTXREG_STENCILCTL 11 +#define MGA_CTX_SETUP_SIZE 12 /* 2d state */ @@ -233,6 +235,7 @@ /* Mechanism to validate card state. */ int ctxOwner; + int vertexsize; } drm_mga_sarea_t; /* Device specific ioctls: @@ -241,6 +244,8 @@ unsigned int clear_color; unsigned int clear_depth; unsigned int flags; + unsigned int clear_depth_mask; + unsigned int clear_color_mask; } drm_mga_clear_t; typedef struct _drm_mga_swap { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drv.c linux/drivers/char/drm/mga_drv.c --- v2.4.0-test8/linux/drivers/char/drm/mga_drv.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/mga_drv.c Fri Sep 15 14:24:55 2000 @@ -1,6 +1,6 @@ /* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * + * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -35,9 +35,9 @@ #include "mga_drv.h" #define MGA_NAME "mga" -#define MGA_DESC "Matrox g200/g400" -#define MGA_DATE "20000719" -#define MGA_MAJOR 1 +#define MGA_DESC "Matrox G200/G400" +#define MGA_DATE "20000910" +#define MGA_MAJOR 2 #define MGA_MINOR 0 #define MGA_PATCHLEVEL 0 @@ -123,7 +123,7 @@ #endif MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Matrox g200/g400"); +MODULE_DESCRIPTION("Matrox G200/G400"); MODULE_PARM(mga, "s"); #ifndef MODULE @@ -144,7 +144,7 @@ static int mga_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -187,22 +187,22 @@ dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -217,15 +217,15 @@ DRM_DEBUG("\n"); if (dev->irq) mga_irq_uninstall(dev); - + down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -243,7 +243,7 @@ if (dev->agp) { drm_agp_mem_t *entry; drm_agp_mem_t *nexte; - + /* Remove AGP resources, but leave dev->agp intact until cleanup is called. */ for (entry = dev->agp->memory; entry; entry = nexte) { @@ -253,10 +253,10 @@ drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; - + if (dev->agp->acquired && drm_agp.release) (*drm_agp.release)(); - + dev->agp->acquired = 0; dev->agp->enabled = 0; } @@ -268,7 +268,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -304,7 +304,7 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->queuelist) { for (i = 0; i < dev->queue_count; i++) { drm_waitlist_destroy(&dev->queuelist[i]->waitlist); @@ -330,7 +330,7 @@ wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -347,7 +347,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(mga); #endif @@ -407,7 +407,7 @@ drm_device_t *dev = &mga_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&mga_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -419,7 +419,7 @@ #ifdef CONFIG_MTRR if(dev->agp && dev->agp->agp_mtrr) { int retval; - retval = mtrr_del(dev->agp->agp_mtrr, + retval = mtrr_del(dev->agp->agp_mtrr, dev->agp->agp_info.aper_base, dev->agp->agp_info.aper_size * 1024*1024); DRM_DEBUG("mtrr_del = %d\n", retval); @@ -477,7 +477,7 @@ { drm_device_t *dev = &mga_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -514,7 +514,7 @@ drm_lock_free(dev, &dev->lock.hw_lock->lock, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - + /* FIXME: may require heavy-handed reset of hardware at this point, possibly processed via a callback to the X @@ -535,7 +535,7 @@ dev->lock.lock_time = jiffies; atomic_inc(&dev->total_locks); break; /* Got lock */ - } + } /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -561,7 +561,7 @@ if (priv->next) priv->next->prev = priv->prev; else dev->file_last = priv->prev; up(&dev->struct_sem); - + drm_free(priv, sizeof(*priv), DRM_MEM_FILES); #if LINUX_VERSION_CODE < 0x020333 MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ @@ -602,7 +602,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -622,7 +622,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -636,7 +636,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_drv.h linux/drivers/char/drm/mga_drv.h --- v2.4.0-test8/linux/drivers/char/drm/mga_drv.h Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/mga_drv.h Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -82,6 +82,7 @@ int use_agp; drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; unsigned int WarpPipe; + unsigned int vertexsize; atomic_t pending_bufs; void *status_page; unsigned long real_status_page; @@ -97,7 +98,7 @@ wait_queue_head_t wait_queue; /* Processes waiting until interrupt */ wait_queue_head_t buf_queue; /* Processes waiting for a free buf */ /* Some validated register values: - */ + */ u32 mAccess; } drm_mga_private_t; @@ -128,7 +129,6 @@ extern int mga_dma_cleanup(drm_device_t *dev); extern int mga_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void mga_flush_write_combine(void); extern unsigned int mga_create_sync_tag(drm_device_t *dev); extern drm_buf_t *mga_freelist_get(drm_device_t *dev); extern int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf); @@ -137,9 +137,9 @@ /* mga_bufs.c */ -extern int mga_addbufs(struct inode *inode, struct file *filp, +extern int mga_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int mga_infobufs(struct inode *inode, struct file *filp, +extern int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int mga_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); @@ -179,6 +179,7 @@ extern int mga_context_switch(drm_device_t *dev, int old, int new); extern int mga_context_switch_complete(drm_device_t *dev, int new); +#define mga_flush_write_combine() mb() typedef enum { TT_GENERAL, @@ -201,7 +202,7 @@ #define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) #define ADRINDEX0(r) (u8)((r - DWGREG0) >> 2) #define ADRINDEX1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) +#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) #define MGA_VERBOSE 0 #define MGA_NUM_PRIM_BUFS 8 @@ -212,13 +213,12 @@ #define PRIM_OVERFLOW(dev, dev_priv, length) do { \ drm_mga_prim_buf_t *tmp_buf = \ dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if( test_bit(MGA_BUF_NEEDS_OVERFLOW, \ - &tmp_buf->buffer_status)) { \ + if( test_bit(MGA_BUF_NEEDS_OVERFLOW, &tmp_buf->buffer_status)) { \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length || \ - tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ + tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ @@ -295,7 +295,7 @@ num_dwords + 1 + outcount, ADRINDEX(reg), val); \ if( ++outcount == 4) { \ outcount = 0; \ - dma_ptr[0] = *(u32 *)tempIndex; \ + dma_ptr[0] = *(unsigned long *)tempIndex; \ dma_ptr+=5; \ num_dwords += 5; \ } \ @@ -396,8 +396,8 @@ #define DC_atype_zi 0x30 #define DC_atype_blk 0x40 #define DC_atype_i 0x70 -#define DC_linear_xy 0x0 -#define DC_linear_linear 0x80 +#define DC_linear_xy 0x0 +#define DC_linear_linear 0x80 #define DC_zmode_nozcmp 0x0 #define DC_zmode_ze 0x200 #define DC_zmode_zne 0x300 @@ -405,16 +405,16 @@ #define DC_zmode_zlte 0x500 #define DC_zmode_zgt 0x600 #define DC_zmode_zgte 0x700 -#define DC_solid_disable 0x0 -#define DC_solid_enable 0x800 -#define DC_arzero_disable 0x0 -#define DC_arzero_enable 0x1000 -#define DC_sgnzero_disable 0x0 -#define DC_sgnzero_enable 0x2000 -#define DC_shftzero_disable 0x0 -#define DC_shftzero_enable 0x4000 -#define DC_bop_SHIFT 16 -#define DC_trans_SHIFT 20 +#define DC_solid_disable 0x0 +#define DC_solid_enable 0x800 +#define DC_arzero_disable 0x0 +#define DC_arzero_enable 0x1000 +#define DC_sgnzero_disable 0x0 +#define DC_sgnzero_enable 0x2000 +#define DC_shftzero_disable 0x0 +#define DC_shftzero_enable 0x4000 +#define DC_bop_SHIFT 16 +#define DC_trans_SHIFT 20 #define DC_bltmod_bmonolef 0x0 #define DC_bltmod_bmonowf 0x8000000 #define DC_bltmod_bplan 0x2000000 @@ -423,21 +423,21 @@ #define DC_bltmod_bu32rgb 0xe000000 #define DC_bltmod_bu24bgr 0x16000000 #define DC_bltmod_bu24rgb 0x1e000000 -#define DC_pattern_disable 0x0 -#define DC_pattern_enable 0x20000000 -#define DC_transc_disable 0x0 -#define DC_transc_enable 0x40000000 -#define DC_clipdis_disable 0x0 -#define DC_clipdis_enable 0x80000000 +#define DC_pattern_disable 0x0 +#define DC_pattern_enable 0x20000000 +#define DC_transc_disable 0x0 +#define DC_transc_enable 0x40000000 +#define DC_clipdis_disable 0x0 +#define DC_clipdis_enable 0x80000000 -#define SETADD_mode_vertlist 0x0 +#define SETADD_mode_vertlist 0x0 #define MGA_CLEAR_CMD (DC_opcod_trap | DC_arzero_enable | \ DC_sgnzero_enable | DC_shftzero_enable | \ (0xC << DC_bop_SHIFT) | DC_clipdis_enable | \ DC_solid_enable | DC_transc_enable) - + #define MGA_COPY_CMD (DC_opcod_bitblt | DC_atype_rpl | DC_linear_xy | \ DC_solid_disable | DC_arzero_disable | \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/mga_state.c linux/drivers/char/drm/mga_state.c --- v2.4.0-test8/linux/drivers/char/drm/mga_state.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/mga_state.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -38,13 +38,13 @@ * change these values */ -#define MGAEMITCLIP_SIZE 10 -#define MGAEMITCTX_SIZE 15 -#define MGAG200EMITTEX_SIZE 20 -#define MGAG400EMITTEX0_SIZE 30 -#define MGAG400EMITTEX1_SIZE 25 -#define MGAG400EMITPIPE_SIZE 50 -#define MGAG200EMITPIPE_SIZE 15 +#define MGAEMITCLIP_SIZE 10 +#define MGAEMITCTX_SIZE 20 +#define MGAG200EMITTEX_SIZE 20 +#define MGAG400EMITTEX0_SIZE 30 +#define MGAG400EMITTEX1_SIZE 25 +#define MGAG400EMITPIPE_SIZE 55 +#define MGAG200EMITPIPE_SIZE 15 #define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ @@ -89,7 +89,7 @@ PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - /* This takes a max of 15 dwords */ + /* This takes a max of 20 dwords */ PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); @@ -107,6 +107,11 @@ PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + + PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); + PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); } else { PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -151,11 +156,13 @@ PRIMADVANCE(dev_priv); } +#define TMC_dualtex_enable 0x80 + static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; - int multitex = sarea_priv->WarpPipe & MGA_T2; + int multitex = regs[MGA_TEXREG_CTL2] & TMC_dualtex_enable; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -183,7 +190,7 @@ PRIMOUTREG(0x2d00 + 61 * 4, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (!multitex) { + if (!multitex || 1) { PRIMOUTREG(0x2d00 + 52 * 4, 0x40); PRIMOUTREG(0x2d00 + 60 * 4, 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -200,10 +207,10 @@ #define TMC_map1_enable 0x80000000 -static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) +static void mgaG400EmitTex1(drm_mga_private_t * dev_priv, int source ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[1]; + unsigned int *regs = sarea_priv->TexState[source]; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -245,6 +252,8 @@ drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; float fParam = 12800.0f; + int multitex = (sarea_priv->TexState[0][MGA_TEXREG_CTL2] & + TMC_dualtex_enable); PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -252,14 +261,36 @@ /* This takes 50 dwords */ - /* Establish vertex size. + /* Establish vertex size. */ PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (pipe & MGA_T2) { + if (sarea_priv->vertexsize == 10) { + PRIMOUTREG(MGAREG_YDST, 0); + PRIMOUTREG(MGAREG_FXLEFT, 0); + PRIMOUTREG(MGAREG_FXRIGHT, 1); + PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); + + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + if (multitex) { + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + } else { + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + } + PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -270,23 +301,21 @@ PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000); } else { - if (dev_priv->WarpPipe & MGA_T2) { - /* Flush the WARP pipe */ - PRIMOUTREG(MGAREG_YDST, 0); - PRIMOUTREG(MGAREG_FXLEFT, 0); - PRIMOUTREG(MGAREG_FXRIGHT, 1); - PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); + /* Flush the WARP pipe */ + PRIMOUTREG(MGAREG_YDST, 0); + PRIMOUTREG(MGAREG_FXLEFT, 0); + PRIMOUTREG(MGAREG_FXRIGHT, 1); + PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - } + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -314,13 +343,16 @@ PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */ PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */ - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR2, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); + if (dev_priv->WarpPipe != pipe || 1) { + /* Dma pading required due to hw bug */ + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_WIADDR2, + (u32) (dev_priv->WarpIndex[pipe].phys_addr | + WIA_wmode_start | WIA_wagp_agp)); + } + PRIMADVANCE(dev_priv); } @@ -363,11 +395,20 @@ DRM_DEBUG("%s\n", __FUNCTION__); if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - int multitex = sarea_priv->WarpPipe & MGA_T2; + int multitex = (sarea_priv->TexState[0][MGA_TEXREG_CTL2] & + TMC_dualtex_enable); - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { + dirty = ~0; + + if (dirty & MGA_UPLOAD_PIPE +/* && (sarea_priv->WarpPipe != dev_priv->WarpPipe || */ +/* sarea_priv->vertexsize != dev_priv->vertexsize) */ + ) + { mgaG400EmitPipe(dev_priv); dev_priv->WarpPipe = sarea_priv->WarpPipe; + dev_priv->vertexsize = sarea_priv->vertexsize; + sarea_priv->dirty &= ~MGA_UPLOAD_PIPE; } if (dirty & MGA_UPLOAD_CTX) { @@ -380,8 +421,11 @@ sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; } - if ((dirty & MGA_UPLOAD_TEX1) && multitex) { - mgaG400EmitTex1(dev_priv); + if (dirty & MGA_UPLOAD_TEX1) { + if (multitex) + mgaG400EmitTex1(dev_priv, 1); + else + mgaG400EmitTex1(dev_priv, 0); sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; } } else { @@ -552,12 +596,15 @@ if (buf->used) { /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). + * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; PRIM_OVERFLOW(dev, dev_priv, (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); mgaEmitState(dev_priv); + +/* length = dev_priv->vertexsize * 3 * 4; */ + do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" @@ -614,7 +661,7 @@ if (start != end) { /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). + * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; PRIM_OVERFLOW(dev, dev_priv, @@ -644,6 +691,7 @@ SETADD_mode_vertlist)); PRIMOUTREG(MGAREG_SETUPEND, ((address + end) | use_agp)); +/* ((address + start + 12) | use_agp)); */ PRIMADVANCE(dev_priv); } while (++i < sarea_priv->nbox); } @@ -658,7 +706,9 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, unsigned int clear_color, - unsigned int clear_zval) + unsigned int clear_zval, + unsigned int clear_colormask, + unsigned int clear_depthmask) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -687,7 +737,7 @@ if (flags & MGA_FRONT) { DRM_DEBUG("clear front\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -702,7 +752,7 @@ if (flags & MGA_BACK) { DRM_DEBUG("clear back\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -717,7 +767,7 @@ if (flags & MGA_DEPTH) { DRM_DEBUG("clear depth\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -818,7 +868,10 @@ */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, clear.clear_depth); + clear.clear_color, + clear.clear_depth, + clear.clear_color_mask, + clear.clear_depth_mask); PRIMUPDATE(dev_priv); mga_flush_write_combine(); mga_dma_schedule(dev, 1); @@ -1012,8 +1065,9 @@ break; buf->pid = current->pid; if (copy_to_user(&d->request_indices[i], - &buf->idx, sizeof(buf->idx)) || - copy_to_user(&d->request_sizes[i], + &buf->idx, sizeof(buf->idx))) + return -EFAULT; + if (copy_to_user(&d->request_sizes[i], &buf->total, sizeof(buf->total))) return -EFAULT; ++d->granted_count; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/picker.c linux/drivers/char/drm/picker.c --- v2.4.0-test8/linux/drivers/char/drm/picker.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/drm/picker.c Fri Sep 15 21:37:23 2000 @@ -0,0 +1,29 @@ +#include +#include + +#ifndef CONFIG_SMP +#define CONFIG_SMP 0 +#endif + +#ifndef CONFIG_MODVERSIONS +#define CONFIG_MODVERSIONS 0 +#endif + +#ifndef CONFIG_AGP_MODULE +#define CONFIG_AGP_MODULE 0 +#endif + +#ifndef CONFIG_AGP +#define CONFIG_AGP 0 +#endif + +#ifndef CONFIG_FB_SIS +#define CONFIG_FB_SIS 0 +#endif + +SMP = CONFIG_SMP +MODVERSIONS = CONFIG_MODVERSIONS +AGP = CONFIG_AGP +AGP_MODULE = CONFIG_AGP_MODULE +RELEASE = UTS_RELEASE +SIS = CONFIG_FB_SIS diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/r128_dma.c linux/drivers/char/drm/r128_dma.c --- v2.4.0-test8/linux/drivers/char/drm/r128_dma.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/r128_dma.c Fri Sep 15 14:24:55 2000 @@ -68,30 +68,8 @@ return R128_READ(R128_CLOCK_CNTL_DATA); } -#ifdef __i386__ -static void r128_flush_write_combine(void) -{ - int xchangeDummy; +#define r128_flush_write_combine() mb() - __asm__ volatile("push %%eax ;" - "xchg %%eax, %0 ;" - "pop %%eax" : : "m" (xchangeDummy)); - __asm__ volatile("push %%eax ;" - "push %%ebx ;" - "push %%ecx ;" - "push %%edx ;" - "movl $0,%%eax ;" - "cpuid ;" - "pop %%edx ;" - "pop %%ecx ;" - "pop %%ebx ;" - "pop %%eax" : /* no outputs */ : /* no inputs */ ); -} -#else -static void r128_flush_write_combine(void) -{ -} -#endif static void r128_status(drm_device_t *dev) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/r128_drv.c linux/drivers/char/drm/r128_drv.c --- v2.4.0-test8/linux/drivers/char/drm/r128_drv.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/char/drm/r128_drv.c Fri Sep 15 14:24:55 2000 @@ -35,7 +35,7 @@ #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" -#define R128_DATE "20000719" +#define R128_DATE "20000910" #define R128_MAJOR 1 #define R128_MINOR 0 #define R128_PATCHLEVEL 0 @@ -467,7 +467,7 @@ } spin_unlock(&dev->count_lock); } - + return retcode; } @@ -501,7 +501,7 @@ } spin_unlock(&dev->count_lock); } - + unlock_kernel(); return retcode; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/tdfx_drv.c linux/drivers/char/drm/tdfx_drv.c --- v2.4.0-test8/linux/drivers/char/drm/tdfx_drv.c Tue Aug 29 21:09:10 2000 +++ linux/drivers/char/drm/tdfx_drv.c Fri Sep 15 14:24:55 2000 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,7 +23,7 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith * Daryll Strauss @@ -36,7 +36,7 @@ #define TDFX_NAME "tdfx" #define TDFX_DESC "3dfx Banshee/Voodoo3+" -#define TDFX_DATE "20000719" +#define TDFX_DATE "20000910" #define TDFX_MAJOR 1 #define TDFX_MINOR 0 #define TDFX_PATCHLEVEL 0 @@ -76,7 +76,7 @@ [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { tdfx_addctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 }, @@ -128,7 +128,7 @@ static int tdfx_setup(drm_device_t *dev) { int i; - + atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); dev->buf_use = 0; @@ -170,7 +170,7 @@ dev->ctx_start = 0; dev->lck_start = 0; - + dev->buf_rp = dev->buf; dev->buf_wp = dev->buf; dev->buf_end = dev->buf + DRM_BSZ; @@ -179,15 +179,15 @@ init_waitqueue_head(&dev->buf_writers); tdfx_res_ctx.handle=-1; - + DRM_DEBUG("\n"); - + /* The kernel's context could be created here, but is now created in drm_dma_enqueue. This is more resource-efficient for hardware that does not do DMA, but may mean that drm_select_queue fails between the time the interrupt is initialized and the time the queues are initialized. */ - + return 0; } @@ -203,12 +203,12 @@ down(&dev->struct_sem); del_timer(&dev->timer); - + if (dev->devname) { drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); dev->devname = NULL; } - + if (dev->unique) { drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); dev->unique = NULL; @@ -227,7 +227,7 @@ if (dev->agp) { drm_agp_mem_t *temp; drm_agp_mem_t *temp_next; - + temp = dev->agp->memory; while(temp != NULL) { temp_next = temp->next; @@ -246,7 +246,7 @@ } dev->vmalist = NULL; } - + /* Clear map area and mtrr information */ if (dev->maplist) { for (i = 0; i < dev->map_count; i++) { @@ -284,14 +284,14 @@ dev->maplist = NULL; dev->map_count = 0; } - + if (dev->lock.hw_lock) { dev->lock.hw_lock = NULL; /* SHM removed */ dev->lock.pid = 0; wake_up_interruptible(&dev->lock.lock_queue); } up(&dev->struct_sem); - + return 0; } @@ -308,7 +308,7 @@ memset((void *)dev, 0, sizeof(*dev)); dev->count_lock = SPIN_LOCK_UNLOCKED; sema_init(&dev->struct_sem, 1); - + #ifdef MODULE drm_parse_options(tdfx); #endif @@ -340,7 +340,7 @@ TDFX_PATCHLEVEL, TDFX_DATE, tdfx_misc.minor); - + return 0; } @@ -351,7 +351,7 @@ drm_device_t *dev = &tdfx_device; DRM_DEBUG("\n"); - + drm_proc_cleanup(); if (misc_deregister(&tdfx_misc)) { DRM_ERROR("Cannot unload module\n"); @@ -412,7 +412,7 @@ { drm_device_t *dev = &tdfx_device; int retcode = 0; - + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { #if LINUX_VERSION_CODE < 0x020333 @@ -480,7 +480,7 @@ atomic_inc(&dev->ioctl_count); atomic_inc(&dev->total_ioctl); ++priv->ioctl_count; - + DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", current->pid, cmd, nr, dev->device, priv->authenticated); @@ -500,7 +500,7 @@ retcode = (func)(inode, filp, cmd, arg); } } - + atomic_dec(&dev->ioctl_count); return retcode; } @@ -538,7 +538,7 @@ if (lock.context < 0 || lock.context >= dev->queue_count) return -EINVAL; #endif - + if (!ret) { #if 0 if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) @@ -550,7 +550,7 @@ /* Can't take lock if we just had it and there is contention. */ DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", - lock.context, current->pid, j, + lock.context, current->pid, j, dev->lock.lock_time, jiffies); current->state = TASK_INTERRUPTIBLE; current->policy |= SCHED_YIELD; @@ -573,7 +573,7 @@ atomic_inc(&dev->total_locks); break; /* Got lock */ } - + /* Contention */ atomic_inc(&dev->total_sleeps); current->state = TASK_INTERRUPTIBLE; @@ -648,7 +648,7 @@ #if DRM_DMA_HISTOGRAM atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); #endif - + return ret; } @@ -662,7 +662,7 @@ if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) return -EFAULT; - + if (lock.context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", current->pid, lock.context); @@ -690,7 +690,7 @@ current->priority = DEF_PRIORITY; } #endif - + unblock_all_signals(); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/efirtc.c linux/drivers/char/efirtc.c --- v2.4.0-test8/linux/drivers/char/efirtc.c Fri Aug 11 19:09:06 2000 +++ linux/drivers/char/efirtc.c Mon Sep 18 14:57:01 2000 @@ -249,7 +249,7 @@ convert_from_efi_time(&eft, &wtime); - return copy_to_user((void *)&ewp->time, &wtime, sizeof(struct rtc_time)); + return copy_to_user((void *)&ewp->time, &wtime, sizeof(struct rtc_time)) ? -EFAULT : 0; } return -EINVAL; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/mem.c linux/drivers/char/mem.c --- v2.4.0-test8/linux/drivers/char/mem.c Wed Jun 21 22:31:01 2000 +++ linux/drivers/char/mem.c Sun Sep 17 09:45:06 2000 @@ -55,9 +55,6 @@ #if defined(CONFIG_ADB) extern void adbdev_init(void); #endif -#ifdef CONFIG_PHONE -extern void telephony_init(void); -#endif static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp, const char * buf, size_t count, loff_t *ppos) @@ -258,25 +255,27 @@ count -= read; } - kbuf = (char *)__get_free_page(GFP_KERNEL); - if (!kbuf) - return -ENOMEM; - while (count > 0) { - int len = count; - - if (len > PAGE_SIZE) - len = PAGE_SIZE; - len = vread(kbuf, (char *)p, len); - if (len && copy_to_user(buf, kbuf, len)) { - free_page((unsigned long)kbuf); - return -EFAULT; + if (count > 0) { + kbuf = (char *)__get_free_page(GFP_KERNEL); + if (!kbuf) + return -ENOMEM; + while (count > 0) { + int len = count; + + if (len > PAGE_SIZE) + len = PAGE_SIZE; + len = vread(kbuf, (char *)p, len); + if (len && copy_to_user(buf, kbuf, len)) { + free_page((unsigned long)kbuf); + return -EFAULT; + } + count -= len; + buf += len; + virtr += len; + p += len; } - count -= len; - buf += len; - virtr += len; - p += len; + free_page((unsigned long)kbuf); } - free_page((unsigned long)kbuf); *ppos = p; return virtr + read; } @@ -666,8 +665,5 @@ #ifdef CONFIG_VIDEO_DEV videodev_init(); #endif -#ifdef CONFIG_PHONE - telephony_init(); -#endif return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/misc.c linux/drivers/char/misc.c --- v2.4.0-test8/linux/drivers/char/misc.c Mon Jul 24 17:04:12 2000 +++ linux/drivers/char/misc.c Mon Sep 18 15:02:03 2000 @@ -81,6 +81,7 @@ extern int pc110pad_init(void); extern int pmu_device_init(void); extern int qpmouse_init(void); +extern int tosh_init(void); static int misc_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *private) @@ -298,6 +299,9 @@ #endif #ifdef CONFIG_SGI streamable_init (); +#endif +#ifdef CONFIG_TOSHIBA + tosh_init(); #endif if (devfs_register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { printk("unable to get major %d for misc devices\n", diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/nvram.c linux/drivers/char/nvram.c --- v2.4.0-test8/linux/drivers/char/nvram.c Sat Aug 26 16:24:58 2000 +++ linux/drivers/char/nvram.c Mon Sep 11 08:41:07 2000 @@ -109,7 +109,7 @@ extern spinlock_t rtc_lock; -static int nvram_open_cnt = 0; /* #times opened */ +static int nvram_open_cnt; /* #times opened */ static int nvram_open_mode; /* special open modes */ #define NVRAM_WRITE 1 /* opened for writing (exclusive) */ #define NVRAM_EXCL 2 /* opened with O_EXCL */ @@ -415,14 +415,29 @@ static int __init nvram_init(void) { + int ret; + /* First test whether the driver should init at all */ if (!CHECK_DRIVER_INIT()) return( -ENXIO ); - printk(KERN_INFO "Non-volatile memory driver v%s\n", NVRAM_VERSION ); - misc_register( &nvram_dev ); - create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL); - return( 0 ); + ret = misc_register( &nvram_dev ); + if (ret) { + printk(KERN_ERR "nvram: can't misc_register on minor=%d\n", NVRAM_MINOR); + goto out; + } + if (!create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL)) { + printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n"); + ret = -ENOMEM; + goto outmisc; + } + ret = 0; + printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n"); +out: + return( ret ); +outmisc: + misc_deregister( &nvram_dev ); + goto out; } static void __exit nvram_cleanup_module (void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/nwflash.c linux/drivers/char/nwflash.c --- v2.4.0-test8/linux/drivers/char/nwflash.c Sun Aug 13 09:54:15 2000 +++ linux/drivers/char/nwflash.c Mon Sep 18 15:15:22 2000 @@ -1,6 +1,9 @@ /* * Flash memory interface rev.5 driver for the Intel * Flash chips used on the NetWinder. + * + * 20/08/2000 RMK use __ioremap to map flash into virtual memory + * make a few more places use "volatile" */ #include @@ -15,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -33,7 +36,7 @@ #define MSTATIC #endif -#define NWFLASH_VERSION "6.2" +#define NWFLASH_VERSION "6.3" MSTATIC void kick_open(void); MSTATIC int get_flash_id(void); @@ -54,6 +57,7 @@ static int gbWriteEnable; static int gbWriteBase64Enable; +static volatile unsigned char *FLASH_BASE; MSTATIC int gbFlashSize = KFLASH_SIZE; extern spinlock_t gpio_lock; @@ -93,25 +97,25 @@ */ kick_open(); c2 = inb(0x80); - *(unsigned char *) (FLASH_BASE + 0x8000) = 0x90; + *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0x90; udelay(15); - c1 = *(unsigned char *) FLASH_BASE; + c1 = *(volatile unsigned char *) FLASH_BASE; c2 = inb(0x80); /* * on 4 Meg flash the second byte is actually at offset 2... */ if (c1 == 0xB0) - c2 = *(unsigned char *) (FLASH_BASE + 2); + c2 = *(volatile unsigned char *) (FLASH_BASE + 2); else - c2 = *(unsigned char *) (FLASH_BASE + 1); + c2 = *(volatile unsigned char *) (FLASH_BASE + 1); c2 += (c1 << 8); /* * set it back to read mode */ - *(unsigned char *) (FLASH_BASE + 0x8000) = 0xFF; + *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0xFF; if (c2 == KFLASH_ID4) gbFlashSize = KFLASH_SIZE4; @@ -177,14 +181,9 @@ if (count > gbFlashSize - p) count = gbFlashSize - p; - /* - * flash virtual address - */ - p += FLASH_BASE; - read = 0; - if (copy_to_user(buf, (void *) p, count)) + if (copy_to_user(buf, (void *)(FLASH_BASE + p), count)) return -EFAULT; read += count; file->f_pos += read; @@ -193,15 +192,15 @@ static ssize_t flash_write(struct file *file, const char *buf, size_t count, loff_t * ppos) { + struct inode *inode = file->f_dentry->d_inode; unsigned long p = file->f_pos; int written; int nBlock, temp, rc; int i, j; - if (flashdebug) - printk("Flash_dev: flash_write: offset=0x%X, buffer=0x%X, count=0x%X.\n", - (unsigned int) p, (unsigned int) buf, count); + printk("flash_write: offset=0x%lX, buffer=0x%p, count=0x%X.\n", + p, buf, count); if (!gbWriteEnable) return -EINVAL; @@ -209,20 +208,25 @@ if (p < 64 * 1024 && (!gbWriteBase64Enable)) return -EINVAL; - if (count < 0) - return -EINVAL; - /* - * if write size to big - error! + * if byte count is -ve or to big - error! */ - if (count > gbFlashSize - p) + if (count < 0 || count > gbFlashSize - p) return -EINVAL; - if (verify_area(VERIFY_READ, buf, count)) return -EFAULT; + /* + * We now should lock around writes. Really, we shouldn't + * allow the flash to be opened more than once in write + * mode though (note that you can't stop two processes having + * it open even then). --rmk + */ + if (down_interruptible(&inode->i_sem)) + return -ERESTARTSYS; + written = 0; leds_event(led_claim); @@ -310,6 +314,8 @@ */ leds_event(led_release); + up(&inode->i_sem); + return written; } @@ -586,7 +592,7 @@ if (time_before(jiffies, timeout)) { if (flashdebug) printk("FlashWrite: Retrying write (addr=0x%X)...\n", - (unsigned int) pWritePtr - FLASH_BASE); + pWritePtr - FLASH_BASE); /* * no LED == waiting @@ -604,7 +610,7 @@ goto WriteRetry; } else { printk("Timeout in flash write! (addr=0x%X) Aborting...\n", - (unsigned int) pWritePtr - FLASH_BASE); + pWritePtr - FLASH_BASE); /* * return error -2 */ @@ -666,6 +672,10 @@ if (machine_is_netwinder()) { int id; + FLASH_BASE = __ioremap(DC21285_FLASH, KFLASH_SIZE4, 0); + if (!FLASH_BASE) + goto out; + id = get_flash_id(); printk("Flash ROM driver v.%s, flash device ID 0x%04X, size %d Mb.\n", NWFLASH_VERSION, id, gbFlashSize / (1024 * 1024)); @@ -674,13 +684,14 @@ ret = 0; } - +out: return ret; } MSTATIC void __exit nwflash_exit(void) { misc_deregister(&flash_miscdev); + iounmap((void *)FLASH_BASE); } EXPORT_NO_SYMBOLS; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/serial_amba.c linux/drivers/char/serial_amba.c --- v2.4.0-test8/linux/drivers/char/serial_amba.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/serial_amba.c Mon Sep 18 15:15:22 2000 @@ -0,0 +1,2030 @@ +/* + * linux/drivers/char/serial_amba.c + * + * Driver for AMBA serial ports + * + * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. + * + * Copyright 1999 ARM Limited + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * + * 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 + * + * + * This is a generic driver for ARM AMBA-type serial ports. They + * have a lot of 16550-like features, but are not register compatable. + * Note that although they do have CTS, DCD and DSR inputs, they do + * not have an RI input, nor do they have DTR or RTS outputs. If + * required, these have to be supplied via some other means (eg, GPIO) + * and hooked into this driver. + * + * This could very easily become a generic serial driver for dumb UARTs + * (eg, {82,16x}50, 21285, SA1100). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define SERIAL_AMBA_NAME "ttyAM" +#define SERIAL_AMBA_MAJOR 204 +#define SERIAL_AMBA_MINOR 16 +#define SERIAL_AMBA_NR 2 + +#define CALLOUT_AMBA_NAME "cuaam" +#define CALLOUT_AMBA_MAJOR 205 +#define CALLOUT_AMBA_MINOR 16 +#define CALLOUT_AMBA_NR SERIAL_AMBA_NR + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#define DEBUG 0 +#define DEBUG_LEDS 0 + +#if DEBUG_LEDS +extern int get_leds(void); +extern int set_leds(int); +#endif + +/* + * Access routines for the AMBA UARTs + */ +#define UART_GET_INT_STATUS(p) IO_READ((p)->uart_base + AMBA_UARTIIR) +#define UART_GET_FR(p) IO_READ((p)->uart_base + AMBA_UARTFR) +#define UART_GET_CHAR(p) IO_READ((p)->uart_base + AMBA_UARTDR) +#define UART_PUT_CHAR(p, c) IO_WRITE((p)->uart_base + AMBA_UARTDR, (c)) +#define UART_GET_RSR(p) IO_READ((p)->uart_base + AMBA_UARTRSR) +#define UART_GET_CR(p) IO_READ((p)->uart_base + AMBA_UARTCR) +#define UART_PUT_CR(p,c) IO_WRITE((p)->uart_base + AMBA_UARTCR, (c)) +#define UART_GET_LCRL(p) IO_READ((p)->uart_base + AMBA_UARTLCR_L) +#define UART_PUT_LCRL(p,c) IO_WRITE((p)->uart_base + AMBA_UARTLCR_L, (c)) +#define UART_GET_LCRM(p) IO_READ((p)->uart_base + AMBA_UARTLCR_M) +#define UART_PUT_LCRM(p,c) IO_WRITE((p)->uart_base + AMBA_UARTLCR_M, (c)) +#define UART_GET_LCRH(p) IO_READ((p)->uart_base + AMBA_UARTLCR_H) +#define UART_PUT_LCRH(p,c) IO_WRITE((p)->uart_base + AMBA_UARTLCR_H, (c)) +#define UART_RX_DATA(s) (((s) & AMBA_UARTFR_RXFE) == 0) +#define UART_TX_READY(s) (((s) & AMBA_UARTFR_TXFF) == 0) +#define UART_TX_EMPTY(p) ((UART_GET_FR(p) & AMBA_UARTFR_TMSK) == 0) + +#define AMBA_UARTRSR_ANY (AMBA_UARTRSR_OE|AMBA_UARTRSR_BE|AMBA_UARTRSR_PE|AMBA_UARTRSR_FE) +#define AMBA_UARTFR_MODEM_ANY (AMBA_UARTFR_DCD|AMBA_UARTFR_DSR|AMBA_UARTFR_CTS) + +/* + * Things needed by tty driver + */ +static struct tty_driver ambanormal_driver, ambacallout_driver; +static int ambauart_refcount; +static struct tty_struct *ambauart_table[SERIAL_AMBA_NR]; +static struct termios *ambauart_termios[SERIAL_AMBA_NR]; +static struct termios *ambauart_termios_locked[SERIAL_AMBA_NR]; + +#if defined(CONFIG_SERIAL_AMBA_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + +/* + * Things needed internally to this driver + */ + +/* + * tmp_buf is used as a temporary buffer by serial_write. We need to + * lock it in case the copy_from_user blocks while swapping in a page, + * and some other program tries to do a serial write at the same time. + * Since the lock will only come under contention when the system is + * swapping and available memory is low, it makes sense to share one + * buffer across all the serial ports, since it significantly saves + * memory if large numbers of serial ports are open. + */ +static u_char *tmp_buf; +static DECLARE_MUTEX(tmp_buf_sem); + +#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) + +/* number of characters left in xmit buffer before we ask for more */ +#define WAKEUP_CHARS 256 +#define AMBA_ISR_PASS_LIMIT 256 + +#define EVT_WRITE_WAKEUP 0 + +struct amba_icount { + __u32 cts; + __u32 dsr; + __u32 rng; + __u32 dcd; + __u32 rx; + __u32 tx; + __u32 frame; + __u32 overrun; + __u32 parity; + __u32 brk; + __u32 buf_overrun; +}; + +/* + * Static information about the port + */ +struct amba_port { + unsigned int uart_base; + unsigned int irq; + unsigned int uartclk; + unsigned int fifosize; + unsigned int tiocm_support; + void (*set_mctrl)(struct amba_port *, u_int mctrl); +}; + +/* + * This is the state information which is persistent across opens + */ +struct amba_state { + struct amba_icount icount; + unsigned int line; + unsigned int close_delay; + unsigned int closing_wait; + unsigned int custom_divisor; + unsigned int flags; + struct termios normal_termios; + struct termios callout_termios; + + int count; + struct amba_info *info; +}; + +#define AMBA_XMIT_SIZE 1024 +/* + * This is the state information which is only valid when the port is open. + */ +struct amba_info { + struct amba_port *port; + struct amba_state *state; + struct tty_struct *tty; + unsigned char x_char; + unsigned char old_status; + unsigned char read_status_mask; + unsigned char ignore_status_mask; + struct circ_buf xmit; + unsigned int flags; +#ifdef SUPPORT_SYSRQ + unsigned long sysrq; +#endif + + unsigned int event; + unsigned int timeout; + unsigned int lcr_h; + unsigned int mctrl; + int blocked_open; + pid_t session; + pid_t pgrp; + + struct tasklet_struct tlet; + + wait_queue_head_t open_wait; + wait_queue_head_t close_wait; + wait_queue_head_t delta_msr_wait; +}; + +#ifdef CONFIG_SERIAL_AMBA_CONSOLE +static struct console ambauart_cons; +#endif +static void ambauart_change_speed(struct amba_info *info, struct termios *old_termios); +static void ambauart_wait_until_sent(struct tty_struct *tty, int timeout); + +#if 1 //def CONFIG_SERIAL_INTEGRATOR +static void amba_set_mctrl_null(struct amba_port *port, u_int mctrl) +{ +} + +static struct amba_port amba_ports[SERIAL_AMBA_NR] = { + { + uart_base: IO_ADDRESS(INTEGRATOR_UART0_BASE), + irq: IRQ_UARTINT0, + uartclk: 14745600, + fifosize: 8, + set_mctrl: amba_set_mctrl_null, + }, + { + uart_base: IO_ADDRESS(INTEGRATOR_UART1_BASE), + irq: IRQ_UARTINT1, + uartclk: 14745600, + fifosize: 8, + set_mctrl: amba_set_mctrl_null, + } +}; +#endif + +static struct amba_state amba_state[SERIAL_AMBA_NR]; + +static void ambauart_enable_rx_interrupt(struct amba_info *info) +{ + unsigned int cr; + + cr = UART_GET_CR(info->port); + cr |= AMBA_UARTCR_RIE | AMBA_UARTCR_RTIE; + UART_PUT_CR(info->port, cr); +} + +static void ambauart_disable_rx_interrupt(struct amba_info *info) +{ + unsigned int cr; + + cr = UART_GET_CR(info->port); + cr &= ~(AMBA_UARTCR_RIE | AMBA_UARTCR_RTIE); + UART_PUT_CR(info->port, cr); +} + +static void ambauart_enable_tx_interrupt(struct amba_info *info) +{ + unsigned int cr; + + cr = UART_GET_CR(info->port); + cr |= AMBA_UARTCR_TIE; + UART_PUT_CR(info->port, cr); +} + +static void ambauart_disable_tx_interrupt(struct amba_info *info) +{ + unsigned int cr; + + cr = UART_GET_CR(info->port); + cr &= ~AMBA_UARTCR_TIE; + UART_PUT_CR(info->port, cr); +} + +static void ambauart_stop(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + + save_flags(flags); cli(); + ambauart_disable_tx_interrupt(info); + restore_flags(flags); +} + +static void ambauart_start(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + + save_flags(flags); cli(); + if (info->xmit.head != info->xmit.tail + && info->xmit.buf) + ambauart_enable_tx_interrupt(info); + restore_flags(flags); +} + + +/* + * This routine is used by the interrupt handler to schedule + * processing in the software interrupt portion of the driver. + */ +static void ambauart_event(struct amba_info *info, int event) +{ + info->event |= 1 << event; + tasklet_schedule(&info->tlet); +} + +static void +#ifdef SUPPORT_SYSRQ +ambauart_rx_chars(struct amba_info *info, struct pt_regs *regs) +#else +ambauart_rx_chars(struct amba_info *info) +#endif +{ + struct tty_struct *tty = info->tty; + unsigned int status, ch, rsr, flg, ignored = 0; + struct amba_icount *icount = &info->state->icount; + struct amba_port *port = info->port; + + status = UART_GET_FR(port); + while (UART_RX_DATA(status)) { + ch = UART_GET_CHAR(port); + + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + goto ignore_char; + icount->rx++; + + flg = TTY_NORMAL; + + /* + * Note that the error handling code is + * out of the main execution path + */ + rsr = UART_GET_RSR(port); + if (rsr & AMBA_UARTRSR_ANY) + goto handle_error; +#ifdef SUPPORT_SYSRQ + if (info->sysrq) { + if (ch && time_before(jiffies, info->sysrq)) { + handle_sysrq(ch, regs, NULL, NULL); + info->sysrq = 0; + goto ignore_char; + } + info->sysrq = 0; + } +#endif + error_return: + *tty->flip.flag_buf_ptr++ = flg; + *tty->flip.char_buf_ptr++ = ch; + tty->flip.count++; + ignore_char: + status = UART_GET_FR(port); + } +out: + tty_flip_buffer_push(tty); + return; + +handle_error: + if (rsr & AMBA_UARTRSR_BE) { + rsr &= ~(AMBA_UARTRSR_FE | AMBA_UARTRSR_PE); + icount->brk++; + +#ifdef SUPPORT_SYSRQ + if (info->state->line == ambauart_cons.index) { + if (!info->sysrq) { + info->sysrq = jiffies + HZ*5; + goto ignore_char; + } + } +#endif + } else if (rsr & AMBA_UARTRSR_PE) + icount->parity++; + else if (rsr & AMBA_UARTRSR_FE) + icount->frame++; + if (rsr & AMBA_UARTRSR_OE) + icount->overrun++; + + if (rsr & info->ignore_status_mask) { + if (++ignored > 100) + goto out; + goto ignore_char; + } + rsr &= info->read_status_mask; + + if (rsr & AMBA_UARTRSR_BE) + flg = TTY_BREAK; + else if (rsr & AMBA_UARTRSR_PE) + flg = TTY_PARITY; + else if (rsr & AMBA_UARTRSR_FE) + flg = TTY_FRAME; + + if (rsr & AMBA_UARTRSR_OE) { + /* + * CHECK: does overrun affect the current character? + * ASSUMPTION: it does not. + */ + *tty->flip.flag_buf_ptr++ = flg; + *tty->flip.char_buf_ptr++ = ch; + tty->flip.count++; + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + goto ignore_char; + ch = 0; + flg = TTY_OVERRUN; + } +#ifdef SUPPORT_SYSRQ + info->sysrq = 0; +#endif + goto error_return; +} + +static void ambauart_tx_chars(struct amba_info *info) +{ + struct amba_port *port = info->port; + int count; + + if (info->x_char) { + UART_PUT_CHAR(port, info->x_char); + info->state->icount.tx++; + info->x_char = 0; + return; + } + if (info->xmit.head == info->xmit.tail + || info->tty->stopped + || info->tty->hw_stopped) { + ambauart_disable_tx_interrupt(info); + return; + } + + count = port->fifosize; + do { + UART_PUT_CHAR(port, info->xmit.buf[info->xmit.tail]); + info->xmit.tail = (info->xmit.tail + 1) & (AMBA_XMIT_SIZE - 1); + info->state->icount.tx++; + if (info->xmit.head == info->xmit.tail) + break; + } while (--count > 0); + + if (CIRC_CNT(info->xmit.head, + info->xmit.tail, + AMBA_XMIT_SIZE) < WAKEUP_CHARS) + ambauart_event(info, EVT_WRITE_WAKEUP); + + if (info->xmit.head == info->xmit.tail) { + ambauart_disable_tx_interrupt(info); + } +} + +static void ambauart_modem_status(struct amba_info *info) +{ + unsigned int status, delta; + struct amba_icount *icount = &info->state->icount; + + status = UART_GET_FR(info->port) & AMBA_UARTFR_MODEM_ANY; + + delta = status ^ info->old_status; + info->old_status = status; + + if (!delta) + return; + + if (delta & AMBA_UARTFR_DCD) { + icount->dcd++; +#ifdef CONFIG_HARD_PPS + if ((info->flags & ASYNC_HARDPPS_CD) && + (status & AMBA_UARTFR_DCD) + hardpps(); +#endif + if (info->flags & ASYNC_CHECK_CD) { + if (status & AMBA_UARTFR_DCD) + wake_up_interruptible(&info->open_wait); + else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_CALLOUT_NOHUP))) { + if (info->tty) + tty_hangup(info->tty); + } + } + } + + if (delta & AMBA_UARTFR_DSR) + icount->dsr++; + + if (delta & AMBA_UARTFR_CTS) { + icount->cts++; + + if (info->flags & ASYNC_CTS_FLOW) { + status &= AMBA_UARTFR_CTS; + + if (info->tty->hw_stopped) { + if (status) { + info->tty->hw_stopped = 0; + ambauart_enable_tx_interrupt(info); + ambauart_event(info, EVT_WRITE_WAKEUP); + } + } else { + if (!status) { + info->tty->hw_stopped = 1; + ambauart_disable_tx_interrupt(info); + } + } + } + } + wake_up_interruptible(&info->delta_msr_wait); + +} + +static void ambauart_int(int irq, void *dev_id, struct pt_regs *regs) +{ + struct amba_info *info = dev_id; + unsigned int status, pass_counter = 0; + +#if DEBUG_LEDS + // tell the world + set_leds(get_leds() | RED_LED); +#endif + + status = UART_GET_INT_STATUS(info->port); + do { + /* + * FIXME: what about clearing the interrupts? + */ + + if (status & (AMBA_UARTIIR_RTIS | AMBA_UARTIIR_RIS)) +#ifdef SUPPORT_SYSRQ + ambauart_rx_chars(info, regs); +#else + ambauart_rx_chars(info); +#endif + if (status & AMBA_UARTIIR_TIS) + ambauart_tx_chars(info); + if (status & AMBA_UARTIIR_MIS) + ambauart_modem_status(info); + if (pass_counter++ > AMBA_ISR_PASS_LIMIT) + break; + + status = UART_GET_INT_STATUS(info->port); + } while (status & (AMBA_UARTIIR_RTIS | AMBA_UARTIIR_RIS | AMBA_UARTIIR_TIS)); + +#if DEBUG_LEDS + // tell the world + set_leds(get_leds() & ~RED_LED); +#endif +} + +static void ambauart_tasklet_action(unsigned long data) +{ + struct amba_info *info = (struct amba_info *)data; + struct tty_struct *tty; + + tty = info->tty; + if (!tty || !test_and_clear_bit(EVT_WRITE_WAKEUP, &info->event)) + return; + + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); + wake_up_interruptible(&tty->write_wait); +} + +static int ambauart_startup(struct amba_info *info) +{ + unsigned long flags; + unsigned long page; + int retval = 0; + + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + save_flags(flags); cli(); + + if (info->flags & ASYNC_INITIALIZED) { + free_page(page); + goto errout; + } + + if (info->xmit.buf) + free_page(page); + else + info->xmit.buf = (unsigned char *) page; + + /* + * Allocate the IRQ + */ + retval = request_irq(info->port->irq, ambauart_int, 0, "amba", info); + if (retval) { + if (capable(CAP_SYS_ADMIN)) { + if (info->tty) + set_bit(TTY_IO_ERROR, &info->tty->flags); + retval = 0; + } + goto errout; + } + + info->mctrl = 0; + if (info->tty->termios->c_cflag & CBAUD) + info->mctrl = TIOCM_RTS | TIOCM_DTR; + info->port->set_mctrl(info->port, info->mctrl); + + /* + * initialise the old status of the modem signals + */ + info->old_status = UART_GET_FR(info->port) & AMBA_UARTFR_MODEM_ANY; + + /* + * Finally, enable interrupts + */ + ambauart_enable_rx_interrupt(info); + + if (info->tty) + clear_bit(TTY_IO_ERROR, &info->tty->flags); + info->xmit.head = info->xmit.tail = 0; + + /* + * Set up the tty->alt_speed kludge + */ + if (info->tty) { + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; + } + + /* + * and set the speed of the serial port + */ + ambauart_change_speed(info, 0); + + info->flags |= ASYNC_INITIALIZED; + restore_flags(flags); + return 0; + +errout: + restore_flags(flags); + return retval; +} + +/* + * This routine will shutdown a serial port; interrupts are disabled, and + * DTR is dropped if the hangup on close termio flag is on. + */ +static void ambauart_shutdown(struct amba_info *info) +{ + unsigned long flags; + + if (!(info->flags & ASYNC_INITIALIZED)) + return; + + save_flags(flags); cli(); /* Disable interrupts */ + + /* + * clear delta_msr_wait queue to avoid mem leaks: we may free the irq + * here so the queue might never be woken up + */ + wake_up_interruptible(&info->delta_msr_wait); + + /* + * Free the IRQ + */ + free_irq(info->port->irq, info); + + if (info->xmit.buf) { + unsigned long pg = (unsigned long) info->xmit.buf; + info->xmit.buf = NULL; + free_page(pg); + } + + /* + * disable all interrupts, disable the port + */ + UART_PUT_CR(info->port, 0); + + /* disable break condition and fifos */ + UART_PUT_LCRH(info->port, UART_GET_LCRH(info->port) & + ~(AMBA_UARTLCR_H_BRK | AMBA_UARTLCR_H_FEN)); + + if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) + info->mctrl &= ~(TIOCM_DTR|TIOCM_RTS); + info->port->set_mctrl(info->port, info->mctrl); + + /* kill off our tasklet */ + tasklet_kill(&info->tlet); + if (info->tty) + set_bit(TTY_IO_ERROR, &info->tty->flags); + + info->flags &= ~ASYNC_INITIALIZED; + restore_flags(flags); +} + +static void ambauart_change_speed(struct amba_info *info, struct termios *old_termios) +{ + unsigned int lcr_h, baud, quot, cflag, old_cr, bits; + unsigned long flags; + + if (!info->tty || !info->tty->termios) + return; + + cflag = info->tty->termios->c_cflag; + +#if DEBUG + printk("ambauart_set_cflag(0x%x) called\n", cflag); +#endif + /* byte size and parity */ + switch (cflag & CSIZE) { + case CS5: lcr_h = AMBA_UARTLCR_H_WLEN_5; bits = 7; break; + case CS6: lcr_h = AMBA_UARTLCR_H_WLEN_6; bits = 8; break; + case CS7: lcr_h = AMBA_UARTLCR_H_WLEN_7; bits = 9; break; + default: lcr_h = AMBA_UARTLCR_H_WLEN_8; bits = 10; break; // CS8 + } + if (cflag & CSTOPB) { + lcr_h |= AMBA_UARTLCR_H_STP2; + bits ++; + } + if (cflag & PARENB) { + lcr_h |= AMBA_UARTLCR_H_PEN; + bits++; + if (!(cflag & PARODD)) + lcr_h |= AMBA_UARTLCR_H_EPS; + } + if (info->port->fifosize > 1) + lcr_h |= AMBA_UARTLCR_H_FEN; + + do { + /* Determine divisor based on baud rate */ + baud = tty_get_baud_rate(info->tty); + if (!baud) + baud = 9600; + + if (baud == 38400 && + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) + quot = info->state->custom_divisor; + else + quot = (info->port->uartclk / (16 * baud)) - 1; + + if (!quot && old_termios) { + info->tty->termios->c_cflag &= ~CBAUD; + info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); + old_termios = NULL; + } + } while (quot == 0 && old_termios); + + /* As a last resort, if the quotient is zero, default to 9600 bps */ + if (!quot) + quot = (info->port->uartclk / (16 * 9600)) - 1; + + info->timeout = (info->port->fifosize * HZ * bits * quot) / + (info->port->uartclk / 16); + info->timeout += HZ/50; /* Add .02 seconds of slop */ + + if (cflag & CRTSCTS) + info->flags |= ASYNC_CTS_FLOW; + else + info->flags &= ~ASYNC_CTS_FLOW; + if (cflag & CLOCAL) + info->flags &= ~ASYNC_CHECK_CD; + else + info->flags |= ASYNC_CHECK_CD; + + /* + * Set up parity check flag + */ +#define RELEVENT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) + + info->read_status_mask = AMBA_UARTRSR_OE; + if (I_INPCK(info->tty)) + info->read_status_mask |= AMBA_UARTRSR_FE | AMBA_UARTRSR_PE; + if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) + info->read_status_mask |= AMBA_UARTRSR_BE; + + /* + * Characters to ignore + */ + info->ignore_status_mask = 0; + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= AMBA_UARTRSR_FE | AMBA_UARTRSR_PE; + if (I_IGNBRK(info->tty)) { + info->ignore_status_mask |= AMBA_UARTRSR_BE; + /* + * If we're ignoring parity and break indicators, + * ignore overruns to (for real raw support). + */ + if (I_IGNPAR(info->tty)) + info->ignore_status_mask |= AMBA_UARTRSR_OE; + } + + /* first, disable everything */ + save_flags(flags); cli(); + old_cr = UART_GET_CR(info->port) &= ~AMBA_UARTCR_MSIE; + + if ((info->flags & ASYNC_HARDPPS_CD) || + (cflag & CRTSCTS) || + !(cflag & CLOCAL)) + old_cr |= AMBA_UARTCR_MSIE; + + UART_PUT_CR(info->port, 0); + restore_flags(flags); + + /* Set baud rate */ + UART_PUT_LCRM(info->port, ((quot & 0xf00) >> 8)); + UART_PUT_LCRL(info->port, (quot & 0xff)); + + /* + * ----------v----------v----------v----------v----- + * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L + * ----------^----------^----------^----------^----- + */ + UART_PUT_LCRH(info->port, lcr_h); + UART_PUT_CR(info->port, old_cr); +} + +static void ambauart_put_char(struct tty_struct *tty, u_char ch) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + + if (!tty || !info->xmit.buf) + return; + + save_flags(flags); cli(); + if (CIRC_SPACE(info->xmit.head, info->xmit.tail, AMBA_XMIT_SIZE) != 0) { + info->xmit.buf[info->xmit.head] = ch; + info->xmit.head = (info->xmit.head + 1) & (AMBA_XMIT_SIZE - 1); + } + restore_flags(flags); +} + +static void ambauart_flush_chars(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + + if (info->xmit.head == info->xmit.tail + || tty->stopped + || tty->hw_stopped + || !info->xmit.buf) + return; + + save_flags(flags); cli(); + ambauart_enable_tx_interrupt(info); + restore_flags(flags); +} + +static int ambauart_write(struct tty_struct *tty, int from_user, + const u_char * buf, int count) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + int c, ret = 0; + + if (!tty || !info->xmit.buf || !tmp_buf) + return 0; + + save_flags(flags); + if (from_user) { + down(&tmp_buf_sem); + while (1) { + int c1; + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + AMBA_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) + break; + + c -= copy_from_user(tmp_buf, buf, c); + if (!c) { + if (!ret) + ret = -EFAULT; + break; + } + cli(); + c1 = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + AMBA_XMIT_SIZE); + if (c1 < c) + c = c1; + memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c); + info->xmit.head = (info->xmit.head + c) & + (AMBA_XMIT_SIZE - 1); + restore_flags(flags); + buf += c; + count -= c; + ret += c; + } + up(&tmp_buf_sem); + } else { + cli(); + while (1) { + c = CIRC_SPACE_TO_END(info->xmit.head, + info->xmit.tail, + AMBA_XMIT_SIZE); + if (count < c) + c = count; + if (c <= 0) + break; + memcpy(info->xmit.buf + info->xmit.head, buf, c); + info->xmit.head = (info->xmit.head + c) & + (AMBA_XMIT_SIZE - 1); + buf += c; + count -= c; + ret += c; + } + restore_flags(flags); + } + if (info->xmit.head != info->xmit.tail + && !tty->stopped + && !tty->hw_stopped) + ambauart_enable_tx_interrupt(info); + return ret; +} + +static int ambauart_write_room(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + + return CIRC_SPACE(info->xmit.head, info->xmit.tail, AMBA_XMIT_SIZE); +} + +static int ambauart_chars_in_buffer(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + + return CIRC_CNT(info->xmit.head, info->xmit.tail, AMBA_XMIT_SIZE); +} + +static void ambauart_flush_buffer(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + +#if DEBUG + printk("ambauart_flush_buffer(%d) called\n", + MINOR(tty->device) - tty->driver.minor_start); +#endif + save_flags(flags); cli(); + info->xmit.head = info->xmit.tail = 0; + restore_flags(flags); + wake_up_interruptible(&tty->write_wait); + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); +} + +/* + * This function is used to send a high-priority XON/XOFF character to + * the device + */ +static void ambauart_send_xchar(struct tty_struct *tty, char ch) +{ + struct amba_info *info = tty->driver_data; + + info->x_char = ch; + if (ch) + ambauart_enable_tx_interrupt(info); +} + +static void ambauart_throttle(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + + if (I_IXOFF(tty)) + ambauart_send_xchar(tty, STOP_CHAR(tty)); + + if (tty->termios->c_cflag & CRTSCTS) { + save_flags(flags); cli(); + info->mctrl &= ~TIOCM_RTS; + info->port->set_mctrl(info->port, info->mctrl); + restore_flags(flags); + } +} + +static void ambauart_unthrottle(struct tty_struct *tty) +{ + struct amba_info *info = (struct amba_info *) tty->driver_data; + unsigned long flags; + + if (I_IXOFF(tty)) { + if (info->x_char) + info->x_char = 0; + else + ambauart_send_xchar(tty, START_CHAR(tty)); + } + + if (tty->termios->c_cflag & CRTSCTS) { + save_flags(flags); cli(); + info->mctrl |= TIOCM_RTS; + info->port->set_mctrl(info->port, info->mctrl); + restore_flags(flags); + } +} + +static int get_serial_info(struct amba_info *info, struct serial_struct *retinfo) +{ + struct amba_state *state = info->state; + struct amba_port *port = info->port; + struct serial_struct tmp; + + memset(&tmp, 0, sizeof(tmp)); + tmp.type = 0; + tmp.line = state->line; + tmp.port = port->uart_base; + if (HIGH_BITS_OFFSET) + tmp.port_high = port->uart_base >> HIGH_BITS_OFFSET; + tmp.irq = port->irq; + tmp.flags = 0; + tmp.xmit_fifo_size = port->fifosize; + tmp.baud_base = port->uartclk / 16; + tmp.close_delay = state->close_delay; + tmp.closing_wait = state->closing_wait; + tmp.custom_divisor = state->custom_divisor; + + if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) + return -EFAULT; + return 0; +} + +static int set_serial_info(struct amba_info *info, + struct serial_struct *newinfo) +{ + struct serial_struct new_serial; + struct amba_state *state, old_state; + struct amba_port *port; + unsigned long new_port; + unsigned int i, change_irq, change_port; + int retval = 0; + + if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) + return -EFAULT; + + state = info->state; + old_state = *state; + port = info->port; + + new_port = new_serial.port; + if (HIGH_BITS_OFFSET) + new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET; + + change_irq = new_serial.irq != port->irq; + change_port = new_port != port->uart_base; + + if (!capable(CAP_SYS_ADMIN)) { + if (change_irq || change_port || + (new_serial.baud_base != port->uartclk / 16) || + (new_serial.close_delay != state->close_delay) || + (new_serial.xmit_fifo_size != port->fifosize) || + ((new_serial.flags & ~ASYNC_USR_MASK) != + (state->flags & ~ASYNC_USR_MASK))) + return -EPERM; + state->flags = ((state->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + info->flags = ((info->flags & ~ASYNC_USR_MASK) | + (new_serial.flags & ASYNC_USR_MASK)); + state->custom_divisor = new_serial.custom_divisor; + goto check_and_exit; + } + + if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || + (new_serial.baud_base < 9600)) + return -EINVAL; + + if (new_serial.type && change_port) { + for (i = 0; i < SERIAL_AMBA_NR; i++) + if ((port != amba_ports + i) && + amba_ports[i].uart_base != new_port) + return -EADDRINUSE; + } + + if ((change_port || change_irq) && (state->count > 1)) + return -EBUSY; + + /* + * OK, past this point, all the error checking has been done. + * At this point, we start making changes..... + */ + port->uartclk = new_serial.baud_base * 16; + state->flags = ((state->flags & ~ASYNC_FLAGS) | + (new_serial.flags & ASYNC_FLAGS)); + info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) | + (info->flags & ASYNC_INTERNAL_FLAGS)); + state->custom_divisor = new_serial.custom_divisor; + state->close_delay = new_serial.close_delay * HZ / 100; + state->closing_wait = new_serial.closing_wait * HZ / 100; + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + port->fifosize = new_serial.xmit_fifo_size; + + if (change_port || change_irq) { + /* + * We need to shutdown the serial port at the old + * port/irq combination. + */ + ambauart_shutdown(info); + port->irq = new_serial.irq; + port->uart_base = new_port; + } + +check_and_exit: + if (!port->uart_base) + return 0; + if (info->flags & ASYNC_INITIALIZED) { + if ((old_state.flags & ASYNC_SPD_MASK) != + (state->flags & ASYNC_SPD_MASK) || + (old_state.custom_divisor != state->custom_divisor)) { + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) + info->tty->alt_speed = 57600; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) + info->tty->alt_speed = 115200; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) + info->tty->alt_speed = 230400; + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) + info->tty->alt_speed = 460800; + ambauart_change_speed(info, NULL); + } + } else + retval = ambauart_startup(info); + return retval; +} + + +/* + * get_lsr_info - get line status register info + */ +static int get_lsr_info(struct amba_info *info, unsigned int *value) +{ + unsigned int result, status; + unsigned long flags; + + save_flags(flags); cli(); + status = UART_GET_FR(info->port); + restore_flags(flags); + result = status & AMBA_UARTFR_BUSY ? TIOCSER_TEMT : 0; + + /* + * If we're about to load something into the transmit + * register, we'll pretend the transmitter isn't empty to + * avoid a race condition (depending on when the transmit + * interrupt happens). + */ + if (info->x_char || + ((CIRC_CNT(info->xmit.head, info->xmit.tail, + AMBA_XMIT_SIZE) > 0) && + !info->tty->stopped && !info->tty->hw_stopped)) + result &= TIOCSER_TEMT; + + return put_user(result, value); +} + +static int get_modem_info(struct amba_info *info, unsigned int *value) +{ + unsigned int result = info->mctrl; + unsigned int status; + + status = UART_GET_FR(info->port); + if (status & AMBA_UARTFR_DCD) + result |= TIOCM_CAR; + if (status & AMBA_UARTFR_DSR) + result |= TIOCM_DSR; + if (status & AMBA_UARTFR_CTS) + result |= TIOCM_CTS; + + return put_user(result, value); +} + +static int set_modem_info(struct amba_info *info, unsigned int cmd, + unsigned int *value) +{ + unsigned int arg, old; + unsigned long flags; + + if (get_user(arg, value)) + return -EFAULT; + + old = info->mctrl; + switch (cmd) { + case TIOCMBIS: + info->mctrl |= arg; + break; + + case TIOCMBIC: + info->mctrl &= ~arg; + break; + + case TIOCMSET: + info->mctrl = arg; + break; + + default: + return -EINVAL; + } + save_flags(flags); cli(); + if (old != info->mctrl) + info->port->set_mctrl(info->port, info->mctrl); + restore_flags(flags); + return 0; +} + +static void ambauart_break_ctl(struct tty_struct *tty, int break_state) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + unsigned int lcr_h; + + save_flags(flags); cli(); + lcr_h = UART_GET_LCRH(info->port); + if (break_state == -1) + lcr_h |= AMBA_UARTLCR_H_BRK; + else + lcr_h &= ~AMBA_UARTLCR_H_BRK; + UART_PUT_LCRH(info->port, lcr_h); + restore_flags(flags); +} + +static int ambauart_ioctl(struct tty_struct *tty, struct file *file, + unsigned int cmd, unsigned long arg) +{ + struct amba_info *info = tty->driver_data; + struct amba_icount cprev, cnow; + struct serial_icounter_struct icount; + unsigned long flags; + + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && + (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { + if (tty->flags & (1 << TTY_IO_ERROR)) + return -EIO; + } + + switch (cmd) { + case TIOCMGET: + return get_modem_info(info, (unsigned int *)arg); + case TIOCMBIS: + case TIOCMBIC: + case TIOCMSET: + return set_modem_info(info, cmd, (unsigned int *)arg); + case TIOCGSERIAL: + return get_serial_info(info, + (struct serial_struct *)arg); + case TIOCSSERIAL: + return set_serial_info(info, + (struct serial_struct *)arg); + case TIOCSERGETLSR: /* Get line status register */ + return get_lsr_info(info, (unsigned int *)arg); + /* + * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change + * - mask passed in arg for lines of interest + * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) + * Caller should use TIOCGICOUNT to see which one it was + */ + case TIOCMIWAIT: + save_flags(flags); cli(); + /* note the counters on entry */ + cprev = info->state->icount; + /* Force modem status interrupts on */ + UART_PUT_CR(info->port, UART_GET_CR(info->port) | AMBA_UARTCR_MSIE); + restore_flags(flags); + while (1) { + interruptible_sleep_on(&info->delta_msr_wait); + /* see if a signal did it */ + if (signal_pending(current)) + return -ERESTARTSYS; + save_flags(flags); cli(); + cnow = info->state->icount; /* atomic copy */ + restore_flags(flags); + if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && + cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) + return -EIO; /* no change => error */ + if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || + ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || + ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || + ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { + return 0; + } + cprev = cnow; + } + /* NOTREACHED */ + + /* + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) + * Return: write counters to the user passed counter struct + * NB: both 1->0 and 0->1 transitions are counted except for + * RI where only 0->1 is counted. + */ + case TIOCGICOUNT: + save_flags(flags); cli(); + cnow = info->state->icount; + restore_flags(flags); + icount.cts = cnow.cts; + icount.dsr = cnow.dsr; + icount.rng = cnow.rng; + icount.dcd = cnow.dcd; + icount.rx = cnow.rx; + icount.tx = cnow.tx; + icount.frame = cnow.frame; + icount.overrun = cnow.overrun; + icount.parity = cnow.parity; + icount.brk = cnow.brk; + icount.buf_overrun = cnow.buf_overrun; + + return copy_to_user((void *)arg, &icount, sizeof(icount)) + ? -EFAULT : 0; + + default: + return -ENOIOCTLCMD; + } + return 0; +} + +static void ambauart_set_termios(struct tty_struct *tty, struct termios *old_termios) +{ + struct amba_info *info = tty->driver_data; + unsigned long flags; + unsigned int cflag = tty->termios->c_cflag; + + if ((cflag ^ old_termios->c_cflag) == 0 && + RELEVENT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) + return; + + ambauart_change_speed(info, old_termios); + + /* Handle transition to B0 status */ + if ((old_termios->c_cflag & CBAUD) && + !(cflag & CBAUD)) { + save_flags(flags); cli(); + info->mctrl &= ~(TIOCM_RTS | TIOCM_DTR); + info->port->set_mctrl(info->port, info->mctrl); + restore_flags(flags); + } + + /* Handle transition away from B0 status */ + if (!(old_termios->c_cflag & CBAUD) && + (cflag & CBAUD)) { + save_flags(flags); cli(); + info->mctrl |= TIOCM_DTR; + if (!(cflag & CRTSCTS) || + !test_bit(TTY_THROTTLED, &tty->flags)) + info->mctrl |= TIOCM_RTS; + info->port->set_mctrl(info->port, info->mctrl); + restore_flags(flags); + } + + /* Handle turning off CRTSCTS */ + if ((old_termios->c_cflag & CRTSCTS) && + !(cflag & CRTSCTS)) { + tty->hw_stopped = 0; + ambauart_start(tty); + } + +#if 0 + /* + * No need to wake up processes in open wait, since they + * sample the CLOCAL flag once, and don't recheck it. + * XXX It's not clear whether the current behavior is correct + * or not. Hence, this may change..... + */ + if (!(old_termios->c_cflag & CLOCAL) && + (tty->termios->c_cflag & CLOCAL)) + wake_up_interruptible(&info->open_wait); +#endif +} + +static void ambauart_close(struct tty_struct *tty, struct file *filp) +{ + struct amba_info *info = tty->driver_data; + struct amba_state *state; + unsigned long flags; + + if (!info) + return; + + state = info->state; + +#if DEBUG + printk("ambauart_close() called\n"); +#endif + + save_flags(flags); cli(); + + if (tty_hung_up_p(filp)) { + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + + if ((tty->count == 1) && (state->count != 1)) { + /* + * Uh, oh. tty->count is 1, which means that the tty + * structure will be freed. state->count should always + * be one in these conditions. If it's greater than + * one, we've got real problems, since it means the + * serial port won't be shutdown. + */ + printk("ambauart_close: bad serial port count; tty->count is 1, " + "state->count is %d\n", state->count); + state->count = 1; + } + if (--state->count < 0) { + printk("rs_close: bad serial port count for %s%d: %d\n", + tty->driver.name, info->state->line, state->count); + state->count = 0; + } + if (state->count) { + MOD_DEC_USE_COUNT; + restore_flags(flags); + return; + } + info->flags |= ASYNC_CLOSING; + restore_flags(flags); + /* + * Save the termios structure, since this port may have + * separate termios for callout and dialin. + */ + if (info->flags & ASYNC_NORMAL_ACTIVE) + info->state->normal_termios = *tty->termios; + if (info->flags & ASYNC_CALLOUT_ACTIVE) + info->state->callout_termios = *tty->termios; + /* + * Now we wait for the transmit buffer to clear; and we notify + * the line discipline to only process XON/XOFF characters. + */ + tty->closing = 1; + if (info->state->closing_wait != ASYNC_CLOSING_WAIT_NONE) + tty_wait_until_sent(tty, info->state->closing_wait); + /* + * At this point, we stop accepting input. To do this, we + * disable the receive line status interrupts. + */ + if (info->flags & ASYNC_INITIALIZED) { + ambauart_disable_rx_interrupt(info); + /* + * Before we drop DTR, make sure the UART transmitter + * has completely drained; this is especially + * important if there is a transmit FIFO! + */ + ambauart_wait_until_sent(tty, info->timeout); + } + ambauart_shutdown(info); + if (tty->driver.flush_buffer) + tty->driver.flush_buffer(tty); + if (tty->ldisc.flush_buffer) + tty->ldisc.flush_buffer(tty); + tty->closing = 0; + info->event = 0; + info->tty = NULL; + if (info->blocked_open) { + if (info->state->close_delay) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(info->state->close_delay); + } + wake_up_interruptible(&info->open_wait); + } + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| + ASYNC_CLOSING); + wake_up_interruptible(&info->close_wait); + MOD_DEC_USE_COUNT; +} + +static void ambauart_wait_until_sent(struct tty_struct *tty, int timeout) +{ + struct amba_info *info = (struct amba_info *) tty->driver_data; + unsigned long char_time, expire; + unsigned int status; + + if (info->port->fifosize == 0) + return; + + /* + * Set the check interval to be 1/5 of the estimated time to + * send a single character, and make it at least 1. The check + * interval should also be less than the timeout. + * + * Note: we have to use pretty tight timings here to satisfy + * the NIST-PCTS. + */ + char_time = (info->timeout - HZ/50) / info->port->fifosize; + char_time = char_time / 5; + if (char_time == 0) + char_time = 1; + if (timeout && timeout < char_time) + char_time = timeout; + /* + * If the transmitter hasn't cleared in twice the approximate + * amount of time to send the entire FIFO, it probably won't + * ever clear. This assumes the UART isn't doing flow + * control, which is currently the case. Hence, if it ever + * takes longer than info->timeout, this is probably due to a + * UART bug of some kind. So, we clamp the timeout parameter at + * 2*info->timeout. + */ + if (!timeout || timeout > 2 * info->timeout) + timeout = 2 * info->timeout; + + expire = jiffies + timeout; +#if DEBUG + printk("ambauart_wait_until_sent(%d), jiff=%lu, expire=%lu...\n", + MINOR(tty->device) - tty->driver.minor_start, jiffies, + expire); +#endif + while (UART_GET_FR(info->port) & AMBA_UARTFR_BUSY) { + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(char_time); + if (signal_pending(current)) + break; + if (timeout && time_after(jiffies, expire)) + break; + status = UART_GET_FR(info->port); + } + set_current_state(TASK_RUNNING); +} + +static void ambauart_hangup(struct tty_struct *tty) +{ + struct amba_info *info = tty->driver_data; + struct amba_state *state = info->state; + + ambauart_flush_buffer(tty); + if (info->flags & ASYNC_CLOSING) + return; + ambauart_shutdown(info); + info->event = 0; + state->count = 0; + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); + info->tty = NULL; + wake_up_interruptible(&info->open_wait); +} + +static int block_til_ready(struct tty_struct *tty, struct file *filp, + struct amba_info *info) +{ + DECLARE_WAITQUEUE(wait, current); + struct amba_state *state = info->state; + unsigned long flags; + int do_clocal = 0, extra_count = 0, retval; + + /* + * If the device is in the middle of being closed, then block + * until it's done, and then try again. + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); + return (info->flags & ASYNC_HUP_NOTIFY) ? + -EAGAIN : -ERESTARTSYS; + } + + /* + * If this is a callout device, then just make sure the normal + * device isn't being used. + */ + if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { + if (info->flags & ASYNC_NORMAL_ACTIVE) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_SESSION_LOCKOUT) && + (info->session != current->session)) + return -EBUSY; + if ((info->flags & ASYNC_CALLOUT_ACTIVE) && + (info->flags & ASYNC_PGRP_LOCKOUT) && + (info->pgrp != current->pgrp)) + return -EBUSY; + info->flags |= ASYNC_CALLOUT_ACTIVE; + return 0; + } + + /* + * If non-blocking mode is set, or the port is not enabled, + * then make the check up front and then exit. + */ + if ((filp->f_flags & O_NONBLOCK) || + (tty->flags & (1 << TTY_IO_ERROR))) { + if (info->flags & ASYNC_CALLOUT_ACTIVE) + return -EBUSY; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; + } + + if (info->flags & ASYNC_CALLOUT_ACTIVE) { + if (state->normal_termios.c_cflag & CLOCAL) + do_clocal = 1; + } else { + if (tty->termios->c_cflag & CLOCAL) + do_clocal = 1; + } + + /* + * Block waiting for the carrier detect and the line to become + * free (i.e., not in use by the callout). While we are in + * this loop, state->count is dropped by one, so that + * rs_close() knows when to free things. We restore it upon + * exit, either normal or abnormal. + */ + retval = 0; + add_wait_queue(&info->open_wait, &wait); + save_flags(flags); cli(); + if (!tty_hung_up_p(filp)) { + extra_count = 1; + state->count--; + } + restore_flags(flags); + info->blocked_open++; + while (1) { + save_flags(flags); cli(); + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + (tty->termios->c_cflag & CBAUD)) { + info->mctrl = TIOCM_DTR | TIOCM_RTS; + info->port->set_mctrl(info->port, info->mctrl); + } + restore_flags(flags); + set_current_state(TASK_INTERRUPTIBLE); + if (tty_hung_up_p(filp) || + !(info->flags & ASYNC_INITIALIZED)) { + if (info->flags & ASYNC_HUP_NOTIFY) + retval = -EAGAIN; + else + retval = -ERESTARTSYS; + break; + } + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) && + !(info->flags & ASYNC_CLOSING) && + (do_clocal || (UART_GET_FR(info->port) & AMBA_UARTFR_DCD))) + break; + if (signal_pending(current)) { + retval = -ERESTARTSYS; + break; + } + schedule(); + } + set_current_state(TASK_RUNNING); + remove_wait_queue(&info->open_wait, &wait); + if (extra_count) + state->count++; + info->blocked_open--; + if (retval) + return retval; + info->flags |= ASYNC_NORMAL_ACTIVE; + return 0; +} + +static struct amba_info *ambauart_get(int line) +{ + struct amba_info *info; + struct amba_state *state = amba_state + line; + + state->count++; + if (state->info) + return state->info; + info = kmalloc(sizeof(struct amba_info), GFP_KERNEL); + if (info) { + memset(info, 0, sizeof(struct amba_info)); + init_waitqueue_head(&info->open_wait); + init_waitqueue_head(&info->close_wait); + init_waitqueue_head(&info->delta_msr_wait); + info->flags = state->flags; + info->state = state; + info->port = amba_ports + line; + tasklet_init(&info->tlet, ambauart_tasklet_action, + (unsigned long)info); + } + if (state->info) { + kfree(info); + return state->info; + } + state->info = info; + return info; +} + +static int ambauart_open(struct tty_struct *tty, struct file *filp) +{ + struct amba_info *info; + int retval, line = MINOR(tty->device) - tty->driver.minor_start; + +#if DEBUG + printk("ambauart_open(%d) called\n", line); +#endif + + // is this a line that we've got? + MOD_INC_USE_COUNT; + if (line >= SERIAL_AMBA_NR) { + MOD_DEC_USE_COUNT; + return -ENODEV; + } + + info = ambauart_get(line); + if (!info) + return -ENOMEM; + + tty->driver_data = info; + info->tty = tty; + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + + /* + * Make sure we have the temporary buffer allocated + */ + if (!tmp_buf) { + unsigned long page = get_zeroed_page(GFP_KERNEL); + if (tmp_buf) + free_page(page); + else if (!page) { + MOD_DEC_USE_COUNT; + return -ENOMEM; + } + tmp_buf = (u_char *)page; + } + + /* + * If the port is in the middle of closing, bail out now. + */ + if (tty_hung_up_p(filp) || + (info->flags & ASYNC_CLOSING)) { + if (info->flags & ASYNC_CLOSING) + interruptible_sleep_on(&info->close_wait); + MOD_DEC_USE_COUNT; + return -EAGAIN; + } + + /* + * Start up the serial port + */ + retval = ambauart_startup(info); + if (retval) { + MOD_DEC_USE_COUNT; + return retval; + } + + retval = block_til_ready(tty, filp, info); + if (retval) { + MOD_DEC_USE_COUNT; + return retval; + } + + if ((info->state->count == 1) && + (info->flags & ASYNC_SPLIT_TERMIOS)) { + if (tty->driver.subtype == SERIAL_TYPE_NORMAL) + *tty->termios = info->state->normal_termios; + else + *tty->termios = info->state->callout_termios; + } +#ifdef CONFIG_SERIAL_AMBA_CONSOLE + if (ambauart_cons.cflag && ambauart_cons.index == line) { + tty->termios->c_cflag = ambauart_cons.cflag; + ambauart_cons.cflag = 0; + } +#endif + ambauart_change_speed(info, NULL); + info->session = current->session; + info->pgrp = current->pgrp; + return 0; +} + +int __init ambauart_init(void) +{ + int i; + + ambanormal_driver.magic = TTY_DRIVER_MAGIC; + ambanormal_driver.driver_name = "serial_amba"; + ambanormal_driver.name = SERIAL_AMBA_NAME; + ambanormal_driver.major = SERIAL_AMBA_MAJOR; + ambanormal_driver.minor_start = SERIAL_AMBA_MINOR; + ambanormal_driver.num = SERIAL_AMBA_NR; + ambanormal_driver.type = TTY_DRIVER_TYPE_SERIAL; + ambanormal_driver.subtype = SERIAL_TYPE_NORMAL; + ambanormal_driver.init_termios = tty_std_termios; + ambanormal_driver.init_termios.c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL; + ambanormal_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + ambanormal_driver.refcount = &ambauart_refcount; + ambanormal_driver.table = ambauart_table; + ambanormal_driver.termios = ambauart_termios; + ambanormal_driver.termios_locked = ambauart_termios_locked; + + ambanormal_driver.open = ambauart_open; + ambanormal_driver.close = ambauart_close; + ambanormal_driver.write = ambauart_write; + ambanormal_driver.put_char = ambauart_put_char; + ambanormal_driver.flush_chars = ambauart_flush_chars; + ambanormal_driver.write_room = ambauart_write_room; + ambanormal_driver.chars_in_buffer = ambauart_chars_in_buffer; + ambanormal_driver.flush_buffer = ambauart_flush_buffer; + ambanormal_driver.ioctl = ambauart_ioctl; + ambanormal_driver.throttle = ambauart_throttle; + ambanormal_driver.unthrottle = ambauart_unthrottle; + ambanormal_driver.send_xchar = ambauart_send_xchar; + ambanormal_driver.set_termios = ambauart_set_termios; + ambanormal_driver.stop = ambauart_stop; + ambanormal_driver.start = ambauart_start; + ambanormal_driver.hangup = ambauart_hangup; + ambanormal_driver.break_ctl = ambauart_break_ctl; + ambanormal_driver.wait_until_sent = ambauart_wait_until_sent; + ambanormal_driver.read_proc = NULL; + + /* + * The callout device is just like the normal device except for + * the major number and the subtype code. + */ + ambacallout_driver = ambanormal_driver; + ambacallout_driver.name = CALLOUT_AMBA_NAME; + ambacallout_driver.major = CALLOUT_AMBA_MAJOR; + ambacallout_driver.subtype = SERIAL_TYPE_CALLOUT; + ambacallout_driver.read_proc = NULL; + ambacallout_driver.proc_entry = NULL; + + if (tty_register_driver(&ambanormal_driver)) + panic("Couldn't register AMBA serial driver\n"); + if (tty_register_driver(&ambacallout_driver)) + panic("Couldn't register AMBA callout driver\n"); + + for (i = 0; i < SERIAL_AMBA_NR; i++) { + struct amba_state *state = amba_state + i; + state->line = i; + state->close_delay = 5 * HZ / 10; + state->closing_wait = 30 * HZ; + state->callout_termios = ambacallout_driver.init_termios; + state->normal_termios = ambanormal_driver.init_termios; + } + + return 0; +} + +__initcall(ambauart_init); + +#ifdef CONFIG_SERIAL_AMBA_CONSOLE +/************** console driver *****************/ + +/* + * This code is currently never used; console->read is never called. + * Therefore, although we have an implementation, we don't use it. + * FIXME: the "const char *s" should be fixed to "char *s" some day. + * (when the definition in include/linux/console.h is also fixed) + */ +#ifdef used_and_not_const_char_pointer +static int ambauart_console_read(struct console *co, const char *s, u_int count) +{ + struct amba_port *port = &amba_ports[co->index]; + unsigned int status; + char *w; + int c; +#if DEBUG + printk("ambauart_console_read() called\n"); +#endif + + c = 0; + w = s; + while (c < count) { + status = UART_GET_FR(port); + if (UART_RX_DATA(status)) { + *w++ = UART_GET_CHAR(port); + c++; + } else { + // nothing more to get, return + return c; + } + } + // return the count + return c; +} +#endif + +/* + * Print a string to the serial port trying not to disturb + * any possible real use of the port... + * + * The console_lock must be held when we get here. + */ +static void ambauart_console_write(struct console *co, const char *s, u_int count) +{ + struct amba_port *port = &amba_ports[co->index]; + unsigned int status, old_cr; + int i; + + /* + * First save the CR then disable the interrupts + */ + old_cr = UART_GET_CR(port); + UART_PUT_CR(port, AMBA_UARTCR_UARTEN); + + /* + * Now, do each character + */ + for (i = 0; i < count; i++) { + do { + status = UART_GET_FR(port); + } while (!UART_TX_READY(status)); + UART_PUT_CHAR(port, s[i]); + if (s[i] == '\n') { + do { + status = UART_GET_FR(port); + } while (!UART_TX_READY(status)); + UART_PUT_CHAR(port, '\r'); + } + } + + /* + * Finally, wait for transmitter to become empty + * and restore the TCR + */ + do { + status = UART_GET_FR(port); + } while (status & AMBA_UARTFR_BUSY); + UART_PUT_CR(port, old_cr); +} + +/* + * Receive character from the serial port + */ +static int ambauart_console_wait_key(struct console *co) +{ + struct amba_port *port = &amba_ports[co->index]; + unsigned int status; + int c; + + do { + status = UART_GET_FR(port); + } while (!UART_RX_DATA(status)); + c = UART_GET_CHAR(port); + return c; +} + +static kdev_t ambauart_console_device(struct console *c) +{ + return MKDEV(SERIAL_AMBA_MAJOR, SERIAL_AMBA_MINOR + c->index); +} + +static int __init ambauart_console_setup(struct console *co, char *options) +{ + struct amba_port *port; + int baud = 38400; + int bits = 8; + int parity = 'n'; + u_int cflag = CREAD | HUPCL | CLOCAL; + u_int lcr_h, quot; + + if (co->index >= SERIAL_AMBA_NR) + co->index = 0; + + port = &amba_ports[co->index]; + + if (options) { + char *s = options; + baud = simple_strtoul(s, NULL, 10); + while (*s >= '0' && *s <= '9') + s++; + if (*s) parity = *s++; + if (*s) bits = *s - '0'; + } + + /* + * Now construct a cflag setting. + */ + switch (baud) { + case 1200: cflag |= B1200; break; + case 2400: cflag |= B2400; break; + case 4800: cflag |= B4800; break; + default: cflag |= B9600; baud = 9600; break; + case 19200: cflag |= B19200; break; + case 38400: cflag |= B38400; break; + case 57600: cflag |= B57600; break; + case 115200: cflag |= B115200; break; + } + switch (bits) { + case 7: cflag |= CS7; lcr_h = AMBA_UARTLCR_H_WLEN_7; break; + default: cflag |= CS8; lcr_h = AMBA_UARTLCR_H_WLEN_8; break; + } + switch (parity) { + case 'o': + case 'O': cflag |= PARODD; lcr_h |= AMBA_UARTLCR_H_PEN; break; + case 'e': + case 'E': cflag |= PARENB; lcr_h |= AMBA_UARTLCR_H_PEN | + AMBA_UARTLCR_H_EPS; break; + } + + co->cflag = cflag; + + if (port->fifosize > 1) + lcr_h |= AMBA_UARTLCR_H_FEN; + + quot = (port->uartclk / (16 * baud)) - 1; + + UART_PUT_LCRL(port, (quot & 0xff)); + UART_PUT_LCRM(port, (quot >> 8)); + UART_PUT_LCRH(port, lcr_h); + + /* we will enable the port as we need it */ + UART_PUT_CR(port, 0); + + return 0; +} + +static struct console ambauart_cons = +{ + name: SERIAL_AMBA_NAME, + write: ambauart_console_write, +#ifdef used_and_not_const_char_pointer + read: ambauart_console_read, +#endif + device: ambauart_console_device, + wait_key: ambauart_console_wait_key, + unblank: NULL, + setup: ambauart_console_setup, + flags: CON_PRINTBUFFER, + index: -1, +}; + +void __init ambauart_console_init(void) +{ + register_console(&ambauart_cons); +} + +#endif /* CONFIG_SERIAL_AMBA_CONSOLE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/toshiba.c linux/drivers/char/toshiba.c --- v2.4.0-test8/linux/drivers/char/toshiba.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/char/toshiba.c Mon Sep 18 15:02:03 2000 @@ -0,0 +1,553 @@ +/* toshiba.c -- Linux driver for accessing the SMM on Toshiba laptops + * + * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk) + * + * Valuable assistance and patches from: + * Tom May + * Rob Napier + * + * Fn status port numbers for machine ID's courtesy of + * 0xfc08: Garth Berry + * 0xfc11: Spencer Olson + * 0xfc13: Claudius Frankewitz + * 0xfc15: Tom May + * 0xfc17: Dave Konrad + * 0xfc1a: George Betzos + * 0xfc1d: Arthur Liu + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * This code is covered by the GNU GPL and you are free to make any + * changes you wish to it under the terms of the license. However the + * code has the potential to render your computer and/or someone else's + * unusable. Please proceed with care when modifying the code. + * + * Note: Unfortunately the laptop hardware can close the System Configuration + * Interface on it's own accord. It is therefore necessary for *all* + * programs using this driver to be aware that *any* SCI call can fail at + * *any* time. It is up to any program to be aware of this eventuality + * and take appropriate steps. + * + * 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, 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. + * + * The information used to write this driver has been obtained by reverse + * engineering the software supplied by Toshiba for their portable computers in + * strict accordance with the European Council Directive 92/250/EEC on the legal + * protection of computer programs, and it's implementation into English Law by + * the Copyright (Computer Programs) Regulations 1992 (S.I. 1992 No.3233). + * + */ + +#define TOSH_VERSION "1.7 22/6/2000" +#define TOSH_DEBUG 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define TOSH_MINOR_DEV 181 + +static int tosh_id = 0x0000; +static int tosh_bios = 0x0000; +static int tosh_date = 0x0000; +static int tosh_sci = 0x0000; +static int tosh_fan = 0; +static int tosh_start = 0; +static int tosh_extent = 0; + +static int tosh_fn = 0; + +MODULE_PARM(tosh_fn, "i"); + + +static int tosh_get_info(char *, char **, off_t, int, int); +static int tosh_open(struct inode *ip, struct file *); +static int tosh_release(struct inode *, struct file *); +static int tosh_ioctl(struct inode *, struct file *, unsigned int, + unsigned long); + + +static struct file_operations tosh_fops = { + owner: THIS_MODULE, + ioctl: tosh_ioctl, + open: tosh_open, + release: tosh_release, +}; + +static struct miscdevice tosh_device = { + TOSH_MINOR_DEV, + "toshiba", + &tosh_fops +}; + +static struct proc_dir_entry tosh_proc_entry = { + 0, 7, "toshiba", S_IFREG|S_IRUGO, 1, 0, 0, 33, NULL, tosh_get_info, NULL +}; + +/* + * Read the Fn key status + */ +static int tosh_fn_status(void) +{ + unsigned char scan; + unsigned long flags; + + if (tosh_fn!=0) { + scan = inb(tosh_fn); + } else { + save_flags(flags); + cli(); + outb(0x8e, 0xe4); + scan = inb(0xe5); + restore_flags(flags); + } + + return (int) scan; +} + + +/* + * At some point we need to emulate setting the HDD auto off times for + * the new laptops. We can do this by calling the ide_ioctl on /dev/hda. + * The values we need for the various times are + * + * Disabled 0x00 + * 1 minute 0x0c + * 3 minutes 0x24 + * 5 minutes 0x3c + * 10 minutes 0x78 + * 15 minutes 0xb4 + * 20 minutes 0xf0 + * 30 minutes 0xf1 + * + */ +/*static int tosh_emulate_hdd(SMMRegisters *regs) +{ + return 0; +}*/ + + +/* + * For the Portage 610CT and the Tecra 700CS/700CDT emulate the HCI fan function + */ +static int tosh_emulate_fan(SMMRegisters *regs) +{ + unsigned long eax,ecx,flags; + unsigned char al; + + eax = regs->eax & 0xff00; + ecx = regs->ecx & 0xffff; + + /* Portage 610CT */ + + if (tosh_id==0xfccb) { + if (eax==0xfe00) { + /* fan status */ + save_flags(flags); + cli(); + outb(0xbe, 0xe4); + al = inb(0xe5); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = (unsigned int) (al & 0x01); + } + if ((eax==0xff00) && (ecx==0x0000)) { + /* fan off */ + save_flags(flags); + cli(); + outb(0xbe, 0xe4); + al = inb(0xe5); + outb(0xbe, 0xe4); + outb (al | 0x01, 0xe5); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = 0x00; + } + if ((eax==0xff00) && (ecx==0x0001)) { + /* fan on */ + save_flags(flags); + cli(); + outb(0xbe, 0xe4); + al = inb(0xe5); + outb(0xbe, 0xe4); + outb(al & 0xfe, 0xe5); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = 0x01; + } + } + + /* Tecra 700CS/CDT */ + + if (tosh_id==0xfccc) { + if (eax==0xfe00) { + /* fan status */ + save_flags(flags); + cli(); + outb(0xe0, 0xe4); + al = inb(0xe5); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = al & 0x01; + } + if ((eax==0xff00) && (ecx==0x0000)) { + /* fan off */ + save_flags(flags); + cli(); + outb(0xe0, 0xe4); + al = inb(0xe5); + outw(0xe0 | ((al & 0xfe) << 8), 0xe4); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = 0x00; + } + if ((eax==0xff00) && (ecx==0x0001)) { + /* fan on */ + save_flags(flags); + cli(); + outb(0xe0, 0xe4); + al = inb(0xe5); + outw(0xe0 | ((al | 0x01) << 8), 0xe4); + restore_flags(flags); + regs->eax = 0x00; + regs->ecx = 0x01; + } + } + + return 0; +} + + +/* + * Put the laptop into System Management Mode + */ +static int tosh_smm(SMMRegisters *regs) +{ + int eax; + + asm ("# load the values into the registers\n\t" \ + "pushl %%eax\n\t" \ + "movl 0(%%eax),%%edx\n\t" \ + "push %%edx\n\t" \ + "movl 4(%%eax),%%ebx\n\t" \ + "movl 8(%%eax),%%ecx\n\t" \ + "movl 12(%%eax),%%edx\n\t" \ + "movl 16(%%eax),%%esi\n\t" \ + "movl 20(%%eax),%%edi\n\t" \ + "popl %%eax\n\t" \ + "# call the System Management mode\n\t" \ + "inb $0xb2,%%al\n\t" + "# fill out the memory with the values in the registers\n\t" \ + "xchgl %%eax,(%%esp)\n\t" + "movl %%ebx,4(%%eax)\n\t" \ + "movl %%ecx,8(%%eax)\n\t" \ + "movl %%edx,12(%%eax)\n\t" \ + "movl %%esi,16(%%eax)\n\t" \ + "movl %%edi,20(%%eax)\n\t" \ + "popl %%edx\n\t" \ + "movl %%edx,0(%%eax)\n\t" \ + "# setup the return value to the carry flag\n\t" \ + "lahf\n\t" \ + "shrl $8,%%eax\n\t" \ + "andl $1,%%eax\n" \ + : "=a" (eax) + : "a" (regs) + : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); + + return eax; +} + + +static int tosh_open(struct inode *ip, struct file *fp) +{ + MOD_INC_USE_COUNT; + + return 0; +} + + +static int tosh_release(struct inode *ip, struct file *fp) +{ + MOD_DEC_USE_COUNT; + + return 0; +} + + +static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, + unsigned long arg) +{ + SMMRegisters regs; + unsigned short ax,bx; + int err; + + if (!arg) + return -EINVAL; + + if(copy_from_user(®s, (SMMRegisters *) arg, sizeof(SMMRegisters))) + return -EFAULT; + + switch (cmd) { + case TOSH_SMM: + ax = regs.eax & 0xff00; + bx = regs.ebx & 0xffff; + /* block HCI calls to read/write memory & PCI devices */ + if (((ax==0xff00) || (ax==0xfe00)) && (bx>0x0069)) + return -EINVAL; + + /* do we need to emulate the fan ? */ + if (tosh_fan==1) { + if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { + err = tosh_emulate_fan(®s); + break; + } + } + err = tosh_smm(®s); + break; + default: + return -EINVAL; + } + + if(copy_to_user((SMMRegisters *) arg, ®s, sizeof(SMMRegisters))) + return -EFAULT; + + return (err==0) ? 0:-EINVAL; +} + + +/* + * Print the information for /proc/toshiba + */ +int tosh_get_info(char *buffer, char **start, off_t fpos, int length, int dummy) +{ + char *temp; + int key; + + temp = buffer; + key = tosh_fn_status(); + + /* Arguments + 0) Linux driver version (this will change if format changes) + 1) Machine ID + 2) SCI version + 3) BIOS version (major, minor) + 4) BIOS date (in SCI date format) + 5) Fn Key status + */ + + temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n", + tosh_id, + (tosh_sci & 0xff00)>>8, + tosh_sci & 0xff, + (tosh_bios & 0xff00)>>8, + tosh_bios & 0xff, + tosh_date, + key); + + return temp-buffer; +} + + +/* + * Determine which port to use for the Fn key status + */ +static void tosh_set_fn_port(void) +{ + switch (tosh_id) { + case 0xfc11: case 0xfc13: case 0xfc15: case 0xfc1a: + tosh_fn = 0x62; + break; + case 0xfc08: case 0xfc17: case 0xfc1d: case 0xfcd1: + case 0xfce0: case 0xfce2: + tosh_fn = 0x68; + break; + default: + tosh_fn = 0x00; + break; + } + + return; +} + + +/* + * Get the machine identification number of the current model + */ +static int tosh_get_machine_id(void) +{ + int id; + SMMRegisters regs; + unsigned short bx,cx; + unsigned long address; + + id = (0x100*(int) readb(0xffffe))+((int) readb(0xffffa)); + + /* do we have a SCTTable machine identication number on our hands */ + + if (id==0xfc2f) { + + /* start by getting a pointer into the BIOS */ + + regs.eax = 0xc000; + regs.ebx = 0x0000; + regs.ecx = 0x0000; + tosh_smm(®s); + bx = (unsigned short) (regs.ebx & 0xffff); + + /* At this point in the Toshiba routines under MS Windows + the bx register holds 0xe6f5. However my code is producing + a different value! For the time being I will just fudge the + value. This has been verified on a Satellite Pro 430CDT, + Tecra 750CDT, Tecra 780DVD and Satellite 310CDT. */ +#if TOSH_DEBUG + printk("toshiba: debugging ID ebx=0x%04x\n", regs.ebx); +#endif + bx = 0xe6f5; + + /* now twiddle with our pointer a bit */ + + address = 0x000f0000+bx; + cx = readw(address); + address = 0x000f0009+bx+cx; + cx = readw(address); + address = 0x000f000a+cx; + cx = readw(address); + + /* now construct our machine identification number */ + + id = ((cx & 0xff)<<8)+((cx & 0xff00)>>8); + } + + return id; +} + + +/* + * Probe for the presence of a Toshiba laptop + * + * returns and non-zero if unable to detect the presence of a Toshiba + * laptop, otherwise zero and determines the Machine ID, BIOS version and + * date, and SCI version. + */ +int tosh_probe(void) +{ + int major,minor,day,year,month,flag; + SMMRegisters regs; + + /* call the Toshiba SCI support check routine */ + + regs.eax = 0xf0f0; + regs.ebx = 0x0000; + regs.ecx = 0x0000; + flag = tosh_smm(®s); + + /* if this is not a Toshiba laptop carry flag is set and ah=0x86 */ + + if ((flag==1) || ((regs.eax & 0xff00)==0x8600)) { + printk("toshiba: not a supported Toshiba laptop\n"); + return -ENODEV; + } + + /* if we get this far then we are running on a Toshiba (probably)! */ + + tosh_sci = regs.edx & 0xffff; + + /* next get the machine ID of the current laptop */ + + tosh_id = tosh_get_machine_id(); + + /* get the BIOS version */ + + major = readb(0xfe009)-'0'; + minor = ((readb(0xfe00b)-'0')*10)+(readb(0xfe00c)-'0'); + tosh_bios = (major*0x100)+minor; + + /* get the BIOS date */ + + day = ((readb(0xffff5)-'0')*10)+(readb(0xffff6)-'0'); + month = ((readb(0xffff8)-'0')*10)+(readb(0xffff9)-'0'); + year = ((readb(0xffffb)-'0')*10)+(readb(0xffffc)-'0'); + tosh_date = (((year-90) & 0x1f)<<10) | ((month & 0xf)<<6) + | ((day & 0x1f)<<1); + + + /* in theory we should check the ports we are going to use for the + fn key detection (and the fan on the Portage 610/Tecra700), and + then request them to stop other drivers using them. However as + the keyboard driver grabs 0x60-0x6f and the pic driver grabs + 0xa0-0xbf we can't. We just have to live dangerously and use the + ports anyway, oh boy! */ + + + /* do we need to emulate the fan? */ + + if ((tosh_id==0xfccb) || (tosh_id==0xfccc)) + tosh_fan = 1; + + return 0; +} + +int __init tosh_init(void) +{ + /* are we running on a Toshiba laptop */ + + if (tosh_probe()!=0) + return -EIO; + + printk(KERN_INFO "Toshiba System Managment Mode driver v" + TOSH_VERSION"\n"); + + /* set the port to use for Fn status if not specified as a parameter */ + + if (tosh_fn==0x00) + tosh_set_fn_port(); + + /* register the device file */ + + misc_register(&tosh_device); + + /* register the proc entry */ + proc_register(&proc_root, &tosh_proc_entry); + return 0; +} + +#ifdef MODULE +int init_module(void) +{ + return tosh_init(); +} + +void cleanup_module(void) +{ + /* remove the proc entry */ + proc_unregister(&proc_root, tosh_proc_entry.low_ino); + + /* unregister the device file */ + misc_deregister(&tosh_device); + + /* release ports */ + release_region(tosh_start, tosh_extent); + + return; +} +#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c --- v2.4.0-test8/linux/drivers/char/tty_io.c Sat Aug 12 19:48:04 2000 +++ linux/drivers/char/tty_io.c Mon Sep 18 15:15:22 2000 @@ -2202,6 +2202,9 @@ #ifdef CONFIG_SERIAL_SA1100_CONSOLE sa1100_rs_console_init(); #endif +#ifdef CONFIG_SERIAL_AMBA_CONSOLE + ambauart_console_init(); +#endif } static struct tty_driver dev_tty_driver, dev_syscons_driver; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt.c linux/drivers/char/wdt.c --- v2.4.0-test8/linux/drivers/char/wdt.c Fri Jul 14 16:08:11 2000 +++ linux/drivers/char/wdt.c Mon Sep 11 08:41:07 2000 @@ -26,6 +26,7 @@ * Alan Cox : Cleaned up copy/user stuff * Tim Hockin : Added insmod parameters, comment cleanup * Parameterized timeout + * Tigran Aivazian : Restructured wdt_init() to handle failures */ #include @@ -49,7 +50,7 @@ #include #include -static int wdt_is_open=0; +static int wdt_is_open; /* * You must set these - there is no sane way to probe for this board. @@ -495,18 +496,53 @@ int __init wdt_init(void) { - printk(KERN_INFO "WDT500/501-P driver 0.07 at %X (Interrupt %d)\n", io,irq); - if(request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", &wdt_miscdev)) - { - printk(KERN_ERR "IRQ %d is not free.\n", irq); - return -EIO; + int ret; + + ret = misc_register(&wdt_miscdev); + if (ret) { + printk(KERN_ERR "wdt: can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out; } - misc_register(&wdt_miscdev); -#ifdef CONFIG_WDT_501 - misc_register(&temp_miscdev); -#endif - request_region(io, 8, "wdt501p"); - register_reboot_notifier(&wdt_notifier); - return 0; + ret = request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL); + if(ret) { + printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); + goto outmisc; + } + if (!request_region(io, 8, "wdt501p")) { + printk(KERN_ERR "wdt: IO %X is not free.\n", io); + ret = -EBUSY; + goto outirq; + } + ret = register_reboot_notifier(&wdt_notifier); + if(ret) { + printk(KERN_ERR "wdt: can't register reboot notifier (err=%d)\n", ret); + goto outreg; + } + +#ifdef CONFIG_WDT_501 + ret = misc_register(&temp_miscdev); + if (ret) { + printk(KERN_ERR "wdt: can't misc_register (temp) on minor=%d\n", TEMP_MINOR); + goto outrbt; + } +#endif + + ret = 0; + printk(KERN_INFO "WDT500/501-P driver 0.07 at %X (Interrupt %d)\n", io, irq); +out: + return ret; + +#ifdef CONFIG_WDT_501 +outrbt: + unregister_reboot_notifier(&wdt_notifier); +#endif + +outreg: + release_region(io,8); +outirq: + free_irq(irq, NULL); +outmisc: + misc_deregister(&wdt_miscdev); + goto out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt285.c linux/drivers/char/wdt285.c --- v2.4.0-test8/linux/drivers/char/wdt285.c Sun Aug 13 09:54:15 2000 +++ linux/drivers/char/wdt285.c Mon Sep 18 15:15:22 2000 @@ -6,8 +6,7 @@ * * SoftDog 0.05: A Software Watchdog Device * - * (c) Copyright 1996 Alan Cox , All Rights Reserved. - * http://www.cymru.net + * (c) Copyright 1996 Alan Cox , 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 @@ -32,7 +31,7 @@ #include #include #include -#include +#include /* * Define this to stop the watchdog actually rebooting the machine. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt977.c linux/drivers/char/wdt977.c --- v2.4.0-test8/linux/drivers/char/wdt977.c Wed Jul 12 21:58:42 2000 +++ linux/drivers/char/wdt977.c Mon Sep 18 15:15:22 2000 @@ -24,6 +24,7 @@ #include #include +#include #define WATCHDOG_MINOR 130 diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/wdt_pci.c linux/drivers/char/wdt_pci.c --- v2.4.0-test8/linux/drivers/char/wdt_pci.c Wed Jul 12 21:58:42 2000 +++ linux/drivers/char/wdt_pci.c Mon Sep 11 08:41:07 2000 @@ -29,6 +29,7 @@ * JP Nollmann : Added support for PCI wdt501p * Alan Cox : Split ISA and PCI cards into two drivers * Jeff Garzik : PCI cleanups + * Tigran Aivazian : Restructured wdtpci_init_one() to handle failures */ #include @@ -70,7 +71,7 @@ #define PCI_DEVICE_ID_WDG_CSM 0x22c0 #endif -static int wdt_is_open=0; +static int wdt_is_open; /* * You must set these - there is no sane way to probe for this board. @@ -499,6 +500,7 @@ const struct pci_device_id *ent) { static int dev_count = 0; + int ret = -EIO; dev_count++; if (dev_count > 1) { @@ -513,33 +515,53 @@ "(Interrupt %d)\n", io, irq); if (pci_enable_device (dev)) - goto err_out; + goto out; if (request_region (io, 16, "wdt-pci") == NULL) { printk (KERN_ERR PFX "I/O %d is not free.\n", io); - goto err_out; + goto out; } if (request_irq (irq, wdtpci_interrupt, SA_INTERRUPT | SA_SHIRQ, "wdt-pci", &wdtpci_miscdev)) { printk (KERN_ERR PFX "IRQ %d is not free.\n", irq); - goto err_out_free_res; + goto out_reg; } - misc_register (&wdtpci_miscdev); + ret = misc_register (&wdtpci_miscdev); + if (ret) { + printk (KERN_ERR PFX "can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out_irq; + } + ret = register_reboot_notifier (&wdtpci_notifier); + if (ret) { + printk (KERN_ERR PFX "can't misc_register on minor=%d\n", WATCHDOG_MINOR); + goto out_misc; + } #ifdef CONFIG_WDT_501 - misc_register (&temp_miscdev); + ret = misc_register (&temp_miscdev); + if (ret) { + printk (KERN_ERR PFX "can't misc_register (temp) on minor=%d\n", TEMP_MINOR); + goto out_rbt; + } #endif - register_reboot_notifier (&wdtpci_notifier); + ret = 0; +out: + return ret; - return 0; - -err_out_free_res: +#ifdef CONFIG_WDT_501 +out_rbt: + unregister_reboot_notifier(&wdtpci_notifier); +#endif +out_misc: + misc_deregister(&wdtpci_miscdev); +out_irq: + free_irq(irq, &wdtpci_miscdev); +out_reg: release_region (io, 16); -err_out: - return -EIO; + goto out; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/i2o/i2o_proc.c linux/drivers/i2o/i2o_proc.c --- v2.4.0-test8/linux/drivers/i2o/i2o_proc.c Wed Apr 12 09:38:53 2000 +++ linux/drivers/i2o/i2o_proc.c Sun Sep 17 09:45:06 2000 @@ -3319,7 +3319,7 @@ return 0; } -static int destroy_i2o_procfs(void) +static int __exit destroy_i2o_procfs(void) { struct i2o_controller *pctrl = NULL; int i; @@ -3342,10 +3342,6 @@ return 0; } -#ifdef MODULE -#define i2o_proc_init init_module -#endif - int __init i2o_proc_init(void) { if (i2o_install_handler(&i2o_proc_handler) < 0) @@ -3360,14 +3356,17 @@ return 0; } -#ifdef MODULE - MODULE_AUTHOR("Deepak Saxena"); MODULE_DESCRIPTION("I2O procfs Handler"); -void cleanup_module(void) +static void __exit i2o_proc_exit(void) { destroy_i2o_procfs(); i2o_remove_handler(&i2o_proc_handler); } + +#ifdef MODULE +module_init(i2o_proc_init); #endif +module_exit(i2o_proc_exit); + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/ide/icside.c linux/drivers/ide/icside.c --- v2.4.0-test8/linux/drivers/ide/icside.c Tue Jun 20 07:52:36 2000 +++ linux/drivers/ide/icside.c Mon Sep 18 15:15:22 2000 @@ -255,43 +255,7 @@ static int icside_build_dmatable(ide_drive_t *drive, int reading) { - dmasg_t *ide_sg = (dmasg_t *)HWIF(drive)->dmatable_cpu; - unsigned int count = 0; - int i; - struct scatterlist *sg; - - HWIF(drive)->sg_nents = i = ide_build_sglist(HWIF(drive), HWGROUP(drive)->rq); - - sg = HWIF(drive)->sg_table; - while (i && sg_dma_len(sg)) { - u32 cur_addr; - u32 cur_len; - - cur_addr = sg_dma_address(sg); - cur_len = sg_dma_len(sg); - - if (count >= (TABLE_SIZE / sizeof(dmasg_t))) { - printk("%s: DMA table too small\n", - drive->name); - pci_unmap_sg(NULL, - HWIF(drive)->sg_table, - HWIF(drive)->sg_nents, - HWIF(drive)->sg_dma_direction); - return 0; - } else { - ide_sg[count].address = cur_addr; - ide_sg[count].length = cur_len; - } - - count++; - sg++; - i--; - } - - if (!count) - printk("%s: empty DMA table?\n", drive->name); - - return count; + return HWIF(drive)->sg_nents = ide_build_sglist(HWIF(drive), HWGROUP(drive)->rq); } /* Teardown mappings after DMA has completed. */ @@ -435,7 +399,7 @@ */ set_dma_speed(hwif->hw.dma, drive->drive_data); - set_dma_sg(hwif->hw.dma, (dmasg_t *)hwif->dmatable_cpu, count); + set_dma_sg(hwif->hw.dma, HWIF(drive)->sg_table, count); set_dma_mode(hwif->hw.dma, reading ? DMA_MODE_READ : DMA_MODE_WRITE); @@ -465,31 +429,6 @@ } } -static void *icside_alloc_dmatable(void) -{ - static unsigned long dmatable; - static unsigned int leftover; - unsigned long table; - - if (leftover < TABLE_SIZE) { -#if PAGE_SIZE == TABLE_SIZE * 2 - dmatable = __get_free_pages(GFP_KERNEL, 1); - leftover = PAGE_SIZE; -#else - dmatable = kmalloc(TABLE_SIZE, GFP_KERNEL); - leftover = TABLE_SIZE; -#endif - } - - table = dmatable; - if (table) { - dmatable += TABLE_SIZE; - leftover -= TABLE_SIZE; - } - - return (void *)table; -} - static int icside_setup_dma(ide_hwif_t *hwif, int autodma) { @@ -500,14 +439,8 @@ if (!hwif->sg_table) goto failed; - hwif->dmatable_cpu = icside_alloc_dmatable(); - - if (!hwif->dmatable_cpu) { - kfree(hwif->sg_table); - hwif->sg_table = NULL; - goto failed; - } - + hwif->dmatable_cpu = NULL; + hwif->dmatable_dma = 0; hwif->speedproc = icside_set_speed; hwif->dmaproc = icside_dmaproc; hwif->autodma = autodma; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/ide/ide-proc.c linux/drivers/ide/ide-proc.c --- v2.4.0-test8/linux/drivers/ide/ide-proc.c Thu Apr 13 22:54:26 2000 +++ linux/drivers/ide/ide-proc.c Mon Sep 18 14:57:01 2000 @@ -159,7 +159,7 @@ unsigned long startn = 0, n, flags; const char *start = NULL, *msg = NULL; - if (!capable(CAP_SYS_ADMIN)) + if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; /* * Skip over leading whitespace diff -u --recursive --new-file v2.4.0-test8/linux/drivers/ide/ide.c linux/drivers/ide/ide.c --- v2.4.0-test8/linux/drivers/ide/ide.c Tue Sep 5 13:08:42 2000 +++ linux/drivers/ide/ide.c Mon Sep 11 08:42:57 2000 @@ -1082,7 +1082,7 @@ { byte *args = rq->buffer; if (args && rq->cmd == IDE_DRIVE_TASK) { - + byte sel; #ifdef DEBUG printk("%s: DRIVE_TASK_CMD data=x%02x cmd=0x%02x fr=0x%02x ns=0x%02x sc=0x%02x lcyl=0x%02x hcyl=0x%02x sel=0x%02x\n", drive->name, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); @@ -1091,7 +1091,10 @@ OUT_BYTE(args[3], IDE_SECTOR_REG); OUT_BYTE(args[4], IDE_LCYL_REG); OUT_BYTE(args[5], IDE_HCYL_REG); - OUT_BYTE(args[6], IDE_SELECT_REG); + sel = (args[6] & ~0x10); + if (drive->select.b.unit) + sel |= 0x10; + OUT_BYTE(sel, IDE_SELECT_REG); ide_cmd(drive, args[0], args[2], &drive_cmd_intr); return ide_started; } else if (args) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/b1.c linux/drivers/isdn/avmb1/b1.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/b1.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/b1.c Mon Sep 18 15:02:02 2000 @@ -517,7 +517,7 @@ struct sk_buff *skb; unsigned ApplId; - unsigned MsgLen; + signed MsgLen; unsigned DataB3Len; unsigned NCCI; unsigned WindowSize; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/b1dma.c linux/drivers/isdn/avmb1/b1dma.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/b1dma.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/b1dma.c Mon Sep 18 15:02:02 2000 @@ -475,7 +475,8 @@ struct capi_ctr *ctrl = cinfo->capi_ctrl; struct sk_buff *skb; void *p = dma->recvbuf+4; - __u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; + __u32 ApplId, DataB3Len, NCCI, WindowSize; + __s32 MsgLen; __u8 b1cmd = _get_byte(&p); #ifdef CONFIG_B1DMA_DEBUG diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/c4.c linux/drivers/isdn/avmb1/c4.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/c4.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/c4.c Mon Sep 18 15:02:02 2000 @@ -572,7 +572,8 @@ avmctrl_info *cinfo; struct sk_buff *skb; void *p = dma->recvbuf; - __u32 ApplId, MsgLen, DataB3Len, NCCI, WindowSize; + __u32 ApplId, DataB3Len, NCCI, WindowSize; + __s32 MsgLen; __u8 b1cmd = _get_byte(&p); __u32 cidx; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/capi.c linux/drivers/isdn/avmb1/capi.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/capi.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/capi.c Sun Sep 17 09:45:05 2000 @@ -212,6 +212,7 @@ #include #include #include +#include #include "capiutil.h" #include "capicmd.h" #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE @@ -1930,7 +1931,7 @@ { "capi/capi20ncci", 0 , proc_capincci_read_proc }, }; -static void proc_init(void) +static void __init proc_init(void) { int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]); int i; @@ -1942,7 +1943,7 @@ } } -static void proc_exit(void) +static void __exit proc_exit(void) { int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]); int i; @@ -1981,7 +1982,7 @@ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ } -static int alloc_init(void) +static int __init alloc_init(void) { capidev_cachep = kmem_cache_create("capi20_dev", sizeof(struct capidev), @@ -2052,10 +2053,6 @@ } } -#ifdef MODULE -#define capi_init init_module -#endif - static struct capi_interface_user cuser = { "capi20", lower_callback, @@ -2063,7 +2060,7 @@ static char rev[10]; -int capi_init(void) +int __init capi_init(void) { char *p; @@ -2152,8 +2149,7 @@ return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit capi_exit(void) { #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE unsigned int j; @@ -2177,4 +2173,8 @@ printk(KERN_NOTICE "capi: Rev%s: unloaded\n", rev); } +#ifdef MODULE +module_init(capi_init); #endif +module_exit(capi_exit); + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/capidrv.c linux/drivers/isdn/avmb1/capidrv.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/capidrv.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/capidrv.c Sun Sep 17 09:45:05 2000 @@ -200,6 +200,7 @@ #include #include #include +#include #include #include "capiutil.h" @@ -2436,7 +2437,7 @@ { "capi/capidrv", 0 , proc_capidrv_read_proc }, }; -static void proc_init(void) +static void __init proc_init(void) { int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]); int i; @@ -2448,7 +2449,7 @@ } } -static void proc_exit(void) +static void __exit proc_exit(void) { int nelem = sizeof(procfsentries)/sizeof(procfsentries[0]); int i; @@ -2467,11 +2468,7 @@ lower_callback }; -#ifdef MODULE -#define capidrv_init init_module -#endif - -int capidrv_init(void) +int __init capidrv_init(void) { struct capi_register_params rparam; capi_profile profile; @@ -2531,8 +2528,7 @@ return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit capidrv_exit(void) { char rev[10]; char *p; @@ -2554,4 +2550,8 @@ printk(KERN_NOTICE "capidrv: Rev%s: unloaded\n", rev); } +#ifdef MODULE +module_init(capidrv_init); #endif +module_exit(capidrv_exit); + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/isdn/avmb1/t1isa.c linux/drivers/isdn/avmb1/t1isa.c --- v2.4.0-test8/linux/drivers/isdn/avmb1/t1isa.c Mon Aug 21 07:49:02 2000 +++ linux/drivers/isdn/avmb1/t1isa.c Mon Sep 18 15:02:02 2000 @@ -200,7 +200,7 @@ struct sk_buff *skb; unsigned ApplId; - unsigned MsgLen; + signed MsgLen; unsigned DataB3Len; unsigned NCCI; unsigned WindowSize; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/Makefile linux/drivers/macintosh/Makefile --- v2.4.0-test8/linux/drivers/macintosh/Makefile Sat May 20 12:07:56 2000 +++ linux/drivers/macintosh/Makefile Sun Sep 17 09:48:05 2000 @@ -9,76 +9,67 @@ # parent makes.. # -SUB_DIRS := -MOD_SUB_DIRS := $(SUB_DIRS) +# Subdirs. -O_TARGET := macintosh.o -O_OBJS := -M_OBJS := +SUB_DIRS := +MOD_SUB_DIRS := $(SUB_DIRS) +MOD_IN_SUB_DIRS := $(SUB_DIRS) +ALL_SUB_DIRS := $(SUB_DIRS) -ifeq ($(CONFIG_PMAC_PBOOK),y) - O_OBJS += mediabay.o -else - ifeq ($(CONFIG_MAC_FLOPPY),y) - O_OBJS += mediabay.o - endif -endif +# The target object and module list name. -ifeq ($(CONFIG_MAC_SERIAL),y) - O_OBJS += macserial.o -else - ifeq ($(CONFIG_MAC_SERIAL),m) - M_OBJS += macserial.o - endif -endif +O_TARGET := macintosh.o +M_OBJS := +O_OBJS := +MOD_LIST_NAME := MACINTOSH_MODULES -ifeq ($(CONFIG_NVRAM),y) - O_OBJS += nvram.o -else - ifeq ($(CONFIG_NVRAM),m) - M_OBJS += nvram.o - endif -endif +# Objects that export symbols. -ifdef CONFIG_ADB - OX_OBJS := adb.o -endif +export-objs := adb.o rtc.o mac_hid.o -ifdef CONFIG_ADB_KEYBOARD - O_OBJS += mac_keyb.o -endif +# Object file lists. -ifdef CONFIG_ADB_MACII - O_OBJS += via-macii.o -endif +obj-y := +obj-m := +obj-n := +obj- := -ifdef CONFIG_ADB_MACIISI - O_OBJS += via-maciisi.o -endif +# Each configuration option enables a list of files. -ifdef CONFIG_ADB_CUDA - O_OBJS += via-cuda.o +ifeq ($(CONFIG_PMAC_PBOOK),y) + obj-y += mediabay.o endif -ifdef CONFIG_ADB_IOP - O_OBJS += adb-iop.o -endif +obj-$(CONFIG_MAC_SERIAL) += macserial.o +obj-$(CONFIG_NVRAM) += nvram.o +obj-$(CONFIG_MAC_HID) += mac_hid.o +obj-$(CONFIG_INPUT_ADBHID) += adbhid.o +obj-$(CONFIG_PPC_RTC) += rtc.o -ifdef CONFIG_ADB_PMU - O_OBJS += via-pmu.o -endif +obj-$(CONFIG_ADB_PMU) += via-pmu.o +obj-$(CONFIG_ADB_CUDA) += via-cuda.o -ifdef CONFIG_ADB_PMU68K - O_OBJS += via-pmu68k.o -endif +obj-$(CONFIG_ADB) += adb.o +obj-$(CONFIG_ADB_KEYBOARD) += mac_keyb.o +obj-$(CONFIG_ADB_MACII) += via-macii.o +obj-$(CONFIG_ADB_MACIISI) += via-maciisi.o +obj-$(CONFIG_ADB_IOP) += adb-iop.o +obj-$(CONFIG_ADB_PMU68K) += via-pmu68k.o +obj-$(CONFIG_ADB_MACIO) += macio-adb.o -ifdef CONFIG_ADB_MACIO - O_OBJS += macio-adb.o -endif +# Files that are both resident and modular: remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(sort $(filter-out $(export-objs), $(obj-y))) +OX_OBJS := $(sort $(filter $(export-objs), $(obj-y))) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) + +# The global Rules.make. include $(TOPDIR)/Rules.make -# Integrated in mac_keyb.c -# mackeymap.map is retained for historical reasons -#mackeymap.c: mackeymap.map -# loadkeys --mktable mackeymap.map > mackeymap.c diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/adb.c linux/drivers/macintosh/adb.c --- v2.4.0-test8/linux/drivers/macintosh/adb.c Wed Jul 12 21:58:42 2000 +++ linux/drivers/macintosh/adb.c Sun Sep 17 09:48:05 2000 @@ -393,6 +393,15 @@ return ids->nids; } +int +adb_unregister(int index) +{ + if (!adb_handler[index].handler) + return -ENODEV; + adb_handler[index].handler = 0; + return 0; +} + void adb_input(unsigned char *buf, int nb, struct pt_regs *regs, int autopoll) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/adbhid.c linux/drivers/macintosh/adbhid.c --- v2.4.0-test8/linux/drivers/macintosh/adbhid.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/macintosh/adbhid.c Sun Sep 17 09:48:05 2000 @@ -0,0 +1,875 @@ +/* + * drivers/input/adbhid.c + * + * ADB HID driver for Power Macintosh computers. + * + * Adapted from drivers/macintosh/mac_keyb.c by Franz Sirl + * (see that file for its authors and contributors). + * + * Copyright (C) 2000 Franz Sirl. + * + * Adapted to ADB changes and support for more devices by + * Benjamin Herrenschmidt. Adapted from code in MkLinux + * and reworked. + * + * Supported devices: + * + * - Standard 1 button mouse + * - All standard Apple Extended protocol (handler ID 4) + * - mouseman and trackman mice & trackballs + * - PowerBook Trackpad (default setup: enable tapping) + * - MicroSpeed mouse & trackball (needs testing) + * - CH Products Trackball Pro (needs testing) + * - Contour Design (Contour Mouse) + * - Hunter digital (NoHandsMouse) + * - Kensignton TurboMouse 5 (needs testing) + * - Mouse Systems A3 mice and trackballs + * - MacAlly 2-buttons mouse (needs testing) + * + * To do: + * + * Improve Kensington support. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif + +MODULE_AUTHOR("Franz Sirl "); + +#define KEYB_KEYREG 0 /* register # for key up/down data */ +#define KEYB_LEDREG 2 /* register # for leds on ADB keyboard */ +#define MOUSE_DATAREG 0 /* reg# for movement/button codes from mouse */ + +static int adb_message_handler(struct notifier_block *, unsigned long, void *); +static struct notifier_block adbhid_adb_notifier = { + notifier_call: adb_message_handler, +}; + +unsigned char adb_to_linux_keycodes[128] = { + 30, 31, 32, 33, 35, 34, 44, 45, 46, 47, 86, 48, 16, 17, 18, 19, + 21, 20, 2, 3, 4, 5, 7, 6, 13, 10, 8, 12, 9, 11, 27, 24, + 22, 26, 23, 25, 28, 38, 36, 40, 37, 39, 43, 51, 53, 49, 50, 52, + 15, 57, 41, 14, 96, 1, 29,125, 42, 58, 56,105,106,108,103, 0, + 0, 83, 0, 55, 0, 78, 0, 69, 0, 0, 0, 98, 96, 0, 74, 0, + 0,117, 82, 79, 80, 81, 75, 76, 77, 71, 0, 72, 73,183,181,124, + 63, 64, 65, 61, 66, 67,191, 87,190, 99, 0, 70, 0, 68,101, 88, + 0,119,110,102,104,111, 62,107, 60,109, 59, 54,100, 97,116,116 +}; + +struct adbhid { + struct input_dev input; + int id; + int default_id; + int original_handler_id; + int current_handler_id; + int mouse_kind; + unsigned char *keycode; + char name[64]; +}; + +static struct adbhid *adbhid[16] = { 0 }; + +static void adbhid_probe(void); + +static void adbhid_input_keycode(int, int, int); +static void leds_done(struct adb_request *); + +static void init_trackpad(int id); +static void init_trackball(int id); +static void init_turbomouse(int id); +static void init_microspeed(int id); +static void init_ms_a3(int id); + +static struct adb_ids keyboard_ids; +static struct adb_ids mouse_ids; +static struct adb_ids buttons_ids; + +/* Kind of keyboard, see Apple technote 1152 */ +#define ADB_KEYBOARD_UNKNOWN 0 +#define ADB_KEYBOARD_ANSI 0x0100 +#define ADB_KEYBOARD_ISO 0x0200 +#define ADB_KEYBOARD_JIS 0x0300 + +/* Kind of mouse */ +#define ADBMOUSE_STANDARD_100 0 /* Standard 100cpi mouse (handler 1) */ +#define ADBMOUSE_STANDARD_200 1 /* Standard 200cpi mouse (handler 2) */ +#define ADBMOUSE_EXTENDED 2 /* Apple Extended mouse (handler 4) */ +#define ADBMOUSE_TRACKBALL 3 /* TrackBall (handler 4) */ +#define ADBMOUSE_TRACKPAD 4 /* Apple's PowerBook trackpad (handler 4) */ +#define ADBMOUSE_TURBOMOUSE5 5 /* Turbomouse 5 (previously req. mousehack) */ +#define ADBMOUSE_MICROSPEED 6 /* Microspeed mouse (&trackball ?), MacPoint */ +#define ADBMOUSE_TRACKBALLPRO 7 /* Trackball Pro (special buttons) */ +#define ADBMOUSE_MS_A3 8 /* Mouse systems A3 trackball (handler 3) */ +#define ADBMOUSE_MACALLY2 9 /* MacAlly 2-button mouse */ + +static void +adbhid_keyboard_input(unsigned char *data, int nb, struct pt_regs *regs, int apoll) +{ + int id = (data[0] >> 4) & 0x0f; + + if (!adbhid[id]) { + printk(KERN_ERR "ADB HID on ID %d not yet registered, packet %#02x, %#02x, %#02x, %#02x\n", + id, data[0], data[1], data[2], data[3]); + return; + } + + /* first check this is from register 0 */ + if (nb != 3 || (data[0] & 3) != KEYB_KEYREG) + return; /* ignore it */ + kbd_pt_regs = regs; + adbhid_input_keycode(id, data[1], 0); + if (!(data[2] == 0xff || (data[2] == 0x7f && data[1] == 0x7f))) + adbhid_input_keycode(id, data[2], 0); +} + +static void +adbhid_input_keycode(int id, int keycode, int repeat) +{ + int up_flag; + + up_flag = (keycode & 0x80); + keycode &= 0x7f; + + switch (keycode) { + case 0x39: /* Generate down/up events for CapsLock everytime. */ + input_report_key(&adbhid[id]->input, KEY_CAPSLOCK, 1); + input_report_key(&adbhid[id]->input, KEY_CAPSLOCK, 0); + return; + case 0x3f: /* ignore Powerbook Fn key */ + return; + } + + if (adbhid[id]->keycode[keycode]) + input_report_key(&adbhid[id]->input, + adbhid[id]->keycode[keycode], !up_flag); + else + printk(KERN_INFO "Unhandled ADB key (scancode %#02x) %s.\n", keycode, + up_flag ? "released" : "pressed"); +} + +static void +adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll) +{ + int id = (data[0] >> 4) & 0x0f; + + if (!adbhid[id]) { + printk(KERN_ERR "ADB HID on ID %d not yet registered\n", id); + return; + } + + /* + Handler 1 -- 100cpi original Apple mouse protocol. + Handler 2 -- 200cpi original Apple mouse protocol. + + For Apple's standard one-button mouse protocol the data array will + contain the following values: + + BITS COMMENTS + data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd. + data[1] = bxxx xxxx First button and x-axis motion. + data[2] = byyy yyyy Second button and y-axis motion. + + Handler 4 -- Apple Extended mouse protocol. + + For Apple's 3-button mouse protocol the data array will contain the + following values: + + BITS COMMENTS + data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd. + data[1] = bxxx xxxx Left button and x-axis motion. + data[2] = byyy yyyy Second button and y-axis motion. + data[3] = byyy bxxx Third button and fourth button. Y is additional + high bits of y-axis motion. XY is additional + high bits of x-axis motion. + + MacAlly 2-button mouse protocol. + + For MacAlly 2-button mouse protocol the data array will contain the + following values: + + BITS COMMENTS + data[0] = dddd 1100 ADB command: Talk, register 0, for device dddd. + data[1] = bxxx xxxx Left button and x-axis motion. + data[2] = byyy yyyy Right button and y-axis motion. + data[3] = ???? ???? unknown + data[4] = ???? ???? unknown + + */ + + /* If it's a trackpad, we alias the second button to the first. + NOTE: Apple sends an ADB flush command to the trackpad when + the first (the real) button is released. We could do + this here using async flush requests. + */ + switch (adbhid[id]->mouse_kind) + { + case ADBMOUSE_TRACKPAD: + data[1] = (data[1] & 0x7f) | ((data[1] & data[2]) & 0x80); + data[2] = data[2] | 0x80; + break; + case ADBMOUSE_MICROSPEED: + data[1] = (data[1] & 0x7f) | ((data[3] & 0x01) << 7); + data[2] = (data[2] & 0x7f) | ((data[3] & 0x02) << 6); + data[3] = (data[3] & 0x77) | ((data[3] & 0x04) << 5) + | (data[3] & 0x08); + break; + case ADBMOUSE_TRACKBALLPRO: + data[1] = (data[1] & 0x7f) | (((data[3] & 0x04) << 5) + & ((data[3] & 0x08) << 4)); + data[2] = (data[2] & 0x7f) | ((data[3] & 0x01) << 7); + data[3] = (data[3] & 0x77) | ((data[3] & 0x02) << 6); + break; + case ADBMOUSE_MS_A3: + data[1] = (data[1] & 0x7f) | ((data[3] & 0x01) << 7); + data[2] = (data[2] & 0x7f) | ((data[3] & 0x02) << 6); + data[3] = ((data[3] & 0x04) << 5); + break; + case ADBMOUSE_MACALLY2: + data[3] = (data[2] & 0x80) ? 0x80 : 0x00; + data[2] |= 0x80; /* Right button is mapped as button 3 */ + nb=4; + break; + } + + input_report_key(&adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1)); + input_report_key(&adbhid[id]->input, BTN_MIDDLE, !((data[2] >> 7) & 1)); + + if (nb >= 4) + input_report_key(&adbhid[id]->input, BTN_RIGHT, !((data[3] >> 7) & 1)); + + input_report_rel(&adbhid[id]->input, REL_X, + ((data[2]&0x7f) < 64 ? (data[2]&0x7f) : (data[2]&0x7f)-128 )); + input_report_rel(&adbhid[id]->input, REL_Y, + ((data[1]&0x7f) < 64 ? (data[1]&0x7f) : (data[1]&0x7f)-128 )); +} + +static void +adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll) +{ + int id = (data[0] >> 4) & 0x0f; + + if (!adbhid[id]) { + printk(KERN_ERR "ADB HID on ID %d not yet registered\n", id); + return; + } + + switch (adbhid[id]->original_handler_id) { + default: + case 0x02: /* Adjustable keyboard button device */ + printk(KERN_INFO "Unhandled ADB_MISC event %02x, %02x, %02x, %02x\n", + data[0], data[1], data[2], data[3]); + break; + case 0x1f: /* Powerbook button device */ + { +#ifdef CONFIG_PMAC_BACKLIGHT + int backlight = get_backlight_level(); + + /* + * XXX: Where is the contrast control for the passive? + * -- Cort + */ + + switch (data[1]) { + case 0x8: /* mute */ + break; + + case 0x7: /* contrast decrease */ + break; + + case 0x6: /* contrast increase */ + break; + + case 0xa: /* brightness decrease */ + if (backlight < 0) + break; + if (backlight > BACKLIGHT_OFF) + set_backlight_level(backlight-1); + else + set_backlight_level(BACKLIGHT_OFF); + break; + + case 0x9: /* brightness increase */ + if (backlight < 0) + break; + if (backlight < BACKLIGHT_MAX) + set_backlight_level(backlight+1); + else + set_backlight_level(BACKLIGHT_MAX); + break; + } +#endif /* CONFIG_PMAC_BACKLIGHT */ + } + break; + } +} + +static struct adb_request led_request; +static int leds_pending[16]; +static int pending_devs[16]; +static int pending_led_start=0; +static int pending_led_end=0; + +static void real_leds(unsigned char leds, int device) +{ + if (led_request.complete) { + adb_request(&led_request, leds_done, 0, 3, + ADB_WRITEREG(device, KEYB_LEDREG), 0xff, + ~leds); + } else { + if (!(leds_pending[device] & 0x100)) { + pending_devs[pending_led_end] = device; + pending_led_end++; + pending_led_end = (pending_led_end < 16) ? pending_led_end : 0; + } + leds_pending[device] = leds | 0x100; + } +} + +/* + * Event callback from the input module. Events that change the state of + * the hardware are processed here. + */ +static int adbhid_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +{ + struct adbhid *adbhid = dev->private; + unsigned char leds; + + switch (type) { + case EV_LED: + leds = (test_bit(LED_SCROLLL, dev->led) ? 4 : 0) + | (test_bit(LED_NUML, dev->led) ? 1 : 0) + | (test_bit(LED_CAPSL, dev->led) ? 2 : 0); + real_leds(leds, adbhid->id); + return 0; + } + + return -1; +} + +static void leds_done(struct adb_request *req) +{ + int leds,device; + + if (pending_led_start != pending_led_end) { + device = pending_devs[pending_led_start]; + leds = leds_pending[device] & 0xff; + leds_pending[device] = 0; + pending_led_start++; + pending_led_start = (pending_led_start < 16) ? pending_led_start : 0; + real_leds(leds,device); + } + +} + +static int +adb_message_handler(struct notifier_block *this, unsigned long code, void *x) +{ + unsigned long flags; + + switch (code) { + case ADB_MSG_PRE_RESET: + case ADB_MSG_POWERDOWN: + /* Stop the repeat timer. Autopoll is already off at this point */ + save_flags(flags); + cli(); + { + int i; + for (i = 1; i < 16; i++) { + if (adbhid[i]) + del_timer(&adbhid[i]->input.timer); + } + } + restore_flags(flags); + + /* Stop pending led requests */ + while(!led_request.complete) + adb_poll(); + break; + + case ADB_MSG_POST_RESET: + adbhid_probe(); + break; + } + return NOTIFY_DONE; +} + +static void +adbhid_input_register(int id, int default_id, int original_handler_id, + int current_handler_id, int mouse_kind) +{ + int i; + + if (adbhid[id]) { + printk(KERN_ERR "Trying to reregister ADB HID on ID %d\n", id); + return; + } + + if (!(adbhid[id] = kmalloc(sizeof(struct adbhid), GFP_KERNEL))) + return; + + memset(adbhid[id], 0, sizeof(struct adbhid)); + + adbhid[id]->id = default_id; + adbhid[id]->original_handler_id = original_handler_id; + adbhid[id]->current_handler_id = current_handler_id; + adbhid[id]->mouse_kind = mouse_kind; + adbhid[id]->input.private = adbhid[id]; + adbhid[id]->input.name = adbhid[id]->name; + adbhid[id]->input.idbus = BUS_ADB; + adbhid[id]->input.idvendor = 0x0001; + adbhid[id]->input.idproduct = (id << 12) | (default_id << 8) | original_handler_id; + adbhid[id]->input.idversion = 0x0100; + + switch (default_id) { + case ADB_KEYBOARD: + if (!(adbhid[id]->keycode = kmalloc(sizeof(adb_to_linux_keycodes), GFP_KERNEL))) { + kfree(adbhid[id]); + return; + } + + sprintf(adbhid[id]->name, "ADB keyboard on ID %d:%d.%02x", + id, default_id, original_handler_id); + + memcpy(adbhid[id]->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes)); + + printk(KERN_INFO "Detected ADB keyboard, type "); + switch (original_handler_id) { + default: + printk(".\n"); + adbhid[id]->input.idversion = ADB_KEYBOARD_UNKNOWN; + break; + + case 0x01: case 0x02: case 0x03: case 0x06: case 0x08: + case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C: + case 0xC0: case 0xC3: case 0xC6: + printk("ANSI.\n"); + adbhid[id]->input.idversion = ADB_KEYBOARD_ANSI; + break; + + case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D: + case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1: + case 0xC4: case 0xC7: + printk("ISO, swapping keys.\n"); + adbhid[id]->input.idversion = ADB_KEYBOARD_ISO; + i = adbhid[id]->keycode[10]; + adbhid[id]->keycode[10] = adbhid[id]->keycode[50]; + adbhid[id]->keycode[50] = i; + break; + + case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A: + case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9: + printk("JIS.\n"); + adbhid[id]->input.idversion = ADB_KEYBOARD_JIS; + break; + } + + for (i = 0; i < 128; i++) + if (adbhid[id]->keycode[i]) + set_bit(adbhid[id]->keycode[i], adbhid[id]->input.keybit); + + adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); + adbhid[id]->input.ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML); + adbhid[id]->input.event = adbhid_kbd_event; + adbhid[id]->input.keycodemax = 127; + adbhid[id]->input.keycodesize = 1; + break; + + case ADB_MOUSE: + sprintf(adbhid[id]->name, "ADB mouse on ID %d:%d.%02x", + id, default_id, original_handler_id); + + adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); + adbhid[id]->input.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); + adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y); + break; + + case ADB_MISC: + switch (original_handler_id) { + case 0x02: /* Adjustable keyboard button device */ + sprintf(adbhid[id]->name, "ADB adjustable keyboard buttons on ID %d:%d.%02x", + id, default_id, original_handler_id); + break; + case 0x1f: /* Powerbook button device */ + sprintf(adbhid[id]->name, "ADB Powerbook buttons on ID %d:%d.%02x", + id, default_id, original_handler_id); + break; + } + if (adbhid[id]->name[0]) + break; + /* else fall through */ + + default: + printk(KERN_INFO "Trying to register unknown ADB device to input layer.\n"); + kfree(adbhid[id]); + return; + } + + adbhid[id]->input.keycode = adbhid[id]->keycode; + + input_register_device(&adbhid[id]->input); + + printk(KERN_INFO "input%d: ADB HID on ID %d:%d.%02x\n", + adbhid[id]->input.number, id, default_id, original_handler_id); + + if (default_id == ADB_KEYBOARD) { + /* HACK WARNING!! This should go away as soon there is an utility + * to control that for event devices. + */ + adbhid[id]->input.rep[REP_DELAY] = HZ/2; /* input layer default: HZ/4 */ + adbhid[id]->input.rep[REP_PERIOD] = HZ/15; /* input layer default: HZ/33 */ + } +} + +static void adbhid_input_unregister(int id) +{ + input_unregister_device(&adbhid[id]->input); + if (adbhid[id]->keycode) + kfree(adbhid[id]->keycode); + kfree(adbhid[id]); + adbhid[id] = 0; +} + + +static void +adbhid_probe(void) +{ + struct adb_request req; + int i, default_id, org_handler_id, cur_handler_id; + + for (i = 1; i < 16; i++) { + if (adbhid[i]) + adbhid_input_unregister(i); + } + + adb_register(ADB_MOUSE, 0, &mouse_ids, adbhid_mouse_input); + adb_register(ADB_KEYBOARD, 0, &keyboard_ids, adbhid_keyboard_input); + adb_register(ADB_MISC, 0, &buttons_ids, adbhid_buttons_input); + + for (i = 0; i < keyboard_ids.nids; i++) { + int id = keyboard_ids.id[i]; + + adb_get_infos(id, &default_id, &org_handler_id); + + /* turn off all leds */ + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id, KEYB_LEDREG), 0xff, 0xff); + + /* Enable full feature set of the keyboard + ->get it to send separate codes for left and right shift, + control, option keys */ +#if 0 /* handler 5 doesn't send separate codes for R modifiers */ + if (adb_try_handler_change(id, 5)) + printk("ADB keyboard at %d, handler set to 5\n", id); + else +#endif + if (adb_try_handler_change(id, 3)) + printk("ADB keyboard at %d, handler set to 3\n", id); + else + printk("ADB keyboard at %d, handler 1\n", id); + + adb_get_infos(id, &default_id, &cur_handler_id); + adbhid_input_register(id, default_id, org_handler_id, cur_handler_id, 0); + } + + for (i = 0; i < buttons_ids.nids; i++) { + int id = buttons_ids.id[i]; + + adb_get_infos(id, &default_id, &org_handler_id); + adbhid_input_register(id, default_id, org_handler_id, org_handler_id, 0); + } + + /* Try to switch all mice to handler 4, or 2 for three-button + mode and full resolution. */ + for (i = 0; i < mouse_ids.nids; i++) { + int id = mouse_ids.id[i]; + int mouse_kind; + + adb_get_infos(id, &default_id, &org_handler_id); + + if (adb_try_handler_change(id, 4)) { + printk("ADB mouse at %d, handler set to 4", id); + mouse_kind = ADBMOUSE_EXTENDED; + } + else if (adb_try_handler_change(id, 0x2F)) { + printk("ADB mouse at %d, handler set to 0x2F", id); + mouse_kind = ADBMOUSE_MICROSPEED; + } + else if (adb_try_handler_change(id, 0x42)) { + printk("ADB mouse at %d, handler set to 0x42", id); + mouse_kind = ADBMOUSE_TRACKBALLPRO; + } + else if (adb_try_handler_change(id, 0x66)) { + printk("ADB mouse at %d, handler set to 0x66", id); + mouse_kind = ADBMOUSE_MICROSPEED; + } + else if (adb_try_handler_change(id, 0x5F)) { + printk("ADB mouse at %d, handler set to 0x5F", id); + mouse_kind = ADBMOUSE_MICROSPEED; + } + else if (adb_try_handler_change(id, 3)) { + printk("ADB mouse at %d, handler set to 3", id); + mouse_kind = ADBMOUSE_MS_A3; + } + else if (adb_try_handler_change(id, 2)) { + printk("ADB mouse at %d, handler set to 2", id); + mouse_kind = ADBMOUSE_STANDARD_200; + } + else { + printk("ADB mouse at %d, handler 1", id); + mouse_kind = ADBMOUSE_STANDARD_100; + } + + if ((mouse_kind == ADBMOUSE_TRACKBALLPRO) + || (mouse_kind == ADBMOUSE_MICROSPEED)) { + init_microspeed(id); + } else if (mouse_kind == ADBMOUSE_MS_A3) { + init_ms_a3(id); + } else if (mouse_kind == ADBMOUSE_EXTENDED) { + /* + * Register 1 is usually used for device + * identification. Here, we try to identify + * a known device and call the appropriate + * init function. + */ + adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, + ADB_READREG(id, 1)); + + if ((req.reply_len) && + (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21) + || (req.reply[2] == 0x20))) { + mouse_kind = ADBMOUSE_TRACKBALL; + init_trackball(id); + } + else if ((req.reply_len >= 4) && + (req.reply[1] == 0x74) && (req.reply[2] == 0x70) && + (req.reply[3] == 0x61) && (req.reply[4] == 0x64)) { + mouse_kind = ADBMOUSE_TRACKPAD; + init_trackpad(id); + } + else if ((req.reply_len >= 4) && + (req.reply[1] == 0x4b) && (req.reply[2] == 0x4d) && + (req.reply[3] == 0x4c) && (req.reply[4] == 0x31)) { + mouse_kind = ADBMOUSE_TURBOMOUSE5; + init_turbomouse(id); + } + else if ((req.reply_len == 9) && + (req.reply[1] == 0x4b) && (req.reply[2] == 0x4f) && + (req.reply[3] == 0x49) && (req.reply[4] == 0x54)) { + if (adb_try_handler_change(id, 0x42)) { + printk("\nADB MacAlly 2-button mouse at %d, handler set to 0x42", id); + mouse_kind = ADBMOUSE_MACALLY2; + } + } + } + printk("\n"); + + adb_get_infos(id, &default_id, &cur_handler_id); + adbhid_input_register(id, default_id, org_handler_id, + cur_handler_id, mouse_kind); + } +} + +static void +init_trackpad(int id) +{ + struct adb_request req; + unsigned char r1_buffer[8]; + + printk(" (trackpad)"); + + adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1, + ADB_READREG(id,1)); + if (req.reply_len < 8) + printk("bad length for reg. 1\n"); + else + { + memcpy(r1_buffer, &req.reply[1], 8); + adb_request(&req, NULL, ADBREQ_SYNC, 9, + ADB_WRITEREG(id,1), + r1_buffer[0], + r1_buffer[1], + r1_buffer[2], + r1_buffer[3], + r1_buffer[4], + r1_buffer[5], + 0x0d, /*r1_buffer[6],*/ + r1_buffer[7]); + + adb_request(&req, NULL, ADBREQ_SYNC, 9, + ADB_WRITEREG(id,2), + 0x99, + 0x94, + 0x19, + 0xff, + 0xb2, + 0x8a, + 0x1b, + 0x50); + + adb_request(&req, NULL, ADBREQ_SYNC, 9, + ADB_WRITEREG(id,1), + r1_buffer[0], + r1_buffer[1], + r1_buffer[2], + r1_buffer[3], + r1_buffer[4], + r1_buffer[5], + 0x03, /*r1_buffer[6],*/ + r1_buffer[7]); + } +} + +static void +init_trackball(int id) +{ + struct adb_request req; + + printk(" (trackman/mouseman)"); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 00,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 01,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 02,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 03,0x38); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 00,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 01,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 02,0x81); + + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id,1), 03,0x38); +} + +static void +init_turbomouse(int id) +{ + struct adb_request req; + + printk(" (TurboMouse 5)"); + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3)); + + adb_request(&req, NULL, ADBREQ_SYNC, 9, + ADB_WRITEREG(3,2), + 0xe7, + 0x8c, + 0, + 0, + 0, + 0xff, + 0xff, + 0x94); + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3)); + + adb_request(&req, NULL, ADBREQ_SYNC, 9, + ADB_WRITEREG(3,2), + 0xa5, + 0x14, + 0, + 0, + 0x69, + 0xff, + 0xff, + 0x27); +} + +static void +init_microspeed(int id) +{ + struct adb_request req; + + printk(" (Microspeed/MacPoint or compatible)"); + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); + + /* This will initialize mice using the Microspeed, MacPoint and + other compatible firmware. Bit 12 enables extended protocol. + + Register 1 Listen (4 Bytes) + 0 - 3 Button is mouse (set also for double clicking!!!) + 4 - 7 Button is locking (affects change speed also) + 8 - 11 Button changes speed + 12 1 = Extended mouse mode, 0 = normal mouse mode + 13 - 15 unused 0 + 16 - 23 normal speed + 24 - 31 changed speed + + Register 1 talk holds version and product identification information. + Register 1 Talk (4 Bytes): + 0 - 7 Product code + 8 - 23 undefined, reserved + 24 - 31 Version number + + Speed 0 is max. 1 to 255 set speed in increments of 1/256 of max. + */ + adb_request(&req, NULL, ADBREQ_SYNC, 5, + ADB_WRITEREG(id,1), + 0x20, /* alt speed = 0x20 (rather slow) */ + 0x00, /* norm speed = 0x00 (fastest) */ + 0x10, /* extended protocol, no speed change */ + 0x07); /* all buttons enabled as mouse buttons, no locking */ + + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); +} + +static void +init_ms_a3(int id) +{ + struct adb_request req; + + printk(" (Mouse Systems A3 Mouse, or compatible)"); + adb_request(&req, NULL, ADBREQ_SYNC, 3, + ADB_WRITEREG(id, 0x2), + 0x00, + 0x07); + + adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id)); +} + +static int __init adbhid_init(void) +{ + if ( (_machine != _MACH_chrp) && (_machine != _MACH_Pmac) ) + return 0; + + led_request.complete = 1; + + adbhid_probe(); + + notifier_chain_register(&adb_client_list, &adbhid_adb_notifier); + + return 0; +} + +static void __exit adbhid_exit(void) +{ +} + +module_init(adbhid_init); +module_exit(adbhid_exit); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/mac_hid.c linux/drivers/macintosh/mac_hid.c --- v2.4.0-test8/linux/drivers/macintosh/mac_hid.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/macintosh/mac_hid.c Sun Sep 17 09:48:05 2000 @@ -0,0 +1,492 @@ +/* + * drivers/macintosh/mac_hid.c + * + * HID support stuff for Macintosh computers. + * + * Copyright (C) 2000 Franz Sirl. + * + * Stuff inside CONFIG_MAC_ADBKEYCODES should go away during 2.5 when all + * major distributions are using the Linux keycodes. + * Stuff inside CONFIG_MAC_EMUMOUSEBTN should really be moved to userspace. + */ + +#include +#include +#include +#include +#include + +#ifdef CONFIG_MAC_ADBKEYCODES +#include +#include +#include +#endif + +#ifdef CONFIG_MAC_ADBKEYCODES +/* Simple translation table for the SysRq keys */ + +#ifdef CONFIG_MAGIC_SYSRQ +unsigned char mac_hid_kbd_sysrq_xlate[128] = + "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */ + "yt123465=97-80o]" /* 0x10 - 0x1f */ + "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */ + "\t `\177\000\033\000\000\000\000\000\000\000\000\000\000" + /* 0x30 - 0x3f */ + "\000\000\000*\000+\000\000\000\000\000/\r\000-\000" + /* 0x40 - 0x4f */ + "\000\0000123456789\000\000\000" /* 0x50 - 0x5f */ + "\205\206\207\203\210\211\000\213\000\215\000\000\000\000\000\212\000\214"; + /* 0x60 - 0x6f */ +extern unsigned char pckbd_sysrq_xlate[128]; +#endif + +static u_short macplain_map[NR_KEYS] = { + 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb68, 0xfb67, 0xfb7a, 0xfb78, + 0xfb63, 0xfb76, 0xf200, 0xfb62, 0xfb71, 0xfb77, 0xfb65, 0xfb72, + 0xfb79, 0xfb74, 0xf031, 0xf032, 0xf033, 0xf034, 0xf036, 0xf035, + 0xf03d, 0xf039, 0xf037, 0xf02d, 0xf038, 0xf030, 0xf05d, 0xfb6f, + 0xfb75, 0xf05b, 0xfb69, 0xfb70, 0xf201, 0xfb6c, 0xfb6a, 0xf027, + 0xfb6b, 0xf03b, 0xf05c, 0xf02c, 0xf02f, 0xfb6e, 0xfb6d, 0xf02e, + 0xf009, 0xf020, 0xf060, 0xf07f, 0xf200, 0xf01b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf104, 0xf105, 0xf106, 0xf102, 0xf107, 0xf108, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf209, 0xf200, 0xf109, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf103, 0xf117, + 0xf101, 0xf119, 0xf100, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static u_short macshift_map[NR_KEYS] = { + 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb48, 0xfb47, 0xfb5a, 0xfb58, + 0xfb43, 0xfb56, 0xf200, 0xfb42, 0xfb51, 0xfb57, 0xfb45, 0xfb52, + 0xfb59, 0xfb54, 0xf021, 0xf040, 0xf023, 0xf024, 0xf05e, 0xf025, + 0xf02b, 0xf028, 0xf026, 0xf05f, 0xf02a, 0xf029, 0xf07d, 0xfb4f, + 0xfb55, 0xf07b, 0xfb49, 0xfb50, 0xf201, 0xfb4c, 0xfb4a, 0xf022, + 0xfb4b, 0xf03a, 0xf07c, 0xf03c, 0xf03f, 0xfb4e, 0xfb4d, 0xf03e, + 0xf009, 0xf020, 0xf07e, 0xf07f, 0xf200, 0xf01b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf10e, 0xf10f, 0xf110, 0xf10c, 0xf111, 0xf112, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf203, 0xf200, 0xf113, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf20b, 0xf116, 0xf10d, 0xf117, + 0xf10b, 0xf20a, 0xf10a, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static u_short macaltgr_map[NR_KEYS] = { + 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb68, 0xfb67, 0xfb7a, 0xfb78, + 0xf916, 0xfb76, 0xf200, 0xf915, 0xfb71, 0xfb77, 0xf918, 0xfb72, + 0xfb79, 0xfb74, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200, + 0xf200, 0xf05d, 0xf07b, 0xf05c, 0xf05b, 0xf07d, 0xf07e, 0xfb6f, + 0xfb75, 0xf200, 0xfb69, 0xfb70, 0xf201, 0xfb6c, 0xfb6a, 0xf200, + 0xfb6b, 0xf200, 0xf200, 0xf200, 0xf200, 0xfb6e, 0xfb6d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf90a, 0xf90b, 0xf90c, 0xf90d, 0xf90e, 0xf90f, + 0xf910, 0xf911, 0xf200, 0xf912, 0xf913, 0xf200, 0xf200, 0xf200, + 0xf510, 0xf511, 0xf512, 0xf50e, 0xf513, 0xf514, 0xf200, 0xf516, + 0xf200, 0xf10c, 0xf200, 0xf202, 0xf200, 0xf515, 0xf200, 0xf517, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf50f, 0xf117, + 0xf50d, 0xf119, 0xf50c, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static u_short macctrl_map[NR_KEYS] = { + 0xf001, 0xf013, 0xf004, 0xf006, 0xf008, 0xf007, 0xf01a, 0xf018, + 0xf003, 0xf016, 0xf200, 0xf002, 0xf011, 0xf017, 0xf005, 0xf012, + 0xf019, 0xf014, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01e, 0xf01d, + 0xf200, 0xf200, 0xf01f, 0xf01f, 0xf07f, 0xf200, 0xf01d, 0xf00f, + 0xf015, 0xf01b, 0xf009, 0xf010, 0xf201, 0xf00c, 0xf00a, 0xf007, + 0xf00b, 0xf200, 0xf01c, 0xf200, 0xf07f, 0xf00e, 0xf00d, 0xf20e, + 0xf200, 0xf000, 0xf000, 0xf008, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf104, 0xf105, 0xf106, 0xf102, 0xf107, 0xf108, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf204, 0xf200, 0xf109, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf103, 0xf117, + 0xf101, 0xf119, 0xf100, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static u_short macshift_ctrl_map[NR_KEYS] = { + 0xf001, 0xf013, 0xf004, 0xf006, 0xf008, 0xf007, 0xf01a, 0xf018, + 0xf003, 0xf016, 0xf200, 0xf002, 0xf011, 0xf017, 0xf005, 0xf012, + 0xf019, 0xf014, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf200, 0xf00f, + 0xf015, 0xf200, 0xf009, 0xf010, 0xf201, 0xf00c, 0xf00a, 0xf200, + 0xf00b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf00e, 0xf00d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf10c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf200, 0xf117, + 0xf200, 0xf119, 0xf200, 0xf700, 0xf701, 0xf702, 0xf200, 0xf20c, +}; + +static u_short macalt_map[NR_KEYS] = { + 0xf861, 0xf873, 0xf864, 0xf866, 0xf868, 0xf867, 0xf87a, 0xf878, + 0xf863, 0xf876, 0xf200, 0xf862, 0xf871, 0xf877, 0xf865, 0xf872, + 0xf879, 0xf874, 0xf831, 0xf832, 0xf833, 0xf834, 0xf836, 0xf835, + 0xf83d, 0xf839, 0xf837, 0xf82d, 0xf838, 0xf830, 0xf85d, 0xf86f, + 0xf875, 0xf85b, 0xf869, 0xf870, 0xf80d, 0xf86c, 0xf86a, 0xf827, + 0xf86b, 0xf83b, 0xf85c, 0xf82c, 0xf82f, 0xf86e, 0xf86d, 0xf82e, + 0xf809, 0xf820, 0xf860, 0xf87f, 0xf200, 0xf81b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf210, 0xf211, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf900, 0xf901, 0xf902, 0xf903, 0xf904, 0xf905, + 0xf906, 0xf907, 0xf200, 0xf908, 0xf909, 0xf200, 0xf200, 0xf200, + 0xf504, 0xf505, 0xf506, 0xf502, 0xf507, 0xf508, 0xf200, 0xf50a, + 0xf200, 0xf10c, 0xf200, 0xf209, 0xf200, 0xf509, 0xf200, 0xf50b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf503, 0xf117, + 0xf501, 0xf119, 0xf500, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static u_short macctrl_alt_map[NR_KEYS] = { + 0xf801, 0xf813, 0xf804, 0xf806, 0xf808, 0xf807, 0xf81a, 0xf818, + 0xf803, 0xf816, 0xf200, 0xf802, 0xf811, 0xf817, 0xf805, 0xf812, + 0xf819, 0xf814, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf80f, + 0xf815, 0xf200, 0xf809, 0xf810, 0xf201, 0xf80c, 0xf80a, 0xf200, + 0xf80b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf80e, 0xf80d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf504, 0xf505, 0xf506, 0xf502, 0xf507, 0xf508, 0xf200, 0xf50a, + 0xf200, 0xf10c, 0xf200, 0xf200, 0xf200, 0xf509, 0xf200, 0xf50b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf503, 0xf117, + 0xf501, 0xf119, 0xf500, 0xf700, 0xf701, 0xf702, 0xf200, 0xf200, +}; + +static unsigned short *mac_key_maps_save[MAX_NR_KEYMAPS] = { + macplain_map, macshift_map, macaltgr_map, 0, + macctrl_map, macshift_ctrl_map, 0, 0, + macalt_map, 0, 0, 0, + macctrl_alt_map, 0 +}; + +static unsigned short *pc_key_maps_save[MAX_NR_KEYMAPS]; + +int mac_hid_kbd_translate(unsigned char keycode, unsigned char *keycodep, + char raw_mode); +static int mac_hid_sysctl_keycodes(ctl_table *ctl, int write, struct file * filp, + void *buffer, size_t *lenp); +char mac_hid_kbd_unexpected_up(unsigned char keycode); + +static int keyboard_lock_keycodes = 0; +int keyboard_sends_linux_keycodes = 0; +#else +int keyboard_sends_linux_keycodes = 1; +#endif + + +static unsigned char e0_keys[128] = { + 0, 0, 0, KEY_KPCOMMA, 0, KEY_INTL3, 0, 0, /* 0x00-0x07 */ + 0, 0, 0, 0, KEY_LANG1, KEY_LANG2, 0, 0, /* 0x08-0x0f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */ + 0, 0, 0, 0, KEY_KPENTER, KEY_RIGHTCTRL, 0, 0, /* 0x18-0x1f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */ + 0, 0, 0, 0, 0, KEY_KPSLASH, 0, KEY_SYSRQ, /* 0x30-0x37 */ + KEY_RIGHTALT, 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f */ + 0, 0, 0, 0, 0, 0, 0, KEY_HOME, /* 0x40-0x47 */ + KEY_UP, KEY_PAGEUP, 0, KEY_LEFT, 0, KEY_RIGHT, 0, KEY_END, /* 0x48-0x4f */ + KEY_DOWN, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, 0, 0, 0, 0, /* 0x50-0x57 */ + 0, 0, 0, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE, 0, 0, /* 0x58-0x5f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */ + 0, 0, 0, 0, 0, 0, 0, KEY_MACRO, /* 0x68-0x6f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */ + 0, 0, 0, 0, 0, 0, 0, 0 /* 0x78-0x7f */ +}; + +#ifdef CONFIG_MAC_EMUMOUSEBTN +static struct input_dev emumousebtn; +static void emumousebtn_input_register(void); +static int mouse_emulate_buttons = 0; +static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ +static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ +static int mouse_last_keycode = 0; +#endif + +extern void pckbd_init_hw(void); + +#if defined CONFIG_SYSCTL && (defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_MAC_EMUMOUSEBTN)) +/* file(s) in /proc/sys/dev/mac_hid */ +ctl_table mac_hid_files[] = +{ +#ifdef CONFIG_MAC_ADBKEYCODES + { + DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES, + "keyboard_sends_linux_keycodes", &keyboard_sends_linux_keycodes, sizeof(int), + 0644, NULL, &mac_hid_sysctl_keycodes + }, + { + DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES, + "keyboard_lock_keycodes", &keyboard_lock_keycodes, sizeof(int), + 0644, NULL, &proc_dointvec + }, +#endif +#ifdef CONFIG_MAC_EMUMOUSEBTN + { + DEV_MAC_HID_MOUSE_BUTTON_EMULATION, + "mouse_button_emulation", &mouse_emulate_buttons, sizeof(int), + 0644, NULL, &proc_dointvec + }, + { + DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, + "mouse_button2_keycode", &mouse_button2_keycode, sizeof(int), + 0644, NULL, &proc_dointvec + }, + { + DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, + "mouse_button3_keycode", &mouse_button3_keycode, sizeof(int), + 0644, NULL, &proc_dointvec + }, +#endif + { 0 } +}; + +/* dir in /proc/sys/dev */ +ctl_table mac_hid_dir[] = +{ + { DEV_MAC_HID, "mac_hid", NULL, 0, 0555, mac_hid_files }, + { 0 } +}; + +/* /proc/sys/dev itself, in case that is not there yet */ +ctl_table mac_hid_root_dir[] = +{ + { CTL_DEV, "dev", NULL, 0, 0555, mac_hid_dir }, + { 0 } +}; + +static struct ctl_table_header *mac_hid_sysctl_header; + +#ifdef CONFIG_MAC_ADBKEYCODES +static +int mac_hid_sysctl_keycodes(ctl_table *ctl, int write, struct file * filp, + void *buffer, size_t *lenp) +{ + int val = keyboard_sends_linux_keycodes; + int ret = 0; + + if (!write + || (write && !keyboard_lock_keycodes)) + ret = proc_dointvec(ctl, write, filp, buffer, lenp); + + if (write + && keyboard_sends_linux_keycodes != val) { + if (!keyboard_sends_linux_keycodes) { +#ifdef CONFIG_MAGIC_SYSRQ + ppc_md.ppc_kbd_sysrq_xlate = mac_hid_kbd_sysrq_xlate; + SYSRQ_KEY = 0x69; +#endif + memcpy(pc_key_maps_save, key_maps, sizeof(key_maps)); + memcpy(key_maps, mac_key_maps_save, sizeof(key_maps)); + } else { +#ifdef CONFIG_MAGIC_SYSRQ + ppc_md.ppc_kbd_sysrq_xlate = pckbd_sysrq_xlate; + SYSRQ_KEY = 0x54; +#endif + memcpy(mac_key_maps_save, key_maps, sizeof(key_maps)); + memcpy(key_maps, pc_key_maps_save, sizeof(key_maps)); + } + } + + return ret; +} +#endif +#endif /* endif CONFIG_SYSCTL */ + +int mac_hid_kbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode) +{ +#ifdef CONFIG_MAC_ADBKEYCODES + if (!keyboard_sends_linux_keycodes) { + if (!raw_mode) { + /* + * Convert R-shift/control/option to L version. + */ + switch (scancode) { + case 0x7b: scancode = 0x38; break; /* R-shift */ + case 0x7c: scancode = 0x3a; break; /* R-option */ + case 0x7d: scancode = 0x36; break; /* R-control */ + } + } + *keycode = scancode; + return 1; + } else +#endif + { + /* This code was copied from char/pc_keyb.c and will be + * superflous when the input layer is fully integrated. + * We don't need the high_keys handling, so this part + * has been removed. + */ + static int prev_scancode = 0; + + /* special prefix scancodes.. */ + if (scancode == 0xe0 || scancode == 0xe1) { + prev_scancode = scancode; + return 0; + } + + scancode &= 0x7f; + + if (prev_scancode) { + if (prev_scancode != 0xe0) { + if (prev_scancode == 0xe1 && scancode == 0x1d) { + prev_scancode = 0x100; + return 0; + } else if (prev_scancode == 0x100 && scancode == 0x45) { + *keycode = KEY_PAUSE; + prev_scancode = 0; + } else { + if (!raw_mode) + printk(KERN_INFO "keyboard: unknown e1 escape sequence\n"); + prev_scancode = 0; + return 0; + } + } else { + prev_scancode = 0; + if (scancode == 0x2a || scancode == 0x36) + return 0; + } + if (e0_keys[scancode]) + *keycode = e0_keys[scancode]; + else { + if (!raw_mode) + printk(KERN_INFO "keyboard: unknown scancode e0 %02x\n", + scancode); + return 0; + } + } else { + switch (scancode) { + case 91: scancode = KEY_LINEFEED; break; + case 92: scancode = KEY_KPEQUAL; break; + case 125: scancode = KEY_INTL1; break; + } + *keycode = scancode; + } + return 1; + } +} + +char mac_hid_kbd_unexpected_up(unsigned char keycode) +{ + if (keyboard_sends_linux_keycodes && keycode == KEY_F13) + return 0; + else + return 0x80; +} + +#ifdef CONFIG_MAC_ADBKEYCODES +int mac_hid_keyboard_sends_linux_keycodes(void) +{ + return keyboard_sends_linux_keycodes; +} + +static int __init mac_hid_setup(char *str) +{ + int ints[2]; + + str = get_options(str, ARRAY_SIZE(ints), ints); + if (ints[0] == 1) { + keyboard_sends_linux_keycodes = ints[1] != 0; + keyboard_lock_keycodes = 1; + } + return 1; +} + +__setup("keyboard_sends_linux_keycodes=", mac_hid_setup); + +#endif + +#ifdef CONFIG_MAC_EMUMOUSEBTN +int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down) +{ + switch (caller) { + case 1: + /* Called from keybdev.c */ + if (mouse_emulate_buttons + && (keycode == mouse_button2_keycode + || keycode == mouse_button3_keycode)) { + if (mouse_emulate_buttons == 1) { + input_report_key(&emumousebtn, + keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT, + down); + return 1; + } + mouse_last_keycode = down ? keycode : 0; + } + break; + case 2: + /* Called from mousedev.c */ + if (mouse_emulate_buttons == 2 && keycode == 0) { + if (mouse_last_keycode == mouse_button2_keycode) + return 1; /* map to middle button */ + if (mouse_last_keycode == mouse_button3_keycode) + return 2; /* map to right button */ + } + return keycode; /* keep button */ + } + return 0; +} + +static void emumousebtn_input_register(void) +{ + emumousebtn.name = "Macintosh mouse button emulation"; + + emumousebtn.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); + emumousebtn.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); + emumousebtn.relbit[0] = BIT(REL_X) | BIT(REL_Y); + + emumousebtn.idbus = BUS_ADB; + emumousebtn.idvendor = 0x0001; + emumousebtn.idproduct = 0x0001; + emumousebtn.idversion = 0x0100; + + input_register_device(&emumousebtn); + + printk(KERN_INFO "input%d: Macintosh mouse button emulation\n", emumousebtn.number); +} +#endif + +void __init mac_hid_init_hw(void) +{ + +#ifdef CONFIG_MAC_ADBKEYCODES + memcpy(pc_key_maps_save, key_maps, sizeof(key_maps)); + + if (!keyboard_sends_linux_keycodes) + memcpy(key_maps, mac_key_maps_save, sizeof(key_maps)); +#endif + +#ifdef CONFIG_MAC_EMUMOUSEBTN + emumousebtn_input_register(); +#endif + +#if CONFIG_PPC + if (_machine != _MACH_Pmac) + pckbd_init_hw(); +#endif + +#if defined(CONFIG_SYSCTL) && (defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_MAC_EMUMOUSEBTN)) + mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir, 1); +#endif /* CONFIG_SYSCTL */ +} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/mac_keyb.c linux/drivers/macintosh/mac_keyb.c --- v2.4.0-test8/linux/drivers/macintosh/mac_keyb.c Tue Jun 20 13:58:42 2000 +++ linux/drivers/macintosh/mac_keyb.c Sun Sep 17 09:48:05 2000 @@ -51,6 +51,10 @@ #include #include +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif + #define KEYB_KEYREG 0 /* register # for key up/down data */ #define KEYB_LEDREG 2 /* register # for leds on ADB keyboard */ #define MOUSE_DATAREG 0 /* reg# for movement/button codes from mouse */ @@ -585,68 +589,50 @@ } #endif /* CONFIG_ADBMOUSE */ -/* XXX Needs to get rid of this, see comments in pmu.c */ -extern int backlight_level; - static void buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll) { -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_PMAC_BACKLIGHT + int backlight = get_backlight_level(); + /* * XXX: Where is the contrast control for the passive? * -- Cort */ /* Ignore data from register other than 0 */ -#if 0 - if ((adb_hardware != ADB_VIAPMU) || (data[0] & 0x3) || (nb < 2)) -#else if ((data[0] & 0x3) || (nb < 2)) -#endif return; - switch (data[1]&0xf ) - { - /* mute */ - case 0x8: - /* down event */ - if ( data[1] == (data[1]&0xf) ) { - } - break; - /* contrast decrease */ - case 0x7: - /* down event */ - if ( data[1] == (data[1]&0xf) ) { - } - break; - /* contrast increase */ - case 0x6: - /* down event */ - if ( data[1] == (data[1]&0xf) ) { - } - break; - /* brightness decrease */ - case 0xa: - /* down event */ - if ( data[1] == (data[1]&0xf) ) { - if (backlight_level > 2) - pmu_set_brightness(backlight_level-2); - else - pmu_set_brightness(0); - } + switch (data[1]) { + case 0x8: /* mute */ + break; + + case 0x7: /* contrast decrease */ + break; + + case 0x6: /* contrast increase */ + break; + + case 0xa: /* brightness decrease */ + if (backlight < 0) break; - /* brightness increase */ - case 0x9: - /* down event */ - if ( data[1] == (data[1]&0xf) ) { - if (backlight_level < 0x1e) - pmu_set_brightness(backlight_level+2); - else - pmu_set_brightness(0x1f); - } + if (backlight > BACKLIGHT_OFF) + set_backlight_level(backlight-1); + else + set_backlight_level(BACKLIGHT_OFF); + break; + + case 0x9: /* brightness increase */ + if (backlight < 0) break; + if (backlight < BACKLIGHT_MAX) + set_backlight_level(backlight+1); + else + set_backlight_level(BACKLIGHT_MAX); + break; } -#endif /* CONFIG_ADB_PMU */ +#endif /* CONFIG_PMAC_BACKLIGHT */ } /* Map led flags as defined in kbd_kern.h to bits for Apple keyboard. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/macio-adb.c linux/drivers/macintosh/macio-adb.c --- v2.4.0-test8/linux/drivers/macintosh/macio-adb.c Thu Oct 7 10:17:09 1999 +++ linux/drivers/macintosh/macio-adb.c Sun Sep 17 09:48:05 2000 @@ -122,6 +122,8 @@ out_8(&adb->autopoll.r, APE); out_8(&adb->intr_enb.r, DFB | TAG); + printk("adb: mac-io driver 1.0 for unified ADB\n"); + return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/macserial.c linux/drivers/macintosh/macserial.c --- v2.4.0-test8/linux/drivers/macintosh/macserial.c Sat May 20 12:07:56 2000 +++ linux/drivers/macintosh/macserial.c Sun Sep 17 09:48:05 2000 @@ -2291,7 +2291,7 @@ zss->irq = ch->intrs[0].line; zss->has_dma = 0; #if !defined(CONFIG_KGDB) && defined(SUPPORT_SERIAL_DMA) - if (ch->n_addrs == 3 && ch->n_intrs == 3) + if (ch->n_addrs >= 3 && ch->n_intrs == 3) zss->has_dma = 1; #endif zss->dma_initted = 0; @@ -2643,9 +2643,6 @@ * ------------------------------------------------------------ */ #ifdef CONFIG_SERIAL_CONSOLE -#ifdef CONFIG_SERIAL -#error Cannot build serial console with macserial and serial drivers -#endif /* * Print a string to the serial port trying not to disturb @@ -2719,7 +2716,7 @@ */ static int __init serial_console_setup(struct console *co, char *options) { - struct mac_serial *info = zs_soft + co->index; + struct mac_serial *info; int baud = 38400; int bits = 8; int parity = 'n'; @@ -2735,6 +2732,11 @@ if (zs_chain == 0) return -1; + /* Do we have the device asked for? */ + if (co->index >= zs_channels_found) + return -1; + info = zs_soft + co->index; + set_scc_power(info, 1); /* Reset the channel */ @@ -2904,7 +2906,7 @@ /* * Register console. */ -void __init serial_console_init(void) +void __init mac_scc_console_init(void) { register_console(&sercons); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/mediabay.c linux/drivers/macintosh/mediabay.c --- v2.4.0-test8/linux/drivers/macintosh/mediabay.c Sat May 20 12:07:56 2000 +++ linux/drivers/macintosh/mediabay.c Sun Sep 17 09:48:05 2000 @@ -472,8 +472,11 @@ } else if (MB_IDE_READY(i)) { bay->timer = 0; bay->state = mb_up; - if (bay->cd_index < 0) + if (bay->cd_index < 0) { + pmu_suspend(); bay->cd_index = ide_register(bay->cd_base, 0, bay->cd_irq); + pmu_resume(); + } if (bay->cd_index == -1) { /* We eventually do a retry */ bay->cd_retry++; @@ -605,7 +608,9 @@ only if it did not change. Note those bozo timings, they seem to help the 3400 get it right. */ - mdelay(MB_STABLE_DELAY); + /* Force MB power to 0 */ + set_mb_power(i, 0); + mdelay(MB_POWER_DELAY); if (!bay->pismo) out_8(&bay->addr->contents, 0x70); mdelay(MB_STABLE_DELAY); @@ -615,7 +620,9 @@ bay->last_value = bay->content_id; bay->value_count = MS_TO_HZ(MB_STABLE_DELAY); bay->timer = MS_TO_HZ(MB_POWER_DELAY); +#ifdef CONFIG_BLK_DEV_IDE bay->cd_retry = 0; +#endif do { mdelay(1000/HZ); media_bay_step(i); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/nvram.c linux/drivers/macintosh/nvram.c --- v2.4.0-test8/linux/drivers/macintosh/nvram.c Tue Jun 20 13:58:42 2000 +++ linux/drivers/macintosh/nvram.c Sun Sep 17 09:48:05 2000 @@ -14,6 +14,7 @@ #include #include #include +#include #define NVRAM_SIZE 8192 @@ -70,11 +71,36 @@ return p - buf; } +static int nvram_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + switch(cmd) { + case PMAC_NVRAM_GET_OFFSET: + { + int part, offset; + if (copy_from_user(&part,(void*)arg,sizeof(part))!=0) + return -EFAULT; + if (part < pmac_nvram_OF || part > pmac_nvram_NR) + return -EINVAL; + offset = pmac_get_partition(part); + if (copy_to_user((void*)arg,&offset,sizeof(offset))!=0) + return -EFAULT; + break; + } + + default: + return -EINVAL; + } + + return 0; +} + struct file_operations nvram_fops = { owner: THIS_MODULE, llseek: nvram_llseek, read: read_nvram, write: write_nvram, + ioctl: nvram_ioctl, }; static struct miscdevice nvram_dev = { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/rtc.c linux/drivers/macintosh/rtc.c --- v2.4.0-test8/linux/drivers/macintosh/rtc.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/macintosh/rtc.c Sun Sep 17 09:48:05 2000 @@ -0,0 +1,158 @@ +/* + * Linux/PowerPC Real Time Clock Driver + * + * heavily based on: + * Linux/SPARC Real Time Clock Driver + * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) + * + * This is a little driver that lets a user-level program access + * the PPC clocks chip. It is no use unless you + * use the modified clock utility. + * + * Get the modified clock utility from: + * ftp://vger.rutgers.edu/pub/linux/Sparc/userland/clock.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static int rtc_busy = 0; + +/* Retrieve the current date and time from the real time clock. */ +void get_rtc_time(struct rtc_time *t) +{ + unsigned long nowtime; + + nowtime = (ppc_md.get_rtc_time)(); + + to_tm(nowtime, t); + + t->tm_year -= 1900; + t->tm_mon -= 1; + t->tm_wday -= 1; +} + +/* Set the current date and time in the real time clock. */ +void set_rtc_time(struct rtc_time *t) +{ + unsigned long nowtime; + + printk(KERN_INFO "rtc.c:set_rtc_time: %04d-%02d-%02d %02d:%02d:%02d.\n", t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); + + nowtime = mktime(t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); + + printk(KERN_INFO "rtc.c:set_rtc_time: set rtc time to %ld seconds.\n", nowtime); + + (ppc_md.set_rtc_time)(nowtime); +} + +static loff_t rtc_lseek(struct file *file, loff_t offset, int origin) +{ + return -ESPIPE; +} + +static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct rtc_time rtc_tm; + + switch (cmd) + { + case RTC_RD_TIME: + if (ppc_md.get_rtc_time) + { + get_rtc_time(&rtc_tm); + + if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) + return -EFAULT; + + return 0; + } + else + return -EINVAL; + + case RTC_SET_TIME: + if (!capable(CAP_SYS_TIME)) + return -EPERM; + + if (ppc_md.set_rtc_time) + { + if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) + return -EFAULT; + + set_rtc_time(&rtc_tm); + + return 0; + } + else + return -EINVAL; + + default: + return -EINVAL; + } +} + +static int rtc_open(struct inode *inode, struct file *file) +{ + if (rtc_busy) + return -EBUSY; + + rtc_busy = 1; + + MOD_INC_USE_COUNT; + + return 0; +} + +static int rtc_release(struct inode *inode, struct file *file) +{ + MOD_DEC_USE_COUNT; + rtc_busy = 0; + return 0; +} + +static struct file_operations rtc_fops = { + owner: THIS_MODULE, + llseek: rtc_lseek, + ioctl: rtc_ioctl, + open: rtc_open, + release: rtc_release +}; + +static struct miscdevice rtc_dev = { RTC_MINOR, "rtc", &rtc_fops }; + +EXPORT_NO_SYMBOLS; + +static int __init rtc_init(void) +{ + int error; + + error = misc_register(&rtc_dev); + if (error) { + printk(KERN_ERR "rtc: unable to get misc minor\n"); + return error; + } + + return 0; +} + +static void __exit rtc_exit(void) +{ + misc_deregister(&rtc_dev); +} + +module_init(rtc_init); +module_exit(rtc_exit); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/via-cuda.c linux/drivers/macintosh/via-cuda.c --- v2.4.0-test8/linux/drivers/macintosh/via-cuda.c Fri Nov 12 04:29:47 1999 +++ linux/drivers/macintosh/via-cuda.c Sun Sep 17 09:48:05 2000 @@ -94,39 +94,48 @@ #endif static int cuda_fully_inited = 0; +#ifdef CONFIG_ADB static int cuda_probe(void); static int cuda_init(void); +static int cuda_send_request(struct adb_request *req, int sync); +static int cuda_adb_autopoll(int devs); +static int cuda_reset_adb_bus(void); +#endif /* CONFIG_ADB */ + static int cuda_init_via(void); static void cuda_start(void); static void cuda_interrupt(int irq, void *arg, struct pt_regs *regs); static void cuda_input(unsigned char *buf, int nb, struct pt_regs *regs); -static int cuda_send_request(struct adb_request *req, int sync); -static int cuda_adb_autopoll(int devs); void cuda_poll(void); -static int cuda_reset_adb_bus(void); static int cuda_write(struct adb_request *req); int cuda_request(struct adb_request *req, void (*done)(struct adb_request *), int nbytes, ...); +#ifdef CONFIG_ADB struct adb_driver via_cuda_driver = { "CUDA", cuda_probe, cuda_init, cuda_send_request, - /*cuda_write,*/ cuda_adb_autopoll, cuda_poll, cuda_reset_adb_bus }; +#endif /* CONFIG_ADB */ #ifdef CONFIG_PPC -void -find_via_cuda() +int +find_via_cuda(void) { + int err; + struct adb_request req; + + if (vias != 0) + return 1; vias = find_devices("via-cuda"); if (vias == 0) - return; + return 0; if (vias->next != 0) printk(KERN_WARNING "Warning: only using 1st via-cuda\n"); @@ -146,15 +155,54 @@ printk(KERN_ERR "via-cuda: expecting 1 address (%d) and 1 interrupt (%d)\n", vias->n_addrs, vias->n_intrs); if (vias->n_addrs < 1 || vias->n_intrs < 1) - return; + return 0; } via = (volatile unsigned char *) ioremap(vias->addrs->address, 0x2000); cuda_state = idle; sys_ctrler = SYS_CTRLER_CUDA; + + err = cuda_init_via(); + if (err) { + printk(KERN_ERR "cuda_init_via() failed\n"); + via = NULL; + return 0; + } + + /* Clear and enable interrupts, but only on PPC. On 68K it's done */ + /* for us by the the main VIA driver in arch/m68k/mac/via.c */ + +#ifndef CONFIG_MAC + via[IFR] = 0x7f; eieio(); /* clear interrupts by writing 1s */ + via[IER] = IER_SET|SR_INT; eieio(); /* enable interrupt from SR */ +#endif + + /* enable autopoll */ + cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1); + while (!req.complete) + cuda_poll(); + + return 1; } #endif /* CONFIG_PPC */ +int via_cuda_start(void) +{ + if (via == NULL) + return -ENODEV; + + if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) { + printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ); + return -EAGAIN; + } + + printk("Macintosh CUDA driver v0.5 for Unified ADB.\n"); + + cuda_fully_inited = 1; + return 0; +} + +#ifdef CONFIG_ADB static int cuda_probe() { @@ -172,46 +220,24 @@ static int cuda_init(void) { - int err; - if (via == NULL) return -ENODEV; - - err = cuda_init_via(); - if (err) { - printk(KERN_ERR "cuda_probe: init_via() failed\n"); - via = NULL; - return err; - } - - /* Clear and enable interrupts, but only on PPC. On 68K it's done */ - /* for us by the the main VIA driver in arch/m68k/mac/via.c */ - -#ifndef CONFIG_MAC - via[IFR] = 0x7f; eieio(); /* clear interrupts by writing 1s */ - via[IER] = IER_SET|SR_INT; eieio(); /* enable interrupt from SR */ +#ifndef CONFIG_PPC + return via_cuda_start(); #endif - - if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) { - printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ); - return -EAGAIN; - } - - printk("adb: CUDA driver v0.5 for Unified ADB.\n"); - - cuda_fully_inited = 1; return 0; } +#endif /* CONFIG_ADB */ -#define WAIT_FOR(cond, what) \ - do { \ - for (x = 1000; !(cond); --x) { \ - if (x == 0) { \ - printk("Timeout waiting for " what); \ - return -ENXIO; \ - } \ +#define WAIT_FOR(cond, what) \ + do { \ + for (x = 1000; !(cond); --x) { \ + if (x == 0) { \ + printk("Timeout waiting for " what "\n"); \ + return -ENXIO; \ + } \ udelay(100); \ - } \ + } \ } while (0) static int @@ -255,6 +281,7 @@ return 0; } +#ifdef CONFIG_ADB /* Send an ADB command */ static int cuda_send_request(struct adb_request *req, int sync) @@ -309,7 +336,7 @@ cuda_poll(); return 0; } - +#endif /* CONFIG_ADB */ /* Construct and send a cuda request */ int cuda_request(struct adb_request *req, void (*done)(struct adb_request *), @@ -534,7 +561,18 @@ switch (buf[0]) { case ADB_PACKET: +#ifdef CONFIG_XMON + if (nb == 5 && buf[2] == 0x2c) { + extern int xmon_wants_key, xmon_adb_keycode; + if (xmon_wants_key) { + xmon_adb_keycode = buf[3]; + return; + } + } +#endif /* CONFIG_XMON */ +#ifdef CONFIG_ADB adb_input(buf+2, nb-2, regs, buf[1] & 0x40); +#endif /* CONFIG_ADB */ break; default: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/macintosh/via-pmu.c linux/drivers/macintosh/via-pmu.c --- v2.4.0-test8/linux/drivers/macintosh/via-pmu.c Wed Jul 12 21:58:42 2000 +++ linux/drivers/macintosh/via-pmu.c Sun Sep 17 09:48:05 2000 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -39,10 +40,16 @@ #include #include #include +#include #include #include #include -#include +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif + +/* Some compile options */ +#undef SUSPEND_USES_PMU /* Misc minor number allocated for /dev/pmu */ #define PMU_MINOR 154 @@ -84,7 +91,7 @@ #define CB2_INT 0x08 #define CB1_INT 0x10 /* transition on CB1 input */ -static enum pmu_state { +static volatile enum pmu_state { idle, sending, intack, @@ -95,7 +102,7 @@ static struct adb_request *current_req; static struct adb_request *last_req; static struct adb_request *req_awaiting_reply; -static unsigned char interrupt_data[32]; +static unsigned char interrupt_data[256]; /* Made bigger: I've been told that might happen */ static unsigned char *reply_ptr; static int data_index; static int data_len; @@ -106,22 +113,27 @@ static struct device_node *vias; static int pmu_kind = PMU_UNKNOWN; static int pmu_fully_inited = 0; -static int pmu_has_adb, pmu_has_backlight; +static int pmu_has_adb; static unsigned char *gpio_reg = NULL; -static int gpio_irq; +static int gpio_irq = -1; +static volatile int pmu_suspended = 0; +static spinlock_t pmu_lock; int asleep; struct notifier_block *sleep_notifier_list; +#ifdef CONFIG_ADB static int pmu_probe(void); static int pmu_init(void); +static int pmu_send_request(struct adb_request *req, int sync); +static int pmu_adb_autopoll(int devs); +static int pmu_adb_reset_bus(void); +#endif /* CONFIG_ADB */ + static int init_pmu(void); static int pmu_queue_request(struct adb_request *req); static void pmu_start(void); static void via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs); -static int pmu_send_request(struct adb_request *req, int sync); -static int pmu_adb_autopoll(int devs); -static int pmu_adb_reset_bus(void); static void send_byte(int x); static void recv_byte(void); static void pmu_sr_intr(struct pt_regs *regs); @@ -130,20 +142,25 @@ struct pt_regs *regs); static void set_volume(int level); static void gpio1_interrupt(int irq, void *arg, struct pt_regs *regs); +#ifdef CONFIG_PMAC_BACKLIGHT +static int pmu_set_backlight_level(int level, void* data); +static int pmu_set_backlight_enable(int on, int level, void* data); +#endif /* CONFIG_PMAC_BACKLIGHT */ #ifdef CONFIG_PMAC_PBOOK static void pmu_pass_intr(unsigned char *data, int len); #endif +#ifdef CONFIG_ADB struct adb_driver via_pmu_driver = { "PMU", pmu_probe, pmu_init, pmu_send_request, - /*pmu_queue_request,*/ pmu_adb_autopoll, pmu_poll, pmu_adb_reset_bus }; +#endif /* CONFIG_ADB */ extern void low_sleep_handler(void); extern void sleep_save_intrs(int); @@ -206,6 +223,13 @@ "Core99" }; +#ifdef CONFIG_PMAC_BACKLIGHT +static struct backlight_controller pmu_backlight_controller = { + pmu_set_backlight_enable, + pmu_set_backlight_level +}; +#endif /* CONFIG_PMAC_BACKLIGHT */ + int __openfirmware find_via_pmu() { @@ -216,17 +240,6 @@ return 0; if (vias->next != 0) printk(KERN_WARNING "Warning: only using 1st via-pmu\n"); -#if 0 - { int i; - - printk("find_via_pmu: node = %p, addrs =", vias->node); - for (i = 0; i < vias->n_addrs; ++i) - printk(" %x(%x)", vias->addrs[i].address, vias->addrs[i].size); - printk(", intrs ="); - for (i = 0; i < vias->n_intrs; ++i) - printk(" %x", vias->intrs[i].line); - printk("\n"); } -#endif if (vias->n_addrs < 1 || vias->n_intrs < 1) { printk(KERN_ERR "via-pmu: %d addresses, %d interrupts!\n", @@ -235,8 +248,9 @@ return 0; } + spin_lock_init(&pmu_lock); + pmu_has_adb = 1; - pmu_has_backlight = 1; if (vias->parent->name && ((strcmp(vias->parent->name, "ohare") == 0) || device_is_compatible(vias->parent, "ohare"))) @@ -246,9 +260,18 @@ else if (device_is_compatible(vias->parent, "heathrow")) pmu_kind = PMU_HEATHROW_BASED; else if (device_is_compatible(vias->parent, "Keylargo")) { + struct device_node *gpio, *gpiop; + pmu_kind = PMU_KEYLARGO_BASED; pmu_has_adb = (find_type_devices("adb") != NULL); - pmu_has_backlight = (find_type_devices("backlight") != NULL); + + gpiop = find_devices("gpio"); + if (gpiop && gpiop->n_addrs) { + gpio_reg = ioremap(gpiop->addrs->address, 0x10); + gpio = find_devices("extint-gpio1"); + if (gpio && gpio->parent == gpiop && gpio->n_intrs) + gpio_irq = gpio->intrs[0].line; + } } else pmu_kind = PMU_UNKNOWN; @@ -266,10 +289,13 @@ printk(KERN_INFO "PMU driver initialized for %s\n", pbook_type[pmu_kind]); + sys_ctrler = SYS_CTRLER_PMU; + return 1; } +#ifdef CONFIG_ADB static int __openfirmware pmu_probe() { @@ -280,9 +306,10 @@ pmu_init(void) { if (vias == NULL) - return -ENXIO; + return -ENODEV; return 0; } +#endif /* CONFIG_ADB */ /* * We can't wait until pmu_init gets called, that happens too late. @@ -291,10 +318,10 @@ * turned us off. * This is called from arch/ppc/kernel/pmac_setup.c:pmac_init2(). */ -void via_pmu_start(void) +int via_pmu_start(void) { if (vias == NULL) - return; + return -ENODEV; bright_req_1.complete = 1; bright_req_2.complete = 1; @@ -304,24 +331,12 @@ (void *)0)) { printk(KERN_ERR "VIA-PMU: can't get irq %d\n", vias->intrs[0].line); - return; + return -EAGAIN; } - if (pmu_kind == PMU_KEYLARGO_BASED) { - struct device_node *gpio, *gpiop; - - gpiop = find_devices("gpio"); - if (gpiop && gpiop->n_addrs) { - gpio_reg = ioremap(gpiop->addrs->address, 0x10); - gpio = find_devices("extint-gpio1"); - if (gpio && gpio->parent == gpiop && gpio->n_intrs) { - gpio_irq = gpio->intrs[0].line; - if (request_irq(gpio_irq, gpio1_interrupt, 0, - "GPIO1/ADB", (void *)0)) - printk(KERN_ERR "pmu: can't get irq %d (GPIO1)\n", - gpio->intrs[0].line); - } - } + if (pmu_kind == PMU_KEYLARGO_BASED && gpio_irq != -1) { + if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1/ADB", (void *)0)) + printk(KERN_ERR "pmu: can't get irq %d (GPIO1)\n", gpio_irq); } /* Enable interrupts */ @@ -329,8 +344,24 @@ pmu_fully_inited = 1; +#ifdef CONFIG_PMAC_BACKLIGHT /* Enable backlight */ - pmu_enable_backlight(1); + register_backlight_controller(&pmu_backlight_controller, NULL, "pmu"); +#endif /* CONFIG_PMAC_BACKLIGHT */ + + /* Make sure PMU settle down before continuing. This is _very_ important + * since the IDE probe may shut interrupts down for quite a bit of time. If + * a PMU communication is pending while this happens, the PMU may timeout + * Not that on Core99 machines, the PMU keeps sending us environement + * messages, we should find a way to either fix IDE or make it call + * pmu_suspend() before masking interrupts. This can also happens while + * scolling with some fbdevs. + */ + do { + pmu_poll(); + } while (pmu_state != idle); + + return 0; } static int __openfirmware @@ -342,7 +373,7 @@ out_8(&via[B], via[B] | TREQ); /* negate TREQ */ out_8(&via[DIRB], (via[DIRB] | TREQ) & ~TACK); /* TACK in, TREQ out */ - pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xff); + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc); timeout = 100000; while (!req.complete) { if (--timeout < 0) { @@ -367,6 +398,13 @@ udelay(10); } + /* Tell PMU we are ready. Which PMU support this ? */ + if (pmu_kind == PMU_KEYLARGO_BASED) { + pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); + while (!req.complete) + pmu_poll(); + } + return 1; } @@ -376,6 +414,7 @@ return pmu_kind; } +#ifdef CONFIG_ADB /* Send an ADB command */ static int __openfirmware pmu_send_request(struct adb_request *req, int sync) @@ -513,6 +552,7 @@ return 0; } +#endif /* CONFIG_ADB */ /* Construct and send a pmu request */ int __openfirmware @@ -568,8 +608,8 @@ req->next = 0; req->sent = 0; req->complete = 0; - save_flags(flags); cli(); + spin_lock_irqsave(&pmu_lock, flags); if (current_req != 0) { last_req->next = req; last_req = req; @@ -579,11 +619,27 @@ if (pmu_state == idle) pmu_start(); } + spin_unlock_irqrestore(&pmu_lock, flags); - restore_flags(flags); return 0; } +static void __openfirmware +wait_for_ack(void) +{ + /* Sightly increased the delay, I had one occurence of the message + * reported + */ + int timeout = 4000; + while ((in_8(&via[B]) & TACK) == 0) { + if (--timeout < 0) { + printk(KERN_ERR "PMU not responding (!ack)\n"); + return; + } + udelay(10); + } +} + /* New PMU seems to be very sensitive to those timings, so we make sure * PCI is flushed immediately */ static void __openfirmware @@ -613,57 +669,126 @@ static void __openfirmware pmu_start() { - unsigned long flags; struct adb_request *req; /* assert pmu_state == idle */ /* get the packet to send */ - save_flags(flags); cli(); req = current_req; if (req == 0 || pmu_state != idle - || (req->reply_expected && req_awaiting_reply)) - goto out; + || (/*req->reply_expected && */req_awaiting_reply)) + return; pmu_state = sending; data_index = 1; data_len = pmu_data_len[req->data[0]][0]; + /* Sounds safer to make sure ACK is high before writing. This helped + * kill a problem with ADB and some iBooks + */ + wait_for_ack(); /* set the shift register to shift out and send a byte */ - ++disable_poll; send_byte(req->data[0]); - --disable_poll; - -out: - restore_flags(flags); } void __openfirmware pmu_poll() { - unsigned long flags; - + if (!via) + return; if (disable_poll) return; - save_flags(flags); - cli(); - if ((via[IFR] & (SR_INT | CB1_INT)) || - (gpio_reg && (in_8(gpio_reg + 0x9) & 0x02) == 0)) + /* Kicks ADB read when PMU is suspended */ + if (pmu_suspended) + adb_int_pending = 1; + do { + via_pmu_interrupt(0, 0, 0); + } while (pmu_suspended && (adb_int_pending || pmu_state != idle + || req_awaiting_reply)); +} + +/* This function loops until the PMU is idle and prevents it from + * anwsering to ADB interrupts. pmu_request can still be called. + * This is done to avoid spurrious shutdowns when we know we'll have + * interrupts switched off for a long time + */ +void __openfirmware +pmu_suspend(void) +{ + unsigned long flags; +#ifdef SUSPEND_USES_PMU + struct adb_request *req; +#endif + if (!via) + return; + + spin_lock_irqsave(&pmu_lock, flags); + pmu_suspended++; + if (pmu_suspended > 1) { + spin_unlock_irqrestore(&pmu_lock, flags); + return; + } + + do { + spin_unlock(&pmu_lock); via_pmu_interrupt(0, 0, 0); - restore_flags(flags); + spin_lock(&pmu_lock); + if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) { +#ifdef SUSPEND_USES_PMU + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0); + spin_unlock_irqrestore(&pmu_lock, flags); + while(!req.complete) + pmu_poll(); +#else /* SUSPEND_USES_PMU */ + if (gpio_irq >= 0) + disable_irq(gpio_irq); + out_8(&via[IER], CB1_INT | IER_CLR); + spin_unlock_irqrestore(&pmu_lock, flags); +#endif /* SUSPEND_USES_PMU */ + break; + } + } while (1); +} + +void __openfirmware +pmu_resume(void) +{ + unsigned long flags; + + if (!via || (pmu_suspended < 1)) + return; + + spin_lock_irqsave(&pmu_lock, flags); + pmu_suspended--; + if (pmu_suspended > 0) { + spin_unlock_irqrestore(&pmu_lock, flags); + return; + } + adb_int_pending = 1; +#ifdef SUSPEND_USES_PMU + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0xfc); + spin_unlock_irqrestore(&pmu_lock, flags); + while(!req.complete) + pmu_poll(); +#else /* SUSPEND_USES_PMU */ + if (gpio_irq >= 0) + enable_irq(gpio_irq); + out_8(&via[IER], CB1_INT | IER_SET); + spin_unlock_irqrestore(&pmu_lock, flags); + pmu_poll(); +#endif /* SUSPEND_USES_PMU */ } static void __openfirmware via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs) { + unsigned long flags; int intr; int nloop = 0; - unsigned long flags; - /* Currently, we use brute-force cli() for syncing with GPIO - * interrupt. I'll make this smarter later, along with some - * spinlocks for SMP */ - save_flags(flags);cli(); + /* This is a bit brutal, we can probably do better */ + spin_lock_irqsave(&pmu_lock, flags); ++disable_poll; + while ((intr = in_8(&via[IFR])) != 0) { if (++nloop > 1000) { printk(KERN_DEBUG "PMU: stuck in intr loop, " @@ -681,25 +806,38 @@ out_8(&via[IFR], intr); } } - if (gpio_reg && (in_8(gpio_reg + 0x9) & 0x02) == 0) + /* This is not necessary except if synchronous ADB requests are done + * with interrupts off, which should not happen. Since I'm not sure + * this "wiring" will remain, I'm commenting it out for now. Please do + * not remove. -- BenH. + */ +#if 0 + if (gpio_reg && !pmu_suspended && (in_8(gpio_reg + 0x9) & 0x02) == 0) adb_int_pending = 1; +#endif if (pmu_state == idle) { if (adb_int_pending) { pmu_state = intack; + /* Sounds safer to make sure ACK is high before writing. + * This helped kill a problem with ADB and some iBooks + */ + wait_for_ack(); send_byte(PMU_INT_ACK); adb_int_pending = 0; } else if (current_req) { pmu_start(); } } + --disable_poll; - restore_flags(flags); + spin_unlock_irqrestore(&pmu_lock, flags); } static void __openfirmware gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) { + adb_int_pending = 1; via_pmu_interrupt(0, 0, 0); } @@ -707,7 +845,7 @@ pmu_sr_intr(struct pt_regs *regs) { struct adb_request *req; - int bite, timeout; + int bite; if (via[B] & TREQ) { printk(KERN_ERR "PMU: spurious SR intr (%x)\n", via[B]); @@ -720,26 +858,16 @@ if (via[B] & TACK) { while ((in_8(&via[B]) & TACK) != 0) ; -#if 0 - printk(KERN_ERR "PMU: sr_intr but ack still high! (%x)\n", - via[B]); -#endif } /* reset TREQ and wait for TACK to go high */ out_8(&via[B], in_8(&via[B]) | TREQ); - timeout = 3200; - while ((in_8(&via[B]) & TACK) == 0) { - if (--timeout < 0) { - printk(KERN_ERR "PMU not responding (!ack)\n"); - return; - } - udelay(10); - } + wait_for_ack(); /* if reading grab the byte, and reset the interrupt */ if (pmu_state == reading || pmu_state == reading_intr) bite = in_8(&via[SR]); + out_8(&via[IFR], SR_INT); switch (pmu_state) { @@ -761,8 +889,11 @@ current_req = req->next; if (req->reply_expected) req_awaiting_reply = req; - else + else { + spin_unlock(&pmu_lock); pmu_done(req); + spin_lock(&pmu_lock); + } } else { pmu_state = reading; data_index = 0; @@ -795,12 +926,16 @@ } if (pmu_state == reading_intr) { + spin_unlock(&pmu_lock); pmu_handle_data(interrupt_data, data_index, regs); + spin_lock(&pmu_lock); } else { req = current_req; current_req = req->next; req->reply_len += data_index; + spin_unlock(&pmu_lock); pmu_done(req); + spin_lock(&pmu_lock); } pmu_state = idle; @@ -826,6 +961,7 @@ { asleep = 0; if (len < 1) { +// xmon_printk("empty ADB\n"); adb_int_pending = 0; return; } @@ -854,6 +990,7 @@ } } #endif /* CONFIG_XMON */ +#ifdef CONFIG_ADB /* * XXX On the [23]400 the PMU gives us an up * event for keycodes 0x74 or 0x75 when the PC @@ -864,10 +1001,13 @@ && data[1] == 0x2c && data[3] == 0xff && (data[2] & ~1) == 0xf4)) adb_input(data+1, len-1, regs, 1); +#endif /* CONFIG_ADB */ } } else if (data[0] == 0x08 && len == 3) { /* sound/brightness buttons pressed */ - pmu_set_brightness(data[1] >> 3); +#ifdef CONFIG_PMAC_BACKLIGHT + set_backlight_level(data[1] >> 4); +#endif set_volume(data[2]); } else { #ifdef CONFIG_PMAC_PBOOK @@ -876,53 +1016,23 @@ } } -int backlight_level = -1; -int backlight_enabled = 0; - -#define LEVEL_TO_BRIGHT(lev) ((lev) < 1? 0x7f: 0x4a - ((lev) << 1)) - -void __openfirmware -pmu_enable_backlight(int on) +#ifdef CONFIG_PMAC_BACKLIGHT +static int backlight_to_bright[] = { + 0x7f, 0x46, 0x42, 0x3e, 0x3a, 0x36, 0x32, 0x2e, + 0x2a, 0x26, 0x22, 0x1e, 0x1a, 0x16, 0x12, 0x0e +}; + +static int __openfirmware +pmu_set_backlight_enable(int on, int level, void* data) { struct adb_request req; + + if (vias == NULL) + return -ENODEV; - if ((vias == NULL) || !pmu_has_backlight) - return; - - /* first call: get current backlight value */ - if (on && backlight_level < 0) { - switch (pmu_kind) { - case PMU_OHARE_BASED: - pmu_request(&req, NULL, 2, 0xd9, 0); - while (!req.complete) - pmu_poll(); - backlight_level = req.reply[1] >> 3; - break; - case PMU_HEATHROW_BASED: - /* We cannot use nvram_read_byte here (not yet initialized) */ - pmu_request(&req, NULL, 3, PMU_READ_NVRAM, 0x14, 0xe); - while (!req.complete) - pmu_poll(); - backlight_level = req.reply[1]; - printk(KERN_DEBUG "pmu: nvram returned bright: %d\n", backlight_level); - break; - case PMU_PADDINGTON_BASED: - case PMU_KEYLARGO_BASED: - /* the G3 PB 1999 has a backlight node - and chrp-structured nvram */ - /* XXX should read macos's "blkt" property in nvram - for this node. For now this ensures that the - backlight doesn't go off as soon as linux boots. */ - backlight_level = 20; - break; - default: - backlight_enabled = 0; - return; - } - } if (on) { pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, - LEVEL_TO_BRIGHT(backlight_level)); + backlight_to_bright[level]); while (!req.complete) pmu_poll(); } @@ -930,35 +1040,28 @@ PMU_POW_BACKLIGHT | (on ? PMU_POW_ON : PMU_POW_OFF)); while (!req.complete) pmu_poll(); - backlight_enabled = on; + + return 0; } -void __openfirmware -pmu_set_brightness(int level) +static int __openfirmware +pmu_set_backlight_level(int level, void* data) { - int bright; + if (vias == NULL) + return -ENODEV; - if ((vias == NULL) || !pmu_has_backlight) - return ; + if (!bright_req_1.complete) + return -EAGAIN; + pmu_request(&bright_req_1, NULL, 2, PMU_BACKLIGHT_BRIGHT, + backlight_to_bright[level]); + if (!bright_req_2.complete) + return -EAGAIN; + pmu_request(&bright_req_2, NULL, 2, PMU_POWER_CTRL, PMU_POW_BACKLIGHT + | (level > BACKLIGHT_OFF ? PMU_POW_ON : PMU_POW_OFF)); - backlight_level = level; - bright = LEVEL_TO_BRIGHT(level); - if (!backlight_enabled) - return; - if (bright_req_1.complete) - pmu_request(&bright_req_1, NULL, 2, PMU_BACKLIGHT_BRIGHT, - bright); - if (bright_req_2.complete) - pmu_request(&bright_req_2, NULL, 2, PMU_POWER_CTRL, - PMU_POW_BACKLIGHT | (bright < 0x7f ? PMU_POW_ON : PMU_POW_OFF)); - - /* XXX nvram address is hard-coded and looks ok on wallstreet, please - test on your machine. Note that newer MacOS system software may break - the nvram layout. */ - if ((pmu_kind == PMU_HEATHROW_BASED) && bright_req_3.complete) - pmu_request(&bright_req_3, NULL, 4, PMU_WRITE_NVRAM, - 0x14, 0xe, level); + return 0; } +#endif /* CONFIG_PMAC_BACKLIGHT */ void __openfirmware pmu_enable_irled(int on) @@ -967,6 +1070,8 @@ if (vias == NULL) return ; + if (pmu_kind == PMU_KEYLARGO_BASED) + return ; pmu_request(&req, NULL, 2, PMU_POWER_CTRL, PMU_POW_IRLED | (on ? PMU_POW_ON : PMU_POW_OFF)); @@ -1201,17 +1306,9 @@ { int ret; unsigned long save_l2cr; - unsigned long save_fcr; unsigned long wait; unsigned short pmcr1; - struct adb_request sleep_req; - struct device_node *macio; - unsigned long macio_base = 0; - - macio = find_devices("mac-io"); - if (macio != 0 && macio->n_addrs > 0) - macio_base = (unsigned long) - ioremap(macio->addrs[0].address, 0x40); + struct adb_request req; /* Notify device drivers */ ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT); @@ -1245,14 +1342,13 @@ /* Make sure the decrementer won't interrupt us */ asm volatile("mtdec %0" : : "r" (0x7fffffff)); + feature_prepare_for_sleep(); + /* For 750, save backside cache setting and disable it */ save_l2cr = _get_L2CR(); /* (returns 0 if not 750) */ if (save_l2cr) _set_L2CR(0); - if (macio_base != 0) - save_fcr = in_le32(FEATURE_CTRL(macio_base)); - if (current->thread.regs && (current->thread.regs->msr & MSR_FP) != 0) giveup_fpu(current); @@ -1263,17 +1359,14 @@ grackle_pcibios_write_config_word(0, 0, 0x70, pmcr1); /* Ask the PMU to put us to sleep */ - pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); - while (!sleep_req.complete) + pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); + while (!req.complete) pmu_poll(); cli(); while (pmu_state != idle) pmu_poll(); - /* clear IOBUS enable */ - out_le32(FEATURE_CTRL(macio_base), save_fcr & ~HRW_IOBUS_ENABLE); - /* Call low-level ASM sleep handler */ low_sleep_handler(); @@ -1282,15 +1375,14 @@ pmcr1 &= ~(GRACKLE_PM|GRACKLE_DOZE|GRACKLE_SLEEP|GRACKLE_NAP); grackle_pcibios_write_config_word(0, 0, 0x70, pmcr1); - /* reenable IOBUS */ - out_le32(FEATURE_CTRL(macio_base), save_fcr | HRW_IOBUS_ENABLE); - /* Make sure the PMU is idle */ while (pmu_state != idle) pmu_poll(); sti(); + feature_wake_up(); + /* The PGD is only a placeholder until Dan finds a way to make * this work properly on the 8xx processors. It is only used on * 8xx processors, it is ignored here. @@ -1304,6 +1396,116 @@ /* reenable interrupts */ sleep_restore_intrs(); + /* Tell PMU we are ready */ + pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); + while (!req.complete) + pmu_poll(); + + /* Notify drivers */ + mdelay(10); + broadcast_wake(); + + return 0; +} + +/* Not finished yet */ +int __openfirmware powerbook_sleep_Core99(void) +{ + int ret; + unsigned long save_l2cr; + unsigned long wait; + struct adb_request req; + + /* Notify device drivers */ + ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT); + if (ret != PBOOK_SLEEP_OK) { + printk("pmu: sleep rejected\n"); + return -EBUSY; + } + + /* Sync the disks. */ + /* XXX It would be nice to have some way to ensure that + * nobody is dirtying any new buffers while we wait. + * BenH: Moved to _after_ sleep request and changed video + * drivers to vmalloc() during sleep request. This way, all + * vmalloc's are done before actual sleep of block drivers */ + fsync_dev(0); + + /* Sleep can fail now. May not be very robust but useful for debugging */ + ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE); + if (ret != PBOOK_SLEEP_OK) { + printk("pmu: sleep failed\n"); + return -EBUSY; + } + + /* Give the disks a little time to actually finish writing */ + for (wait = jiffies + (HZ/4); time_before(jiffies, wait); ) + mb(); + + /* Tell PMU what events will wake us up */ + pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_CLR_WAKEUP_EVENTS, + 0xff, 0xff); + while (!req.complete) + pmu_poll(); + pmu_request(&req, NULL, 4, PMU_POWER_EVENTS, PMU_PWR_SET_WAKEUP_EVENTS, + 0, PMU_PWR_WAKEUP_KEY | PMU_PWR_WAKEUP_LID_OPEN); + while (!req.complete) + pmu_poll(); + + /* Disable all interrupts except pmu */ + sleep_save_intrs(vias->intrs[0].line); + + /* Make sure the decrementer won't interrupt us */ + asm volatile("mtdec %0" : : "r" (0x7fffffff)); + + /* Save the state of PCI config space for some slots */ + pbook_pci_save(); + + feature_prepare_for_sleep(); + + /* For 750, save backside cache setting and disable it */ + save_l2cr = _get_L2CR(); /* (returns 0 if not 750) */ + if (save_l2cr) + _set_L2CR(0); + + if (current->thread.regs && (current->thread.regs->msr & MSR_FP) != 0) + giveup_fpu(current); + + /* Ask the PMU to put us to sleep */ + pmu_request(&req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); + while (!req.complete) + mb(); + + cli(); + while (pmu_state != idle) + pmu_poll(); + + /* Call low-level ASM sleep handler */ + low_sleep_handler(); + + /* Make sure the PMU is idle */ + while (pmu_state != idle) + pmu_poll(); + + sti(); + + feature_wake_up(); + pbook_pci_restore(); + + set_context(current->mm->context, current->mm->pgd); + + /* Restore L2 cache */ + if (save_l2cr) + _set_L2CR(save_l2cr | 0x200000); /* set invalidate bit */ + + /* reenable interrupts */ + sleep_restore_intrs(); + + /* Tell PMU we are ready */ + pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); + while (!req.complete) + pmu_poll(); + /* Notify drivers */ mdelay(10); broadcast_wake(); @@ -1557,7 +1759,6 @@ u_int cmd, u_long arg) { int error; - __u32 value; switch (cmd) { case PMU_IOC_SLEEP: @@ -1569,21 +1770,33 @@ case PMU_PADDINGTON_BASED: error = powerbook_sleep_G3(); break; +#if 0 /* Not ready yet */ + case PMU_KEYLARGO_BASED: + error = powerbook_sleep_Core99(); + break; +#endif default: error = -ENOSYS; } return error; +#ifdef CONFIG_PMAC_BACKLIGHT + /* Backlight should have its own device or go via + * the fbdev + */ case PMU_IOC_GET_BACKLIGHT: - if (!pmu_has_backlight) - return -ENOSYS; - return put_user(backlight_level, (__u32 *)arg); + error = get_backlight_level(); + if (error < 0) + return error; + return put_user(error, (__u32 *)arg); case PMU_IOC_SET_BACKLIGHT: - if (!pmu_has_backlight) - return -ENOSYS; + { + __u32 value; error = get_user(value, (__u32 *)arg); if (!error) - pmu_set_brightness(value); + error = set_backlight_level(value); return error; + } +#endif /* CONFIG_PMAC_BACKLIGHT */ case PMU_IOC_GET_MODEL: return put_user(pmu_kind, (__u32 *)arg); case PMU_IOC_HAS_ADB: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/media/video/bttv-driver.c linux/drivers/media/video/bttv-driver.c --- v2.4.0-test8/linux/drivers/media/video/bttv-driver.c Mon Aug 7 21:01:35 2000 +++ linux/drivers/media/video/bttv-driver.c Sun Sep 17 09:45:06 2000 @@ -3027,11 +3027,11 @@ * Scan for a Bt848 card, request the irq and map the io memory */ -static void __devinit bttv_remove(struct pci_dev *pci_dev) +static void __devexit bttv_remove(struct pci_dev *pci_dev) { u8 command; int j; - struct bttv *btv = PCI_GET_DRIVER_DATA(pci_dev); + struct bttv *btv = pci_get_drvdata(pci_dev); /* unregister i2c_bus */ if (0 == btv->i2c_ok) @@ -3093,6 +3093,8 @@ btv->shutdown=1; wake_up(&btv->gpioq); + pci_set_drvdata(pci_dev, NULL); + return; } @@ -3198,7 +3200,7 @@ } } - PCI_SET_DRIVER_DATA(dev,btv); + pci_set_drvdata(dev,btv); if(init_bt848(btv) < 0) { bttv_remove(dev); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/media/video/bttv.h linux/drivers/media/video/bttv.h --- v2.4.0-test8/linux/drivers/media/video/bttv.h Sun Aug 6 12:45:28 2000 +++ linux/drivers/media/video/bttv.h Sun Sep 17 09:45:06 2000 @@ -23,11 +23,6 @@ #define BTTV_VERSION_CODE KERNEL_VERSION(0,7,38) -#ifndef PCI_GET_DRIVER_DATA -# define PCI_GET_DRIVER_DATA(pdev) ((pdev)->driver_data) -# define PCI_SET_DRIVER_DATA(pdev,data) (((pdev)->driver_data) = (data)) -#endif /* PCI_GET_DRIVER_DATA */ - #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/3c507.c linux/drivers/net/3c507.c --- v2.4.0-test8/linux/drivers/net/3c507.c Mon Jun 19 13:30:56 2000 +++ linux/drivers/net/3c507.c Sun Sep 17 09:41:28 2000 @@ -332,6 +332,7 @@ { static unsigned char init_ID_done = 0, version_printed = 0; int i, irq, irqval; + struct net_local *lp; if (init_ID_done == 0) { ushort lrs_state = 0xff; @@ -355,7 +356,7 @@ /* Allocate a new 'dev' if needed. */ if (dev == NULL) - dev = init_etherdev(0, sizeof(struct net_local)); + dev = init_etherdev(0, 0); if (net_debug && version_printed++ == 0) printk(version); @@ -417,10 +418,11 @@ printk(version); /* Initialize the device structure. */ - dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); + lp = dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); if (dev->priv == NULL) return -ENOMEM; memset(dev->priv, 0, sizeof(struct net_local)); + spin_lock_init(&lp->lock); dev->open = el16_open; dev->stop = el16_close; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/3c509.c linux/drivers/net/3c509.c --- v2.4.0-test8/linux/drivers/net/3c509.c Tue Jul 11 11:12:23 2000 +++ linux/drivers/net/3c509.c Sun Sep 17 09:41:28 2000 @@ -193,6 +193,7 @@ int el3_probe(struct net_device *dev) { + struct el3_private *lp; short lrs_state = 0xff, i; int ioaddr, irq, if_port; u16 phys_addr[3]; @@ -200,7 +201,7 @@ int mca_slot = -1; #ifdef __ISAPNP__ static int pnp_cards = 0; -#endif +#endif /* __ISAPNP__ */ /* First check all slots of the EISA bus. The next slot address to probe is kept in 'eisa_addr' to support multiple probe() calls. */ @@ -292,7 +293,7 @@ /* if we get here, we didn't find an MCA adapter */ return -ENODEV; } -#endif +#endif /* CONFIG_MCA */ #ifdef __ISAPNP__ if (nopnp == 1) @@ -330,7 +331,7 @@ } } no_pnp: -#endif +#endif /* __ISAPNP__ */ /* Select an open I/O location at 0x1*0 to do contention select. */ for ( ; id_port < 0x200; id_port += 0x10) { @@ -396,7 +397,7 @@ } } } -#endif +#endif /* __ISAPNP__ */ { unsigned int iobase = id_read_eeprom(8); @@ -466,9 +467,10 @@ return -ENOMEM; memset(dev->priv, 0, sizeof(struct el3_private)); - ((struct el3_private *)dev->priv)->mca_slot = mca_slot; - ((struct el3_private *)dev->priv)->next_dev = el3_root_dev; - ((struct el3_private *)dev->priv)->lock = (spinlock_t) SPIN_LOCK_UNLOCKED; + lp = dev->priv; + lp->mca_slot = mca_slot; + lp->next_dev = el3_root_dev; + spin_lock_init(&lp->lock); el3_root_dev = dev; if (el3_debug > 0) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/3c59x.c linux/drivers/net/3c59x.c --- v2.4.0-test8/linux/drivers/net/3c59x.c Sun Aug 13 19:27:39 2000 +++ linux/drivers/net/3c59x.c Fri Sep 15 16:28:25 2000 @@ -98,6 +98,18 @@ - Added INVERT_LED_PWR, used it. - Backed out the extra_reset stuff + LK1.1.9 2 Sep 2000 andrewm + - Backed out the tx_reset_resume flags. It was a no-op. + - In vortex_error, don't reset the Tx on txReclaim errors + - In vortex_error, don't reset the Tx on maxCollisions errors. + Hence backed out all the DownListPtr logic here. + - In vortex_error, give Tornado cards a partial TxReset on + maxCollisions (David Hinds). Defined MAX_COLLISION_RESET for this. + - Redid some driver flags and device names based on pcmcia_cs-3.1.20. + - Fixed a bug where, if vp->tx_full is set when the interface + is downed, it remains set when the interface is upped. Bad + things happen. + - See http://www.uow.edu.au/~andrewm/linux/#3c59x-2.3 for more details. - Also see Documentation/networking/vortex.txt */ @@ -183,7 +195,7 @@ #include static char version[] __devinitdata = -"3c59x.c:LK1.1.8 13 Aug 2000 Donald Becker and others. http://www.scyld.com/network/vortex.html " "$Revision: 1.102.2.25 $\n"; +"3c59x.c:LK1.1.9 2 Sep 2000 Donald Becker and others. http://www.scyld.com/network/vortex.html " "$Revision: 1.102.2.38 $\n"; MODULE_AUTHOR("Donald Becker "); MODULE_DESCRIPTION("3Com 3c59x/3c90x/3c575 series Vortex/Boomerang/Cyclone driver"); @@ -303,7 +315,7 @@ enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8, EEPROM_8BIT=0x10, /* AKPM: Uses 0x230 as the base bitmaps for EEPROM reads */ HAS_PWR_CTRL=0x20, HAS_MII=0x40, HAS_NWAY=0x80, HAS_CB_FNS=0x100, - INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400 }; + INVERT_MII_PWR=0x200, INVERT_LED_PWR=0x400, MAX_COLLISION_RESET=0x800 }; enum vortex_chips { @@ -415,14 +427,14 @@ {"3CCFE575BT Cyclone CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_LED_PWR, 128, }, - {"3CCFE575CT Cyclone CardBus", - PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR, 128, }, + {"3CCFE575CT Tornado CardBus", + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|MAX_COLLISION_RESET, 128, }, {"3CCFE656 Cyclone CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|INVERT_LED_PWR, 128, }, {"3CCFEM656B Cyclone+Winmodem CardBus", PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|INVERT_LED_PWR, 128, }, - {"3CCFE656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */ - PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR, 128, }, + {"3CXFEM656C Tornado+Winmodem CardBus", /* From pcmcia-cs-3.1.5 */ + PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|MAX_COLLISION_RESET, 128, }, {"3c450 HomePNA Tornado", /* AKPM: from Don's 0.99Q */ PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY, 128, }, @@ -652,7 +664,6 @@ open:1, must_free_region:1; /* Flag: if zero, Cardbus owns the I/O region */ int drv_flags; - int tx_reset_resume; /* Flag to retart timer after vortex_error handling */ u16 status_enable; u16 intr_enable; u16 available_media; /* From Wn3_Options. */ @@ -1369,6 +1380,7 @@ vortex_up(dev); vp->open = 1; + vp->tx_full = 0; return 0; out_free_irq: @@ -1570,7 +1582,7 @@ { struct vortex_private *vp = (struct vortex_private *)dev->priv; long ioaddr = dev->base_addr; - int do_tx_reset = 0; + int do_tx_reset = 0, reset_mask = 0; unsigned char tx_status = 0; if (vortex_debug > 2) { @@ -1589,10 +1601,14 @@ if (tx_status & 0x14) vp->stats.tx_fifo_errors++; if (tx_status & 0x38) vp->stats.tx_aborted_errors++; outb(0, ioaddr + TxStatus); - if (tx_status & 0x3a) /* TxReset after 16 collisions, despite what the manual says */ - do_tx_reset = 1; /* Also reset on reclaim errors */ - else /* Merely re-enable the transmitter. */ + if (tx_status & 0x30) { /* txJabber or txUnderrun */ + do_tx_reset = 1; + } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ + do_tx_reset = 1; + reset_mask = 0x0108; /* Reset interface logic, but not download logic */ + } else { /* Merely re-enable the transmitter. */ outw(TxEnable, ioaddr + EL3_CMD); + } } if (status & RxEarly) { /* Rx early is unused. */ @@ -1644,40 +1660,11 @@ } } - /* - * Black magic. If we're resetting the transmitter, remember the current downlist - * pointer and restore it afterwards. We can't usr cur_tx because that could - * lag the actual hardware index. - */ if (do_tx_reset) { - if (vp->full_bus_master_tx) { - unsigned long old_down_list_ptr; - - wait_for_completion(dev, DownStall); - old_down_list_ptr = inl(ioaddr + DownListPtr); - wait_for_completion(dev, TxReset); - outw(TxEnable, ioaddr + EL3_CMD); - - /* Restart DMA if necessary */ - outl(old_down_list_ptr, ioaddr + DownListPtr); - if (vortex_debug > 2) - printk(KERN_DEBUG "reset DMA to 0x%08x\n", inl(ioaddr + DownListPtr)); - outw(DownUnstall, ioaddr + EL3_CMD); - - /* - * Here we make a single attempt to prevent a timeout by - * restarting the timer if we think that the ISR has a good - * chance of unjamming things. - */ - if (vp->tx_reset_resume == 0 && vp->tx_full) { - vp->tx_reset_resume = 1; - dev->trans_start = jiffies; - } - } else { - wait_for_completion(dev, TxReset); - outw(TxEnable, ioaddr + EL3_CMD); + wait_for_completion(dev, TxReset|reset_mask); + outw(TxEnable, ioaddr + EL3_CMD); + if (!vp->full_bus_master_tx) netif_wake_queue(dev); - } } } @@ -1785,7 +1772,6 @@ /* netif_start_queue (dev); */ /* AKPM: redundant? */ } outw(DownUnstall, ioaddr + EL3_CMD); - vp->tx_reset_resume = 0; spin_unlock_irqrestore(&vp->lock, flags); dev->trans_start = jiffies; return 0; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/8139too.c linux/drivers/net/8139too.c --- v2.4.0-test8/linux/drivers/net/8139too.c Fri Sep 8 12:37:34 2000 +++ linux/drivers/net/8139too.c Sun Sep 17 09:41:28 2000 @@ -2,8 +2,37 @@ 8139too.c: A RealTek RTL-8139 Fast Ethernet driver for Linux. - Copyright 2000 Jeff Garzik - Originally: Written 1997-1999 by Donald Becker. + Maintained by Jeff Garzik + + Much code comes from Donald Becker's rtl8139.c driver, + versions 1.11 and older. This driver was originally based + on rtl8139.c version 1.07. Header of rtl8139.c version 1.11: + + ---------- + + Written 1997-2000 by Donald Becker. + This software may be used and distributed according to the + terms of the GNU General Public License (GPL), incorporated + herein by reference. Drivers based on or derived from this + code fall under the GPL and must retain the authorship, + copyright and license notice. This file is not a complete + program and may only be used when the entire operating + system is licensed under the GPL. + + This driver is for boards based on the RTL8129 and RTL8139 + PCI ethernet chips. + + The author may be reached as becker@scyld.com, or C/O Scyld + Computing Corporation 410 Severn Ave., Suite 210 Annapolis + MD 21403 + + Support and updates available at + http://www.scyld.com/network/rtl8139.html + + Twister-tuning table provided by Kinston + . + + ---------- This software may be used and distributed according to the terms of the GNU Public License, incorporated herein by reference. @@ -16,7 +45,7 @@ Tigran Aivazian - bug fixes, skbuff free cleanup Martin Mares - suggestions for PCI cleanup - + David S. Miller - PCI DMA and softnet updates Ernst Gill - fixes ported from BSD driver @@ -24,7 +53,22 @@ Daniel Kobras - identified specific locations of posted MMIO write bugginess - Gerard Sharp - bug fix + Gerard Sharp - bug fix, testing and feedback + + David Ford - Rx ring wrap fix + + Dan DeMaggio - swapped RTL8139 cards with me, and allowed me + to find and fix a crucial bug on older chipsets. + + Donald Becker/Chris Butterworth/Marcus Westergren - + Noticed various Rx packet size-related buglets. + + Santiago Garcia Mantinan - testing and feedback + + Jens David - 2.2.x kernel backports + + Martin Dennett - incredibly helpful insight on undocumented + features of the 8139 chips Submitting bug reports: @@ -73,7 +117,7 @@ IVb. References http://www.realtek.com.tw/cn/cn.html -http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html +http://www.scyld.com/expert/NWay.html IVc. Errata @@ -97,25 +141,33 @@ #include -#define RTL8139_VERSION "0.9.8" +#define RTL8139_VERSION "0.9.10" #define RTL8139_MODULE_NAME "8139too" #define RTL8139_DRIVER_NAME RTL8139_MODULE_NAME " Fast Ethernet driver " RTL8139_VERSION #define PFX RTL8139_MODULE_NAME ": " -#undef RTL8139_DEBUG /* define to 1 to enable copious debugging info */ + +/* define to 1 to enable PIO instead of MMIO */ +#undef USE_IO_OPS + +/* define to 1 to enable copious debugging info */ +#undef RTL8139_DEBUG + +/* define to 1 to disable lightweight runtime debugging checks */ +#undef RTL8139_NDEBUG + #ifdef RTL8139_DEBUG /* note: prints function name for you */ -#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) +# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) #else -#define DPRINTK(fmt, args...) +# define DPRINTK(fmt, args...) #endif -#undef RTL8139_NDEBUG /* define to 1 to disable lightweight runtime checks */ #ifdef RTL8139_NDEBUG -#define assert(expr) +# define assert(expr) do {} while (0) #else -#define assert(expr) \ +# define assert(expr) \ if(!(expr)) { \ printk( "Assertion failed! %s,%s,%s,line=%d\n", \ #expr,__FILE__,__FUNCTION__,__LINE__); \ @@ -125,12 +177,6 @@ #define arraysize(x) (sizeof(x)/sizeof(*(x))) -#ifndef PCI_GET_DRIVER_DATA - #define PCI_GET_DRIVER_DATA(pdev) ((pdev)->driver_data) - #define PCI_SET_DRIVER_DATA(pdev,data) (((pdev)->driver_data) = (data)) -#endif /* PCI_GET_DRIVER_DATA */ - - /* A few user-configurable values. */ /* media options */ static int media[] = {-1, -1, -1, -1, -1, -1, -1, -1}; @@ -146,7 +192,8 @@ #define RX_BUF_LEN_IDX 2 /* 0==8K, 1==16K, 2==32K, 3==64K */ #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX) #define RX_BUF_PAD 16 -#define RX_BUF_TOT_LEN (RX_BUF_LEN + RX_BUF_PAD) +#define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */ +#define RX_BUF_TOT_LEN (RX_BUF_LEN + RX_BUF_PAD + RX_BUF_WRAP_PAD) /* Number of Tx descriptor registers. */ #define NUM_TX_DESC 4 @@ -160,9 +207,9 @@ #define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */ /* The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024, 7==end of packet. */ -#define RX_FIFO_THRESH 4 /* Rx buffer level before first PCI xfer. */ -#define RX_DMA_BURST 4 /* Maximum PCI burst, '7' is unlimited */ -#define TX_DMA_BURST 4 /* Maximum PCI burst, '4' is 256 */ +#define RX_FIFO_THRESH 6 /* Rx buffer level before first PCI xfer. */ +#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ +#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */ /* Operational parameters that usually are not changed. */ @@ -321,6 +368,7 @@ TxLoopBack = (1 << 18) | (1 << 17), /* enable loopback test mode */ TxCRC = (1 << 16), /* DISABLE appending CRC to end of Tx packets */ TxClearAbt = (1 << 0), /* Clear abort (WO) */ + TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ TxVersionMask = 0x7C800000, /* mask out version bits 30-26, 23 */ }; @@ -341,7 +389,7 @@ /* Early Rx threshold, none or X/16 */ RxCfgEarlyRxNone = 0, RxCfgEarlyRxShift = 24, - + /* rx fifo threshold */ RxCfgFIFOShift = 13, RxCfgFIFONone = (7 << RxCfgFIFOShift), @@ -355,6 +403,9 @@ RxCfgRcv16K = (1 << 11), RxCfgRcv32K = (1 << 12), RxCfgRcv64K = (1 << 11) | (1 << 12), + + /* Disable packet wrap at end of Rx buffer */ + RxNoWrap = (1 << 7), }; @@ -411,17 +462,17 @@ 0x40, 0xf0fe0040, /* XXX copied from RTL8139A, verify */ }, - + { "RTL-8139 rev K", 0x60, - 0xf0fe0040, /* XXX copied from RTL8139A, verify */ + 0xf0fe0040, }, - + { "RTL-8139A", 0x70, 0xf0fe0040, }, - + { "RTL-8139B", 0x78, 0xf0fc0040 @@ -497,6 +548,32 @@ static void rtl8139_hw_start (struct net_device *dev); +#ifdef USE_IO_OPS + +#define RTL_R8(reg) inb (((unsigned long)ioaddr) + (reg)) +#define RTL_R16(reg) inw (((unsigned long)ioaddr) + (reg)) +#define RTL_R32(reg) inl (((unsigned long)ioaddr) + (reg)) +#define RTL_W8(reg, val8) outb ((val8), ((unsigned long)ioaddr) + (reg)) +#define RTL_W16(reg, val16) outw ((val16), ((unsigned long)ioaddr) + (reg)) +#define RTL_W32(reg, val32) outl ((val32), ((unsigned long)ioaddr) + (reg)) +#define RTL_W8_F RTL_W8 +#define RTL_W16_F RTL_W16 +#define RTL_W32_F RTL_W32 +#undef readb +#undef readw +#undef readl +#undef writeb +#undef writew +#undef writel +#define readb(addr) inb((unsigned long)(addr)) +#define readw(addr) inw((unsigned long)(addr)) +#define readl(addr) inl((unsigned long)(addr)) +#define writeb(val,addr) outb((val),(unsigned long)(addr)) +#define writew(val,addr) outw((val),(unsigned long)(addr)) +#define writel(val,addr) outl((val),(unsigned long)(addr)) + +#else + /* write MMIO register, with flush */ /* Flush avoids rtl8139 bug w/ posted MMIO writes */ #define RTL_W8_F(reg, val8) do { writeb ((val8), ioaddr + (reg)); readb (ioaddr + (reg)); } while (0) @@ -525,13 +602,17 @@ #define RTL_R16(reg) readw (ioaddr + (reg)) #define RTL_R32(reg) readl (ioaddr + (reg)) +#endif /* USE_IO_OPS */ -static const u16 rtl8139_intr_mask = + +static const u16 rtl8139_intr_mask = PCIErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; static const unsigned int rtl8139_rx_config = - RxCfgEarlyRxNone | RxCfgFIFONone | RxCfgRcv32K | RxCfgDMAUnlimited; + RxCfgEarlyRxNone | RxCfgRcv32K | RxNoWrap | + (RX_FIFO_THRESH << RxCfgFIFOShift) | + (RX_DMA_BURST << RxCfgDMAShift); static int __devinit rtl8139_init_board (struct pci_dev *pdev, @@ -577,7 +658,7 @@ /* set this immediately, we need to know before * we talk to the chip directly */ DPRINTK("PIO region size == 0x%02X\n", pio_len); - DPRINTK("MMIO region size == 0x%02X\n", mmio_len); + DPRINTK("MMIO region size == 0x%02lX\n", mmio_len); if (pio_len == RTL8139B_IO_SIZE) tp->chipset = CH_8139B; @@ -587,14 +668,14 @@ rc = -ENODEV; goto err_out; } - + /* make sure PCI base addr 1 is MMIO */ if (!(mmio_flags & IORESOURCE_MEM)) { printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n"); rc = -ENODEV; goto err_out; } - + /* check for weird/broken PCI region reporting */ if ((pio_len != mmio_len) || (pio_len < RTL_MIN_IO_SIZE) || @@ -610,14 +691,14 @@ rc = -EBUSY; goto err_out; } - + /* make sure our MMIO region in PCI space is available */ if (!request_mem_region (mmio_start, mmio_len, dev->name)) { printk (KERN_ERR PFX "no mem resource available, aborting\n"); rc = -EBUSY; goto err_out_free_pio; } - + /* enable device (incl. PCI PM wakeup), and bus-mastering */ rc = pci_enable_device (pdev); if (rc) @@ -625,6 +706,9 @@ pci_set_master (pdev); +#ifdef USE_IO_OPS + ioaddr = (void *) pio_start; +#else /* ioremap MMIO region */ ioaddr = ioremap (mmio_start, mmio_len); if (ioaddr == NULL) { @@ -632,6 +716,7 @@ rc = -EIO; goto err_out_free_mmio; } +#endif /* USE_IO_OPS */ /* Soft reset the chip. */ RTL_W8 (ChipCmd, (RTL_R8 (ChipCmd) & ChipCmdClear) | CmdReset); @@ -653,12 +738,14 @@ RTL_W8 (Config1, 0); } +#ifndef USE_IO_OPS /* sanity checks -- ensure PIO and MMIO registers agree */ assert (inb (pio_start+Config0) == readb (ioaddr+Config0)); assert (inb (pio_start+Config1) == readb (ioaddr+Config1)); assert (inb (pio_start+TxConfig) == readb (ioaddr+TxConfig)); assert (inb (pio_start+RxConfig) == readb (ioaddr+RxConfig)); - +#endif /* !USE_IO_OPS */ + /* make sure chip thinks PIO and MMIO are enabled */ tmp8 = RTL_R8 (Config1); if ((tmp8 & Cfg1_PIO) == 0) { @@ -671,7 +758,7 @@ rc = -EIO; goto err_out_iounmap; } - + /* identify chip attached to board */ tmp = RTL_R8 (ChipVersion); for (i = arraysize (rtl_chip_info) - 1; i >= 0; i--) @@ -691,15 +778,17 @@ tmp, tp->chipset, rtl_chip_info[tp->chipset].name); - + DPRINTK ("EXIT, returning 0\n"); *ioaddr_out = ioaddr; *dev_out = dev; - return 0; + return 0; err_out_iounmap: assert (ioaddr > 0); +#ifndef USE_IO_OPS iounmap (ioaddr); +#endif /* !USE_IO_OPS */ err_out_free_mmio: release_mem_region (mmio_start, mmio_len); err_out_free_pio: @@ -720,14 +809,11 @@ int i, addr_len, option; void *ioaddr = NULL; static int board_idx = -1; - u8 tmp; - -#ifndef RTL8139_NDEBUG static int printed_version = 0; -#endif /* RTL8139_NDEBUG */ + u8 tmp; DPRINTK ("ENTER\n"); - + assert (pdev != NULL); assert (ent != NULL); @@ -743,9 +829,9 @@ DPRINTK ("EXIT, returning %d\n", i); return i; } - + tp = dev->priv; - + assert (ioaddr != NULL); assert (dev != NULL); assert (tp != NULL); @@ -766,7 +852,7 @@ dev->watchdog_timeo = TX_TIMEOUT; dev->irq = pdev->irq; - dev->base_addr = pci_resource_start (pdev, 1); + dev->base_addr = (unsigned long) ioaddr; /* dev->priv/tp zeroed and aligned in init_etherdev */ tp = dev->priv; @@ -779,24 +865,23 @@ tp->mmio_addr = ioaddr; tp->lock = SPIN_LOCK_UNLOCKED; - PCI_SET_DRIVER_DATA (pdev, dev); + pdev->driver_data = dev; tp->phys[0] = 32; - printk (KERN_INFO "%s: %s board found at 0x%lx, IRQ %d\n", - dev->name, board_info[ent->driver_data].name, - dev->base_addr, dev->irq); - - printk (KERN_INFO "%s: Chip is '%s'\n", - dev->name, - rtl_chip_info[tp->chipset].name); - - printk (KERN_INFO "%s: MAC address " - "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n", + printk (KERN_INFO "%s: %s at 0x%lx, " + "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " + "IRQ %d\n", dev->name, + board_info[ent->driver_data].name, + dev->base_addr, dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5]); + dev->dev_addr[4], dev->dev_addr[5], + dev->irq); + + printk (KERN_DEBUG "%s: Identified 8139 chip type '%s'\n", + dev->name, rtl_chip_info[tp->chipset].name); /* Put the chip into low-power mode. */ RTL_W8_F (Cfg9346, Cfg9346_Unlock); @@ -831,7 +916,7 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev) { - struct net_device *dev = PCI_GET_DRIVER_DATA (pdev); + struct net_device *dev = pdev->driver_data; struct rtl8139_private *np; DPRINTK ("ENTER\n"); @@ -843,7 +928,10 @@ unregister_netdev (dev); +#ifndef USE_IO_OPS iounmap (np->mmio_addr); +#endif /* !USE_IO_OPS */ + release_region (pci_resource_start (pdev, 0), pci_resource_len (pdev, 0)); release_mem_region (pci_resource_start (pdev, 1), @@ -857,7 +945,9 @@ #endif /* RTL8139_NDEBUG */ kfree (dev); - + + pdev->driver_data = NULL; + DPRINTK ("EXIT\n"); } @@ -1094,9 +1184,9 @@ DPRINTK ("EXIT, returning -ENOMEM\n"); MOD_DEC_USE_COUNT; return -ENOMEM; - + } - + tp->full_duplex = tp->duplex_lock; tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; @@ -1131,7 +1221,7 @@ u8 tmp; DPRINTK ("ENTER\n"); - + /* Soft reset the chip. */ RTL_W8 (ChipCmd, (RTL_R8 (ChipCmd) & ChipCmdClear) | CmdReset); udelay (100); @@ -1154,7 +1244,7 @@ RTL_W32_F (RxConfig, i); /* Check this value: the documentation for IFG contradicts ifself. */ - RTL_W32 (TxConfig, (TX_DMA_BURST << 8)); + RTL_W32 (TxConfig, (TX_DMA_BURST << TxDMAShift)); /* unlock Config[01234] and BMCR register writes */ RTL_W8_F (Cfg9346, Cfg9346_Unlock); @@ -1175,9 +1265,9 @@ if (tp->chipset >= CH_8139B) { tmp = RTL_R8 (Config4) & ~(1<<2); /* chip will clear Rx FIFO overflow automatically */ - tmp |= (1<<7); + tmp |= (1<<7); RTL_W8 (Config4, tmp); - + /* disable magic packet scanning, which is enabled * when PM is enabled above (Config1) */ RTL_W8 (Config3, RTL_R8 (Config3) & ~(1<<5)); @@ -1334,15 +1424,13 @@ { struct net_device *dev = (struct net_device *) data; struct rtl8139_private *tp = (struct rtl8139_private *) dev->priv; + void *ioaddr = tp->mmio_addr; int next_tick = 60 * HZ; int mii_reg5; - spin_lock_irq (&tp->lock); - mii_reg5 = mdio_read (dev, tp->phys[0], 5); if (!tp->duplex_lock && mii_reg5 != 0xffff) { - void *ioaddr = tp->mmio_addr; int duplex = (mii_reg5 & 0x0100) || (mii_reg5 & 0x01C0) == 0x0040; if (tp->full_duplex != duplex) { @@ -1371,8 +1459,6 @@ dev->name, RTL_R8 (Config0), RTL_R8 (Config1)); - spin_unlock_irq (&tp->lock); - tp->timer.expires = jiffies + next_tick; add_timer (&tp->timer); } @@ -1383,6 +1469,7 @@ struct rtl8139_private *tp = (struct rtl8139_private *) dev->priv; void *ioaddr = tp->mmio_addr; int i; + unsigned long flags; DPRINTK ("%s: Transmit timeout, status %2.2x %4.4x " "media %2.2x.\n", dev->name, @@ -1390,25 +1477,20 @@ RTL_R16 (IntrStatus), RTL_R8 (MediaStatus)); - spin_lock_irq (&tp->lock); - /* Disable interrupts by clearing the interrupt mask. */ RTL_W16 (IntrMask, 0x0000); - spin_unlock_irq (&tp->lock); - /* Emit info to figure out what went wrong. */ - printk (KERN_DEBUG - "%s: Tx queue start entry %d dirty entry %d.\n", + printk (KERN_DEBUG "%s: Tx queue start entry %d dirty entry %d.\n", dev->name, atomic_read (&tp->cur_tx), atomic_read (&tp->dirty_tx)); for (i = 0; i < NUM_TX_DESC; i++) printk (KERN_DEBUG "%s: Tx descriptor %d is %8.8x.%s\n", dev->name, i, RTL_R32 (TxStatus0 + (i * 4)), - i == - atomic_read (&tp->dirty_tx) % NUM_TX_DESC ? " (queue head)" : ""); + i == atomic_read (&tp->dirty_tx) % NUM_TX_DESC ? + " (queue head)" : ""); - spin_lock_irq (&tp->lock); + spin_lock_irqsave (&tp->lock, flags); /* Stop a shared interrupt from scavenging while we are. */ atomic_set (&tp->cur_tx, 0); @@ -1418,7 +1500,8 @@ for (i = 0; i < NUM_TX_DESC; i++) { struct ring_info *rp = &tp->tx_info[i]; if (rp->mapping != 0) { - pci_unmap_single (tp->pci_dev, rp->mapping, rp->skb->len, PCI_DMA_TODEVICE); + pci_unmap_single (tp->pci_dev, rp->mapping, + rp->skb->len, PCI_DMA_TODEVICE); rp->mapping = 0; } if (rp->skb) { @@ -1427,9 +1510,10 @@ tp->stats.tx_dropped++; } } - - spin_unlock_irq (&tp->lock); + spin_unlock_irqrestore (&tp->lock, flags); + + /* ...and finally, reset everything */ rtl8139_hw_start (dev); } @@ -1444,18 +1528,17 @@ /* Calculate the next Tx descriptor entry. */ entry = atomic_read (&tp->cur_tx) % NUM_TX_DESC; + assert (tp->tx_info[entry].skb == NULL); + assert (tp->tx_info[entry].mapping == 0); + tp->tx_info[entry].skb = skb; - tp->tx_info[entry].mapping = 0; + /* tp->tx_info[entry].mapping = 0; */ memcpy (tp->tx_buf[entry], skb->data, skb->len); - spin_lock_irq (&tp->lock); - /* Note: the chip doesn't have auto-pad! */ RTL_W32 (TxStatus0 + (entry * sizeof(u32)), tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); - spin_unlock_irq (&tp->lock); - dev->trans_start = jiffies; atomic_inc (&tp->cur_tx); if ((atomic_read (&tp->cur_tx) - atomic_read (&tp->dirty_tx)) >= NUM_TX_DESC) @@ -1477,20 +1560,15 @@ assert (dev != NULL); assert (tp != NULL); assert (ioaddr != NULL); - - /* drop lock held in rtl8139_interrupt */ - spin_unlock (&tp->lock); - + dirty_tx = atomic_read (&tp->dirty_tx); while ((atomic_read (&tp->cur_tx) - dirty_tx) > 0) { int entry = dirty_tx % NUM_TX_DESC; int txstatus; - spin_lock (&tp->lock); - txstatus = RTL_R32 (TxStatus0 + (entry * 4)); - spin_unlock (&tp->lock); - + txstatus = RTL_R32 (TxStatus0 + (entry * sizeof (u32))); + if (!(txstatus & (TxStatOK | TxUnderrun | TxAborted))) break; /* It still hasn't been Txed */ @@ -1502,9 +1580,7 @@ tp->stats.tx_errors++; if (txstatus & TxAborted) { tp->stats.tx_aborted_errors++; - spin_lock (&tp->lock); - RTL_W32 (TxConfig, (TX_DMA_BURST << 8)); - spin_unlock (&tp->lock); + RTL_W32 (TxConfig, TxClearAbt | (TX_DMA_BURST << TxDMAShift)); } if (txstatus & TxCarrierLost) tp->stats.tx_carrier_errors++; @@ -1551,17 +1627,63 @@ #endif /* RTL8139_NDEBUG */ atomic_set (&tp->dirty_tx, dirty_tx); - - /* obtain lock need for rtl8139_interrupt */ - spin_lock (&tp->lock); +} + + +/* TODO: clean this up! Rx reset need not be this intensive */ +static void rtl8139_rx_err (u32 rx_status, struct net_device *dev, + struct rtl8139_private *tp, void *ioaddr) +{ + u8 tmp8; + int tmp_work = 1000; + + DPRINTK ("%s: Ethernet frame had errors, status %8.8x.\n", + dev->name, rx_status); + if (rx_status & RxTooLong) { + DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", + dev->name, rx_status); + /* A.C.: The chip hangs here. */ + } + tp->stats.rx_errors++; + if (rx_status & (RxBadSymbol | RxBadAlign)) + tp->stats.rx_frame_errors++; + if (rx_status & (RxRunt | RxTooLong)) + tp->stats.rx_length_errors++; + if (rx_status & RxCRCErr) + tp->stats.rx_crc_errors++; + /* Reset the receiver, based on RealTek recommendation. (Bug?) */ + tp->cur_rx = 0; + + /* disable receive */ + tmp8 = RTL_R8 (ChipCmd) & ChipCmdClear; + RTL_W8_F (ChipCmd, tmp8 | CmdTxEnb); + + /* A.C.: Reset the multicast list. */ + rtl8139_set_rx_mode (dev); + + /* XXX potentially temporary hack to + * restart hung receiver */ + while (--tmp_work > 0) { + tmp8 = RTL_R8 (ChipCmd); + if ((tmp8 & CmdRxEnb) && (tmp8 & CmdTxEnb)) + break; + RTL_W8_F (ChipCmd, + (tmp8 & ChipCmdClear) | CmdRxEnb | CmdTxEnb); + } + + /* G.S.: Re-enable receiver */ + /* XXX temporary hack to work around receiver hang */ + rtl8139_set_rx_mode (dev); + + if (tmp_work <= 0) + printk (KERN_WARNING PFX "tx/rx enable wait too long\n"); } /* The data sheet doesn't describe the Rx ring at all, so I'm guessing at the field alignments and semantics. */ static void rtl8139_rx_interrupt (struct net_device *dev, - struct rtl8139_private *tp, - void *ioaddr) + struct rtl8139_private *tp, void *ioaddr) { unsigned char *rx_ring; u16 cur_rx; @@ -1569,31 +1691,33 @@ assert (dev != NULL); assert (tp != NULL); assert (ioaddr != NULL); - + rx_ring = tp->rx_ring; cur_rx = tp->cur_rx; DPRINTK ("%s: In rtl8139_rx(), current %4.4x BufAddr %4.4x," - " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, - RTL_R16 (RxBufAddr), - RTL_R16 (RxBufPtr), - RTL_R8 (ChipCmd)); + " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, + RTL_R16 (RxBufAddr), + RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); while ((RTL_R8 (ChipCmd) & RxBufEmpty) == 0) { int ring_offset = cur_rx % RX_BUF_LEN; u32 rx_status = le32_to_cpu (*(u32 *) (rx_ring + ring_offset)); int rx_size = rx_status >> 16; + struct sk_buff *skb; + int pkt_size = rx_size - 4; DPRINTK ("%s: rtl8139_rx() status %4.4x, size %4.4x," - " cur %4.4x.\n", dev->name, rx_status, - rx_size, cur_rx); + " cur %4.4x.\n", dev->name, rx_status, + rx_size, cur_rx); #if RTL8139_DEBUG > 2 { - int i; - DPRINTK ("%s: Frame contents ", dev->name); - for (i = 0; i < 70; i++) - printk (" %2.2x", rx_ring[ring_offset + i]); - printk (".\n"); + int i; + DPRINTK ("%s: Frame contents ", dev->name); + for (i = 0; i < 70; i++) + printk (" %2.2x", + rx_ring[ring_offset + i]); + printk (".\n"); } #endif @@ -1609,128 +1733,68 @@ if (rx_size == 0xfff0) break; + /* if Rx err received, Rx process gets reset, so + * we abort any further Rx processing + */ if (rx_status & - (RxBadSymbol | RxRunt | RxTooLong | RxCRCErr | - RxBadAlign)) { - u8 tmp8; - int tmp_work = 1000; - - DPRINTK ("%s: Ethernet frame had errors," - " status %8.8x.\n", dev->name, - rx_status); - if (rx_status & RxTooLong) { - DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", - dev->name, rx_status); - /* A.C.: The chip hangs here. */ - } - tp->stats.rx_errors++; - if (rx_status & (RxBadSymbol | RxBadAlign)) - tp->stats.rx_frame_errors++; - if (rx_status & (RxRunt | RxTooLong)) - tp->stats.rx_length_errors++; - if (rx_status & RxCRCErr) - tp->stats.rx_crc_errors++; - /* Reset the receiver, based on RealTek recommendation. (Bug?) */ - tp->cur_rx = 0; - - /* disable receive */ - tmp8 = RTL_R8 (ChipCmd) & ChipCmdClear; - RTL_W8_F (ChipCmd, tmp8 | CmdTxEnb); - - /* A.C.: Reset the multicast list. */ - rtl8139_set_rx_mode (dev); - - /* XXX potentially temporary hack to - * restart hung receiver */ - while (--tmp_work > 0) { - tmp8 = RTL_R8 (ChipCmd); - if ((tmp8 & CmdRxEnb) && (tmp8 & CmdTxEnb)) - break; - RTL_W8_F (ChipCmd, (tmp8 & ChipCmdClear) | CmdRxEnb | CmdTxEnb); - } + (RxBadSymbol | RxRunt | RxTooLong | RxCRCErr | RxBadAlign)) { + rtl8139_rx_err (rx_status, dev, tp, ioaddr); + return; + } - /* G.S.: Re-enable receiver */ - /* XXX temporary hack to work around receiver hang */ - rtl8139_set_rx_mode (dev); + /* Malloc up new buffer, compatible with net-2e. */ + /* Omit the four octet CRC from the length. */ - if (tmp_work <= 0) - printk (KERN_WARNING PFX "tx/rx enable wait too long\n"); - } else { - /* Malloc up new buffer, compatible with net-2e. */ - /* Omit the four octet CRC from the length. */ - struct sk_buff *skb; - int pkt_size = rx_size - 4; - - skb = dev_alloc_skb (pkt_size + 2); - if (skb == NULL) { - printk (KERN_WARNING - "%s: Memory squeeze, dropping packet.\n", - dev->name); - /* We should check that some rx space is free. - If not, free one and mark stats->rx_dropped++. */ - tp->stats.rx_dropped++; - break; - } - skb->dev = dev; - skb_reserve (skb, 2); /* 16 byte align the IP fields. */ + /* TODO: consider allocating skb's outside of + * interrupt context, both to speed interrupt processing, + * and also to reduce the chances of having to + * drop packets here under memory pressure. + */ - if (ring_offset + rx_size + 4 > RX_BUF_LEN) { - int semi_count = - RX_BUF_LEN - ring_offset - 4; - /* This could presumably use two calls to copy_and_sum()? */ - memcpy (skb_put (skb, semi_count), - &rx_ring[ring_offset + 4], - semi_count); - memcpy (skb_put (skb, pkt_size - semi_count), - rx_ring, pkt_size - semi_count); -#ifdef RTL8139_DEBUG - { - int i; - printk (KERN_DEBUG "%s: Frame wrap @%d", - dev->name, semi_count); - for (i = 0; i < 16; i++) - printk (" %2.2x", rx_ring[i]); - printk ("\n"); - memset (rx_ring, 0xcc, 16); - } -#endif /* RTL8139_DEBUG */ - - } else { - eth_copy_and_sum (skb, - &rx_ring[ring_offset + 4], - pkt_size, 0); - skb_put (skb, pkt_size); - } - skb->protocol = eth_type_trans (skb, dev); - netif_rx (skb); - tp->stats.rx_bytes += pkt_size; - tp->stats.rx_packets++; + skb = dev_alloc_skb (pkt_size + 2); + if (skb == NULL) { + printk (KERN_WARNING + "%s: Memory squeeze, dropping packet.\n", + dev->name); + tp->stats.rx_dropped++; + break; } + skb->dev = dev; + skb_reserve (skb, 2); /* 16 byte align the IP fields. */ + + eth_copy_and_sum (skb, &rx_ring[ring_offset + 4], pkt_size, 0); + skb_put (skb, pkt_size); + + skb->protocol = eth_type_trans (skb, dev); + netif_rx (skb); + tp->stats.rx_bytes += pkt_size; + tp->stats.rx_packets++; cur_rx = (cur_rx + rx_size + 4 + 3) & ~3; RTL_W16_F (RxBufPtr, cur_rx - 16); } + DPRINTK ("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x," - " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, - RTL_R16 (RxBufAddr), - RTL_R16 (RxBufPtr), - RTL_R8 (ChipCmd)); + " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx, + RTL_R16 (RxBufAddr), + RTL_R16 (RxBufPtr), RTL_R8 (ChipCmd)); + tp->cur_rx = cur_rx; } -static int rtl8139_weird_interrupt (struct net_device *dev, - struct rtl8139_private *tp, - void *ioaddr, - int status, int link_changed) -{ - DPRINTK ("%s: Abnormal interrupt, status %8.8x.\n", - dev->name, status); - +static void rtl8139_weird_interrupt (struct net_device *dev, + struct rtl8139_private *tp, + void *ioaddr, + int status, int link_changed) +{ + printk (KERN_DEBUG "%s: Abnormal interrupt, status %8.8x.\n", + dev->name, status); + assert (dev != NULL); assert (tp != NULL); assert (ioaddr != NULL); - + /* Update the error count. */ tp->stats.rx_missed_errors += RTL_R32 (RxMissed); RTL_W32 (RxMissed, 0); @@ -1768,8 +1832,6 @@ printk (KERN_ERR "%s: PCI Bus error %4.4x.\n", dev->name, pci_cmd_status); } - - return 0; } @@ -1785,14 +1847,14 @@ int status = 0, link_changed = 0; /* avoid bogus "uninit" warning */ spin_lock (&tp->lock); - + do { status = RTL_R16 (IntrStatus); /* h/w no longer present (hotplug?) or major error, bail */ if (status == 0xFFFF) break; - + /* Acknowledge all of the current interrupt sources ASAP, but an first get an additional status bit from CSCR. */ if (status & RxUnderrun) @@ -1854,7 +1916,7 @@ } spin_unlock (&tp->lock); - + DPRINTK ("%s: exiting interrupt, intr_status=%#4.4x.\n", dev->name, RTL_R16 (IntrStatus)); } @@ -1875,7 +1937,7 @@ dev->name, RTL_R16 (IntrStatus)); del_timer_sync (&tp->timer); - + spin_lock_irqsave (&tp->lock, flags); /* Disable interrupts by clearing the interrupt mask. */ @@ -1889,7 +1951,7 @@ RTL_W32 (RxMissed, 0); spin_unlock_irqrestore (&tp->lock, flags); - + /* snooze for a small bit */ if (current->need_resched) schedule (); @@ -2053,7 +2115,7 @@ set_bit (ether_crc (ETH_ALEN, mclist->dmi_addr) >> 26, mc_filter); } - + /* if called from irq handler, lock already acquired */ if (!in_irq ()) spin_lock_irq (&tp->lock); @@ -2074,13 +2136,13 @@ static void rtl8139_suspend (struct pci_dev *pdev) { - struct net_device *dev = PCI_GET_DRIVER_DATA (pdev); + struct net_device *dev = pdev->driver_data; struct rtl8139_private *tp = (struct rtl8139_private *) dev->priv; void *ioaddr = tp->mmio_addr; unsigned long flags; netif_device_detach (dev); - + spin_lock_irqsave (&tp->lock, flags); /* Disable interrupts, stop Tx and Rx. */ @@ -2097,7 +2159,7 @@ static void rtl8139_resume (struct pci_dev *pdev) { - struct net_device *dev = PCI_GET_DRIVER_DATA (pdev); + struct net_device *dev = pdev->driver_data; netif_device_attach (dev); rtl8139_hw_start (dev); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/8390.h linux/drivers/net/8390.h --- v2.4.0-test8/linux/drivers/net/8390.h Fri Sep 8 12:53:27 2000 +++ linux/drivers/net/8390.h Mon Sep 18 15:39:06 2000 @@ -53,11 +53,11 @@ #if defined(LOAD_8390_BY_KMOD) && defined(MODULE) && !defined(NS8390_CORE) /* Function pointers to be mapped onto the 8390 core support */ -static int (*S_ethdev_init)(struct net_device *dev) = NULL; -static void (*S_NS8390_init)(struct net_device *dev, int startp) = NULL; -static int (*S_ei_open)(struct net_device *dev) = NULL; -static int (*S_ei_close)(struct net_device *dev) = NULL; -static void (*S_ei_interrupt)(int irq, void *dev_id, struct pt_regs *regs) = NULL; +static int (*S_ethdev_init)(struct net_device *dev); +static void (*S_NS8390_init)(struct net_device *dev, int startp); +static int (*S_ei_open)(struct net_device *dev); +static int (*S_ei_close)(struct net_device *dev); +static void (*S_ei_interrupt)(int irq, void *dev_id, struct pt_regs *regs); extern __inline__ void unload_8390_module(void) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/Makefile linux/drivers/net/Makefile --- v2.4.0-test8/linux/drivers/net/Makefile Wed Aug 23 09:30:13 2000 +++ linux/drivers/net/Makefile Sun Sep 17 09:45:05 2000 @@ -304,7 +304,7 @@ MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) ifneq ($(ARCH),s390) -O_OBJS += auto_irq.o +OX_OBJS += auto_irq.o endif include $(TOPDIR)/Rules.make diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/acenic.c linux/drivers/net/acenic.c --- v2.4.0-test8/linux/drivers/net/acenic.c Fri Jul 28 12:47:19 2000 +++ linux/drivers/net/acenic.c Mon Sep 18 15:16:48 2000 @@ -29,7 +29,16 @@ * infrastructure and Sparc support * Pierrick Pinasseau (CERN): For lending me an Ultra 5 to test the * driver under Linux/Sparc64 - * Matt Domsch : Detect 1000baseT cards + * Matt Domsch : Detect Alteon 1000baseT cards + * Chip Salzenberg : Fix race condition between tx + * handler and close() cleanup. + * Ken Aaker : Correct check for whether + * memory mapped IO is enabled to + * make the driver work on RS/6000. + * Takayoshi Kouchi : Identifying problem + * where the driver would disable + * bus master mode if it had to disable + * write and invalidate. */ #include @@ -83,8 +92,13 @@ #define PCI_VENDOR_ID_NETGEAR 0x1385 #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a #endif +#ifndef PCI_DEVICE_ID_NETGEAR_GA620T +#define PCI_DEVICE_ID_NETGEAR_GA620T 0x630a +#endif + /* - * They used the DEC vendor ID by mistake + * Farallon used the DEC vendor ID by mistake and they seem not + * to care - stinky! */ #ifndef PCI_DEVICE_ID_FARALLON_PN9000SX #define PCI_DEVICE_ID_FARALLON_PN9000SX 0x1a @@ -389,7 +403,7 @@ static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1}; static const char __initdata *version = - "acenic.c: v0.44 05/11/2000 Jes Sorensen, linux-acenic@SunSITE.auc.dk\n" + "acenic.c: v0.47 09/18/2000 Jes Sorensen, linux-acenic@SunSITE.auc.dk\n" " http://home.cern.ch/~jes/gige/acenic.html\n"; static struct net_device *root_dev = NULL; @@ -429,7 +443,8 @@ !((pdev->vendor == PCI_VENDOR_ID_3COM) && (pdev->device == PCI_DEVICE_ID_3COM_3C985)) && !((pdev->vendor == PCI_VENDOR_ID_NETGEAR) && - (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620)) && + ((pdev->device == PCI_DEVICE_ID_NETGEAR_GA620) || + (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620T))) && /* * Farallon used the DEC vendor ID on their cards by * mistake for a while @@ -477,10 +492,17 @@ printk(version); } + /* + * Enable master mode before we start playing with the + * pci_command word since pci_set_master() will modify + * it. + */ + pci_set_master(pdev); + pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); /* OpenFirmware on Mac's does not set this - DOH.. */ - if (!ap->pci_command & PCI_COMMAND_MEMORY) { + if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { printk(KERN_INFO "%s: Enabling PCI Memory Mapped " "access - was not enabled by BIOS/Firmware\n", dev->name); @@ -498,8 +520,6 @@ ap->pci_latency); } - pci_set_master(pdev); - /* * Remap the regs into kernel space - this is abuse of * dev->base_addr since it was means for I/O port @@ -606,9 +626,9 @@ MODULE_PARM(max_tx_desc, "1-" __MODULE_STRING(8) "i"); MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i"); MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i"); - #endif + void __exit ace_module_cleanup(void) { struct ace_private *ap; @@ -713,6 +733,7 @@ } +#ifdef MODULE #if (LINUX_VERSION_CODE < 0x02032a) int init_module(void) { @@ -728,6 +749,7 @@ module_init(ace_module_init); module_exit(ace_module_cleanup); #endif +#endif static void ace_free_descriptors(struct net_device *dev) @@ -1994,18 +2016,34 @@ if (txcsm != idx) { do { struct sk_buff *skb; - dma_addr_t mapping; skb = ap->skb->tx_skbuff[idx].skb; - mapping = ap->skb->tx_skbuff[idx].mapping; + /* + * Race condition between the code cleaning + * the tx queue in the interrupt handler and the + * interface close, + * + * This is a kludge that really should be fixed + * by preventing the driver from generating a tx + * interrupt when the packet has already been + * removed from the tx queue. + * + * Nailed by Don Dugger and Chip Salzenberg of + * VA Linux. + */ + if (skb) { + dma_addr_t mapping; - ap->stats.tx_packets++; - ap->stats.tx_bytes += skb->len; - pci_unmap_single(ap->pdev, mapping, skb->len, - PCI_DMA_TODEVICE); - dev_kfree_skb_irq(skb); + mapping = ap->skb->tx_skbuff[idx].mapping; - ap->skb->tx_skbuff[idx].skb = NULL; + ap->stats.tx_packets++; + ap->stats.tx_bytes += skb->len; + pci_unmap_single(ap->pdev, mapping, skb->len, + PCI_DMA_TODEVICE); + dev_kfree_skb_irq(skb); + + ap->skb->tx_skbuff[idx].skb = NULL; + } /* * Question here is whether one should not skip @@ -2966,6 +3004,6 @@ /* * Local variables: - * compile-command: "gcc -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c" + * compile-command: "gcc -D__SMP__ -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c" * End: */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/acenic.h linux/drivers/net/acenic.h --- v2.4.0-test8/linux/drivers/net/acenic.h Fri May 12 11:38:35 2000 +++ linux/drivers/net/acenic.h Mon Sep 18 15:16:48 2000 @@ -609,7 +609,7 @@ struct timer_list timer; unsigned long std_refill_busy - __attribute__ ((aligned (L1_CACHE_BYTES))); + __attribute__ ((aligned (SMP_CACHE_BYTES))); unsigned long mini_refill_busy, jumbo_refill_busy; atomic_t cur_rx_bufs, cur_mini_bufs, @@ -642,7 +642,7 @@ char name[48]; #ifdef INDEX_DEBUG spinlock_t debug_lock - __attribute__ ((aligned (L1_CACHE_BYTES)));; + __attribute__ ((aligned (SMP_CACHE_BYTES)));; u32 last_tx, last_std_rx, last_mini_rx; #endif struct net_device_stats stats; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/acenic_firmware.h linux/drivers/net/acenic_firmware.h --- v2.4.0-test8/linux/drivers/net/acenic_firmware.h Thu Jul 6 19:27:48 2000 +++ linux/drivers/net/acenic_firmware.h Mon Sep 18 15:16:48 2000 @@ -17,6 +17,9 @@ #define tigonFwSbssLen 0x38 #define tigonFwBssAddr 0x00015dd0 #define tigonFwBssLen 0x2080 +u32 tigonFwText[]; +u32 tigonFwData[]; +u32 tigonFwRodata[]; #ifndef CONFIG_ACENIC_OMIT_TIGON_I /* Generated by genfw.c */ u32 tigonFwText[(MAX_TEXT_LEN/4) + 1] __initdata = { @@ -4592,10 +4595,6 @@ 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x30001, 0x1, 0x30201, 0x0, 0x0, 0x0 }; -#else -#define tigonFwText NULL -#define tigonFwData NULL -#define tigonFwRodata NULL #endif /* Generated by genfw.c */ #define tigon2FwReleaseMajor 0xc diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/am79c961a.c linux/drivers/net/am79c961a.c --- v2.4.0-test8/linux/drivers/net/am79c961a.c Tue Jul 11 11:12:23 2000 +++ linux/drivers/net/am79c961a.c Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * linux/drivers/net/am79c961.c + * linux/drivers/net/am79c961.c * - * Derived from various things including skeleton.c + * by Russell King 1995-2000. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Russell King 1995-2000. + * Derived from various things including skeleton.c * * This is a special driver for the am79c961A Lance chip used in the * Intel (formally Digital Equipment Corp) EBSA110 platform. @@ -204,9 +208,12 @@ u_int hdr_addr, first_free_addr; int i; - save_flags_cli (flags); + /* + * Stop the chip. + */ + spin_lock_irqsave(priv->chip_lock, flags); write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP); - restore_flags (flags); + spin_unlock_irqrestore(priv->chip_lock, flags); write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */ write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */ @@ -301,16 +308,15 @@ static int am79c961_close(struct net_device *dev) { + struct dev_priv *priv = (struct dev_priv *)dev->priv; unsigned long flags; netif_stop_queue(dev); - save_flags_cli (flags); - + spin_lock_irqsave(priv->chip_lock, flags); write_rreg (dev->base_addr, CSR0, CSR0_STOP); write_rreg (dev->base_addr, CSR3, CSR3_MASKALL); - - restore_flags (flags); + spin_unlock_irqrestore(priv->chip_lock, flags); free_irq (dev->irq, dev); @@ -368,6 +374,7 @@ */ static void am79c961_setmulticastlist (struct net_device *dev) { + struct dev_priv *priv = (struct dev_priv *)dev->priv; unsigned long flags; unsigned short multi_hash[4], mode; int i, stopped; @@ -387,7 +394,7 @@ am79c961_mc_hash(dmi, multi_hash); } - save_flags_cli(flags); + spin_lock_irqsave(priv->chip_lock, flags); stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP; @@ -401,9 +408,9 @@ * Spin waiting for chip to report suspend mode */ while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) { - restore_flags(flags); + spin_unlock_irqrestore(priv->chip_lock, flags); nop(); - save_flags_cli(flags); + spin_lock_irqsave(priv->chip_lock, flags); } } @@ -425,7 +432,7 @@ write_rreg(dev->base_addr, CTRL1, 0); } - restore_flags(flags); + spin_unlock_irqrestore(priv->chip_lock, flags); } static void am79c961_timeout(struct net_device *dev) @@ -464,10 +471,10 @@ am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP); priv->txhead = head; - save_flags_cli (flags); + spin_lock_irqsave(priv->chip_lock, flags); write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA); dev->trans_start = jiffies; - restore_flags (flags); + spin_unlock_irqrestore(priv->chip_lock, flags); /* * If the next packet is owned by the ethernet device, @@ -611,20 +618,22 @@ priv->stats.rx_dropped ++; } +/* + * Initialise the chip. Note that we always expect + * to be entered with interrupts enabled. + */ static int am79c961_hw_init(struct net_device *dev) { - unsigned long flags; - - am79c961_ramtest(dev, 0x66); - am79c961_ramtest(dev, 0x99); - - save_flags_cli (flags); + struct dev_priv *priv = (struct dev_priv *)dev->priv; + spin_lock_irq(priv->chip_lock); write_rreg (dev->base_addr, CSR0, CSR0_STOP); write_rreg (dev->base_addr, CSR3, CSR3_MASKALL); + spin_unlock_irq(priv->chip_lock); - restore_flags (flags); + am79c961_ramtest(dev, 0x66); + am79c961_ramtest(dev, 0x99); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/am79c961a.h linux/drivers/net/am79c961a.h --- v2.4.0-test8/linux/drivers/net/am79c961a.h Tue Jul 11 11:12:23 2000 +++ linux/drivers/net/am79c961a.h Mon Sep 18 15:15:22 2000 @@ -1,5 +1,9 @@ /* * linux/drivers/net/am79c961.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef _LINUX_am79c961a_H @@ -118,6 +122,7 @@ unsigned char rxtail; unsigned long rxhdr; unsigned long txhdr; + spinlock_t chip_lock; }; extern int am79c961_probe (struct net_device *dev); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/arcnet/arcnet.c linux/drivers/net/arcnet/arcnet.c --- v2.4.0-test8/linux/drivers/net/arcnet/arcnet.c Thu Jun 29 11:11:22 2000 +++ linux/drivers/net/arcnet/arcnet.c Sun Sep 17 09:45:05 2000 @@ -155,9 +155,6 @@ #ifdef CONFIG_ARCNET_COM90xx com90xx_probe(NULL); #endif -#ifdef CONFIG_ARCNET_COM20020_PCI - com20020pci_probe_all(); -#endif #endif } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/arcnet/com20020-isa.c linux/drivers/net/arcnet/com20020-isa.c --- v2.4.0-test8/linux/drivers/net/arcnet/com20020-isa.c Sat May 13 07:50:25 2000 +++ linux/drivers/net/arcnet/com20020-isa.c Sun Sep 17 09:45:05 2000 @@ -205,7 +205,7 @@ case 6: /* Timeout */ lp->timeout = ints[6]; case 5: /* CKP value */ - lp->clock = ints[5]; + lp->clockp = ints[5]; case 4: /* Backplane flag */ lp->backplane = ints[4]; case 3: /* Node ID */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/arcnet/com20020-pci.c linux/drivers/net/arcnet/com20020-pci.c --- v2.4.0-test8/linux/drivers/net/arcnet/com20020-pci.c Sat May 13 08:19:21 2000 +++ linux/drivers/net/arcnet/com20020-pci.c Sun Sep 17 09:45:05 2000 @@ -148,7 +148,7 @@ remove: com20020pci_remove }; -int com20020pci_init(void) +static int __init com20020pci_init(void) { BUGLVL(D_NORMAL) printk(VERSION); #ifndef MODULE @@ -157,7 +157,7 @@ return pci_module_init(&com20020pci_driver); } -void com20020pci_cleanup(void) +static void __exit com20020pci_cleanup(void) { pci_unregister_driver(&com20020pci_driver); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/auto_irq.c linux/drivers/net/auto_irq.c --- v2.4.0-test8/linux/drivers/net/auto_irq.c Tue Feb 10 12:56:44 1998 +++ linux/drivers/net/auto_irq.c Sun Sep 17 09:45:05 2000 @@ -32,6 +32,7 @@ "auto_irq.c:v1.11 Donald Becker (becker@cesdis.gsfc.nasa.gov)"; #endif +#include #include #include #include @@ -53,6 +54,10 @@ BUSY_LOOP_UNTIL(delay) return probe_irq_off(irqs); } + +EXPORT_SYMBOL(autoirq_setup); +EXPORT_SYMBOL(autoirq_report); + /* * Local variables: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/cs89x0.c linux/drivers/net/cs89x0.c --- v2.4.0-test8/linux/drivers/net/cs89x0.c Wed Jul 5 11:54:11 2000 +++ linux/drivers/net/cs89x0.c Mon Sep 18 14:57:01 2000 @@ -61,6 +61,11 @@ : MOD_INC/DEC race fix (see : http://www.uwsg.indiana.edu/hypermail/linux/kernel/0003.3/1532.html) + Andrew Morton : andrewm@uow.edu.au / Kernel 2.4.0-test7-pre2 + : Enhanced EEPROM support to cover more devices, + : abstracted IRQ mapping to support CONFIG_ARCH_CLPS7500 arch + : (Jason Gunthorpe ) + */ static char *version = @@ -128,10 +133,26 @@ #include "cs89x0.h" -/* First, a few definitions that the brave might change. */ -/* A zero-terminated list of I/O addresses to be probed. */ +/* First, a few definitions that the brave might change. + A zero-terminated list of I/O addresses to be probed. Some special flags.. + Addr & 1 = Read back the address port, look for signature and reset + the page window before probing + Addr & 3 = Reset the page window and probe + The CLPS eval board has the Cirrus chip at 0x80090300, in ARM IO space, + but it is possible that a Cirrus board could be plugged into the ISA + slots. */ +/* The cs8900 has 4 IRQ pins, software selectable. cs8900_irq_map maps + them to system IRQ numbers. This mapping is card specific and is set to + the configuration of the Cirrus Eval board for this chip. */ +#ifdef CONFIG_ARCH_CLPS7500 +static unsigned int netcard_portlist[] __initdata = + { 0x80090303, 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; +static unsigned int cs8900_irq_map[] = {12,0,0,0}; +#else static unsigned int netcard_portlist[] __initdata = { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; +static unsigned int cs8900_irq_map[] = {10,11,12,5}; +#endif #if DEBUGGING static unsigned int net_debug = DEBUGGING; @@ -343,7 +364,7 @@ dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); if (dev->priv == 0) { - retval = ENOMEM; + retval = -ENOMEM; goto out; } lp = (struct net_local *)dev->priv; @@ -362,18 +383,20 @@ /* if they give us an odd I/O address, then do ONE write to the address port, to get it back to address zero, where we - expect to find the EISA signature word. */ + expect to find the EISA signature word. An IO with a base of 0x3 + will skip the test for the ADD_PORT. */ if (ioaddr & 1) { - ioaddr &= ~1; - if ((inw(ioaddr + ADD_PORT) & ADD_MASK) != ADD_SIG) - return -ENODEV; + if ((ioaddr & 2) != 2) + if ((inw((ioaddr & ~3)+ ADD_PORT) & ADD_MASK) != ADD_SIG) + return -ENODEV; + ioaddr &= ~3; outw(PP_ChipID, ioaddr + ADD_PORT); } - if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) - { - retval = ENODEV; - goto out1; + if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) + { + retval = -ENODEV; + goto out1; } /* Fill in the 'dev' fields. */ @@ -403,15 +426,77 @@ dev->base_addr); reset_chip(dev); - - /* First check to see if an EEPROM is attached*/ + + /* Here we read the current configuration of the chip. If there + is no Extended EEPROM then the idea is to not disturb the chip + configuration, it should have been correctly setup by automatic + EEPROM read on reset. So, if the chip says it read the EEPROM + the driver will always do *something* instead of complain that + adapter_cnf is 0. */ + if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) == + (EEPROM_OK|EEPROM_PRESENT)) { + /* Load the MAC. */ + for (i=0; i < ETH_ALEN/2; i++) { + unsigned int Addr; + Addr = readreg(dev, PP_IA+i*2); + dev->dev_addr[i*2] = Addr & 0xFF; + dev->dev_addr[i*2+1] = Addr >> 8; + } + + /* Load the Adapter Configuration. + Note: Barring any more specific information from some + other source (ie EEPROM+Schematics), we would not know + how to operate a 10Base2 interface on the AUI port. + However, since we do read the status of HCB1 and use + settings that always result in calls to control_dc_dc(dev,0) + a BNC interface should work if the enable pin + (dc/dc converter) is on HCB1. It will be called AUI + however. */ + + lp->adapter_cnf = 0; + i = readreg(dev, PP_LineCTL); + /* Preserve the setting of the HCB1 pin. */ + if ((i & (HCB1 | HCB1_ENBL)) == (HCB1 | HCB1_ENBL)) + lp->adapter_cnf |= A_CNF_DC_DC_POLARITY; + /* Save the sqelch bit */ + if ((i & LOW_RX_SQUELCH) == LOW_RX_SQUELCH) + lp->adapter_cnf |= A_CNF_EXTND_10B_2 | A_CNF_LOW_RX_SQUELCH; + /* Check if the card is in 10Base-t only mode */ + if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == 0) + lp->adapter_cnf |= A_CNF_10B_T | A_CNF_MEDIA_10B_T; + /* Check if the card is in AUI only mode */ + if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUI_ONLY) + lp->adapter_cnf |= A_CNF_AUI | A_CNF_MEDIA_AUI; + /* Check if the card is in Auto mode. */ + if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUTO_AUI_10BASET) + lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T | + A_CNF_MEDIA_AUI | A_CNF_MEDIA_10B_T | A_CNF_MEDIA_AUTO; + + /* IRQ. Other chips already probe, see below. */ + if (lp->chip_type == CS8900) + lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK; + + printk( "[Cirrus EEPROM] "); + } + + printk("\n"); + + /* First check to see if an EEPROM is attached. */ if ((readreg(dev, PP_SelfST) & EEPROM_PRESENT) == 0) - printk(KERN_WARNING "\ncs89x0: No EEPROM, relying on command line....\n"); + printk(KERN_WARNING "cs89x0: No EEPROM, relying on command line....\n"); else if (get_eeprom_data(dev, START_EEPROM_DATA,CHKSUM_LEN,eeprom_buff) < 0) { printk(KERN_WARNING "\ncs89x0: EEPROM read failed, relying on command line.\n"); } else if (get_eeprom_cksum(START_EEPROM_DATA,CHKSUM_LEN,eeprom_buff) < 0) { - printk(KERN_WARNING "\ncs89x0: EEPROM checksum bad, relying on command line\n"); + /* Check if the chip was able to read its own configuration starting + at 0 in the EEPROM*/ + if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) != + (EEPROM_OK|EEPROM_PRESENT)) + printk(KERN_WARNING "cs89x0: Extended EEPROM checksum bad and no Cirrus EEPROM, relying on command line\n"); + } else { + /* This reads an extended EEPROM that is not documented + in the CS8900 datasheet. */ + /* get transmission control word but keep the autonegotiation bits */ if (!lp->auto_neg_cnf) lp->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2]; /* Store adapter configuration */ @@ -464,17 +549,12 @@ } else { i = lp->isa_config & INT_NO_MASK; if (lp->chip_type == CS8900) { - /* the table that follows is dependent upon how you wired up your cs8900 - * in your system. The table is the same as the cs8900 engineering demo - * board. irq_map also depends on the contents of the table. Also see - * write_irq, which is the reverse mapping of the table below. */ - switch(i) { - case 0: i = 10; break; - case 1: i = 11; break; - case 2: i = 12; break; - case 3: i = 5; break; - default: printk("\ncs89x0: bug: isa_config is %d\n", i); - } + /* Translate the IRQ using the IRQ mapping table. */ + if (i > sizeof(cs8900_irq_map)/sizeof(cs8900_irq_map[0])) + printk("\ncs89x0: bug: isa_config is %d\n", i); + else + i = cs8900_irq_map[i]; + lp->irq_map = CS8900_IRQ_MAP; /* fixed IRQ map for CS8900 */ } else { int irq_map_buff[IRQ_MAP_LEN/2]; @@ -490,7 +570,7 @@ dev->irq = i; } - printk(", IRQ %d", dev->irq); + printk(" IRQ %d", dev->irq); #if ALLOW_DMA if (lp->use_dma) @@ -741,7 +821,9 @@ struct net_local *lp = (struct net_local *)dev->priv; unsigned int selfcontrol; int timenow = jiffies; - /* control the DC to DC convertor in the SelfControl register. */ + /* control the DC to DC convertor in the SelfControl register. + Note: This is hooked up to a general purpose pin, might not + always be a DC to DC convertor. */ selfcontrol = HCB1_ENBL; /* Enable the HCB1 bit as an output */ if (((lp->adapter_cnf & A_CNF_DC_DC_POLARITY) != 0) ^ on_not_off) @@ -753,7 +835,6 @@ /* Wait for the DC/DC converter to power up - 500ms */ while (jiffies - timenow < HZ) ; - } #define DETECTED_NONE 0 @@ -916,13 +997,13 @@ int i; if (chip_type == CS8900) { - switch(irq) { - case 10: i = 0; break; - case 11: i = 1; break; - case 12: i = 2; break; - case 5: i = 3; break; - default: i = 3; break; - } + /* Search the mapping table for the corrisponding IRQ pin. */ + for (i = 0; i != sizeof(cs8900_irq_map)/sizeof(cs8900_irq_map[0]); i++) + if (cs8900_irq_map[i] == irq) + break; + /* Not found */ + if (i == sizeof(cs8900_irq_map)/sizeof(cs8900_irq_map[0])) + i = 3; writereg(dev, PP_CS8900_ISAINT, i); } else { writereg(dev, PP_CS8920_ISAINT, irq); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/declance.c linux/drivers/net/declance.c --- v2.4.0-test8/linux/drivers/net/declance.c Sat May 13 08:29:40 2000 +++ linux/drivers/net/declance.c Sun Sep 17 09:41:29 2000 @@ -1030,6 +1030,7 @@ /* Make certain the data structures used by the LANCE are aligned. */ dev->priv = (void *) (((unsigned long) dev->priv + 7) & ~7); lp = (struct lance_private *) dev->priv; + spin_lock_init(&lp->lock); switch (type) { #ifdef CONFIG_TC @@ -1193,9 +1194,9 @@ lp->multicast_timer.function = &lance_set_multicast_retry; #ifdef MODULE - dev->ifindex = dev_new_index(); - lp->next_module = root_lance_dev; - root_lance_dev = lp; + dev->ifindex = dev_new_index(); + lp->next_module = root_lance_dev; + root_lance_dev = lp; #endif return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/eexpress.c linux/drivers/net/eexpress.c --- v2.4.0-test8/linux/drivers/net/eexpress.c Mon Jun 19 13:30:58 2000 +++ linux/drivers/net/eexpress.c Sun Sep 17 09:41:29 2000 @@ -1084,6 +1084,7 @@ return -ENOMEM; memset(dev->priv, 0, sizeof(struct net_local)); + spin_lock_init(&lp->lock); printk("(IRQ %d, %s connector, %d-bit bus", dev->irq, eexp_ifmap[dev->if_port], buswidth?8:16); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/epic100.c linux/drivers/net/epic100.c --- v2.4.0-test8/linux/drivers/net/epic100.c Fri Sep 8 12:34:55 2000 +++ linux/drivers/net/epic100.c Sun Sep 10 13:21:13 2000 @@ -33,9 +33,9 @@ LK1.1.4 (jgarzik): * Merge becker test version 1.09 (5/29/2000) - LK1.1.5 (jgarzik): - * Fix locking - * Limit 83c175 probe to ethernet-class PCI devices + LK1.1.5: + * Fix locking (jgarzik) + * Limit 83c175 probe to ethernet-class PCI devices (rgooch) */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/gmac.c linux/drivers/net/gmac.c --- v2.4.0-test8/linux/drivers/net/gmac.c Wed Aug 9 13:49:29 2000 +++ linux/drivers/net/gmac.c Sun Sep 17 09:48:05 2000 @@ -9,10 +9,15 @@ * Changes: * Arnaldo Carvalho de Melo - 08/06/2000 * - check init_etherdev return in gmac_probe1 + * BenH - 03/09/2000 + * - Add support for new PHYs + * - Add some PowerBook sleep code * */ #include + +#include #include #include #include @@ -29,13 +34,19 @@ #include #include #include +#include +#ifdef CONFIG_PMAC_PBOOK +#include +#include +#include +#endif #include "gmac.h" #define DEBUG_PHY -/* Driver version 1.1, kernel 2.4.x */ -#define GMAC_VERSION "v1.1k4" +/* Driver version 1.2, kernel 2.4.x */ +#define GMAC_VERSION "v1.2k4" static unsigned char dummy_buf[RX_BUF_ALLOC_SIZE + RX_OFFSET + GMAC_BUFFER_ALIGN]; static struct net_device *gmacs = NULL; @@ -48,9 +59,12 @@ static void mii_interrupt(struct gmac *gm); static int mii_lookup_and_reset(struct gmac *gm); static void mii_setup_phy(struct gmac *gm); +static int mii_do_reset_phy(struct gmac *gm, int phy_addr); +static void mii_init_BCM5400(struct gmac *gm); static void gmac_set_power(struct gmac *gm, int power_up); static int gmac_powerup_and_reset(struct net_device *dev); +static void gmac_set_gigabit_mode(struct gmac *gm, int gigabit); static void gmac_set_duplex_mode(struct gmac *gm, int full_duplex); static void gmac_mac_init(struct gmac *gm, unsigned char *mac_addr); static void gmac_init_rings(struct gmac *gm, int from_irq); @@ -71,6 +85,13 @@ extern int pci_device_loc(struct device_node *dev, unsigned char *bus_ptr, unsigned char *devfn_ptr); +#ifdef CONFIG_PMAC_PBOOK +int gmac_sleep_notify(struct pmu_sleep_notifier *self, int when); +static struct pmu_sleep_notifier gmac_sleep_notifier = { + gmac_sleep_notify, SLEEP_LEVEL_NET, +}; +#endif + /* * Read via the mii interface from a PHY register */ @@ -161,6 +182,19 @@ * a timer and control the autoneg. process more closely. Also, we may * want to stop rx and tx side when the link is down. */ + +/* Link modes of the BCM5400 PHY */ +static int phy_BCM5400_link_table[8][3] = { + { 0, 0, 0 }, /* No link */ + { 0, 0, 0 }, /* 10BT Half Duplex */ + { 1, 0, 0 }, /* 10BT Full Duplex */ + { 0, 1, 0 }, /* 100BT Half Duplex */ + { 0, 1, 0 }, /* 100BT Half Duplex */ + { 1, 1, 0 }, /* 100BT Full Duplex*/ + { 1, 0, 1 }, /* 1000BT */ + { 1, 0, 1 }, /* 1000BT */ +}; + static void mii_interrupt(struct gmac *gm) { @@ -175,8 +209,9 @@ /* We read the Auxilliary Status Summary register */ phy_status = mii_read(gm, gm->phy_addr, MII_SR); if ((phy_status ^ gm->phy_status) & (MII_SR_ASSC | MII_SR_LKS)) { - int full_duplex; - int link_100; + int full_duplex = 0; + int link_100 = 0; + int gigabit = 0; #ifdef DEBUG_PHY printk("Link state change, phy_status: 0x%04x\n", phy_status); #endif @@ -188,8 +223,9 @@ else GM_BIC(GM_MAC_CTRL_CONFIG, GM_MAC_CTRL_CONF_SND_PAUSE_EN); - /* Link ? For now we handle only the 5201 PHY */ + /* Link ? Check for speed and duplex */ if ((phy_status & MII_SR_LKS) && (phy_status & MII_SR_ASSC)) { + int restart = 0; if (gm->phy_type == PHY_B5201) { int aux_stat = mii_read(gm, gm->phy_addr, MII_BCM5201_AUXCTLSTATUS); #ifdef DEBUG_PHY @@ -197,19 +233,41 @@ #endif full_duplex = ((aux_stat & MII_BCM5201_AUXCTLSTATUS_DUPLEX) != 0); link_100 = ((aux_stat & MII_BCM5201_AUXCTLSTATUS_SPEED) != 0); - } else { - full_duplex = 1; - link_100 = 1; + } else if (gm->phy_type == PHY_B5400) { + int aux_stat = mii_read(gm, gm->phy_addr, MII_BCM5400_AUXSTATUS); + int link = (aux_stat & MII_BCM5400_AUXSTATUS_LINKMODE_MASK) >> + MII_BCM5400_AUXSTATUS_LINKMODE_SHIFT; +#ifdef DEBUG_PHY + printk(" Link up ! BCM5400 aux_stat: 0x%04x (link mode: %d)\n", + aux_stat, link); +#endif + full_duplex = phy_BCM5400_link_table[link][0]; + link_100 = phy_BCM5400_link_table[link][1]; + gigabit = phy_BCM5400_link_table[link][2]; + } else if (gm->phy_type == PHY_LXT971) { + int stat2 = mii_read(gm, gm->phy_addr, MII_LXT971_STATUS2); +#ifdef DEBUG_PHY + printk(" Link up ! LXT971 stat2: 0x%04x\n", stat2); +#endif + full_duplex = ((stat2 & MII_LXT971_STATUS2_FULLDUPLEX) != 0); + link_100 = ((stat2 & MII_LXT971_STATUS2_SPEED) != 0); } #ifdef DEBUG_PHY printk(" full_duplex: %d, speed: %s\n", full_duplex, - link_100 ? "100" : "10"); + gigabit ? "1000" : (link_100 ? "100" : "10")); #endif + if (gigabit != gm->gigabit) { + gm->gigabit = gigabit; + gmac_set_gigabit_mode(gm, gm->gigabit); + restart = 1; + } if (full_duplex != gm->full_duplex) { gm->full_duplex = full_duplex; gmac_set_duplex_mode(gm, gm->full_duplex); - gmac_start_dma(gm); + restart = 1; } + if (restart) + gmac_start_dma(gm); } else if (!(phy_status & MII_SR_LKS)) { #ifdef DEBUG_PHY printk(" Link down !\n"); @@ -218,19 +276,73 @@ } } -/* - * Lookup for a PHY on the mii interface and reset it - */ +static int +mii_do_reset_phy(struct gmac *gm, int phy_addr) +{ + int mii_control, timeout; + + mii_control = mii_read(gm, phy_addr, MII_CR); + mii_write(gm, phy_addr, MII_CR, mii_control | MII_CR_RST); + mdelay(10); + for (timeout = 100; timeout > 0; --timeout) { + mii_control = mii_read(gm, phy_addr, MII_CR); + if (mii_control == -1) { + printk(KERN_ERR "%s PHY died after reset !\n", + gm->dev->name); + return 1; + } + if ((mii_control & MII_CR_RST) == 0) + break; + mdelay(10); + } + if (mii_control & MII_CR_RST) { + printk(KERN_ERR "%s PHY reset timeout !\n", gm->dev->name); + return 1; + } + mii_write(gm, phy_addr, MII_CR, mii_control & ~MII_CR_ISOL); + return 0; +} + +static void +mii_init_BCM5400(struct gmac *gm) +{ + int data; + + data = mii_read(gm, gm->phy_addr, MII_BCM5400_AUXCONTROL); + data |= MII_BCM5400_AUXCONTROL_PWR10BASET; + mii_write(gm, gm->phy_addr, MII_BCM5400_AUXCONTROL, data); + + data = mii_read(gm, gm->phy_addr, MII_BCM5400_GB_CONTROL); + data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP; + mii_write(gm, gm->phy_addr, MII_BCM5400_GB_CONTROL, data); + + mdelay(10); + mii_do_reset_phy(gm, 0x1f); + + data = mii_read(gm, 0x1f, MII_BCM5201_MULTIPHY); + data |= MII_BCM5201_MULTIPHY_SERIALMODE; + mii_write(gm, 0x1f, MII_BCM5201_MULTIPHY, data); + + data = mii_read(gm, gm->phy_addr, MII_BCM5400_AUXCONTROL); + data &= ~MII_BCM5400_AUXCONTROL_PWR10BASET; + mii_write(gm, gm->phy_addr, MII_BCM5400_AUXCONTROL, data); +} + static int mii_lookup_and_reset(struct gmac *gm) { - int i, timeout; - int mii_status, mii_control; + int i, mii_status, mii_control; - /* Find the PHY */ gm->phy_addr = -1; gm->phy_type = PHY_UNKNOWN; + + /* Hard reset the PHY */ + feature_set_gmac_phy_reset(gm->of_node, KL_GPIO_ETH_PHY_RESET_ASSERT); + mdelay(10); + feature_set_gmac_phy_reset(gm->of_node, KL_GPIO_ETH_PHY_RESET_RELEASE); + mdelay(10); + /* Find the PHY */ for(i=31; i>0; --i) { mii_control = mii_read(gm, i, MII_CR); mii_status = mii_read(gm, i, MII_SR); @@ -243,25 +355,9 @@ return 0; /* Reset it */ - mii_write(gm, gm->phy_addr, MII_CR, mii_control | MII_CR_RST); - mdelay(10); - for (timeout = 100; timeout > 0; --timeout) { - mii_control = mii_read(gm, gm->phy_addr, MII_CR); - if (mii_control == -1) { - printk(KERN_ERR "%s PHY died after reset !\n", - gm->dev->name); - goto fail; - } - if ((mii_control & MII_CR_RST) == 0) - break; - mdelay(10); - } - if (mii_control & MII_CR_RST) { - printk(KERN_ERR "%s PHY reset timeout !\n", gm->dev->name); + if (mii_do_reset_phy(gm, gm->phy_addr)) goto fail; - } - mii_write(gm, gm->phy_addr, MII_CR, mii_control & ~MII_CR_ISOL); - + /* Read the PHY ID */ gm->phy_id = (mii_read(gm, gm->phy_addr, MII_ID0) << 16) | mii_read(gm, gm->phy_addr, MII_ID1); @@ -270,10 +366,15 @@ #endif if ((gm->phy_id & MII_BCM5400_MASK) == MII_BCM5400_ID) { gm->phy_type = PHY_B5400; - printk(KERN_ERR "%s Warning ! Unsupported BCM5400 PHY !\n", + printk(KERN_ERR "%s Found Broadcom BCM5400 PHY (Gigabit)\n", gm->dev->name); + mii_init_BCM5400(gm); } else if ((gm->phy_id & MII_BCM5201_MASK) == MII_BCM5201_ID) { gm->phy_type = PHY_B5201; + printk(KERN_INFO "%s Found Broadcom BCM5201 PHY\n", gm->dev->name); + } else if ((gm->phy_id & MII_LXT971_MASK) == MII_LXT971_ID) { + gm->phy_type = PHY_LXT971; + printk(KERN_INFO "%s Found LevelOne LX971 PHY\n", gm->dev->name); } else { printk(KERN_ERR "%s: Warning ! Unknown PHY ID 0x%08x !\n", gm->dev->name, gm->phy_id); @@ -405,6 +506,22 @@ } } +/* Set the MAC gigabit mode. Side effect: stops Tx MAC */ +static void +gmac_set_gigabit_mode(struct gmac *gm, int gigabit) +{ + /* Stop Tx MAC */ + GM_BIC(GM_MAC_TX_CONFIG, GM_MAC_TX_CONF_ENABLE); + while(GM_IN(GM_MAC_TX_CONFIG) & GM_MAC_TX_CONF_ENABLE) + ; + + if (gigabit) { + GM_BIS(GM_MAC_XIF_CONFIG, GM_MAC_XIF_CONF_GMII_MODE); + } else { + GM_BIC(GM_MAC_XIF_CONFIG, GM_MAC_XIF_CONF_GMII_MODE); + } +} + /* * Initialize a bunch of registers to put the chip into a known * and hopefully happy state @@ -788,6 +905,65 @@ return 0; } +#ifdef CONFIG_PMAC_PBOOK +int +gmac_sleep_notify(struct pmu_sleep_notifier *self, int when) +{ + struct gmac *gm; + int i; + + /* XXX should handle more than one */ + if (gmacs == NULL) + return PBOOK_SLEEP_OK; + + gm = (struct gmac *) gmacs->priv; + if (!gm->opened) + return PBOOK_SLEEP_OK; + + switch (when) { + case PBOOK_SLEEP_REQUEST: + break; + case PBOOK_SLEEP_REJECT: + break; + case PBOOK_SLEEP_NOW: + disable_irq(gm->dev->irq); + netif_stop_queue(gm->dev); + gmac_stop_dma(gm); + mii_poll_stop(gm); + gmac_set_power(gm, 0); + for (i = 0; i < NRX; ++i) { + if (gm->rx_buff[i] != 0) { + dev_kfree_skb(gm->rx_buff[i]); + gm->rx_buff[i] = 0; + } + } + for (i = 0; i < NTX; ++i) { + if (gm->tx_buff[i] != 0) { + dev_kfree_skb(gm->tx_buff[i]); + gm->tx_buff[i] = 0; + } + } + break; + case PBOOK_WAKE: + /* see if this is enough */ + gmac_powerup_and_reset(gm->dev); + gm->full_duplex = 0; + gm->phy_status = 0; + mii_lookup_and_reset(gm); + mii_setup_phy(gm); + gmac_init_rings(gm, 0); + gmac_mac_init(gm, gm->dev->dev_addr); + gmac_set_multicast(gm->dev); + mii_interrupt(gm); + gmac_start_dma(gm); + netif_start_queue(gm->dev); + enable_irq(gm->dev->irq); + break; + } + return PBOOK_SLEEP_OK; +} +#endif /* CONFIG_PMAC_PBOOK */ + /* * Handle a transmit timeout */ @@ -1196,7 +1372,8 @@ ioremap(gmac->addrs[0].address, 0x10000); dev->irq = gmac->intrs[0].line; gm->dev = dev; - + gm->of_node = gmac; + if (pci_device_loc(gmac, &gm->pci_bus, &gm->pci_devfn)) { gm->pci_bus = gm->pci_devfn = 0xff; printk(KERN_ERR "Can't locate GMAC PCI entry\n"); @@ -1229,6 +1406,10 @@ gm->next_gmac = gmacs; gmacs = dev; + +#ifdef CONFIG_PMAC_PBOOK + pmu_register_sleep_notifier(&gmac_sleep_notifier); +#endif } MODULE_AUTHOR("Paul Mackerras/Ben Herrenschmidt"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/gmac.h linux/drivers/net/gmac.h --- v2.4.0-test8/linux/drivers/net/gmac.h Wed Jul 26 15:53:45 2000 +++ linux/drivers/net/gmac.h Sun Sep 17 09:48:05 2000 @@ -730,8 +730,9 @@ */ /* Supported PHYs (phy_type field ) */ -#define PHY_B5400 5400 -#define PHY_B5201 5201 +#define PHY_B5400 0x5400 +#define PHY_B5201 0x5201 +#define PHY_LXT971 0x0971 #define PHY_UNKNOWN 0 /* Identification (for multi-PHY) */ @@ -745,6 +746,11 @@ #define MII_BCM5400_REV 0x01 #define MII_BCM5400_ID ((MII_BCM5400_OUI << 10) | (MII_BCM5400_MODEL << 4)) #define MII_BCM5400_MASK 0xfffffff0 +#define MII_LXT971_OUI 0x0004de +#define MII_LXT971_MODEL 0x0e +#define MII_LXT971_REV 0x00 +#define MII_LXT971_ID ((MII_LXT971_OUI << 10) | (MII_LXT971_MODEL << 4)) +#define MII_LXT971_MASK 0xfffffff0 /* BCM5201 AUX STATUS register */ #define MII_BCM5201_AUXCTLSTATUS 0x18 @@ -764,6 +770,26 @@ #define MII_BCM5201_MULTIPHY_SERIALMODE 0x0002 #define MII_BCM5201_MULTIPHY_SUPERISOLATE 0x0008 +/* MII BCM5400 1000-BASET Control register */ +#define MII_BCM5400_GB_CONTROL 0x09 +#define MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP 0x0200 + +/* MII BCM5400 AUXCONTROL register */ +#define MII_BCM5400_AUXCONTROL 0x18 +#define MII_BCM5400_AUXCONTROL_PWR10BASET 0x0004 + +/* MII BCM5400 AUXSTATUS register */ +#define MII_BCM5400_AUXSTATUS 0x19 +#define MII_BCM5400_AUXSTATUS_LINKMODE_MASK 0x0700 +#define MII_BCM5400_AUXSTATUS_LINKMODE_SHIFT 8 + +/* MII LXT971 STATUS2 register */ +#define MII_LXT971_STATUS2 0x11 +#define MII_LXT971_STATUS2_SPEED 0x4000 +#define MII_LXT971_STATUS2_LINK 0x0400 +#define MII_LXT971_STATUS2_FULLDUPLEX 0x0200 +#define MII_LXT971_STATUS2_AUTONEG_COMPLETE 0x0080 + /* @@ -845,6 +871,7 @@ int phy_type; int phy_status; /* Cached PHY status */ int full_duplex; /* Current set to full duplex */ + int gigabit; /* Current set to 1000BT */ struct net_device_stats stats; u8 pci_bus; u8 pci_devfn; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/hamradio/pi2.c linux/drivers/net/hamradio/pi2.c --- v2.4.0-test8/linux/drivers/net/hamradio/pi2.c Mon Jun 19 13:30:58 2000 +++ linux/drivers/net/hamradio/pi2.c Fri Sep 8 17:56:49 2000 @@ -1182,7 +1182,7 @@ } -int __init pi_init(void) +int __init pi2_init(void) { int *port; int ioaddr = 0; @@ -1658,7 +1658,7 @@ int init_module(void) { - return pi_init(); + return pi2_init(); } void cleanup_module(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/hamradio/pt.c linux/drivers/net/hamradio/pt.c --- v2.4.0-test8/linux/drivers/net/hamradio/pt.c Mon Jun 19 13:30:58 2000 +++ linux/drivers/net/hamradio/pt.c Fri Sep 8 17:56:49 2000 @@ -474,7 +474,7 @@ } /* chipset_init() */ -int __init pt_init(void) +int __init ptwin_init(void) { int *port; int ioaddr = 0; @@ -531,7 +531,7 @@ pt0b.irq = pt0a.irq; /* IRQ is shared */ return 0; -} /* pt_init() */ +} /* ptwin_init() */ /* * Probe for PT card. Also initialises the timers @@ -1758,7 +1758,7 @@ int init_module(void) { - return pt_init(); + return ptwin_init(); } void cleanup_module(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/irda/toshoboe.c linux/drivers/net/irda/toshoboe.c --- v2.4.0-test8/linux/drivers/net/irda/toshoboe.c Tue Mar 21 11:17:28 2000 +++ linux/drivers/net/irda/toshoboe.c Sun Sep 17 09:45:07 2000 @@ -900,7 +900,6 @@ static void toshoboe_wakeup (struct toshoboe_cb *self) { - struct net_device *dev = self->netdev; unsigned long flags; if (!self->stopped) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/lne390.c linux/drivers/net/lne390.c --- v2.4.0-test8/linux/drivers/net/lne390.c Mon Jun 19 13:30:58 2000 +++ linux/drivers/net/lne390.c Sun Sep 17 09:49:42 2000 @@ -26,10 +26,13 @@ You can try if you want more info, as I've never even seen one of these cards. :) + Arnaldo Carvalho de Melo - 2000/09/01 + - get rid of check_region + - no need to check if dev == NULL in lne390_probe1 */ static const char *version = - "lne390.c: Driver revision v0.99, 12/05/98\n"; + "lne390.c: Driver revision v0.99.1, 01/09/2000\n"; #include #include @@ -103,9 +106,16 @@ int __init lne390_probe(struct net_device *dev) { unsigned short ioaddr = dev->base_addr; + int ret; - if (ioaddr > 0x1ff) /* Check a single specified location. */ - return lne390_probe1(dev, ioaddr); + if (ioaddr > 0x1ff) { /* Check a single specified location. */ + if (!request_region(ioaddr, LNE390_IO_EXTENT, "lne390")) + return -EBUSY; + ret = lne390_probe1(dev, ioaddr); + if (ret) + release_region(ioaddr, LNE390_IO_EXTENT); + return ret; + } else if (ioaddr > 0) /* Don't probe at all. */ return -ENXIO; @@ -118,10 +128,11 @@ /* EISA spec allows for up to 16 slots, but 8 is typical. */ for (ioaddr = 0x1000; ioaddr < 0x9000; ioaddr += 0x1000) { - if (check_region(ioaddr , LNE390_IO_EXTENT)) + if (!request_region(ioaddr, LNE390_IO_EXTENT, "lne390")) continue; if (lne390_probe1(dev, ioaddr) == 0) return 0; + release_region(ioaddr, LNE390_IO_EXTENT); } return -ENODEV; @@ -129,7 +140,7 @@ int __init lne390_probe1(struct net_device *dev, int ioaddr) { - int i, revision; + int i, revision, ret; unsigned long eisa_id; if (inb_p(ioaddr + LNE390_ID_PORT) == 0xff) return -ENODEV; @@ -161,13 +172,6 @@ return -ENODEV; } #endif - - /* We should have a "dev" from Space.c or the static module table. */ - if (dev == NULL) { - printk("lne390.c: Passed a NULL device.\n"); - dev = init_etherdev(0, 0); - } - /* Allocate dev->priv and fill in 8390 specific dev fields. */ if (ethdev_init(dev)) { printk ("lne390.c: unable to allocate memory for dev->priv!\n"); @@ -225,20 +229,16 @@ printk(KERN_CRIT "lne390.c: Use EISA SCU to set card memory below 1MB,\n"); printk(KERN_CRIT "lne390.c: or to an address above 0x%lx.\n", virt_to_bus(high_memory)); printk(KERN_CRIT "lne390.c: Driver NOT installed.\n"); - free_irq(dev->irq, dev); - kfree(dev->priv); - dev->priv = NULL; - return -EINVAL; + ret = -EINVAL; + goto cleanup; } dev->mem_start = (unsigned long)ioremap(dev->mem_start, LNE390_STOP_PG*0x100); if (dev->mem_start == 0) { printk(KERN_ERR "lne390.c: Unable to remap card memory above 1MB !!\n"); printk(KERN_ERR "lne390.c: Try using EISA SCU to set memory below 1MB.\n"); printk(KERN_ERR "lne390.c: Driver NOT installed.\n"); - free_irq(dev->irq, dev); - kfree(dev->priv); - dev->priv = NULL; - return -EAGAIN; + ret = -EAGAIN; + goto cleanup; } ei_status.reg0 = 1; /* Use as remap flag */ printk("lne390.c: remapped %dkB card memory to virtual address %#lx\n", @@ -251,7 +251,6 @@ /* The 8390 offset is zero for the LNE390 */ dev->base_addr = ioaddr; - request_region(dev->base_addr, LNE390_IO_EXTENT, "lne390"); ei_status.name = "LNE390"; ei_status.tx_start_page = LNE390_START_PG; @@ -271,6 +270,11 @@ dev->stop = &lne390_close; NS8390_init(dev, 0); return 0; +cleanup: + free_irq(dev->irq, dev); + kfree(dev->priv); + dev->priv = NULL; + return ret; } /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/ne2k-pci.c linux/drivers/net/ne2k-pci.c --- v2.4.0-test8/linux/drivers/net/ne2k-pci.c Mon Jun 19 13:30:58 2000 +++ linux/drivers/net/ne2k-pci.c Mon Sep 18 14:57:01 2000 @@ -286,7 +286,7 @@ /* Set up the rest of the parameters. */ dev->irq = irq; dev->base_addr = ioaddr; - pdev->driver_data = dev; + pci_set_drvdata(pdev, dev); /* Allocate dev->priv and fill in 8390 specific dev fields. */ if (ethdev_init(dev)) { @@ -535,16 +535,17 @@ static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) { - struct net_device *dev = pdev->driver_data; + struct net_device *dev = pci_get_drvdata(pdev); if (!dev) { printk (KERN_ERR "bug! ne2k_pci_remove_one called w/o net_device\n"); return; } - unregister_netdev (dev); - release_region (dev->base_addr, NE_IO_EXTENT); - kfree (dev); + unregister_netdev(dev); + release_region(dev->base_addr, NE_IO_EXTENT); + kfree(dev); + pci_set_drvdata(pdev, NULL); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/net_init.c linux/drivers/net/net_init.c --- v2.4.0-test8/linux/drivers/net/net_init.c Fri Jul 14 14:46:30 2000 +++ linux/drivers/net/net_init.c Sun Sep 17 09:41:29 2000 @@ -198,7 +198,7 @@ return(0); } -#endif +#endif /* CONFIG_FDDI */ #ifdef CONFIG_HIPPI @@ -256,7 +256,7 @@ return 0; } -#endif +#endif /* CONFIG_HIPPI */ void ether_setup(struct net_device *dev) { @@ -314,7 +314,7 @@ return; } -#endif +#endif /* CONFIG_FDDI */ #ifdef CONFIG_HIPPI void hippi_setup(struct net_device *dev) @@ -350,7 +350,7 @@ dev_init_buffers(dev); } -#endif +#endif /* CONFIG_HIPPI */ #if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) @@ -389,7 +389,7 @@ dev_init_buffers(dev); } -#endif +#endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */ int ether_config(struct net_device *dev, struct ifmap *map) { @@ -506,7 +506,7 @@ unregister_netdevice(dev); rtnl_unlock(); } -#endif +#endif /* CONFIG_TR */ #ifdef CONFIG_NET_FC @@ -555,10 +555,3 @@ #endif /* CONFIG_NET_FC */ -/* - * Local variables: - * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c net_init.c" - * version-control: t - * kept-new-versions: 5 - * End: - */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/pcmcia/xircom_tulip_cb.c linux/drivers/net/pcmcia/xircom_tulip_cb.c --- v2.4.0-test8/linux/drivers/net/pcmcia/xircom_tulip_cb.c Mon Aug 21 07:54:43 2000 +++ linux/drivers/net/pcmcia/xircom_tulip_cb.c Sun Sep 17 09:41:29 2000 @@ -3034,10 +3034,7 @@ if (entry == TX_RING_SIZE-1) tx_flags |= DESC_RING_WRAP; /* Wrap ring. */ tp->tx_ring[entry].length = tx_flags; - if(tp->chip_id == X3201_3) - tp->tx_ring[entry].buffer1 = (virt_to_bus(tp->setup_frame) + 4); - else - tp->tx_ring[entry].buffer1 = virt_to_bus(tp->setup_frame); + tp->tx_ring[entry].buffer1 = virt_to_bus(tp->setup_frame); tp->tx_ring[entry].status = DescOwned; if (tp->cur_tx - tp->dirty_tx >= TX_RING_SIZE - 2) { tp->tx_full = 1; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/pppox.c linux/drivers/net/pppox.c --- v2.4.0-test8/linux/drivers/net/pppox.c Fri May 12 11:32:08 2000 +++ linux/drivers/net/pppox.c Sun Sep 17 09:41:29 2000 @@ -141,6 +141,8 @@ pppox_create }; +extern int pppoe_init (void); + #ifdef MODULE int init_module(void) #else @@ -154,9 +156,7 @@ if (err == 0) printk(KERN_INFO "Registered PPPoX v0.5\n"); -#ifdef CONFIG_PPPOE pppoe_init(); -#endif return err; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/rtl8129.c linux/drivers/net/rtl8129.c --- v2.4.0-test8/linux/drivers/net/rtl8129.c Tue Jul 11 11:12:24 2000 +++ linux/drivers/net/rtl8129.c Sun Sep 17 09:41:29 2000 @@ -406,6 +406,8 @@ printk(KERN_INFO "%s", version); dev = init_etherdev(NULL, 0); + if (dev == NULL) + goto out; printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", dev->name, pci_tbl[chip_idx].name, ioaddr, irq); @@ -427,13 +429,17 @@ printk("%2.2x.\n", dev->dev_addr[i]); /* We do a request_region() to register /proc/ioports info. */ - request_region(ioaddr, pci_tbl[chip_idx].io_size, dev->name); + if (!request_region(ioaddr, pci_tbl[chip_idx].io_size, dev->name)) + goto out_free_dev; dev->base_addr = ioaddr; dev->irq = irq; /* Some data structures must be quadword aligned. */ tp = kmalloc(sizeof(*tp), GFP_KERNEL | GFP_DMA); + if (tp == NULL) + goto out_release_region; + memset(tp, 0, sizeof(*tp)); dev->priv = tp; @@ -499,8 +505,15 @@ dev->get_stats = &rtl8129_get_stats; dev->set_multicast_list = &set_rx_mode; dev->do_ioctl = &mii_ioctl; - return dev; + +out_release_region: + release_region(ioaddr, pci_tbl[chip_idx].io_size); +out_free_dev: + unregister_netdev(dev); + kfree(dev); +out: + return NULL; } /* Serial EEPROM section. */ @@ -660,17 +673,18 @@ { struct rtl8129_private *tp = (struct rtl8129_private *)dev->priv; long ioaddr = dev->base_addr; - int i; + int i, retval; + + MOD_INC_USE_COUNT; /* Soft reset the chip. */ outb(CmdReset, ioaddr + ChipCmd); - if (request_irq(dev->irq, &rtl8129_interrupt, SA_SHIRQ, dev->name, dev)) { - return -EAGAIN; + if ((retval = request_irq(dev->irq, &rtl8129_interrupt, SA_SHIRQ, dev->name, dev))) { + MOD_DEC_USE_COUNT; + return retval; } - MOD_INC_USE_COUNT; - tp->tx_bufs = pci_alloc_consistent(tp->pdev, TX_BUF_SIZE * NUM_TX_DESC, &tp->tx_bufs_dma); @@ -690,6 +704,7 @@ if (rtl8129_debug > 0) printk(KERN_ERR "%s: Couldn't allocate a %d byte receive ring.\n", dev->name, RX_BUF_LEN); + MOD_DEC_USE_COUNT; return -ENOMEM; } rtl8129_init_ring(dev); @@ -1226,8 +1241,9 @@ /* Malloc up new buffer, compatible with net-2e. */ /* Omit the four octet CRC from the length. */ struct sk_buff *skb; + int pkt_size = rx_size - 4; - skb = dev_alloc_skb(rx_size + 2); + skb = dev_alloc_skb(pkt_size + 2); if (skb == NULL) { printk(KERN_WARNING"%s: Memory squeeze, deferring packet.\n", dev->name); @@ -1238,12 +1254,12 @@ } skb->dev = dev; skb_reserve(skb, 2); /* 16 byte align the IP fields. */ - if (ring_offset+rx_size+4 > RX_BUF_LEN) { + if (ring_offset+rx_size > RX_BUF_LEN) { int semi_count = RX_BUF_LEN - ring_offset - 4; memcpy(skb_put(skb, semi_count), &rx_ring[ring_offset + 4], semi_count); - memcpy(skb_put(skb, rx_size-semi_count), rx_ring, - rx_size-semi_count); + memcpy(skb_put(skb, pkt_size-semi_count), rx_ring, + pkt_size-semi_count); if (rtl8129_debug > 4) { int i; printk(KERN_DEBUG"%s: Frame wrap @%d", @@ -1256,17 +1272,17 @@ } else { #if 1 /* USE_IP_COPYSUM */ eth_copy_and_sum(skb, &rx_ring[ring_offset + 4], - rx_size, 0); - skb_put(skb, rx_size); + pkt_size, 0); + skb_put(skb, pkt_size); #else - memcpy(skb_put(skb, rx_size), &rx_ring[ring_offset + 4], - rx_size); + memcpy(skb_put(skb, pkt_size), &rx_ring[ring_offset + 4], + pkt_size); #endif } skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); #if LINUX_VERSION_CODE > 0x20119 - tp->stats.rx_bytes += rx_size; + tp->stats.rx_bytes += pkt_size; #endif tp->stats.rx_packets++; } @@ -1292,6 +1308,8 @@ netif_stop_queue(dev); + del_timer_sync(&tp->timer); + if (rtl8129_debug > 1) printk(KERN_DEBUG"%s: Shutting down ethercard, status was 0x%4.4x.\n", dev->name, inw(ioaddr + IntrStatus)); @@ -1305,8 +1323,6 @@ /* Update the error counts. */ tp->stats.rx_missed_errors += inl(ioaddr + RxMissed); outl(0, ioaddr + RxMissed); - - del_timer(&tp->timer); free_irq(dev->irq, dev); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/setup.c linux/drivers/net/setup.c --- v2.4.0-test8/linux/drivers/net/setup.c Tue May 23 08:21:51 2000 +++ linux/drivers/net/setup.c Sun Sep 17 09:48:04 2000 @@ -22,6 +22,7 @@ extern int awc4500_365_probe(void); extern int arcnet_init(void); extern int scc_enet_init(void); +extern int fec_enet_init(void); extern int dlci_setup(void); extern int lapbeth_init(void); extern int sdla_setup(void); @@ -74,6 +75,9 @@ #endif #if defined(CONFIG_SCC_ENET) {scc_enet_init, 0}, +#endif +#if defined(CONFIG_FEC_ENET) + {fec_enet_init, 0}, #endif #if defined(CONFIG_COMX) {comx_init, 0}, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/lm80.h linux/drivers/net/sk98lin/h/lm80.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/lm80.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/lm80.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: lm80.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.2 $ - * Date: $Date: 1999/03/12 13:26:51 $ + * Version: $Revision: 1.3 $ + * Date: $Date: 1999/11/22 13:41:19 $ * Purpose: Contains all defines for the LM80 Chip * (National Semiconductor). * @@ -27,6 +27,9 @@ * * History: * $Log: lm80.h,v $ + * Revision 1.3 1999/11/22 13:41:19 cgoos + * Changed license header to GPL. + * * Revision 1.2 1999/03/12 13:26:51 malthoff * remove __STDC__. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skaddr.h linux/drivers/net/sk98lin/h/skaddr.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skaddr.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skaddr.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skaddr.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.19 $ - * Date: $Date: 1999/05/28 10:56:07 $ - * Purpose: Header file for Address Management (MC, UC, Prom) + * Version: $Revision: 1.23 $ + * Date: $Date: 2000/08/10 11:27:50 $ + * Purpose: Header file for Address Management (MC, UC, Prom). * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,21 @@ * History: * * $Log: skaddr.h,v $ + * Revision 1.23 2000/08/10 11:27:50 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * + * Revision 1.22 2000/08/07 11:10:40 rassmann + * Editorial changes. + * + * Revision 1.21 2000/05/04 09:39:59 rassmann + * Editorial changes. + * Corrected multicast address hashing. + * + * Revision 1.20 1999/11/22 13:46:14 cgoos + * Changed license header to GPL. + * Allowing overwrite for SK_ADDR_EQUAL. + * * Revision 1.19 1999/05/28 10:56:07 rassmann * Editorial changes. * @@ -115,32 +130,33 @@ #define __INC_SKADDR_H #ifdef __cplusplus -xxxx /* not supported yet - force error */ +#error C++ is not yet supported. extern "C" { #endif /* cplusplus */ /* defines ********************************************************************/ -#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */ -#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */ +#define SK_MAC_ADDR_LEN 6 /* Length of MAC address. */ +#define SK_MAX_ADDRS 14 /* #Addrs for exact match. */ /* ----- Common return values ----- */ -#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */ -#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */ -#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */ +#define SK_ADDR_SUCCESS 0 /* Function returned successfully. */ +#define SK_ADDR_ILLEGAL_PORT 100 /* Port number too high. */ +#define SK_ADDR_TOO_EARLY 101 /* Function called too early. */ /* ----- Clear/Add flag bits ----- */ -#define SK_ADDR_PERMANENT 1 /* RLMT Address */ +#define SK_ADDR_PERMANENT 1 /* RLMT Address */ /* ----- Additional Clear flag bits ----- */ -#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */ +#define SK_MC_SW_ONLY 2 /* Do not update HW when clearing. */ /* ----- Override flag bits ----- */ -#define SK_ADDR_VIRTUAL_ADDRESS 0 +#define SK_ADDR_LOGICAL_ADDRESS 0 +#define SK_ADDR_VIRTUAL_ADDRESS (SK_ADDR_LOGICAL_ADDRESS) /* old */ #define SK_ADDR_PHYSICAL_ADDRESS 1 /* ----- Override return values ----- */ @@ -151,7 +167,7 @@ /* ----- Partitioning of excact match table ----- */ -#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */ +#define SK_ADDR_EXACT_MATCHES 16 /* #Exact match entries. */ #define SK_ADDR_FIRST_MATCH_RLMT 1 #define SK_ADDR_LAST_MATCH_RLMT 2 @@ -160,21 +176,21 @@ /* ----- SkAddrMcAdd/SkAddrMcUpdate return values ----- */ -#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */ -#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */ +#define SK_MC_FILTERING_EXACT 0 /* Exact filtering. */ +#define SK_MC_FILTERING_INEXACT 1 /* Inexact filtering. */ /* ----- Additional SkAddrMcAdd return values ----- */ -#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */ -#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */ -#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */ +#define SK_MC_ILLEGAL_ADDRESS 2 /* Illegal address. */ +#define SK_MC_ILLEGAL_PORT 3 /* Illegal port (not the active one). */ +#define SK_MC_RLMT_OVERFLOW 4 /* Too many RLMT mc addresses. */ /* Promiscuous mode bits ----- */ -#define SK_PROM_MODE_NONE 0 /* Normal receive. */ -#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */ -#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */ -/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */ +#define SK_PROM_MODE_NONE 0 /* Normal receive. */ +#define SK_PROM_MODE_LLC 1 /* Receive all LLC frames. */ +#define SK_PROM_MODE_ALL_MC 2 /* Receive all multicast frames. */ +/* #define SK_PROM_MODE_NON_LLC 4 */ /* Receive all non-LLC frames. */ /* Macros */ @@ -192,7 +208,7 @@ *(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2]) && \ *(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0])) #endif /* SK_ADDR_DWORD_COMPARE */ -#endif /* SK_ADDR_EQUAL */ +#endif /* SK_ADDR_EQUAL */ /* typedefs *******************************************************************/ @@ -203,27 +219,28 @@ /* SK_FILTER is used to ensure alignment of the filter. */ typedef union s_InexactFilter { SK_U8 Bytes[8]; - SK_U64 Val; /* Dummy entry for alignment only. */ + SK_U64 Val; /* Dummy entry for alignment only. */ } SK_FILTER64; typedef struct s_AddrPort { /* ----- Public part (read-only) ----- */ - SK_MAC_ADDR PermanentMacAddress; /* Physical MAC Address. */ - SK_MAC_ADDR CurrentMacAddress; /* Physical MAC Address. */ - int PromMode; /* Promiscuous Mode. */ + SK_MAC_ADDR CurrentMacAddress; /* Current physical MAC Address. */ + SK_MAC_ADDR PermanentMacAddress; /* Permanent physical MAC Address. */ + int PromMode; /* Promiscuous Mode. */ /* ----- Private part ----- */ + SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */ SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ - SK_MAC_ADDR PreviousMacAddress; /* Prev. phys. MAC Address. */ + SK_U8 Align01; SK_U32 FirstExactMatchRlmt; SK_U32 NextExactMatchRlmt; SK_U32 FirstExactMatchDrv; SK_U32 NextExactMatchDrv; SK_MAC_ADDR Exact[SK_ADDR_EXACT_MATCHES]; - SK_FILTER64 InexactFilter; /* For 64-bit hash register. */ + SK_FILTER64 InexactFilter; /* For 64-bit hash register. */ } SK_ADDR_PORT; typedef struct s_Addr { @@ -232,22 +249,21 @@ SK_ADDR_PORT Port[SK_MAX_MACS]; SK_MAC_ADDR PermanentMacAddress; /* Logical MAC Address. */ - SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */ + SK_MAC_ADDR CurrentMacAddress; /* Logical MAC Address. */ /* ----- Private part ----- */ -#if 0 - SK_BOOL Initialized; /* Flag: Addr module is initialized. */ -#endif /* 0 */ + SK_U32 ActivePort; /* View of module ADDR. */ SK_BOOL CurrentMacAddressSet; /* CurrentMacAddress is set. */ - SK_U32 ActivePort; /* Vie of module ADDR. */ + SK_U8 Align01; + SK_U16 Align02; } SK_ADDR; /* function prototypes ********************************************************/ #ifndef SK_KR_PROTO -/* Functions provided by SkRlmt */ +/* Functions provided by SkAddr */ /* ANSI/C++ compliant function prototypes */ @@ -297,7 +313,7 @@ /* Non-ANSI/C++ compliant function prototypes */ -xxxx /* not supported yet - force error */ +#error KR-style prototypes are not yet provided. #endif /* defined(SK_KR_PROTO)) */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skcsum.h linux/drivers/net/sk98lin/h/skcsum.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skcsum.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skcsum.h Fri Sep 15 14:34:19 2000 @@ -1,9 +1,9 @@ /****************************************************************************** * * Name: skcsum.h - * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.2 $ - * Date: $Date: 1998/09/04 12:16:34 $ + * Project: GEnesis - SysKonnect SK-NET Gigabit Ethernet (SK-98xx) + * Version: $Revision: 1.7 $ + * Date: $Date: 2000/06/29 13:17:05 $ * Purpose: Store/verify Internet checksum in send/receive packets. * ******************************************************************************/ @@ -27,6 +27,25 @@ * History: * * $Log: skcsum.h,v $ + * Revision 1.7 2000/06/29 13:17:05 rassmann + * Corrected reception of a packet with UDP checksum == 0 (which means there + * is no UDP checksum). + * + * Revision 1.6 2000/02/28 12:33:44 cgoos + * Changed C++ style comments to C style. + * + * Revision 1.5 2000/02/21 12:10:05 cgoos + * Fixed license comment. + * + * Revision 1.4 2000/02/21 11:08:37 cgoos + * Merged changes back into common source. + * + * Revision 1.1 1999/07/26 14:47:49 mkarl + * changed from common source to windows specific source + * added return SKCS_STATUS_IP_CSUM_ERROR_UDP and + * SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester + * changes for Tx csum offload + * * Revision 1.2 1998/09/04 12:16:34 mhaveman * Checked in for Stephan to allow compilation. * -Added definition SK_CSUM_EVENT_CLEAR_PROTO_STATS to clear statistic @@ -98,24 +117,32 @@ * * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame. + * SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + * SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum. */ #ifndef SKCS_OVERWRITE_STATUS /* User overwrite? */ #define SKCS_STATUS int /* Define status type. */ #define SKCS_STATUS_UNKNOWN_IP_VERSION 1 -#define SKCS_STATUS_IP_CSUM_ERROR 2 -#define SKCS_STATUS_IP_FRAGMENT 3 -#define SKCS_STATUS_IP_CSUM_OK 4 -#define SKCS_STATUS_TCP_CSUM_ERROR 5 -#define SKCS_STATUS_UDP_CSUM_ERROR 6 -#define SKCS_STATUS_TCP_CSUM_OK 7 -#define SKCS_STATUS_UDP_CSUM_OK 8 +#define SKCS_STATUS_IP_CSUM_ERROR 2 +#define SKCS_STATUS_IP_FRAGMENT 3 +#define SKCS_STATUS_IP_CSUM_OK 4 +#define SKCS_STATUS_TCP_CSUM_ERROR 5 +#define SKCS_STATUS_UDP_CSUM_ERROR 6 +#define SKCS_STATUS_TCP_CSUM_OK 7 +#define SKCS_STATUS_UDP_CSUM_OK 8 +/* needed for Microsoft */ +#define SKCS_STATUS_IP_CSUM_ERROR_UDP 9 +#define SKCS_STATUS_IP_CSUM_ERROR_TCP 10 +/* UDP checksum may be omitted */ +#define SKCS_STATUS_IP_CSUM_OK_NO_UDP 11 #endif /* !SKCS_OVERWRITE_STATUS */ /* Clear protocol statistics event. */ @@ -158,7 +185,7 @@ SK_U64 RxUnableCts; /* Unable to verify receive checksum. */ SK_U64 RxErrCts; /* Receive checksum error. */ SK_U64 TxOkCts; /* Transmit checksum ok. */ - SK_U64 TxUnableCts; /* Unable to verify transmit checksum. */ + SK_U64 TxUnableCts; /* Unable to calculate checksum in hw. */ } SKCS_PROTO_STATS; /* @@ -167,6 +194,9 @@ typedef struct s_Csum { /* Enabled receive SK_PROTO_XXX bit flags. */ unsigned ReceiveFlags; +#ifdef TX_CSUM + unsigned TransmitFlags; +#endif /* TX_CSUM */ /* The protocol statistics structure; one per supported protocol. */ SKCS_PROTO_STATS ProtoStats[SKCS_NUM_PROTOCOLS]; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skdebug.h linux/drivers/net/sk98lin/h/skdebug.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skdebug.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skdebug.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skdebug.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.9 $ - * Date: $Date: 1999/09/14 14:02:43 $ + * Version: $Revision: 1.10 $ + * Date: $Date: 1999/11/22 13:47:40 $ * Purpose: SK specific DEBUG support * ******************************************************************************/ @@ -26,6 +26,9 @@ * * History: * $Log: skdebug.h,v $ + * Revision 1.10 1999/11/22 13:47:40 cgoos + * Changed license header to GPL. + * * Revision 1.9 1999/09/14 14:02:43 rwahl * Added SK_DBGMOD_PECP. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skdrv1st.h linux/drivers/net/sk98lin/h/skdrv1st.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skdrv1st.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skdrv1st.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skdrv1st.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.6 $ - * Date: $Date: 1999/07/27 08:03:33 $ + * Version: $Revision: 1.8 $ + * Date: $Date: 2000/02/21 12:19:18 $ * Purpose: First header file for driver and all other modules * ******************************************************************************/ @@ -27,6 +27,15 @@ * History: * * $Log: skdrv1st.h,v $ + * Revision 1.8 2000/02/21 12:19:18 cgoos + * Added default for SK_DEBUG_CHKMOD/_CHKCAT + * + * Revision 1.7 1999/11/22 13:50:00 cgoos + * Changed license header to GPL. + * Added overwrite for several functions. + * Removed linux 2.0.x definitions. + * Removed PCI vendor ID definition (now in kernel). + * * Revision 1.6 1999/07/27 08:03:33 cgoos * Changed SK_IN/OUT macros to readX/writeX instead of memory * accesses (necessary for ALPHA). @@ -175,6 +184,12 @@ #ifdef DEBUG #define SK_DBG_PRINTF printk +#ifndef SK_DEBUG_CHKMOD +#define SK_DEBUG_CHKMOD 0 +#endif +#ifndef SK_DEBUG_CHKCAT +#define SK_DEBUG_CHKCAT 0 +#endif /* those come from the makefile */ #define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD) #define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skerror.h linux/drivers/net/sk98lin/h/skerror.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skerror.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skerror.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skerror.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1999/09/14 14:04:42 $ + * Version: $Revision: 1.4 $ + * Date: $Date: 1999/11/22 13:51:59 $ * Purpose: SK specific Error log support * ******************************************************************************/ @@ -26,6 +26,9 @@ * * History: * $Log: skerror.h,v $ + * Revision 1.4 1999/11/22 13:51:59 cgoos + * Changed license header to GPL. + * * Revision 1.3 1999/09/14 14:04:42 rwahl * Added error base SK_ERRBASE_PECP. * Changed error base for driver. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgedrv.h linux/drivers/net/sk98lin/h/skgedrv.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgedrv.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgedrv.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgedrv.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1998/12/01 13:31:39 $ + * Version: $Revision: 1.4 $ + * Date: $Date: 1999/11/22 13:52:46 $ * Purpose: Interface with the driver * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skgedrv.h,v $ + * Revision 1.4 1999/11/22 13:52:46 cgoos + * Changed license header to GPL. + * * Revision 1.3 1998/12/01 13:31:39 cgoos * SWITCH INTERN Event added. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehw.h linux/drivers/net/sk98lin/h/skgehw.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehw.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgehw.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgehw.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.33 $ - * Date: $Date: 1999/08/27 11:17:10 $ + * Version: $Revision: 1.35 $ + * Date: $Date: 2000/05/19 10:17:13 $ * Purpose: Defines and Macros for the Gigabit Ethernet Adapter Product * Family * @@ -27,6 +27,12 @@ * * History: * $Log: skgehw.h,v $ + * Revision 1.35 2000/05/19 10:17:13 cgoos + * Added inactivity check in PHY_READ (in DEBUG mode only). + * + * Revision 1.34 1999/11/22 13:53:40 cgoos + * Changed license header to GPL. + * * Revision 1.33 1999/08/27 11:17:10 malthoff * It's more savely to put bracket around marco parameters. * Brackets added for PHY_READ and PHY_WRITE. @@ -1627,19 +1633,44 @@ * written. * * usage: PHY_READ(IoC, pPort, MAC_1, PHY_CTRL, Value); + * Warning: a PHY_READ on an uninitialized PHY (PHY still in reset) never + * comes back. This is checked in DEBUG mode. */ +#ifndef DEBUG +#define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \ + SK_U16 Mmu; \ + \ + XM_OUT16((IoC),(Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + if ((pPort)->PhyType != SK_PHY_XMAC) { \ + do { \ + XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + } while ((Mmu & XM_MMU_PHY_RDY) == 0); \ + XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ + } \ +} +#else #define PHY_READ(IoC, pPort, Mac, PhyReg, pVal) { \ SK_U16 Mmu; \ + int __i = 0; \ \ XM_OUT16((IoC),(Mac), XM_PHY_ADDR, (PhyReg)|(pPort)->PhyAddr); \ XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ if ((pPort)->PhyType != SK_PHY_XMAC) { \ do { \ XM_IN16((IoC), (Mac), XM_MMU_CMD, &Mmu); \ + __i++; \ + if (__i > 10000) { \ + SK_DBG_PRINTF("*****************************\n"); \ + SK_DBG_PRINTF("PHY_READ on uninitialized PHY\n"); \ + SK_DBG_PRINTF("*****************************\n"); \ + break; \ + } \ } while ((Mmu & XM_MMU_PHY_RDY) == 0); \ XM_IN16((IoC), (Mac), XM_PHY_DATA, (pVal)); \ } \ } +#endif #define PHY_WRITE(IoC, pPort, Mac, PhyReg, Val) { \ SK_U16 Mmu; \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehwt.h linux/drivers/net/sk98lin/h/skgehwt.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgehwt.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgehwt.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skhwt.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.4 $ - * Date: $Date: 1998/08/19 09:50:58 $ + * Version: $Revision: 1.5 $ + * Date: $Date: 1999/11/22 13:54:24 $ * Purpose: Defines for the hardware timer functions * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skgehwt.h,v $ + * Revision 1.5 1999/11/22 13:54:24 cgoos + * Changed license header to GPL. + * * Revision 1.4 1998/08/19 09:50:58 gklug * fix: remove struct keyword from c-code (see CCC) add typedefs * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgei2c.h linux/drivers/net/sk98lin/h/skgei2c.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgei2c.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgei2c.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgei2c.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.16 $ - * Date: $Date: 1999/11/12 08:24:10 $ + * Version: $Revision: 1.17 $ + * Date: $Date: 1999/11/22 13:55:25 $ * Purpose: Special genesis defines for I2C * (taken from Monalisa (taken from Concentrator)) * @@ -28,6 +28,9 @@ * History: * * $Log: skgei2c.h,v $ + * Revision 1.17 1999/11/22 13:55:25 cgoos + * Changed license header to GPL. + * * Revision 1.16 1999/11/12 08:24:10 malthoff * Change voltage warning and error limits * (warning +-5%, error +-10%). diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgeinit.h linux/drivers/net/sk98lin/h/skgeinit.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgeinit.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgeinit.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skgeinit.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.44 $ - * Date: $Date: 1999/10/26 07:34:15 $ + * Version: $Revision: 1.46 $ + * Date: $Date: 2000/08/10 11:28:00 $ * Purpose: Structures and prototypes for the GE Init Module * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,13 @@ * History: * * $Log: skgeinit.h,v $ + * Revision 1.46 2000/08/10 11:28:00 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * + * Revision 1.45 1999/11/22 13:56:19 cgoos + * Changed license header to GPL. + * * Revision 1.44 1999/10/26 07:34:15 malthoff * The define SK_LNK_ON has been lost in v1.41. * @@ -443,61 +450,63 @@ SK_TIMER PWaTimer; /* Workaround Timer */ #endif SK_U64 PPrevShorts; /* Previous short Counter checking */ - SK_U64 PPrevRx; /* Previous RxOk Counter checking */ - SK_U64 PPrevFcs; /* Previous FCS Error Counter checking */ - SK_U64 PRxLim; /* Previous RxOk Counter checking */ - int PLinkResCt; /* Link Restart Counter */ - int PAutoNegTimeOut;/* AutoNegotiation timeout current value */ - int PRxQSize; /* Port Rx Queue Size in kB */ - int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */ - int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB*/ + SK_U64 PPrevRx; /* Previous RxOk Counter checking */ + SK_U64 PPrevFcs; /* Previous FCS Error Counter checking */ + SK_U64 PRxLim; /* Previous RxOk Counter checking */ + int PLinkResCt; /* Link Restart Counter */ + int PAutoNegTimeOut;/* AutoNegotiation timeout current value */ + int PRxQSize; /* Port Rx Queue Size in kB */ + int PXSQSize; /* Port Synchronous Transmit Queue Size in kB */ + int PXAQSize; /* Port Asynchronous Transmit Queue Size in kB*/ SK_U32 PRxQRamStart; /* Receive Queue RAM Buffer Start Address */ - SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */ + SK_U32 PRxQRamEnd; /* Receive Queue RAM Buffer End Address */ SK_U32 PXsQRamStart; /* Sync Tx Queue RAM Buffer Start Address */ - SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */ + SK_U32 PXsQRamEnd; /* Sync Tx Queue RAM Buffer End Address */ SK_U32 PXaQRamStart; /* Async Tx Queue RAM Buffer Start Address */ - SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */ - int PRxQOff; /* Rx Queue Address Offset */ - int PXsQOff; /* Synchronous Tx Queue Address Offset */ - int PXaQOff; /* Asynchronous Tx Queue Address Offset */ - SK_U16 PRxCmd; /* Port Receive Command Configuration Value */ - SK_U16 PIsave; /* Saved Interrupt status word */ - SK_U16 PSsave; /* Saved PHY status word */ - SK_BOOL PHWLinkUp; /* The hardware Link is up (wireing) */ - SK_BOOL PState; /* Is port initialized ? */ + SK_U32 PXaQRamEnd; /* Async Tx Queue RAM Buffer End Address */ + int PRxQOff; /* Rx Queue Address Offset */ + int PXsQOff; /* Synchronous Tx Queue Address Offset */ + int PXaQOff; /* Asynchronous Tx Queue Address Offset */ + SK_U16 PRxCmd; /* Port Receive Command Configuration Value */ + SK_U16 PIsave; /* Saved Interrupt status word */ + SK_U16 PSsave; /* Saved PHY status word */ + SK_BOOL PHWLinkUp; /* The hardware Link is up (wireing) */ + SK_BOOL PState; /* Is port initialized ? */ SK_BOOL PLinkBroken; /* Is Link broken ? */ - SK_BOOL PCheckPar; /* Do we check for parity errors ? */ - SK_U8 PLinkCap; /* Link Capabilities */ + SK_BOOL PCheckPar; /* Do we check for parity errors ? */ + SK_U8 PLinkCap; /* Link Capabilities */ SK_U8 PLinkModeConf; /* Link Mode configured */ - SK_U8 PLinkMode; /* Link Mode currently used */ - SK_U8 PLinkModeStatus; /* Link Mode Status */ + SK_U8 PLinkMode; /* Link Mode currently used */ + SK_U8 PLinkModeStatus;/* Link Mode Status */ SK_U8 PFlowCtrlCap; /* Flow Control Capabilities */ SK_U8 PFlowCtrlMode; /* Flow Control Mode */ - SK_U8 PFlowCtrlStatus; /* Flow Control Status */ - SK_U8 PMSCap; /* Master/Slave Capabilities */ - SK_U8 PMSMode; /* Master/Slave Mode */ - SK_U8 PMSStatus; /* Master/Slave Status */ + SK_U8 PFlowCtrlStatus;/* Flow Control Status */ + SK_U8 PMSCap; /* Master/Slave Capabilities */ + SK_U8 PMSMode; /* Master/Slave Mode */ + SK_U8 PMSStatus; /* Master/Slave Status */ SK_U8 PAutoNegFail; /* Autonegotiation fail flag */ SK_U8 PLipaAutoNeg; /* Autonegotiation possible with Link Partner */ + SK_U16 PhyAddr; /* MDIO/MDC PHY address */ int PhyType; /* PHY used on this port */ - SK_U16 PhyAddr; /* MDIO/MDC PHY address */ } SK_GEPORT; /* * Gigabit Ethernet Initalization Struct - * (has to be included in the adapter context + * (has to be included in the adapter context) */ typedef struct s_GeInit { - int GIMacsFound; /* Number of MACs found on this adapter */ - int GIPciHwRev; /* PCI HW Revision Number */ - SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */ - int GIRamSize; /* The RAM size of the adapter in kB */ - int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */ - int GIPortUsage; /* driver port usage: SK_RED_LINK/SK_MUL_LINK */ - SK_U32 GIPollTimerVal; /* Descriptor Poll Timer Init Val in clk ticks*/ - int GILevel; /* Initialization Level Completed */ - SK_BOOL GIAnyPortAct; /* Is True if one or more port is initialized */ - SK_GEPORT GP[SK_MAX_MACS]; /* Port Dependent Information */ + int GIMacsFound; /* Number of MACs found on this adapter */ + int GIPciHwRev; /* PCI HW Revision Number */ + SK_U32 GIRamOffs; /* RAM Address Offset for addr calculation */ + int GIRamSize; /* The RAM size of the adapter in kB */ + int GIHstClkFact; /* Host Clock Factor (62.5 / HstClk * 100) */ + int GIPortUsage; /* driver port usage: SK_RED_LINK/SK_MUL_LINK */ + SK_U32 GIPollTimerVal; /* Descriptor Poll Timer Init Val in clk ticks*/ + int GILevel; /* Initialization Level Completed */ + SK_GEPORT GP[SK_MAX_MACS];/* Port Dependent Information */ + SK_BOOL GIAnyPortAct; /* Is True if one or more port is initialized */ + SK_U8 Align01; + SK_U16 Align02; } SK_GEINIT; /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnm2.h linux/drivers/net/sk98lin/h/skgepnm2.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnm2.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgepnm2.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnm2.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.24 $ - * Date: $Date: 1999/04/13 15:11:11 $ + * Version: $Revision: 1.28 $ + * Date: $Date: 2000/08/03 15:12:48 $ * Purpose: Defines for Private Network Management Interface * ****************************************************************************/ @@ -27,6 +27,20 @@ * History: * * $Log: skgepnm2.h,v $ + * Revision 1.28 2000/08/03 15:12:48 rwahl + * - Additional comment for MAC statistic data structure. + * + * Revision 1.27 2000/08/01 16:10:18 rwahl + * - Added mac statistic data structure for StatRxLongFrame counter. + * + * Revision 1.26 2000/03/31 13:51:34 rwahl + * Added SK_UPTR cast to offset calculation for PNMI struct fields; + * missing cast caused compiler warnings by Win64 compiler. + * + * Revision 1.25 1999/11/22 13:57:41 cgoos + * Changed license header to GPL. + * Allowing overwrite for SK_PNMI_STORE/_READ defines. + * * Revision 1.24 1999/04/13 15:11:11 mhaveman * Changed copyright. * @@ -203,6 +217,8 @@ /* * MAC statistic data structures + * Only for the first 64 counters: the number relates to the bit in the + * XMAC overflow status register */ #define SK_PNMI_HTX 0 #define SK_PNMI_HTX_OCTET 1 @@ -274,6 +290,8 @@ #define SK_PNMI_HTX_SYNC 64 #define SK_PNMI_HTX_SYNC_OCTET 65 +#define SK_PNMI_HRX_LONGFRAMES 66 + #define SK_PNMI_MAX_IDX (SK_PNMI_CNT_NO) /* @@ -288,25 +306,25 @@ /* * SK_PNMI_STRUCT_DATA copy offset evaluation macros */ -#define SK_PNMI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) -#define SK_PNMI_MAI_OFF(e) ((SK_U32)&(((SK_PNMI_STRUCT_DATA *)0)->e)) -#define SK_PNMI_VPD_OFF(e) ((SK_U32)&(((SK_PNMI_VPD *)0)->e)) -#define SK_PNMI_SEN_OFF(e) ((SK_U32)&(((SK_PNMI_SENSOR *)0)->e)) -#define SK_PNMI_CHK_OFF(e) ((SK_U32)&(((SK_PNMI_CHECKSUM *)0)->e)) -#define SK_PNMI_STA_OFF(e) ((SK_U32)&(((SK_PNMI_STAT *)0)->e)) -#define SK_PNMI_CNF_OFF(e) ((SK_U32)&(((SK_PNMI_CONF *)0)->e)) -#define SK_PNMI_RLM_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT *)0)->e)) -#define SK_PNMI_MON_OFF(e) ((SK_U32)&(((SK_PNMI_RLMT_MONITOR *)0)->e)) -#define SK_PNMI_TRP_OFF(e) ((SK_U32)&(((SK_PNMI_TRAP *)0)->e)) +#define SK_PNMI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_MAI_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STRUCT_DATA *)0)->e)) +#define SK_PNMI_VPD_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_VPD *)0)->e)) +#define SK_PNMI_SEN_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_SENSOR *)0)->e)) +#define SK_PNMI_CHK_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CHECKSUM *)0)->e)) +#define SK_PNMI_STA_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_STAT *)0)->e)) +#define SK_PNMI_CNF_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_CONF *)0)->e)) +#define SK_PNMI_RLM_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT *)0)->e)) +#define SK_PNMI_MON_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_RLMT_MONITOR *)0)->e)) +#define SK_PNMI_TRP_OFF(e) ((SK_U32)(SK_UPTR)&(((SK_PNMI_TRAP *)0)->e)) #define SK_PNMI_SET_STAT(b,s,o) {SK_U32 Val32; char *pVal; \ Val32 = (s); \ - pVal = (char *)(b) + ((SK_U32) \ + pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \ &(((SK_PNMI_STRUCT_DATA *)0)-> \ ReturnStatus.ErrorStatus)); \ SK_PNMI_STORE_U32(pVal, Val32); \ Val32 = (o); \ - pVal = (char *)(b) + ((SK_U32) \ + pVal = (char *)(b) + ((SK_U32)(SK_UPTR) \ &(((SK_PNMI_STRUCT_DATA *)0)-> \ ReturnStatus.ErrorOffset)); \ SK_PNMI_STORE_U32(pVal, Val32);} diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnmi.h linux/drivers/net/sk98lin/h/skgepnmi.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgepnmi.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgepnmi.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnmi.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.37 $ - * Date: $Date: 1999/09/14 14:25:32 $ + * Version: $Revision: 1.44 $ + * Date: $Date: 2000/09/07 07:35:27 $ * Purpose: Defines for Private Network Management Interface * ****************************************************************************/ @@ -27,6 +27,34 @@ * History: * * $Log: skgepnmi.h,v $ + * Revision 1.44 2000/09/07 07:35:27 rwahl + * - removed NDIS counter specific data type. + * - fixed spelling for OID_SKGE_RLMT_PORT_PREFERRED. + * + * Revision 1.43 2000/08/04 11:41:08 rwahl + * - Fixed compiler warning (port is always >= 0) for macros + * SK_PNMI_CNT_RX_LONGFRAMES & SK_PNMI_CNT_SYNC_OCTETS + * + * Revision 1.42 2000/08/03 15:14:07 rwahl + * - Corrected error in driver macros addressing a physical port. + * + * Revision 1.41 2000/08/01 16:22:29 rwahl + * - Changed MDB version to 3.1. + * - Added definitions for StatRxLongFrames counter. + * - Added macro to be used by driver to count long frames received. + * - Added directive to control width (default = 32bit) of NDIS statistic + * counters (SK_NDIS_64BIT_CTR). + * + * Revision 1.40 2000/03/31 13:51:34 rwahl + * Added SK_UPTR cast to offset calculation for PNMI struct fields; + * missing cast caused compiler warnings by Win64 compiler. + * + * Revision 1.39 1999/12/06 10:09:47 rwahl + * Added new error log message. + * + * Revision 1.38 1999/11/22 13:57:55 cgoos + * Changed license header to GPL. + * * Revision 1.37 1999/09/14 14:25:32 rwahl * Set MDB version for 1000Base-T (sensors, Master/Slave) changes. * @@ -164,7 +192,7 @@ /* * Management Database Version */ -#define SK_PNMI_MDB_VERSION 0x00030000 /* 3.0 */ +#define SK_PNMI_MDB_VERSION 0x00030001 /* 3.1 */ /* @@ -383,6 +411,7 @@ #define OID_SKGE_STAT_RX_511 0xFF020154 #define OID_SKGE_STAT_RX_1023 0xFF020155 #define OID_SKGE_STAT_RX_MAX 0xFF020156 +#define OID_SKGE_STAT_RX_LONGFRAMES 0xFF020157 #define OID_SKGE_PHYS_CUR_ADDR 0xFF010120 #define OID_SKGE_PHYS_FAC_ADDR 0xFF010121 @@ -405,7 +434,7 @@ #define OID_SKGE_RLMT_MODE 0xFF010140 #define OID_SKGE_RLMT_PORT_NUMBER 0xFF010141 #define OID_SKGE_RLMT_PORT_ACTIVE 0xFF010142 -#define OID_SKGE_RLMT_PORT_PREFERED 0xFF010143 +#define OID_SKGE_RLMT_PORT_PREFERRED 0xFF010143 #define OID_SKGE_RLMT_CHANGE_CTS 0xFF020160 #define OID_SKGE_RLMT_CHANGE_TIME 0xFF020161 #define OID_SKGE_RLMT_CHANGE_ESTIM 0xFF020162 @@ -559,6 +588,8 @@ #define SK_PNMI_ERR050MSG "MacUpdate: Cannot update statistic counter" #define SK_PNMI_ERR051 (SK_ERRBASE_PNMI + 51) #define SK_PNMI_ERR051MSG "SkPnmiEvent: Port switch suspicious" +#define SK_PNMI_ERR052 (SK_ERRBASE_PNMI + 52) +#define SK_PNMI_ERR052MSG "MacPrivateConf: SK_HWEV_SET_ROLE returned not 0" /* * Management counter macros called by the driver @@ -592,9 +623,16 @@ #define SK_PNMI_CNT_SYNC_OCTETS(pAC,p,v) \ { \ - if (((p) >= 0) && ((p) < SK_MAX_MACS)) { \ - ((pAC)->Pnmi.StatSyncCts[p])++; \ - (pAC)->Pnmi.StatSyncOctetsCts[p] += (SK_U64)(v); \ + if ((p) < SK_MAX_MACS) { \ + ((pAC)->Pnmi.Port[p].StatSyncCts)++; \ + (pAC)->Pnmi.Port[p].StatSyncOctetsCts += (SK_U64)(v); \ + } \ + } + +#define SK_PNMI_CNT_RX_LONGFRAMES(pAC,p) \ + { \ + if ((p) < SK_MAX_MACS) { \ + ((pAC)->Pnmi.Port[p].StatRxLongFrameCts)++; \ } \ } @@ -687,6 +725,7 @@ SK_U64 StatRxBroadcastOkCts; SK_U64 StatRxMulticastOkCts; SK_U64 StatRxUnicastOkCts; + SK_U64 StatRxLongFramesCts; SK_U64 StatRxPauseMacCtrlCts; SK_U64 StatRxMacCtrlCts; SK_U64 StatRxPauseMacCtrlErrorCts; @@ -809,8 +848,9 @@ } SK_PNMI_STRUCT_DATA; #define SK_PNMI_STRUCT_SIZE (sizeof(SK_PNMI_STRUCT_DATA)) -#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)&(((SK_PNMI_STRUCT_DATA *)0)->\ - VpdFreeBytes)) /* +#define SK_PNMI_MIN_STRUCT_SIZE ((unsigned int)(SK_UPTR)\ + &(((SK_PNMI_STRUCT_DATA *)0)->VpdFreeBytes)) + /* * ReturnStatus field * must be located * before VpdFreeBytes @@ -822,7 +862,7 @@ #define SK_PNMI_MAX_PROTOS 3 #define SK_PNMI_SCNT_NOT 64 -#define SK_PNMI_CNT_NO 66 +#define SK_PNMI_CNT_NO 67 /* * Estimate data structure @@ -843,6 +883,7 @@ SK_U64 CounterOffset[SK_PNMI_CNT_NO]; SK_U64 StatSyncCts; SK_U64 StatSyncOctetsCts; + SK_U64 StatRxLongFrameCts; SK_BOOL ActiveFlag; } SK_PNMI_PORT; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skgesirq.h linux/drivers/net/sk98lin/h/skgesirq.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skgesirq.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skgesirq.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgesirq.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.18 $ - * Date: $Date: 1999/05/19 07:32:59 $ + * Version: $Revision: 1.20 $ + * Date: $Date: 1999/12/06 10:00:44 $ * Purpose: SK specific Gigabit Ethernet special IRQ functions * ******************************************************************************/ @@ -26,6 +26,12 @@ * * History: * $Log: skgesirq.h,v $ + * Revision 1.20 1999/12/06 10:00:44 cgoos + * Added SET event for role. + * + * Revision 1.19 1999/11/22 13:58:26 cgoos + * Changed license header to GPL. + * * Revision 1.18 1999/05/19 07:32:59 cgoos * Changes for 1000Base-T. * @@ -99,6 +105,7 @@ #define SK_HWEV_UPDATE_STAT 5 /* Update Statistics by PNMI */ #define SK_HWEV_SET_LMODE 6 /* Set Link Mode by PNMI */ #define SK_HWEV_SET_FLOWMODE 7 /* Set Flow Control Mode by PNMI */ +#define SK_HWEV_SET_ROLE 8 /* Set Master/Slave (Role) by PNMI */ #define SK_WA_ACT_TIME (5000000L) /* 5 sec */ #define SK_WA_INA_TIME (100000L) /* 100 msec */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/ski2c.h linux/drivers/net/sk98lin/h/ski2c.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/ski2c.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/ski2c.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: ski2c.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.27 $ - * Date: $Date: 1999/05/20 09:23:10 $ + * Version: $Revision: 1.29 $ + * Date: $Date: 2000/08/03 14:28:17 $ * Purpose: Defines to access Voltage and Temperature Sensor * (taken from Monalisa (taken from Concentrator)) * @@ -28,6 +28,13 @@ * History: * * $Log: ski2c.h,v $ + * Revision 1.29 2000/08/03 14:28:17 rassmann + * - Added function to wait for I2C being ready before resetting the board. + * - Replaced one duplicate "out of range" message with correct one. + * + * Revision 1.28 1999/11/22 13:55:46 cgoos + * Changed license header to GPL. + * * Revision 1.27 1999/05/20 09:23:10 cgoos * Changes for 1000Base-T (Fan sensors). * @@ -254,9 +261,9 @@ extern int SkI2cReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen); #ifndef SK_DIAG -extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, - SK_EVPARA Para); +extern int SkI2cEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Para); extern int SkI2cInit(SK_AC *pAC, SK_IOC IoC, int Level); +extern void SkI2cWaitIrq(SK_AC *pAC, SK_IOC IoC); extern void SkI2cIsr(SK_AC *pAC, SK_IOC IoC); #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skqueue.h linux/drivers/net/sk98lin/h/skqueue.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skqueue.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skqueue.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skqueue.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.12 $ - * Date: $Date: 1998/09/08 08:48:01 $ + * Version: $Revision: 1.13 $ + * Date: $Date: 1999/11/22 13:59:05 $ * Purpose: Defines for the Event queue * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skqueue.h,v $ + * Revision 1.13 1999/11/22 13:59:05 cgoos + * Changed license header to GPL. + * * Revision 1.12 1998/09/08 08:48:01 gklug * add: init level handling * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skrlmt.h linux/drivers/net/sk98lin/h/skrlmt.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skrlmt.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skrlmt.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skrlmt.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.26 $ - * Date: $Date: 1999/10/04 14:01:19 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 1999/11/22 13:59:56 $ * Purpose: Header file for Redundant Link ManagemenT. * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: skrlmt.h,v $ + * Revision 1.27 1999/11/22 13:59:56 cgoos + * Changed license header to GPL. + * * Revision 1.26 1999/10/04 14:01:19 rassmann * Corrected reaction to reception of BPDU frames. * Added parameter descriptions to "For Readme" section skrlmt.txt. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/sktimer.h linux/drivers/net/sk98lin/h/sktimer.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/sktimer.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/sktimer.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktimer.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.8 $ - * Date: $Date: 1998/09/08 08:48:02 $ + * Version: $Revision: 1.9 $ + * Date: $Date: 1999/11/22 14:00:29 $ * Purpose: Defines for the timer functions * ******************************************************************************/ @@ -27,6 +27,9 @@ * History: * * $Log: sktimer.h,v $ + * Revision 1.9 1999/11/22 14:00:29 cgoos + * Changed license header to GPL. + * * Revision 1.8 1998/09/08 08:48:02 gklug * add: init level handling * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/sktypes.h linux/drivers/net/sk98lin/h/sktypes.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/sktypes.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/sktypes.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktypes.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.1 $ - * Date: $Date: 1999/02/16 07:41:40 $ + * Version: $Revision: 1.2 $ + * Date: $Date: 1999/11/22 14:01:58 $ * Purpose: Define data types for Linux * ******************************************************************************/ @@ -27,6 +27,10 @@ * History: * * $Log: sktypes.h,v $ + * Revision 1.2 1999/11/22 14:01:58 cgoos + * Changed license header to GPL. + * Now using Linux' fixed size types instead of standard types. + * * Revision 1.1 1999/02/16 07:41:40 cgoos * First version. * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/skvpd.h linux/drivers/net/sk98lin/h/skvpd.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/skvpd.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/skvpd.h Fri Sep 15 14:34:19 2000 @@ -2,15 +2,15 @@ * * Name: skvpd.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.8 $ - * Date: $Date: 1999/03/11 14:26:40 $ + * Version: $Revision: 1.10 $ + * Date: $Date: 2000/08/10 11:29:07 $ * Purpose: Defines and Macros for VPD handling * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,15 @@ * History: * * $Log: skvpd.h,v $ + * Revision 1.10 2000/08/10 11:29:07 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * Removed unused function VpdWriteDword() (#if 0). + * Made VpdReadKeyword() available for SKDIAG only. + * + * Revision 1.9 1999/11/22 14:02:27 cgoos + * Changed license header to GPL. + * * Revision 1.8 1999/03/11 14:26:40 malthoff * Replace __STDC__ with SK_KR_PROTO. * @@ -112,40 +121,42 @@ /* VPD status */ /* bit 7..1 reserved */ -#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ - /* and vpd_free_rw valid */ +#define VPD_VALID (1<<0) /* VPD data buffer, vpd_free_ro, */ + /* and vpd_free_rw valid */ /* * VPD structs */ typedef struct s_vpd_status { - unsigned short vpd_status ; /* VPD status, description see above */ - int vpd_free_ro ; /* unused bytes in read only area */ - int vpd_free_rw ; /* bytes available in read/write area */ + unsigned short Align01; /* Alignment */ + unsigned short vpd_status; /* VPD status, description see above */ + int vpd_free_ro; /* unused bytes in read only area */ + int vpd_free_rw; /* bytes available in read/write area */ } SK_VPD_STATUS; typedef struct s_vpd { - SK_VPD_STATUS v ; /* VPD status structure */ - char vpd_buf[VPD_SIZE] ; /* VPD buffer */ + SK_VPD_STATUS v; /* VPD status structure */ + char vpd_buf[VPD_SIZE]; /* VPD buffer */ } SK_VPD; typedef struct s_vpd_para { - unsigned int p_len ; /* parameter length */ - char *p_val ; /* points to the value */ + unsigned int p_len; /* parameter length */ + char *p_val; /* points to the value */ } SK_VPD_PARA; /* * structure of Large Resource Type Identifiers */ -/* was removed, because of alignment problems */ + +/* was removed because of alignment problems */ /* * sturcture of VPD keywords */ typedef struct s_vpd_key { - char p_key[2] ; /* 2 bytes ID string */ - unsigned char p_len ; /* 1 byte length */ - char p_val ; /* start of the value string */ + char p_key[2]; /* 2 bytes ID string */ + unsigned char p_len; /* 1 byte length */ + char p_val; /* start of the value string */ } SK_VPD_KEY; @@ -169,39 +180,39 @@ #define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) #endif /* VPD_DO_IO */ #else /* SKDIAG */ -#define VPD_OUT8(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT8(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgByte(pAC,Addr,Val) ; \ - else \ + SkPciWriteCfgByte(pAC,Addr,Val); \ + else \ SK_OUT8(pAC,PCI_C(Addr),Val); \ } -#define VPD_OUT16(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT16(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgWord(pAC,Addr,Val) ; \ + SkPciWriteCfgWord(pAC,Addr,Val); \ else \ SK_OUT16(pAC,PCI_C(Addr),Val); \ } -#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ +#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgDWord(pAC,Addr,Val) ; \ + SkPciWriteCfgDWord(pAC,Addr,Val); \ else \ SK_OUT32(pAC,PCI_C(Addr),Val); \ } -#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgByte(pAC,Addr,pVal) ; \ + SkPciReadCfgByte(pAC,Addr,pVal); \ else \ SK_IN8(pAC,PCI_C(Addr),pVal); \ } -#define VPD_IN16(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN16(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgWord(pAC,Addr,pVal) ; \ + SkPciReadCfgWord(pAC,Addr,pVal); \ else \ SK_IN16(pAC,PCI_C(Addr),pVal); \ } -#define VPD_IN32(pAC,Ioc,Addr,pVal) { \ +#define VPD_IN32(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciReadCfgDWord(pAC,Addr,pVal) ; \ + SkPciReadCfgDWord(pAC,Addr,pVal); \ else \ SK_IN32(pAC,PCI_C(Addr),pVal); \ } @@ -210,50 +221,52 @@ /* function prototypes ********************************************************/ #ifndef SK_KR_PROTO +#ifdef SKDIAG extern SK_U32 VpdReadDWord( SK_AC *pAC, SK_IOC IoC, - int addr) ; + int addr); +#endif /* SKDIAG */ extern int VpdSetupPara( SK_AC *pAC, char *key, char *buf, - int len, - int type, - int op) ; + int len, + int type, + int op); extern SK_VPD_STATUS *VpdStat( SK_AC *pAC, - SK_IOC IoC) ; + SK_IOC IoC); extern int VpdKeys( SK_AC *pAC, SK_IOC IoC, char *buf, - int *len, - int *elements) ; + int *len, + int *elements); extern int VpdRead( SK_AC *pAC, SK_IOC IoC, char *key, char *buf, - int *len) ; + int *len); extern SK_BOOL VpdMayWrite( - char *key) ; + char *key); extern int VpdWrite( SK_AC *pAC, SK_IOC IoC, char *key, - char *buf) ; + char *buf); extern int VpdDelete( SK_AC *pAC, SK_IOC IoC, - char *key) ; + char *key); extern int VpdUpdate( SK_AC *pAC, @@ -262,34 +275,34 @@ extern void VpdErrLog( SK_AC *pAC, SK_IOC IoC, - char *msg) ; + char *msg); #ifdef SKDIAG extern int VpdReadBlock( SK_AC *pAC, SK_IOC IoC, char *buf, - int addr, - int len) ; + int addr, + int len); extern int VpdWriteBlock( SK_AC *pAC, SK_IOC IoC, char *buf, - int addr, - int len) ; + int addr, + int len); #endif /* SKDIAG */ #else /* SK_KR_PROTO */ -extern SK_U32 VpdReadDWord() ; -extern int VpdSetupPara() ; -extern SK_VPD_STATUS *VpdStat() ; -extern int VpdKeys() ; -extern int VpdRead() ; -extern SK_BOOL VpdMayWrite() ; -extern int VpdWrite() ; -extern int VpdDelete() ; -extern int VpdUpdate() ; -extern void VpdErrLog() ; +extern SK_U32 VpdReadDWord(); +extern int VpdSetupPara(); +extern SK_VPD_STATUS *VpdStat(); +extern int VpdKeys(); +extern int VpdRead(); +extern SK_BOOL VpdMayWrite(); +extern int VpdWrite(); +extern int VpdDelete(); +extern int VpdUpdate(); +extern void VpdErrLog(); #endif /* SK_KR_PROTO */ #endif /* __INC_SKVPD_H_ */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/h/xmac_ii.h linux/drivers/net/sk98lin/h/xmac_ii.h --- v2.4.0-test8/linux/drivers/net/sk98lin/h/xmac_ii.h Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/h/xmac_ii.h Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: xmac_ii.h * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.25 $ - * Date: $Date: 1999/08/12 19:19:38 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 2000/05/17 11:00:46 $ * Purpose: Defines and Macros for XaQti's Gigabit Ethernet Controller * ******************************************************************************/ @@ -27,6 +27,12 @@ * History: * * $Log: xmac_ii.h,v $ + * Revision 1.27 2000/05/17 11:00:46 malthoff + * Add bit for enable/disable power management in BCOM chip. + * + * Revision 1.26 1999/11/22 14:03:00 cgoos + * Changed license header to GPL. + * * Revision 1.25 1999/08/12 19:19:38 malthoff * Add PHY_B_AC_TX_TST bit according to BCOM A1 errata sheet. * @@ -930,7 +936,9 @@ #define PHY_B_AC_TX_TST (1<<10) /* Bit 10: tx test bit, always 1 */ /* Bit 9.. 8: reserved */ #define PHY_B_AC_DIS_PRF (1<<7) /* Bit 7: dis part resp filter */ - /* Bit 6.. 4: reserved */ + /* Bit 6: reserved */ +#define PHY_B_AC_DIS_PM (1<<5) /* Bit 5: dis power management */ + /* Bit 4: reserved */ #define PHY_B_AC_DIAG (1<<3) /* Bit 3: Diagnostic Mode */ /* Bit 2.. 0: reserved */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skaddr.c linux/drivers/net/sk98lin/skaddr.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skaddr.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skaddr.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skaddr.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.33 $ - * Date: $Date: 1999/05/28 10:56:06 $ - * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode + * Version: $Revision: 1.36 $ + * Date: $Date: 2000/08/07 11:10:39 $ + * Purpose: Manage Addresses (Multicast and Unicast) and Promiscuous Mode. * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,16 @@ * History: * * $Log: skaddr.c,v $ + * Revision 1.36 2000/08/07 11:10:39 rassmann + * Editorial changes. + * + * Revision 1.35 2000/05/04 09:38:41 rassmann + * Editorial changes. + * Corrected multicast address hashing. + * + * Revision 1.34 1999/11/22 13:23:44 cgoos + * Changed license header to GPL. + * * Revision 1.33 1999/05/28 10:56:06 rassmann * Editorial changes. * @@ -164,13 +172,13 @@ #ifndef lint static const char SysKonnectFileId[] = - "@(#) $Id: skaddr.c,v 1.33 1999/05/28 10:56:06 rassmann Exp $ (C) SysKonnect."; + "@(#) $Id: skaddr.c,v 1.36 2000/08/07 11:10:39 rassmann Exp $ (C) SysKonnect."; #endif /* !defined(lint) */ #define __SKADDR_C #ifdef __cplusplus -xxxx /* not supported yet - force error */ +#error C++ is not yet supported. extern "C" { #endif /* cplusplus */ @@ -179,19 +187,9 @@ /* defines ********************************************************************/ -#define SK_ADDR_CHEAT YES /* Cheat. */ - -/* - * G32: - * POLY equ 04C11DB6h ; CRC polynominal term - * bit-reversed: 6DB88320 - */ #define CRC32_POLY 0xEDB88320UL /* CRC32-Poly - XMAC: Little Endian */ -#if 0 -#define CRC32_POLY 0x6DB88320UL /* CRC32-Poly - XMAC: Little Endian */ -#endif /* 0 */ -#define HASH_BITS 6 /* #bits in hash */ +#define HASH_BITS 6 /* #bits in hash */ #define SK_MC_BIT 0x01 /* Error numbers and messages. */ @@ -219,13 +217,6 @@ /* functions ******************************************************************/ -#if 0 -void SkAddrDummy(void) -{ - SkAddrInit(NULL, NULL, 0); -} /* SkAddrDummy */ -#endif /* 0 */ - /****************************************************************************** * * SkAddrInit - initialize data, set state to init @@ -236,7 +227,7 @@ * ============ * * This routine clears the multicast tables and resets promiscuous mode. - * Some entries are reserved for the "logical board address", the + * Some entries are reserved for the "logical MAC address", the * SK-RLMT multicast address, and the BPDU multicast address. * * @@ -263,12 +254,12 @@ int SkAddrInit( SK_AC *pAC, /* the adapter context */ SK_IOC IoC, /* I/O context */ -int Level) /* initialization level */ +int Level) /* initialization level */ { - int j; - SK_U32 i; - SK_U8 *InAddr; - SK_U16 *OutAddr; + int j; + SK_U32 i; + SK_U8 *InAddr; + SK_U16 *OutAddr; SK_ADDR_PORT *pAPort; switch (Level) { @@ -279,20 +270,15 @@ pAPort = &pAC->Addr.Port[i]; pAPort->PromMode = SK_PROM_MODE_NONE; - pAPort->FirstExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; - pAPort->FirstExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; - pAPort->NextExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; - pAPort->NextExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; + pAPort->FirstExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; + pAPort->FirstExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; + pAPort->NextExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; + pAPort->NextExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; #if 0 - /* Not here ... */ + /* Don't do this here ... */ /* Reset Promiscuous mode. */ - (void)SkAddrPromiscuousChange( pAC, IoC, @@ -325,8 +311,7 @@ } #endif /* DEBUG */ - /* Read permanent virtual address from Control Register File. */ - + /* Read permanent logical MAC address from Control Register File. */ for (j = 0; j < SK_MAC_ADDR_LEN; j++) { InAddr = (SK_U8 *)&pAC->Addr.PermanentMacAddress.a[j]; SK_IN8(IoC, B2_MAC_1 + j, InAddr); @@ -334,17 +319,15 @@ if (!pAC->Addr.CurrentMacAddressSet) { /* - * Set the current virtual MAC address + * Set the current logical MAC address * to the permanent one. */ - pAC->Addr.CurrentMacAddress = pAC->Addr.PermanentMacAddress; pAC->Addr.CurrentMacAddressSet = SK_TRUE; } - /* Set the current virtual MAC address. */ - + /* Set the current logical MAC address. */ pAC->Addr.Port[pAC->Addr.ActivePort].Exact[0] = pAC->Addr.CurrentMacAddress; @@ -354,27 +337,27 @@ SK_DBGMOD_ADDR, SK_DBGCAT_INIT, ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.PermanentMacAddress.a[0], - pAC->Addr.PermanentMacAddress.a[1], - pAC->Addr.PermanentMacAddress.a[2], - pAC->Addr.PermanentMacAddress.a[3], - pAC->Addr.PermanentMacAddress.a[4], - pAC->Addr.PermanentMacAddress.a[5])) + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) SK_DBG_MSG( pAC, SK_DBGMOD_ADDR, SK_DBGCAT_INIT, - ("Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.CurrentMacAddress.a[0], - pAC->Addr.CurrentMacAddress.a[1], - pAC->Addr.CurrentMacAddress.a[2], - pAC->Addr.CurrentMacAddress.a[3], - pAC->Addr.CurrentMacAddress.a[4], - pAC->Addr.CurrentMacAddress.a[5])) + ("Logical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) #endif /* DEBUG */ #if 0 - /* Not here ... */ + /* Don't do this here ... */ (void)SkAddrMcUpdate(pAC, IoC, pAC->Addr.ActivePort); #endif /* 0 */ @@ -386,10 +369,8 @@ * Read permanent port addresses from * Control Register File. */ - for (j = 0; j < SK_MAC_ADDR_LEN; j++) { - InAddr = (SK_U8 *) - &pAPort->PermanentMacAddress.a[j]; + InAddr = (SK_U8 *)&pAPort->PermanentMacAddress.a[j]; SK_IN8(IoC, B2_MAC_2 + 8 * i + j, InAddr); } @@ -399,16 +380,12 @@ * MAC address of this port to its permanent * MAC address. */ - - pAPort->CurrentMacAddress = - pAPort->PermanentMacAddress; - pAPort->PreviousMacAddress = - pAPort->PermanentMacAddress; + pAPort->CurrentMacAddress = pAPort->PermanentMacAddress; + pAPort->PreviousMacAddress = pAPort->PermanentMacAddress; pAPort->CurrentMacAddressSet = SK_TRUE; } /* Set port's current MAC addresses. */ - OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; XM_OUTADDR(IoC, i, XM_SA, OutAddr); @@ -484,7 +461,7 @@ SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Index of affected port */ -int Flags) /* permanent/non-perm, sw-only */ +int Flags) /* permanent/non-perm, sw-only */ { int i; @@ -495,9 +472,7 @@ if (Flags & SK_ADDR_PERMANENT) { /* Clear RLMT multicast addresses. */ - - pAC->Addr.Port[PortIdx].NextExactMatchRlmt = - SK_ADDR_FIRST_MATCH_RLMT; + pAC->Addr.Port[PortIdx].NextExactMatchRlmt = SK_ADDR_FIRST_MATCH_RLMT; } else { /* not permanent => DRV */ @@ -509,8 +484,7 @@ /* Clear DRV multicast addresses. */ - pAC->Addr.Port[PortIdx].NextExactMatchDrv = - SK_ADDR_FIRST_MATCH_DRV; + pAC->Addr.Port[PortIdx].NextExactMatchDrv = SK_ADDR_FIRST_MATCH_DRV; } if (!(Flags & SK_MC_SW_ONLY)) { @@ -521,7 +495,7 @@ } /* SkAddrMcClear */ #ifndef SK_ADDR_CHEAT -// RA;:;: + /****************************************************************************** * * SkCrc32McHash - hash multicast address @@ -548,15 +522,13 @@ Crc = 0xFFFFFFFFUL; for (Idx = 0; Idx < SK_MAC_ADDR_LEN; Idx++) { - Data = *pMc++; + Data = *pMc++; for (Bit = 0; Bit < 8; Bit++, Data >>= 1) { - Crc = (Crc >> 1) ^ - (((Crc ^ Data) & 1) ? CRC32_POLY : 0); + Crc = (Crc >> 1) ^ (((Crc ^ Data) & 1) ? CRC32_POLY : 0); } } return (Crc & ((1 << HASH_BITS) - 1)); - } /* SkCrc32McHash */ #endif /* not SK_ADDR_CHEAT */ @@ -593,7 +565,7 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Port Index */ SK_MAC_ADDR *pMc, /* multicast address to be added */ -int Flags) /* permanent/non-permanent */ +int Flags) /* permanent/non-permanent */ { int i; SK_U8 Inexact; @@ -628,11 +600,9 @@ } /* Not PERMANENT => DRV */ - if (PortIdx != pAC->Addr.ActivePort) { /* Only RLMT is allowed to do this. */ - return (SK_MC_ILLEGAL_PORT); } @@ -647,41 +617,31 @@ if (pAC->Addr.Port[PortIdx].NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { /* Set exact match entry. */ - pAC->Addr.Port[PortIdx].Exact[ pAC->Addr.Port[PortIdx].NextExactMatchDrv++] = *pMc; /* Clear InexactFilter. */ - for (i = 0; i < 8; i++) { - pAC->Addr.Port[PortIdx - ].InexactFilter.Bytes[i] = 0; + pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0; } } else { if (!(pMc->a[0] & SK_MC_BIT)) { - /* * Hashing only possible with * multicast addresses. */ - return (SK_MC_ILLEGAL_ADDRESS); } #ifndef SK_ADDR_CHEAT /* Compute hash value of address. */ -RA;:;: untested - HashBit = SkCrc32McHash(&pMc->a[0]); + HashBit = 63 - SkCrc32McHash(&pMc->a[0]); /* Add bit to InexactFilter. */ - pAC->Addr.Port[PortIdx].InexactFilter.Bytes[HashBit / 8] |= 1 << (HashBit % 8); - #else /* SK_ADDR_CHEAT */ - /* Set all bits in InexactFilter. */ - for (i = 0; i < 8; i++) { pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i] = 0xFF; } @@ -727,10 +687,10 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx) /* Port Index */ { - SK_U32 i; - SK_U8 Inexact; - SK_U16 *OutAddr; - SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Reg. */ + SK_U32 i; + SK_U8 Inexact; + SK_U16 *OutAddr; + SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Reg. */ SK_ADDR_PORT *pAPort; if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { @@ -753,18 +713,16 @@ ("Next0 on Port %d: %d\n", PortIdx, Next0[PortIdx])) #endif /* DEBUG */ - for (i = 0; /* Also program the virtual address. */ + for (i = 0; /* Also program the logical MAC address. */ i < pAPort->NextExactMatchRlmt; i++) { /* Set exact match address i on HW. */ - OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); } /* Clear other permanent exact match addresses on HW. */ - if (pAPort->NextExactMatchRlmt <= SK_ADDR_LAST_MATCH_RLMT) { SkXmClrExactAddr( pAC, @@ -774,17 +732,12 @@ SK_ADDR_LAST_MATCH_RLMT); } - for (i = pAPort->FirstExactMatchDrv; - i < pAPort->NextExactMatchDrv; - i++) { - + for (i = pAPort->FirstExactMatchDrv; i < pAPort->NextExactMatchDrv; i++) { OutAddr = (SK_U16 *)&pAPort->Exact[i].a[0]; XM_OUTADDR(IoC, PortIdx, XM_EXM(i), OutAddr); - } /* Clear other non-permanent exact match addresses on HW. */ - if (pAPort->NextExactMatchDrv <= SK_ADDR_LAST_MATCH_DRV) { SkXmClrExactAddr( pAC, @@ -794,67 +747,51 @@ SK_ADDR_LAST_MATCH_DRV); } - for (Inexact = 0xFF, i = 0; i < 8; i++) { - Inexact &= pAPort->InexactFilter.Bytes[i]; + for (Inexact = 0, i = 0; i < 8; i++) { + Inexact |= pAPort->InexactFilter.Bytes[i]; } - if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) { + if (pAPort->PromMode & SK_PROM_MODE_ALL_MC) { /* Set all bits in 64-bit hash register. */ - XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } - else if (Inexact != 0xFF) { - - /* Clear bit 15 in mode register. */ + else if (Inexact != 0) { + /* Set 64-bit hash register to InexactFilter. */ + XM_OUTHASH(IoC, PortIdx, XM_HSM, &pAPort->InexactFilter.Bytes[0]); + /* Set bit 15 in mode register. */ XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - LoMode &= ~XM_MD_ENA_HSH; + LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else { - /* Set 64-bit hash register to InexactFilter. */ - - XM_OUTHASH( - IoC, - PortIdx, - XM_HSM, - &pAPort->InexactFilter.Bytes[0]); - - /* Set bit 15 in mode register. */ - + /* Clear bit 15 in mode register. */ XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - LoMode |= XM_MD_ENA_HSH; + LoMode &= ~XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } if (pAPort->PromMode != SK_PROM_MODE_NONE) { - (void)SkAddrPromiscuousChange( - pAC, - IoC, - PortIdx, - pAPort->PromMode); + (void)SkAddrPromiscuousChange(pAC, IoC, PortIdx, pAPort->PromMode); } /* Set port's current MAC address. */ - OutAddr = (SK_U16 *)&pAPort->CurrentMacAddress.a[0]; XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); #ifdef DEBUG - for (i = 0; /* Also program the virtual address. */ + for (i = 0; /* Also program the logical MAC address. */ i < pAPort->NextExactMatchRlmt; i++) { SK_U8 InAddr8[6]; SK_U16 *InAddr; /* Get exact match address i from port PortIdx. */ - InAddr = (SK_U16 *)&InAddr8[0]; XM_INADDR(IoC, PortIdx, XM_EXM(i), InAddr); SK_DBG_MSG( @@ -880,10 +817,6 @@ #endif /* DEBUG */ /* Determine return value. */ - - for (Inexact = 0, i = 0; i < 8; i++) { - Inexact |= pAPort->InexactFilter.Bytes[i]; - } if (Inexact == 0 && pAPort->PromMode == 0) { return (SK_MC_FILTERING_EXACT); } @@ -915,7 +848,7 @@ SK_IOC IoC, /* I/O context */ SK_U32 PortIdx, /* Port Index */ SK_MAC_ADDR *pNewAddr, /* new MAC address */ -int Flags) /* logical/physical address */ +int Flags) /* logical/physical MAC address */ { SK_U32 i; SK_U16 *OutAddr; @@ -957,7 +890,7 @@ return (SK_ADDR_TOO_EARLY); } - if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical address. */ + if (Flags & SK_ADDR_PHYSICAL_ADDRESS) { /* Physical MAC address. */ if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { return (SK_ADDR_DUPLICATE_ADDRESS); } @@ -984,16 +917,14 @@ pAC->Addr.Port[PortIdx].CurrentMacAddress = *pNewAddr; /* Change port's address. */ - OutAddr = (SK_U16 *)pNewAddr; XM_OUTADDR(IoC, PortIdx, XM_SA, OutAddr); /* Report address change to RLMT. */ - Para.Para32[0] = PortIdx; SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_PORT_ADDR, Para); } - else { /* Logical Address. */ + else { /* Logical MAC address. */ if (SK_ADDR_EQUAL(pNewAddr->a, pAC->Addr.CurrentMacAddress.a)) { return (SK_ADDR_SUCCESS); } @@ -1019,27 +950,26 @@ SK_DBGMOD_ADDR, SK_DBGCAT_CTRL, ("Permanent MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.PermanentMacAddress.a[0], - pAC->Addr.PermanentMacAddress.a[1], - pAC->Addr.PermanentMacAddress.a[2], - pAC->Addr.PermanentMacAddress.a[3], - pAC->Addr.PermanentMacAddress.a[4], - pAC->Addr.PermanentMacAddress.a[5])) + pAC->Addr.PermanentMacAddress.a[0], + pAC->Addr.PermanentMacAddress.a[1], + pAC->Addr.PermanentMacAddress.a[2], + pAC->Addr.PermanentMacAddress.a[3], + pAC->Addr.PermanentMacAddress.a[4], + pAC->Addr.PermanentMacAddress.a[5])) SK_DBG_MSG( pAC, SK_DBGMOD_ADDR, SK_DBGCAT_CTRL, - ("New Virtual MAC Address: %02X %02X %02X %02X %02X %02X\n", - pAC->Addr.CurrentMacAddress.a[0], - pAC->Addr.CurrentMacAddress.a[1], - pAC->Addr.CurrentMacAddress.a[2], - pAC->Addr.CurrentMacAddress.a[3], - pAC->Addr.CurrentMacAddress.a[4], - pAC->Addr.CurrentMacAddress.a[5])) + ("New logical MAC Address: %02X %02X %02X %02X %02X %02X\n", + pAC->Addr.CurrentMacAddress.a[0], + pAC->Addr.CurrentMacAddress.a[1], + pAC->Addr.CurrentMacAddress.a[2], + pAC->Addr.CurrentMacAddress.a[3], + pAC->Addr.CurrentMacAddress.a[4], + pAC->Addr.CurrentMacAddress.a[5])) #endif /* DEBUG */ /* Write address to first exact match entry of active port. */ - (void)SkAddrMcUpdate(pAC, IoC, PortIdx); } @@ -1066,25 +996,24 @@ * SK_ADDR_ILLEGAL_PORT */ int SkAddrPromiscuousChange( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* I/O context */ -SK_U32 PortIdx, /* port whose promiscuous mode changes */ -int NewPromMode) /* new promiscuous mode */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ +SK_U32 PortIdx, /* port whose promiscuous mode changes */ +int NewPromMode) /* new promiscuous mode */ { - int i; + int i; SK_BOOL InexactModeBit; SK_U8 Inexact; SK_U8 HwInexact; SK_FILTER64 HwInexactFilter; SK_U16 LoMode; /* Lower 16 bits of XMAC Mode Register. */ - int CurPromMode = SK_PROM_MODE_NONE; + int CurPromMode = SK_PROM_MODE_NONE; if (PortIdx >= (SK_U32)pAC->GIni.GIMacsFound) { return (SK_ADDR_ILLEGAL_PORT); } /* Read CurPromMode from Hardware. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); if (LoMode & XM_MD_ENA_PROM) { @@ -1095,18 +1024,15 @@ Inexact &= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; } if (Inexact == 0xFF) { - CurPromMode |= (pAC->Addr.Port[PortIdx].PromMode & - SK_PROM_MODE_ALL_MC); + CurPromMode |= (pAC->Addr.Port[PortIdx].PromMode & SK_PROM_MODE_ALL_MC); } else { /* Read InexactModeBit (bit 15 in mode register). */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); - - InexactModeBit = (LoMode & XM_MD_ENA_HSH) != 0; + + InexactModeBit = (LoMode & XM_MD_ENA_HSH) != 0; /* Read 64-bit hash register from HW. */ - XM_INHASH(IoC, PortIdx, XM_HSM, &HwInexactFilter.Bytes[0]); for (HwInexact = 0xFF, i = 0; i < 8; i++) { @@ -1126,43 +1052,34 @@ if ((NewPromMode & SK_PROM_MODE_ALL_MC) && !(CurPromMode & SK_PROM_MODE_ALL_MC)) { /* All MC. */ - /* Set all bits in 64-bit hash register. */ - XM_OUTHASH(IoC, PortIdx, XM_HSM, &OnesHash); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else if ((CurPromMode & SK_PROM_MODE_ALL_MC) && !(NewPromMode & SK_PROM_MODE_ALL_MC)) { /* Norm MC. */ - for (Inexact = 0, i = 0; i < 8; i++) { - Inexact |= - pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; + Inexact |= pAC->Addr.Port[PortIdx].InexactFilter.Bytes[i]; } if (Inexact == 0) { /* Clear bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode &= ~XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else { /* Set 64-bit hash register to InexactFilter. */ - XM_OUTHASH( IoC, PortIdx, XM_HSM, - &pAC->Addr.Port[PortIdx - ].InexactFilter.Bytes[0]); + &pAC->Addr.Port[PortIdx].InexactFilter.Bytes[0]); /* Set bit 15 in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); LoMode |= XM_MD_ENA_HSH; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); @@ -1171,29 +1088,27 @@ if ((NewPromMode & SK_PROM_MODE_LLC) && !(CurPromMode & SK_PROM_MODE_LLC)) { /* Prom. LLC */ - /* Set promiscuous bit in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + #if 0 /* Receive MAC frames. */ - LoMode |= XM_MD_RX_MCTRL; #endif /* 0 */ + LoMode |= XM_MD_ENA_PROM; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } else if ((CurPromMode & SK_PROM_MODE_LLC) && !(NewPromMode & SK_PROM_MODE_LLC)) { /* Norm. LLC. */ - /* Clear promiscuous bit in mode register. */ - XM_IN16(IoC, PortIdx, XM_MODE, &LoMode); + #if 0 /* Don't receive MAC frames. */ - LoMode &= ~XM_MD_RX_MCTRL; #endif /* 0 */ + LoMode &= ~XM_MD_ENA_PROM; XM_OUT16(IoC, PortIdx, XM_MODE, LoMode); } @@ -1218,12 +1133,12 @@ * SK_ADDR_ILLEGAL_PORT */ int SkAddrSwap( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* I/O context */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* I/O context */ SK_U32 FromPortIdx, /* Port1 Index */ -SK_U32 ToPortIdx) /* Port2 Index */ +SK_U32 ToPortIdx) /* Port2 Index */ { - int i; + int i; SK_U8 Byte; SK_MAC_ADDR MacAddr; SK_U32 DWord; @@ -1263,8 +1178,7 @@ } i = pAC->Addr.Port[FromPortIdx].PromMode; - pAC->Addr.Port[FromPortIdx].PromMode = - pAC->Addr.Port[ToPortIdx].PromMode; + pAC->Addr.Port[FromPortIdx].PromMode = pAC->Addr.Port[ToPortIdx].PromMode; pAC->Addr.Port[ToPortIdx].PromMode = i; DWord = pAC->Addr.Port[FromPortIdx].FirstExactMatchRlmt; @@ -1287,7 +1201,7 @@ pAC->Addr.Port[ToPortIdx].NextExactMatchDrv; pAC->Addr.Port[ToPortIdx].NextExactMatchDrv = DWord; - pAC->Addr.ActivePort = ToPortIdx; + pAC->Addr.ActivePort = ToPortIdx; (void)SkAddrMcUpdate(pAC, IoC, FromPortIdx); (void)SkAddrMcUpdate(pAC, IoC, ToPortIdx); @@ -1298,3 +1212,4 @@ #ifdef __cplusplus } #endif /* __cplusplus */ + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skcsum.c linux/drivers/net/sk98lin/skcsum.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skcsum.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skcsum.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skcsum.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.3 $ - * Date: $Date: 1999/05/10 08:39:33 $ + * Version: $Revision: 1.7 $ + * Date: $Date: 2000/06/29 13:17:05 $ * Purpose: Store/verify Internet checksum in send/receive packets. * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,23 @@ * History: * * $Log: skcsum.c,v $ + * Revision 1.7 2000/06/29 13:17:05 rassmann + * Corrected reception of a packet with UDP checksum == 0 (which means there + * is no UDP checksum). + * + * Revision 1.6 2000/02/21 12:35:10 cgoos + * Fixed license header comment. + * + * Revision 1.5 2000/02/21 11:05:19 cgoos + * Merged changes back to common source. + * Fixed rx path for BIG ENDIAN architecture. + * + * Revision 1.1 1999/07/26 15:28:12 mkarl + * added return SKCS_STATUS_IP_CSUM_ERROR_UDP and + * SKCS_STATUS_IP_CSUM_ERROR_TCP to pass the NidsTester + * changed from common source to windows specific source + * therefore restarting with v1.0 + * * Revision 1.3 1999/05/10 08:39:33 mkarl * prevent overflows in SKCS_HTON16 * fixed a bug in pseudo header checksum calculation @@ -48,7 +63,7 @@ #ifndef lint static const char SysKonnectFileId[] = "@(#)" - "$Id: skcsum.c,v 1.3 1999/05/10 08:39:33 mkarl Exp $" + "$Id: skcsum.c,v 1.7 2000/06/29 13:17:05 rassmann Exp $" " (C) SysKonnect."; #endif /* !lint */ @@ -94,13 +109,13 @@ /* defines ********************************************************************/ /* The size of an Ethernet MAC header. */ -#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2) +#define SKCS_ETHERNET_MAC_HEADER_SIZE (6+6+2) /* The size of the used topology's MAC header. */ #define SKCS_MAC_HEADER_SIZE SKCS_ETHERNET_MAC_HEADER_SIZE /* The size of the IP header without any option fields. */ -#define SKCS_IP_HEADER_SIZE 20 +#define SKCS_IP_HEADER_SIZE 20 /* * Field offsets within the IP header. @@ -110,23 +125,31 @@ #define SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH 0 /* "Total Length". */ -#define SKCS_OFS_IP_TOTAL_LENGTH 2 +#define SKCS_OFS_IP_TOTAL_LENGTH 2 /* "Flags" "Fragment Offset". */ #define SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET 6 /* "Next Level Protocol" identifier. */ -#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9 +#define SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL 9 /* Source IP address. */ -#define SKCS_OFS_IP_SOURCE_ADDRESS 12 +#define SKCS_OFS_IP_SOURCE_ADDRESS 12 /* Destination IP address. */ -#define SKCS_OFS_IP_DESTINATION_ADDRESS 16 +#define SKCS_OFS_IP_DESTINATION_ADDRESS 16 + + +/* + * Field offsets within the UDP header. + */ + +/* UDP checksum. */ +#define SKCS_OFS_UDP_CHECKSUM 6 /* IP "Next Level Protocol" identifiers (see RFC 790). */ -#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */ -#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */ +#define SKCS_PROTO_ID_TCP 6 /* Transport Control Protocol */ +#define SKCS_PROTO_ID_UDP 17 /* User Datagram Protocol */ /* IP "Don't Fragment" bit. */ #define SKCS_IP_DONT_FRAGMENT SKCS_HTON16(0x4000) @@ -224,8 +247,8 @@ * of the TCP or UDP pseudo header is returned here. */ void SkCsGetSendInfo( -SK_AC *pAc, /* Adapter context struct. */ -void *pIpHeader, /* IP header. */ +SK_AC *pAc, /* Adapter context struct. */ +void *pIpHeader, /* IP header. */ SKCS_PACKET_INFO *pPacketInfo) /* Packet information struct. */ { /* Internet Header Version found in IP header. */ @@ -397,7 +420,8 @@ SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0); NextLevelProtoStats->TxOkCts++; /* Success. */ -} +} /* SkCsGetSendInfo */ + /****************************************************************************** * @@ -415,7 +439,8 @@ * pAc - Pointer to adapter context struct. * * pIpHeader - Pointer to IP header. Must be at least the length in bytes - * of the received IP header including any option fields. + * of the received IP header including any option fields. For UDP packets, + * 8 additional bytes are needed to access the UDP checksum. * * Note: The actual length of the IP header is stored in the lower four * bits of the first octet of the IP header as the number of 4-byte words, @@ -431,18 +456,20 @@ * Returns: * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. + * SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame. + * SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. + * SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum. * - * Note: The SKCS_STATUS_XXX values returned here are *not* defined by - * the CSUM module but must be defined in some header file by the module - * using CSUM. In this way, the calling module can assign return values - * for its own needs, e.g. by assigning bit flags to the individual - * protocols. + * Note: If SKCS_OVERWRITE_STATUS is defined, the SKCS_STATUS_XXX values + * returned here can be defined in some header file by the module using CSUM. + * In this way, the calling module can assign return values for its own needs, + * e.g. by assigning bit flags to the individual protocols. */ SKCS_STATUS SkCsGetReceiveInfo( SK_AC *pAc, /* Adapter context struct. */ @@ -544,30 +571,36 @@ /* Adjust the IP header and IP data checksums. */ - SKCS_OC_ADD(IpHeaderChecksum, - IpHeaderChecksum, IpOptionsChecksum); + SKCS_OC_ADD(IpHeaderChecksum, IpHeaderChecksum, IpOptionsChecksum); - SKCS_OC_SUB(IpDataChecksum, - IpDataChecksum, IpOptionsChecksum); + SKCS_OC_SUB(IpDataChecksum, IpDataChecksum, IpOptionsChecksum); } - /* Check if the IP header checksum is ok. */ /* - * NOTE: We must check the IP header checksum even if the caller does - * not want us to do so because we cannot do any further processing of - * the packet without a valid IP checksum. + * Check if the IP header checksum is ok. + * + * NOTE: We must check the IP header checksum even if the caller just wants + * us to check upper-layer checksums, because we cannot do any further + * processing of the packet without a valid IP checksum. */ + + /* Get the next level protocol identifier. */ + + NextLevelProtocol = *(SK_U8 *) + SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); if (IpHeaderChecksum != 0xFFFF) { pAc->Csum.ProtoStats[SKCS_PROTO_STATS_IP].RxErrCts++; + /* the NDIS tester wants to know the upper level protocol too */ + if (NextLevelProtocol == SKCS_PROTO_ID_TCP) { + return(SKCS_STATUS_IP_CSUM_ERROR_TCP); + } + else if (NextLevelProtocol == SKCS_PROTO_ID_UDP) { + return(SKCS_STATUS_IP_CSUM_ERROR_UDP); + } return (SKCS_STATUS_IP_CSUM_ERROR); } - /* Get the next level protocol identifier. */ - - NextLevelProtocol = - *(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); - /* * Check if this is a TCP or UDP frame and if we should calculate the * TCP/UDP pseudo header checksum. @@ -579,14 +612,12 @@ if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_TCP) != 0 && NextLevelProtocol == SKCS_PROTO_ID_TCP) { /* TCP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; + NextLevelProtoStats = &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_TCP]; } else if ((pAc->Csum.ReceiveFlags & SKCS_PROTO_UDP) != 0 && NextLevelProtocol == SKCS_PROTO_ID_UDP) { /* UDP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; + NextLevelProtoStats = &pAc->Csum.ProtoStats[SKCS_PROTO_STATS_UDP]; } else { /* @@ -615,6 +646,24 @@ } /* + * 08-May-2000 ra + * + * From RFC 768 (UDP) + * If the computed checksum is zero, it is transmitted as all ones (the + * equivalent in one's complement arithmetic). An all zero transmitted + * checksum value means that the transmitter generated no checksum (for + * debugging or for higher level protocols that don't care). + */ + + if (NextLevelProtocol == SKCS_PROTO_ID_UDP && + *(SK_U16*)SKCS_IDX(pIpHeader, IpHeaderLength + 6) == 0x0000) { + + NextLevelProtoStats->RxOkCts++; + + return (SKCS_STATUS_IP_CSUM_OK_NO_UDP); + } + + /* * Calculate the TCP/UDP checksum. */ @@ -639,7 +688,7 @@ SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + - (unsigned long) (NextLevelProtocol << 8) + + (unsigned long) SKCS_HTON16(NextLevelProtocol) + (unsigned long) SKCS_HTON16(IpDataLength) + /* Add the TCP/UDP header checksum. */ @@ -672,7 +721,8 @@ return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? SKCS_STATUS_TCP_CSUM_ERROR : SKCS_STATUS_UDP_CSUM_ERROR); -} +} /* SkCsGetReceiveInfo */ + /****************************************************************************** * @@ -702,7 +752,7 @@ * Returns the two hardware checksum start offsets. */ void SkCsSetReceiveFlags( -SK_AC *pAc, /* Adapter context struct. */ +SK_AC *pAc, /* Adapter context struct. */ unsigned ReceiveFlags, /* New receive flags. */ unsigned *pChecksum1Offset, /* Offset for hardware checksum 1. */ unsigned *pChecksum2Offset) /* Offset for hardware checksum 2. */ @@ -719,9 +769,10 @@ * if there are any IP header options in the actual packet. */ *pChecksum2Offset = SKCS_MAC_HEADER_SIZE + SKCS_IP_HEADER_SIZE; -} +} /* SkCsSetReceiveFlags */ #ifndef SkCsCalculateChecksum + /****************************************************************************** * * SkCsCalculateChecksum - calculate checksum for specified data @@ -783,7 +834,8 @@ /* Note: All bits beyond the 16-bit limit are now zero. */ return ((unsigned) Checksum); -} +} /* SkCsCalculateChecksum */ + #endif /* SkCsCalculateChecksum */ /****************************************************************************** @@ -833,7 +885,7 @@ memset(&pAc->Csum.ProtoStats[0], 0, sizeof(pAc->Csum.ProtoStats)); } - else { /* Clear for individual protocol. */ + else { /* Clear for individual protocol. */ memset(&pAc->Csum.ProtoStats[ProtoIndex], 0, sizeof(pAc->Csum.ProtoStats[ProtoIndex])); } @@ -842,6 +894,6 @@ break; } return (0); /* Success. */ -} +} /* SkCsEvent */ #endif /* SK_USE_CSUM */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skge.c linux/drivers/net/sk98lin/skge.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skge.c Sun Aug 6 22:20:09 2000 +++ linux/drivers/net/sk98lin/skge.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skge.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.27 $ - * Date: $Date: 1999/11/25 09:06:28 $ + * Version: $Revision: 1.29 $ + * Date: $Date: 2000/02/21 13:31:56 $ * Purpose: The main driver source module * ******************************************************************************/ @@ -46,6 +46,25 @@ * History: * * $Log: skge.c,v $ + * Kernel 2.4.x specific: + * Revision 1.xx 2000/09/12 13:31:56 cgoos + * Fixed missign "dev=NULL in skge_probe. + * Added counting for jumbo frames (corrects error statistic). + * Removed VLAN tag check (enables VLAN support). + * + * Kernel 2.2.x specific: + * Revision 1.29 2000/02/21 13:31:56 cgoos + * Fixed "unused" warning for UltraSPARC change. + * + * Partially kernel 2.2.x specific: + * Revision 1.28 2000/02/21 10:32:36 cgoos + * Added fixes for UltraSPARC. + * Now printing RlmtMode and PrefPort setting at startup. + * Changed XmitFrame return value. + * Fixed rx checksum calculation for BIG ENDIAN systems. + * Fixed rx jumbo frames counted as ierrors. + * + * * Revision 1.27 1999/11/25 09:06:28 cgoos * Changed base_addr to unsigned long. * @@ -225,7 +244,7 @@ static const char SysKonnectFileId[] = "@(#)" __FILE__ " (C) SysKonnect."; static const char SysKonnectBuildNumber[] = - "@(#)SK-BUILD: 3.02 (19991111) PL: 01"; + "@(#)SK-BUILD: 3.05 (20000907) PL: 01"; #include #include @@ -235,10 +254,10 @@ /* defines ******************************************************************/ -#define BOOT_STRING "sk98lin: Network Device Driver v3.02\n" \ - "Copyright (C) 1999 SysKonnect" +#define BOOT_STRING "sk98lin: Network Device Driver v3.05\n" \ + "Copyright (C) 1999-2000 SysKonnect" -#define VER_STRING "3.02" +#define VER_STRING "3.05" /* for debuging on x86 only */ @@ -373,6 +392,8 @@ PCI_DEVICE_ID_SYSKONNECT_GE, pdev)) != NULL) { if (pci_enable_device(pdev)) continue; + + dev = NULL; dev = init_etherdev(dev, sizeof(SK_AC)); if (dev == NULL) { @@ -785,6 +806,14 @@ ProductStr(pAC); printk("%s: %s\n", dev->name, pAC->DeviceStr); + /* Print configuration settings */ + printk(" PrefPort:%c RlmtMode:%s\n", + 'A' + pAC->Rlmt.PrefPort, + (pAC->RlmtMode==0) ? "ChkLink" : + ((pAC->RlmtMode==1) ? "ChkLink" : + ((pAC->RlmtMode==3) ? "ChkOth" : + ((pAC->RlmtMode==7) ? "ChkSeg" : "Error")))); + SkGeYellowLED(pAC, pAC->IoBase, 1); /* @@ -1936,6 +1965,10 @@ } /* frame > SK_COPY_TRESHOLD */ FrameStat = pRxd->FrameStat; + if ((FrameStat & XMR_FS_LNG_ERR) != 0) { + /* jumbo frame, count to correct statistic */ + SK_PNMI_CNT_RX_LONGFRAMES(pAC, pRxPort->PortIndex); + } pRxd = pRxd->pNextRxd; pRxPort->pRxdRingHead = pRxd; pRxPort->RxdRingFree ++; @@ -1947,9 +1980,9 @@ pRxPort->RxdRingFree)); if ((Control & RX_CTRL_STAT_VALID) == RX_CTRL_STAT_VALID && - (FrameStat & - (XMR_FS_ANY_ERR | XMR_FS_1L_VLAN | XMR_FS_2L_VLAN)) - == 0) { + (FrameStat & XMR_FS_ANY_ERR) == 0) { + // was the following, changed to allow VLAN support + // (XMR_FS_ANY_ERR | XMR_FS_1L_VLAN | XMR_FS_2L_VLAN) SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS,("V")); ForRlmt = SK_RLMT_RX_PROTOCOL; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgehwt.c linux/drivers/net/sk98lin/skgehwt.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgehwt.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skgehwt.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgehwt.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.12 $ - * Date: $Date: 1998/10/15 15:11:34 $ + * Version: $Revision: 1.13 $ + * Date: $Date: 1999/11/22 13:31:12 $ * Purpose: Hardware Timer. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,9 @@ * History: * * $Log: skgehwt.c,v $ + * Revision 1.13 1999/11/22 13:31:12 cgoos + * Changed license header to GPL. + * * Revision 1.12 1998/10/15 15:11:34 gklug * fix: ID_sccs to SysKonnectFileId * @@ -76,7 +77,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.12 1998/10/15 15:11:34 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/skgehwt.c,v 1.13 1999/11/22 13:31:12 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgeinit.c linux/drivers/net/sk98lin/skgeinit.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgeinit.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skgeinit.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skgeinit.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.54 $ - * Date: $Date: 1999/10/26 07:32:54 $ + * Version: $Revision: 1.57 $ + * Date: $Date: 2000/08/03 14:55:28 $ * Purpose: Contains functions to initialize the GE HW * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,16 @@ * History: * * $Log: skgeinit.c,v $ + * Revision 1.57 2000/08/03 14:55:28 rassmann + * Waiting for I2C to be ready before de-initializing adapter + * (prevents sensors from hanging up). + * + * Revision 1.56 2000/07/27 12:16:48 gklug + * fix: Stop Port check of the STOP bit does now take 2/18 sec as wanted + * + * Revision 1.55 1999/11/22 13:32:26 cgoos + * Changed license header to GPL. + * * Revision 1.54 1999/10/26 07:32:54 malthoff * Initialize PHWLinkUp with SK_FALSE. Required for Diagnostics. * @@ -199,7 +207,7 @@ * DoInitRamQueue(), and SkGeCfgSync(). * Add coding for SkGeInitMacArb(), SkGeInitPktArb(), * SkGeInitMacFifo(), SkGeInitRamBufs(), - * SkGeInitRamIface(), and SkGeInitBmu(). + * SkGeInitRamIface(), and SkGeInitBmu(). * * Revision 1.11 1998/09/29 08:26:29 malthoff * bug fix: SkGeInit0() 'i' should be increment. @@ -275,7 +283,7 @@ /* local variables ************************************************************/ static const char SysKonnectFileId[] = - "@(#)$Id: skgeinit.c,v 1.54 1999/10/26 07:32:54 malthoff Exp $ (C) SK "; + "@(#)$Id: skgeinit.c,v 1.57 2000/08/03 14:55:28 rassmann Exp $ (C) SK "; struct s_QOffTab { int RxQOff; /* Receive Queue Address Offset */ @@ -283,7 +291,7 @@ int XaQOff; /* Async Tx Queue Address Offset */ }; static struct s_QOffTab QOffTab[] = { - { Q_R1, Q_XS1, Q_XA1 }, { Q_R2, Q_XS2, Q_XA2 } + {Q_R1, Q_XS1, Q_XA1}, {Q_R2, Q_XS2, Q_XA2} }; @@ -303,7 +311,7 @@ void SkGePollRxD( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_BOOL PollRxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ { SK_GEPORT *pPrt; @@ -311,12 +319,13 @@ pPrt = &pAC->GIni.GP[Port]; if (PollRxD) { - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_ENA_POL); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_ENA_POL); } else { - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_DIS_POL); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_DIS_POL); } -} +} /* SkGePollRxD */ + /****************************************************************************** * @@ -334,7 +343,7 @@ void SkGePollTxD( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_BOOL PollTxD) /* SK_TRUE (enable pol.), SK_FALSE (disable pol.) */ { SK_GEPORT *pPrt; @@ -350,12 +359,12 @@ } if (pPrt->PXSQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), DWord); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), DWord); } if (pPrt->PXAQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), DWord); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), DWord); } -} +} /* SkGePollTxD */ /****************************************************************************** @@ -374,17 +383,18 @@ void SkGeYellowLED( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int State) /* yellow LED state, 0 = OFF, 0 != ON */ +int State) /* yellow LED state, 0 = OFF, 0 != ON */ { if (State == 0) { /* Switch yellow LED OFF */ - SK_OUT8(IoC, B0_LED, LED_STAT_OFF) ; + SK_OUT8(IoC, B0_LED, LED_STAT_OFF); } else { /* Switch yellow LED ON */ - SK_OUT8(IoC, B0_LED, LED_STAT_ON) ; + SK_OUT8(IoC, B0_LED, LED_STAT_ON); } -} +} /* SkGeYellowLED */ + /****************************************************************************** * @@ -398,7 +408,7 @@ * 'Led' must contain the address offset of the LEDs INI register. * * Usage: - * SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); + * SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_ENA); * * Returns: * nothing @@ -406,31 +416,31 @@ void SkGeXmitLED( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Led, /* offset to the LED Init Value register */ -int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */ +int Led, /* offset to the LED Init Value register */ +int Mode) /* Mode may be SK_LED_DIS, SK_LED_ENA, SK_LED_TST */ { SK_U32 LedIni; switch (Mode) { case SK_LED_ENA: LedIni = SK_XMIT_DUR * (SK_U32)pAC->GIni.GIHstClkFact / 100; - SK_OUT32(IoC, Led+XMIT_LED_INI, LedIni); - SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); - break ; + SK_OUT32(IoC, Led + XMIT_LED_INI, LedIni); + SK_OUT8(IoC, Led + XMIT_LED_CTRL, LED_START); + break; case SK_LED_TST: - SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_ON); - SK_OUT32(IoC, Led+XMIT_LED_CNT, 100); - SK_OUT8(IoC, Led+XMIT_LED_CTRL, LED_START); - break ; + SK_OUT8(IoC, Led + XMIT_LED_TST, LED_T_ON); + SK_OUT32(IoC, Led + XMIT_LED_CNT, 100); + SK_OUT8(IoC, Led + XMIT_LED_CTRL, LED_START); + break; case SK_LED_DIS: default: /* * Do NOT stop the LED Timer here. The LED might be * in on state. But it needs to go off. */ - SK_OUT32(IoC, Led+XMIT_LED_CNT, 0); - SK_OUT8(IoC, Led+XMIT_LED_TST, LED_T_OFF); - break ; + SK_OUT32(IoC, Led + XMIT_LED_CNT, 0); + SK_OUT8(IoC, Led + XMIT_LED_TST, LED_T_OFF); + break; } /* @@ -440,7 +450,8 @@ * (Broadcom: It may be that PHY_B_PEC_EN_LTR has to be set.) * (In this case it has to be added here. But we will see. XXX) */ -} +} /* SkGeXmitLED */ + /****************************************************************************** * @@ -461,12 +472,12 @@ * 1: configuration error */ static int DoCalcAddr( -SK_AC *pAC, /* adapter context */ -SK_GEPORT *pPrt, /* port index */ -int QuSize, /* size of the queue to configure in kB */ -SK_U32 *StartVal, /* start value for address calculation */ -SK_U32 *QuStartAddr, /* start addr to calculate */ -SK_U32 *QuEndAddr) /* end address to calculate */ +SK_AC *pAC, /* adapter context */ +SK_GEPORT *pPrt, /* port index */ +int QuSize, /* size of the queue to configure in kB */ +SK_U32 *StartVal, /* start value for address calculation */ +SK_U32 *QuStartAddr, /* start addr to calculate */ +SK_U32 *QuEndAddr) /* end address to calculate */ { SK_U32 EndVal; SK_U32 NextStart; @@ -494,7 +505,7 @@ *StartVal = NextStart; return (Rtv); -} +} /* DoCalcAddr */ /****************************************************************************** @@ -521,8 +532,8 @@ * 1: Queue Size Configuration invalid */ static int SkGeCheckQSize( -SK_AC *pAC, /* adapter context */ -int Port) /* port index */ +SK_AC *pAC, /* adapter context */ +int Port) /* port index */ { SK_GEPORT *pPrt; int UsedMem; @@ -540,9 +551,7 @@ (pPrt->PXSQSize & QZ_UNITS) || (pPrt->PXAQSize & QZ_UNITS)) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E012, - SKERR_HWI_E012MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E012, SKERR_HWI_E012MSG); Rtv = 1; goto CheckQSizeEnd; } @@ -550,9 +559,7 @@ UsedMem += pPrt->PRxQSize + pPrt->PXSQSize + pPrt->PXAQSize; if (i == Port && pPrt->PRxQSize < SK_MIN_RXQ_SIZE) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E011, - SKERR_HWI_E011MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E011, SKERR_HWI_E011MSG); Rtv = 1; goto CheckQSizeEnd; } @@ -584,17 +591,15 @@ Rtv |= Rtv2; if (Rtv) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, - SKERR_HWI_E013, - SKERR_HWI_E013MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E013, SKERR_HWI_E013MSG); break; } } - CheckQSizeEnd: return (Rtv); -} +} /* SkGeCheckQSize */ + /****************************************************************************** * @@ -633,7 +638,8 @@ * There is not start or enable buttom to push, therefore * the MAC arbiter is configured and enabled now. */ -} +} /* SkGeInitMacArb */ + /****************************************************************************** * @@ -666,10 +672,11 @@ SK_OUT16(IoC, B3_PA_CTRL, PA_ENA_TO_TX1); } else { - SK_OUT16(IoC, B3_PA_CTRL,(PA_ENA_TO_TX1|PA_ENA_TO_TX2)); + SK_OUT16(IoC, B3_PA_CTRL,(PA_ENA_TO_TX1 | PA_ENA_TO_TX2)); } } -} +} /* SkGeInitPktArb */ + /****************************************************************************** * @@ -684,7 +691,7 @@ static void SkGeInitMacFifo( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { /* * For each FIFO: @@ -707,7 +714,8 @@ if (pAC->GIni.GIPortUsage == SK_JUMBO_LINK) { SK_OUT16(IoC, MR_ADDR(Port, RX_MFF_CTRL1), MFF_ENA_FLUSH); } -} +} /* SkGeInitMacFifo */ + /****************************************************************************** * @@ -731,7 +739,7 @@ void SkGeLoadLnkSyncCnt( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_U32 CntVal) /* Counter value */ { SK_U32 OrgIMsk; @@ -740,7 +748,7 @@ SK_BOOL IrqPend; /* stop counter */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_STOP); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_STOP); /* * ASIC problem: @@ -770,17 +778,18 @@ } /* load counter */ - SK_OUT32(IoC, MR_ADDR(Port,LNK_SYNC_INI), CntVal); + SK_OUT32(IoC, MR_ADDR(Port, LNK_SYNC_INI), CntVal); /* start counter */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_START); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_START); if (!IrqPend) { /* clear the unexpected IRQ, and restore the interrupt mask */ - SK_OUT8(IoC, MR_ADDR(Port,LNK_SYNC_CTRL), LED_CLR_IRQ); + SK_OUT8(IoC, MR_ADDR(Port, LNK_SYNC_CTRL), LED_CLR_IRQ); SK_OUT32(IoC, B0_IMSK, OrgIMsk); } -} +} /* SkGeLoadLnkSyncCnt*/ + /****************************************************************************** * @@ -813,10 +822,10 @@ int SkGeCfgSync( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port, /* Port Index (MAC_1 + n) */ +int Port, /* Port Index (MAC_1 + n) */ SK_U32 IntTime, /* Interval Timer Value in units of 8ns */ SK_U32 LimCount, /* Number of bytes to transfer during IntTime */ -int SyncMode) /* Sync Mode: TXA_ENA_ALLOC | TXA_DIS_ALLOC | 0 */ +int SyncMode) /* Sync Mode: TXA_ENA_ALLOC | TXA_DIS_ALLOC | 0 */ { int Rtv; @@ -836,8 +845,7 @@ IntTime = (IntTime / 2) * pAC->GIni.GIHstClkFact / 100; LimCount = LimCount / 8; if (IntTime > TXA_MAX_VAL || LimCount > TXA_MAX_VAL) { - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, - SKERR_HWI_E010MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E010, SKERR_HWI_E010MSG); Rtv = 1; goto CfgSyncEnd; } @@ -852,14 +860,14 @@ * - start 'Rate Control' and disable 'Force Sync' * if Interval Timer or Limit Counter not zero. */ - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_ENA_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); - SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), IntTime); - SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), LimCount); - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), IntTime); + SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), LimCount); + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), (SyncMode & (TXA_ENA_ALLOC|TXA_DIS_ALLOC))); if (IntTime != 0 || LimCount != 0) { - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_DIS_FSYNC|TXA_START_RC); } } @@ -870,7 +878,8 @@ CfgSyncEnd: return (Rtv); -} +} /* SkGeCfgSync */ + /****************************************************************************** * @@ -884,12 +893,12 @@ * nothing */ static void DoInitRamQueue( -SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* IO context */ -int QuIoOffs, /* Queue IO Address Offset */ +SK_AC *pAC, /* adapter context */ +SK_IOC IoC, /* IO context */ +int QuIoOffs, /* Queue IO Address Offset */ SK_U32 QuStartAddr, /* Queue Start Address */ -SK_U32 QuEndAddr, /* Queue End Address */ -int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */ +SK_U32 QuEndAddr, /* Queue End Address */ +int QuType) /* Queue Type (SK_RX_SRAM_Q|SK_RX_BRAM_Q|SK_TX_RAM_Q) */ { SK_U32 RxUpThresVal; SK_U32 RxLoThresVal; @@ -904,13 +913,13 @@ QuEndAddr = QuEndAddr / 8; /* release local reset */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_CLR); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_RST_CLR); /* configure addresses */ - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_START), QuStartAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_END), QuEndAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_WP), QuStartAddr); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RP), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_START), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_END), QuEndAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_WP), QuStartAddr); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RP), QuStartAddr); switch (QuType) { case SK_RX_SRAM_Q: @@ -921,10 +930,9 @@ case SK_RX_BRAM_Q: /* write threshold for Rx Queue */ - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_UTPP), - RxUpThresVal); - SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_LTPP), - RxLoThresVal); + SK_OUT32(IoC, RB_ADDR(QuIoOffs, RB_RX_UTPP), RxUpThresVal); + SK_OUT32(IoC, RB_ADDR(QuIoOffs,RB_RX_LTPP), RxLoThresVal); + /* the high priority threshold not used */ break; case SK_TX_RAM_Q: @@ -939,20 +947,20 @@ * enable Store & Forward Mode for the * Tx Side */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), - RB_ENA_STFWD); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_ENA_STFWD); } break; } /* set queue operational */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_ENA_OP_MD); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_ENA_OP_MD); } else { /* ensure the queue is still disabled */ - SK_OUT8(IoC, RB_ADDR(QuIoOffs,RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, RB_ADDR(QuIoOffs, RB_CTRL), RB_RST_SET); } -} +} /* DoInitRamQueue*/ + /****************************************************************************** * @@ -967,7 +975,7 @@ static void SkGeInitRamBufs( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { SK_GEPORT *pPrt; int RxQType; @@ -987,7 +995,8 @@ pPrt->PXsQRamEnd, SK_TX_RAM_Q); DoInitRamQueue(pAC, IoC, pPrt->PXaQOff, pPrt->PXaQRamStart, pPrt->PXaQRamEnd, SK_TX_RAM_Q); -} +} /* SkGeInitRamBufs */ + /****************************************************************************** * @@ -1022,7 +1031,8 @@ SK_OUT8(IoC, B3_RI_RTO_R2, SK_RI_TO_53); SK_OUT8(IoC, B3_RI_RTO_XA2, SK_RI_TO_53); SK_OUT8(IoC, B3_RI_RTO_XS2, SK_RI_TO_53); -} +} /* SkGeInitRamIface */ + /****************************************************************************** * @@ -1037,33 +1047,34 @@ static void SkGeInitBmu( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port Index (MAC_1 + n) */ +int Port) /* Port Index (MAC_1 + n) */ { SK_GEPORT *pPrt; pPrt = &pAC->GIni.GP[Port]; /* Rx Queue: Release all local resets and set the watermark */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_F), SK_BMU_RX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_F), SK_BMU_RX_WM); /* * Tx Queue: Release all local resets if the queue is used! * set watermark */ if (pPrt->PXSQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_F), SK_BMU_TX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_F), SK_BMU_TX_WM); } if (pPrt->PXAQSize != 0) { - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_CLR_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_F), SK_BMU_TX_WM); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_CLR_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_F), SK_BMU_TX_WM); } /* * Do NOT enable the descriptor poll timers here, because * the descriptor addresses are not specified yet. */ -} +} /* SkGeInitBmu */ + /****************************************************************************** * @@ -1081,17 +1092,18 @@ static SK_U32 TestStopBit( SK_AC *pAC, /* Adapter Context */ SK_IOC IoC, /* IO Context */ -int QuIoOffs) /* Queue IO Address Offset */ +int QuIoOffs) /* Queue IO Address Offset */ { SK_U32 QuCsr; /* CSR contents */ - SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr); if ((QuCsr & (CSR_STOP|CSR_SV_IDLE)) == 0) { - SK_OUT32(IoC, Q_ADDR(QuIoOffs,Q_CSR), CSR_STOP); - SK_IN32(IoC, Q_ADDR(QuIoOffs,Q_CSR), &QuCsr); + SK_OUT32(IoC, Q_ADDR(QuIoOffs, Q_CSR), CSR_STOP); + SK_IN32(IoC, Q_ADDR(QuIoOffs, Q_CSR), &QuCsr); } return (QuCsr); -} +} /* TestStopBit*/ + /****************************************************************************** * @@ -1173,10 +1185,10 @@ */ void SkGeStopPort( SK_AC *pAC, /* adapter context */ -SK_IOC IoC, /* IO context */ -int Port, /* port to stop (MAC_1 + n) */ -int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */ -int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */ +SK_IOC IoC, /* I/O context */ +int Port, /* port to stop (MAC_1 + n) */ +int Dir, /* Direction to Stop (SK_STOP_RX, SK_STOP_TX, SK_STOP_ALL) */ +int RstMode)/* Reset Mode (SK_SOFT_RST, SK_HARD_RST) */ { #ifndef SK_DIAG SK_EVPARA Para; @@ -1196,8 +1208,7 @@ if (Dir & SK_STOP_TX) { /* disable the XMACs receiver and transmitter */ XM_IN16(IoC, Port, XM_MMU_CMD, &Word); - XM_OUT16(IoC, Port, XM_MMU_CMD, - Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); + XM_OUT16(IoC, Port, XM_MMU_CMD, Word & ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX)); /* dummy read to ensure writing */ XM_IN16(IoC, Port, XM_MMU_CMD, &Word); @@ -1207,8 +1218,8 @@ * If the BMU is in the reset state CSR_STOP will terminate * immediately. */ - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_STOP); - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_STOP); ToutStart = SkOsGetTime(pAC); ToutCnt = 0; @@ -1231,17 +1242,16 @@ * transmit FIFO ! */ XM_IN32(IoC, Port, XM_MODE, &DWord); - DWord |= XM_MD_FTF ; + DWord |= XM_MD_FTF; XM_OUT32(IoC, Port, XM_MODE, DWord); XsCsr = TestStopBit(pAC, IoC, pPrt->PXsQOff); XaCsr = TestStopBit(pAC, IoC, pPrt->PXaQOff); - if (ToutStart + (SK_TICKS_PER_SEC / 18) < - SkOsGetTime(pAC)) { - + if (ToutStart + (SK_TICKS_PER_SEC / 18) >= SkOsGetTime(pAC)) { /* * Timeout of 1/18 second reached. + * This needs to be checked at 1/18 sec only. */ ToutCnt++; switch (ToutCnt) { @@ -1253,35 +1263,36 @@ */ ToutStart = SkOsGetTime(pAC); if (XsCsr & CSR_STOP) { - SK_OUT32(IoC, - Q_ADDR(pPrt->PXsQOff, - Q_CSR), CSR_START); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_START); } if (XaCsr & CSR_STOP) { - SK_OUT32(IoC, - Q_ADDR(pPrt->PXaQOff, - Q_CSR), CSR_START); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_START); } break; case 2: - default: /* Fatal Error, Loop aborted */ + default: + /* Might be a problem when the driver event handler + * calls StopPort again. + * XXX. + */ + /* Fatal Error, Loop aborted */ /* Create an Error Log Entry */ - SK_ERR_LOG(pAC, SK_ERRCL_HW, + SK_ERR_LOG( + pAC, + SK_ERRCL_HW, SKERR_HWI_E018, SKERR_HWI_E018MSG); #ifndef SK_DIAG Para.Para64 = Port; - SkEventQueue(pAC, SKGE_DRV, - SK_DRV_PORT_FAIL, Para); + SkEventQueue(pAC, SKGE_DRV, SK_DRV_PORT_FAIL, Para); #endif /* !SK_DIAG */ return; } } /* - * because of the ASIC problem report entry from 21.08.98 - * it is required to wait until CSR_STOP is reset and - * CSR_SV_IDLE is set. + * Because of the ASIC problem report entry from 21.08.1998 it is + * required to wait until CSR_STOP is reset and CSR_SV_IDLE is set. */ } while ((XsCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE || (XaCsr & (CSR_STOP|CSR_SV_IDLE)) != CSR_SV_IDLE); @@ -1298,10 +1309,10 @@ * Stop Interval Timer and Limit Counter of Tx Arbiter, * also disable Force Sync bit and Enable Alloc bit. */ - SK_OUT8(IoC, MR_ADDR(Port,TXA_CTRL), + SK_OUT8(IoC, MR_ADDR(Port, TXA_CTRL), TXA_DIS_FSYNC | TXA_DIS_ALLOC | TXA_STOP_RC); - SK_OUT32(IoC, MR_ADDR(Port,TXA_ITI_INI), 0x00000000L); - SK_OUT32(IoC, MR_ADDR(Port,TXA_LIM_INI), 0x00000000L); + SK_OUT32(IoC, MR_ADDR(Port, TXA_ITI_INI), 0x00000000L); + SK_OUT32(IoC, MR_ADDR(Port, TXA_LIM_INI), 0x00000000L); /* * perform a local reset of the port's tx path @@ -1311,16 +1322,16 @@ * - reset the RAM Butter sync tx queue * - reset the MAC Tx FIFO */ - SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff,Q_CSR), CSR_SET_RESET); - SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff,Q_CSR), CSR_SET_RESET); - SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff,RB_CTRL), RB_RST_SET); - SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff,RB_CTRL), RB_RST_SET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXaQOff, Q_CSR), CSR_SET_RESET); + SK_OUT32(IoC, Q_ADDR(pPrt->PXsQOff, Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXaQOff, RB_CTRL), RB_RST_SET); + SK_OUT8(IoC, RB_ADDR(pPrt->PXsQOff, RB_CTRL), RB_RST_SET); /* Note: MFF_RST_SET does NOT reset the XMAC! */ SK_OUT8(IoC, MR_ADDR(Port, TX_MFF_CTRL2), MFF_RST_SET); /* switch Link and Tx LED off, stop the LED counters */ /* Link LED is switched off by the RLMT and the Diag itself */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_DIS); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_DIS); } if (Dir & SK_STOP_RX) { @@ -1331,7 +1342,7 @@ * stop the transfer of received packets. */ /* stop the port's receive queue */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_STOP); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_STOP); i = 100; do { /* @@ -1368,12 +1379,12 @@ * - reset the RAM Buffer receive queue * - reset the MAC Rx FIFO */ - SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff,Q_CSR), CSR_SET_RESET); - SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff,RB_CTRL), RB_RST_SET); + SK_OUT32(IoC, Q_ADDR(pPrt->PRxQOff, Q_CSR), CSR_SET_RESET); + SK_OUT8(IoC, RB_ADDR(pPrt->PRxQOff, RB_CTRL), RB_RST_SET); SK_OUT8(IoC, MR_ADDR(Port, RX_MFF_CTRL2), MFF_RST_SET); /* switch Rx LED off, stop the LED counter */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_DIS); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_DIS); } @@ -1391,7 +1402,8 @@ if (AllPortsDis) { pAC->GIni.GIAnyPortAct = SK_FALSE; } -} +} /* SkGeStopPort */ + /****************************************************************************** * @@ -1444,7 +1456,88 @@ pAC->GIni.GIPortUsage = SK_RED_LINK; pAC->GIni.GIAnyPortAct = SK_FALSE; -} +} /* SkGeInit0*/ + +#ifdef SK_PCI_RESET + +/****************************************************************************** + * + * SkGePciReset() - Reset PCI interface + * + * Description: + * o Read PCI configuration. + * o Change power state to 3. + * o Change power state to 0. + * o Restore PCI configuration. + * + * Returns: + * 0: Success. + * 1: Power state could not be changed to 3. + */ +static int SkGePciReset( +SK_AC *pAC, /* adapter context */ +SK_IOC IoC) /* IO context */ +{ + int i; + SK_U16 PmCtlSts; + SK_U32 Bp1; + SK_U32 Bp2; + SK_U16 PciCmd; + SK_U8 Cls; + SK_U8 Lat; + SK_U8 ConfigSpace[PCI_CFG_SIZE]; + + /* + * Note: Switching to D3 state is like a software reset. + * Switching from D3 to D0 is a hardware reset. + * We have to save and restore the configuration space. + */ + for (i = 0; i < PCI_CFG_SIZE; i++) { + SkPciReadCfgDWord(pAC, i*4, &ConfigSpace[i]); + } + + /* We know the RAM Interface Arbiter is enabled. */ + SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D3); + SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); + if ((PmCtlSts & PCI_PM_STATE) != PCI_PM_STATE_D3) { + return (1); + } + + /* + * Return to D0 state. + */ + SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PCI_PM_STATE_D0); + + /* Check for D0 state. */ + SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); + if ((PmCtlSts & PCI_PM_STATE) != PCI_PM_STATE_D0) { + return (1); + } + + /* + * Check PCI Config Registers. + */ + SkPciReadCfgWord(pAC, PCI_COMMAND, &PciCmd); + SkPciReadCfgByte(pAC, PCI_CACHE_LSZ, &Cls); + SkPciReadCfgDWord(pAC, PCI_BASE_1ST, &Bp1); + SkPciReadCfgDWord(pAC, PCI_BASE_2ND, &Bp2); + SkPciReadCfgByte(pAC, PCI_LAT_TIM, &lat); + if (PciCmd != 0 || Cls != 0 || (Bp1 & 0xfffffff0L) != 0 || Bp2 != 1 || + Lat != 0 ) { + return (0); + } + + /* + * Restore Config Space. + */ + for (i = 0; i < PCI_CFG_SIZE; i++) { + SkPciWriteCfgDWord(pAC, i*4, ConfigSpace[i]); + } + + return (0); +} /* SkGePciReset */ + +#endif /* SK_PCI_RESET */ /****************************************************************************** * @@ -1477,6 +1570,10 @@ RetVal = 0; +#ifdef SK_PCI_RESET + (void)SkGePciReset(pAC, IoC); +#endif /* SK_PCI_RESET */ + /* Do the reset */ SK_OUT8(IoC, B0_CTST, CS_RST_SET); @@ -1486,7 +1583,7 @@ /* Reset all error bits in the PCI STATUS register */ /* * Note: Cfg cycles cannot be used, because they are not - * available on some platforms after 'boot time'. + * available on some platforms after 'boot time'. */ SK_OUT8(IoC, B2_TST_CTRL1, TST_CFG_WRITE_ON); SK_IN16(IoC, PCI_C(PCI_STATUS), &Word); @@ -1547,12 +1644,13 @@ break; } } - SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT, ("PHY type: %d PHY addr: %x\n", pAC->GIni.GP[i].PhyType, - pAC->GIni.GP[i].PhyAddr)) ; + pAC->GIni.GP[i].PhyAddr)); return (RetVal); -} +} /* SkGeInit1*/ + /****************************************************************************** * @@ -1588,8 +1686,7 @@ pAC->GIni.GIPollTimerVal = SK_DPOLL_MAX; /* Create an Error Log Entry */ - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E017, - SKERR_HWI_E017MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E017, SKERR_HWI_E017MSG); } SK_OUT32(IoC, B28_DPT_INI, pAC->GIni.GIPollTimerVal); SK_OUT8(IoC, B28_DPT_CTRL, DPT_START); @@ -1607,9 +1704,9 @@ SkGeInitPktArb(pAC, IoC); /* enable the Tx Arbiters */ - SK_OUT8(IoC, MR_ADDR(MAC_1,TXA_CTRL), TXA_ENA_ARB); + SK_OUT8(IoC, MR_ADDR(MAC_1, TXA_CTRL), TXA_ENA_ARB); if (pAC->GIni.GIMacsFound > 1) { - SK_OUT8(IoC, MR_ADDR(MAC_2,TXA_CTRL), TXA_ENA_ARB); + SK_OUT8(IoC, MR_ADDR(MAC_2, TXA_CTRL), TXA_ENA_ARB); } /* enable the RAM Interface Arbiter */ @@ -1621,7 +1718,7 @@ pPrt->PRxCmd |= XM_RX_BIG_PK_OK; } } -} +} /* SkGeInit2 */ /****************************************************************************** * @@ -1660,24 +1757,24 @@ int SkGeInit( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Level) /* initialization level */ +int Level) /* initialization level */ { int RetVal; /* return value */ SK_U32 DWord; RetVal = 0; - SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_INIT, - ("SkGeInit(Level %d)\n",Level)) ; + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_INIT, + ("SkGeInit(Level %d)\n", Level)); switch (Level) { case SK_INIT_DATA: /* Initialization Level 0 */ - SkGeInit0(pAC,IoC) ; + SkGeInit0(pAC, IoC); pAC->GIni.GILevel = SK_INIT_DATA; break; case SK_INIT_IO: /* Initialization Level 1 */ - RetVal = SkGeInit1(pAC,IoC) ; + RetVal = SkGeInit1(pAC, IoC); /* Check if the adapter seems to be accessable */ SK_OUT32(IoC, B2_IRQM_INI, 0x11335577L); @@ -1701,13 +1798,12 @@ /* Initialization Level 2 */ if (pAC->GIni.GILevel != SK_INIT_IO) { #ifndef SK_DIAG - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E002, - SKERR_HWI_E002MSG); + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E002, SKERR_HWI_E002MSG); #endif RetVal = 4; break; } - SkGeInit2(pAC,IoC) ; + SkGeInit2(pAC, IoC); /* Level 2 successfully passed */ pAC->GIni.GILevel = SK_INIT_RUN; @@ -1715,12 +1811,13 @@ default: /* Create an Error Log Entry */ SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E003, SKERR_HWI_E003MSG); - RetVal = 3 ; + RetVal = 3; break; } return (RetVal); -} +} /* SkGeInit*/ + /****************************************************************************** * @@ -1740,6 +1837,9 @@ int i; SK_U16 Word; + /* Ensure I2C is ready. */ + SkI2cWaitIrq(pAC, IoC); + /* Stop all current transfer activity */ for (i = 0; i < pAC->GIni.GIMacsFound; i++) { if (pAC->GIni.GP[i].PState != SK_PRT_STOP && @@ -1761,7 +1861,8 @@ /* Do the reset, all LEDs are switched off now */ SK_OUT8(IoC, B0_CTST, CS_RST_SET); -} +} /* SkGeDeInit*/ + /****************************************************************************** * @@ -1795,13 +1896,13 @@ int SkGeInitPort( SK_AC *pAC, /* adapter context */ SK_IOC IoC, /* IO context */ -int Port) /* Port to configure */ +int Port) /* Port to configure */ { SK_GEPORT *pPrt; pPrt = &pAC->GIni.GP[Port]; - if (SkGeCheckQSize(pAC,Port) != 0) { + if (SkGeCheckQSize(pAC, Port) != 0) { SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_HWI_E004, SKERR_HWI_E004MSG); return (1); } @@ -1817,8 +1918,8 @@ * If 1000BT Phy needs LED initialization than swap * LED and XMAC initialization order */ - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,TX_LED_INI), SK_LED_ENA); - SkGeXmitLED(pAC, IoC, MR_ADDR(Port,RX_LED_INI), SK_LED_ENA); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, TX_LED_INI), SK_LED_ENA); + SkGeXmitLED(pAC, IoC, MR_ADDR(Port, RX_LED_INI), SK_LED_ENA); /* The Link LED is initialized by RLMT or Diagnostics itself */ /* Do NOT initialize the Link Sync Counter */ @@ -1844,4 +1945,4 @@ pAC->GIni.GIAnyPortAct = SK_TRUE; return (0); -} +} /* SkGeInitPort */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgepnmi.c linux/drivers/net/sk98lin/skgepnmi.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgepnmi.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skgepnmi.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgepnmi.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.69 $ - * Date: $Date: 1999/10/18 11:42:15 $ + * Version: $Revision: 1.78 $ + * Date: $Date: 2000/09/12 10:44:58 $ * Purpose: Private Network Management Interface * ****************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,43 @@ * History: * * $Log: skgepnmi.c,v $ + * Revision 1.78 2000/09/12 10:44:58 cgoos + * Fixed SK_PNMI_STORE_U32 calls with typecasted argument. + * + * Revision 1.77 2000/09/07 08:10:19 rwahl + * - Modified algorithm for 64bit NDIS statistic counters; + * returns 64bit or 32bit value depending on passed buffer + * size. Indicate capability for 64bit NDIS counter, if passed + * buffer size is zero. OID_GEN_XMIT_ERROR, OID_GEN_RCV_ERROR, + * and OID_GEN_RCV_NO_BUFFER handled as 64bit counter, too. + * - corrected OID_SKGE_RLMT_PORT_PREFERRED. + * + * Revision 1.76 2000/08/03 15:23:39 rwahl + * - Correction for FrameTooLong counter has to be moved to OID handling + * routines (instead of statistic counter routine). + * - Fix in XMAC Reset Event handling: Only offset counter for hardware + * statistic registers are updated. + * + * Revision 1.75 2000/08/01 16:46:05 rwahl + * - Added StatRxLongFrames counter and correction of FrameTooLong counter. + * - Added directive to control width (default = 32bit) of NDIS statistic + * counters (SK_NDIS_64BIT_CTR). + * + * Revision 1.74 2000/07/04 11:41:53 rwahl + * - Added volition connector type. + * + * Revision 1.73 2000/03/15 16:33:10 rwahl + * Fixed bug 10510; wrong reset of virtual port statistic counters. + * + * Revision 1.72 1999/12/06 16:15:53 rwahl + * Fixed problem of instance range for current and factory MAC address. + * + * Revision 1.71 1999/12/06 10:14:20 rwahl + * Fixed bug 10476; set operation for PHY_OPERATION_MODE. + * + * Revision 1.70 1999/11/22 13:33:34 cgoos + * Changed license header to GPL. + * * Revision 1.69 1999/10/18 11:42:15 rwahl * Added typecasts for checking event dependent param (debug only). * @@ -297,7 +332,8 @@ static const char SysKonnectFileId[] = - "@(#) $Id: skgepnmi.c,v 1.69 1999/10/18 11:42:15 rwahl Exp $ (C) SysKonnect."; + "@(#) $Id: skgepnmi.c,v 1.78 2000/09/12 10:44:58 cgoos Exp $" + " (C) SysKonnect."; #include "h/skdrv1st.h" #include "h/sktypes.h" @@ -982,6 +1018,11 @@ sizeof(SK_PNMI_STAT), SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxUnicastOkCts), SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_UNICAST}, + {OID_SKGE_STAT_RX_LONGFRAMES, + SK_PNMI_MAC_ENTRIES, + sizeof(SK_PNMI_STAT), + SK_PNMI_OFF(Stat) + SK_PNMI_STA_OFF(StatRxLongFramesCts), + SK_PNMI_RO, MacPrivateStat, SK_PNMI_HRX_LONGFRAMES}, {OID_SKGE_STAT_RX_PFLOWC, SK_PNMI_MAC_ENTRIES, sizeof(SK_PNMI_STAT), @@ -1197,7 +1238,7 @@ 0, SK_PNMI_MAI_OFF(RlmtPortActive), SK_PNMI_RO, Rlmt, 0}, - {OID_SKGE_RLMT_PORT_PREFERED, + {OID_SKGE_RLMT_PORT_PREFERRED, 1, 0, SK_PNMI_MAI_OFF(RlmtPortPreferred), @@ -1353,7 +1394,8 @@ /* 62 */ {TRUE, XM_RXF_1023B}, /* 63 */ {TRUE, XM_RXF_MAX_SZ}, /* 64 */ {FALSE, 0}, - /* 65 */ {FALSE, 0} + /* 65 */ {FALSE, 0}, + /* 66 */ {TRUE, 0} }; @@ -1520,6 +1562,10 @@ pAC->Pnmi.Connector = 5; break; + case 'V': + pAC->Pnmi.Connector = 6; + break; + default: pAC->Pnmi.Connector = 1; break; @@ -2074,8 +2120,13 @@ case SK_PNMI_HRX_OCTETLOW: case SK_PNMI_HRX_IRLENGTH: case SK_PNMI_HRX_RESERVED22: + + /* + * the following counters aren't be handled (id > 63) + */ case SK_PNMI_HTX_SYNC: case SK_PNMI_HTX_SYNC_OCTET: + case SK_PNMI_HRX_LONGFRAMES: break; default: @@ -2270,7 +2321,7 @@ */ pAC->Pnmi.MacUpdatedFlag ++; - for (CounterIndex = 0; CounterIndex < SK_PNMI_MAX_IDX; + for (CounterIndex = 0; CounterIndex < SK_PNMI_SCNT_NOT; CounterIndex ++) { if (!StatAddress[CounterIndex].GetOffset) { @@ -2985,9 +3036,9 @@ SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */ unsigned int TableIndex) /* Index to the Id table */ { - int Ret; - SK_U32 StatVal; - + int Ret; + SK_U64 StatVal; + SK_BOOL Is64BitReq = SK_FALSE; /* * Only the active Mac is returned @@ -3022,11 +3073,28 @@ break; default: - if (*pLen < 4) { +#ifndef SK_NDIS_64BIT_CTR + if (*pLen < sizeof(SK_U32)) { + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } - *pLen = 4; +#else /* SK_NDIS_64BIT_CTR */ + + /* + * for compatibility, at least 32bit are required for oid + */ + if (*pLen < sizeof(SK_U32)) { + /* + * but indicate handling for 64bit values, + * if insufficient space is provided + */ + *pLen = sizeof(SK_U64); return (SK_PNMI_ERR_TOO_SHORT); } + + Is64BitReq = (*pLen < sizeof(SK_U64)) ? SK_FALSE : SK_TRUE; +#endif /* SK_NDIS_64BIT_CTR */ break; } @@ -3059,10 +3127,21 @@ break; default: - StatVal = (SK_U32)GetStatVal(pAC, IoC, 0, - IdTable[TableIndex].Param); - SK_PNMI_STORE_U32(pBuf, StatVal); - *pLen = sizeof(SK_U32); + StatVal = GetStatVal(pAC, IoC, 0, IdTable[TableIndex].Param); + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 StatVal32; + StatVal32 = (SK_U32)StatVal; + SK_PNMI_STORE_U32(pBuf, StatVal32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, StatVal); + *pLen = sizeof(SK_U64); + } break; } @@ -3177,6 +3256,20 @@ case OID_SKGE_STAT_RX_UTIL: return (SK_PNMI_ERR_GENERAL); */ + /* + * Frames longer than IEEE 802.3 frame max size are counted + * by XMAC in frame_too_long counter even reception of long + * frames was enabled and the frame was correct. + * So correct the value by subtracting RxLongFrame counter. + */ + case OID_SKGE_STAT_RX_TOO_LONG: + StatVal = GetStatVal(pAC, IoC, LogPortIndex, + IdTable[TableIndex].Param) - + GetStatVal(pAC, IoC, LogPortIndex, + SK_PNMI_HRX_LONGFRAMES); + SK_PNMI_STORE_U64(pBuf + Offset, StatVal); + break; + default: StatVal = GetStatVal(pAC, IoC, LogPortIndex, IdTable[TableIndex].Param); @@ -3245,7 +3338,7 @@ if ((Instance != (SK_U32)(-1))) { - if ((Instance < 1) || (Instance > SKCS_NUM_PROTOCOLS)) { + if ((Instance < 1) || (Instance > LogPortMax)) { *pLen = 0; return (SK_PNMI_ERR_UNKNOWN_INST); @@ -4289,6 +4382,7 @@ SK_U64 Val64; SK_U64 Val64RxHwErrs = 0; SK_U64 Val64TxHwErrs = 0; + SK_BOOL Is64BitReq = SK_FALSE; char Buf[256]; @@ -4315,13 +4409,37 @@ */ switch (Id) { + case OID_GEN_XMIT_ERROR: + case OID_GEN_RCV_ERROR: + case OID_GEN_RCV_NO_BUFFER: +#ifndef SK_NDIS_64BIT_CTR + if (*pLen < sizeof(SK_U32)) { + *pLen = sizeof(SK_U32); + return (SK_PNMI_ERR_TOO_SHORT); + } + +#else /* SK_NDIS_64BIT_CTR */ + + /* + * for compatibility, at least 32bit are required for oid + */ + if (*pLen < sizeof(SK_U32)) { + /* + * but indicate handling for 64bit values, + * if insufficient space is provided + */ + *pLen = sizeof(SK_U64); + return (SK_PNMI_ERR_TOO_SHORT); + } + + Is64BitReq = (*pLen < sizeof(SK_U64)) ? SK_FALSE : SK_TRUE; +#endif /* SK_NDIS_64BIT_CTR */ + break; + case OID_SKGE_PORT_NUMBER: case OID_SKGE_DEVICE_TYPE: case OID_SKGE_RESULT: case OID_SKGE_RLMT_MONITOR_NUMBER: - case OID_GEN_XMIT_ERROR: - case OID_GEN_RCV_ERROR: - case OID_GEN_RCV_NO_BUFFER: case OID_GEN_TRANSMIT_QUEUE_LENGTH: case OID_SKGE_TRAP_NUMBER: case OID_SKGE_MDB_VERSION: @@ -4420,7 +4538,8 @@ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SYMBOL) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SHORTS) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT) + - GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG)+ + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG)- + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_LONGFRAMES)+ GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS) + GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CEXT); break; @@ -4748,21 +4867,57 @@ break; case OID_GEN_RCV_ERROR: - Val32 = (SK_U32)(Val64RxHwErrs + pAC->Pnmi.RxNoBufCts); - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = Val64RxHwErrs + pAC->Pnmi.RxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_XMIT_ERROR: - Val32 = (SK_U32)(Val64TxHwErrs + pAC->Pnmi.TxNoBufCts); - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = Val64TxHwErrs + pAC->Pnmi.TxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_RCV_NO_BUFFER: - Val32 = (SK_U32)pAC->Pnmi.RxNoBufCts; - SK_PNMI_STORE_U32(pBuf, Val32); - *pLen = sizeof(SK_U32); + Val64 = pAC->Pnmi.RxNoBufCts; + + /* + * by default 32bit values are evaluated + */ + if (!Is64BitReq) { + SK_U32 Val32; + Val32 = (SK_U32)Val64; + SK_PNMI_STORE_U32(pBuf, Val32); + *pLen = sizeof(SK_U32); + } + else { + SK_PNMI_STORE_U64(pBuf, Val64); + *pLen = sizeof(SK_U64); + } break; case OID_GEN_TRANSMIT_QUEUE_LENGTH: @@ -4853,7 +5008,7 @@ case OID_SKGE_RLMT_MODE: case OID_SKGE_RLMT_PORT_ACTIVE: - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: if (*pLen < sizeof(SK_U8)) { *pLen = sizeof(SK_U8); @@ -4941,7 +5096,7 @@ *pLen = sizeof(char); break; - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: *pBuf = (char)SK_PNMI_PORT_PHYS2LOG( pAC->Rlmt.MacPreferred); *pLen = sizeof(char); @@ -5021,7 +5176,7 @@ } break; - case OID_SKGE_RLMT_PORT_PREFERED: + case OID_SKGE_RLMT_PORT_PREFERRED: /* Check if the buffer length is plausible */ if (*pLen < sizeof(char)) { @@ -5622,6 +5777,7 @@ case OID_SKGE_LINK_MODE: case OID_SKGE_FLOWCTRL_MODE: + case OID_SKGE_PHY_OPERATION_MODE: if (*pLen < Limit - LogPortIndex) { *pLen = Limit - LogPortIndex; @@ -5798,6 +5954,82 @@ Offset += sizeof(char); break; + case OID_SKGE_PHY_OPERATION_MODE : + /* Check the value range */ + Val8 = *(pBuf + Offset); + if (Val8 == 0) { + /* mode of this port remains unchanged */ + Offset += sizeof(char); + break; + } + if (Val8 < SK_MS_MODE_AUTO || + Val8 > SK_MS_MODE_SLAVE) { + + *pLen = 0; + return (SK_PNMI_ERR_BAD_VALUE); + } + + /* The preset ends here */ + if (Action == SK_PNMI_PRESET) { + + return (SK_PNMI_ERR_OK); + } + + if (LogPortIndex == 0) { + + /* + * The virtual port consists of all currently + * active ports. Find them and send an event + * with new master/slave (role) mode to SIRQ. + */ + for (PhysPortIndex = 0; + PhysPortIndex < PhysPortMax; + PhysPortIndex ++) { + + if (!pAC->Pnmi.Port[PhysPortIndex]. + ActiveFlag) { + + continue; + } + + EventParam.Para32[0] = PhysPortIndex; + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_ROLE, + EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR052, + SK_PNMI_ERR052MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + } + else { + /* + * Send an event with the new master/slave + * (role) mode to the SIRQ module. + */ + EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS( + pAC, LogPortIndex); + EventParam.Para32[1] = (SK_U32)Val8; + if (SkGeSirqEvent(pAC, IoC, + SK_HWEV_SET_ROLE, EventParam) > 0) { + + SK_ERR_LOG(pAC, SK_ERRCL_SW, + SK_PNMI_ERR052, + SK_PNMI_ERR052MSG); + + *pLen = 0; + return (SK_PNMI_ERR_GENERAL); + } + } + + Offset += sizeof(char); + break; + default: SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR045, SK_PNMI_ERR045MSG); @@ -6670,6 +6902,12 @@ 32); break; + case SK_PNMI_HRX_LONGFRAMES: + LowVal = (SK_U32)pAC->Pnmi.Port[PhysPortIndex].StatRxLongFrameCts; + HighVal = (SK_U32) + (pAC->Pnmi.Port[PhysPortIndex].StatRxLongFrameCts >> 32); + break; + case SK_PNMI_HRX_FCS: /* * Broadcom filters fcs errors and counts it in @@ -6765,11 +7003,16 @@ SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. StatSyncOctetsCts, 0, sizeof(pAC->Pnmi.Port[ PhysPortIndex].StatSyncOctetsCts)); + SK_MEMSET((char *)&pAC->Pnmi.Port[PhysPortIndex]. + StatRxLongFrameCts, 0, sizeof(pAC->Pnmi.Port[ + PhysPortIndex].StatRxLongFrameCts)); } /* * Clear local statistics */ + SK_MEMSET((char *)&pAC->Pnmi.VirtualCounterOffset, 0, + sizeof(pAC->Pnmi.VirtualCounterOffset)); pAC->Pnmi.RlmtChangeCts = 0; pAC->Pnmi.RlmtChangeTime = 0; SK_MEMSET((char *)&pAC->Pnmi.RlmtChangeEstimate.EstValue[0], 0, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skgesirq.c linux/drivers/net/sk98lin/skgesirq.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skgesirq.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skgesirq.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skgesirq.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.46 $ - * Date: $Date: 1999/09/16 10:30:07 $ + * Version: $Revision: 1.55 $ + * Date: $Date: 2000/06/19 08:36:25 $ * Purpose: Special IRQ module * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,34 @@ * History: * * $Log: skgesirq.c,v $ + * Revision 1.55 2000/06/19 08:36:25 cgoos + * Changed comment. + * + * Revision 1.54 2000/05/22 08:45:57 malthoff + * Fix: #10523 is valid for all BCom PHYs. + * + * Revision 1.53 2000/05/19 10:20:30 cgoos + * Removed Solaris debug output code. + * + * Revision 1.52 2000/05/19 10:19:37 cgoos + * Added PHY state check in HWLinkDown. + * Move PHY interrupt code to IS_EXT_REG case in SkGeSirqIsr. + * + * Revision 1.51 2000/05/18 05:56:20 cgoos + * Fixed typo. + * + * Revision 1.50 2000/05/17 12:49:49 malthoff + * Fixes BCom link bugs (#10523). + * + * Revision 1.49 1999/12/17 11:02:50 gklug + * fix: read PHY_STAT of Broadcom chip more often to assure good status + * + * Revision 1.48 1999/12/06 10:01:17 cgoos + * Added SET function for Role. + * + * Revision 1.47 1999/11/22 13:34:24 cgoos + * Changed license header to GPL. + * * Revision 1.46 1999/09/16 10:30:07 cgoos * Removed debugging output statement from Linux. * @@ -215,7 +241,7 @@ */ static const char SysKonnectFileId[] = - "$Id: skgesirq.c,v 1.46 1999/09/16 10:30:07 cgoos Exp $" ; + "$Id: skgesirq.c,v 1.55 2000/06/19 08:36:25 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skgepnmi.h" /* PNMI Definitions */ @@ -385,6 +411,15 @@ /* disable all PHY interrupts */ switch (pAC->GIni.GP[Port].PhyType) { case SK_PHY_BCOM: + /* make sure that PHY is initialized */ + if (pAC->GIni.GP[Port].PState) { + /* Workaround BCOM Errata (#10523) all BCom */ + /* Disable Power Management if link is down */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + &Word); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + Word | PHY_B_AC_DIS_PM); + } PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, 0xffff); break; @@ -766,12 +801,11 @@ } /* - * I2C Ready interrupt + * external reg interrupt */ - if (Istatus & IS_I2C_READY) { + if (Istatus & IS_EXT_REG) { SK_U16 PhyInt; SK_U16 PhyIMsk; - SK_BOOL IsPhyInt = SK_FALSE; int i; /* test IRQs from PHY */ for (i=0; iGIni.GIMacsFound; i++) { @@ -794,7 +828,6 @@ SkPhyIsrBcom(pAC, IoC, i, (SK_U16) (PhyInt & (~PhyIMsk))); - IsPhyInt = SK_TRUE; } } else { @@ -814,7 +847,6 @@ i, PhyInt, PhyIMsk)); SkPhyIsrLone(pAC, IoC, i, (SK_U16) (PhyInt & PhyIMsk)); - IsPhyInt = SK_TRUE; } break; case SK_PHY_NAT: @@ -822,9 +854,13 @@ break; } } - if (!IsPhyInt) { - SkI2cIsr(pAC, IoC); - } + } + + /* + * I2C Ready interrupt + */ + if (Istatus & IS_I2C_READY) { + SkI2cIsr(pAC, IoC); } if (Istatus & IS_LNK_SYNC_M1) { @@ -1328,8 +1364,23 @@ SK_U16 PhyStat; /* Phy Status Register */ int Done; SK_U16 ResAb; + SK_U16 SWord; pPrt = &pAC->GIni.GP[Port]; + + /* Check for No HCD Link events (#10523) */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_INT_STAT, &Isrc); + if ((Isrc & PHY_B_IS_NO_HDCL) == PHY_B_IS_NO_HDCL) { + + /* Workaround BCOM Errata */ + /* enable and disable Loopback mode if NO HCD occurs */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_CTRL, SWord | PHY_CT_LOOP); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_CTRL, SWord & ~PHY_CT_LOOP); + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("No HCD Link event, Port %d\n", Port)); + } + PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); if (pPrt->PHWLinkUp) { @@ -1338,7 +1389,7 @@ pPrt->PIsave = 0; - /* Now wait for each ports link */ + /* Now wait for each port's link */ if (pPrt->PLinkMode == SK_LMODE_HALF || pPrt->PLinkMode == SK_LMODE_FULL) { AutoNeg = SK_FALSE; @@ -1355,13 +1406,43 @@ PHY_READ(IoC, pPrt, Port, PHY_BCOM_STAT, &PhyStat); SkXmAutoNegLipaBcom(pAC, IoC, Port, PhyStat); - if ((PhyStat & PHY_ST_LSYNC) == 0){ - return(SK_HW_PS_NONE) ; + + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("AutoNeg:%d, PhyStat: %Xh.\n", AutoNeg, PhyStat)); + + PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); + + if ((PhyStat & PHY_ST_LSYNC) == 0) { + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } + return (SK_HW_PS_NONE); + } + + if (ResAb & (PHY_B_1000S_MSF)) { + /* Error */ + SK_DBG_MSG(pAC,SK_DBGMOD_HWM,SK_DBGCAT_CTRL, + ("Master/Slave Fault port %d\n", Port)); + pPrt->PAutoNegFail = SK_TRUE; + pPrt->PMSStatus = SK_MS_STAT_FAULT; + return (SK_AND_OTHER); + } else if (ResAb & PHY_B_1000S_MSR) { + pPrt->PMSStatus = SK_MS_STAT_MASTER; + } else { + pPrt->PMSStatus = SK_MS_STAT_SLAVE; } + + SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, + ("AutoNeg:%d, PhyStat: %Xh.\n", AutoNeg, PhyStat)); if (AutoNeg) { if (PhyStat & PHY_ST_AN_OVER) { - SkHWLinkUp(pAC, IoC, Port) ; + SkHWLinkUp(pAC, IoC, Port); Done = SkXmAutoNegDone(pAC,IoC,Port); if (Done != SK_AND_OK) { /* Get PHY parameters, for debuging only */ @@ -1400,6 +1481,8 @@ Port)); } #endif + +#if 0 PHY_READ(IoC, pPrt, Port, PHY_BCOM_1000T_STAT, &ResAb); if (ResAb & (PHY_B_1000S_MSF)) { /* Error */ @@ -1413,6 +1496,7 @@ } else { pPrt->PMSStatus = SK_MS_STAT_SLAVE ; } +#endif /* 0 */ /* @@ -1753,6 +1837,18 @@ if (pAC->GIni.GP[Port].PFlowCtrlMode != Val8) { /* Set New Flow Control mode */ pAC->GIni.GP[Port].PFlowCtrlMode = Val8; + + /* Restart Port */ + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); + SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para); + } + break; + + case SK_HWEV_SET_ROLE: + Val8 = (SK_U8) Para.Para32[1]; + if (pAC->GIni.GP[Port].PMSMode != Val8) { + /* Set New link mode */ + pAC->GIni.GP[Port].PMSMode = Val8; /* Restart Port */ SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/ski2c.c linux/drivers/net/sk98lin/ski2c.c --- v2.4.0-test8/linux/drivers/net/sk98lin/ski2c.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/ski2c.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: ski2c.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.41 $ - * Date: $Date: 1999/09/14 14:11:30 $ + * Version: $Revision: 1.44 $ + * Date: $Date: 2000/08/07 15:49:03 $ * Purpose: Funktions to access Voltage and Temperature Sensor * (taken from Monalisa (taken from Concentrator)) * @@ -11,11 +11,9 @@ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -30,6 +28,16 @@ * History: * * $Log: ski2c.c,v $ + * Revision 1.44 2000/08/07 15:49:03 gklug + * fix: SK_INFAST only in NetWare driver + * + * Revision 1.43 2000/08/03 14:28:17 rassmann + * - Added function to wait for I2C being ready before resetting the board. + * - Replaced one duplicate "out of range" message with correct one. + * + * Revision 1.42 1999/11/22 13:35:12 cgoos + * Changed license header to GPL. + * * Revision 1.41 1999/09/14 14:11:30 malthoff * The 1000BT Dual Link adapter has got only one Fan. * The second Fan has been removed. @@ -172,10 +180,10 @@ /* - i2C Protocol + I2C Protocol */ static const char SysKonnectFileId[] = - "$Id: ski2c.c,v 1.41 1999/09/14 14:11:30 malthoff Exp $" ; + "$Id: ski2c.c,v 1.44 2000/08/07 15:49:03 gklug Exp $"; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/lm80.h" @@ -193,9 +201,9 @@ This file covers functions that allow to read write and do some bulk requests a specified I2C address. - The Genesis has 2 I2C busses. One for the EEPROM which holds + The Genesis has 2 I2C buses. One for the EEPROM which holds the VPD Data and one for temperature and voltage sensor. - The following picture shows the I2C busses, I2C devices and + The following picture shows the I2C buses, I2C devices and there control registers. Note: The VPD functions are in skvpd.c @@ -292,13 +300,13 @@ * serial data line simultaneously (ASIC: last bit of a byte = '1', I2C client * send an 'ACK'). See also Concentrator Bugreport No. 10192. */ -#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA) -#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA) -#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC,I2C_DATA_DIR) -#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC,I2C_DATA_DIR|I2C_DATA) -#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC,I2C_CLK) -#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK|I2C_DATA_DIR) -#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC,I2C_CLK) +#define I2C_DATA_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA) +#define I2C_DATA_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA) +#define I2C_DATA_OUT(IoC) SK_I2C_SET_BIT(IoC, I2C_DATA_DIR) +#define I2C_DATA_IN(IoC) SK_I2C_CLR_BIT(IoC, I2C_DATA_DIR|I2C_DATA) +#define I2C_CLK_HIGH(IoC) SK_I2C_SET_BIT(IoC, I2C_CLK) +#define I2C_CLK_LOW(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK|I2C_DATA_DIR) +#define I2C_START_COND(IoC) SK_I2C_CLR_BIT(IoC, I2C_CLK) #define NS2CLKT(x) ((x*125L)/10000) @@ -308,25 +316,24 @@ * sending one bit */ void SkI2cSndBit( -SK_IOC IoC, /* IoContext */ +SK_IOC IoC, /* I/O Context */ SK_U8 Bit) /* Bit to send */ { - I2C_DATA_OUT(IoC) ; + I2C_DATA_OUT(IoC); if (Bit) { I2C_DATA_HIGH(IoC); } else { I2C_DATA_LOW(IoC); } - SkDgWaitTime(IoC,NS2BCLK(T_DATA_IN_SETUP)); + SkDgWaitTime(IoC, NS2BCLK(T_DATA_IN_SETUP)); I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)); + SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH)); I2C_CLK_LOW(IoC); -} - +} /* SkI2cSndBit*/ /* - * Signal a start to the i2C Bus. + * Signal a start to the I2C Bus. * * A start is signaled when data goes to low in a high clock cycle. * @@ -334,66 +341,70 @@ * * Status: not tested */ -void SkI2cStart(SK_IOC IoC) /* I/O Context */ +void SkI2cStart( +SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data high */ - I2C_DATA_OUT(IoC) ; - I2C_DATA_HIGH(IoC) ; + I2C_DATA_OUT(IoC); + I2C_DATA_HIGH(IoC); /* Set Clock high */ - I2C_CLK_HIGH(IoC) ; + I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_START_SETUP)) ; + SkDgWaitTime(IoC, NS2BCLK(T_START_SETUP)); /* Set Data Low */ - I2C_DATA_LOW(IoC) ; + I2C_DATA_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_START_HOLD)) ; + SkDgWaitTime(IoC, NS2BCLK(T_START_HOLD)); /* Clock low without Data to Input */ - I2C_START_COND(IoC) ; + I2C_START_COND(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW)) ; -} + SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW)); +} /* SkI2cStart */ -void SkI2cStop(SK_IOC IoC) /* I/O Context */ +void SkI2cStop( +SK_IOC IoC) /* I/O Context */ { /* Init data and Clock to output lines */ /* Set Data low */ - I2C_DATA_OUT(IoC) ; - I2C_DATA_LOW(IoC) ; + I2C_DATA_OUT(IoC); + I2C_DATA_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT)); /* Set Clock high */ - I2C_CLK_HIGH(IoC) ; + I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_STOP_SETUP)) ; + SkDgWaitTime(IoC, NS2BCLK(T_STOP_SETUP)); /* * Set Data High: Do it by setting the Data Line to Input. * Because of a pull up resistor the Data Line * floods to high. */ - I2C_DATA_IN(IoC) ; + I2C_DATA_IN(IoC); /* * When I2C activity is stopped * o DATA should be set to input and * o CLOCK should be set to high! */ - SkDgWaitTime(IoC,NS2BCLK(T_BUS_IDLE)) ; -} + SkDgWaitTime(IoC, NS2BCLK(T_BUS_IDLE)); +} /* SkI2cStop */ + /* - * Receive just one bit via the i2C bus. + * Receive just one bit via the I2C bus. * * Note: Clock must be set to LOW before calling this function. * * Returns The received bit. */ -int SkI2cRcvBit(SK_IOC IoC) /* I/O Context */ +int SkI2cRcvBit( +SK_IOC IoC) /* I/O Context */ { int Bit; SK_U8 I2cSwCtrl; @@ -401,13 +412,13 @@ /* Init data as input line */ I2C_DATA_IN(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_2_DATA_OUT)); I2C_CLK_HIGH(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_HIGH)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH)); - SK_I2C_GET_SW(IoC,&I2cSwCtrl) ; + SK_I2C_GET_SW(IoC, &I2cSwCtrl); if (I2cSwCtrl & I2C_DATA) { Bit = 1; } else { @@ -415,10 +426,11 @@ } I2C_CLK_LOW(IoC); - SkDgWaitTime(IoC,NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT)) ; + SkDgWaitTime(IoC, NS2BCLK(T_CLK_LOW-T_CLK_2_DATA_OUT)); return(Bit); -} +} /* SkI2cRcvBit */ + /* * Receive an ACK. @@ -426,58 +438,64 @@ * returns 0 If acknoledged * 1 in case of an error */ -int SkI2cRcvAck(SK_IOC IoC) /* I/O Context */ +int SkI2cRcvAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. */ - return (SkI2cRcvBit(IoC) != 0) ; -} + return (SkI2cRcvBit(IoC) != 0); +} /* SkI2cRcvAck */ + /* * Send an NACK. */ -void SkI2cSndNAck(SK_IOC IoC) /* I/O Context */ +void SkI2cSndNAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. */ - SkI2cSndBit(IoC,1) ; -} + SkI2cSndBit(IoC, 1); +} /* SkI2cSndNAck */ + /* * Send an ACK. */ -void SkI2cSndAck(SK_IOC IoC) /* I/O Context */ +void SkI2cSndAck( +SK_IOC IoC) /* I/O Context */ { /* * Received bit must be zero. * */ - SkI2cSndBit(IoC,0) ; -} + SkI2cSndBit(IoC, 0); +} /* SkI2cSndAck */ + /* - * Send one byte to the i2C device and wait for ACK. + * Send one byte to the I2C device and wait for ACK. * * Return acknoleged status. */ int SkI2cSndByte( SK_IOC IoC, /* I/O Context */ -int Byte) /* byte to send */ +int Byte) /* byte to send */ { int i; for (i=0; i<8; i++) { if (Byte & (1<<(7-i))) { - SkI2cSndBit(IoC,1) ; + SkI2cSndBit(IoC, 1); } else { - SkI2cSndBit(IoC,0) ; + SkI2cSndBit(IoC, 0); } } - return(SkI2cRcvAck(IoC)) ; -} + return(SkI2cRcvAck(IoC)); +} /* SkI2cSndByte */ /* @@ -487,24 +505,24 @@ */ int SkI2cRcvByte( SK_IOC IoC, /* I/O Context */ -int Last) /* Last Byte Flag */ +int Last) /* Last Byte Flag */ { int i; int Byte = 0; for (i=0; i<8; i++) { - Byte <<= 1 ; - Byte |= SkI2cRcvBit(IoC) ; + Byte <<= 1; + Byte |= SkI2cRcvBit(IoC); } if (Last) { - SkI2cSndNAck(IoC) ; + SkI2cSndNAck(IoC); } else { - SkI2cSndAck(IoC) ; + SkI2cSndAck(IoC); } - return(Byte) ; -} + return(Byte); +} /* SkI2cRcvByte */ /* @@ -514,68 +532,106 @@ */ int SkI2cSndDev( SK_IOC IoC, /* I/O Context */ -int Addr, /* Device Address */ -int Rw) /* Read / Write Flag */ +int Addr, /* Device Address */ +int Rw) /* Read / Write Flag */ { - SkI2cStart(IoC) ; - Rw = ~Rw ; - Rw &= I2C_WRITE ; - return(SkI2cSndByte(IoC, (Addr<<1) | Rw)) ; -} + SkI2cStart(IoC); + Rw = ~Rw; + Rw &= I2C_WRITE; + return(SkI2cSndByte(IoC, (Addr<<1) | Rw)); +} /* SkI2cSndDev */ #endif /* SK_DIAG */ /*----------------- I2C CTRL Register Functions ----------*/ /* - * waits for a completetion of a I2C transfer + * waits for a completion of an I2C transfer * * returns 0: success, transfer completes - * 1: error, transfer does not complete, I2C transfer - * killed, wait loop terminated. + * 1: error, transfer does not complete, I2C transfer + * killed, wait loop terminated. */ int SkI2cWait( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext */ -int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ +SK_IOC IoC, /* I/O Context */ +int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */ +{ + SK_U64 StartTime; + SK_U32 I2cCtrl; + + StartTime = SkOsGetTime(pAC); + do { + if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) { + SK_I2C_STOP(IoC); +#ifndef SK_DIAG + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG); +#endif /* !SK_DIAG */ + return(1); + } + SK_I2C_GET_CTL(IoC, &I2cCtrl); + } while ((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31); + + return(0); +} /* SkI2cWait */ + + +/* + * waits for a completion of an I2C transfer + * + * Returns + * Nothing + */ +void SkI2cWaitIrq( +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* I/O Context */ { - SK_U64 StartTime ; - SK_U32 I2cCtrl ; + SK_SENSOR *pSen; + SK_U64 StartTime; + SK_U32 IrqSrc; - StartTime = SkOsGetTime(pAC) ; + pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; + + if (pSen->SenState == SK_SEN_IDLE) { + return; + } + + StartTime = SkOsGetTime(pAC); do { - if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC/16) { - SK_I2C_STOP(IoC) ; + if (SkOsGetTime(pAC) - StartTime > SK_TICKS_PER_SEC / 8) { + SK_I2C_STOP(IoC); #ifndef SK_DIAG - SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, - SKERR_I2C_E002MSG) ; + SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG); #endif /* !SK_DIAG */ - return(1) ; + return; } - SK_I2C_GET_CTL(IoC,&I2cCtrl) ; - } while((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31) ; + SK_IN32(pAC, B0_ISRC, &IrqSrc); + } while ((IrqSrc & IS_I2C_READY) == 0); - return(0) ; -} + return; +} /* SkI2cWaitIrq */ #ifdef SK_DIAG + /* * writes a single byte or 4 bytes into the I2C device * * returns 0: success - * 1: error + * 1: error */ int SkI2cWrite( -SK_AC *pAC, /* Adapter Context */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ SK_U32 I2cData, /* I2C Data to write */ -int I2cDev, /* I2C Device Address */ -int I2cReg, /* I2C Device Register Address */ -int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ -{ - SK_OUT32(pAC,B2_I2C_DATA,I2cData) ; - SK_I2C_CTL(pAC,I2C_WRITE,I2cDev,I2cReg,I2cBurst); - return(SkI2cWait(pAC,pAC,I2C_WRITE)) ; -} +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_OUT32(IoC, B2_I2C_DATA, I2cData); + SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cReg, I2cBurst); + return(SkI2cWait(pAC, IoC, I2C_WRITE)); +} /* SkI2cWrite*/ + /* * reads a single byte or 4 bytes from the I2C device @@ -583,39 +639,42 @@ * returns the word read */ SK_U32 SkI2cRead( -SK_AC *pAC, /* Adapter Context */ -int I2cDev, /* I2C Device Address */ -int I2cReg, /* I2C Device Register Address */ -int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ -{ - SK_U32 Data ; - - SK_OUT32(pAC,B2_I2C_DATA,0) ; - SK_I2C_CTL(pAC,I2C_READ,I2cDev,I2cReg,I2cBurst); - if (SkI2cWait(pAC,pAC,I2C_READ)) { - w_print("I2c Transfer Timeout!\n"); - } - SK_IN32(pAC,B2_I2C_DATA,&Data) ; - return(Data) ; -} +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ +int I2cDev, /* I2C Device Address */ +int I2cReg, /* I2C Device Register Address */ +int I2cBurst) /* I2C Burst Flag ( 0 || I2C_BURST ) */ +{ + SK_U32 Data; + + SK_OUT32(IoC, B2_I2C_DATA, 0); + SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cReg, I2cBurst); + if (SkI2cWait(pAC, IoC, I2C_READ)) { + w_print("I2C Transfer Timeout!\n"); + } + SK_IN32(IoC, B2_I2C_DATA, &Data); + return(Data); +} /* SkI2cRead */ + #endif /* SK_DIAG */ + /* - * read a sensors value + * read a sensor's value * - * This function read a sensors value from the I2c sensor chip. The sensor + * This function read a sensors value from the I2C sensor chip. The sensor * is defined by its index into the sensors database in the struct pAC points * to. * Returns 1 if the read is completed - * 0 if the read must be continued (I2c Bus still allocated) + * 0 if the read must be continued (I2C Bus still allocated) */ int SkI2cReadSensor( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext */ +SK_IOC IoC, /* I/O Context */ SK_SENSOR *pSen) /* Sensor to be read */ { - return((*pSen->SenRead)(pAC,IoC,pSen)) ; -} + return((*pSen->SenRead)(pAC, IoC, pSen)); +} /* SkI2cReadSensor*/ /* * Do the Init state 0 initialization @@ -639,7 +698,7 @@ for (i=0; i < SK_MAX_SENSORS; i ++) { switch (i) { case 0: - pAC->I2c.SenTable[i].SenDesc = "Temperature" ; + pAC->I2c.SenTable[i].SenDesc = "Temperature"; pAC->I2c.SenTable[i].SenType = SK_SEN_TEMP; pAC->I2c.SenTable[i].SenThreErrHigh = SK_SEN_ERRHIGH0; pAC->I2c.SenTable[i].SenThreErrLow = SK_SEN_ERRLOW0; @@ -733,10 +792,11 @@ pAC->I2c.SenTable[i].SenDev = LM80_ADDR; } - /* Now we are INIT dataed */ + /* Now we are "INIT data"ed */ pAC->I2c.InitLevel = SK_INIT_DATA; return(0); -} +} /* SkI2cInit0*/ + /* * Do the init state 1 initialization @@ -760,7 +820,7 @@ */ static int SkI2cInit1( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC) /* IoContext needed in level 1 */ +SK_IOC IoC) /* I/O Context */ { if (pAC->I2c.InitLevel != SK_INIT_DATA) { /* ReInit not needed in I2C module */ @@ -769,27 +829,27 @@ SK_OUT32(IoC, B2_I2C_DATA, 0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0xff); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_1, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0xff); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_IMSK_2, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0x0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_FAN_CTRL, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, 0); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_TEMP_CTRL, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); SK_OUT32(IoC, B2_I2C_DATA, LM80_CFG_START); SK_I2C_CTL(IoC, I2C_WRITE, LM80_ADDR, LM80_CFG, 0); - (void)SkI2cWait(pAC, IoC, I2C_WRITE) ; + (void)SkI2cWait(pAC, IoC, I2C_WRITE); /* * MaxSens has to be initialized here, because PhyType is not @@ -820,14 +880,15 @@ /* Now we are IO initialized */ pAC->I2c.InitLevel = SK_INIT_IO; return(0); -} +} /* SkI2cInit1 */ + /* * Init level 2: Start first sensors read */ static int SkI2cInit2( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC) /* IoContext needed in level 1 */ +SK_IOC IoC) /* I/O Context */ { int ReadComplete; SK_SENSOR *pSen; @@ -839,18 +900,18 @@ } pSen = &pAC->I2c.SenTable[pAC->I2c.CurrSens]; - ReadComplete = SkI2cReadSensor(pAC,IoC,pSen); + ReadComplete = SkI2cReadSensor(pAC, IoC, pSen); if (ReadComplete) { - SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, - SKERR_I2C_E008MSG); + SK_ERR_LOG(pAC, SK_ERRCL_INIT, SKERR_I2C_E008, SKERR_I2C_E008MSG); } /* Now we are correctly initialized */ pAC->I2c.InitLevel = SK_INIT_RUN; return(0); -} +} /* SkI2cInit2*/ + /* * Initialize I2C devices @@ -871,27 +932,29 @@ */ int SkI2cInit( SK_AC *pAC, /* Adapter Context */ -SK_IOC IoC, /* IoContext needed in level 1 */ -int Level) /* Init Level */ +SK_IOC IoC, /* I/O Context needed in levels 1 and 2 */ +int Level) /* Init Level */ { switch (Level) { case SK_INIT_DATA: - return(SkI2cInit0(pAC)) ; + return(SkI2cInit0(pAC)); case SK_INIT_IO: - return(SkI2cInit1(pAC, IoC)) ; + return(SkI2cInit1(pAC, IoC)); case SK_INIT_RUN: - return(SkI2cInit2(pAC, IoC)) ; + return(SkI2cInit2(pAC, IoC)); default: break; } - return(0) ; -} + return(0); +} /* SkI2cInit */ + #ifndef SK_DIAG + /* - * Interrupt service function for the I2c Interface + * Interrupt service function for the I2C Interface * * Clears the Interrupt source * @@ -900,23 +963,24 @@ * Starts the timer if necessary. */ void SkI2cIsr( -SK_AC *pAC, /* Adapters context */ -SK_IOC IoC) /* Io Context */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC) /* I/O Context */ { SK_EVPARA Para; /* Clear the interrupt source */ - SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ) ; + SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ); Para.Para64 = 0; SkEventQueue(pAC, SKGE_I2C, SK_I2CEV_IRQ, Para); -} +} /* SkI2cIsr */ + /* * Check this sensors Value against the threshold and send events. */ static void SkI2cCheckSensor( -SK_AC *pAC, /* Adapters context */ +SK_AC *pAC, /* Adapter Context */ SK_SENSOR *pSen) { SK_EVPARA ParaLocal; @@ -929,12 +993,12 @@ /* Check Dummy Reads first */ if (pAC->I2c.DummyReads > 0) { - pAC->I2c.DummyReads -- ; + pAC->I2c.DummyReads --; return; } /* Get the current time */ - CurrTime = SkOsGetTime(pAC) ; + CurrTime = SkOsGetTime(pAC); /* Set para to the most usefull setting: * The current sensor. @@ -943,17 +1007,17 @@ /* Check the Value against the thresholds */ /* First: Error Thresholds */ - TooHigh = (pSen->SenValue > pSen->SenThreErrHigh) ; - TooLow = (pSen->SenValue < pSen->SenThreErrLow) ; + TooHigh = (pSen->SenValue > pSen->SenThreErrHigh); + TooLow = (pSen->SenValue < pSen->SenThreErrLow); - IsError = SK_FALSE ; + IsError = SK_FALSE; if (TooHigh || TooLow) { - /* Error condition is satiesfied */ + /* Error condition is satisfied */ DoTrapSend = SK_TRUE; DoErrLog = SK_TRUE; /* Now error condition is satisfied */ - IsError = SK_TRUE ; + IsError = SK_TRUE; if (pSen->SenErrFlag == SK_SEN_ERR_ERR) { /* This state is the former one */ @@ -981,7 +1045,7 @@ /* We came from a different state */ /* -> Set Begin Time Stamp */ pSen->SenBegErrTS = CurrTime; - pSen->SenErrFlag = SK_SEN_ERR_ERR ; + pSen->SenErrFlag = SK_SEN_ERR_ERR; } if (DoTrapSend) { @@ -993,7 +1057,7 @@ SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? SK_PNMI_EVT_SEN_ERR_UPP : SK_PNMI_EVT_SEN_ERR_LOW), - ParaLocal) ; + ParaLocal); } if (DoErrLog) { @@ -1016,12 +1080,12 @@ /* Check the Value against the thresholds */ /* 2nd: Warning thresholds */ - TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh) ; - TooLow = (pSen->SenValue < pSen->SenThreWarnLow) ; + TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh); + TooLow = (pSen->SenValue < pSen->SenThreWarnLow); if (!IsError && (TooHigh || TooLow)) { - /* Error condition is satiesfied */ + /* Error condition is satisfied */ DoTrapSend = SK_TRUE; DoErrLog = SK_TRUE; @@ -1051,7 +1115,7 @@ /* We came from a different state */ /* -> Set Begin Time Stamp */ pSen->SenBegWarnTS = CurrTime; - pSen->SenErrFlag = SK_SEN_ERR_WARN ; + pSen->SenErrFlag = SK_SEN_ERR_WARN; } if (DoTrapSend) { @@ -1063,7 +1127,7 @@ SkEventQueue(pAC, SKGE_PNMI, (TooHigh ? SK_PNMI_EVT_SEN_WAR_UPP : SK_PNMI_EVT_SEN_WAR_LOW), - ParaLocal) ; + ParaLocal); } if (DoErrLog) { @@ -1074,8 +1138,8 @@ SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, SKERR_I2C_E009MSG); } else if (pSen->SenType == SK_SEN_VOLT) { - SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E009, - SKERR_I2C_E009MSG); + SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E010, + SKERR_I2C_E010MSG); } else { SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E014, @@ -1087,7 +1151,7 @@ /* Check for NO error at all */ if (!IsError && !TooHigh && !TooLow) { /* Set o.k. Status if no error and no warning condition */ - pSen->SenErrFlag = SK_SEN_ERR_OK ; + pSen->SenErrFlag = SK_SEN_ERR_OK; } /* End of check against the thresholds */ @@ -1115,17 +1179,18 @@ if (!pSen->SenInit) { SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG); } -} +} /* SkI2cCheckSensor*/ + /* * The only Event to be served is the timeout event * */ int SkI2cEvent( -SK_AC *pAC, /* Adapters context */ -SK_IOC IoC, /* Io Context */ -SK_U32 Event, /* Module specific Event */ -SK_EVPARA Para) /* Event specific Parameter */ +SK_AC *pAC, /* Adapter Context */ +SK_IOC IoC, /* I/O Context */ +SK_U32 Event, /* Module specific Event */ +SK_EVPARA Para) /* Event specific Parameter */ { int ReadComplete; SK_SENSOR *pSen; @@ -1141,7 +1206,7 @@ if (ReadComplete) { /* Check sensor against defined thresholds */ - SkI2cCheckSensor (pAC, pSen) ; + SkI2cCheckSensor (pAC, pSen); /* Increment Current and set appropriate Timeout */ Time = SK_I2C_TIM_SHORT; @@ -1155,7 +1220,7 @@ /* Start Timer */ ParaLocal.Para64 = (SK_U64) 0; SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time, - SKGE_I2C, SK_I2CEV_TIM, ParaLocal) ; + SKGE_I2C, SK_I2CEV_TIM, ParaLocal); } break; case SK_I2CEV_CLEAR: @@ -1176,6 +1241,6 @@ } return(0); -} -#endif /* !SK_DIAG */ -/* End of File */ +} /* SkI2cEvent*/ + +#endif /* !SK_DIAG */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/sklm80.c linux/drivers/net/sk98lin/sklm80.c --- v2.4.0-test8/linux/drivers/net/sk98lin/sklm80.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/sklm80.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sklm80.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.16 $ - * Date: $Date: 1999/05/27 14:05:47 $ + * Version: $Revision: 1.17 $ + * Date: $Date: 1999/11/22 13:35:51 $ * Purpose: Funktions to access Voltage and Temperature Sensor (LM80) * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,9 @@ * History: * * $Log: sklm80.c,v $ + * Revision 1.17 1999/11/22 13:35:51 cgoos + * Changed license header to GPL. + * * Revision 1.16 1999/05/27 14:05:47 malthoff * Fans: Set SenVal to 0 if the fan value is 0 or 0xff. Both values * are outside the limits (0: div zero error, 0xff: value not in @@ -92,7 +93,7 @@ LM80 functions */ static const char SysKonnectFileId[] = - "$Id: sklm80.c,v 1.16 1999/05/27 14:05:47 malthoff Exp $" ; + "$Id: sklm80.c,v 1.17 1999/11/22 13:35:51 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/lm80.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skqueue.c linux/drivers/net/sk98lin/skqueue.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skqueue.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skqueue.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skqueue.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.14 $ - * Date: $Date: 1998/10/15 15:11:35 $ + * Version: $Revision: 1.15 $ + * Date: $Date: 1999/11/22 13:36:29 $ * Purpose: Management of an event queue. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,9 @@ * History: * * $Log: skqueue.c,v $ + * Revision 1.15 1999/11/22 13:36:29 cgoos + * Changed license header to GPL. + * * Revision 1.14 1998/10/15 15:11:35 gklug * fix: ID_sccs to SysKonnectFileId * @@ -81,7 +82,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.14 1998/10/15 15:11:35 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/skqueue.c,v 1.15 1999/11/22 13:36:29 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skqueue.h" /* Queue Definitions */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skrlmt.c linux/drivers/net/sk98lin/skrlmt.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skrlmt.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skrlmt.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skrlmt.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.48 $ - * Date: $Date: 1999/10/04 14:01:17 $ + * Version: $Revision: 1.49 $ + * Date: $Date: 1999/11/22 13:38:02 $ * Purpose: Manage links on SK-NET Adapters, esp. redundant ones. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,10 @@ * History: * * $Log: skrlmt.c,v $ + * Revision 1.49 1999/11/22 13:38:02 cgoos + * Changed license header to GPL. + * Added initialization to some variables to avoid compiler warnings. + * * Revision 1.48 1999/10/04 14:01:17 rassmann * Corrected reaction to reception of BPDU frames. * Added parameter descriptions to "For Readme" section skrlmt.txt. @@ -216,7 +218,7 @@ #ifndef lint static const char SysKonnectFileId[] = - "@(#) $Id: skrlmt.c,v 1.48 1999/10/04 14:01:17 rassmann Exp $ (C) SysKonnect."; + "@(#) $Id: skrlmt.c,v 1.49 1999/11/22 13:38:02 cgoos Exp $ (C) SysKonnect."; #endif /* !defined(lint) */ #define __SKRLMT_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/sktimer.c linux/drivers/net/sk98lin/sktimer.c --- v2.4.0-test8/linux/drivers/net/sk98lin/sktimer.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/sktimer.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: sktimer.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.11 $ - * Date: $Date: 1998/12/17 13:24:13 $ + * Version: $Revision: 1.12 $ + * Date: $Date: 1999/11/22 13:38:51 $ * Purpose: High level timer functions. * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,9 @@ * History: * * $Log: sktimer.c,v $ + * Revision 1.12 1999/11/22 13:38:51 cgoos + * Changed license header to GPL. + * * Revision 1.11 1998/12/17 13:24:13 gklug * fix: restart problem: do NOT destroy timer queue if init 1 is done * @@ -75,7 +76,7 @@ Event queue and dispatcher */ static const char SysKonnectFileId[] = - "$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.11 1998/12/17 13:24:13 gklug Exp $" ; + "$Header: /usr56/projects/ge/schedule/sktimer.c,v 1.12 1999/11/22 13:38:51 cgoos Exp $" ; #include "h/skdrv1st.h" /* Driver Specific Definitions */ #include "h/skdrv2nd.h" /* Adapter Control- and Driver specific Def. */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skvpd.c linux/drivers/net/sk98lin/skvpd.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skvpd.c Wed Jul 5 10:56:13 2000 +++ linux/drivers/net/sk98lin/skvpd.c Fri Sep 15 14:34:19 2000 @@ -2,19 +2,17 @@ * * Name: skvpd.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.24 $ - * Date: $Date: 1999/03/11 14:25:49 $ + * Version: $Revision: 1.27 $ + * Date: $Date: 2000/08/10 11:29:06 $ * Purpose: Shared software to read and write VPD data * ******************************************************************************/ /****************************************************************************** * - * (C)Copyright 1998,1999 SysKonnect, + * (C)Copyright 1998-2000 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,18 @@ * History: * * $Log: skvpd.c,v $ + * Revision 1.27 2000/08/10 11:29:06 rassmann + * Editorial changes. + * Preserving 32-bit alignment in structs for the adapter context. + * Removed unused function VpdWriteDword() (#if 0). + * Made VpdReadKeyword() available for SKDIAG only. + * + * Revision 1.26 2000/06/13 08:00:01 mkarl + * additional cast to avoid compile problems in 64 bit environment + * + * Revision 1.25 1999/11/22 13:39:32 cgoos + * Changed license header to GPL. + * * Revision 1.24 1999/03/11 14:25:49 malthoff * Replace __STDC__ with SK_KR_PROTO. * @@ -62,7 +72,7 @@ * * Revision 1.14 1998/10/28 07:20:38 gklug * chg: Interface functions to use IoC as parameter as well - * fix: VpdRead/WriteDWord now return SK_U32 + * fix: VpdRead/WriteDWord now returns SK_U32 * chg: VPD_IN/OUT names conform to SK_IN/OUT * add: usage of VPD_IN/OUT8 macros * add: VpdRead/Write Stream functions to r/w a stream of data @@ -120,7 +130,7 @@ Please refer skvpd.txt for infomation how to include this module */ static const char SysKonnectFileId[] = - "@(#)$Id: skvpd.c,v 1.24 1999/03/11 14:25:49 malthoff Exp $ (C) SK" ; + "@(#)$Id: skvpd.c,v 1.27 2000/08/10 11:29:06 rassmann Exp $ (C) SK"; #include "h/skdrv1st.h" #include "h/sktypes.h" @@ -134,9 +144,9 @@ static SK_VPD_PARA *vpd_find_para( SK_AC *pAC, char *key, - SK_VPD_PARA *p) ; + SK_VPD_PARA *p); #else /* SK_KR_PROTO */ -static SK_VPD_PARA *vpd_find_para() ; +static SK_VPD_PARA *vpd_find_para(); #endif /* SK_KR_PROTO */ /* @@ -151,28 +161,29 @@ SK_IOC IoC, /* IO Context */ int event) /* event to wait for (VPD_READ / VPD_write) completion*/ { - SK_U64 start_time ; - SK_U16 state ; + SK_U64 start_time; + SK_U16 state; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd wait for %s\n",event?"Write":"Read")) ; - start_time = SkOsGetTime(pAC) ; + ("vpd wait for %s\n",event?"Write":"Read")); + start_time = SkOsGetTime(pAC); do { if (SkOsGetTime(pAC) - start_time > SK_TICKS_PER_SEC/16) { - VPD_STOP(pAC,IoC) ; + VPD_STOP(pAC,IoC); SK_DBG_MSG(pAC,SK_DBGMOD_VPD, SK_DBGCAT_FATAL|SK_DBGCAT_ERR, - ("ERROR:vpd wait timeout\n")) ; - return(1) ; + ("ERROR:vpd wait timeout\n")); + return(1); } - VPD_IN16(pAC,IoC,PCI_VPD_ADR_REG,&state) ; + VPD_IN16(pAC,IoC,PCI_VPD_ADR_REG,&state); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("state = %x, event %x\n",state,event)) ; - } while((int)(state & PCI_VPD_FLAG) == event) ; + ("state = %x, event %x\n",state,event)); + } while((int)(state & PCI_VPD_FLAG) == event); - return(0) ; + return(0); } +#ifdef SKDIAG /* * Read the dword at address 'addr' from the VPD EEPROM. @@ -189,27 +200,31 @@ SK_IOC IoC, /* IO Context */ int addr) /* VPD address */ { - SK_U32 Rtv ; + SK_U32 Rtv; /* start VPD read */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd read dword at 0x%x\n",addr)) ; - addr &= ~VPD_WRITE ; /* ensure the R/W bit is set to read */ + ("vpd read dword at 0x%x\n",addr)); + addr &= ~VPD_WRITE; /* ensure the R/W bit is set to read */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16) addr) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16) addr); /* ignore return code here */ - (void)VpdWait(pAC,IoC,VPD_READ) ; + (void)VpdWait(pAC,IoC,VPD_READ); /* Don't swap here, it's a data stream of bytes */ - Rtv = 0 ; + Rtv = 0; - VPD_IN32(pAC,IoC,PCI_VPD_DAT_REG,&Rtv) ; + VPD_IN32(pAC,IoC,PCI_VPD_DAT_REG,&Rtv); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd read dword data = 0x%x\n",Rtv)) ; - return (Rtv) ; + ("vpd read dword data = 0x%x\n",Rtv)); + return (Rtv); } +#endif // SKDIAG + +#if 0 + /* Write the dword 'data' at address 'addr' into the VPD EEPROM, and verify that the data is written. @@ -229,11 +244,10 @@ Returns 0: success - 1: error, I2C transfer does not terminate - 2: error, data verify error + 1: error, I2C transfer does not terminate + 2: error, data verify error */ -#if 0 /* unused */ static int VpdWriteDWord( SK_AC *pAC, /* pAC pointer */ SK_IOC IoC, /* IO Context */ @@ -243,29 +257,30 @@ /* start VPD write */ /* Don't swap here, it's a data stream of bytes */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd write dword at addr 0x%x, data = 0x%x\n",addr,data)) ; - VPD_OUT32(pAC,IoC,PCI_VPD_DAT_REG, (SK_U32)data) ; + ("vpd write dword at addr 0x%x, data = 0x%x\n",addr,data)); + VPD_OUT32(pAC,IoC,PCI_VPD_DAT_REG, (SK_U32)data); /* But do it here */ - addr |= VPD_WRITE ; + addr |= VPD_WRITE; - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)); /* this may take up to 10,6 ms */ if (VpdWait(pAC,IoC,VPD_WRITE)) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Write Timed Out\n")) ; - return(1) ; - } ; + ("Write Timed Out\n")); + return(1); + }; /* verify data */ if (VpdReadDWord(pAC,IoC,addr) != data) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, - ("Data Verify Error\n")) ; - return(2) ; + ("Data Verify Error\n")); + return(2); } - return(0) ; -} -#endif /* unused */ + return(0); +} /* VpdWriteDWord */ + +#endif /* 0 */ /* * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from @@ -280,12 +295,12 @@ int Addr, /* VPD start address */ int Len) /* number of bytes to read / to write */ { - int i ; - int j ; - SK_U16 AdrReg ; - int Rtv ; + int i; + int j; + SK_U16 AdrReg; + int Rtv; SK_U8 * pComp; /* Compare pointer */ - SK_U8 Data ; /* Input Data for Compare */ + SK_U8 Data; /* Input Data for Compare */ /* Init Compare Pointer */ pComp = (SK_U8 *) buf; @@ -297,56 +312,56 @@ * So it is initialized even if only a few bytes * are written. */ - AdrReg = (SK_U16) Addr ; - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg = (SK_U16) Addr; + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* ignore return code here */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { - return(i) ; + return(i); } } /* Write current Byte */ VPD_OUT8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), - *(SK_U8*)buf) ; + *(SK_U8*)buf); if (((i%sizeof(SK_U32)) == 3) || (i == (Len - 1))) { /* New Address needs to be written to VPD_ADDR reg */ - AdrReg = (SK_U16) Addr ; + AdrReg = (SK_U16) Addr; Addr += sizeof(SK_U32); - AdrReg |= VPD_WRITE ; /* WRITE operation */ + AdrReg |= VPD_WRITE; /* WRITE operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* Wait for termination */ - Rtv = VpdWait(pAC,IoC,VPD_WRITE) ; + Rtv = VpdWait(pAC,IoC,VPD_WRITE); if (Rtv != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Write Timed Out\n")) ; - return(i - (i%sizeof(SK_U32))) ; + ("Write Timed Out\n")); + return(i - (i%sizeof(SK_U32))); } /* * Now re-read to verify */ - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* Wait for termination */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Verify Timed Out\n")) ; - return(i - (i%sizeof(SK_U32))) ; + ("Verify Timed Out\n")); + return(i - (i%sizeof(SK_U32))); } for (j = 0; j <= (int) (i%sizeof(SK_U32)); j ++, pComp ++ ) { - VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+j, &Data) ; + VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+j, &Data); if (Data != *pComp) { /* Verify Error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD, @@ -376,31 +391,31 @@ int Addr, /* VPD start address */ int Len) /* number of bytes to read / to write */ { - int i ; - SK_U16 AdrReg ; - int Rtv ; + int i; + SK_U16 AdrReg; + int Rtv; for (i=0; i < Len; i ++, buf++) { if ((i%sizeof(SK_U32)) == 0) { /* New Address needs to be written to VPD_ADDR reg */ - AdrReg = (SK_U16) Addr ; + AdrReg = (SK_U16) Addr; Addr += sizeof(SK_U32); - AdrReg &= ~VPD_WRITE ; /* READ operation */ + AdrReg &= ~VPD_WRITE; /* READ operation */ - VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg) ; + VPD_OUT16(pAC,IoC,PCI_VPD_ADR_REG, AdrReg); /* ignore return code here */ - Rtv = VpdWait(pAC,IoC,VPD_READ) ; + Rtv = VpdWait(pAC,IoC,VPD_READ); if (Rtv != 0) { - return(i) ; + return(i); } } VPD_IN8(pAC,IoC,PCI_VPD_DAT_REG+(i%sizeof(SK_U32)), - (SK_U8 *)buf) ; + (SK_U8 *)buf); } - return(Len) ; + return(Len); } /* @@ -417,29 +432,29 @@ int len, /* number of bytes to read / to write */ int dir) /* transfer direction may be VPD_READ or VPD_WRITE */ { - int Rtv ; /* Return value */ - int vpd_rom_size ; - SK_U32 our_reg2 ; + int Rtv; /* Return value */ + int vpd_rom_size; + SK_U32 our_reg2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, ("vpd %s block, addr = 0x%x, len = %d\n", - dir?"write":"read",addr,len)) ; + dir?"write":"read",addr,len)); if (len == 0) - return (0) ; + return (0); - VPD_IN32(pAC,IoC,PCI_OUR_REG_2,&our_reg2) ; + VPD_IN32(pAC,IoC,PCI_OUR_REG_2,&our_reg2); vpd_rom_size = 256 << ((our_reg2 & PCI_VPD_ROM_SZ) >> 14); if (addr > vpd_rom_size - 4) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR|SK_DBGCAT_FATAL, ("Address error: 0x%x, exp. < 0x%x\n", - addr, vpd_rom_size - 4)) ; - return (0) ; + addr, vpd_rom_size - 4)); + return (0); } if (addr + len > vpd_rom_size) { - len = vpd_rom_size - addr ; + len = vpd_rom_size - addr; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Warning: len was cut to %d\n",len)) ; + ("Warning: len was cut to %d\n",len)); } if (dir == VPD_READ) { @@ -448,7 +463,7 @@ Rtv = VpdWriteStream(pAC, IoC, buf, addr, len); } - return (Rtv) ; + return (Rtv); } #ifdef SKDIAG @@ -465,7 +480,7 @@ int addr, /* start reading at the VPD address */ int len) /* number of bytes to read */ { - return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ)) ; + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_READ)); } /* @@ -480,7 +495,7 @@ int addr, /* start writing at the VPD address */ int len) /* number of bytes to write */ { - return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE)) ; + return (VpdTransferBlock(pAC, IoC, buf, addr, len, VPD_WRITE)); } #endif /* SKDIAG */ @@ -497,64 +512,64 @@ SK_AC *pAC, /* Adapters context */ SK_IOC IoC) /* IO Context */ { - SK_VPD_PARA *r, rp ; /* RW or RV */ - int i ; - unsigned char x ; + SK_VPD_PARA *r, rp; /* RW or RV */ + int i; + unsigned char x; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT,("VpdInit .. ")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT,("VpdInit .. ")); /* read the VPD data into the VPD buffer */ if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf,0,VPD_SIZE,VPD_READ) != VPD_SIZE) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("Block Read Error\n")) ; - return(1) ; + ("Block Read Error\n")); + return(1); } /* find the end tag of the RO area */ if (!(r = vpd_find_para(pAC,VPD_RV,&rp))) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: RV Tag not found\n")) ; - return (1) ; + ("Encoding Error: RV Tag not found\n")); + return (1); } if (r->p_val + r->p_len > pAC->vpd.vpd_buf + VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: Invalid VPD struct size\n")) ; - return (1) ; + ("Encoding Error: Invalid VPD struct size\n")); + return (1); } - pAC->vpd.v.vpd_free_ro = r->p_len - 1 ; + pAC->vpd.v.vpd_free_ro = r->p_len - 1; /* test the checksum */ for (i = 0, x = 0; (unsigned)i<=(unsigned)VPD_SIZE/2 - r->p_len; i++) { - x += pAC->vpd.vpd_buf[i] ; + x += pAC->vpd.vpd_buf[i]; } if (x != 0) { /* checksum error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("VPD Checksum Error\n")) ; - return (1) ; + ("VPD Checksum Error\n")); + return (1); } /* find and check the end tag of the RW area */ if (!(r = vpd_find_para(pAC,VPD_RW,&rp))) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: RV Tag not found\n")) ; - return (1) ; + ("Encoding Error: RV Tag not found\n")); + return (1); } if (r->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: Invalid VPD struct size\n")) ; - return (1) ; + ("Encoding Error: Invalid VPD struct size\n")); + return (1); } - pAC->vpd.v.vpd_free_rw = r->p_len ; + pAC->vpd.v.vpd_free_rw = r->p_len; /* everything seems to be ok */ - pAC->vpd.v.vpd_status |= VPD_VALID ; + pAC->vpd.v.vpd_status |= VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_INIT, ("done. Free RO = %d, Free RW = %d\n", - pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)); - return(0) ; + return(0); } /* @@ -570,62 +585,62 @@ SK_VPD_PARA *p) /* parameter description struct */ { char *v ; /* points to vpd buffer */ - int max ; /* Maximum Number of Iterations */ + int max; /* Maximum Number of Iterations */ - v = pAC->vpd.vpd_buf ; - max = 128 ; + v = pAC->vpd.vpd_buf; + max = 128; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd find para %s .. ",key)) ; + ("vpd find para %s .. ",key)); /* check mandatory resource type ID string (Product Name) */ if (*v != (char) RES_ID) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Error: 0x%x missing\n",RES_ID)) ; - return (0) ; + ("Error: 0x%x missing\n",RES_ID)); + return (0); } if (strcmp(key,VPD_NAME) == 0) { - p->p_len = VPD_GET_RES_LEN(v) ; - p->p_val = VPD_GET_VAL(v) ; + p->p_len = VPD_GET_RES_LEN(v); + p->p_val = VPD_GET_VAL(v); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("found, len = %d\n",p->p_len)) ; - return(p) ; + ("found, len = %d\n",p->p_len)); + return(p); } - v += 3 + VPD_GET_RES_LEN(v) + 3 ; - for ( ; ; ) { + v += 3 + VPD_GET_RES_LEN(v) + 3; + for (;; ) { if (SK_MEMCMP(key,v,2) == 0) { - p->p_len = VPD_GET_VPD_LEN(v) ; - p->p_val = VPD_GET_VAL(v) ; + p->p_len = VPD_GET_VPD_LEN(v); + p->p_val = VPD_GET_VAL(v); SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("found, len = %d\n",p->p_len)) ; - return (p) ; + ("found, len = %d\n",p->p_len)); + return (p); } /* exit when reaching the "RW" Tag or the maximum of itera. */ - max-- ; + max--; if (SK_MEMCMP(VPD_RW,v,2) == 0 || max == 0) { - break ; + break; } if (SK_MEMCMP(VPD_RV,v,2) == 0) { - v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ + v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */ } else { - v += 3 + VPD_GET_VPD_LEN(v) ; + v += 3 + VPD_GET_VPD_LEN(v); } SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("scanning '%c%c' len = %d\n",v[0],v[1],v[2])) ; + ("scanning '%c%c' len = %d\n",v[0],v[1],v[2])); } #ifdef DEBUG - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL,("not found\n")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL,("not found\n")); if (max == 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Key/Len Encoding error\n")) ; + ("Key/Len Encoding error\n")); } #endif - return (0) ; + return (0); } /* @@ -639,24 +654,24 @@ char *end, /* end of memory block to move */ int n) /* number of bytes the memory block has to be moved */ { - char *p ; - int i ; /* number of byte copied */ + char *p; + int i; /* number of byte copied */ if (n == 0) - return ; + return; - i = end - start + 1 ; + i = (int) (end - start + 1); if (n < 0) { - p = start + n ; + p = start + n; while (i != 0) { - *p++ = *start++ ; - i-- ; + *p++ = *start++; + i--; } } else { - p = end + n ; + p = end + n; while (i != 0) { - *p-- = *end-- ; - i-- ; + *p-- = *end--; + i--; } } } @@ -672,13 +687,13 @@ int len, /* length of the value string */ char *ip) /* inseration point */ { - SK_VPD_KEY *p ; + SK_VPD_KEY *p; - p = (SK_VPD_KEY *) ip ; - p->p_key[0] = key[0] ; - p->p_key[1] = key[1] ; - p->p_len = (unsigned char) len ; - SK_MEMCPY(&p->p_val,buf,len) ; + p = (SK_VPD_KEY *) ip; + p->p_key[0] = key[0]; + p->p_key[1] = key[1]; + p->p_len = (unsigned char) len; + SK_MEMCPY(&p->p_val,buf,len); } /* @@ -692,46 +707,46 @@ SK_AC *pAC, /* common data base */ char *etp) /* end pointer input position */ { - SK_VPD_KEY *p ; - unsigned char x ; - int i ; + SK_VPD_KEY *p; + unsigned char x; + int i; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd modify endtag at 0x%x = '%c%c'\n",etp,etp[0],etp[1])) ; + ("vpd modify endtag at 0x%x = '%c%c'\n",etp,etp[0],etp[1])); - p = (SK_VPD_KEY *) etp ; + p = (SK_VPD_KEY *) etp; if (p->p_key[0] != 'R' || (p->p_key[1] != 'V' && p->p_key[1] != 'W')) { /* something wrong here, encoding error */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Encoding Error: invalid end tag\n")) ; - return(1) ; + ("Encoding Error: invalid end tag\n")); + return(1); } if (etp > pAC->vpd.vpd_buf + VPD_SIZE/2) { /* create "RW" tag */ - p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE-etp-3-1) ; - pAC->vpd.v.vpd_free_rw = (int) p->p_len ; - i = pAC->vpd.v.vpd_free_rw ; - etp += 3 ; + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE-etp-3-1); + pAC->vpd.v.vpd_free_rw = (int) p->p_len; + i = pAC->vpd.v.vpd_free_rw; + etp += 3; } else { /* create "RV" tag */ - p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE/2-etp-3) ; - pAC->vpd.v.vpd_free_ro = (int) p->p_len - 1 ; + p->p_len = (unsigned char)(pAC->vpd.vpd_buf+VPD_SIZE/2-etp-3); + pAC->vpd.v.vpd_free_ro = (int) p->p_len - 1; /* setup checksum */ for (i = 0, x = 0; i < VPD_SIZE/2 - p->p_len; i++) { - x += pAC->vpd.vpd_buf[i] ; + x += pAC->vpd.vpd_buf[i]; } - p->p_val = (char) 0 - x ; - i = pAC->vpd.v.vpd_free_ro ; - etp += 4 ; + p->p_val = (char) 0 - x; + i = pAC->vpd.v.vpd_free_ro; + etp += 4; } while (i) { - *etp++ = 0x00 ; - i-- ; + *etp++ = 0x00; + i--; } - return (0) ; + return (0); } /* @@ -756,76 +771,76 @@ int type, /* VPD_RO_KEY or VPD_RW_KEY */ int op) /* operation to do: ADD_KEY or OWR_KEY */ { - SK_VPD_PARA vp ; - char *etp ; /* end tag position */ - int free ; /* remaining space in selected area */ - char *ip ; /* input position inside the VPD buffer */ - int rtv ; /* return code */ - int head ; /* additional haeder bytes to move */ - int found ; /* additinoal bytes if the keyword was found */ + SK_VPD_PARA vp; + char *etp; /* end tag position */ + int free; /* remaining space in selected area */ + char *ip; /* input position inside the VPD buffer */ + int rtv; /* return code */ + int head; /* additional haeder bytes to move */ + int found; /* additinoal bytes if the keyword was found */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("vpd setup para key = %s, val = %s\n",key,buf)) ; + ("vpd setup para key = %s, val = %s\n",key,buf)); - rtv = 0 ; - ip = 0 ; + rtv = 0; + ip = 0; if (type == VPD_RW_KEY) { /* end tag is "RW" */ - free = pAC->vpd.v.vpd_free_rw ; - etp = pAC->vpd.vpd_buf + (VPD_SIZE - free - 1 - 3) ; + free = pAC->vpd.v.vpd_free_rw; + etp = pAC->vpd.vpd_buf + (VPD_SIZE - free - 1 - 3); } else { /* end tag is "RV" */ - free = pAC->vpd.v.vpd_free_ro ; - etp = pAC->vpd.vpd_buf + (VPD_SIZE/2 - free - 4) ; + free = pAC->vpd.v.vpd_free_ro; + etp = pAC->vpd.vpd_buf + (VPD_SIZE/2 - free - 4); } SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, ("Free RO = %d, Free RW = %d\n", - pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)) ; + pAC->vpd.v.vpd_free_ro, pAC->vpd.v.vpd_free_rw)); - head = 0 ; - found = 0 ; + head = 0; + found = 0; if (op == OWR_KEY) { if (vpd_find_para(pAC,key,&vp)) { - found = 3 ; - ip = vp.p_val - 3 ; - free += vp.p_len + 3 ; + found = 3; + ip = vp.p_val - 3; + free += vp.p_len + 3; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("Overwrite Key\n")) ; + ("Overwrite Key\n")); } else { - op = ADD_KEY ; + op = ADD_KEY; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_CTRL, - ("Add Key\n")) ; + ("Add Key\n")); } } if (op == ADD_KEY) { - ip = etp ; - vp.p_len = 0 ; - head = 3 ; + ip = etp; + vp.p_len = 0; + head = 3; } if (len + 3 > free) { if (free < 7) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, ("VPD Buffer Overflow, keyword not written\n")); - return (4) ; + return (4); } /* cut it again */ - len = free - 3 ; - rtv = 2 ; + len = free - 3; + rtv = 2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Buffer Full, Keyword was cut\n")) ; + ("VPD Buffer Full, Keyword was cut\n")); } - vpd_move_para(ip + vp.p_len + found, etp+2, len-vp.p_len+head) ; - vpd_insert_key(key, buf, len, ip) ; + vpd_move_para(ip + vp.p_len + found, etp+2, len-vp.p_len+head); + vpd_insert_key(key, buf, len, ip); if (vpd_mod_endtag(pAC, etp + len - vp.p_len + head)) { - pAC->vpd.v.vpd_status &= ~VPD_VALID ; + pAC->vpd.v.vpd_status &= ~VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Encoding Error\n")) ; - return(6) ; + ("VPD Encoding Error\n")); + return(6); } - return (rtv) ; + return (rtv); } @@ -833,7 +848,7 @@ * Read the contents of the VPD EEPROM and copy it to the * VPD buffer if not already done. * - * return: A pointer to the vpd_status structure. The structure contain + * return: A pointer to the vpd_status structure. The structure contains * this fields. */ SK_VPD_STATUS *VpdStat( @@ -841,9 +856,9 @@ SK_IOC IoC) /* IO Context */ { if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { - (void)VpdInit(pAC,IoC) ; + (void)VpdInit(pAC,IoC); } - return(&pAC->vpd.v) ; + return(&pAC->vpd.v); } @@ -876,67 +891,67 @@ int *len, /* buffer length */ int *elements) /* number of keywords returned */ { - char *v ; - int n ; + char *v; + int n; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("list vpd keys .. ")) ; - *elements = 0 ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("list vpd keys .. ")); + *elements = 0; if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("VPD Init Error, terminated\n")) ; - return(6) ; + ("VPD Init Error, terminated\n")); + return(6); } } if ((signed)strlen(VPD_NAME) + 1 <= *len) { - v = pAC->vpd.vpd_buf ; - strcpy(buf,VPD_NAME) ; - n = strlen(VPD_NAME) + 1 ; - buf += n ; - *elements = 1 ; + v = pAC->vpd.vpd_buf; + strcpy(buf,VPD_NAME); + n = strlen(VPD_NAME) + 1; + buf += n; + *elements = 1; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, - ("'%c%c' ",v[0],v[1])) ; + ("'%c%c' ",v[0],v[1])); } else { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("buffer overflow\n")) ; - return(2) ; + ("buffer overflow\n")); + return(2); } - v += 3 + VPD_GET_RES_LEN(v) + 3 ; - for ( ; ; ) { + v += 3 + VPD_GET_RES_LEN(v) + 3; + for (;; ) { /* exit when reaching the "RW" Tag */ if (SK_MEMCMP(VPD_RW,v,2) == 0) { - break ; + break; } if (SK_MEMCMP(VPD_RV,v,2) == 0) { - v += 3 + VPD_GET_VPD_LEN(v) + 3 ; /* skip VPD-W */ - continue ; + v += 3 + VPD_GET_VPD_LEN(v) + 3; /* skip VPD-W */ + continue; } if (n+3 <= *len) { - SK_MEMCPY(buf,v,2) ; - buf += 2 ; - *buf++ = '\0' ; - n += 3 ; - v += 3 + VPD_GET_VPD_LEN(v) ; - *elements += 1 ; + SK_MEMCPY(buf,v,2); + buf += 2; + *buf++ = '\0'; + n += 3; + v += 3 + VPD_GET_VPD_LEN(v); + *elements += 1; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, - ("'%c%c' ",v[0],v[1])) ; + ("'%c%c' ",v[0],v[1])); } else { - *len = n ; + *len = n; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("buffer overflow\n")) ; - return (2) ; + ("buffer overflow\n")); + return (2); } } - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("\n")) ; - *len = n ; - return(0) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("\n")); + *len = n; + return(0); } @@ -960,34 +975,34 @@ char *buf, /* buffer where to copy the keyword value */ int *len) /* buffer length */ { - SK_VPD_PARA *p, vp ; + SK_VPD_PARA *p, vp; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("vpd read %s .. ",key)) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX,("vpd read %s .. ",key)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { - *len = 0 ; + *len = 0; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } if ((p = vpd_find_para(pAC,key,&vp))) { if (p->p_len > (*(unsigned *)len)-1) { - p->p_len = *len - 1 ; + p->p_len = *len - 1; } - SK_MEMCPY(buf,p->p_val,p->p_len) ; - buf[p->p_len] = '\0' ; - *len = p->p_len ; + SK_MEMCPY(buf,p->p_val,p->p_len); + buf[p->p_len] = '\0'; + *len = p->p_len; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_RX, ("%c%c%c%c.., len = %d\n", - buf[0],buf[1],buf[2],buf[3],*len)) ; + buf[0],buf[1],buf[2],buf[3],*len)); } else { - *len = 0 ; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,("not found\n")) ; - return (1) ; + *len = 0; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR,("not found\n")); + return (1); } - return (0) ; + return (0); } @@ -1005,9 +1020,9 @@ key[1] < '0' || key[1] > 'Z' || (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { - return (SK_FALSE) ; + return (SK_FALSE); } - return (SK_TRUE) ; + return (SK_TRUE); } /* @@ -1029,46 +1044,46 @@ char *key, /* keyword to write (allowed values "Yx", "Vx") */ char *buf) /* buffer where the keyword value can be read from */ { - int len ; /* lenght of the keyword to write */ - int rtv ; /* return code */ - int rtv2 ; + int len; /* lenght of the keyword to write */ + int rtv; /* return code */ + int rtv2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, - ("vpd write %s = %s\n",key,buf)) ; + ("vpd write %s = %s\n",key,buf)); if ((*key != 'Y' && *key != 'V') || key[1] < '0' || key[1] > 'Z' || (key[1] > '9' && key[1] < 'A') || strlen(key) != 2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("illegal key tag, keyword not written\n")) ; - return (5) ; + ("illegal key tag, keyword not written\n")); + return (5); } if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } - rtv = 0 ; - len = strlen(buf) ; + rtv = 0; + len = strlen(buf); if (len > VPD_MAX_LEN) { /* cut it */ - len = VPD_MAX_LEN ; - rtv = 2 ; + len = VPD_MAX_LEN; + rtv = 2; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("keyword to long, cut after %d bytes\n",VPD_MAX_LEN)) ; + ("keyword to long, cut after %d bytes\n",VPD_MAX_LEN)); } if ((rtv2 = VpdSetupPara(pAC,key,buf,len,VPD_RW_KEY,OWR_KEY)) != 0) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd write error\n")) ; - return(rtv2) ; + ("vpd write error\n")); + return(rtv2); } - return (rtv) ; + return (rtv); } /* @@ -1088,15 +1103,15 @@ SK_IOC IoC, /* IO Context */ char *key) /* keyword to read (e.g. "MN") */ { - SK_VPD_PARA *p, vp ; - char *etp ; + SK_VPD_PARA *p, vp; + char *etp; - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd delete key %s\n",key)) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd delete key %s\n",key)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return(6) ; + ("vpd init error\n")); + return(6); } } @@ -1104,27 +1119,27 @@ if (p->p_val < pAC->vpd.vpd_buf + VPD_SIZE/2) { /* try to delete read only keyword */ SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("cannot delete RO keyword\n")) ; - return (5) ; + ("cannot delete RO keyword\n")); + return (5); } - etp = pAC->vpd.vpd_buf + (VPD_SIZE-pAC->vpd.v.vpd_free_rw-1-3) ; + etp = pAC->vpd.vpd_buf + (VPD_SIZE-pAC->vpd.v.vpd_free_rw-1-3); vpd_move_para(vp.p_val+vp.p_len, etp+2, - - ((int)(vp.p_len + 3))) ; + - ((int)(vp.p_len + 3))); if (vpd_mod_endtag(pAC, etp - vp.p_len - 3)) { - pAC->vpd.v.vpd_status &= ~VPD_VALID ; + pAC->vpd.v.vpd_status &= ~VPD_VALID; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd encoding error\n")) ; - return(6) ; + ("vpd encoding error\n")); + return(6); } } else { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("keyword not found\n")) ; - return (1) ; + ("keyword not found\n")); + return (1); } - return (0) ; + return (0); } /* @@ -1138,18 +1153,18 @@ SK_AC *pAC, /* Adapters context */ SK_IOC IoC) /* IO Context */ { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd update .. ")) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("vpd update .. ")); if (pAC->vpd.v.vpd_status & VPD_VALID) { if (VpdTransferBlock(pAC,IoC,pAC->vpd.vpd_buf + VPD_SIZE/2, VPD_SIZE/2, VPD_SIZE/2, VPD_WRITE) != VPD_SIZE/2) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("transfer timed out\n")) ; - return(3) ; + ("transfer timed out\n")); + return(3); } } - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("done\n")) ; - return (0) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("done\n")); + return (0); } @@ -1169,32 +1184,32 @@ SK_IOC IoC, /* IO Context */ char *msg) /* error log message */ { - SK_VPD_PARA *v, vf ; /* VF */ - int len ; + SK_VPD_PARA *v, vf; /* VF */ + int len; SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX, - ("vpd error log msg %s\n",msg)) ; + ("vpd error log msg %s\n",msg)); if (!(pAC->vpd.v.vpd_status & VPD_VALID)) { if (VpdInit(pAC,IoC) != 0 ) { SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR, - ("vpd init error\n")) ; - return ; + ("vpd init error\n")); + return; } } - len = strlen(msg) ; + len = strlen(msg); if (len > VPD_MAX_LEN) { /* cut it */ - len = VPD_MAX_LEN ; + len = VPD_MAX_LEN; } if ((v = vpd_find_para(pAC,VPD_VF,&vf))) { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("overwrite VL\n")) ; - (void)VpdSetupPara(pAC,VPD_VL,msg,len,VPD_RW_KEY,OWR_KEY) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("overwrite VL\n")); + (void)VpdSetupPara(pAC,VPD_VL,msg,len,VPD_RW_KEY,OWR_KEY); } else { - SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("write VF\n")) ; - (void)VpdSetupPara(pAC,VPD_VF,msg,len,VPD_RW_KEY,ADD_KEY) ; + SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_TX,("write VF\n")); + (void)VpdSetupPara(pAC,VPD_VF,msg,len,VPD_RW_KEY,ADD_KEY); } - (void)VpdUpdate(pAC,IoC) ; + (void)VpdUpdate(pAC,IoC); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sk98lin/skxmac2.c linux/drivers/net/sk98lin/skxmac2.c --- v2.4.0-test8/linux/drivers/net/sk98lin/skxmac2.c Tue Nov 23 10:15:42 1999 +++ linux/drivers/net/sk98lin/skxmac2.c Fri Sep 15 14:34:19 2000 @@ -2,8 +2,8 @@ * * Name: skxmac2.c * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.49 $ - * Date: $Date: 1999/11/22 08:12:13 $ + * Version: $Revision: 1.53 $ + * Date: $Date: 2000/07/27 12:22:11 $ * Purpose: Contains functions to initialize the XMAC II * ******************************************************************************/ @@ -13,8 +13,6 @@ * (C)Copyright 1998,1999 SysKonnect, * a business unit of Schneider & Koch & Co. Datensysteme GmbH. * - * See the file "skge.c" for further information. - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -29,6 +27,18 @@ * History: * * $Log: skxmac2.c,v $ + * Revision 1.53 2000/07/27 12:22:11 gklug + * fix: possible endless loop in XmHardRst. + * + * Revision 1.52 2000/05/22 08:48:31 malthoff + * Fix: #10523 errata valid for all BCOM PHYs. + * + * Revision 1.51 2000/05/17 12:52:18 malthoff + * Fixes BCom link errata (#10523). + * + * Revision 1.50 1999/11/22 13:40:14 cgoos + * Changed license header to GPL. + * * Revision 1.49 1999/11/22 08:12:13 malthoff * Add workaround for power consumption feature of Bcom C0 chip. * @@ -224,7 +234,7 @@ /* local variables ************************************************************/ static const char SysKonnectFileId[] = - "@(#)$Id: skxmac2.c,v 1.49 1999/11/22 08:12:13 malthoff Exp $ (C) SK "; + "@(#)$Id: skxmac2.c,v 1.53 2000/07/27 12:22:11 gklug Exp $ (C) SK "; /* BCOM PHY magic pattern list */ typedef struct s_PhyHack { @@ -558,6 +568,10 @@ * register (Timing requirements: Broadcom: 400ns, Level One: * none, National: 80ns). * + * ATTENTION: + * It is absolutely neccessary to reset the SW_RST Bit first + * before calling this function. + * * Returns: * nothing */ @@ -568,6 +582,7 @@ { SK_U16 Word; int i; + int TOut; SK_U32 Reg; for (i=0; i<4; i++) { @@ -575,12 +590,25 @@ /* bit contains buttoms to press */ SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), (SK_U16) MFF_CLR_MAC_RST); - SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), - (SK_U16) MFF_SET_MAC_RST); + + TOut = 0; do { + TOut ++; + if (TOut > 10000) { + /* + * Adapter seems to be in RESET state. + * Registers cannot be written. + */ + return; + } + + SK_OUT16(IoC, MR_ADDR(Port, TX_MFF_CTRL1), + (SK_U16) MFF_SET_MAC_RST); SK_IN16(IoC,MR_ADDR(Port,TX_MFF_CTRL1), &Word); } while ((Word & MFF_SET_MAC_RST) == 0); } + + /* For external PHYs there must be special handling */ if (pAC->GIni.GP[Port].PhyType != SK_PHY_XMAC) { /* reset external PHY */ @@ -696,6 +724,11 @@ i++; } } + /* Workaround BCOM Errata (#10523) for all BCom PHYs*/ + /* Disable Power Management after reset */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + SWord | PHY_B_AC_DIS_PM); /* * PHY LED initialization is performed in @@ -1845,6 +1878,7 @@ SK_GEPORT *pPrt; SK_U16 Reg ; /* 16bit register value */ SK_U16 IntMask; /* XMac interrupt mask */ + SK_U16 SWord; pPrt = &pAC->GIni.GP[Port]; @@ -1892,6 +1926,11 @@ } switch (pPrt->PhyType) { case SK_PHY_BCOM: + /* Workaround BCOM Errata (#10523) for all BCom Phys */ + /* Enable Power Management after link up */ + PHY_READ(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, &SWord); + PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_AUX_CTRL, + SWord & ~PHY_B_AC_DIS_PM); PHY_WRITE(IoC, pPrt, Port, PHY_BCOM_INT_MASK, PHY_B_DEF_MSK); break; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/skfp/skfddi.c linux/drivers/net/skfp/skfddi.c --- v2.4.0-test8/linux/drivers/net/skfp/skfddi.c Tue Jul 11 11:12:24 2000 +++ linux/drivers/net/skfp/skfddi.c Fri Sep 15 14:34:36 2000 @@ -1654,7 +1654,8 @@ virt = mac_drv_get_space(smc, size); - size = (u_int) ((0 - (unsigned long) virt) & 15UL); + size = (u_int) (16 - (((unsigned long) virt) & 15UL)); + size = size % 16; PRINTK("Allocate %u bytes alignment gap ", size); PRINTK("for descriptor memory.\n"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/sunlance.c linux/drivers/net/sunlance.c --- v2.4.0-test8/linux/drivers/net/sunlance.c Sun Aug 13 12:01:54 2000 +++ linux/drivers/net/sunlance.c Sun Sep 17 09:41:29 2000 @@ -1332,6 +1332,7 @@ /* Make certain the data structures used by the LANCE are aligned. */ dev->priv = (void *)(((unsigned long)dev->priv + 7) & ~7); lp = (struct lance_private *) dev->priv; + spin_lock_init(&lp->lock); /* Copy the IDPROM ethernet address to the device structure, later we * will copy the address in the device structure to the lance diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/tulip/tulip_core.c linux/drivers/net/tulip/tulip_core.c --- v2.4.0-test8/linux/drivers/net/tulip/tulip_core.c Fri Sep 8 12:34:58 2000 +++ linux/drivers/net/tulip/tulip_core.c Mon Sep 18 14:57:01 2000 @@ -1092,7 +1092,7 @@ dev->base_addr = ioaddr; dev->irq = irq; - pdev->driver_data = dev; + pci_set_drvdata(pdev, dev); #ifdef TULIP_FULL_DUPLEX tp->full_duplex = 1; @@ -1393,7 +1393,7 @@ static void tulip_suspend (struct pci_dev *pdev) { - struct net_device *dev = pdev->driver_data; + struct net_device *dev = pci_get_drvdata(pdev); if (dev && netif_device_present (dev)) { netif_device_detach (dev); @@ -1405,7 +1405,7 @@ static void tulip_resume(struct pci_dev *pdev) { - struct net_device *dev = pdev->driver_data; + struct net_device *dev = pci_get_drvdata(pdev); pci_enable_device(pdev); if (dev && !netif_device_present (dev)) { @@ -1417,7 +1417,7 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev) { - struct net_device *dev = pdev->driver_data; + struct net_device *dev = pci_get_drvdata(pdev); if (dev) { struct tulip_private *tp = (struct tulip_private *)dev->priv; @@ -1432,6 +1432,8 @@ release_region (pci_resource_start (pdev, 0), pci_resource_len (pdev, 0)); kfree(dev); + + pci_set_drvdata(pdev, NULL); } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/Makefile linux/drivers/net/wan/Makefile --- v2.4.0-test8/linux/drivers/net/wan/Makefile Mon Aug 14 10:19:03 2000 +++ linux/drivers/net/wan/Makefile Sun Sep 17 09:41:29 2000 @@ -35,6 +35,7 @@ obj-$(CONFIG_COMX_PROTO_FR) += comx-proto-fr.o obj-$(CONFIG_COSA) += syncppp.o cosa.o obj-$(CONFIG_LANMEDIA) += syncppp.o +obj-$(CONFIG_X25_ASY) += x25_asy.o ifeq ($(CONFIG_LANMEDIA),y) SUB_DIRS += lmc diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-hw-comx.c linux/drivers/net/wan/comx-hw-comx.c --- v2.4.0-test8/linux/drivers/net/wan/comx-hw-comx.c Sun May 21 20:34:37 2000 +++ linux/drivers/net/wan/comx-hw-comx.c Mon Sep 18 15:02:03 2000 @@ -9,6 +9,9 @@ * * Copyright (C) 1995-2000 ITConsult-Pro Co. * + * Contributors: + * Arnaldo Carvalho de Melo - 0.86 + * * 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 @@ -37,9 +40,11 @@ * Version 0.85 (00/01/14): * - some additional workarounds :/ * - printk cleanups + * Version 0.86 (00/08/15): + * - resource release on failure at COMX_init */ -#define VERSION "0.85" +#define VERSION "0.86" #include #include @@ -1224,7 +1229,7 @@ if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1234,7 +1239,7 @@ if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1244,7 +1249,7 @@ if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_irq; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1255,7 +1260,7 @@ if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) { if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_channel; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1266,7 +1271,7 @@ if ((new_file = create_proc_entry(FILENAME_MEMADDR, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_clock; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1276,7 +1281,7 @@ if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_memaddr; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1285,7 +1290,7 @@ if ((new_file = create_proc_entry(FILENAME_FIRMWARE, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_twin; } new_file->data = (void *)new_file; new_file->read_proc = &comxhw_read_proc; @@ -1326,6 +1331,23 @@ MOD_INC_USE_COUNT; return 0; + +cleanup_filename_twin: + remove_proc_entry(FILENAME_TWIN, ch->procdir); +cleanup_filename_memaddr: + remove_proc_entry(FILENAME_MEMADDR, ch->procdir); +cleanup_filename_clock: + if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) + remove_proc_entry(FILENAME_CLOCK, ch->procdir); +cleanup_filename_channel: + remove_proc_entry(FILENAME_CHANNEL, ch->procdir); +cleanup_filename_irq: + remove_proc_entry(FILENAME_IRQ, ch->procdir); +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } /* Called on echo valami >boardtype */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-hw-locomx.c linux/drivers/net/wan/comx-hw-locomx.c --- v2.4.0-test8/linux/drivers/net/wan/comx-hw-locomx.c Sun May 21 20:34:37 2000 +++ linux/drivers/net/wan/comx-hw-locomx.c Mon Sep 18 15:02:03 2000 @@ -7,6 +7,9 @@ * Based on skeleton code and old LoCOMX driver by Tivadar Szemethy * and the hostess_sv11 driver * + * Contributors: + * Arnaldo Carvalho de Melo (0.14) + * * Copyright (C) 1999 ITConsult-Pro Co. * * This program is free software; you can redistribute it and/or @@ -27,9 +30,11 @@ * Version 0.13 (99/07/08): * - Fix the transmitter status check * - Handle the net device statistics better + * Version 0.14 (00/08/15): + * - resource release on failure at LOCOMX_init */ -#define VERSION "0.13" +#define VERSION "0.14" #include #include @@ -385,7 +390,7 @@ /* Register /proc files */ if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; @@ -394,7 +399,7 @@ if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &locomx_read_proc; @@ -432,6 +437,11 @@ /* O.K. Count one more user on this module */ MOD_INC_USE_COUNT; return 0; +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-hw-mixcom.c linux/drivers/net/wan/comx-hw-mixcom.c --- v2.4.0-test8/linux/drivers/net/wan/comx-hw-mixcom.c Sun May 21 20:34:37 2000 +++ linux/drivers/net/wan/comx-hw-mixcom.c Mon Sep 18 15:02:03 2000 @@ -8,6 +8,9 @@ * * Copyright (C) 1998-1999 ITConsult-Pro Co. * + * Contributors: + * Arnaldo Carvalho de Melo (0.65) + * * 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 @@ -29,9 +32,12 @@ * * Version 0.64 (99/12/01): * - some more cosmetical fixes + * + * Version 0.65 (00/08/15) + * - resource release on failure at MIXCOM_init */ -#define VERSION "0.64" +#define VERSION "0.65" #include #include @@ -819,7 +825,7 @@ if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_HW_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -828,7 +834,7 @@ if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_io; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -848,7 +854,7 @@ if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_irq; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -857,7 +863,7 @@ if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_channel; } new_file->data = (void *)new_file; new_file->read_proc = &mixcom_read_proc; @@ -881,6 +887,15 @@ MOD_INC_USE_COUNT; return 0; +cleanup_filename_channel: + remove_proc_entry(FILENAME_CHANNEL, ch->procdir); +cleanup_filename_irq: + remove_proc_entry(FILENAME_IRQ, ch->procdir); +cleanup_filename_io: + remove_proc_entry(FILENAME_IO, ch->procdir); +cleanup_HW_privdata: + kfree(ch->HW_privdata); + return -EIO; } static int MIXCOM_exit(struct net_device *dev) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-proto-fr.c linux/drivers/net/wan/comx-proto-fr.c --- v2.4.0-test8/linux/drivers/net/wan/comx-proto-fr.c Sun May 21 20:34:37 2000 +++ linux/drivers/net/wan/comx-proto-fr.c Mon Sep 18 15:02:03 2000 @@ -6,6 +6,9 @@ * Maintainer: Gergely Madarasz * * Copyright (C) 1998-1999 ITConsult-Pro Co. + * + * Contributors: + * Arnaldo Carvalho de Melo (0.73) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,9 +28,13 @@ * Version 0.72 (99/07/09): * - handle slave tbusy with master tbusy (should be fixed) * - fix the keepalive timer addition/deletion + * + * Version 0.73 (00/08/15) + * - resource release on failure at fr_master_init and + * fr_slave_init */ -#define VERSION "0.72" +#define VERSION "0.73" #include #include @@ -793,7 +800,7 @@ if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_LINE_privdata; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -803,7 +810,7 @@ if ((new_file = create_proc_entry(FILENAME_KEEPALIVE, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_filename_dlci; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -815,6 +822,11 @@ MOD_INC_USE_COUNT; return 0; +cleanup_filename_dlci: + remove_proc_entry(FILENAME_DLCI, ch->procdir); +cleanup_LINE_privdata: + kfree(fr); + return -EIO; } static int fr_slave_init(struct net_device *dev) @@ -847,7 +859,7 @@ if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, ch->procdir)) == NULL) { - return -ENOMEM; + goto cleanup_LINE_privdata; } new_file->data = (void *)new_file; @@ -858,7 +870,7 @@ if ((new_file = create_proc_entry(FILENAME_MASTER, S_IFREG | 0644, ch->procdir)) == NULL) { - return -EIO; + goto cleanup_filename_dlci; } new_file->data = (void *)new_file; new_file->read_proc = &fr_read_proc; @@ -867,6 +879,11 @@ new_file->nlink = 1; MOD_INC_USE_COUNT; return 0; +cleanup_filename_dlci: + remove_proc_entry(FILENAME_DLCI, ch->procdir); +cleanup_LINE_privdata: + kfree(fr); + return -EIO; } static int dlci_open(struct net_device *dev) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx-proto-ppp.c linux/drivers/net/wan/comx-proto-ppp.c --- v2.4.0-test8/linux/drivers/net/wan/comx-proto-ppp.c Mon Mar 13 13:55:09 2000 +++ linux/drivers/net/wan/comx-proto-ppp.c Mon Sep 18 15:02:03 2000 @@ -200,6 +200,8 @@ struct ppp_device *pppdev = (struct ppp_device *)ch->if_ptr; ch->LINE_privdata = kmalloc(sizeof(struct syncppp_data), GFP_KERNEL); + if (!ch->LINE_privdata) + return -ENOMEM; pppdev->dev = dev; sppp_attach(pppdev); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/net/wan/comx.c linux/drivers/net/wan/comx.c --- v2.4.0-test8/linux/drivers/net/wan/comx.c Wed Jun 21 10:10:02 2000 +++ linux/drivers/net/wan/comx.c Mon Sep 18 15:02:03 2000 @@ -10,6 +10,9 @@ * * Copyright (C) 1995-1999 ITConsult-Pro Co. * + * Contributors: + * Arnaldo Carvalho de Melo (0.85) + * * 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 @@ -39,9 +42,13 @@ * Version 0.84 (99/12/01): * - comx_status should not check for IFF_UP (to report * line status from dev->open()) + * + * Version 0.85 (00/08/15): + * - resource release on failure in comx_mkdir + * - fix return value on failure at comx_write_proc */ -#define VERSION "0.84" +#define VERSION "0.85" #include #include @@ -506,6 +513,7 @@ ch->loadavg_size = ch->loadavg[2] / ch->loadavg[0] + 1; if ((ch->avg_bytes = kmalloc(ch->loadavg_size * sizeof(unsigned long) * 2, GFP_KERNEL)) == NULL) { + kfree(ch); return -ENOMEM; } @@ -629,7 +637,7 @@ ch->debug_start = ch->debug_end = 0; restore_flags(flags); free_page((unsigned long)page); - return count; + return ret ? ret : count; } if (*page != '+' && *page != '-') { @@ -762,10 +770,16 @@ struct proc_dir_entry *new_dir, *debug_file; struct net_device *dev; struct comx_channel *ch; + int ret = -EIO; + + if ((dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) == NULL) { + return -ENOMEM; + } + memset(dev, 0, sizeof(struct net_device)); if ((new_dir = create_proc_entry(dentry->d_name.name, mode | S_IFDIR, comx_root_dir)) == NULL) { - return -EIO; + goto cleanup_dev; } new_dir->nlink = 2; @@ -774,42 +788,38 @@ /* Ezek kellenek */ if (!create_comx_proc_entry(FILENAME_HARDWARE, 0644, strlen(HWNAME_NONE) + 1, new_dir)) { - return -ENOMEM; + goto cleanup_new_dir; } if (!create_comx_proc_entry(FILENAME_PROTOCOL, 0644, strlen(PROTONAME_NONE) + 1, new_dir)) { - return -ENOMEM; + goto cleanup_filename_hardware; } if (!create_comx_proc_entry(FILENAME_STATUS, 0444, 0, new_dir)) { - return -ENOMEM; + goto cleanup_filename_protocol; } if (!create_comx_proc_entry(FILENAME_LINEUPDELAY, 0644, 2, new_dir)) { - return -ENOMEM; + goto cleanup_filename_status; } if ((debug_file = create_proc_entry(FILENAME_DEBUG, S_IFREG | 0644, new_dir)) == NULL) { - return -ENOMEM; + goto cleanup_filename_lineupdelay; } debug_file->data = (void *)debug_file; debug_file->read_proc = NULL; // see below debug_file->write_proc = &comx_write_proc; debug_file->nlink = 1; - if ((dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) == NULL) { - return -ENOMEM; - } - memset(dev, 0, sizeof(struct net_device)); strcpy(dev->name, (char *)new_dir->name); dev->init = comx_init_dev; if (register_netdevice(dev)) { - return -EIO; + goto cleanup_filename_debug; } ch=dev->priv; if((ch->if_ptr = (void *)kmalloc(sizeof(struct ppp_device), GFP_KERNEL)) == NULL) { - return -ENOMEM; + goto cleanup_register; } memset(ch->if_ptr, 0, sizeof(struct ppp_device)); ch->debug_file = debug_file; @@ -819,13 +829,33 @@ ch->debug_start = ch->debug_end = 0; if ((ch->debug_area = kmalloc(ch->debug_size = DEFAULT_DEBUG_SIZE, GFP_KERNEL)) == NULL) { - return -ENOMEM; + ret = -ENOMEM; + goto cleanup_if_ptr; } ch->lineup_delay = DEFAULT_LINEUP_DELAY; MOD_INC_USE_COUNT; return 0; +cleanup_if_ptr: + kfree(ch->if_ptr); +cleanup_register: + unregister_netdevice(dev); +cleanup_filename_debug: + remove_proc_entry(FILENAME_DEBUG, new_dir); +cleanup_filename_lineupdelay: + remove_proc_entry(FILENAME_LINEUPDELAY, new_dir); +cleanup_filename_status: + remove_proc_entry(FILENAME_STATUS, new_dir); +cleanup_filename_protocol: + remove_proc_entry(FILENAME_PROTOCOL, new_dir); +cleanup_filename_hardware: + remove_proc_entry(FILENAME_HARDWARE, new_dir); +cleanup_new_dir: + remove_proc_entry(dentry->d_name.name, &comx_root_dir); +cleanup_dev: + kfree(dev); + return ret; } static int comx_rmdir(struct inode *dir, struct dentry *dentry) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/parport/ChangeLog linux/drivers/parport/ChangeLog --- v2.4.0-test8/linux/drivers/parport/ChangeLog Mon Jul 24 18:59:27 2000 +++ linux/drivers/parport/ChangeLog Sun Sep 17 09:45:07 2000 @@ -1,3 +1,8 @@ +2000-09-16 Cesar Eduardo Barros + + * parport_pc.c (sio_via_686a_probe): Handle case + where hardware returns 255 for IRQ or DMA. + 2000-07-20 Eddie C. Dost * share.c (attach_driver_chain): attach[i](port) needs to be diff -u --recursive --new-file v2.4.0-test8/linux/drivers/parport/parport_pc.c linux/drivers/parport/parport_pc.c --- v2.4.0-test8/linux/drivers/parport/parport_pc.c Sun Aug 6 11:24:58 2000 +++ linux/drivers/parport/parport_pc.c Sun Sep 17 09:45:07 2000 @@ -2239,11 +2239,13 @@ irq = ((irq >> 4) & 0x0F); /* filter bogus IRQs */ + /* 255 means NONE, and is bogus as well */ switch (irq) { case 0: case 2: case 8: case 13: + case 255: irq = PARPORT_IRQ_NONE; break; @@ -2252,7 +2254,9 @@ } /* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */ - if (!have_eppecp) + /* 255 means NONE. Looks like some BIOS don't set the DMA correctly + * even on ECP mode */ + if (!have_eppecp || dma == 255) dma = PARPORT_DMA_NONE; /* finally, do the probe with values obtained */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pci/pci.c linux/drivers/pci/pci.c --- v2.4.0-test8/linux/drivers/pci/pci.c Mon Jun 19 13:42:38 2000 +++ linux/drivers/pci/pci.c Sun Sep 17 10:01:49 2000 @@ -657,134 +657,82 @@ return child; } -/* - * A CardBus bridge is basically the same as a regular PCI bridge, - * except we don't scan behind it because it will be changing. - */ -static int __init pci_scan_cardbus(struct pci_bus *bus, struct pci_dev *dev, int busnr) -{ - int i; - unsigned short cr; - unsigned int buses; - struct pci_bus *child; - - /* - * Insert it into the tree of buses. - */ - DBG("Scanning CardBus bridge %s\n", dev->slot_name); - child = pci_add_new_bus(bus, dev, ++busnr); - - for (i = 0; i < 4; i++) - child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i]; - - /* - * Maybe we'll have another bus behind this one? - */ - child->subordinate = ++busnr; - sprintf(child->name, "PCI CardBus #%02x", child->number); - - /* - * Clear all status bits and turn off memory, - * I/O and master enables. - */ - pci_read_config_word(dev, PCI_COMMAND, &cr); - pci_write_config_word(dev, PCI_COMMAND, 0x0000); - pci_write_config_word(dev, PCI_STATUS, 0xffff); - - /* - * Read the existing primary/secondary/subordinate bus - * number configuration to determine if the bridge - * has already been configured by the system. If so, - * do not modify the configuration, merely note it. - */ - pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); - if ((buses & 0xFFFFFF) != 0 && ! pcibios_assign_all_busses()) { - child->primary = buses & 0xFF; - child->secondary = (buses >> 8) & 0xFF; - child->subordinate = (buses >> 16) & 0xFF; - child->number = child->secondary; - if (child->subordinate > busnr) - busnr = child->subordinate; - } else { - /* - * Configure the bus numbers for this bridge: - */ - buses &= 0xff000000; - buses |= - (((unsigned int)(child->primary) << 0) | - ((unsigned int)(child->secondary) << 8) | - ((unsigned int)(child->subordinate) << 16)); - pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); - } - pci_write_config_word(dev, PCI_COMMAND, cr); - return busnr; -} - static unsigned int __init pci_do_scan_bus(struct pci_bus *bus); /* - * If it's a bridge, scan the bus behind it. + * If it's a bridge, configure it and scan the bus behind it. + * For CardBus bridges, we don't scan behind as the devices will + * be handled by the bridge driver itself. + * + * We need to process bridges in two passes -- first we scan those + * already configured by the BIOS and after we are done with all of + * them, we proceed to assigning numbers to the remaining buses in + * order to avoid overlaps between old and new bus numbers. */ -static int __init pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max) +static int __init pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) { unsigned int buses; unsigned short cr; struct pci_bus *child; + int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); - /* - * Insert it into the tree of buses. - */ - DBG("Scanning behind PCI bridge %s\n", dev->slot_name); - child = pci_add_new_bus(bus, dev, ++max); - sprintf(child->name, "PCI Bus #%02x", child->number); - - /* - * Clear all status bits and turn off memory, - * I/O and master enables. - */ - pci_read_config_word(dev, PCI_COMMAND, &cr); - pci_write_config_word(dev, PCI_COMMAND, 0x0000); - pci_write_config_word(dev, PCI_STATUS, 0xffff); - - /* - * Read the existing primary/secondary/subordinate bus - * number configuration to determine if the PCI bridge - * has already been configured by the system. If so, - * do not modify the configuration, merely note it. - */ pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); - if ((buses & 0xFFFFFF) != 0 && ! pcibios_assign_all_busses()) { - unsigned int cmax; + DBG("Scanning behind PCI bridge %s, config %06x, pass %d\n", dev->slot_name, buses & 0xffffff, pass); + if ((buses & 0xffffff) && !pcibios_assign_all_busses()) { + /* + * Bus already configured by firmware, process it in the first + * pass and just note the configuration. + */ + if (pass) + return max; + child = pci_add_new_bus(bus, dev, 0); child->primary = buses & 0xFF; child->secondary = (buses >> 8) & 0xFF; child->subordinate = (buses >> 16) & 0xFF; child->number = child->secondary; - cmax = pci_do_scan_bus(child); - if (cmax > max) max = cmax; + if (!is_cardbus) { + unsigned int cmax = pci_do_scan_bus(child); + if (cmax > max) max = cmax; + } } else { /* - * Configure the bus numbers for this bridge: + * We need to assign a number to this bus which we always + * do in the second pass. We also keep all address decoders + * on the bridge disabled during scanning. FIXME: Why? */ - buses &= 0xff000000; - buses |= - (((unsigned int)(child->primary) << 0) | - ((unsigned int)(child->secondary) << 8) | - ((unsigned int)(child->subordinate) << 16)); - pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); + if (!pass) + return max; + pci_read_config_word(dev, PCI_COMMAND, &cr); + pci_write_config_word(dev, PCI_COMMAND, 0x0000); + pci_write_config_word(dev, PCI_STATUS, 0xffff); + child = pci_add_new_bus(bus, dev, ++max); + buses = (buses & 0xff000000) + | ((unsigned int)(child->primary) << 0) + | ((unsigned int)(child->secondary) << 8) + | ((unsigned int)(child->subordinate) << 16); /* - * Now we can scan all subordinate buses: + * We need to blast all three values with a single write. */ - max = pci_do_scan_bus(child); + pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); + if (!is_cardbus) { + /* Now we can scan all subordinate buses... */ + max = pci_do_scan_bus(child); + } else { + /* + * For CardBus bridges, we leave 4 bus numbers + * as cards with a PCI-to-PCI bridge can be + * inserted later. + */ + max += 3; + } /* - * Set the subordinate bus number to its real - * value: + * Set the subordinate bus number to its real value. */ child->subordinate = max; - buses = (buses & 0xff00ffff) - | ((unsigned int)(child->subordinate) << 16); - pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); + pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); + pci_write_config_word(dev, PCI_COMMAND, cr); } - pci_write_config_word(dev, PCI_COMMAND, cr); + sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); return max; } @@ -933,7 +881,7 @@ static unsigned int __init pci_do_scan_bus(struct pci_bus *bus) { - unsigned int devfn, max; + unsigned int devfn, max, pass; struct list_head *ln; struct pci_dev *dev, dev0; @@ -957,17 +905,12 @@ */ DBG("Fixups for bus %02x\n", bus->number); pcibios_fixup_bus(bus); - for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) { - dev = pci_dev_b(ln); - switch (dev->class >> 8) { - case PCI_CLASS_BRIDGE_PCI: - max = pci_scan_bridge(bus, dev, max); - break; - case PCI_CLASS_BRIDGE_CARDBUS: - max = pci_scan_cardbus(bus, dev, max); - break; + for (pass=0; pass < 2; pass++) + for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) { + dev = pci_dev_b(ln); + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) + max = pci_scan_bridge(bus, dev, max, pass); } - } /* * We've scanned the bus and so we know all about what's on diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pci/pci.ids linux/drivers/pci/pci.ids --- v2.4.0-test8/linux/drivers/pci/pci.ids Sun Aug 13 19:37:15 2000 +++ linux/drivers/pci/pci.ids Fri Sep 15 16:28:25 2000 @@ -1471,9 +1471,9 @@ 6055 3c556 Laptop Hurricane 5057 3c575 [Megahertz] 10/100 LAN CardBus 10b7 5a57 3C575 Megahertz 10/100 LAN Cardbus PC Card - 5157 3c575 [Megahertz] 10/100 LAN CardBus + 5157 3CCFE575BT Cyclone CardBus 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card - 5257 3CCFE575CT Cyclone CardBus + 5257 3CCFE575CT Tornado CardBus 5900 3c590 10BaseT [Vortex] 5920 3c592 EISA 10mbps Demon/Vortex 5950 3c595 100BaseTX [Vortex] @@ -1483,8 +1483,8 @@ 5b57 3c595 [Megahertz] 10/100 LAN CardBus 10b7 5b57 3C575 Megahertz 10/100 LAN Cardbus PC Card 6560 3CCFE656 Cyclone CardBus - 6562 3CCFEM656 [id 6562] Cyclone CardBus - 6564 3CCFEM656 [id 6564] Cyclone CardBus + 6562 3CCFEM656B Cyclone CardBus + 6564 3CXFEM656C Tornado CardBus 7646 3cSOHO100-TX Hurricane 8811 Token ring 9000 3c900 10BaseT [Boomerang] diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/cardbus.c linux/drivers/pcmcia/cardbus.c --- v2.4.0-test8/linux/drivers/pcmcia/cardbus.c Tue Sep 5 12:56:51 2000 +++ linux/drivers/pcmcia/cardbus.c Mon Sep 18 15:11:51 2000 @@ -58,11 +58,6 @@ #include #include -#ifndef PCMCIA_DEBUG -#define PCMCIA_DEBUG 1 -#endif -static int pc_debug = PCMCIA_DEBUG; - #define IN_CARD_SERVICES #include #include @@ -73,6 +68,10 @@ #include "cs_internal.h" #include "rsrc_mgr.h" +#ifdef PCMCIA_DEBUG +static int pc_debug = PCMCIA_DEBUG; +#endif + /*====================================================================*/ #define FIND_FIRST_BIT(n) ((n) - ((n) & ((n)-1))) @@ -372,9 +371,9 @@ void cb_enable(socket_info_t * s) { struct pci_dev *dev; - u_char i, bus = s->cap.cb_dev->subordinate->number; + u_char i; - DEBUG(0, "cs: cb_enable(bus %d)\n", bus); + DEBUG(0, "cs: cb_enable(bus %d)\n", s->cap.cb_dev->subordinate->number); /* Configure bridge */ cb_release_cis_mem(s); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c --- v2.4.0-test8/linux/drivers/pcmcia/cs.c Thu Sep 7 09:13:00 2000 +++ linux/drivers/pcmcia/cs.c Mon Sep 18 15:11:51 2000 @@ -103,13 +103,13 @@ #define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") -INT_MODULE_PARM(setup_delay, HZ/20); /* ticks */ -INT_MODULE_PARM(resume_delay, HZ/5); /* ticks */ -INT_MODULE_PARM(shutdown_delay, HZ/40); /* ticks */ -INT_MODULE_PARM(vcc_settle, 400); /* msecs */ +INT_MODULE_PARM(setup_delay, 10); /* centiseconds */ +INT_MODULE_PARM(resume_delay, 20); /* centiseconds */ +INT_MODULE_PARM(shutdown_delay, 3); /* centiseconds */ +INT_MODULE_PARM(vcc_settle, 40); /* centiseconds */ INT_MODULE_PARM(reset_time, 10); /* usecs */ -INT_MODULE_PARM(unreset_delay, 100); /* msecs */ -INT_MODULE_PARM(unreset_check, 100); /* msecs */ +INT_MODULE_PARM(unreset_delay, 10); /* centiseconds */ +INT_MODULE_PARM(unreset_check, 10); /* centiseconds */ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */ /* Access speed for attribute memory windows */ @@ -446,10 +446,13 @@ static int send_event(socket_info_t *s, event_t event, int priority); -static void msleep(unsigned int msec) +/* + * Sleep for n_cs centiseconds (1 cs = 1/100th of a second) + */ +static void cs_sleep(unsigned int n_cs) { current->state = TASK_INTERRUPTIBLE; - schedule_timeout( (msec * HZ + 999) / 1000); + schedule_timeout( (n_cs * HZ + 99) / 100); } static void shutdown_socket(socket_info_t *s) @@ -504,7 +507,7 @@ if (!(val & SS_PENDING)) break; if (--setup_timeout) { - msleep(100); + cs_sleep(10); continue; } printk(KERN_NOTICE "cs: socket %p voltage interrogation" @@ -516,7 +519,7 @@ if (val & SS_DETECT) { DEBUG(1, "cs: setup_socket(%p): applying power\n", s); s->state |= SOCKET_PRESENT; - s->socket.flags = 0; + s->socket.flags &= SS_DEBOUNCED; if (val & SS_3VCARD) s->socket.Vcc = s->socket.Vpp = 33; else if (!(val & SS_XVCARD)) @@ -533,7 +536,7 @@ #endif } set_socket(s, &s->socket); - msleep(vcc_settle); + cs_sleep(vcc_settle); reset_socket(s); ret = 1; } else { @@ -561,7 +564,7 @@ udelay((long)reset_time); s->socket.flags &= ~SS_RESET; set_socket(s, &s->socket); - msleep(unreset_delay); + cs_sleep(unreset_delay); unreset_socket(s); } /* reset_socket */ @@ -580,11 +583,11 @@ break; DEBUG(2, "cs: socket %d not ready yet\n", s->sock); if (--setup_timeout) { - msleep(unreset_check); + cs_sleep(unreset_check); continue; } printk(KERN_NOTICE "cs: socket %p timed out during" - " reset\n", s); + " reset. Try increasing setup_delay.\n", s); s->state &= ~EVENT_MASK; return; } @@ -656,7 +659,7 @@ DEBUG(0, "cs: flushing pending setup\n"); s->state &= ~EVENT_MASK; } - msleep(shutdown_delay); + cs_sleep(shutdown_delay); s->state &= ~SOCKET_PRESENT; shutdown_socket(s); } @@ -679,11 +682,13 @@ } s->state |= SOCKET_SETUP_PENDING; if (s->state & SOCKET_SUSPEND) - msleep(resume_delay); + cs_sleep(resume_delay); else - msleep(setup_delay); + cs_sleep(setup_delay); + s->socket.flags |= SS_DEBOUNCED; if (setup_socket(s) == 0) s->state &= ~SOCKET_SETUP_PENDING; + s->socket.flags &= ~SS_DEBOUNCED; } } if (events & SS_BATDEAD) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/pcmcia/yenta.c linux/drivers/pcmcia/yenta.c --- v2.4.0-test8/linux/drivers/pcmcia/yenta.c Wed Sep 6 11:48:58 2000 +++ linux/drivers/pcmcia/yenta.c Fri Sep 15 16:31:09 2000 @@ -233,6 +233,11 @@ { u16 bridge; + if (state->flags & SS_DEBOUNCED) { + /* The insertion debounce period has ended. Clear any pending insertion events */ + socket->events &= ~SS_DETECT; + state->flags &= ~SS_DEBOUNCED; /* SS_DEBOUNCED is oneshot */ + } yenta_set_power(socket, state); socket->io_irq = state->io_irq; bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/3w-xxxx.c linux/drivers/scsi/3w-xxxx.c --- v2.4.0-test8/linux/drivers/scsi/3w-xxxx.c Fri Aug 4 17:56:25 2000 +++ linux/drivers/scsi/3w-xxxx.c Mon Sep 18 14:57:01 2000 @@ -3,6 +3,7 @@ Written By: Adam Radford Modifications By: Joel Jacobson + Arnaldo Carvalho de Melo Copyright (C) 1999-2000 3ware Inc. @@ -64,6 +65,8 @@ Bug fix so hot spare drives don't show up. 1.02.00.002 - Fix bug with tw_setfeature() call that caused oops on some systems. + 08/21/00 - release previously allocated resources on failure at + tw_allocate_memory (acme) */ #include @@ -410,35 +413,26 @@ /* This function will allocate memory and check if it is 16 d-word aligned */ int tw_allocate_memory(TW_Device_Extension *tw_dev, int request_id, int size, int which) { - u32 *virt_addr; + u32 *virt_addr = kmalloc(size, GFP_ATOMIC); dprintk(KERN_NOTICE "3w-xxxx: tw_allocate_memory()\n"); + if (!virt_addr) { + printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); + return 1; + } + + if ((u32)virt_addr % TW_ALIGNMENT) { + kfree(virt_addr); + printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); + return 1; + } + if (which == 0) { - /* Allocate command packet memory */ - virt_addr = kmalloc(size, GFP_ATOMIC); - if (virt_addr == NULL) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); - return 1; - } - if ((u32)virt_addr % TW_ALIGNMENT) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); - return 1; - } tw_dev->command_packet_virtual_address[request_id] = virt_addr; tw_dev->command_packet_physical_address[request_id] = virt_to_bus(virt_addr); } else { - /* Allocate generic buffer */ - virt_addr = kmalloc(size, GFP_ATOMIC); - if (virt_addr == NULL) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): kmalloc() failed.\n"); - return 1; - } - if ((u32)virt_addr % TW_ALIGNMENT) { - printk(KERN_WARNING "3w-xxxx: tw_allocate_memory(): Found unaligned address.\n"); - return 1; - } tw_dev->alignment_virtual_address[request_id] = virt_addr; tw_dev->alignment_physical_address[request_id] = virt_to_bus(virt_addr); } @@ -2390,7 +2384,6 @@ /* Now get things going */ -#ifdef MODULE -Scsi_Host_Template driver_template = TWXXXX; +static Scsi_Host_Template driver_template = TWXXXX; #include "scsi_module.c" -#endif + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/3w-xxxx.h linux/drivers/scsi/3w-xxxx.h --- v2.4.0-test8/linux/drivers/scsi/3w-xxxx.h Fri Sep 8 12:54:35 2000 +++ linux/drivers/scsi/3w-xxxx.h Mon Sep 18 14:09:49 2000 @@ -338,7 +338,6 @@ int tw_state_request_start(TW_Device_Extension *tw_dev, int *request_id); void tw_unmask_command_interrupt(TW_Device_Extension *tw_dev); -#if defined(HOSTS_C) || defined(MODULE) /* Scsi_Host_Template Initializer */ #define TWXXXX { \ next : NULL, \ @@ -371,5 +370,4 @@ use_new_eh_code : 1, \ emulated : 1 \ } -#endif /* HOSTS_C */ #endif /* _3W_XXXX_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/53c7,8xx.c linux/drivers/scsi/53c7,8xx.c --- v2.4.0-test8/linux/drivers/scsi/53c7,8xx.c Tue Aug 8 09:19:25 2000 +++ linux/drivers/scsi/53c7,8xx.c Mon Sep 18 13:36:24 2000 @@ -6425,6 +6425,7 @@ vfree ((void *)hostdata->events); return 1; } -Scsi_Host_Template driver_template = NCR53c7xx; -#include "scsi_module.c" #endif /* def MODULE */ + +static Scsi_Host_Template driver_template = NCR53c7xx; +#include "scsi_module.c" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/53c7,8xx.h linux/drivers/scsi/53c7,8xx.h --- v2.4.0-test8/linux/drivers/scsi/53c7,8xx.h Fri Sep 8 12:54:35 2000 +++ linux/drivers/scsi/53c7,8xx.h Mon Sep 18 14:09:49 2000 @@ -46,7 +46,6 @@ * array. */ -#if defined(HOSTS_C) || defined(MODULE) #include extern int NCR53c7xx_abort(Scsi_Cmnd *); @@ -71,8 +70,6 @@ sg_tablesize: 127, \ cmd_per_lun: 3, \ use_clustering: DISABLE_CLUSTERING} - -#endif /* defined(HOSTS_C) || defined(MODULE) */ #ifndef HOSTS_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/53c7xx.c linux/drivers/scsi/53c7xx.c --- v2.4.0-test8/linux/drivers/scsi/53c7xx.c Tue Aug 8 09:19:25 2000 +++ linux/drivers/scsi/53c7xx.c Mon Sep 18 13:36:24 2000 @@ -6102,6 +6102,7 @@ free_pages ((u32)hostdata, 1); return 1; } -Scsi_Host_Template driver_template = NCR53c7xx; -#include "scsi_module.c" #endif /* def MODULE */ + +static Scsi_Host_Template driver_template = NCR53c7xx; +#include "scsi_module.c" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/53c7xx.h linux/drivers/scsi/53c7xx.h --- v2.4.0-test8/linux/drivers/scsi/53c7xx.h Tue Nov 23 10:29:15 1999 +++ linux/drivers/scsi/53c7xx.h Mon Sep 18 14:09:49 2000 @@ -59,7 +59,6 @@ * array. */ -#if defined(HOSTS_C) || defined(MODULE) #include extern int NCR53c7xx_abort(Scsi_Cmnd *); @@ -79,8 +78,6 @@ NULL /* slave attach */, scsicam_bios_param, /* can queue */ 24, \ /* id */ 7, 127 /* old SG_ALL */, /* cmd per lun */ 3, \ /* present */ 0, /* unchecked isa dma */ 0, DISABLE_CLUSTERING} - -#endif /* defined(HOSTS_C) || defined(MODULE) */ #ifndef HOSTS_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/AM53C974.c linux/drivers/scsi/AM53C974.c --- v2.4.0-test8/linux/drivers/scsi/AM53C974.c Mon Jun 19 17:59:41 2000 +++ linux/drivers/scsi/AM53C974.c Mon Sep 18 13:36:24 2000 @@ -2456,11 +2456,10 @@ #ifdef MODULE -static Scsi_Host_Template driver_template = AM53C974; - /* You can specify overrides=a,b,c,d in the same format at AM53C974=a,b,c,d on boot up */ - MODULE_PARM(overrides, "1-32i"); -#include "scsi_module.c" #endif + +static Scsi_Host_Template driver_template = AM53C974; +#include "scsi_module.c" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/BusLogic.c linux/drivers/scsi/BusLogic.c --- v2.4.0-test8/linux/drivers/scsi/BusLogic.c Mon Jul 10 13:06:35 2000 +++ linux/drivers/scsi/BusLogic.c Mon Sep 18 13:36:24 2000 @@ -61,7 +61,7 @@ */ static int - BusLogic_DriverOptionsCount = 0; + BusLogic_DriverOptionsCount; /* @@ -79,7 +79,7 @@ */ #ifdef MODULE -static char *BusLogic = NULL; +static char *BusLogic; MODULE_PARM(BusLogic, "s"); #endif @@ -90,7 +90,7 @@ */ static BusLogic_ProbeOptions_T - BusLogic_ProbeOptions = { 0 }; + BusLogic_ProbeOptions; /* @@ -99,7 +99,7 @@ */ static BusLogic_GlobalOptions_T - BusLogic_GlobalOptions = { 0 }; + BusLogic_GlobalOptions; /* @@ -108,8 +108,8 @@ */ static BusLogic_HostAdapter_T - *BusLogic_FirstRegisteredHostAdapter = NULL, - *BusLogic_LastRegisteredHostAdapter = NULL; + *BusLogic_FirstRegisteredHostAdapter, + *BusLogic_LastRegisteredHostAdapter; /* @@ -117,7 +117,7 @@ */ static int - BusLogic_ProbeInfoCount = 0; + BusLogic_ProbeInfoCount; /* @@ -128,7 +128,7 @@ */ static BusLogic_ProbeInfo_T - *BusLogic_ProbeInfoList = NULL; + *BusLogic_ProbeInfoList; /* @@ -4982,13 +4982,9 @@ __setup("BusLogic=", BusLogic_Setup); /* - Include Module support if requested. + Get it all started */ -#ifdef MODULE - -SCSI_Host_Template_T driver_template = BUSLOGIC; +static SCSI_Host_Template_T driver_template = BUSLOGIC; #include "scsi_module.c" - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile --- v2.4.0-test8/linux/drivers/scsi/Makefile Sun Aug 6 11:23:40 2000 +++ linux/drivers/scsi/Makefile Mon Sep 18 11:17:51 2000 @@ -30,7 +30,7 @@ obj-$(CONFIG_SCSI) += scsi_mod.o obj-$(CONFIG_CHR_DEV_ST) += st.o -obj-$(CONFIG_BLK_DEV_SD) += sd.o +obj-$(CONFIG_BLK_DEV_SD) += sd_mod.o obj-$(CONFIG_BLK_DEV_SR) += sr_mod.o obj-$(CONFIG_CHR_DEV_SG) += sg.o @@ -116,7 +116,7 @@ obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o -scsi_mod-objs := hosts.o scsi.o scsi_ioctl.o constants.o \ +scsi_mod-objs := scsi.o hosts.o scsi_ioctl.o constants.o \ scsicam.o scsi_proc.o scsi_error.o \ scsi_obsolete.o scsi_queue.o scsi_lib.o \ scsi_merge.o scsi_dma.o scsi_scan.o \ @@ -137,7 +137,7 @@ int-m := $(filter-out $(int-y), $(int-m)) # Take multi-part drivers out of obj-y and put components in. -obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y) +# obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y) O_OBJS := $(filter-out $(export-objs), $(obj-y)) OX_OBJS := $(filter $(export-objs), $(obj-y)) @@ -151,6 +151,9 @@ scsi_mod.o: $(scsi_mod-objs) $(LD) -r -o $@ $(scsi_mod-objs) + +sd_mod.o: sd.o + $(LD) -r -o $@ sd.o sr_mod.o: $(sr_mod-objs) $(LD) -r -o $@ $(sr_mod-objs) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/NCR53c406a.c linux/drivers/scsi/NCR53c406a.c --- v2.4.0-test8/linux/drivers/scsi/NCR53c406a.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/NCR53c406a.c Mon Sep 18 13:36:24 2000 @@ -1059,12 +1059,10 @@ /* CONFIG6 = (port_base+0x0F);*/ } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = NCR53c406a; +static Scsi_Host_Template driver_template = NCR53c406a; #include "scsi_module.c" -#endif /* * Overrides for Emacs so that we get a uniform tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/a2091.c linux/drivers/scsi/a2091.c --- v2.4.0-test8/linux/drivers/scsi/a2091.c Wed Jan 26 12:45:20 2000 +++ linux/drivers/scsi/a2091.c Mon Sep 18 13:36:24 2000 @@ -226,17 +226,13 @@ return num_a2091; } -#ifdef MODULE - #define HOSTS_C #include "a2091.h" -Scsi_Host_Template driver_template = A2091_SCSI; +static Scsi_Host_Template driver_template = A2091_SCSI; #include "scsi_module.c" - -#endif int a2091_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/a2091.h linux/drivers/scsi/a2091.h --- v2.4.0-test8/linux/drivers/scsi/a2091.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/a2091.h Mon Sep 18 14:12:01 2000 @@ -29,8 +29,6 @@ #define CAN_QUEUE 16 #endif -#ifdef HOSTS_C - #define A2091_SCSI { proc_name: "A2901", \ name: "Commodore A2091/A590 SCSI", \ detect: a2091_detect, \ @@ -43,7 +41,6 @@ sg_tablesize: SG_ALL, \ cmd_per_lun: CMD_PER_LUN, \ use_clustering: DISABLE_CLUSTERING } -#else /* * if the transfer address ANDed with this results in a non-zero @@ -91,7 +88,5 @@ #define ISTR_OE_INT (1<<2) #define ISTR_FF_FLG (1<<1) #define ISTR_FE_FLG (1<<0) - -#endif /* else def HOSTS_C */ #endif /* A2091_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/a3000.c linux/drivers/scsi/a3000.c --- v2.4.0-test8/linux/drivers/scsi/a3000.c Wed Jan 26 12:45:20 2000 +++ linux/drivers/scsi/a3000.c Mon Sep 18 13:36:24 2000 @@ -188,17 +188,13 @@ return 1; } -#ifdef MODULE - #define HOSTS_C #include "a3000.h" -Scsi_Host_Template driver_template = A3000_SCSI; +static Scsi_Host_Template driver_template = A3000_SCSI; #include "scsi_module.c" - -#endif int a3000_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/a3000.h linux/drivers/scsi/a3000.h --- v2.4.0-test8/linux/drivers/scsi/a3000.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/a3000.h Mon Sep 18 14:12:01 2000 @@ -29,8 +29,6 @@ #define CAN_QUEUE 16 #endif -#ifdef HOSTS_C - #define A3000_SCSI { proc_name: "A3000", \ proc_info: NULL, \ name: "Amiga 3000 built-in SCSI", \ @@ -44,7 +42,6 @@ sg_tablesize: SG_ALL, \ cmd_per_lun: CMD_PER_LUN, \ use_clustering: ENABLE_CLUSTERING } -#else /* * if the transfer address ANDed with this results in a non-zero @@ -95,7 +92,5 @@ #define ISTR_OE_INT (1<<2) #define ISTR_FF_FLG (1<<1) #define ISTR_FE_FLG (1<<0) - -#endif /* else def HOSTS_C */ #endif /* A3000_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/advansys.c linux/drivers/scsi/advansys.c --- v2.4.0-test8/linux/drivers/scsi/advansys.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/advansys.c Mon Sep 18 13:36:25 2000 @@ -6785,10 +6785,8 @@ * --- Loadable Driver Support */ -#ifdef MODULE -Scsi_Host_Template driver_template = ADVANSYS; +static Scsi_Host_Template driver_template = ADVANSYS; # include "scsi_module.c" -#endif /* MODULE */ /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/aha152x.c linux/drivers/scsi/aha152x.c --- v2.4.0-test8/linux/drivers/scsi/aha152x.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/aha152x.c Mon Sep 18 13:36:25 2000 @@ -3813,9 +3813,7 @@ return thislength < length ? thislength : length; } -#if defined(MODULE) /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = AHA152X; +static Scsi_Host_Template driver_template = AHA152X; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c --- v2.4.0-test8/linux/drivers/scsi/aha1542.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/aha1542.c Mon Sep 18 13:36:25 2000 @@ -1764,9 +1764,7 @@ } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = AHA1542; +static Scsi_Host_Template driver_template = AHA1542; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/aha1740.c linux/drivers/scsi/aha1740.c --- v2.4.0-test8/linux/drivers/scsi/aha1740.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/aha1740.c Mon Sep 18 13:36:25 2000 @@ -601,12 +601,10 @@ return 0; } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = AHA1740; +static Scsi_Host_Template driver_template = AHA1740; #include "scsi_module.c" -#endif /* Okay, you made it all the way through. As of this writing, 3/31/93, I'm brad@saturn.gaylord.com or brad@bradpc.gaylord.com. I'll try to help as time diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c --- v2.4.0-test8/linux/drivers/scsi/aic7xxx.c Thu Aug 10 13:14:40 2000 +++ linux/drivers/scsi/aic7xxx.c Mon Sep 18 13:36:25 2000 @@ -12217,12 +12217,10 @@ #include "aic7xxx_proc.c" -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = AIC7XXX; +static Scsi_Host_Template driver_template = AIC7XXX; #include "scsi_module.c" -#endif /* * Overrides for Emacs so that we almost follow Linus's tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/amiga7xx.h linux/drivers/scsi/amiga7xx.h --- v2.4.0-test8/linux/drivers/scsi/amiga7xx.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/amiga7xx.h Mon Sep 18 14:09:49 2000 @@ -22,7 +22,6 @@ #define CAN_QUEUE 24 #endif -#if defined(HOSTS_C) || defined(MODULE) #include #define AMIGA7XX_SCSI {name: "Amiga NCR53c710 SCSI", \ @@ -36,5 +35,5 @@ sg_tablesize: 63, \ cmd_per_lun: 3, \ use_clustering: DISABLE_CLUSTERING } -#endif + #endif /* AMIGA7XX_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/atari_scsi.c linux/drivers/scsi/atari_scsi.c --- v2.4.0-test8/linux/drivers/scsi/atari_scsi.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/atari_scsi.c Mon Sep 18 13:36:25 2000 @@ -1126,8 +1126,5 @@ #include "atari_NCR5380.c" -#ifdef MODULE -Scsi_Host_Template driver_template = ATARI_SCSI; - +static Scsi_Host_Template driver_template = ATARI_SCSI; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/atari_scsi.h linux/drivers/scsi/atari_scsi.h --- v2.4.0-test8/linux/drivers/scsi/atari_scsi.h Sun Dec 21 17:04:48 1997 +++ linux/drivers/scsi/atari_scsi.h Mon Sep 18 14:12:01 2000 @@ -51,8 +51,6 @@ #define DEFAULT_USE_TAGGED_QUEUING 0 -#if defined (HOSTS_C) || defined (MODULE) - #define ATARI_SCSI { proc_info: atari_scsi_proc_info, \ name: "Atari native SCSI", \ detect: atari_scsi_detect, \ @@ -67,10 +65,6 @@ cmd_per_lun: 0, /* initialized at run-time */ \ use_clustering: DISABLE_CLUSTERING } -#endif - -#ifndef HOSTS_C - #define NCR5380_implementation_fields /* none */ #define NCR5380_read(reg) atari_scsi_reg_read( reg ) @@ -267,7 +261,6 @@ #define NDEBUG_ANY 0xffffffff -#endif /* else def HOSTS_C */ #endif /* ndef ASM */ #endif /* ATARI_SCSI_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/atp870u.c linux/drivers/scsi/atp870u.c --- v2.4.0-test8/linux/drivers/scsi/atp870u.c Fri Jul 7 15:55:24 2000 +++ linux/drivers/scsi/atp870u.c Mon Sep 18 13:36:25 2000 @@ -1971,8 +1971,5 @@ } -#ifdef MODULE -Scsi_Host_Template driver_template = ATP870U; - +static Scsi_Host_Template driver_template = ATP870U; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/blz1230.c linux/drivers/scsi/blz1230.c --- v2.4.0-test8/linux/drivers/scsi/blz1230.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/blz1230.c Mon Sep 18 13:36:25 2000 @@ -274,17 +274,13 @@ } } -#ifdef MODULE - #define HOSTS_C #include "blz1230.h" -Scsi_Host_Template driver_template = SCSI_BLZ1230; +static Scsi_Host_Template driver_template = SCSI_BLZ1230; #include "scsi_module.c" - -#endif int blz1230_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/blz2060.c linux/drivers/scsi/blz2060.c --- v2.4.0-test8/linux/drivers/scsi/blz2060.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/blz2060.c Mon Sep 18 13:36:25 2000 @@ -236,17 +236,13 @@ } } -#ifdef MODULE - #define HOSTS_C #include "blz2060.h" -Scsi_Host_Template driver_template = SCSI_BLZ2060; +static Scsi_Host_Template driver_template = SCSI_BLZ2060; #include "scsi_module.c" - -#endif int blz2060_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/bvme6000.h linux/drivers/scsi/bvme6000.h --- v2.4.0-test8/linux/drivers/scsi/bvme6000.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/bvme6000.h Mon Sep 18 14:09:49 2000 @@ -23,7 +23,6 @@ #define CAN_QUEUE 24 #endif -#if defined(HOSTS_C) || defined(MODULE) #include #define BVME6000_SCSI {name: "BVME6000 NCR53c710 SCSI", \ @@ -37,5 +36,5 @@ sg_tablesize: 63, \ cmd_per_lun: 3, \ use_clustering: DISABLE_CLUSTERING } -#endif + #endif /* BVME6000_SCSI_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/cyberstorm.c linux/drivers/scsi/cyberstorm.c --- v2.4.0-test8/linux/drivers/scsi/cyberstorm.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/cyberstorm.c Mon Sep 18 13:36:25 2000 @@ -302,17 +302,13 @@ } } -#ifdef MODULE - #define HOSTS_C #include "cyberstorm.h" -Scsi_Host_Template driver_template = SCSI_CYBERSTORM; +static Scsi_Host_Template driver_template = SCSI_CYBERSTORM; #include "scsi_module.c" - -#endif int cyber_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/cyberstormII.c linux/drivers/scsi/cyberstormII.c --- v2.4.0-test8/linux/drivers/scsi/cyberstormII.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/cyberstormII.c Mon Sep 18 13:36:25 2000 @@ -251,17 +251,14 @@ } } -#ifdef MODULE - #define HOSTS_C #include "cyberstormII.h" -Scsi_Host_Template driver_template = SCSI_CYBERSTORMII; +static Scsi_Host_Template driver_template = SCSI_CYBERSTORMII; #include "scsi_module.c" -#endif int cyberII_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/dc390.h linux/drivers/scsi/dc390.h --- v2.4.0-test8/linux/drivers/scsi/dc390.h Fri Sep 8 12:54:35 2000 +++ linux/drivers/scsi/dc390.h Mon Sep 18 14:09:49 2000 @@ -18,8 +18,6 @@ #define DC390_BANNER "Tekram DC390/AM53C974" #define DC390_VERSION "2.0d 1998/12/25" -#if defined(HOSTS_C) || defined(MODULE) - #include extern int DC390_detect(Scsi_Host_Template *psht); @@ -52,7 +50,5 @@ cmd_per_lun: 8, \ use_clustering: DISABLE_CLUSTERING \ } - -#endif /* defined(HOSTS_C) || defined(MODULE) */ #endif /* DC390_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/dmx3191d.c linux/drivers/scsi/dmx3191d.c --- v2.4.0-test8/linux/drivers/scsi/dmx3191d.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/dmx3191d.c Mon Sep 18 13:36:25 2000 @@ -115,10 +115,6 @@ } -#ifdef MODULE -Scsi_Host_Template driver_template = DMX3191D; - +static Scsi_Host_Template driver_template = DMX3191D; #include "scsi_module.c" - -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/dmx3191d.h linux/drivers/scsi/dmx3191d.h --- v2.4.0-test8/linux/drivers/scsi/dmx3191d.h Mon Mar 27 09:48:11 2000 +++ linux/drivers/scsi/dmx3191d.h Mon Sep 18 14:12:01 2000 @@ -32,7 +32,6 @@ int dmx3191d_reset(Scsi_Cmnd *, unsigned int); -#if defined(HOSTS_C) || defined(MODULE) #define DMX3191D { \ proc_info: dmx3191d_proc_info, \ name: "Domex DMX3191D", \ @@ -49,10 +48,8 @@ cmd_per_lun: 2, \ use_clustering: DISABLE_CLUSTERING \ } -#endif /* HOSTS_C || MODULE */ -#ifndef HOSTS_C #define NCR5380_read(reg) inb(port + reg) #define NCR5380_write(reg, value) outb(value, port + reg) @@ -67,7 +64,6 @@ #define NCR5380_queue_command dmx3191d_queue_command #define NCR5380_reset dmx3191d_reset -#endif /* HOSTS_C */ #endif /* ASM */ #endif /* __DMX3191D_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/dtc.c linux/drivers/scsi/dtc.c --- v2.4.0-test8/linux/drivers/scsi/dtc.c Fri Nov 19 11:30:54 1999 +++ linux/drivers/scsi/dtc.c Mon Sep 18 13:36:25 2000 @@ -432,9 +432,6 @@ #include "NCR5380.c" -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = DTC3x80; - +static Scsi_Host_Template driver_template = DTC3x80; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/dtc.h linux/drivers/scsi/dtc.h --- v2.4.0-test8/linux/drivers/scsi/dtc.h Sat Apr 11 11:13:25 1998 +++ linux/drivers/scsi/dtc.h Mon Sep 18 14:12:01 2000 @@ -55,8 +55,6 @@ * macros when this is being used solely for the host stub. */ -#if defined(HOSTS_C) || defined(MODULE) - #define DTC3x80 { \ name: "DTC 3180/3280 ", \ detect: dtc_detect, \ @@ -70,10 +68,6 @@ cmd_per_lun: CMD_PER_LUN , \ use_clustering: DISABLE_CLUSTERING} -#endif - -#ifndef HOSTS_C - #define NCR5380_implementation_fields \ volatile unsigned int base @@ -124,6 +118,5 @@ #define DTC_IRQS 0x9c00 -#endif /* else def HOSTS_C */ #endif /* ndef ASM */ #endif /* DTC3280_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/eata.c linux/drivers/scsi/eata.c --- v2.4.0-test8/linux/drivers/scsi/eata.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/eata.c Mon Sep 18 13:36:25 2000 @@ -2292,12 +2292,11 @@ return FALSE; } -#if defined(MODULE) -Scsi_Host_Template driver_template = EATA; +static Scsi_Host_Template driver_template = EATA; #include "scsi_module.c" -#else +#ifndef MODULE #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,18) void eata2x_setup(char *str, int *ints) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c --- v2.4.0-test8/linux/drivers/scsi/eata_dma.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/eata_dma.c Mon Sep 18 13:36:25 2000 @@ -1520,11 +1520,9 @@ return(registered_HBAs); } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = EATA_DMA; +static Scsi_Host_Template driver_template = EATA_DMA; #include "scsi_module.c" -#endif /* * Overrides for Emacs so that we almost follow Linus's tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/eata_dma.h linux/drivers/scsi/eata_dma.h --- v2.4.0-test8/linux/drivers/scsi/eata_dma.h Tue Jan 25 13:01:14 2000 +++ linux/drivers/scsi/eata_dma.h Mon Sep 18 14:12:01 2000 @@ -10,8 +10,6 @@ #ifndef _EATA_DMA_H #define _EATA_DMA_H -#ifndef HOSTS_C - #include "eata_generic.h" @@ -66,8 +64,6 @@ #else #define DBG(x, y) #endif - -#endif /* !HOSTS_C */ int eata_detect(Scsi_Host_Template *); const char *eata_info(struct Scsi_Host *); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/eata_pio.c linux/drivers/scsi/eata_pio.c --- v2.4.0-test8/linux/drivers/scsi/eata_pio.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/eata_pio.c Mon Sep 18 13:36:25 2000 @@ -985,12 +985,10 @@ return (registered_HBAs); } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = EATA_PIO; +static Scsi_Host_Template driver_template = EATA_PIO; #include "scsi_module.c" -#endif /* * Overrides for Emacs so that we almost follow Linus's tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/esp.c linux/drivers/scsi/esp.c --- v2.4.0-test8/linux/drivers/scsi/esp.c Mon Aug 28 21:20:03 2000 +++ linux/drivers/scsi/esp.c Mon Sep 18 13:36:25 2000 @@ -4364,10 +4364,8 @@ return 0; } -#ifdef MODULE -Scsi_Host_Template driver_template = SCSI_SPARC_ESP; +static Scsi_Host_Template driver_template = SCSI_SPARC_ESP; #include "scsi_module.c" EXPORT_NO_SYMBOLS; -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/fastlane.c linux/drivers/scsi/fastlane.c --- v2.4.0-test8/linux/drivers/scsi/fastlane.c Fri Jan 28 08:04:58 2000 +++ linux/drivers/scsi/fastlane.c Mon Sep 18 13:36:25 2000 @@ -349,17 +349,12 @@ } } -#ifdef MODULE - #define HOSTS_C #include "fastlane.h" -Scsi_Host_Template driver_template = SCSI_FASTLANE; - +static Scsi_Host_Template driver_template = SCSI_FASTLANE; #include "scsi_module.c" - -#endif int fastlane_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/fcal.c linux/drivers/scsi/fcal.c --- v2.4.0-test8/linux/drivers/scsi/fcal.c Mon Dec 20 22:06:42 1999 +++ linux/drivers/scsi/fcal.c Mon Sep 18 13:36:25 2000 @@ -292,11 +292,8 @@ return 0; } -#ifdef MODULE - -Scsi_Host_Template driver_template = FCAL; +static Scsi_Host_Template driver_template = FCAL; #include "scsi_module.c" EXPORT_NO_SYMBOLS; -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/fd_mcs.c linux/drivers/scsi/fd_mcs.c --- v2.4.0-test8/linux/drivers/scsi/fd_mcs.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/fd_mcs.c Mon Sep 18 13:36:25 2000 @@ -1465,9 +1465,7 @@ return 0; } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = FD_MCS; +static Scsi_Host_Template driver_template = FD_MCS; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/fdomain.c linux/drivers/scsi/fdomain.c --- v2.4.0-test8/linux/drivers/scsi/fdomain.c Thu Jul 6 19:25:21 2000 +++ linux/drivers/scsi/fdomain.c Mon Sep 18 13:36:25 2000 @@ -2028,9 +2028,7 @@ return 0; } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = FDOMAIN_16X0; +static Scsi_Host_Template driver_template = FDOMAIN_16X0; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/g_NCR5380.c linux/drivers/scsi/g_NCR5380.c --- v2.4.0-test8/linux/drivers/scsi/g_NCR5380.c Thu Jan 20 10:44:46 2000 +++ linux/drivers/scsi/g_NCR5380.c Mon Sep 18 13:36:25 2000 @@ -885,12 +885,13 @@ #undef PRINTP #undef ANDP -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = GENERIC_NCR5380; +static Scsi_Host_Template driver_template = GENERIC_NCR5380; #include #include "scsi_module.c" + +#ifdef MODULE MODULE_PARM(ncr_irq, "i"); MODULE_PARM(ncr_dma, "i"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/g_NCR5380.h linux/drivers/scsi/g_NCR5380.h --- v2.4.0-test8/linux/drivers/scsi/g_NCR5380.h Wed Dec 8 15:17:55 1999 +++ linux/drivers/scsi/g_NCR5380.h Mon Sep 18 14:25:56 2000 @@ -70,8 +70,6 @@ #define CAN_QUEUE 16 #endif -#if defined(HOSTS_C) || defined(MODULE) - #define GENERIC_NCR5380 { \ proc_info: generic_NCR5380_proc_info, \ name: "Generic NCR5380/NCR53C400 Scsi Driver", \ @@ -87,8 +85,6 @@ sg_tablesize: SG_ALL, \ cmd_per_lun: CMD_PER_LUN , \ use_clustering: DISABLE_CLUSTERING} - -#endif #ifndef HOSTS_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/gdth.c linux/drivers/scsi/gdth.c --- v2.4.0-test8/linux/drivers/scsi/gdth.c Mon Jun 26 18:06:55 2000 +++ linux/drivers/scsi/gdth.c Mon Sep 18 13:36:25 2000 @@ -3704,7 +3704,5 @@ } -#ifdef MODULE -Scsi_Host_Template driver_template = GDTH; +static Scsi_Host_Template driver_template = GDTH; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/gvp11.c linux/drivers/scsi/gvp11.c --- v2.4.0-test8/linux/drivers/scsi/gvp11.c Wed Jan 26 12:45:20 2000 +++ linux/drivers/scsi/gvp11.c Mon Sep 18 13:36:25 2000 @@ -352,17 +352,13 @@ } -#ifdef MODULE - #define HOSTS_C #include "gvp11.h" -Scsi_Host_Template driver_template = GVP11_SCSI; +static Scsi_Host_Template driver_template = GVP11_SCSI; #include "scsi_module.c" - -#endif int gvp11_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c --- v2.4.0-test8/linux/drivers/scsi/hosts.c Tue Jul 11 11:17:45 2000 +++ linux/drivers/scsi/hosts.c Mon Sep 18 15:15:22 2000 @@ -11,6 +11,10 @@ * Jiffies wrap fixes (host->resetting), 3 Dec 1998 Andrea Arcangeli * Added QLOGIC QLA1280 SCSI controller kernel host support. * August 4, 1999 Fred Lewis, Intel DuPont + * + * Updated to reflect the new initialization scheme for the higher + * level of scsi drivers (sd/sr/st) + * September 17, 2000 Torben Mathiasen */ @@ -36,361 +40,8 @@ #include #include "scsi.h" - -#ifndef NULL -#define NULL 0L -#endif - -#define HOSTS_C - #include "hosts.h" -#if defined(CONFIG_A4000T_SCSI) || \ - defined(CONFIG_WARPENGINE_SCSI) || \ - defined(CONFIG_A4091_SCSI) || \ - defined (CONFIG_GVP_TURBO_SCSI) || \ - defined (CONFIG_BLZ603EPLUS_SCSI) -#define AMIGA7XXCONFIG -#endif - -#ifdef AMIGA7XXCONFIG -#include "amiga7xx.h" -#endif - -#ifdef CONFIG_MVME16x_SCSI -#include "mvme16x.h" -#endif - -#ifdef CONFIG_BVME6000_SCSI -#include "bvme6000.h" -#endif - -#ifdef CONFIG_SCSI_SIM710 -#include "sim710.h" -#endif - -#ifdef CONFIG_A3000_SCSI -#include "a3000.h" -#endif - -#ifdef CONFIG_A2091_SCSI -#include "a2091.h" -#endif - -#ifdef CONFIG_GVP11_SCSI -#include "gvp11.h" -#endif - -#ifdef CONFIG_CYBERSTORM_SCSI -#include "cyberstorm.h" -#endif - -#ifdef CONFIG_CYBERSTORMII_SCSI -#include "cyberstormII.h" -#endif - -#ifdef CONFIG_BLZ2060_SCSI -#include "blz2060.h" -#endif - -#ifdef CONFIG_BLZ1230_SCSI -#include "blz1230.h" -#endif - -#ifdef CONFIG_FASTLANE_SCSI -#include "fastlane.h" -#endif - -#ifdef CONFIG_OKTAGON_SCSI -#include "oktagon_esp.h" -#endif - -#ifdef CONFIG_ATARI_SCSI -#include "atari_scsi.h" -#endif - -#if defined(CONFIG_MAC_SCSI) || defined(CONFIG_MAC_SCSI_OLD) -#include "mac_scsi.h" -#endif - -#ifdef CONFIG_SUN3_SCSI -#include "sun3_scsi.h" -#endif - -#ifdef CONFIG_SCSI_MAC_ESP -#include "mac_esp.h" -#endif - -#ifdef CONFIG_SCSI_ADVANSYS -#include "advansys.h" -#endif - -#ifdef CONFIG_SCSI_AHA152X -#include "aha152x.h" -#endif - -#ifdef CONFIG_SCSI_AHA1542 -#include "aha1542.h" -#endif - -#ifdef CONFIG_SCSI_AHA1740 -#include "aha1740.h" -#endif - -#ifdef CONFIG_SCSI_AIC7XXX -#include "aic7xxx.h" -#endif - -#ifdef CONFIG_SCSI_IPS -#include "ips.h" -#endif - -#ifdef CONFIG_SCSI_BUSLOGIC -#include "BusLogic.h" -#endif - -#ifdef CONFIG_SCSI_EATA_DMA -#include "eata_dma.h" -#endif - -#ifdef CONFIG_SCSI_EATA_PIO -#include "eata_pio.h" -#endif - -#ifdef CONFIG_SCSI_U14_34F -#include "u14-34f.h" -#endif - -#ifdef CONFIG_SCSI_FD_MCS -#include "fd_mcs.h" -#endif - -#ifdef CONFIG_SCSI_FUTURE_DOMAIN -#include "fdomain.h" -#endif - -#ifdef CONFIG_SCSI_GENERIC_NCR5380 -#include "g_NCR5380.h" -#endif - -#ifdef CONFIG_SCSI_IN2000 -#include "in2000.h" -#endif - -#ifdef CONFIG_SCSI_PAS16 -#include "pas16.h" -#endif - -#ifdef CONFIG_SCSI_QLOGIC_FAS -#include "qlogicfas.h" -#endif - -#ifdef CONFIG_SCSI_QLOGIC_ISP -#include "qlogicisp.h" -#endif - -#ifdef CONFIG_SCSI_QLOGIC_FC -#include "qlogicfc.h" -#endif - -#ifdef CONFIG_SCSI_QLOGIC_1280 -#include "qla1280.h" -#endif - -#ifdef CONFIG_SCSI_SEAGATE -#include "seagate.h" -#endif - -#ifdef CONFIG_SCSI_T128 -#include "t128.h" -#endif - -#ifdef CONFIG_SCSI_DMX3191D -#include "dmx3191d.h" -#endif - -#ifdef CONFIG_SCSI_DTC3280 -#include "dtc.h" -#endif - -#ifdef CONFIG_SCSI_NCR53C7xx -#include "53c7,8xx.h" -#endif - -#ifdef CONFIG_SCSI_SYM53C8XX -#include "sym53c8xx.h" -#endif - -#ifdef CONFIG_SCSI_NCR53C8XX -#include "ncr53c8xx.h" -#endif - -#ifdef CONFIG_SCSI_ULTRASTOR -#include "ultrastor.h" -#endif - -#ifdef CONFIG_SCSI_7000FASST -#include "wd7000.h" -#endif - -#ifdef CONFIG_SCSI_MCA_53C9X -#include "mca_53c9x.h" -#endif - -#ifdef CONFIG_SCSI_IBMMCA -#include "ibmmca.h" -#endif - -#ifdef CONFIG_SCSI_EATA -#include "eata.h" -#endif - -#ifdef CONFIG_SCSI_NCR53C406A -#include "NCR53c406a.h" -#endif - -#ifdef CONFIG_SCSI_SYM53C416 -#include "sym53c416.h" -#endif - -#ifdef CONFIG_SCSI_DC390T -#include "dc390.h" -#endif - -#ifdef CONFIG_SCSI_AM53C974 -#include "AM53C974.h" -#endif - -#ifdef CONFIG_SCSI_MEGARAID -#include "megaraid.h" -#endif - -#ifdef CONFIG_SCSI_ACARD -#include "atp870u.h" -#endif - -#ifdef CONFIG_SCSI_SUNESP -#include "esp.h" -#endif - -#ifdef CONFIG_SCSI_SGIWD93 -#include "sgiwd93.h" -#endif - -#ifdef CONFIG_SCSI_QLOGICPTI -#include "qlogicpti.h" -#endif - -#ifdef CONFIG_BLK_DEV_IDESCSI -#include "ide-scsi.h" -#endif - -#ifdef CONFIG_SCSI_MESH -#include "mesh.h" -#endif - -#ifdef CONFIG_SCSI_MAC53C94 -#include "mac53c94.h" -#endif - -#ifdef CONFIG_SCSI_GDTH -#include "gdth.h" -#endif - -#ifdef CONFIG_SCSI_PCI2000 -#include "pci2000.h" -#endif - -#ifdef CONFIG_SCSI_PCI2220I -#include "pci2220i.h" -#endif - -#ifdef CONFIG_SCSI_PSI240I -#include "psi240i.h" -#endif - -#ifdef CONFIG_SCSI_PLUTO -#include "pluto.h" -#endif - -#ifdef CONFIG_SCSI_INITIO -#include "ini9100u.h" -#endif - -#ifdef CONFIG_SCSI_INIA100 -#include "inia100.h" -#endif - -#ifdef CONFIG_SCSI_DEBUG -#include "scsi_debug.h" -#endif - -#ifdef CONFIG_SCSI_ACORNSCSI_3 -#include "../acorn/scsi/acornscsi.h" -#endif - -#ifdef CONFIG_SCSI_CUMANA_1 -#include "../acorn/scsi/cumana_1.h" -#endif - -#ifdef CONFIG_SCSI_CUMANA_2 -#include "../acorn/scsi/cumana_2.h" -#endif - -#ifdef CONFIG_SCSI_ECOSCSI -#include "../acorn/scsi/ecoscsi.h" -#endif - -#ifdef CONFIG_SCSI_OAK1 -#include "../acorn/scsi/oak.h" -#endif - -#ifdef CONFIG_SCSI_POWERTECSCSI -#include "../acorn/scsi/powertec.h" -#endif - -#ifdef CONFIG_SCSI_ARXESCSI -#include "../acorn/scsi/arxescsi.h" -#endif - -#ifdef CONFIG_I2O_SCSI -#include "../i2o/i2o_scsi.h" -#endif - -#ifdef CONFIG_JAZZ_ESP -#include "jazz_esp.h" -#endif - -#ifdef CONFIG_SCSI_DECNCR -#include "dec_esp.h" -#endif - -#ifdef CONFIG_SUN3X_ESP -#include "sun3x_esp.h" -#endif - -#ifdef CONFIG_IPHASE5526 -#include "../net/fc/iph5526_scsi.h" -#endif - -#ifdef CONFIG_BLK_DEV_3W_XXXX_RAID -#include "3w-xxxx.h" -#endif - -/* - * Moved ppa driver to the end of the probe list - * since it is a removable host adapter. - * This means the parallel ZIP drive will not bump - * the order of the /dev/sd devices - campbell@torque.net - */ -#ifdef CONFIG_SCSI_PPA -#include "ppa.h" -#endif - -#ifdef CONFIG_SCSI_IMM -#include "imm.h" -#endif - /* static const char RCSid[] = "$Header: /vger/u4/cvs/linux/drivers/scsi/hosts.c,v 1.20 1996/12/12 19:18:32 davem Exp $"; */ @@ -422,281 +73,6 @@ Scsi_Host_Template * scsi_hosts = NULL; -static Scsi_Host_Template builtin_scsi_hosts[] = -{ -#ifdef CONFIG_AMIGA -#ifdef AMIGA7XXCONFIG - AMIGA7XX_SCSI, -#endif -#ifdef CONFIG_A3000_SCSI - A3000_SCSI, -#endif -#ifdef CONFIG_A2091_SCSI - A2091_SCSI, -#endif -#ifdef CONFIG_GVP11_SCSI - GVP11_SCSI, -#endif -#ifdef CONFIG_CYBERSTORM_SCSI - SCSI_CYBERSTORM, -#endif -#ifdef CONFIG_CYBERSTORMII_SCSI - SCSI_CYBERSTORMII, -#endif -#ifdef CONFIG_BLZ2060_SCSI - SCSI_BLZ2060, -#endif -#ifdef CONFIG_BLZ1230_SCSI - SCSI_BLZ1230, -#endif -#ifdef CONFIG_FASTLANE_SCSI - SCSI_FASTLANE, -#endif -#ifdef CONFIG_OKTAGON_SCSI - SCSI_OKTAGON_ESP, -#endif -#endif - -#ifdef CONFIG_ATARI -#ifdef CONFIG_ATARI_SCSI - ATARI_SCSI, -#endif -#endif - -#ifdef CONFIG_MAC -#ifdef CONFIG_MAC_SCSI_OLD - MAC_SCSI, -#endif -#ifdef CONFIG_SCSI_MAC_ESP - SCSI_MAC_ESP, -#endif -#ifdef CONFIG_MAC_SCSI - MAC_NCR5380, -#endif -#endif - -#ifdef CONFIG_SUN3_SCSI - SUN3_NCR5380, -#endif - -#ifdef CONFIG_MVME16x_SCSI - MVME16x_SCSI, -#endif -#ifdef CONFIG_BVME6000_SCSI - BVME6000_SCSI, -#endif -#ifdef CONFIG_SCSI_SIM710 - SIM710_SCSI, -#endif -#ifdef CONFIG_SCSI_ADVANSYS - ADVANSYS, -#endif - -#ifdef CONFIG_SCSI_PCI2000 - PCI2000, -#endif -#ifdef CONFIG_SCSI_PCI2220I - PCI2220I, -#endif -#ifdef CONFIG_SCSI_PSI240I - PSI240I, -#endif - -/* BusLogic must come before aha1542.c */ -#ifdef CONFIG_SCSI_BUSLOGIC - BUSLOGIC, -#endif -#ifdef CONFIG_SCSI_U14_34F - ULTRASTOR_14_34F, -#endif -#ifdef CONFIG_SCSI_ULTRASTOR - ULTRASTOR_14F, -#endif -#ifdef CONFIG_SCSI_AHA152X - AHA152X, -#endif -#ifdef CONFIG_SCSI_AHA1542 - AHA1542, -#endif -#ifdef CONFIG_SCSI_AHA1740 - AHA1740, -#endif -#ifdef CONFIG_SCSI_AIC7XXX - AIC7XXX, -#endif -#ifdef CONFIG_SCSI_IPS - IPS, -#endif -#ifdef CONFIG_SCSI_FD_MCS - FD_MCS, -#endif -#ifdef CONFIG_SCSI_FUTURE_DOMAIN - FDOMAIN_16X0, -#endif -#ifdef CONFIG_SCSI_IN2000 - IN2000, -#endif -#ifdef CONFIG_SCSI_GENERIC_NCR5380 - GENERIC_NCR5380, -#endif -#ifdef CONFIG_SCSI_NCR53C406A /* 53C406A should come before QLOGIC */ - NCR53c406a, -#endif -#ifdef CONFIG_SCSI_SYM53C416 - SYM53C416, -#endif -#ifdef CONFIG_SCSI_QLOGIC_FAS - QLOGICFAS, -#endif -#ifdef CONFIG_SCSI_QLOGIC_ISP - QLOGICISP, -#endif -#ifdef CONFIG_SCSI_QLOGIC_FC - QLOGICFC, -#endif -#ifdef CONFIG_SCSI_QLOGIC_1280 - QLA1280_LINUX_TEMPLATE, -#endif -#ifdef CONFIG_SCSI_PAS16 - MV_PAS16, -#endif -#ifdef CONFIG_SCSI_SEAGATE - SEAGATE_ST0X, -#endif -#ifdef CONFIG_SCSI_T128 - TRANTOR_T128, -#endif -#ifdef CONFIG_SCSI_DMX3191D - DMX3191D, -#endif -#ifdef CONFIG_SCSI_DTC3280 - DTC3x80, -#endif -#ifdef CONFIG_SCSI_NCR53C7xx - NCR53c7xx, -#endif -#ifdef CONFIG_SCSI_SYM53C8XX - SYM53C8XX, -#endif -#ifdef CONFIG_SCSI_NCR53C8XX - NCR53C8XX, -#endif -#ifdef CONFIG_SCSI_EATA_DMA - EATA_DMA, -#endif -#ifdef CONFIG_SCSI_EATA_PIO - EATA_PIO, -#endif -#ifdef CONFIG_SCSI_7000FASST - WD7000, -#endif -#ifdef CONFIG_SCSI_MCA_53C9X - MCA_53C9X, -#endif -#ifdef CONFIG_SCSI_IBMMCA - IBMMCA, -#endif -#ifdef CONFIG_SCSI_EATA - EATA, -#endif -#ifdef CONFIG_SCSI_DC390T - DC390_T, -#endif -#ifdef CONFIG_SCSI_AM53C974 - AM53C974, -#endif -#ifdef CONFIG_SCSI_MEGARAID - MEGARAID, -#endif -#ifdef CONFIG_SCSI_ACARD - ATP870U, -#endif -#ifdef CONFIG_SCSI_SUNESP - SCSI_SPARC_ESP, -#endif -#ifdef CONFIG_SCSI_GDTH - GDTH, -#endif -#ifdef CONFIG_SCSI_INITIO - INI9100U, -#endif -#ifdef CONFIG_SCSI_INIA100 - INIA100, -#endif -#ifdef CONFIG_SCSI_QLOGICPTI - QLOGICPTI, -#endif -#ifdef CONFIG_BLK_DEV_IDESCSI - IDESCSI, -#endif -#ifdef CONFIG_SCSI_MESH - SCSI_MESH, -#endif -#ifdef CONFIG_SCSI_MAC53C94 - SCSI_MAC53C94, -#endif -#ifdef CONFIG_SCSI_PLUTO - PLUTO, -#endif -#ifdef CONFIG_ARCH_ACORN -#ifdef CONFIG_SCSI_ACORNSCSI_3 - ACORNSCSI_3, -#endif -#ifdef CONFIG_SCSI_CUMANA_1 - CUMANA_NCR5380, -#endif -#ifdef CONFIG_SCSI_CUMANA_2 - CUMANA_FAS216, -#endif -#ifdef CONFIG_SCSI_ARXESCSI - ARXEScsi, -#endif -#ifdef CONFIG_SCSI_ECOSCSI - ECOSCSI_NCR5380, -#endif -#ifdef CONFIG_SCSI_OAK1 - OAK_NCR5380, -#endif -#ifdef CONFIG_SCSI_POWERTECSCSI - POWERTECSCSI, -#endif -#endif -#ifdef CONFIG_IPHASE5526 - IPH5526_SCSI_FC, -#endif -#ifdef CONFIG_SCSI_DECNCR - SCSI_DEC_ESP, -#endif -#ifdef CONFIG_BLK_DEV_3W_XXXX_RAID - TWXXXX, -#endif -/* Put I2O last so that host specific controllers always win */ -#ifdef CONFIG_I2O_SCSI - I2OSCSI, -#endif -/* "Removable host adapters" below this line (Parallel Port/USB/other) */ -#ifdef CONFIG_SCSI_PPA - PPA, -#endif -#ifdef CONFIG_SCSI_IMM - IMM, -#endif -#ifdef CONFIG_SCSI_SGIWD93 - SGIWD93_SCSI, -#endif -#ifdef CONFIG_JAZZ_ESP - SCSI_JAZZ_ESP, -#endif -#ifdef CONFIG_SUN3X_ESP - SCSI_SUN3X_ESP, -#endif -#ifdef CONFIG_SCSI_DEBUG - SCSI_DEBUG, -#endif -}; - -#define MAX_SCSI_HOSTS (sizeof(builtin_scsi_hosts) / sizeof(Scsi_Host_Template)) - /* * Our semaphores and timeout counters, where size depends on @@ -886,135 +262,6 @@ if(sdpnt->next) panic("Device already registered"); sdpnt->next = scsi_devicelist; scsi_devicelist = sdpnt; - return 0; -} - -/* - * Why is this a separate function? Because the kernel_thread code - * effectively does a fork, and there is a builtin exit() call when - * the child returns. The difficulty is that scsi_init() is - * marked __init, which means the memory is unmapped after bootup - * is complete, which means that the thread's exit() call gets wiped. - * - * The lesson is to *NEVER*, *NEVER* call kernel_thread() from an - * __init function, if that function could ever return. - */ -static void launch_error_handler_thread(struct Scsi_Host * shpnt) -{ - DECLARE_MUTEX_LOCKED(sem); - - shpnt->eh_notify = &sem; - - kernel_thread((int (*)(void *))scsi_error_handler, - (void *) shpnt, 0); - - /* - * Now wait for the kernel error thread to initialize itself - * as it might be needed when we scan the bus. - */ - down (&sem); - shpnt->eh_notify = NULL; -} - -unsigned int __init scsi_init(void) -{ - static int called = 0; - int i, pcount; - unsigned long flags; - Scsi_Host_Template * tpnt; - struct Scsi_Host * shpnt; - const char * name; - - if(called) return 0; - - called = 1; - for (tpnt = &builtin_scsi_hosts[0], i = 0; i < MAX_SCSI_HOSTS; ++i, tpnt++) - { - /* - * Initialize our semaphores. -1 is interpreted to mean - * "inactive" - where as 0 will indicate a time out condition. - */ - - pcount = next_scsi_host; - if (tpnt->detect) { - - /* The detect routine must carefully spinunlock/spinlock if - it enables interrupts, since all interrupt handlers do - spinlock as well. - All lame drivers are going to fail due to the following - spinlock. For the time beeing let's use it only for drivers - using the new scsi code. NOTE: the detect routine could - redefine the value tpnt->use_new_eh_code. (DB, 13 May 1998) */ - - if (tpnt->use_new_eh_code) { - spin_lock_irqsave(&io_request_lock, flags); - tpnt->present = tpnt->detect(tpnt); - spin_unlock_irqrestore(&io_request_lock, flags); - } - else - tpnt->present = tpnt->detect(tpnt); - - } - - if (tpnt->detect && tpnt->present) - { - /* The only time this should come up is when people use - * some kind of patched driver of some kind or another. */ - if(pcount == next_scsi_host) { - if(tpnt->present > 1) - panic("Failure to register low-level scsi driver"); - /* The low-level driver failed to register a driver. We - * can do this now. */ - scsi_register(tpnt,0); - } - tpnt->next = scsi_hosts; - scsi_hosts = tpnt; - - /* Add the driver to /proc/scsi */ -#if CONFIG_PROC_FS - build_proc_dir_entries(tpnt); -#endif - } - } - - for(shpnt=scsi_hostlist; shpnt; shpnt = shpnt->next) - { - if(shpnt->hostt->info) - name = shpnt->hostt->info(shpnt); - else - name = shpnt->hostt->name; - printk ("scsi%d : %s\n", /* And print a little message */ - shpnt->host_no, name); - - /* - * Now start the error recovery thread for the host. - */ - if( shpnt->hostt->use_new_eh_code ) - { - launch_error_handler_thread(shpnt); - } - } - - printk ("scsi : %d host%s.\n", next_scsi_host, - (next_scsi_host == 1) ? "" : "s"); - - /* Now attach the high level drivers */ -#ifdef CONFIG_BLK_DEV_SD - scsi_register_device(&sd_template); -#endif -#ifdef CONFIG_BLK_DEV_SR - scsi_register_device(&sr_template); -#endif -#ifdef CONFIG_CHR_DEV_ST - scsi_register_device(&st_template); -#endif -#ifdef CONFIG_CHR_DEV_SG - scsi_register_device(&sg_template); -#endif - -#if 0 - max_scsi_hosts = next_scsi_host; -#endif return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/hosts.h linux/drivers/scsi/hosts.h --- v2.4.0-test8/linux/drivers/scsi/hosts.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/hosts.h Mon Sep 18 15:39:52 2000 @@ -506,11 +506,6 @@ void scsi_initialize_queue(Scsi_Device * SDpnt, struct Scsi_Host * SHpnt); -extern struct Scsi_Device_Template sd_template; -extern struct Scsi_Device_Template st_template; -extern struct Scsi_Device_Template sr_template; -extern struct Scsi_Device_Template sg_template; - int scsi_register_device(struct Scsi_Device_Template * sdpnt); /* These are used by loadable modules */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ibmmca.c linux/drivers/scsi/ibmmca.c --- v2.4.0-test8/linux/drivers/scsi/ibmmca.c Mon Jul 31 11:35:12 2000 +++ linux/drivers/scsi/ibmmca.c Mon Sep 18 13:36:25 2000 @@ -3294,12 +3294,10 @@ __setup("ibmmcascsi=", option_setup); #endif -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = IBMMCA; +static Scsi_Host_Template driver_template = IBMMCA; #include "scsi_module.c" -#endif /*--------------------------------------------------------------------*/ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c --- v2.4.0-test8/linux/drivers/scsi/ide-scsi.c Thu Apr 13 22:50:32 2000 +++ linux/drivers/scsi/ide-scsi.c Mon Sep 18 15:08:18 2000 @@ -827,18 +827,17 @@ return 0; } -#ifdef MODULE -Scsi_Host_Template idescsi_template = IDESCSI; +static Scsi_Host_Template idescsi_template = IDESCSI; -int init_module (void) +static int __init init_idescsi_module(void) { - idescsi_init (); - idescsi_template.module = &__this_module; + idescsi_init(); + idescsi_template.module = THIS_MODULE; scsi_register_module (MODULE_SCSI_HA, &idescsi_template); return 0; } -void cleanup_module (void) +static void __exit exit_idescsi_module(void) { ide_drive_t *drive; byte media[] = {TYPE_DISK, TYPE_TAPE, TYPE_PROCESSOR, TYPE_WORM, TYPE_ROM, TYPE_SCANNER, TYPE_MOD, 255}; @@ -855,4 +854,6 @@ } ide_unregister_module(&idescsi_module); } -#endif /* MODULE */ + +module_init(init_idescsi_module); +module_exit(exit_idescsi_module); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/imm.c linux/drivers/scsi/imm.c --- v2.4.0-test8/linux/drivers/scsi/imm.c Mon Jul 24 18:59:27 2000 +++ linux/drivers/scsi/imm.c Mon Sep 18 13:36:25 2000 @@ -114,10 +114,8 @@ * Parallel port probing routines * ***************************************************************************/ -#ifdef MODULE -Scsi_Host_Template driver_template = IMM; +static Scsi_Host_Template driver_template = IMM; #include "scsi_module.c" -#endif int imm_detect(Scsi_Host_Template * host) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/in2000.c linux/drivers/scsi/in2000.c --- v2.4.0-test8/linux/drivers/scsi/in2000.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/in2000.c Mon Sep 18 13:36:25 2000 @@ -2359,11 +2359,6 @@ } -#ifdef MODULE - -Scsi_Host_Template driver_template = IN2000; - +static Scsi_Host_Template driver_template = IN2000; #include "scsi_module.c" - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ini9100u.c linux/drivers/scsi/ini9100u.c --- v2.4.0-test8/linux/drivers/scsi/ini9100u.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/ini9100u.c Mon Sep 18 13:36:25 2000 @@ -143,10 +143,8 @@ unsigned int i91u_debug = DEBUG_DEFAULT; #endif -#ifdef MODULE -Scsi_Host_Template driver_template = INI9100U; +static Scsi_Host_Template driver_template = INI9100U; #include "scsi_module.c" -#endif char *i91uCopyright = "Copyright (C) 1996-98"; char *i91uInitioName = "by Initio Corporation"; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/inia100.c linux/drivers/scsi/inia100.c --- v2.4.0-test8/linux/drivers/scsi/inia100.c Wed Jul 5 17:57:27 2000 +++ linux/drivers/scsi/inia100.c Mon Sep 18 13:36:25 2000 @@ -92,10 +92,8 @@ #include #include "inia100.h" -#ifdef MODULE -Scsi_Host_Template driver_template = INIA100; +static Scsi_Host_Template driver_template = INIA100; #include "scsi_module.c" -#endif #define ORC_RDWORD(x,y) (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) )) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ips.c linux/drivers/scsi/ips.c --- v2.4.0-test8/linux/drivers/scsi/ips.c Fri Aug 4 17:58:10 2000 +++ linux/drivers/scsi/ips.c Mon Sep 18 13:36:25 2000 @@ -5205,13 +5205,9 @@ return (0); } -#if defined (MODULE) +static Scsi_Host_Template driver_template = IPS; +#include "scsi_module.c" -Scsi_Host_Template driver_template = IPS; - - #include "scsi_module.c" - -#endif /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/mac_scsi.c linux/drivers/scsi/mac_scsi.c --- v2.4.0-test8/linux/drivers/scsi/mac_scsi.c Mon Jun 19 17:59:41 2000 +++ linux/drivers/scsi/mac_scsi.c Mon Sep 18 13:36:25 2000 @@ -662,9 +662,6 @@ -#ifdef MODULE - -Scsi_Host_Template driver_template = MAC_NCR5380; +static Scsi_Host_Template driver_template = MAC_NCR5380; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/mca_53c9x.c linux/drivers/scsi/mca_53c9x.c --- v2.4.0-test8/linux/drivers/scsi/mca_53c9x.c Tue Sep 7 10:14:37 1999 +++ linux/drivers/scsi/mca_53c9x.c Mon Sep 18 13:36:25 2000 @@ -419,10 +419,8 @@ outb(inb(PS2_SYS_CTR) & 0x3f, PS2_SYS_CTR); } -#ifdef MODULE -Scsi_Host_Template driver_template = MCA_53C9X; +static Scsi_Host_Template driver_template = MCA_53C9X; #include "scsi_module.c" -#endif /* * OK, here's the goods I promised. The NCR 86C01 is an MCA interface chip diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/megaraid.c linux/drivers/scsi/megaraid.c --- v2.4.0-test8/linux/drivers/scsi/megaraid.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/megaraid.c Mon Sep 18 13:36:25 2000 @@ -2032,8 +2032,6 @@ __setup("megaraid=", megaraid_setup); -#ifdef MODULE -Scsi_Host_Template driver_template = MEGARAID; +static Scsi_Host_Template driver_template = MEGARAID; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/mvme16x.h linux/drivers/scsi/mvme16x.h --- v2.4.0-test8/linux/drivers/scsi/mvme16x.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/mvme16x.h Mon Sep 18 14:09:49 2000 @@ -23,7 +23,6 @@ #define CAN_QUEUE 24 #endif -#if defined(HOSTS_C) || defined(MODULE) #include #define MVME16x_SCSI {name: "MVME16x NCR53c710 SCSI", \ @@ -37,5 +36,5 @@ sg_tablesize: 63, \ cmd_per_lun: 3, \ use_clustering: DISABLE_CLUSTERING } -#endif + #endif /* MVME16x_SCSI_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ncr53c8xx.c linux/drivers/scsi/ncr53c8xx.c --- v2.4.0-test8/linux/drivers/scsi/ncr53c8xx.c Mon Jun 19 17:59:41 2000 +++ linux/drivers/scsi/ncr53c8xx.c Mon Sep 18 13:36:25 2000 @@ -9513,7 +9513,5 @@ ** Module stuff */ -#ifdef MODULE -Scsi_Host_Template driver_template = NCR53C8XX; +static Scsi_Host_Template driver_template = NCR53C8XX; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ncr53c8xx.h linux/drivers/scsi/ncr53c8xx.h --- v2.4.0-test8/linux/drivers/scsi/ncr53c8xx.h Fri Sep 8 12:54:35 2000 +++ linux/drivers/scsi/ncr53c8xx.h Mon Sep 18 14:09:49 2000 @@ -50,8 +50,6 @@ ** Used by hosts.c and ncr53c8xx.c with module configuration. */ -#if defined(HOSTS_C) || defined(MODULE) - #include int ncr53c8xx_abort(Scsi_Cmnd *); @@ -95,7 +93,5 @@ 0, 0, DISABLE_CLUSTERING} #endif /* LINUX_VERSION_CODE */ - -#endif /* defined(HOSTS_C) || defined(MODULE) */ #endif /* NCR53C8XX_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/oktagon_esp.c linux/drivers/scsi/oktagon_esp.c --- v2.4.0-test8/linux/drivers/scsi/oktagon_esp.c Wed Jan 26 12:45:20 2000 +++ linux/drivers/scsi/oktagon_esp.c Mon Sep 18 13:36:25 2000 @@ -570,17 +570,14 @@ sp->SCp.ptr = sp->SCp.buffer->address; } -#ifdef MODULE #define HOSTS_C #include "oktagon_esp.h" -Scsi_Host_Template driver_template = SCSI_OKTAGON_ESP; +static Scsi_Host_Template driver_template = SCSI_OKTAGON_ESP; #include "scsi_module.c" - -#endif int oktagon_esp_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/pas16.c linux/drivers/scsi/pas16.c --- v2.4.0-test8/linux/drivers/scsi/pas16.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/pas16.c Mon Sep 18 13:36:25 2000 @@ -597,12 +597,12 @@ #include "NCR5380.c" -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = MV_PAS16; +static Scsi_Host_Template driver_template = MV_PAS16; #include "scsi_module.c" +#ifdef MODULE MODULE_PARM(pas16_addr, "h"); MODULE_PARM(pas16_irq, "i"); #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/pas16.h linux/drivers/scsi/pas16.h --- v2.4.0-test8/linux/drivers/scsi/pas16.h Sat Apr 11 11:13:25 1998 +++ linux/drivers/scsi/pas16.h Mon Sep 18 14:10:10 2000 @@ -140,8 +140,6 @@ * macros when this is being used solely for the host stub. */ -#if defined(HOSTS_C) || defined(MODULE) - #define MV_PAS16 { \ name: "Pro Audio Spectrum-16 SCSI", \ detect: pas16_detect, \ @@ -155,7 +153,6 @@ cmd_per_lun: CMD_PER_LUN , \ use_clustering: DISABLE_CLUSTERING} -#endif #ifndef HOSTS_C #define NCR5380_implementation_fields \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/pci2000.c linux/drivers/scsi/pci2000.c --- v2.4.0-test8/linux/drivers/scsi/pci2000.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/pci2000.c Mon Sep 18 13:36:25 2000 @@ -855,9 +855,7 @@ } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = PCI2000; +static Scsi_Host_Template driver_template = PCI2000; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/pci2220i.c linux/drivers/scsi/pci2220i.c --- v2.4.0-test8/linux/drivers/scsi/pci2220i.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/pci2220i.c Mon Sep 18 13:36:25 2000 @@ -2509,7 +2509,7 @@ init_timer (&padapter->reconTimer); padapter->reconTimer.function = ReconTimerExpiry; padapter->reconTimer.data = (unsigned long)padapter; - printk("\nPCI-%sI EIDE CONTROLLER: at I/O = %lX/%lX IRQ = %ld\n", str, padapter->basePort, padapter->regBase, irq); + printk("\nPCI-%sI EIDE CONTROLLER: at I/O = %lX/%lX IRQ = %d\n", str, padapter->basePort, padapter->regBase, irq); printk("Version %s, Compiled %s %s\n\n", PCI2220I_VERSION, __DATE__, __TIME__); } /**************************************************************** @@ -2920,9 +2920,7 @@ } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = PCI2220I; +static Scsi_Host_Template driver_template = PCI2220I; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/pluto.c linux/drivers/scsi/pluto.c --- v2.4.0-test8/linux/drivers/scsi/pluto.c Fri Jul 14 12:20:22 2000 +++ linux/drivers/scsi/pluto.c Mon Sep 18 13:36:25 2000 @@ -331,11 +331,8 @@ return 0; } -#ifdef MODULE - -Scsi_Host_Template driver_template = PLUTO; +static Scsi_Host_Template driver_template = PLUTO; #include "scsi_module.c" EXPORT_NO_SYMBOLS; -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ppa.c linux/drivers/scsi/ppa.c --- v2.4.0-test8/linux/drivers/scsi/ppa.c Mon Jul 24 18:59:27 2000 +++ linux/drivers/scsi/ppa.c Mon Sep 18 13:36:25 2000 @@ -99,10 +99,8 @@ * Parallel port probing routines * ***************************************************************************/ -#ifdef MODULE -Scsi_Host_Template driver_template = PPA; +static Scsi_Host_Template driver_template = PPA; #include "scsi_module.c" -#endif /* * Start of Chipset kludges diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/psi240i.c linux/drivers/scsi/psi240i.c --- v2.4.0-test8/linux/drivers/scsi/psi240i.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/psi240i.c Mon Sep 18 13:36:25 2000 @@ -713,10 +713,8 @@ } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = PSI240I; +static Scsi_Host_Template driver_template = PSI240I; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/qla1280.c linux/drivers/scsi/qla1280.c --- v2.4.0-test8/linux/drivers/scsi/qla1280.c Mon Jun 19 13:42:40 2000 +++ linux/drivers/scsi/qla1280.c Mon Sep 18 13:36:25 2000 @@ -6163,11 +6163,9 @@ /* * Declarations for load module */ -#ifdef MODULE -Scsi_Host_Template driver_template = QLA1280_LINUX_TEMPLATE; +static Scsi_Host_Template driver_template = QLA1280_LINUX_TEMPLATE; #include "scsi_module.c" -#endif /************************************************************************ * qla1280_check_for_dead_scsi_bus * diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/qlogicfas.c linux/drivers/scsi/qlogicfas.c --- v2.4.0-test8/linux/drivers/scsi/qlogicfas.c Tue Feb 15 08:53:46 2000 +++ linux/drivers/scsi/qlogicfas.c Mon Sep 18 13:36:25 2000 @@ -643,8 +643,10 @@ ip[0] = 0xff; ip[1] = 0x3f; ip[2] = disk->capacity / (ip[0] * ip[1]); +#if 0 if (ip[2] > 1023) ip[2] = 1023; +#endif } return 0; } @@ -674,10 +676,7 @@ return qinfo; } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = QLOGICFAS; - +static Scsi_Host_Template driver_template = QLOGICFAS; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/qlogicfc.c linux/drivers/scsi/qlogicfc.c --- v2.4.0-test8/linux/drivers/scsi/qlogicfc.c Fri Aug 11 14:30:35 2000 +++ linux/drivers/scsi/qlogicfc.c Mon Sep 18 13:36:25 2000 @@ -2226,10 +2226,6 @@ #endif /* DEBUG_ISP2x00 */ -#ifdef MODULE - -Scsi_Host_Template driver_template = QLOGICFC; +static Scsi_Host_Template driver_template = QLOGICFC; #include "scsi_module.c" - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/qlogicisp.c linux/drivers/scsi/qlogicisp.c --- v2.4.0-test8/linux/drivers/scsi/qlogicisp.c Mon Jun 19 13:42:41 2000 +++ linux/drivers/scsi/qlogicisp.c Mon Sep 18 13:36:25 2000 @@ -1989,8 +1989,6 @@ #endif /* DEBUG_ISP1020 */ -#ifdef MODULE -Scsi_Host_Template driver_template = QLOGICISP; +static Scsi_Host_Template driver_template = QLOGICISP; #include "scsi_module.c" -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/qlogicpti.c linux/drivers/scsi/qlogicpti.c --- v2.4.0-test8/linux/drivers/scsi/qlogicpti.c Mon Aug 28 12:00:08 2000 +++ linux/drivers/scsi/qlogicpti.c Mon Sep 18 13:36:25 2000 @@ -1526,10 +1526,8 @@ return return_status; } -#ifdef MODULE -Scsi_Host_Template driver_template = QLOGICPTI; +static Scsi_Host_Template driver_template = QLOGICPTI; #include "scsi_module.c" EXPORT_NO_SYMBOLS; -#endif /* MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v2.4.0-test8/linux/drivers/scsi/scsi.c Mon Jul 31 11:00:06 2000 +++ linux/drivers/scsi/scsi.c Mon Sep 18 14:53:40 2000 @@ -384,7 +384,7 @@ * return NULL. */ SCpnt = NULL; - break; + goto busy; } } /* @@ -402,6 +402,7 @@ if (SCpnt) { break; } + busy: /* * If we have been asked to wait for a free block, then * wait here. @@ -495,30 +496,7 @@ return SCpnt; } -/* - * Function: scsi_release_command - * - * Purpose: Release a command block. - * - * Arguments: SCpnt - command block we are releasing. - * - * Notes: The command block can no longer be used by the caller once - * this funciton is called. This is in effect the inverse - * of scsi_allocate_device. Note that we also must perform - * a couple of additional tasks. We must first wake up any - * processes that might have blocked waiting for a command - * block, and secondly we must hit the queue handler function - * to make sure that the device is busy. - * - * The idea is that a lot of the mid-level internals gunk - * gets hidden in this function. Upper level drivers don't - * have any chickens to wave in the air to get things to - * work reliably. - * - * This function is deprecated, and drivers should be - * rewritten to use Scsi_Request instead of Scsi_Cmnd. - */ -void scsi_release_command(Scsi_Cmnd * SCpnt) +inline void __scsi_release_command(Scsi_Cmnd * SCpnt) { unsigned long flags; Scsi_Device * SDpnt; @@ -562,6 +540,43 @@ * they wake up. */ wake_up(&SDpnt->scpnt_wait); +} + +/* + * Function: scsi_release_command + * + * Purpose: Release a command block. + * + * Arguments: SCpnt - command block we are releasing. + * + * Notes: The command block can no longer be used by the caller once + * this funciton is called. This is in effect the inverse + * of scsi_allocate_device. Note that we also must perform + * a couple of additional tasks. We must first wake up any + * processes that might have blocked waiting for a command + * block, and secondly we must hit the queue handler function + * to make sure that the device is busy. Note - there is an + * option to not do this - there were instances where we could + * recurse too deeply and blow the stack if this happened + * when we were indirectly called from the request function + * itself. + * + * The idea is that a lot of the mid-level internals gunk + * gets hidden in this function. Upper level drivers don't + * have any chickens to wave in the air to get things to + * work reliably. + * + * This function is deprecated, and drivers should be + * rewritten to use Scsi_Request instead of Scsi_Cmnd. + */ +void scsi_release_command(Scsi_Cmnd * SCpnt) +{ + request_queue_t *q; + Scsi_Device * SDpnt; + + SDpnt = SCpnt->device; + + __scsi_release_command(SCpnt); /* * Finally, hit the queue request function to make sure that @@ -569,12 +584,8 @@ * This won't block - if the device cannot take any more, life * will go on. */ - { - request_queue_t *q; - - q = &SDpnt->request_queue; - scsi_queue_next_request(q, NULL); - } + q = &SDpnt->request_queue; + scsi_queue_next_request(q, NULL); } /* @@ -1361,11 +1372,8 @@ SCpnt->done(SCpnt); } -#if defined(CONFIG_MODULES) || defined(CONFIG_BLK_DEV_IDESCSI) || defined(CONFIG_USB_STORAGE) static int scsi_register_host(Scsi_Host_Template *); static void scsi_unregister_host(Scsi_Host_Template *); -#endif - int scsi_loadable_module_flag; /* Set after we scan builtin drivers */ @@ -1499,120 +1507,6 @@ } } -#ifndef MODULE /* { */ - -char scsi_host_no_table[20][10] __initdata = {}; -int scsi_host_no_set __initdata = 0; - -/* - * scsi_dev_init() is our initialization routine, which in turn calls host - * initialization, bus scanning, and sd/st initialization routines. - * This is only used at boot time. - */ -int __init scsi_dev_init(void) -{ - Scsi_Device *SDpnt; - struct Scsi_Host *shpnt; - struct Scsi_Device_Template *sdtpnt; - struct proc_dir_entry *generic; -#ifdef FOO_ON_YOU - return; -#endif - - /* Initialize list of host_no if kernel parameter set */ - if (scsi_host_no_set) { - int i; - for (i = 0;i < sizeof(scsi_host_no_table)/sizeof(scsi_host_no_table[0]);i++) - scsi_host_no_insert(scsi_host_no_table[i], i); - } - - /* Yes we're here... */ - - scsi_devfs_handle = devfs_mk_dir (NULL, "scsi", NULL); - /* - * This makes /proc/scsi and /proc/scsi/scsi visible. - */ -#ifdef CONFIG_PROC_FS - proc_scsi = proc_mkdir("scsi", 0); - if (!proc_scsi) { - printk (KERN_ERR "cannot init /proc/scsi\n"); - return -ENOMEM; - } - - generic = create_proc_info_entry ("scsi/scsi", 0, 0, scsi_proc_info); - if (!generic) { - printk (KERN_ERR "cannot init /proc/scsi/scsi\n"); - remove_proc_entry("scsi", 0); - return -ENOMEM; - } - generic->write_proc = proc_scsi_gen_write; -#endif - - /* Init a few things so we can "malloc" memory. */ - scsi_loadable_module_flag = 0; - - /* initialize all hosts */ - scsi_init(); - - /* - * This is where the processing takes place for most everything - * when commands are completed. Until we do this, we will not be able - * to queue any commands. - */ - init_bh(SCSI_BH, scsi_bottom_half_handler); - - for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { - scan_scsis(shpnt, 0, 0, 0, 0); /* scan for scsi devices */ - if (shpnt->select_queue_depths != NULL) - (shpnt->select_queue_depths) (shpnt, shpnt->host_queue); - } - - printk("scsi : detected "); - for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) - if (sdtpnt->dev_noticed && sdtpnt->name) - printk("%d SCSI %s%s ", sdtpnt->dev_noticed, sdtpnt->name, - (sdtpnt->dev_noticed != 1) ? "s" : ""); - printk("total.\n"); - - for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) - if (sdtpnt->init && sdtpnt->dev_noticed) - (*sdtpnt->init) (); - - for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) { - for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { - /* SDpnt->scsi_request_fn = NULL; */ - for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) - if (sdtpnt->attach) - (*sdtpnt->attach) (SDpnt); - if (SDpnt->attached) { - scsi_build_commandblocks(SDpnt); - if (0 == SDpnt->has_cmdblocks) { - printk("scsi_dev_init: DANGER, no command blocks\n"); - /* What to do now ?? */ - } - } - } - } - - /* - * This should build the DMA pool. - */ - scsi_resize_dma_pool(); - - /* - * OK, now we finish the initialization by doing spin-up, read - * capacity, etc, etc - */ - for (sdtpnt = scsi_devicelist; sdtpnt; sdtpnt = sdtpnt->next) - if (sdtpnt->finish && sdtpnt->nr_dev) - (*sdtpnt->finish) (); - - scsi_loadable_module_flag = 1; - - return 0; -} -#endif /* MODULE */ /* } */ - #ifdef CONFIG_PROC_FS static int scsi_proc_info(char *buffer, char **start, off_t offset, int length) { @@ -1908,13 +1802,6 @@ #endif /* - * Some host adapters that are plugging into other subsystems register - * their hosts through the modules entrypoints, and don't use the big - * list in hosts.c. - */ -#if defined(CONFIG_MODULES) || defined(CONFIG_BLK_DEV_IDESCSI) || defined(CONFIG_USB_STORAGE) || defined(CONFIG_USB_MICROTEK) /* a big #ifdef block... */ - -/* * This entry point should be called by a loadable module if it is trying * add a low level scsi driver to the system. */ @@ -2466,8 +2353,6 @@ return; } -#endif /* CONFIG_MODULES */ - #ifdef CONFIG_PROC_FS /* * Function: scsi_dump_status @@ -2579,12 +2464,6 @@ static int next_no = 0; char *temp; -#ifndef MODULE - int len; - scsi_host_no_set = 1; - memset(scsi_host_no_table, 0, sizeof(scsi_host_no_table)); -#endif /* MODULE */ - while (str) { temp = str; while (*temp && (*temp != ':') && (*temp != ',')) @@ -2593,16 +2472,7 @@ temp = NULL; else *temp++ = 0; -#ifdef MODULE scsi_host_no_insert(str, next_no); -#else - if (next_no < sizeof(scsi_host_no_table)/sizeof(scsi_host_no_table[0])) { - if ((len = strlen(str)) >= sizeof(scsi_host_no_table[0])) - len = sizeof(scsi_host_no_table[0])-1; - strncpy(scsi_host_no_table[next_no], str, len); - scsi_host_no_table[next_no][len] = 0; - } -#endif /* MODULE */ str = temp; next_no++; } @@ -2613,12 +2483,11 @@ __setup("scsihosts=", scsi_host_no_init); #endif -#ifdef MODULE static char *scsihosts; MODULE_PARM(scsihosts, "s"); -int init_module(void) +static int __init init_scsi(void) { struct proc_dir_entry *generic; @@ -2658,7 +2527,7 @@ return 0; } -void cleanup_module(void) +static void __exit exit_scsi(void) { Scsi_Host_Name *shn, *shn2 = NULL; @@ -2688,7 +2557,8 @@ } -#endif /* MODULE */ +module_init(init_scsi); +module_exit(exit_scsi); /* * Function: scsi_get_host_dev() diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h --- v2.4.0-test8/linux/drivers/scsi/scsi.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/scsi.h Mon Sep 18 15:39:52 2000 @@ -492,6 +492,7 @@ extern void scsi_finish_command(Scsi_Cmnd *); extern int scsi_retry_command(Scsi_Cmnd *); extern Scsi_Cmnd *scsi_allocate_device(Scsi_Device *, int, int); +extern void __scsi_release_command(Scsi_Cmnd *); extern void scsi_release_command(Scsi_Cmnd *); extern void scsi_do_cmd(Scsi_Cmnd *, const void *cmnd, void *buffer, unsigned bufflen, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_debug.c linux/drivers/scsi/scsi_debug.c --- v2.4.0-test8/linux/drivers/scsi/scsi_debug.c Mon Mar 13 22:15:03 2000 +++ linux/drivers/scsi/scsi_debug.c Mon Sep 18 13:36:25 2000 @@ -767,12 +767,10 @@ } #endif -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = SCSI_DEBUG; +static Scsi_Host_Template driver_template = SCSI_DEBUG; #include "scsi_module.c" -#endif /* * Overrides for Emacs so that we almost follow Linus's tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_error.c linux/drivers/scsi/scsi_error.c --- v2.4.0-test8/linux/drivers/scsi/scsi_error.c Mon Aug 21 07:37:13 2000 +++ linux/drivers/scsi/scsi_error.c Mon Sep 18 14:57:01 2000 @@ -1861,6 +1861,9 @@ * Flush resources */ + exit_files(current); + current->files = init_task.files; + atomic_inc(¤t->files->count); daemonize(); /* diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_lib.c linux/drivers/scsi/scsi_lib.c --- v2.4.0-test8/linux/drivers/scsi/scsi_lib.c Wed Jul 5 13:18:05 2000 +++ linux/drivers/scsi/scsi_lib.c Sun Sep 17 10:09:29 2000 @@ -381,6 +381,8 @@ * uptodate - 1 if I/O indicates success, 0 for I/O error. * sectors - number of sectors we want to mark. * requeue - indicates whether we should requeue leftovers. + * frequeue - indicates that if we release the command block + * that the queue request function should be called. * * Lock status: Assumed that lock is not held upon entry. * @@ -395,10 +397,12 @@ static Scsi_Cmnd *__scsi_end_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors, - int requeue) + int requeue, + int frequeue) { struct request *req; struct buffer_head *bh; + Scsi_Device * SDpnt; ASSERT_LOCK(&io_request_lock, 0); @@ -458,11 +462,20 @@ } add_blkdev_randomness(MAJOR(req->rq_dev)); + SDpnt = SCpnt->device; + /* * This will goose the queue request function at the end, so we don't * need to worry about launching another command. */ - scsi_release_command(SCpnt); + __scsi_release_command(SCpnt); + + if( frequeue ) { + request_queue_t *q; + + q = &SDpnt->request_queue; + scsi_queue_next_request(q, NULL); + } return NULL; } @@ -488,7 +501,7 @@ */ Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors) { - return __scsi_end_request(SCpnt, uptodate, sectors, 1); + return __scsi_end_request(SCpnt, uptodate, sectors, 1, 1); } /* @@ -648,7 +661,8 @@ SCpnt = __scsi_end_request(SCpnt, 1, good_sectors, - result == 0); + result == 0, + 1); /* * If the command completed without error, then either finish off the @@ -718,8 +732,8 @@ } break; case NOT_READY: - printk(KERN_INFO "Device %x not ready.\n", - SCpnt->request.rq_dev); + printk(KERN_INFO "Device %s not ready.\n", + kdevname(SCpnt->request.rq_dev)); SCpnt = scsi_end_request(SCpnt, 0, this_count); return; break; @@ -962,6 +976,7 @@ } } else { + SRpnt = NULL; STpnt = scsi_get_request_dev(req); if (!STpnt) { panic("Unable to find device associated with request"); @@ -1010,7 +1025,7 @@ */ blkdev_dequeue_request(req); - if (req != &SCpnt->request) { + if (req != &SCpnt->request && req != &SRpnt->sr_request ) { memcpy(&SCpnt->request, req, sizeof(struct request)); /* @@ -1048,8 +1063,12 @@ * get those allocated here. */ if (!SDpnt->scsi_init_io_fn(SCpnt)) { - scsi_end_request(SCpnt, 0, - SCpnt->request.nr_sectors); + SCpnt = __scsi_end_request(SCpnt, 0, + SCpnt->request.nr_sectors, 0, 0); + if( SCpnt != NULL ) + { + panic("Should not have leftover blocks\n"); + } spin_lock_irq(&io_request_lock); SHpnt->host_busy--; SDpnt->device_busy--; @@ -1060,8 +1079,12 @@ */ if (!STpnt->init_command(SCpnt)) { scsi_release_buffers(SCpnt); - scsi_end_request(SCpnt, 0, - SCpnt->request.nr_sectors); + SCpnt = __scsi_end_request(SCpnt, 0, + SCpnt->request.nr_sectors, 0, 0); + if( SCpnt != NULL ) + { + panic("Should not have leftover blocks\n"); + } spin_lock_irq(&io_request_lock); SHpnt->host_busy--; SDpnt->device_busy--; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_module.c linux/drivers/scsi/scsi_module.c --- v2.4.0-test8/linux/drivers/scsi/scsi_module.c Sat Sep 4 10:48:46 1999 +++ linux/drivers/scsi/scsi_module.c Mon Sep 18 14:24:53 2000 @@ -30,10 +30,11 @@ */ #include +#include -int init_module(void) +static int __init init_this_scsi_driver(void) { - driver_template.module = &__this_module; + driver_template.module = THIS_MODULE; scsi_register_module(MODULE_SCSI_HA, &driver_template); if (driver_template.present) return 0; @@ -42,10 +43,13 @@ return -1; } -void cleanup_module(void) +static void __exit exit_this_scsi_driver(void) { scsi_unregister_module(MODULE_SCSI_HA, &driver_template); } + +module_init(init_this_scsi_driver); +module_exit(exit_this_scsi_driver); /* * Overrides for Emacs so that we almost follow Linus's tabbing style. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_queue.c linux/drivers/scsi/scsi_queue.c --- v2.4.0-test8/linux/drivers/scsi/scsi_queue.c Thu Jan 20 15:15:22 2000 +++ linux/drivers/scsi/scsi_queue.c Sun Sep 17 10:09:29 2000 @@ -118,7 +118,7 @@ * If a host is inactive and cannot queue any commands, I don't see * how things could possibly work anyways. */ - if (cmd->device->device_blocked == 0) { + if (cmd->device->device_busy == 0) { if (scsi_retry_command(cmd) == 0) { return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/scsi_scan.c linux/drivers/scsi/scsi_scan.c --- v2.4.0-test8/linux/drivers/scsi/scsi_scan.c Tue Sep 5 14:08:55 2000 +++ linux/drivers/scsi/scsi_scan.c Mon Sep 18 14:59:23 2000 @@ -127,9 +127,9 @@ {"REGAL", "CDC-4X", "*", BLIST_MAX5LUN | BLIST_SINGLELUN}, {"NAKAMICH", "MJ-4.8S", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, {"NAKAMICH", "MJ-5.16S", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, - {"PIONEER", "CD-ROM DRM-600", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, - {"PIONEER", "CD-ROM DRM-602X", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, - {"PIONEER", "CD-ROM DRM-604X", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, + {"PIONEER", "CD-ROM DRM-600", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, + {"PIONEER", "CD-ROM DRM-602X", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, + {"PIONEER", "CD-ROM DRM-604X", "*", BLIST_FORCELUN | BLIST_SINGLELUN}, {"EMULEX", "MD21/S2 ESDI", "*", BLIST_SINGLELUN}, {"CANON", "IPUBJD", "*", BLIST_SPARSELUN}, {"nCipher", "Fastness Crypto", "*", BLIST_FORCELUN}, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c --- v2.4.0-test8/linux/drivers/scsi/sd.c Thu Sep 7 08:56:00 2000 +++ linux/drivers/scsi/sd.c Mon Sep 18 15:13:10 2000 @@ -96,10 +96,30 @@ static int sd_attach(Scsi_Device *); static int sd_detect(Scsi_Device *); static void sd_detach(Scsi_Device *); -static void rw_intr(Scsi_Cmnd * SCpnt); - static int sd_init_command(Scsi_Cmnd *); +static struct Scsi_Device_Template sd_template = { + name:"disk", + tag:"sd", + scsi_type:TYPE_DISK, + major:SCSI_DISK0_MAJOR, + /* + * Secondary range of majors that this driver handles. + */ + min_major:SCSI_DISK1_MAJOR, + max_major:SCSI_DISK7_MAJOR, + blk:1, + detect:sd_detect, + init:sd_init, + finish:sd_finish, + attach:sd_attach, + detach:sd_detach, + init_command:sd_init_command, +}; + + +static void rw_intr(Scsi_Cmnd * SCpnt); + #if defined(CONFIG_PPC) /* * Moved from arch/ppc/pmac_setup.c. This is where it really belongs. @@ -243,25 +263,6 @@ } } -struct Scsi_Device_Template sd_template = { - name:"disk", - tag:"sd", - scsi_type:TYPE_DISK, - major:SCSI_DISK0_MAJOR, - /* - * Secondary range of majors that this driver handles. - */ - min_major:SCSI_DISK1_MAJOR, - max_major:SCSI_DISK7_MAJOR, - blk:1, - detect:sd_detect, - init:sd_init, - finish:sd_finish, - attach:sd_attach, - detach:sd_detach, - init_command:sd_init_command, -}; - static request_queue_t *sd_find_queue(kdev_t dev) { Scsi_Disk *dpnt; @@ -1030,7 +1031,7 @@ sd_template.dev_max = N_SD_MAJORS * SCSI_DISKS_PER_MAJOR; if (!sd_registered) { - for (i = 0; i <= (sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) { + for (i = 0; i < N_USED_SD_MAJORS; i++) { if (devfs_register_blkdev(SD_MAJOR(i), "sd", &sd_fops)) { printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i)); return 1; @@ -1142,7 +1143,7 @@ struct gendisk *gendisk; int i; - for (i = 0; i <= (sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) { + for (i = 0; i < N_USED_SD_MAJORS; i++) { blk_dev[SD_MAJOR(i)].queue = sd_find_queue; } for (gendisk = gendisk_head; gendisk != NULL; gendisk = gendisk->next) @@ -1335,12 +1336,13 @@ return; } -int init_sd(void) +static int __init init_sd(void) { sd_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &sd_template); } -void exit_sd(void) + +static void __exit exit_sd(void) { struct gendisk **prev_sdgd_link; struct gendisk *sdgd; @@ -1349,7 +1351,7 @@ scsi_unregister_module(MODULE_SCSI_DEV, &sd_template); - for (i = 0; i <= (sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) + for (i = 0; i < N_USED_SD_MAJORS; i++) devfs_unregister_blkdev(SD_MAJOR(i), "sd"); sd_registered--; @@ -1378,7 +1380,7 @@ removed > N_USED_SD_MAJORS ? "total" : "just", removed); } - for (i = 0; i <= (sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) { + for (i = 0; i < N_USED_SD_MAJORS; i++) { blk_size[SD_MAJOR(i)] = NULL; hardsect_size[SD_MAJOR(i)] = NULL; read_ahead[SD_MAJOR(i)] = 0; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/seagate.c linux/drivers/scsi/seagate.c --- v2.4.0-test8/linux/drivers/scsi/seagate.c Fri Jul 7 15:55:24 2000 +++ linux/drivers/scsi/seagate.c Mon Sep 18 13:36:25 2000 @@ -5,7 +5,8 @@ * * Note : TMC-880 boards don't work because they have two bits in * the status register flipped, I'll fix this "RSN" - * [why do I have strong feeling that above message is from 1993? :-) pavel@ucw.cz] + * [why do I have strong feeling that above message is from 1993? :-) + * pavel@ucw.cz] * * This card does all the I/O via memory mapped I/O, so there is no need * to check or allocate a region of the I/O address space. @@ -18,6 +19,13 @@ * * 1998-jul-29 - created DPRINTK macros and made it work under * linux 2.1.112, simplified some #defines etc. + * + * Aug 2000 - aeb - deleted seagate_st0x_biosparam(). It would try to + * read the physical disk geometry, a bad mistake. Of course it doesnt + * matter much what geometry one invents, but on large disks it + * returned 256 (or more) heads, causing all kind of failures. + * Of course this means that people might see a different geometry now, + * so boot parameters may be necessary in some cases. */ /* @@ -1702,127 +1710,7 @@ } -int seagate_st0x_biosparam (Disk * disk, kdev_t dev, int *ip) -{ - unsigned char buf[256 + sizeof (Scsi_Ioctl_Command)], - cmd[6], *data, *page; - Scsi_Ioctl_Command *sic = (Scsi_Ioctl_Command *) buf; - int result, formatted_sectors, total_sectors; - int cylinders, heads, sectors; - int capacity; - -/* - * Only SCSI-I CCS drives and later implement the necessary mode sense - * pages. - */ - - if (disk->device->scsi_level < 2) - return -1; - - data = sic->data; - - cmd[0] = MODE_SENSE; - cmd[1] = (disk->device->lun << 5) & 0xe5; - cmd[2] = 0x04; /* Read page 4, rigid disk geometry - page current values */ - cmd[3] = 0; - cmd[4] = 255; - cmd[5] = 0; - -/* - * We are transferring 0 bytes in the out direction, and expect to get back - * 24 bytes for each mode page. - */ - sic->inlen = 0; - sic->outlen = 256; - - memcpy (data, cmd, 6); - - if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, - sic))) - { -/* - * The mode page lies beyond the MODE SENSE header, with length 4, and - * the BLOCK DESCRIPTOR, with length header[3]. - */ - page = data + 4 + data[3]; - heads = (int) page[5]; - cylinders = (page[2] << 16) | (page[3] << 8) | page[4]; - - cmd[2] = 0x03; /* Read page 3, format page current - values */ - memcpy (data, cmd, 6); - - if (!(result = kernel_scsi_ioctl (disk->device, SCSI_IOCTL_SEND_COMMAND, - sic))) - { - page = data + 4 + data[3]; - sectors = (page[10] << 8) | page[11]; -/* - * Get the total number of formatted sectors from the block descriptor, - * so we can tell how many are being used for alternates. - */ - formatted_sectors = (data[4 + 1] << 16) | (data[4 + 2] << 8) - | data[4 + 3]; - - total_sectors = (heads * cylinders * sectors); - -/* - * Adjust the real geometry by subtracting - * (spare sectors / (heads * tracks)) cylinders from the number of cylinders. - * - * It appears that the CE cylinder CAN be a partial cylinder. - */ - - printk ("scsi%d : heads = %d cylinders = %d sectors = %d total = %d formatted = %d\n", - hostno, heads, cylinders, sectors, total_sectors, - formatted_sectors); - - if (!heads || !sectors || !cylinders) - result = -1; - else - cylinders -= ((total_sectors - formatted_sectors) / (heads * sectors)); - -/* - * Now, we need to do a sanity check on the geometry to see if it is - * BIOS compatible. The maximum BIOS geometry is 1024 cylinders * - * 256 heads * 64 sectors. - */ - - if ((cylinders > 1024) || (sectors > 64)) - { - /* The Seagate's seem to have some mapping. Multiply - heads*sectors*cyl to get capacity. Then start rounding down. - */ - capacity = heads * sectors * cylinders; - - /* Old MFM Drives use this, so does the Seagate */ - sectors = 17; - heads = 2; - capacity = capacity / sectors; - while (cylinders > 1024) - { - heads *= 2; /* For some reason, they go in - multiples */ - cylinders = capacity / heads; - } - } - ip[0] = heads; - ip[1] = sectors; - ip[2] = cylinders; -/* - * There should be an alternate mapping for things the seagate doesn't - * understand, but I couldn't say what it is with reasonable certainty. - */ - } - } - - return result; -} - -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = SEAGATE_ST0X; +static Scsi_Host_Template driver_template = SEAGATE_ST0X; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/seagate.h linux/drivers/scsi/seagate.h --- v2.4.0-test8/linux/drivers/scsi/seagate.h Tue Jan 25 13:01:14 2000 +++ linux/drivers/scsi/seagate.h Sun Sep 17 09:51:57 2000 @@ -20,16 +20,12 @@ const char *seagate_st0x_info(struct Scsi_Host *); int seagate_st0x_reset(Scsi_Cmnd *, unsigned int); -#include -int seagate_st0x_biosparam(Disk *, kdev_t, int*); - #define SEAGATE_ST0X { detect: seagate_st0x_detect, \ info: seagate_st0x_info, \ command: seagate_st0x_command, \ queuecommand: seagate_st0x_queue_command, \ abort: seagate_st0x_abort, \ reset: seagate_st0x_reset, \ - bios_param: seagate_st0x_biosparam, \ can_queue: 1, \ this_id: 7, \ sg_tablesize: SG_ALL, \ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sg.c linux/drivers/scsi/sg.c --- v2.4.0-test8/linux/drivers/scsi/sg.c Sun Aug 6 11:43:17 2000 +++ linux/drivers/scsi/sg.c Mon Sep 18 15:06:01 2000 @@ -112,12 +112,12 @@ static int sg_detect(Scsi_Device *); static void sg_detach(Scsi_Device *); -static Scsi_Cmnd * dummy_cmdp = 0; /* only used for sizeof */ +static Scsi_Request * dummy_cmdp = 0; /* only used for sizeof */ static rwlock_t sg_dev_arr_lock = RW_LOCK_UNLOCKED; /* Also used to lock file descriptor list for device */ -struct Scsi_Device_Template sg_template = +static struct Scsi_Device_Template sg_template = { tag:"sg", scsi_type:0xff, @@ -148,12 +148,12 @@ typedef struct sg_request /* SG_MAX_QUEUE requests outstanding per file */ { - Scsi_Cmnd * my_cmdp; /* != 0 when request with lower levels */ + Scsi_Request * my_cmdp; /* != 0 when request with lower levels */ struct sg_request * nextrp; /* NULL -> tail request (slist) */ struct sg_fd * parentfp; /* NULL -> not in use */ Sg_scatter_hold data; /* hold buffer, perhaps scatter list */ sg_io_hdr_t header; /* scsi command+info, see */ - unsigned char sense_b[sizeof(dummy_cmdp->sense_buffer)]; + unsigned char sense_b[sizeof(dummy_cmdp->sr_sense_buffer)]; char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ char orphan; /* 1 -> drop on sight, 0 -> normal */ char sg_io_owned; /* 1 -> packet belongs to SG_IO */ @@ -230,8 +230,8 @@ static int sg_remove_request(Sg_fd * sfp, Sg_request * srp); static int sg_res_in_use(Sg_fd * sfp); static int sg_dio_in_use(Sg_fd * sfp); -static void sg_clr_scpnt(Scsi_Cmnd * SCpnt); -static void sg_shorten_timeout(Scsi_Cmnd * scpnt); +static void sg_clr_srpnt(Scsi_Request * SRpnt); +static void sg_shorten_timeout(Scsi_Request * srpnt); static int sg_ms_to_jif(unsigned int msecs); static unsigned sg_jif_to_ms(int jifs); static int sg_allow_access(unsigned char opcode, char dev_type); @@ -460,7 +460,7 @@ if ((hp->mx_sb_len > 0) && hp->sbp) { if ((CHECK_CONDITION & hp->masked_status) || (DRIVER_SENSE & hp->driver_status)) { - int sb_len = sizeof(dummy_cmdp->sense_buffer); + int sb_len = sizeof(dummy_cmdp->sr_sense_buffer); sb_len = (hp->mx_sb_len > sb_len) ? sb_len : hp->mx_sb_len; len = 8 + (int)srp->sense_b[7]; /* Additional sense length field */ len = (len > sb_len) ? sb_len : len; @@ -492,7 +492,7 @@ Sg_request * srp; struct sg_header old_hdr; sg_io_hdr_t * hp; - unsigned char cmnd[sizeof(dummy_cmdp->cmnd)]; + unsigned char cmnd[sizeof(dummy_cmdp->sr_cmnd)]; if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp))) return -ENXIO; @@ -581,7 +581,7 @@ int k; Sg_request * srp; sg_io_hdr_t * hp; - unsigned char cmnd[sizeof(dummy_cmdp->cmnd)]; + unsigned char cmnd[sizeof(dummy_cmdp->sr_cmnd)]; int timeout; if (count < size_sg_io_hdr) @@ -625,7 +625,7 @@ unsigned char * cmnd, int timeout, int blocking) { int k; - Scsi_Cmnd * SCpnt; + Scsi_Request * SRpnt; Sg_device * sdp = sfp->parentdp; sg_io_hdr_t * hp = &srp->header; @@ -652,38 +652,34 @@ return k; } /* SCSI_LOG_TIMEOUT(7, printk("sg_write: allocating device\n")); */ - SCpnt = scsi_allocate_device(sdp->device, blocking, TRUE); - if (! SCpnt) { - sg_finish_rem_req(srp); - return (signal_pending(current)) ? -EINTR : -EAGAIN; - /* No available command blocks, or, interrupted while waiting */ - } + SRpnt = scsi_allocate_request(sdp->device); + /* SCSI_LOG_TIMEOUT(7, printk("sg_write: device allocated\n")); */ - srp->my_cmdp = SCpnt; - SCpnt->request.rq_dev = sdp->i_rdev; - SCpnt->request.rq_status = RQ_ACTIVE; - SCpnt->sense_buffer[0] = 0; - SCpnt->cmd_len = hp->cmd_len; + srp->my_cmdp = SRpnt; + SRpnt->sr_request.rq_dev = sdp->i_rdev; + SRpnt->sr_request.rq_status = RQ_ACTIVE; + SRpnt->sr_sense_buffer[0] = 0; + SRpnt->sr_cmd_len = hp->cmd_len; /* Set the LUN field in the command structure, overriding user input */ if (! (hp->flags & SG_FLAG_LUN_INHIBIT)) cmnd[1] = (cmnd[1] & 0x1f) | (sdp->device->lun << 5); /* SCSI_LOG_TIMEOUT(7, printk("sg_write: do cmd\n")); */ - SCpnt->use_sg = srp->data.k_use_sg; - SCpnt->sglist_len = srp->data.sglist_len; - SCpnt->bufflen = srp->data.bufflen; - SCpnt->underflow = 0; - SCpnt->buffer = srp->data.buffer; + SRpnt->sr_use_sg = srp->data.k_use_sg; + SRpnt->sr_sglist_len = srp->data.sglist_len; + SRpnt->sr_bufflen = srp->data.bufflen; + SRpnt->sr_underflow = 0; + SRpnt->sr_buffer = srp->data.buffer; switch (hp->dxfer_direction) { case SG_DXFER_TO_FROM_DEV: case SG_DXFER_FROM_DEV: - SCpnt->sc_data_direction = SCSI_DATA_READ; break; + SRpnt->sr_data_direction = SCSI_DATA_READ; break; case SG_DXFER_TO_DEV: - SCpnt->sc_data_direction = SCSI_DATA_WRITE; break; + SRpnt->sr_data_direction = SCSI_DATA_WRITE; break; case SG_DXFER_UNKNOWN: - SCpnt->sc_data_direction = SCSI_DATA_UNKNOWN; break; + SRpnt->sr_data_direction = SCSI_DATA_UNKNOWN; break; default: - SCpnt->sc_data_direction = SCSI_DATA_NONE; break; + SRpnt->sr_data_direction = SCSI_DATA_NONE; break; } srp->data.k_use_sg = 0; srp->data.sglist_len = 0; @@ -692,10 +688,10 @@ hp->duration = jiffies; /* unit jiffies now, millisecs after done */ /* Now send everything of to mid-level. The next time we hear about this packet is when sg_cmd_done_bh() is called (i.e. a callback). */ - scsi_do_cmd(SCpnt, (void *)cmnd, - (void *)SCpnt->buffer, hp->dxfer_len, + scsi_do_req(SRpnt, (void *)cmnd, + (void *)SRpnt->sr_buffer, hp->dxfer_len, sg_cmd_done_bh, timeout, SG_DEFAULT_RETRIES); - /* dxfer_len overwrites SCpnt->bufflen, hence need for b_malloc_len */ + /* dxfer_len overwrites SRpnt->sr_bufflen, hence need for b_malloc_len */ return 0; } @@ -989,7 +985,8 @@ * mid level when a command is completed (or has failed). */ static void sg_cmd_done_bh(Scsi_Cmnd * SCpnt) { - int dev = MINOR(SCpnt->request.rq_dev); + Scsi_Request * SRpnt = SCpnt->sc_request; + int dev = MINOR(SRpnt->sr_request.rq_dev); Sg_device * sdp = NULL; Sg_fd * sfp; Sg_request * srp = NULL; @@ -1002,15 +999,15 @@ if (NULL == sdp) { read_unlock(&sg_dev_arr_lock); SCSI_LOG_TIMEOUT(1, printk("sg...bh: bad args dev=%d\n", dev)); - scsi_release_command(SCpnt); - SCpnt = NULL; + scsi_release_request(SRpnt); + SRpnt = NULL; return; } sfp = sdp->headfp; while (sfp) { read_lock(&sfp->rq_list_lock); for (srp = sfp->headrp; srp; srp = srp->nextrp) { - if (SCpnt == srp->my_cmdp) + if (SRpnt == srp->my_cmdp) break; } read_unlock(&sfp->rq_list_lock); @@ -1021,41 +1018,41 @@ read_unlock(&sg_dev_arr_lock); if (! srp) { SCSI_LOG_TIMEOUT(1, printk("sg...bh: req missing, dev=%d\n", dev)); - scsi_release_command(SCpnt); - SCpnt = NULL; + scsi_release_request(SRpnt); + SRpnt = NULL; return; } /* First transfer ownership of data buffers to sg_device object. */ - srp->data.k_use_sg = SCpnt->use_sg; - srp->data.sglist_len = SCpnt->sglist_len; - srp->data.bufflen = SCpnt->bufflen; - srp->data.buffer = SCpnt->buffer; - sg_clr_scpnt(SCpnt); + srp->data.k_use_sg = SRpnt->sr_use_sg; + srp->data.sglist_len = SRpnt->sr_sglist_len; + srp->data.bufflen = SRpnt->sr_bufflen; + srp->data.buffer = SRpnt->sr_buffer; + sg_clr_srpnt(SRpnt); srp->my_cmdp = NULL; srp->done = 1; SCSI_LOG_TIMEOUT(4, printk("sg...bh: dev=%d, pack_id=%d, res=0x%x\n", - dev, srp->header.pack_id, (int)SCpnt->result)); + dev, srp->header.pack_id, (int)SRpnt->sr_result)); srp->header.resid = SCpnt->resid; /* sg_unmap_and(&srp->data, 0); */ /* unmap locked pages a.s.a.p. */ /* N.B. unit of duration changes here from jiffies to millisecs */ srp->header.duration = sg_jif_to_ms(jiffies - (int)srp->header.duration); - if (0 != SCpnt->result) { - memcpy(srp->sense_b, SCpnt->sense_buffer, sizeof(srp->sense_b)); - srp->header.status = 0xff & SCpnt->result; - srp->header.masked_status = status_byte(SCpnt->result); - srp->header.msg_status = msg_byte(SCpnt->result); - srp->header.host_status = host_byte(SCpnt->result); - srp->header.driver_status = driver_byte(SCpnt->result); + if (0 != SRpnt->sr_result) { + memcpy(srp->sense_b, SRpnt->sr_sense_buffer, sizeof(srp->sense_b)); + srp->header.status = 0xff & SRpnt->sr_result; + srp->header.masked_status = status_byte(SRpnt->sr_result); + srp->header.msg_status = msg_byte(SRpnt->sr_result); + srp->header.host_status = host_byte(SRpnt->sr_result); + srp->header.driver_status = driver_byte(SRpnt->sr_result); if ((sdp->sgdebug > 0) && ((CHECK_CONDITION == srp->header.masked_status) || (COMMAND_TERMINATED == srp->header.masked_status))) - print_sense("sg_cmd_done_bh", SCpnt); + print_req_sense("sg_cmd_done_bh", SRpnt); /* Following if statement is a patch supplied by Eric Youngdale */ - if (driver_byte(SCpnt->result) != 0 - && (SCpnt->sense_buffer[0] & 0x7f) == 0x70 - && (SCpnt->sense_buffer[2] & 0xf) == UNIT_ATTENTION + if (driver_byte(SRpnt->sr_result) != 0 + && (SRpnt->sr_sense_buffer[0] & 0x7f) == 0x70 + && (SRpnt->sr_sense_buffer[2] & 0xf) == UNIT_ATTENTION && sdp->device->removable) { /* Detected disc change. Set the bit - this may be used if */ /* there are filesystems using this device. */ @@ -1064,8 +1061,8 @@ } /* Rely on write phase to clean out srp status values, so no "else" */ - scsi_release_command(SCpnt); - SCpnt = NULL; + scsi_release_request(SRpnt); + SRpnt = NULL; if (sfp->closed) { /* whoops this fd already released, cleanup */ SCSI_LOG_TIMEOUT(1, printk("sg...bh: already closed, freeing ...\n")); @@ -1308,7 +1305,7 @@ int init_module(void) { if (def_reserved_size >= 0) sg_big_buff = def_reserved_size; - sg_template.module = &__this_module; + sg_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &sg_template); } @@ -1336,7 +1333,7 @@ #endif /* Can't see clean way to abort a command so shorten timeout to 1 jiffy */ -static void sg_shorten_timeout(Scsi_Cmnd * scpnt) +static void sg_shorten_timeout(Scsi_Request * srpnt) { #if 0 /* scsi_syms.c is very miserly about exported functions */ scsi_delete_timer(scpnt); @@ -2366,14 +2363,14 @@ sg_low_free(buff, size, mem_src); } -static void sg_clr_scpnt(Scsi_Cmnd * SCpnt) +static void sg_clr_srpnt(Scsi_Request * SRpnt) { - SCpnt->use_sg = 0; - SCpnt->sglist_len = 0; - SCpnt->bufflen = 0; - SCpnt->buffer = NULL; - SCpnt->underflow = 0; - SCpnt->request.rq_dev = MKDEV(0, 0); /* "sg" _disowns_ command blk */ + SRpnt->sr_use_sg = 0; + SRpnt->sr_sglist_len = 0; + SRpnt->sr_bufflen = 0; + SRpnt->sr_buffer = NULL; + SRpnt->sr_underflow = 0; + SRpnt->sr_request.rq_dev = MKDEV(0, 0); /* "sg" _disowns_ command blk */ } static int sg_ms_to_jif(unsigned int msecs) @@ -2642,8 +2639,8 @@ /* stop indenting so far ... */ PRINT_PROC(srp->res_used ? " rb>> " : ((SG_INFO_DIRECT_IO_MASK & hp->info) ? " dio>> " : " ")); - blen = srp->my_cmdp ? srp->my_cmdp->bufflen : srp->data.bufflen; - usg = srp->my_cmdp ? srp->my_cmdp->use_sg : srp->data.k_use_sg; + blen = srp->my_cmdp ? srp->my_cmdp->sr_bufflen : srp->data.bufflen; + usg = srp->my_cmdp ? srp->my_cmdp->sr_use_sg : srp->data.k_use_sg; PRINT_PROC(srp->done ? ((1 == srp->done) ? "rcv:" : "fin:") : (srp->my_cmdp ? "act:" : "prior:")); PRINT_PROC(" id=%d blen=%d", srp->header.pack_id, blen); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sgiwd93.c linux/drivers/scsi/sgiwd93.c --- v2.4.0-test8/linux/drivers/scsi/sgiwd93.c Tue Jul 11 11:17:45 2000 +++ linux/drivers/scsi/sgiwd93.c Mon Sep 18 13:36:25 2000 @@ -317,17 +317,13 @@ return 1; /* Found one. */ } -#ifdef MODULE - #define HOSTS_C #include "sgiwd93.h" -Scsi_Host_Template driver_template = SGIWD93_SCSI; +static Scsi_Host_Template driver_template = SGIWD93_SCSI; #include "scsi_module.c" - -#endif int sgiwd93_release(struct Scsi_Host *instance) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sim710.c linux/drivers/scsi/sim710.c --- v2.4.0-test8/linux/drivers/scsi/sim710.c Fri Nov 19 11:30:54 1999 +++ linux/drivers/scsi/sim710.c Mon Sep 18 13:36:25 2000 @@ -1603,7 +1603,8 @@ return 1; } -Scsi_Host_Template driver_template = SIM710_SCSI; +#endif + +static Scsi_Host_Template driver_template = SIM710_SCSI; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sim710.h linux/drivers/scsi/sim710.h --- v2.4.0-test8/linux/drivers/scsi/sim710.h Fri Sep 8 12:54:34 2000 +++ linux/drivers/scsi/sim710.h Mon Sep 18 14:10:10 2000 @@ -21,7 +21,6 @@ #define sim710_release NULL #endif -#if defined(HOSTS_C) || defined(MODULE) #include #define SIM710_SCSI { proc_name: "sim710", \ @@ -40,8 +39,6 @@ cmd_per_lun: 1, \ use_clustering: DISABLE_CLUSTERING, \ use_new_eh_code: 1} - -#endif #ifndef HOSTS_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v2.4.0-test8/linux/drivers/scsi/sr.c Thu Sep 7 08:32:01 2000 +++ linux/drivers/scsi/sr.c Sun Sep 17 17:57:47 2000 @@ -71,7 +71,7 @@ static int sr_init_command(Scsi_Cmnd *); -struct Scsi_Device_Template sr_template = +static struct Scsi_Device_Template sr_template = { name:"cdrom", tag:"sr", @@ -849,13 +849,13 @@ return; } -int init_sr(void) +static int __init init_sr(void) { sr_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &sr_template); } -void exit_sr(void) +static void __exit exit_sr(void) { scsi_unregister_module(MODULE_SCSI_DEV, &sr_template); devfs_unregister_blkdev(MAJOR_NR, "sr"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/st.c linux/drivers/scsi/st.c --- v2.4.0-test8/linux/drivers/scsi/st.c Wed Sep 6 12:53:14 2000 +++ linux/drivers/scsi/st.c Mon Sep 18 15:05:42 2000 @@ -155,7 +155,7 @@ static int st_detect(Scsi_Device *); static void st_detach(Scsi_Device *); -struct Scsi_Device_Template st_template = +static struct Scsi_Device_Template st_template = { name:"tape", tag:"st", @@ -3700,17 +3700,15 @@ } -#ifdef MODULE - -int __init init_module(void) +static int __init init_st(void) { validate_options(); - st_template.module = &__this_module; + st_template.module = THIS_MODULE; return scsi_register_module(MODULE_SCSI_DEV, &st_template); } -void cleanup_module(void) +static void __exit exit_st(void) { int i; @@ -3736,4 +3734,6 @@ st_template.dev_max = 0; printk(KERN_INFO "st: Unloaded.\n"); } -#endif /* MODULE */ + +module_init(init_st); +module_exit(exit_st); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sun3_scsi.c linux/drivers/scsi/sun3_scsi.c --- v2.4.0-test8/linux/drivers/scsi/sun3_scsi.c Sat Feb 26 20:33:03 2000 +++ linux/drivers/scsi/sun3_scsi.c Mon Sep 18 13:36:25 2000 @@ -529,10 +529,7 @@ #include "sun3_NCR5380.c" -#ifdef MODULE - -Scsi_Host_Template driver_template = SUN3_NCR5380; +static Scsi_Host_Template driver_template = SUN3_NCR5380; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sym53c416.c linux/drivers/scsi/sym53c416.c --- v2.4.0-test8/linux/drivers/scsi/sym53c416.c Thu Nov 11 16:57:30 1999 +++ linux/drivers/scsi/sym53c416.c Mon Sep 18 13:36:25 2000 @@ -813,7 +813,8 @@ MODULE_PARM(sym53c416_2, "1-2i"); MODULE_PARM(sym53c416_3, "1-2i"); -Scsi_Host_Template driver_template = SYM53C416; +#endif + +static Scsi_Host_Template driver_template = SYM53C416; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sym53c8xx.c linux/drivers/scsi/sym53c8xx.c --- v2.4.0-test8/linux/drivers/scsi/sym53c8xx.c Mon Jun 19 17:59:42 2000 +++ linux/drivers/scsi/sym53c8xx.c Mon Sep 18 13:36:25 2000 @@ -698,6 +698,9 @@ #elif defined(__alpha__) # define pcivtobus(p) ((p) & 0xfffffffful) # define memcpy_to_pci(a, b, c) memcpy_toio((a), (b), (c)) +#elif defined(CONFIG_PPC) +# define pcivtobus(p) phys_to_bus(p) +# define memcpy_to_pci(a, b, c) memcpy_toio((a), (b), (c)) #else /* others */ # define pcivtobus(p) (p) # define memcpy_to_pci(a, b, c) memcpy_toio((a), (b), (c)) @@ -15059,7 +15062,5 @@ ** Module stuff */ -#ifdef MODULE -Scsi_Host_Template driver_template = SYM53C8XX; +static Scsi_Host_Template driver_template = SYM53C8XX; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sym53c8xx.h linux/drivers/scsi/sym53c8xx.h --- v2.4.0-test8/linux/drivers/scsi/sym53c8xx.h Fri Sep 8 12:54:35 2000 +++ linux/drivers/scsi/sym53c8xx.h Mon Sep 18 15:40:47 2000 @@ -65,8 +65,6 @@ ** Used by hosts.c and sym53c8xx.c with module configuration. */ -#if defined(HOSTS_C) || defined(MODULE) - #include int sym53c8xx_abort(Scsi_Cmnd *); @@ -110,7 +108,5 @@ 0, 0, DISABLE_CLUSTERING} #endif /* LINUX_VERSION_CODE */ - -#endif /* defined(HOSTS_C) || defined(MODULE) */ #endif /* SYM53C8XX_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/sym53c8xx_comm.h linux/drivers/scsi/sym53c8xx_comm.h --- v2.4.0-test8/linux/drivers/scsi/sym53c8xx_comm.h Mon Jun 19 17:59:42 2000 +++ linux/drivers/scsi/sym53c8xx_comm.h Mon Sep 18 15:05:20 2000 @@ -498,7 +498,8 @@ # define memcpy_to_pci(a, b, c) memcpy_toio((a), (b), (c)) #endif -#ifndef SCSI_NCR_PCI_MEM_NOT_SUPPORTED +#if (defined(SCSI_NCR_NVRAM_SUPPORT) && !defined(NCR_IOMAPPED)) || \ + (defined(__i386__) && !defined(SCSI_NCR_PCI_MEM_NOT_SUPPORTED)) static u_long __init remap_pci_mem(u_long base, u_long size) { u_long page_base = ((u_long) base) & PAGE_MASK; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/t128.c linux/drivers/scsi/t128.c --- v2.4.0-test8/linux/drivers/scsi/t128.c Fri Nov 19 11:30:54 1999 +++ linux/drivers/scsi/t128.c Mon Sep 18 13:36:25 2000 @@ -393,9 +393,7 @@ #include "NCR5380.c" -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = TRANTOR_T128; +static Scsi_Host_Template driver_template = TRANTOR_T128; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/t128.h linux/drivers/scsi/t128.h --- v2.4.0-test8/linux/drivers/scsi/t128.h Fri Nov 19 11:30:54 1999 +++ linux/drivers/scsi/t128.h Mon Sep 18 14:10:10 2000 @@ -117,8 +117,6 @@ * macros when this is being used solely for the host stub. */ -#if defined(HOSTS_C) || defined(MODULE) - #define TRANTOR_T128 { \ name: "Trantor T128/T128F/T228", \ detect: t128_detect, \ @@ -131,8 +129,6 @@ sg_tablesize: SG_ALL, \ cmd_per_lun: CMD_PER_LUN, \ use_clustering: DISABLE_CLUSTERING} - -#endif #ifndef HOSTS_C diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/tmscsim.c linux/drivers/scsi/tmscsim.c --- v2.4.0-test8/linux/drivers/scsi/tmscsim.c Thu Jul 6 19:27:48 2000 +++ linux/drivers/scsi/tmscsim.c Mon Sep 18 14:26:56 2000 @@ -2588,6 +2588,7 @@ return( 1 ); } -Scsi_Host_Template driver_template = DC390_T; +#endif + +static Scsi_Host_Template driver_template = DC390_T; #include "scsi_module.c" -#endif /* def MODULE */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/u14-34f.c linux/drivers/scsi/u14-34f.c --- v2.4.0-test8/linux/drivers/scsi/u14-34f.c Tue Mar 21 14:43:39 2000 +++ linux/drivers/scsi/u14-34f.c Mon Sep 18 13:36:25 2000 @@ -1964,12 +1964,11 @@ return FALSE; } -#if defined(MODULE) -Scsi_Host_Template driver_template = ULTRASTOR_14_34F; +static Scsi_Host_Template driver_template = ULTRASTOR_14_34F; #include "scsi_module.c" -#else +#ifndef MODULE #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,18) void u14_34f_setup(char *str, int *ints) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/ultrastor.c linux/drivers/scsi/ultrastor.c --- v2.4.0-test8/linux/drivers/scsi/ultrastor.c Thu Nov 11 16:57:31 1999 +++ linux/drivers/scsi/ultrastor.c Mon Sep 18 13:36:25 2000 @@ -1161,9 +1161,7 @@ spin_unlock_irqrestore(&io_request_lock, flags); } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = ULTRASTOR_14F; +static Scsi_Host_Template driver_template = ULTRASTOR_14F; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/scsi/wd7000.c linux/drivers/scsi/wd7000.c --- v2.4.0-test8/linux/drivers/scsi/wd7000.c Thu Dec 16 13:57:05 1999 +++ linux/drivers/scsi/wd7000.c Mon Sep 18 13:36:25 2000 @@ -1778,9 +1778,7 @@ return (0); } -#ifdef MODULE /* Eventually this will go into an include file, but this will be later */ -Scsi_Host_Template driver_template = WD7000; +static Scsi_Host_Template driver_template = WD7000; #include "scsi_module.c" -#endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/ac97_codec.c linux/drivers/sound/ac97_codec.c --- v2.4.0-test8/linux/drivers/sound/ac97_codec.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/ac97_codec.c Sun Sep 17 09:41:29 2000 @@ -48,6 +48,7 @@ static int ac97_init_mixer(struct ac97_codec *codec); static int sigmatel_init(struct ac97_codec *codec); +static int enable_eapd(struct ac97_codec *codec); #define arraysize(x) (sizeof(x)/sizeof((x)[0])) @@ -58,11 +59,14 @@ } ac97_codec_ids[] = { {0x414B4D00, "Asahi Kasei AK4540" , NULL}, {0x41445340, "Analog Devices AD1881" , NULL}, + {0x41445360, "Analog Devices AD1885" , enable_eapd}, {0x43525900, "Cirrus Logic CS4297" , NULL}, {0x43525903, "Cirrus Logic CS4297" , NULL}, {0x43525913, "Cirrus Logic CS4297A" , NULL}, {0x43525923, "Cirrus Logic CS4298" , NULL}, + {0x4352592B, "Cirrus Logic CS4294" , NULL}, {0x43525931, "Cirrus Logic CS4299" , NULL}, + {0x43525934, "Cirrus Logic CS4299" , NULL}, {0x4e534331, "National Semiconductor LM4549" , NULL}, {0x53494c22, "Silicon Laboratory Si3036" , NULL}, {0x53494c23, "Silicon Laboratory Si3038" , NULL}, @@ -562,8 +566,10 @@ /* also according to spec, we wait for codec-ready state */ if (codec->codec_wait) codec->codec_wait(codec); - else + else { + current->state = TASK_UNINTERRUPTIBLE; schedule_timeout(5); + } if ((audio = codec->codec_read(codec, AC97_RESET)) & 0x8000) { printk(KERN_ERR "ac97_codec: %s ac97 codec not present\n", @@ -582,6 +588,7 @@ id2 = codec->codec_read(codec, AC97_VENDOR_ID2); for (i = 0; i < arraysize(ac97_codec_ids); i++) { if (ac97_codec_ids[i].id == ((id1 << 16) | id2)) { + codec->id = ac97_codec_ids[i].id; codec->name = ac97_codec_ids[i].name; codec->codec_init = ac97_codec_ids[i].init; break; @@ -659,6 +666,18 @@ return 1; } + +/* + * Bring up an AD1885 + */ + +static int enable_eapd(struct ac97_codec * codec) +{ + codec->codec_write(codec, AC97_POWER_CONTROL, + codec->codec_read(codec, AC97_POWER_CONTROL)|0x8000); + return 0; +} + EXPORT_SYMBOL(ac97_read_proc); EXPORT_SYMBOL(ac97_probe_codec); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/adlib_card.c linux/drivers/sound/adlib_card.c --- v2.4.0-test8/linux/drivers/sound/adlib_card.c Fri Aug 11 08:26:43 2000 +++ linux/drivers/sound/adlib_card.c Sun Sep 17 09:45:06 2000 @@ -20,15 +20,10 @@ static void __init attach_adlib_card(struct address_info *hw_config) { hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE); - request_region(hw_config->io_base, 4, "OPL3/OPL2"); } static int __init probe_adlib(struct address_info *hw_config) { - if (check_region(hw_config->io_base, 4)) { - DDB(printk("opl3.c: I/O port %x already in use\n", hw_config->io_base)); - return 0; - } return opl3_detect(hw_config->io_base, hw_config->osp); } @@ -55,7 +50,6 @@ static void __exit cleanup_adlib(void) { - release_region(cfg.io_base, 4); sound_unload_synthdev(cfg.slots[0]); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/cs46xx.c linux/drivers/sound/cs46xx.c --- v2.4.0-test8/linux/drivers/sound/cs46xx.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/cs46xx.c Sun Sep 17 09:45:05 2000 @@ -100,12 +100,6 @@ /* maxinum number of AC97 codecs connected, AC97 2.0 defined 4 */ #define NR_AC97 2 -/* minor number of /dev/dspW */ -#define SND_DEV_DSP8 1 - -/* minor number of /dev/dspW */ -#define SND_DEV_DSP16 1 - static const unsigned sample_size[] = { 1, 2, 2, 4 }; static const unsigned sample_shift[] = { 0, 1, 1, 2 }; @@ -2485,7 +2479,7 @@ void (*active)(struct cs_card *, int); }; -static struct cs_card_type __init cards[]={ +static struct cs_card_type __initdata cards[]={ {0x1489, 0x7001, "Genius Soundmaker 128 value", amp_none, NULL}, {0x5053, 0x3357, "Voyetra", amp_voyetra, NULL}, /* MI6020/21 use the same chipset as the Thinkpads, maybe needed */ @@ -2494,7 +2488,7 @@ {PCI_VENDOR_ID_IBM, 0x0132, "Thinkpad 570", amp_none, clkrun_hack}, {PCI_VENDOR_ID_IBM, 0x0153, "Thinkpad 600X/A20/T20", amp_none, clkrun_hack}, {PCI_VENDOR_ID_IBM, 0x1010, "Thinkpad 600E (unsupported)", NULL, NULL}, - {0, 0, NULL, NULL} + {0, 0, NULL, NULL, NULL} }; static int __init cs_install(struct pci_dev *pci_dev) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/dmasound/awacs_defs.h linux/drivers/sound/dmasound/awacs_defs.h --- v2.4.0-test8/linux/drivers/sound/dmasound/awacs_defs.h Mon Jul 12 16:21:25 1999 +++ linux/drivers/sound/dmasound/awacs_defs.h Sun Sep 17 09:48:05 2000 @@ -62,6 +62,11 @@ #define MASK_ADDR_VOLC MASK_ADDR4 /* Volume Control C -- Speaker */ #define MASK_ADDR_VOLSPK MASK_ADDR4 +/* additional registers of screamer */ +#define MASK_ADDR5 (0x5 << 12) /* Expanded Data Mode Address 5 */ +#define MASK_ADDR6 (0x6 << 12) /* Expanded Data Mode Address 6 */ +#define MASK_ADDR7 (0x7 << 12) /* Expanded Data Mode Address 7 */ + /* Address 0 Bit Masks & Macros */ /* ------- - --- ----- - ------ */ #define MASK_GAINRIGHT (0xf) /* Gain Right Mask */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/dmasound/dmasound_awacs.c linux/drivers/sound/dmasound/dmasound_awacs.c --- v2.4.0-test8/linux/drivers/sound/dmasound/dmasound_awacs.c Tue Jun 20 07:52:36 2000 +++ linux/drivers/sound/dmasound/dmasound_awacs.c Sun Sep 17 09:48:05 2000 @@ -17,8 +17,12 @@ #include #include #include +#ifdef CONFIG_ADB_CUDA #include +#endif +#ifdef CONFIG_ADB_PMU #include +#endif #include #include @@ -45,6 +49,9 @@ static char awacs_name[64]; static int awacs_revision; +int awacs_is_screamer = 0; +int awacs_device_id = 0; +int awacs_has_iic = 0; #define AWACS_BURGUNDY 100 /* fake revision # for burgundy */ /* @@ -60,7 +67,7 @@ * Cached values of AWACS registers (we can't read them). * Except on the burgundy. XXX */ -int awacs_reg[5]; +int awacs_reg[8]; #define HAS_16BIT_TABLES #undef HAS_8BIT_TABLES @@ -1303,6 +1310,11 @@ awacs_write(awacs_reg[1] | MASK_ADDR1); awacs_write(awacs_reg[2] | MASK_ADDR2); awacs_write(awacs_reg[4] | MASK_ADDR4); + if (awacs_is_screamer) { + awacs_write(awacs_reg[5] + MASK_ADDR5); + awacs_write(awacs_reg[6] + MASK_ADDR6); + awacs_write(awacs_reg[7] + MASK_ADDR7); + } out_le32(&awacs->byteswap, dmasound.hard.format != AFMT_S16_BE); enable_irq(awacs_irq); enable_irq(awacs_tx_irq); @@ -1551,6 +1563,7 @@ if (sys_ctrler != SYS_CTRLER_CUDA) return; +#ifdef CONFIG_ADB_CUDA /* turn on headphones */ cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a, 4, 0); @@ -1570,6 +1583,7 @@ cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x8a, 1, 0x29); while (!req.complete) cuda_poll(); +#endif /* CONFIG_ADB_CUDA */ } @@ -1974,6 +1988,13 @@ awacs_subframe = *prop; if (device_is_compatible(sound, "burgundy")) awacs_revision = AWACS_BURGUNDY; + /* This should be verified on older screamers */ + if (device_is_compatible(sound, "screamer")) + awacs_is_screamer = 1; + prop = (unsigned int *)get_property(sound, "device-id", 0); + if (prop != 0) + awacs_device_id = *prop; + awacs_has_iic = (find_devices("perch") != NULL); /* look for a property saying what sample rates are available */ @@ -2029,10 +2050,12 @@ #ifdef CONFIG_PMAC_PBOOK if (machine_is_compatible("PowerBook1,1") || machine_is_compatible("AAPL,PowerBook1998")) { + pmu_suspend(); feature_set(np, FEATURE_Sound_CLK_enable); feature_set(np, FEATURE_Sound_power); /* Shorter delay will not work */ mdelay(1000); + pmu_resume(); } #endif awacs_tx_cmds = (volatile struct dbdma_cmd *) @@ -2050,16 +2073,28 @@ awacs_reg[0] = MASK_MUX_CD; - awacs_reg[1] = MASK_LOOPTHRU | MASK_PAROUT; + /* FIXME: Only machines with external SRS module need MASK_PAROUT */ + awacs_reg[1] = MASK_LOOPTHRU; + if (awacs_has_iic || awacs_device_id == 0x5 || /*awacs_device_id == 0x8 + || */awacs_device_id == 0xb) + awacs_reg[1] |= MASK_PAROUT; /* get default volume from nvram */ vol = (~nvram_read_byte(0x1308) & 7) << 1; awacs_reg[2] = vol + (vol << 6); awacs_reg[4] = vol + (vol << 6); + awacs_reg[5] = 0; + awacs_reg[6] = 0; + awacs_reg[7] = 0; out_le32(&awacs->control, 0x11); awacs_write(awacs_reg[0] + MASK_ADDR0); awacs_write(awacs_reg[1] + MASK_ADDR1); awacs_write(awacs_reg[2] + MASK_ADDR2); awacs_write(awacs_reg[4] + MASK_ADDR4); + if (awacs_is_screamer) { + awacs_write(awacs_reg[5] + MASK_ADDR5); + awacs_write(awacs_reg[6] + MASK_ADDR6); + awacs_write(awacs_reg[7] + MASK_ADDR7); + } /* Initialize recent versions of the awacs */ if (awacs_revision == 0) { @@ -2118,7 +2153,15 @@ break; } } - /* enable CD sound input */ + /* + * Enable CD sound input. + * The relevant bits for writing to this byte are 0x8f. + * I haven't found out what the 0x80 bit does. + * For the 0xf bits, writing 3 or 7 enables the CD + * input, any other value disables it. Values + * 1, 3, 5, 7 enable the microphone. Values 0, 2, + * 4, 6, 8 - f enable the input from the modem. + */ if (macio_base) out_8(macio_base + 0x37, 3); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/emu10k1/emu_wrapper.h linux/drivers/sound/emu10k1/emu_wrapper.h --- v2.4.0-test8/linux/drivers/sound/emu10k1/emu_wrapper.h Mon Aug 14 08:32:48 2000 +++ linux/drivers/sound/emu10k1/emu_wrapper.h Sun Sep 17 09:45:06 2000 @@ -5,9 +5,4 @@ #define PCI_SET_DMA_MASK(pdev,mask) (((pdev)->dma_mask) = (mask)) -#ifndef PCI_GET_DRIVER_DATA - #define PCI_GET_DRIVER_DATA(pdev) ((pdev)->driver_data) - #define PCI_SET_DRIVER_DATA(pdev,data) (((pdev)->driver_data) = (data)) -#endif /* PCI_GET_DRIVER_DATA */ - #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/emu10k1/main.c linux/drivers/sound/emu10k1/main.c --- v2.4.0-test8/linux/drivers/sound/emu10k1/main.c Mon Aug 14 08:32:48 2000 +++ linux/drivers/sound/emu10k1/main.c Sun Sep 17 09:45:06 2000 @@ -641,7 +641,7 @@ return -ENODEV; } - PCI_SET_DRIVER_DATA(pci_dev, card); + pci_set_drvdata(pci_dev, card); PCI_SET_DMA_MASK(pci_dev, EMU10K1_DMA_MASK); card->irq = pci_dev->irq; @@ -736,7 +736,7 @@ static void __devexit emu10k1_remove(struct pci_dev *pci_dev) { - struct emu10k1_card *card = PCI_GET_DRIVER_DATA(pci_dev); + struct emu10k1_card *card = pci_get_drvdata(pci_dev); midi_exit(card); emu10k1_exit(card); @@ -755,7 +755,7 @@ kfree(card); - return; + pci_set_drvdata(pci_dev, NULL); } MODULE_AUTHOR("Bertrand Lee, Cai Ying. (Email to: emu10k1-devel@opensource.creative.com)"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/es1370.c linux/drivers/sound/es1370.c --- v2.4.0-test8/linux/drivers/sound/es1370.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/es1370.c Mon Sep 18 14:57:01 2000 @@ -2593,7 +2593,7 @@ } set_fs(fs); /* store it in the driver field */ - pcidev->driver_data = s; + pci_set_drvdata(pcidev, s); pcidev->dma_mask = 0xffffffff; /* put it into driver list */ list_add_tail(&s->devs, &devs); @@ -2620,7 +2620,7 @@ static void __devinit es1370_remove(struct pci_dev *dev) { - struct es1370_state *s = (struct es1370_state *)dev->driver_data; + struct es1370_state *s = pci_get_drvdata(dev); if (!s) return; @@ -2635,7 +2635,7 @@ unregister_sound_dsp(s->dev_dac); unregister_sound_midi(s->dev_midi); kfree(s); - dev->driver_data = NULL; + pci_set_drvdata(dev, NULL); } static struct pci_device_id id_table[] __devinitdata = { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/es1371.c linux/drivers/sound/es1371.c --- v2.4.0-test8/linux/drivers/sound/es1371.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/es1371.c Mon Sep 18 14:57:01 2000 @@ -2859,7 +2859,7 @@ /* turn on S/PDIF output driver if requested */ outl(cssr, s->io+ES1371_REG_STATUS); /* store it in the driver field */ - pcidev->driver_data = s; + pci_set_drvdata(pcidev, s); pcidev->dma_mask = 0xffffffff; /* put it into driver list */ list_add_tail(&s->devs, &devs); @@ -2886,7 +2886,7 @@ static void __devinit es1371_remove(struct pci_dev *dev) { - struct es1371_state *s = (struct es1371_state *)dev->driver_data; + struct es1371_state *s = pci_get_drvdata(dev); if (!s) return; @@ -2905,7 +2905,7 @@ unregister_sound_dsp(s->dev_dac); unregister_sound_midi(s->dev_midi); kfree(s); - dev->driver_data = NULL; + pci_set_drvdata(dev, NULL); } static struct pci_device_id id_table[] __devinitdata = { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/esssolo1.c linux/drivers/sound/esssolo1.c --- v2.4.0-test8/linux/drivers/sound/esssolo1.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/esssolo1.c Mon Sep 18 14:57:01 2000 @@ -2305,7 +2305,7 @@ if (setup_solo1(s)) goto err; /* store it in the driver field */ - pcidev->driver_data = s; + pci_set_drvdata(pcidev, s); pcidev->dma_mask = dma_mask; /* put it into driver list */ list_add_tail(&s->devs, &devs); @@ -2342,7 +2342,7 @@ static void __devinit solo1_remove(struct pci_dev *dev) { - struct solo1_state *s = (struct solo1_state *)dev->driver_data; + struct solo1_state *s = pci_get_drvdata(dev); if (!s) return; @@ -2363,7 +2363,7 @@ unregister_sound_midi(s->dev_midi); unregister_sound_special(s->dev_dmfm); kfree(s); - dev->driver_data = NULL; + pci_set_drvdata(dev, NULL); } static struct pci_device_id id_table[] __devinitdata = { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/gus_card.c linux/drivers/sound/gus_card.c --- v2.4.0-test8/linux/drivers/sound/gus_card.c Fri Aug 11 08:26:43 2000 +++ linux/drivers/sound/gus_card.c Sun Sep 17 09:45:05 2000 @@ -198,7 +198,9 @@ } #endif +#ifdef CONFIG_SOUND_GUS16 static int gus16 = 0; +#endif #ifdef CONFIG_SOUND_GUSMAX static int no_wave_dma = 0;/* Set if no dma is to be used for the wave table (GF1 chip) */ @@ -223,12 +225,12 @@ MODULE_PARM(dma, "i"); MODULE_PARM(dma16, "i"); MODULE_PARM(type, "i"); -MODULE_PARM(gus16, "i"); #ifdef CONFIG_SOUND_GUSMAX MODULE_PARM(no_wave_dma, "i"); #endif #ifdef CONFIG_SOUND_GUS16 MODULE_PARM(db16, "i"); +MODULE_PARM(gus16, "i"); #endif static int __init init_gus(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/opl3.c linux/drivers/sound/opl3.c --- v2.4.0-test8/linux/drivers/sound/opl3.c Fri Aug 11 08:26:43 2000 +++ linux/drivers/sound/opl3.c Sun Sep 17 09:45:06 2000 @@ -15,6 +15,8 @@ * Thomas Sailer ioctl code reworked (vmalloc/vfree removed) * Alan Cox modularisation, fixed sound_mem allocs. * Christoph Hellwig Adapted to module_init/module_exit + * Arnaldo C. de Melo get rid of check_region, use request_region for + * OPL4, release it on exit, some cleanups. * * Status * Believed to work. Badly needs rewriting a bit to support multiple @@ -172,6 +174,15 @@ "structure \n "); return 0; } + + memset(devc, 0, sizeof(*devc)); + strcpy(devc->fm_info.name, "OPL2"); + + if (!request_region(ioaddr, 4, devc->fm_info.name)) { + printk(KERN_WARNING "opl3: I/O port 0x%x already in use\n", ioaddr); + goto cleanup_devc; + } + devc->osp = osp; devc->base = ioaddr; @@ -187,7 +198,7 @@ signature != 0x0f) { MDB(printk(KERN_INFO "OPL3 not detected %x\n", signature)); - return 0; + goto cleanup_region; } if (signature == 0x06) /* OPL2 */ @@ -214,7 +225,7 @@ detected_model = 4; } - if (!check_region(ioaddr - 8, 2)) /* OPL4 port is free */ + if (request_region(ioaddr - 8, 2, "OPL4")) /* OPL4 port was free */ { int tmp; @@ -232,7 +243,10 @@ udelay(10); } else + { /* release OPL4 port */ + release_region(ioaddr - 8, 2); detected_model = 3; + } } opl3_command(ioaddr + 2, OPL3_MODE_REGISTER, 0); } @@ -246,6 +260,12 @@ * Melodic mode. */ return 1; +cleanup_region: + release_region(ioaddr, 4); +cleanup_devc: + kfree(devc); + devc = NULL; + return 0; } static int opl3_kill_note (int devno, int voice, int note, int velocity) @@ -1099,12 +1119,7 @@ return -1; } - memset((char *) devc, 0x00, sizeof(*devc)); - devc->osp = osp; - devc->base = ioaddr; - devc->nr_voice = 9; - strcpy(devc->fm_info.name, "OPL2"); devc->fm_info.device = 0; devc->fm_info.synth_type = SYNTH_TYPE_FM; @@ -1191,18 +1206,12 @@ if (io != -1) /* User loading pure OPL3 module */ { - if (check_region(io, 4)) - { - printk(KERN_WARNING "opl3: I/O port 0x%x already in use\n", io); - return 0; - } if (!opl3_detect(io, NULL)) { return -ENODEV; } - me = opl3_init(io, NULL, THIS_MODULE); - request_region(io, 4, devc->fm_info.name); + me = opl3_init(io, NULL, THIS_MODULE); } return 0; @@ -1212,8 +1221,11 @@ { if (devc && io != -1) { - if(devc->base) + if (devc->base) { release_region(devc->base,4); + if (devc->is_opl4) + release_region(devc->base - 8, 2); + } kfree(devc); devc = NULL; sound_unload_synthdev(me); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/pss.c linux/drivers/sound/pss.c --- v2.4.0-test8/linux/drivers/sound/pss.c Fri Aug 11 08:26:43 2000 +++ linux/drivers/sound/pss.c Mon Sep 18 15:02:02 2000 @@ -24,8 +24,32 @@ * To probe_pss_mss added test for initialize AD1848 * 98-05-28: Vladimir Michl * Fixed computation of mixer volumes + * 04-05-1999: Anthony Barbachan + * Added code that allows the user to enable his cdrom and/or + * joystick through the module parameters pss_cdrom_port and + * pss_enable_joystick. pss_cdrom_port takes a port address as its + * argument. pss_enable_joystick takes either a 0 or a non-0 as its + * argument. + * 04-06-1999: Anthony Barbachan + * Separated some code into new functions for easier reuse. + * Cleaned up and streamlined new code. Added code to allow a user + * to only use this driver for enabling non-sound components + * through the new module parameter pss_no_sound (flag). Added + * code that would allow a user to decide whether the driver should + * reset the configured hardware settings for the PSS board through + * the module parameter pss_keep_settings (flag). This flag will + * allow a user to free up resources in use by this card if needbe, + * furthermore it allows him to use this driver to just enable the + * emulations and then be unloaded as it is no longer needed. Both + * new settings are only available to this driver if compiled as a + * module. The default settings of all new parameters are set to + * load the driver as it did in previous versions. + * 04-07-1999: Anthony Barbachan + * Added module parameter pss_firmware to allow the user to tell + * the driver where the fireware file is located. The default + * setting is the previous hardcoded setting "/etc/sound/pss_synth". * 00-03-03: Christoph Hellwig - * Adapted to module_init/module_exit + * Adapted to module_init/module_exit */ @@ -84,6 +108,7 @@ #define NO_WSS_MIXER -1 #include "coproc.h" + #include "pss_boot.h" /* If compiled into kernel, it enable or disable pss mixer */ @@ -116,6 +141,8 @@ static int pss_initialized = 0; static int nonstandard_microcode = 0; +static int pss_cdrom_port = -1; /* Parameter for the PSS cdrom port */ +static int pss_enable_joystick = 0;/* Parameter for enabling the joystick */ static void pss_write(pss_confdata *devc, int data) { @@ -574,6 +601,49 @@ ioctl: pss_mixer_ioctl }; +void disable_all_emulations(void) +{ + outw(0x0000, REG(CONF_PSS)); /* 0x0400 enables joystick */ + outw(0x0000, REG(CONF_WSS)); + outw(0x0000, REG(CONF_SB)); + outw(0x0000, REG(CONF_MIDI)); + outw(0x0000, REG(CONF_CDROM)); +} + +void configure_nonsound_components(void) +{ + /* Configure Joystick port */ + + if(pss_enable_joystick) + { + outw(0x0400, REG(CONF_PSS)); /* 0x0400 enables joystick */ + printk(KERN_INFO "PSS: joystick enabled.\n"); + } + else + { + printk(KERN_INFO "PSS: joystick port not enabled.\n"); + } + + /* Configure CDROM port */ + + if(pss_cdrom_port == -1) /* If cdrom port enablation wasn't requested */ + { + printk(KERN_INFO "PSS: CDROM port not enabled.\n"); + } + else if(check_region(pss_cdrom_port, 2)) + { + printk(KERN_ERR "PSS: CDROM I/O port conflict.\n"); + } + else if(!set_io_base(devc, CONF_CDROM, pss_cdrom_port)) + { + printk(KERN_ERR "PSS: CDROM I/O port could not be set.\n"); + } + else /* CDROM port successfully configured */ + { + printk(KERN_INFO "PSS: CDROM I/O port set to 0x%x.\n", pss_cdrom_port); + } +} + void attach_pss(struct address_info *hw_config) { unsigned short id; @@ -594,13 +664,10 @@ id = inw(REG(PSS_ID)) & 0x00ff; /* - * Disable all emulations. Will be enabled later (if required). + * Disable all emulations. Will be enabled later (if required). */ - outw(0x0000, REG(CONF_PSS)); /* 0x0400 enables joystick */ - outw(0x0000, REG(CONF_WSS)); - outw(0x0000, REG(CONF_SB)); - outw(0x0000, REG(CONF_MIDI)); - outw(0x0000, REG(CONF_CDROM)); + + disable_all_emulations(); #if YOU_REALLY_WANT_TO_ALLOCATE_THESE_RESOURCES if (sound_alloc_dma(hw_config->dma, "PSS")) @@ -620,6 +687,7 @@ } #endif + configure_nonsound_components(); pss_initialized = 1; sprintf(tmp, "ECHO-PSS Rev. %d", id); conf_printf(tmp, hw_config); @@ -1028,6 +1096,9 @@ static int mss_dma __initdata = -1; static int mpu_io __initdata = -1; static int mpu_irq __initdata = -1; +static int pss_no_sound __initdata = 0; /* Just configure non-sound components */ +static int pss_keep_settings = 1; /* Keep hardware settings at module exit */ +static char *pss_firmware = "/etc/sound/pss_synth"; MODULE_PARM(pss_io, "i"); MODULE_PARM_DESC(pss_io, "Set i/o base of PSS card (probably 0x220 or 0x240)"); @@ -1041,6 +1112,16 @@ MODULE_PARM_DESC(mpu_io, "Set MIDI i/o base (0x330 or other. Address must be on 4 location boundaries and must be from 0x100 to 0xFFC)"); MODULE_PARM(mpu_irq, "i"); MODULE_PARM_DESC(mpu_irq, "Set MIDI IRQ (3, 5, 7, 9, 10, 11, 12)"); +MODULE_PARM(pss_cdrom_port, "i"); +MODULE_PARM_DESC(pss_cdrom_port, "Set the PSS CDROM port i/o base (0x340 or other)"); +MODULE_PARM(pss_enable_joystick, "i"); +MODULE_PARM_DESC(pss_enable_joystick, "Enables the PSS joystick port (1 to enable, 0 to disable)"); +MODULE_PARM(pss_no_sound, "i"); +MODULE_PARM_DESC(pss_no_sound, "Configure sound compoents (0 - no, 1 - yes)"); +MODULE_PARM(pss_keep_settings, "i"); +MODULE_PARM_DESC(pss_keep_settings, "Keep hardware setting at driver unloading (0 - no, 1 - yes)"); +MODULE_PARM(pss_firmware, "s"); +MODULE_PARM_DESC(pss_firmware, "Location of the firmware file (default - /etc/sound/pss_synth)"); MODULE_PARM(pss_mixer, "b"); MODULE_PARM_DESC(pss_mixer, "Enable (1) or disable (0) PSS mixer (controlling of output volume, bass, treble, synth volume). The mixer is not available on all PSS cards."); MODULE_AUTHOR("Hannu Savolainen, Vladimir Michl"); @@ -1055,6 +1136,19 @@ static int __init init_pss(void) { + + if(pss_no_sound) /* If configuring only nonsound components */ + { + cfg.io_base = pss_io; + if(!probe_pss(&cfg)) + return -ENODEV; + printk(KERN_INFO "ECHO-PSS Rev. %d\n", inw(REG(PSS_ID)) & 0x00ff); + printk(KERN_INFO "PSS: loading in no sound mode.\n"); + disable_all_emulations(); + configure_nonsound_components(); + return 0; + } + cfg.io_base = pss_io; cfg2.io_base = mss_io; @@ -1071,7 +1165,7 @@ if (!pss_synth) { fw_load = 1; - pss_synthLen = mod_firmware_load("/etc/sound/pss_synth", (void *) &pss_synth); + pss_synthLen = mod_firmware_load(pss_firmware, (void *) &pss_synth); } if (!probe_pss(&cfg)) return -ENODEV; @@ -1093,13 +1187,22 @@ static void __exit cleanup_pss(void) { - if (fw_load && pss_synth) - vfree(pss_synth); - if (pssmss) - unload_pss_mss(&cfg2); - if (pssmpu) - unload_pss_mpu(&cfg_mpu); - unload_pss(&cfg); + if(!pss_no_sound) + { + if(fw_load && pss_synth) + vfree(pss_synth); + if(pssmss) + unload_pss_mss(&cfg2); + if(pssmpu) + unload_pss_mpu(&cfg_mpu); + unload_pss(&cfg); + } + + if(!pss_keep_settings) /* Keep hardware settings if asked */ + { + disable_all_emulations(); + printk(KERN_INFO "Resetting PSS sound card configurations.\n"); + } } module_init(init_pss); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c --- v2.4.0-test8/linux/drivers/sound/sonicvibes.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/sonicvibes.c Mon Sep 18 14:57:01 2000 @@ -2589,7 +2589,7 @@ } set_fs(fs); /* store it in the driver field */ - pcidev->driver_data = s; + pci_set_drvdata(pcidev, s); pcidev->dma_mask = 0x00ffffff; /* put it into driver list */ list_add_tail(&s->devs, &devs); @@ -2624,7 +2624,7 @@ static void __devinit sv_remove(struct pci_dev *dev) { - struct sv_state *s = (struct sv_state *)dev->driver_data; + struct sv_state *s = pci_get_drvdata(dev); if (!s) return; @@ -2646,7 +2646,7 @@ unregister_sound_midi(s->dev_midi); unregister_sound_special(s->dev_dmfm); kfree(s); - dev->driver_data = NULL; + pci_set_drvdata(dev, NULL); } static struct pci_device_id id_table[] __devinitdata = { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/trident.c linux/drivers/sound/trident.c --- v2.4.0-test8/linux/drivers/sound/trident.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/trident.c Mon Sep 18 14:57:01 2000 @@ -2484,7 +2484,7 @@ /* edited by HMSEO for GT sound*/ } - pci_dev->driver_data = card; + pci_set_drvdata(pci_dev, card); pci_dev->dma_mask = TRIDENT_DMA_MASK; /* Enable Address Engine Interrupts */ @@ -2496,7 +2496,7 @@ static void __exit trident_remove(struct pci_dev *pci_dev) { int i; - struct trident_card *card = pci_dev->driver_data; + struct trident_card *card = pci_get_drvdata(pci_dev); /* Kill interrupts, and SP/DIF */ trident_disable_loop_interrupts(card); @@ -2514,6 +2514,8 @@ unregister_sound_dsp(card->dev_audio); kfree(card); + + pci_set_drvdata(pci_dev, NULL); } MODULE_AUTHOR("Alan Cox, Aaron Holtzman, Ollie Lho, Ching Ling Lee"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/uart6850.c linux/drivers/sound/uart6850.c --- v2.4.0-test8/linux/drivers/sound/uart6850.c Fri Aug 11 08:26:44 2000 +++ linux/drivers/sound/uart6850.c Sun Sep 17 09:45:07 2000 @@ -13,8 +13,11 @@ * Alan Cox: Updated for new modular code. Removed snd_* irq handling. Now * uses native linux resources * Christoph Hellwig: Adapted to module_init/module_exit + * Jeff Garzik: Made it work again, in theory + * FIXME: If the request_irq() succeeds, the probe succeeds. Ug. + * + * Status: Testing required (no shit -jgarzik) * - * Status: Testing required * */ @@ -64,12 +67,11 @@ #define UART_RESET 0x95 #define UART_MODE_ON 0x03 -static int uart6850_opened = 0; +static int uart6850_opened; static int uart6850_irq; -static int uart6850_detected = 0; +static int uart6850_detected; static int my_dev; -static int reset_uart6850(void); static void (*midi_input_intr) (int dev, unsigned char data); static void poll_uart6850(unsigned long dummy); @@ -251,6 +253,9 @@ int ok, timeout; unsigned long flags; + if (!uart6850_detected) + return; + if ((my_dev = sound_alloc_mididev()) == -1) { printk(KERN_INFO "uart6850: Too many midi devices detected\n"); @@ -260,11 +265,6 @@ uart6850_osp = hw_config->osp; uart6850_irq = hw_config->irq; - if (!uart6850_detected) - { - sound_unload_mididev(my_dev); - return; - } save_flags(flags); cli(); @@ -283,7 +283,7 @@ sequencer_init(); } -static int reset_uart6850(void) +static inline int reset_uart6850(void) { uart6850_read(); return 1; /* @@ -291,10 +291,9 @@ */ } - static int __init probe_uart6850(struct address_info *hw_config) { - int ok = 0; + int ok; uart6850_osp = hw_config->osp; uart6850_base = hw_config->io_base; @@ -334,6 +333,7 @@ if (probe_uart6850(&cfg_mpu)) return -ENODEV; + attach_uart6850(&cfg_mpu); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/vidc.c linux/drivers/sound/vidc.c --- v2.4.0-test8/linux/drivers/sound/vidc.c Fri Aug 11 08:26:44 2000 +++ linux/drivers/sound/vidc.c Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * drivers/sound/vidc.c + * linux/drivers/sound/vidc.c * - * VIDC20 audio driver. + * Copyright (C) 1997-2000 by Russell King * - * Copyright (C) 1997-2000 by Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * VIDC20 audio driver. * * The VIDC20 sound hardware consists of the VIDC20 itself, a DAC and a DMA * engine. The DMA transfers fixed-format (16-bit little-endian linear) @@ -21,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -287,10 +291,10 @@ struct dma_buffparms *dmap = audio_devs[dev]->dmap_out; unsigned long flags; - save_flags_cli(flags); + local_irq_save(flags); dma_start = buf - (unsigned long)dmap->raw_buf_phys + (unsigned long)dmap->raw_buf; dma_count = total_count; - restore_flags(flags); + local_irq_restore(flags); } static void @@ -345,7 +349,7 @@ if (!(adev->flags & DMA_ACTIVE)) { unsigned long flags; - save_flags_cli(flags); + local_irq_save(flags); /* prevent recusion */ adev->flags |= DMA_ACTIVE; @@ -354,7 +358,7 @@ vidc_sound_dma_irq(0, NULL, NULL); outb(DMA_CR_E | 0x10, IOMD_SD0CR); - restore_flags(flags); + local_irq_restore(flags); } } } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/vidc.h linux/drivers/sound/vidc.h --- v2.4.0-test8/linux/drivers/sound/vidc.h Thu Feb 24 22:44:47 2000 +++ linux/drivers/sound/vidc.h Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * drivers/sound/vidc.h + * linux/drivers/sound/vidc.h * - * VIDC sound function prototypes + * Copyright (C) 1997 Russell King * - * Copyright (C) 1997 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * VIDC sound function prototypes */ /* vidc.c */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/vidc_fill.S linux/drivers/sound/vidc_fill.S --- v2.4.0-test8/linux/drivers/sound/vidc_fill.S Thu Feb 24 22:44:47 2000 +++ linux/drivers/sound/vidc_fill.S Mon Sep 18 15:15:22 2000 @@ -1,15 +1,19 @@ /* - * sound/vidc_fill.S + * linux/drivers/sound/vidc_fill.S * - * Filler routines for DMA buffers + * Copyright (C) 1997 Russell King * - * Copyright (C) 1997 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Filler routines for DMA buffers */ #define __ASSEMBLY__ #include #include #include -#include +#include .text diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/waveartist.c linux/drivers/sound/waveartist.c --- v2.4.0-test8/linux/drivers/sound/waveartist.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/sound/waveartist.c Mon Sep 18 15:15:22 2000 @@ -38,7 +38,6 @@ #include #include -#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/drivers/sound/wf_midi.c linux/drivers/sound/wf_midi.c --- v2.4.0-test8/linux/drivers/sound/wf_midi.c Fri Aug 11 08:26:44 2000 +++ linux/drivers/sound/wf_midi.c Sun Sep 17 09:45:07 2000 @@ -781,8 +781,7 @@ return 0; } -static int __init detect_wf_mpu (int irq, int io_base) - +int __init detect_wf_mpu (int irq, int io_base) { if (check_region (io_base, 2)) { printk (KERN_WARNING "WF-MPU: I/O port %x already in use.\n", diff -u --recursive --new-file v2.4.0-test8/linux/drivers/telephony/Makefile linux/drivers/telephony/Makefile --- v2.4.0-test8/linux/drivers/telephony/Makefile Wed Dec 29 17:13:59 1999 +++ linux/drivers/telephony/Makefile Sun Sep 17 09:45:07 2000 @@ -1,35 +1,29 @@ # -# Makefile for the kernel miscellaneous drivers. +# Makefile for drivers/telephony # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # -# Note 2! The CFLAGS definitions are now inherited from the -# parent makes.. -SUB_DIRS := +SUB_DIRS := MOD_SUB_DIRS := $(SUB_DIRS) ALL_SUB_DIRS := $(SUB_DIRS) -L_TARGET := telephony.a -MX_OBJS := -M_OBJS := - -ifeq ($(CONFIG_PHONE),y) - LX_OBJS += phonedev.o -else - ifeq ($(CONFIG_PHONE),m) - MX_OBJS += phonedev.o - endif -endif - -ifeq ($(CONFIG_PHONE_IXJ),y) - L_OBJS += ixj.o -else - ifeq ($(CONFIG_PHONE_IXJ),m) - M_OBJS += ixj.o - endif -endif +obj-y := +obj-n := +obj-m := +obj- := +export-objs := phonedev.o + +obj-$(CONFIG_PHONE) += phonedev.o +obj-$(CONFIG_PHONE_IXJ) += ixj.o + +O_TARGET := telephony.o +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) include $(TOPDIR)/Rules.make + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/telephony/ixj.c linux/drivers/telephony/ixj.c --- v2.4.0-test8/linux/drivers/telephony/ixj.c Wed Jul 12 21:58:43 2000 +++ linux/drivers/telephony/ixj.c Mon Sep 18 15:02:03 2000 @@ -1,10 +1,10 @@ -/* +/**************************************************************************** * ixj.c * * Device Driver for the Internet PhoneJACK and * Internet LineJACK Telephony Cards. * - * (c) Copyright 1999 Quicknet Technologies, Inc. + * (c) Copyright 1999-2000 Quicknet Technologies, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -12,29 +12,39 @@ * 2 of the License, or (at your option) any later version. * * Author: Ed Okerson, - * + * * Contributors: Greg Herlein, * David W. Erhart, * John Sellers, * Mike Preston, - * + * * Fixes: - * - * 2.3.x port : Alan Cox - * - * More information about the hardware related to this driver can be found + * + * More information about the hardware related to this driver can be found * at our website: http://www.quicknet.net * - */ + * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET + * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION + * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + ***************************************************************************/ -static char ixj_c_rcsid[] = "$Id: ixj.c,v 3.4 1999/12/16 22:18:36 root Exp root $"; +static char ixj_c_rcsid[] = "$Id: ixj.c,v 3.31 2000/04/14 19:24:47 jaugenst Exp $"; +static char ixj_c_revision[] = "$Revision: 3.31 $"; //#define PERFMON_STATS #define IXJDEBUG 0 #define MAXRINGS 5 #include -#include + #include #include #include /* printk() */ @@ -50,7 +60,6 @@ #include #include #include -#include #include #include @@ -102,14 +111,17 @@ static void ixj_write_frame(int board); static void ixj_init_timer(void); static void ixj_add_timer(void); -static void ixj_del_timer(void); static void ixj_timeout(unsigned long ptr); static int read_filters(int board); static int LineMonitor(int board); static int ixj_fasync(int fd, struct file *, int mode); +static int ixj_set_port(int board, int arg); +static int ixj_set_pots(int board, int arg); static int ixj_hookstate(int board); static int ixj_record_start(int board); static void ixj_record_stop(int board); +static void set_rec_volume(int board, int volume); +static void ixj_vad(int board, int arg); static int ixj_play_start(int board); static void ixj_play_stop(int board); static int ixj_set_tone_on(unsigned short arg, int board); @@ -126,6 +138,7 @@ static char daa_int_read(int board); static int daa_set_mode(int board, int mode); static int ixj_linetest(int board); +static int ixj_daa_write(int board); static int ixj_daa_cid_read(int board); static void DAA_Coeff_US(int board); static void DAA_Coeff_UK(int board); @@ -136,12 +149,18 @@ static int ixj_init_filter(int board, IXJ_FILTER * jf); static int ixj_init_tone(int board, IXJ_TONE * ti); static int ixj_build_cadence(int board, IXJ_CADENCE * cp); +static int ixj_build_filter_cadence(int board, IXJ_FILTER_CADENCE * cp); // Serial Control Interface funtions static int SCI_Control(int board, int control); static int SCI_Prepare(int board); static int SCI_WaitHighSCI(int board); static int SCI_WaitLowSCI(int board); static DWORD PCIEE_GetSerialNumber(WORD wAddress); +static int ixj_PCcontrol_wait(int board); +static void ixj_write_cid(int board); +static void ixj_write_cid_bit(int board, int bit); +static int set_base_frame(int board, int size); +static int set_play_codec(int board, int rate); /************************************************************************ CT8020/CT8021 Host Programmers Model @@ -162,12 +181,19 @@ ixj[board].hsr.bytes.low = inb_p(ixj[board].DSPbase + 8); ixj[board].hsr.bytes.high = inb_p(ixj[board].DSPbase + 9); } + extern __inline__ int IsControlReady(int board) { ixj_read_HSR(board); return ixj[board].hsr.bits.controlrdy ? 1 : 0; } +extern __inline__ int IsPCControlReady(int board) +{ + ixj[board].pccr1.byte = inb_p(ixj[board].XILINXbase + 3); + return ixj[board].pccr1.bits.crr ? 1 : 0; +} + extern __inline__ int IsStatusReady(int board) { ixj_read_HSR(board); @@ -177,21 +203,54 @@ extern __inline__ int IsRxReady(int board) { ixj_read_HSR(board); +#ifdef PERFMON_STATS + ++ixj[board].rxreadycheck; +#endif return ixj[board].hsr.bits.rxrdy ? 1 : 0; } extern __inline__ int IsTxReady(int board) { ixj_read_HSR(board); +#ifdef PERFMON_STATS + ++ixj[board].txreadycheck; +#endif return ixj[board].hsr.bits.txrdy ? 1 : 0; } +extern __inline__ void set_play_volume(int board, int volume) +{ + ixj_WriteDSPCommand(0xCF02, board); + ixj_WriteDSPCommand(volume, board); +} + +extern __inline__ int get_play_volume(int board) +{ + ixj_WriteDSPCommand(0xCF00, board); + return ixj[board].ssr.high << 8 | ixj[board].ssr.low; +} + extern __inline__ BYTE SLIC_GetState(int board) { IXJ *j = &ixj[board]; - j->pld_slicr.byte = inb_p(j->XILINXbase + 0x01); - + if (j->cardtype == 600) { + j->pccr1.byte = 0; + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 1; + outw_p(j->psccr.byte << 8, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(board); + j->pslic.byte = inw_p(j->XILINXbase + 0x00) & 0xFF; + ixj_PCcontrol_wait(board); + if (j->pslic.bits.powerdown) + return PLD_SLIC_STATE_OC; + else if (!j->pslic.bits.ring0 && !j->pslic.bits.ring1) + return PLD_SLIC_STATE_ACTIVE; + else + return PLD_SLIC_STATE_RINGING; + } else { + j->pld_slicr.byte = inb_p(j->XILINXbase + 0x01); + } return j->pld_slicr.bits.state; } @@ -200,78 +259,122 @@ BOOL fRetVal = FALSE; IXJ *j = &ixj[board]; - // Set the C1, C2, C3 & B2EN signals. - switch (byState) { - case PLD_SLIC_STATE_OC: - j->pld_slicw.bits.c1 = 0; - j->pld_slicw.bits.c2 = 0; - j->pld_slicw.bits.c3 = 0; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_RINGING: - j->pld_slicw.bits.c1 = 1; - j->pld_slicw.bits.c2 = 0; - j->pld_slicw.bits.c3 = 0; - j->pld_slicw.bits.b2en = 1; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_ACTIVE: - j->pld_slicw.bits.c1 = 0; - j->pld_slicw.bits.c2 = 1; - j->pld_slicw.bits.c3 = 0; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_OHT: // On-hook transmit + if (j->cardtype == 600) { + if (j->flags.pcmciasct) { + switch (byState) { + case PLD_SLIC_STATE_TIPOPEN: + case PLD_SLIC_STATE_OC: + j->pslic.bits.powerdown = 1; + j->pslic.bits.ring0 = j->pslic.bits.ring1 = 0; + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_RINGING: + if (j->readers || j->writers) { + j->pslic.bits.powerdown = 0; + j->pslic.bits.ring0 = 1; + j->pslic.bits.ring1 = 0; + fRetVal = TRUE; + } + break; + case PLD_SLIC_STATE_OHT: // On-hook transmit - j->pld_slicw.bits.c1 = 1; - j->pld_slicw.bits.c2 = 1; - j->pld_slicw.bits.c3 = 0; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_TIPOPEN: - j->pld_slicw.bits.c1 = 0; - j->pld_slicw.bits.c2 = 0; - j->pld_slicw.bits.c3 = 1; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_STANDBY: - j->pld_slicw.bits.c1 = 1; - j->pld_slicw.bits.c2 = 0; - j->pld_slicw.bits.c3 = 1; - j->pld_slicw.bits.b2en = 1; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_APR: // Active polarity reversal + case PLD_SLIC_STATE_STANDBY: + case PLD_SLIC_STATE_ACTIVE: + if (j->readers || j->writers) { + j->pslic.bits.powerdown = 0; + } else { + j->pslic.bits.powerdown = 1; + } + j->pslic.bits.ring0 = j->pslic.bits.ring1 = 0; + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_APR: // Active polarity reversal - j->pld_slicw.bits.c1 = 0; - j->pld_slicw.bits.c2 = 1; - j->pld_slicw.bits.c3 = 1; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - case PLD_SLIC_STATE_OHTPR: // OHT polarity reversal + case PLD_SLIC_STATE_OHTPR: // OHT polarity reversal - j->pld_slicw.bits.c1 = 1; - j->pld_slicw.bits.c2 = 1; - j->pld_slicw.bits.c3 = 1; - j->pld_slicw.bits.b2en = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - fRetVal = TRUE; - break; - default: - fRetVal = FALSE; - break; + default: + fRetVal = FALSE; + break; + } + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 0; + outw_p(j->psccr.byte << 8 | j->pslic.byte, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(board); + } + } else { + // Set the C1, C2, C3 & B2EN signals. + switch (byState) { + case PLD_SLIC_STATE_OC: + j->pld_slicw.bits.c1 = 0; + j->pld_slicw.bits.c2 = 0; + j->pld_slicw.bits.c3 = 0; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_RINGING: + j->pld_slicw.bits.c1 = 1; + j->pld_slicw.bits.c2 = 0; + j->pld_slicw.bits.c3 = 0; + j->pld_slicw.bits.b2en = 1; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_ACTIVE: + j->pld_slicw.bits.c1 = 0; + j->pld_slicw.bits.c2 = 1; + j->pld_slicw.bits.c3 = 0; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_OHT: // On-hook transmit + + j->pld_slicw.bits.c1 = 1; + j->pld_slicw.bits.c2 = 1; + j->pld_slicw.bits.c3 = 0; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_TIPOPEN: + j->pld_slicw.bits.c1 = 0; + j->pld_slicw.bits.c2 = 0; + j->pld_slicw.bits.c3 = 1; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_STANDBY: + j->pld_slicw.bits.c1 = 1; + j->pld_slicw.bits.c2 = 0; + j->pld_slicw.bits.c3 = 1; + j->pld_slicw.bits.b2en = 1; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_APR: // Active polarity reversal + + j->pld_slicw.bits.c1 = 0; + j->pld_slicw.bits.c2 = 1; + j->pld_slicw.bits.c3 = 1; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + case PLD_SLIC_STATE_OHTPR: // OHT polarity reversal + + j->pld_slicw.bits.c1 = 1; + j->pld_slicw.bits.c2 = 1; + j->pld_slicw.bits.c3 = 1; + j->pld_slicw.bits.b2en = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + fRetVal = TRUE; + break; + default: + fRetVal = FALSE; + break; + } } return fRetVal; @@ -363,51 +466,42 @@ add_timer(&ixj_timer); } -static void ixj_del_timer(void) -{ - del_timer(&ixj_timer); -} - static void ixj_tone_timeout(int board) { IXJ *j = &ixj[board]; IXJ_TONE ti; - + j->tone_state++; if (j->tone_state == 3) { j->tone_state = 0; if (j->cadence_t) { j->tone_cadence_state++; - if (j->tone_cadence_state >= j->cadence_t->elements_used) - { - switch (j->cadence_t->termination) - { - case PLAY_ONCE: - ixj_cpt_stop(board); - break; - case REPEAT_LAST_ELEMENT: - j->tone_cadence_state--; - ixj_play_tone(board, j->cadence_t->ce[j->tone_cadence_state].index); - break; - case REPEAT_ALL: - j->tone_cadence_state = 0; - if (j->cadence_t->ce[j->tone_cadence_state].freq0) - { - ti.tone_index = j->cadence_t->ce[j->tone_cadence_state].index; - ti.freq0 = j->cadence_t->ce[j->tone_cadence_state].freq0; - ti.gain0 = j->cadence_t->ce[j->tone_cadence_state].gain0; - ti.freq1 = j->cadence_t->ce[j->tone_cadence_state].freq1; - ti.gain1 = j->cadence_t->ce[j->tone_cadence_state].gain1; - ixj_init_tone(board, &ti); - } - ixj_set_tone_on(j->cadence_t->ce[0].tone_on_time, board); - ixj_set_tone_off(j->cadence_t->ce[0].tone_off_time, board); - ixj_play_tone(board, j->cadence_t->ce[0].index); - break; + if (j->tone_cadence_state >= j->cadence_t->elements_used) { + switch (j->cadence_t->termination) { + case PLAY_ONCE: + ixj_cpt_stop(board); + break; + case REPEAT_LAST_ELEMENT: + j->tone_cadence_state--; + ixj_play_tone(board, j->cadence_t->ce[j->tone_cadence_state].index); + break; + case REPEAT_ALL: + j->tone_cadence_state = 0; + if (j->cadence_t->ce[j->tone_cadence_state].freq0) { + ti.tone_index = j->cadence_t->ce[j->tone_cadence_state].index; + ti.freq0 = j->cadence_t->ce[j->tone_cadence_state].freq0; + ti.gain0 = j->cadence_t->ce[j->tone_cadence_state].gain0; + ti.freq1 = j->cadence_t->ce[j->tone_cadence_state].freq1; + ti.gain1 = j->cadence_t->ce[j->tone_cadence_state].gain1; + ixj_init_tone(board, &ti); + } + ixj_set_tone_on(j->cadence_t->ce[0].tone_on_time, board); + ixj_set_tone_off(j->cadence_t->ce[0].tone_off_time, board); + ixj_play_tone(board, j->cadence_t->ce[0].index); + break; } } else { - if (j->cadence_t->ce[j->tone_cadence_state].gain0) - { + if (j->cadence_t->ce[j->tone_cadence_state].gain0) { ti.tone_index = j->cadence_t->ce[j->tone_cadence_state].index; ti.freq0 = j->cadence_t->ce[j->tone_cadence_state].freq0; ti.gain0 = j->cadence_t->ce[j->tone_cadence_state].gain0; @@ -423,49 +517,49 @@ } } +extern __inline__ void ixj_kill_fasync(int board, int dir) +{ + kill_fasync(&ixj[board].async_queue, SIGIO, dir); // Send apps notice of change + +} static void ixj_timeout(unsigned long ptr) { int board; unsigned long jifon; IXJ *j; - for (board = 0; board < IXJMAX; board++) - { + for (board = 0; board < IXJMAX; board++) { j = &ixj[board]; - if (j->DSPbase) - { + if (j->DSPbase) { #ifdef PERFMON_STATS j->timerchecks++; #endif - if (j->tone_state) - { - if (!ixj_hookstate(board)) - { + if (j->tone_state) { + if (!ixj_hookstate(board)) { ixj_cpt_stop(board); - if (j->m_hook) - { + if (j->m_hook) { j->m_hook = 0; j->ex.bits.hookstate = 1; - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of change + ixj_kill_fasync(board, POLL_IN); } - goto timer_end; + continue; } if (j->tone_state == 1) jifon = (hertz * j->tone_on_time * 25 / 100000); else jifon = (hertz * j->tone_on_time * 25 / 100000) + (hertz * j->tone_off_time * 25 / 100000); - if (jiffies < j->tone_start_jif + jifon) { + if (time_before(jiffies, j->tone_start_jif + jifon)) { if (j->tone_state == 1) { ixj_play_tone(board, j->tone_index); if (j->dsp.low == 0x20) { - goto timer_end; + continue; } } else { ixj_play_tone(board, 0); if (j->dsp.low == 0x20) { - goto timer_end; + continue; } } } else { @@ -476,13 +570,13 @@ if (j->flags.busytone) { ixj_busytone(board); if (j->dsp.low == 0x20) { - goto timer_end; + continue; } } if (j->flags.ringback) { ixj_ringback(board); if (j->dsp.low == 0x20) { - goto timer_end; + continue; } } if (!j->tone_state) { @@ -499,7 +593,7 @@ if (IsRxReady(board)) { ixj_read_frame(board); } - if (IsTxReady(board)) { + if (IsTxReady(board) && !j->flags.cidplay) { ixj_write_frame(board); } } @@ -508,7 +602,12 @@ j->flags.cringing = 0; ixj_ring_off(board); } else { - if (jiffies - j->ring_cadence_jif >= (hertz/2)) { + if (jiffies - j->ring_cadence_jif >= (.5 * hertz)) { + if (j->flags.cidring && !j->flags.cidsent) { + j->flags.cidsent = 1; + ixj_write_cid(board); + j->flags.cidring = 0; + } j->ring_cadence_t--; if (j->ring_cadence_t == -1) j->ring_cadence_t = 15; @@ -518,16 +617,15 @@ ixj_ring_on(board); } else { ixj_ring_off(board); + j->flags.cidring = 1; } - goto timer_end; + continue; } } if (!j->flags.ringing) { if (ixj_hookstate(board)) { - if (j->dsp.low == 0x21 && - j->pld_slicr.bits.state != PLD_SLIC_STATE_ACTIVE) - // Internet LineJACK - { + if (j->dsp.low != 0x20 && + SLIC_GetState(board) != PLD_SLIC_STATE_ACTIVE) { SLIC_SetState(PLD_SLIC_STATE_ACTIVE, board); } LineMonitor(board); @@ -536,12 +634,12 @@ j->proc_load = j->ssr.high << 8 | j->ssr.low; if (!j->m_hook) { j->m_hook = j->ex.bits.hookstate = 1; - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of change + ixj_kill_fasync(board, POLL_IN); } } else { - if (j->dsp.low == 0x21 && - j->pld_slicr.bits.state == PLD_SLIC_STATE_ACTIVE) - // Internet LineJACK + if (j->dsp.low != 0x20 && + SLIC_GetState(board) == PLD_SLIC_STATE_ACTIVE) + // Internet LineJACK { SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); } @@ -551,14 +649,14 @@ if (j->m_hook) { j->m_hook = 0; j->ex.bits.hookstate = 1; - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of change + ixj_kill_fasync(board, POLL_IN); } } } - if (j->cardtype == 300) { + if (j->cardtype == 300 && !j->flags.incheck) { if (j->flags.pstn_present) { j->pld_scrr.byte = inb_p(j->XILINXbase); - if (jiffies >= j->pstn_sleeptil && j->pld_scrr.bits.daaflag) { + if (j->pld_scrr.bits.daaflag) { daa_int_read(board); if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.RING) { if (!j->flags.pstn_ringing) { @@ -567,22 +665,38 @@ daa_set_mode(board, SOP_PU_RINGING); } } - if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { + if (time_after(jiffies, j->pstn_sleeptil) && j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { j->pstn_winkstart = 0; + j->pstn_ring_stop = 0; + ixj[board].pld_scrw.bits.led1 = 1; if (j->flags.pstn_ringing && !j->pstn_envelope) { + if (j->daa_mode != SOP_PU_RINGING) { + j->flags.pstn_ringing = 0; + } else { + ixj[board].pld_scrw.bits.led2 = 0; + j->pstn_envelope = 1; + j->pstn_ring_start = jiffies; + j->pstn_ring_stop = 0; + } j->ex.bits.pstn_ring = 0; - j->pstn_envelope = 1; - j->pstn_ring_start = jiffies; } + outb_p(ixj[board].pld_scrw.byte, ixj[board].XILINXbase); } else { - if (j->flags.pstn_ringing && j->pstn_envelope && - jiffies > j->pstn_ring_start + ((hertz * 15) / 10)) { - j->ex.bits.pstn_ring = 1; - j->pstn_envelope = 0; + ixj[board].pld_scrw.bits.led1 = 0; + ixj[board].pld_scrw.bits.led2 = 1; + outb_p(ixj[board].pld_scrw.byte, ixj[board].XILINXbase); + if (j->flags.pstn_ringing && j->pstn_envelope) { + if(!j->pstn_ring_stop) { + j->pstn_ring_stop = jiffies; + } else if (time_after(jiffies, j->pstn_ring_stop + ((hertz * 5) / 100))){ + j->pstn_ring_stop = 0; + j->ex.bits.pstn_ring = 1; + j->pstn_envelope = 0; + } } else if (j->daa_mode == SOP_PU_CONVERSATION) { if (!j->pstn_winkstart) { j->pstn_winkstart = jiffies; - } else if (jiffies > j->pstn_winkstart + (hertz * j->winktime / 1000)) { + } else if (time_after(jiffies, j->pstn_winkstart + (hertz * j->winktime / 1000))) { daa_set_mode(board, SOP_PU_SLEEP); j->pstn_winkstart = 0; j->ex.bits.pstn_wink = 1; @@ -619,13 +733,23 @@ j->ex.bits.caller_id = 0; } if (!j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { + ixj[board].pld_scrw.bits.led1 = 0; + ixj[board].pld_scrw.bits.led2 = 1; + outb_p(ixj[board].pld_scrw.byte, ixj[board].XILINXbase); if (j->flags.pstn_ringing && j->pstn_envelope) { - j->ex.bits.pstn_ring = 1; - j->pstn_envelope = 0; + if(!j->pstn_ring_stop) { + j->pstn_ring_stop = jiffies; + } else if (time_after(jiffies, j->pstn_ring_stop + ((hertz * 5) / 100))){ + j->pstn_ring_stop = 0; + j->ex.bits.pstn_ring = 1; + j->pstn_envelope = 0; + } + ixj[board].pld_scrw.bits.led1 = 0; + outb_p(ixj[board].pld_scrw.byte, ixj[board].XILINXbase); } else if (j->daa_mode == SOP_PU_CONVERSATION) { if (!j->pstn_winkstart) { j->pstn_winkstart = jiffies; - } else if (jiffies > j->pstn_winkstart + (hertz * 320 / 1000)) { + } else if (time_after(jiffies, j->pstn_winkstart + (hertz * j->winktime / 1000))) { daa_set_mode(board, SOP_PU_SLEEP); j->pstn_winkstart = 0; j->ex.bits.pstn_wink = 1; @@ -635,18 +759,15 @@ } } } - if ((j->ex.bits.f0 || j->ex.bits.f1 || j->ex.bits.f2 || j->ex.bits.f3) - && j->filter_cadence) { - } if (j->ex.bytes) { wake_up_interruptible(&j->poll_q); // Wake any blocked selects - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of change + + ixj_kill_fasync(board, POLL_IN); } } else { break; } } -timer_end: ixj_add_timer(); } @@ -663,6 +784,19 @@ return 0; } +static int ixj_PCcontrol_wait(int board) +{ + unsigned long jif; + + jif = jiffies; + while (!IsPCControlReady(board)) { + if (jiffies - jif > (60 * (hertz / 100))) { + return -1; + } + } + return 0; +} + int ixj_WriteDSPCommand(unsigned short cmd, int board) { BYTES bytes; @@ -708,7 +842,7 @@ extern __inline__ void LED_SetState(int state, int board) { - if (ixj[board].dsp.low == 0x21) { + if (ixj[board].cardtype == 300) { ixj[board].pld_scrw.bits.led1 = state & 0x1 ? 1 : 0; ixj[board].pld_scrw.bits.led2 = state & 0x2 ? 1 : 0; ixj[board].pld_scrw.bits.led3 = state & 0x4 ? 1 : 0; @@ -746,12 +880,19 @@ case PORT_POTS: j->port = PORT_POTS; switch (j->cardtype) { + case 600: + if (j->flags.pcmciasct == 1) + SLIC_SetState(PLD_SLIC_STATE_ACTIVE, board); + else + return 11; + break; case 500: j->pld_slicw.pcib.mic = 0; j->pld_slicw.pcib.spk = 0; outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); break; case 300: + ixj_set_pots(board, 0); if (ixj_WriteDSPCommand(0xC528, board)) /* Write CODEC config to Software Control Register */ return 2; @@ -789,12 +930,21 @@ case PORT_SPEAKER: j->port = PORT_SPEAKER; switch (j->cardtype) { + case 600: + if (j->flags.pcmciasct) { + SLIC_SetState(PLD_SLIC_STATE_OC, board); +// while(SLIC_GetState(board) != PLD_SLIC_STATE_OC) { + // SLIC_SetState(PLD_SLIC_STATE_OC,board); + // } + } + break; case 500: j->pld_slicw.pcib.mic = 1; j->pld_slicw.pcib.spk = 1; outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); break; case 300: + ixj_set_pots(board, 0); break; case 100: j->gpio.bytes.high = 0x0B; @@ -859,8 +1009,7 @@ j->gpio.bits.gpio2 = 1; j->gpio.bits.gpio5 = 0; ixj_WriteDSPCommand(j->gpio.word, board); /* send the ring signal */ - } else // Internet LineJACK, Internet PhoneJACK Lite or - // Internet PhoneJACK PCI + } else // Internet LineJACK, Internet PhoneJACK Lite or Internet PhoneJACK PCI { if (ixjdebug > 0) printk(KERN_INFO "IXJ Ring On /dev/phone%d\n", board); @@ -869,6 +1018,212 @@ } } +static int ixj_pcmcia_cable_check(int board) +{ + IXJ *j = &ixj[board]; + + j->pccr1.byte = inb_p(j->XILINXbase + 0x03); + if (!j->flags.pcmciastate) { + j->pccr2.byte = inb_p(j->XILINXbase + 0x02); + if (j->pccr1.bits.drf || j->pccr2.bits.rstc) { + j->flags.pcmciastate = 4; + return 0; + } + if (j->pccr1.bits.ed) { + j->pccr1.bits.ed = 0; + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 1; + outw_p(j->psccr.byte << 8, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(board); + j->pslic.byte = inw_p(j->XILINXbase + 0x00) & 0xFF; + j->pslic.bits.led2 = j->pslic.bits.det ? 1 : 0; + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 0; + outw_p(j->psccr.byte << 8 | j->pslic.byte, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(board); + return j->pslic.bits.led2 ? 1 : 0; + } else if (j->flags.pcmciasct) { + return j->r_hook; + } else { + return 1; + } + } else if (j->flags.pcmciastate == 4) { + if (!j->pccr1.bits.drf) { + j->flags.pcmciastate = 3; + } + return 0; + } else if (j->flags.pcmciastate == 3) { + j->pccr2.bits.pwr = 0; + j->pccr2.bits.rstc = 1; + outb_p(j->pccr2.byte, j->XILINXbase + 0x02); + j->checkwait = jiffies + hertz * 2; + j->flags.incheck = 1; + j->flags.pcmciastate = 2; + return 0; + } else if (j->flags.pcmciastate == 2) { + if (j->flags.incheck) { + if (time_before(jiffies, j->checkwait)) { + return 0; + } else { + j->flags.incheck = 0; + } + } + j->pccr2.bits.pwr = 0; + j->pccr2.bits.rstc = 0; + outb_p(j->pccr2.byte, j->XILINXbase + 0x02); + j->flags.pcmciastate = 1; + return 0; + } else if (j->flags.pcmciastate == 1) { + j->flags.pcmciastate = 0; + if (!j->pccr1.bits.drf) { + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 1; + outb_p(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->flags.pcmciascp = 1; // Set Cable Present Flag + + j->flags.pcmciasct = (inw_p(j->XILINXbase + 0x00) >> 8) & 0x03; // Get Cable Type + + if (j->flags.pcmciasct == 3) { + j->flags.pcmciastate = 4; + return 0; + } else if (j->flags.pcmciasct == 0) { + j->pccr2.bits.pwr = 1; + j->pccr2.bits.rstc = 0; + outb_p(j->pccr2.byte, j->XILINXbase + 0x02); + j->port = PORT_SPEAKER; + } else { + j->port = PORT_POTS; + } + j->sic1.bits.cpd = 0; // Chip Power Down + + j->sic1.bits.mpd = 0; // MIC Bias Power Down + + j->sic1.bits.hpd = 0; // Handset Bias Power Down + + j->sic1.bits.lpd = 0; // Line Bias Power Down + + j->sic1.bits.spd = 1; // Speaker Drive Power Down + + j->psccr.bits.addr = 1; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->sic1.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->sic2.bits.al = 0; // Analog Loopback DAC analog -> ADC analog + + j->sic2.bits.dl2 = 0; // Digital Loopback DAC -> ADC one bit + + j->sic2.bits.dl1 = 0; // Digital Loopback ADC -> DAC one bit + + j->sic2.bits.pll = 0; // 1 = div 10, 0 = div 5 + + j->sic2.bits.hpd = 0; // HPF disable + + j->psccr.bits.addr = 2; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->sic2.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->psccr.bits.addr = 3; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(0x00, j->XILINXbase + 0x00); // PLL Divide N1 + + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->psccr.bits.addr = 4; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(0x09, j->XILINXbase + 0x00); // PLL Multiply M1 + + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->sirxg.bits.lig = 1; // Line In Gain + + j->sirxg.bits.lim = 1; // Line In Mute + + j->sirxg.bits.mcg = 0; // MIC In Gain // was 3 + + j->sirxg.bits.mcm = 0; // MIC In Mute + + j->sirxg.bits.him = 0; // Handset In Mute + + j->sirxg.bits.iir = 1; // IIR + + j->psccr.bits.addr = 5; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->sirxg.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->siadc.bits.hom = 0; // Handset Out Mute + + j->siadc.bits.lom = 0; // Line Out Mute + + j->siadc.bits.rxg = 23; //(0xC000 - 0x41C8) / 0x4EF; // RX PGA Gain + + j->psccr.bits.addr = 6; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->siadc.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->sidac.bits.srm = 1; // Speaker Right Mute + + j->sidac.bits.slm = 1; // Speaker Left Mute + + j->sidac.bits.txg = (0xC000 - 0x45E4) / 0x5D3; // TX PGA Gain + + j->psccr.bits.addr = 7; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->sidac.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + j->siaatt.bits.sot = 0; + j->psccr.bits.addr = 9; // R/W Smart Cable Register Address + + j->psccr.bits.rw = 0; // Read / Write flag + + j->psccr.bits.dev = 0; + outb(j->siaatt.byte, j->XILINXbase + 0x00); + outb(j->psccr.byte, j->XILINXbase + 0x01); + ixj_PCcontrol_wait(board); + + if (j->flags.pcmciasct == 1 && !j->readers && !j->writers) { + j->psccr.byte = j->pslic.byte = 0; + j->pslic.bits.powerdown = 1; + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 0; + outw_p(j->psccr.byte << 8 | j->pslic.byte, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(board); + } + } + return 0; + } else { + j->flags.pcmciascp = 0; + return 0; + } + return 0; +} + static int ixj_hookstate(int board) { unsigned long det; @@ -885,12 +1240,9 @@ case 500: SLIC_GetState(board); if (j->pld_slicr.bits.state == PLD_SLIC_STATE_ACTIVE || - j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) - { - if (j->flags.ringing) - { - if(!in_interrupt()) - { + j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) { + if (j->flags.ringing) { + if (!in_interrupt()) { det = jiffies + (hertz / 50); while (time_before(jiffies, det)) { current->state = TASK_INTERRUPTIBLE; @@ -909,13 +1261,17 @@ fOffHook = j->pld_slicr.bits.det ? 1 : 0; } break; + case 600: + fOffHook = ixj_pcmcia_cable_check(board); + break; } if (j->r_hook != fOffHook) { j->r_hook = fOffHook; if (j->port != PORT_POTS) { j->ex.bits.hookstate = 1; - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of change - + ixj_kill_fasync(board, POLL_IN); + } else if (!fOffHook) { + j->flash_end = jiffies + (hertz / 10 * 6); } } if (j->port == PORT_PSTN && j->daa_mode == SOP_PU_CONVERSATION) @@ -927,7 +1283,10 @@ if (j->port == PORT_HANDSET) fOffHook |= 2; - return fOffHook; + if (fOffHook && time_before(jiffies, j->flash_end)) + return 0; + else + return fOffHook; } static void ixj_ring_off(board) @@ -949,7 +1308,7 @@ if (ixjdebug > 0) printk(KERN_INFO "IXJ Ring Off\n"); - SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); + SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); SLIC_GetState(board); } @@ -999,7 +1358,7 @@ } current->state = TASK_INTERRUPTIBLE; schedule_timeout(1); - if(signal_pending(current)) + if (signal_pending(current)) break; } jif = jiffies + (3 * hertz); @@ -1010,7 +1369,7 @@ while (time_before(jiffies, det)) { current->state = TASK_INTERRUPTIBLE; schedule_timeout(1); - if(signal_pending(current)) + if (signal_pending(current)) break; } if (ixj_hookstate(board) & 1) { @@ -1020,7 +1379,7 @@ } current->state = TASK_INTERRUPTIBLE; schedule_timeout(1); - if(signal_pending(current)) + if (signal_pending(current)) break; } } @@ -1031,39 +1390,70 @@ int ixj_open(struct phone_device *p, struct file *file_p) { - IXJ *j = &ixj[p->board]; + IXJ *j = file_p->private_data = &ixj[p->board]; if (!j->DSPbase) return -ENODEV; - if (file_p->f_mode & FMODE_READ) - j->readers++; - if (file_p->f_mode & FMODE_WRITE) - j->writers++; + if (file_p->f_mode & FMODE_READ) { + if(!j->readers) { + j->readers++; + } else { + return -EBUSY; + } + } + + if (file_p->f_mode & FMODE_WRITE) { + if(!j->writers) { + j->writers++; + } else { + if (file_p->f_mode & FMODE_READ){ + j->readers--; + } + return -EBUSY; + } + } + + if (j->cardtype == 600) { + j->pslic.bits.powerdown = 0; + j->psccr.bits.dev = 3; + j->psccr.bits.rw = 0; + outw_p(j->psccr.byte << 8 | j->pslic.byte, j->XILINXbase + 0x00); + ixj_PCcontrol_wait(p->board); + } + MOD_INC_USE_COUNT; if (ixjdebug > 0) -// printk(KERN_INFO "Opening board %d\n", NUM(inode->i_rdev)); printk(KERN_INFO "Opening board %d\n", p->board); + j->framesread = j->frameswritten = 0; return 0; } int ixj_release(struct inode *inode, struct file *file_p) { IXJ_TONE ti; - int board = NUM(inode->i_rdev); - IXJ *j = &ixj[board]; +// int board = NUM(inode->i_rdev); + IXJ *j = file_p->private_data; + int board = j->p.board; +// IXJ *j = &ixj[board]; if (ixjdebug > 0) printk(KERN_INFO "Closing board %d\n", NUM(inode->i_rdev)); - lock_kernel(); daa_set_mode(board, SOP_PU_SLEEP); - ixj_set_port(board, PORT_POTS); + if (j->cardtype == 600) + ixj_set_port(board, PORT_SPEAKER); + else + ixj_set_port(board, PORT_POTS); aec_stop(board); ixj_play_stop(board); ixj_record_stop(board); + set_play_volume(board, 0x100); + set_rec_volume(board, 0x100); + ixj_ring_off(board); + // Restore the tone table to default settings. ti.tone_index = 10; ti.gain0 = 1; ti.freq0 = hz941; @@ -1172,6 +1562,10 @@ idle(board); +// if(j->cardtype == 600) { // && j->flags.pcmciasct == 1 && j->readers == 1 && j->writers == 1) { + SLIC_SetState(PLD_SLIC_STATE_OC, board); +// } + if (file_p->f_mode & FMODE_READ) j->readers--; if (file_p->f_mode & FMODE_WRITE) @@ -1189,15 +1583,24 @@ } j->rec_codec = j->play_codec = 0; j->rec_frame_size = j->play_frame_size = 0; + j->flags.cidsent = j->flags.cidring = 0; ixj_fasync(-1, file_p, 0); // remove from list of async notification - unlock_kernel(); + if(j->cardtype == 300 && !j->readers && !j->writers) { + ixj_set_port(board, PORT_PSTN); + ixj_set_pots(board, 1); + } + ixj_WriteDSPCommand(0x0FE3, board); // Put the DSP in 1/5 power mode. + + file_p->private_data = NULL; + MOD_DEC_USE_COUNT; return 0; } static int read_filters(int board) { unsigned short fc, cnt; + int var; IXJ *j = &ixj[board]; if (ixj_WriteDSPCommand(0x5144, board)) @@ -1209,6 +1612,11 @@ j->frame_count = fc; + if (j->dtmf_proc) + return 1; + + var = 10; + for (cnt = 0; cnt < 4; cnt++) { if (ixj_WriteDSPCommand(0x5154 + cnt, board)) return -1; @@ -1217,8 +1625,108 @@ return -1; j->filter_hist[cnt] = j->ssr.high << 8 | j->ssr.low; - if ((j->filter_hist[cnt] & 1 && !(j->filter_hist[cnt] & 2)) || - (j->filter_hist[cnt] & 2 && !(j->filter_hist[cnt] & 1))) { + + if (j->cadence_f[cnt].enable) { + if (j->filter_hist[cnt] & 3 && !(j->filter_hist[cnt] & 12)) { + if (j->cadence_f[cnt].state == 0) { + j->cadence_f[cnt].state = 1; + j->cadence_f[cnt].on1min = jiffies + (j->cadence_f[cnt].on1 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].on1dot = jiffies + (j->cadence_f[cnt].on1 * hertz * (100) / 10000); + j->cadence_f[cnt].on1max = jiffies + (j->cadence_f[cnt].on1 * hertz * (100 + var) / 10000); + } else if (j->cadence_f[cnt].state == 2 && + (time_after(jiffies, j->cadence_f[cnt].off1min) && + time_before(jiffies, j->cadence_f[cnt].off1max))) { + if (j->cadence_f[cnt].on2) { + j->cadence_f[cnt].state = 3; + j->cadence_f[cnt].on2min = jiffies + (j->cadence_f[cnt].on2 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].on2dot = jiffies + (j->cadence_f[cnt].on2 * hertz * (100) / 10000); + j->cadence_f[cnt].on2max = jiffies + (j->cadence_f[cnt].on2 * hertz * (100 + var) / 10000); + } else { + j->cadence_f[cnt].state = 6; + } + } else if (j->cadence_f[cnt].state == 4 && + (time_after(jiffies, j->cadence_f[cnt].off2min) && + time_before(jiffies, j->cadence_f[cnt].off2max))) { + if (j->cadence_f[cnt].on2) { + j->cadence_f[cnt].state = 5; + j->cadence_f[cnt].on3min = jiffies + (j->cadence_f[cnt].on3 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].on3dot = jiffies + (j->cadence_f[cnt].on3 * hertz * (100) / 10000); + j->cadence_f[cnt].on3max = jiffies + (j->cadence_f[cnt].on3 * hertz * (100 + var) / 10000); + } else { + j->cadence_f[cnt].state = 6; + } + } else { + j->cadence_f[cnt].state = 0; + } + } else if (j->filter_hist[cnt] & 12 && !(j->filter_hist[cnt] & 3)) { + if (j->cadence_f[cnt].state == 1 && + (time_after(jiffies, j->cadence_f[cnt].on1min) && + time_before(jiffies, j->cadence_f[cnt].on1max))) { + j->cadence_f[cnt].state = 2; + j->cadence_f[cnt].off1min = jiffies + (j->cadence_f[cnt].off1 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].off1max = jiffies + (j->cadence_f[cnt].off1 * hertz * (100 + var) / 10000); + } else if (j->cadence_f[cnt].state == 3 && + (time_after(jiffies, j->cadence_f[cnt].on2min) && + time_before(jiffies, j->cadence_f[cnt].on2max))) { + j->cadence_f[cnt].state = 4; + j->cadence_f[cnt].off2min = jiffies + (j->cadence_f[cnt].off2 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].off2max = jiffies + (j->cadence_f[cnt].off2 * hertz * (100 + var) / 10000); + } else if (j->cadence_f[cnt].state == 5 && + (time_after(jiffies, j->cadence_f[cnt].on3min) && + time_before(jiffies, j->cadence_f[cnt].on3max))) { + j->cadence_f[cnt].state = 6; + j->cadence_f[cnt].off3min = jiffies + (j->cadence_f[cnt].off3 * hertz * (100 - var) / 10000); + j->cadence_f[cnt].off3max = jiffies + (j->cadence_f[cnt].off3 * hertz * (100 + var) / 10000); + } else { + j->cadence_f[cnt].state = 0; + } + } else { + switch(j->cadence_f[cnt].state) { + case 1: + if(time_after(jiffies, j->cadence_f[cnt].on1dot) && + !j->cadence_f[cnt].off1 && + !j->cadence_f[cnt].on2 && !j->cadence_f[cnt].off2 && + !j->cadence_f[cnt].on3 && !j->cadence_f[cnt].off3) { + j->cadence_f[cnt].state = 6; + } + break; + case 3: + if(time_after(jiffies, j->cadence_f[cnt].on2dot) && + !j->cadence_f[cnt].off2 && + !j->cadence_f[cnt].on3 && !j->cadence_f[cnt].off3) { + j->cadence_f[cnt].state = 6; + } + break; + case 5: + if(time_after(jiffies, j->cadence_f[cnt].on3dot) && + !j->cadence_f[cnt].off3) { + j->cadence_f[cnt].state = 6; + } + break; + } + } + } + if (j->cadence_f[cnt].state == 6) { + j->cadence_f[cnt].state = 0; + if (j->cadence_f[cnt].enable == 1) + j->cadence_f[cnt].enable = 0; + switch (cnt) { + case 0: + j->ex.bits.fc0 = 1; + break; + case 1: + j->ex.bits.fc1 = 1; + break; + case 2: + j->ex.bits.fc2 = 1; + break; + case 3: + j->ex.bits.fc3 = 1; + break; + } + } + if (j->filter_en[cnt] && ((j->filter_hist[cnt] & 3 && !(j->filter_hist[cnt] & 12)) || + (j->filter_hist[cnt] & 12 && !(j->filter_hist[cnt] & 3)))) { switch (cnt) { case 0: j->ex.bits.f0 = 1; @@ -1259,11 +1767,16 @@ } if (j->dtmf_state && !j->dtmf.bits.dtmf_valid) // && j->dtmf_wp != j->dtmf_rp) { - j->dtmfbuffer[j->dtmf_wp] = j->dtmf_current; - j->dtmf_wp++; - if (j->dtmf_wp == 79) - j->dtmf_wp = 0; - j->ex.bits.dtmf_ready = 1; + if(!j->flags.cidplay) { + j->dtmfbuffer[j->dtmf_wp] = j->dtmf_current; + j->dtmf_wp++; + if (j->dtmf_wp == 79) + j->dtmf_wp = 0; + j->ex.bits.dtmf_ready = 1; + } + else if(j->dtmf_current == 25 || j->dtmf_current == 31) { + j->flags.cidcw_ack = 1; + } j->dtmf_state = 0; } j->dtmf_proc = 0; @@ -1277,26 +1790,38 @@ IXJ *j = &ixj[NUM(file_p->f_dentry->d_inode->i_rdev)]; DECLARE_WAITQUEUE(wait, current); + if (j->flags.inread) + return -EALREADY; + + j->flags.inread = 1; + add_wait_queue(&j->read_q, &wait); current->state = TASK_INTERRUPTIBLE; mb(); while (!j->read_buffer_ready || (j->dtmf_state && j->flags.dtmf_oob)) { ++j->read_wait; + if(j->tone_state) { + j->flags.inread = 0; + return -EAGAIN; + } if (file_p->f_flags & O_NONBLOCK) { current->state = TASK_RUNNING; remove_wait_queue(&j->read_q, &wait); + j->flags.inread = 0; return -EAGAIN; } if (!ixj_hookstate(NUM(file_p->f_dentry->d_inode->i_rdev))) { current->state = TASK_RUNNING; remove_wait_queue(&j->read_q, &wait); + j->flags.inread = 0; return 0; } interruptible_sleep_on(&j->read_q); if (signal_pending(current)) { current->state = TASK_RUNNING; remove_wait_queue(&j->read_q, &wait); + j->flags.inread = 0; return -EINTR; } } @@ -1306,10 +1831,13 @@ /* Don't ever copy more than the user asks */ i = copy_to_user(buf, j->read_buffer, min(length, j->read_buffer_size)); j->read_buffer_ready = 0; - if (i) + if (i) { + j->flags.inread = 0; return -EFAULT; - else + } else { + j->flags.inread = 0; return min(length, j->read_buffer_size); + } } ssize_t ixj_enhanced_read(struct file * file_p, char *buf, size_t length, @@ -1337,50 +1865,62 @@ return read_retval; } -ssize_t ixj_write(struct file * file_p, const char *buf, size_t count, loff_t * ppos) +ssize_t ixj_write(struct file *file_p, const char *buf, size_t count, loff_t * ppos) { unsigned long i = *ppos; - int board = NUM(file_p->f_dentry->d_inode->i_rdev); - IXJ *j = &ixj[board]; + IXJ *j = file_p->private_data; DECLARE_WAITQUEUE(wait, current); - add_wait_queue(&j->read_q, &wait); + if (j->flags.inwrite) + return -EALREADY; + + j->flags.inwrite = 1; + + add_wait_queue(&j->write_q, &wait); current->state = TASK_INTERRUPTIBLE; mb(); while (!j->write_buffers_empty) { ++j->write_wait; + if(j->tone_state) { + j->flags.inwrite = 0; + return -EAGAIN; + } if (file_p->f_flags & O_NONBLOCK) { current->state = TASK_RUNNING; - remove_wait_queue(&j->read_q, &wait); + remove_wait_queue(&j->write_q, &wait); + j->flags.inwrite = 0; return -EAGAIN; } if (!ixj_hookstate(NUM(file_p->f_dentry->d_inode->i_rdev))) { current->state = TASK_RUNNING; - remove_wait_queue(&j->read_q, &wait); + remove_wait_queue(&j->write_q, &wait); + j->flags.inwrite = 0; return 0; } interruptible_sleep_on(&j->write_q); if (signal_pending(current)) { current->state = TASK_RUNNING; - remove_wait_queue(&j->read_q, &wait); + remove_wait_queue(&j->write_q, &wait); + j->flags.inwrite = 0; return -EINTR; } } current->state = TASK_RUNNING; - remove_wait_queue(&j->read_q, &wait); + remove_wait_queue(&j->write_q, &wait); if (j->write_buffer_wp + count >= j->write_buffer_end) j->write_buffer_wp = j->write_buffer; i = copy_from_user(j->write_buffer_wp, buf, min(count, j->write_buffer_size)); - if (i) + if (i) { + j->flags.inwrite = 0; return -EFAULT; - + } + j->flags.inwrite = 0; return min(count, j->write_buffer_size); } -ssize_t ixj_enhanced_write(struct file * file_p, const char *buf, size_t count, - loff_t * ppos) +ssize_t ixj_enhanced_write(struct file * file_p, const char *buf, size_t count, loff_t * ppos) { int pre_retval; ssize_t write_retval = 0; @@ -1437,9 +1977,7 @@ *(j->read_buffer + cnt) = inb_p(j->DSPbase + 0x0E); *(j->read_buffer + cnt + 1) = inb_p(j->DSPbase + 0x0F); } -#ifdef PERFMON_STATS ++j->framesread; -#endif if (j->intercom != -1) { if (IsTxReady(j->intercom)) { for (cnt = 0; cnt < j->rec_frame_size * 2; cnt += 2) { @@ -1456,9 +1994,7 @@ outb_p(*(j->read_buffer + cnt), ixj[j->intercom].DSPbase + 0x0C); outb_p(*(j->read_buffer + cnt + 1), ixj[j->intercom].DSPbase + 0x0D); } -#ifdef PERFMON_STATS ++ixj[j->intercom].frameswritten; -#endif } } else { j->read_buffer_ready = 1; @@ -1466,12 +2002,472 @@ wake_up_interruptible(&j->poll_q); // Wake any blocked selects - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of frame + ixj_kill_fasync(board, POLL_OUT); + } + } +} +static short fsk[][6][20] = +{ + { + { + 0, 17846, 29934, 32364, 24351, 8481, -10126, -25465, -32587, -29196, + -16384, 1715, 19260, 30591, 32051, 23170, 6813, -11743, -26509, -32722 + }, + { + -28377, -14876, 3425, 20621, 31163, 31650, 21925, 5126, -13328, -27481, + -32767, -27481, -13328, 5126, 21925, 31650, 31163, 20621, 3425, -14876 + }, + { + -28377, -32722, -26509, -11743, 6813, 23170, 32051, 30591, 19260, 1715, + -16384, -29196, -32587, -25465, -10126, 8481, 24351, 32364, 29934, 17846 + }, + { + 0, -17846, -29934, -32364, -24351, -8481, 10126, 25465, 32587, 29196, + 16384, -1715, -19260, -30591, -32051, -23170, -6813, 11743, 26509, 32722 + }, + { + 28377, 14876, -3425, -20621, -31163, -31650, -21925, -5126, 13328, 27481, + 32767, 27481, 13328, -5126, -21925, -31650, -31163, -20621, -3425, 14876 + }, + { + 28377, 32722, 26509, 11743, -6813, -23170, -32051, -30591, -19260, -1715, + 16384, 29196, 32587, 25465, 10126, -8481, -24351, -32364, -29934, -17846 + } + }, + { + { + 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126, + 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126 + }, + { + -28377, -21925, -13328, -3425, 6813, 16384, 24351, 29934, 32587, 32051, + 28377, 21925, 13328, 3425, -6813, -16384, -24351, -29934, -32587, -32051 + }, + { + -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925, + 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925 + }, + { + 0, -10126, -19260, -26509, -31163, -32767, -31163, -26509, -19260, -10126, + 0, 10126, 19260, 26509, 31163, 32767, 31163, 26509, 19260, 10126 + }, + { + 28377, 21925, 13328, 3425, -6813, -16383, -24351, -29934, -32587, -32051, + -28377, -21925, -13328, -3425, 6813, 16383, 24351, 29934, 32587, 32051 + }, + { + 28377, 32051, 32587, 29934, 24351, 16384, 6813, -3425, -13328, -21925, + -28377, -32051, -32587, -29934, -24351, -16384, -6813, 3425, 13328, 21925 + } + } +}; + + +static void ixj_write_cid_bit(int board, int bit) +{ + int dly; + IXJ_WORD dat; + IXJ *j = &ixj[board]; + + while (j->fskcnt < 20) { + if (!IsTxReady(board)) { + dly = 0; + while (!IsTxReady(board)) { + if (dly++ > 5) { + dly = 0; + // break; + // printk("CID delay\n"); + } + udelay(10); + } } + dat.word = j->fskdata[j->fskdcnt++] = + fsk[bit][j->fskz][j->fskcnt]; + outb_p(dat.bytes.low, j->DSPbase + 0x0C); + outb_p(dat.bytes.high, j->DSPbase + 0x0D); + j->fskcnt += 3; + } + j->fskcnt %= 20; + + if (!bit) + j->fskz++; + if (j->fskz >= 6) + j->fskz = 0; + +} + +static void ixj_write_cid_byte(int board, char byte) +{ + IXJ_CBYTE cb; + +// printk("Writing CID data %x - %c\n", byte, byte); + cb.cbyte = byte; + ixj_write_cid_bit(board, 0); + ixj_write_cid_bit(board, cb.cbits.b0 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b1 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b2 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b3 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b4 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b5 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b6 ? 1 : 0); + ixj_write_cid_bit(board, cb.cbits.b7 ? 1 : 0); + ixj_write_cid_bit(board, 1); +} + +static void ixj_write_cid_seize(int board) +{ + int cnt; + + for (cnt = 0; cnt < 150; cnt++) { + ixj_write_cid_bit(board, 0); + ixj_write_cid_bit(board, 1); + } + for (cnt = 0; cnt < 180; cnt++) { + ixj_write_cid_bit(board, 1); + } +} + +static void ixj_write_cidcw_seize(int board) +{ + int cnt; + + for (cnt = 0; cnt < 80; cnt++) { + ixj_write_cid_bit(board, 1); + } +} + +static int ixj_write_cid_string(int board, char *s, int checksum) +{ + int cnt; + + for (cnt = 0; cnt < strlen(s); cnt++) { + ixj_write_cid_byte(board, s[cnt]); + checksum = (checksum + s[cnt]); + } + return checksum; +} + +static void ixj_pad_fsk(int board, int pad) +{ + int cnt, dly; + IXJ *j = &ixj[board]; + + for (cnt = 0; cnt < pad; cnt++) { + if (!IsTxReady(board)) { + dly = 0; + while (!IsTxReady(board)) { + if (dly++ > 5) { + dly = 0; + } + udelay(10); + } + } + outb_p(0x00, j->DSPbase + 0x0C); + outb_p(0x00, j->DSPbase + 0x0D); + } + for (cnt = 0; cnt < 720; cnt++) { + if (!IsTxReady(board)) { + dly = 0; + while (!IsTxReady(board)) { + if (dly++ > 5) { + dly = 0; + } + udelay(10); + } + } + outb_p(0x00, j->DSPbase + 0x0C); + outb_p(0x00, j->DSPbase + 0x0D); } } +static void ixj_write_cid(int board) +{ + IXJ *j = &ixj[board]; + + char sdmf1[50]; + char sdmf2[50]; + char sdmf3[80]; + char mdmflen, len1, len2, len3; + int pad; + + int checksum = 0; + + if (ixj[board].dsp.low == 0x20) + return; + + ixj[board].fskz = ixj[board].fskphase = ixj[board].fskcnt = + ixj[board].fskdcnt = 0; + + ixj[board].flags.cidplay = 1; + + strcpy(sdmf1, j->cid_send.month); + strcat(sdmf1, j->cid_send.day); + strcat(sdmf1, j->cid_send.hour); + strcat(sdmf1, j->cid_send.min); + strcpy(sdmf2, j->cid_send.number); + strcpy(sdmf3, j->cid_send.name); + + len1 = strlen(sdmf1); + len2 = strlen(sdmf2); + len3 = strlen(sdmf3); + mdmflen = len1 + len2 + len3 + 6; + + printk("CID Lengths = %d %d %d %d\n", len1, len2, len3, mdmflen); + + set_base_frame(board, 30); + set_play_codec(board, LINEAR16); + + if (ixj[board].port == PORT_POTS) + if(!j->r_hook) + SLIC_SetState(PLD_SLIC_STATE_OHT, board); + + set_play_volume(board, 0x1B); + ixj_play_start(board); + ixj_write_cid_seize(board); + + ixj_write_cid_byte(board, 0x80); + checksum = 0x80; + ixj_write_cid_byte(board, mdmflen); + checksum = checksum + mdmflen; + + ixj_write_cid_byte(board, 0x01); + checksum = checksum + 0x01; + ixj_write_cid_byte(board, len1); + checksum = checksum + len1; + checksum = ixj_write_cid_string(board, sdmf1, checksum); + + ixj_write_cid_byte(board, 0x02); + checksum = checksum + 0x02; + ixj_write_cid_byte(board, len2); + checksum = checksum + len2; + checksum = ixj_write_cid_string(board, sdmf2, checksum); + + ixj_write_cid_byte(board, 0x07); + checksum = checksum + 0x07; + ixj_write_cid_byte(board, len3); + checksum = checksum + len3; + checksum = ixj_write_cid_string(board, sdmf3, checksum); + + checksum %= 256; + checksum ^= 0xFF; + checksum += 1; + printk("14Checksum = %d\n", checksum); + + ixj_write_cid_byte(board, (char) checksum); + + pad = j->fskdcnt % 240; + if (pad) { + pad = 240 - pad; + } + ixj_pad_fsk(board, pad); + SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); + ixj[board].flags.cidplay = 0; + ixj_play_stop(board); +} + +static void ixj_write_cidcw(int board) +{ + IXJ_TONE ti; + + IXJ *j = &ixj[board]; + + char sdmf1[50]; + char sdmf2[50]; + char sdmf3[80]; + char mdmflen, len1, len2, len3; + int pad; + + int checksum = 0; + + if (ixj[board].dsp.low == 0x20) + return; + + ixj[board].fskz = ixj[board].fskphase = ixj[board].fskcnt = ixj[board].fskdcnt = 0; + + ixj[board].flags.cidplay = 1; + + ti.tone_index = 23; + ti.gain0 = 1; + ti.freq0 = hz440; + ti.gain1 = 0; + ti.freq1 = 0; + ixj_init_tone(board, &ti); + + ti.tone_index = 24; + ti.gain0 = 1; + ti.freq0 = hz2130; + ti.gain1 = 0; + ti.freq1 = hz2750; + ixj_init_tone(board, &ti); + + ixj_set_tone_on(1200, board); + ixj_play_tone(board, 23); + + while(j->tone_state) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } + + ixj_set_tone_on(320, board); + ixj_play_tone(board, 24); + + while(j->tone_state) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } + + j->cidcw_wait = jiffies + (200 * hertz / 100000); + + while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait)) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } + + if(!j->flags.cidcw_ack) { + return; + } + + strcpy(sdmf1, j->cid_send.month); + strcat(sdmf1, j->cid_send.day); + strcat(sdmf1, j->cid_send.hour); + strcat(sdmf1, j->cid_send.min); + strcpy(sdmf2, j->cid_send.number); + strcpy(sdmf3, j->cid_send.name); + + len1 = strlen(sdmf1); + len2 = strlen(sdmf2); + len3 = strlen(sdmf3); + mdmflen = len1 + len2 + len3 + 6; + + printk("CID Lengths = %d %d %d %d\n", len1, len2, len3, mdmflen); + + j->cid_play_codec = j->play_codec; + ixj_play_stop(board); + + switch(j->baseframe.low) { + case 0xA0: + j->cid_base_frame_size = 20; + break; + case 0x50: + j->cid_base_frame_size = 10; + break; + default: + j->cid_base_frame_size = 30; + break; + } + set_base_frame(board, 30); + set_play_codec(board, LINEAR16); + + set_play_volume(board, 0x1B); + ixj_play_start(board); + ixj_write_cidcw_seize(board); + + ixj_write_cid_byte(board, 0x80); + checksum = 0x80; + ixj_write_cid_byte(board, mdmflen); + checksum = checksum + mdmflen; + + ixj_write_cid_byte(board, 0x01); + checksum = checksum + 0x01; + ixj_write_cid_byte(board, len1); + checksum = checksum + len1; + checksum = ixj_write_cid_string(board, sdmf1, checksum); + + ixj_write_cid_byte(board, 0x02); + checksum = checksum + 0x02; + ixj_write_cid_byte(board, len2); + checksum = checksum + len2; + checksum = ixj_write_cid_string(board, sdmf2, checksum); + + ixj_write_cid_byte(board, 0x07); + checksum = checksum + 0x07; + ixj_write_cid_byte(board, len3); + checksum = checksum + len3; + checksum = ixj_write_cid_string(board, sdmf3, checksum); + + checksum %= 256; + checksum ^= 0xFF; + checksum += 1; + printk("14Checksum = %d\n", checksum); + + ixj_write_cid_byte(board, (char) checksum); + + pad = j->fskdcnt % 240; + if (pad) { + pad = 240 - pad; + } + ixj_pad_fsk(board, pad); + ixj[board].flags.cidplay = 0; + ixj_play_stop(board); + + set_base_frame(board, j->cid_base_frame_size); + set_play_codec(board, j->cid_play_codec); +} + +static void ixj_write_vmwi(int board, int msg) +{ + IXJ *j = &ixj[board]; + + char mdmflen; + int pad; + + int checksum = 0; + + if (ixj[board].dsp.low == 0x20) + return; + + ixj[board].fskz = ixj[board].fskphase = ixj[board].fskcnt = ixj[board].fskdcnt = 0; + + ixj[board].flags.cidplay = 1; + + mdmflen = 3; + + set_base_frame(board, 30); + set_play_codec(board, LINEAR16); + + if (ixj[board].port == PORT_POTS) + SLIC_SetState(PLD_SLIC_STATE_OHT, board); + + set_play_volume(board, 0x1B); + ixj_play_start(board); + ixj_write_cid_seize(board); + + ixj_write_cid_byte(board, 0x82); + checksum = 0x82; + ixj_write_cid_byte(board, mdmflen); + checksum = checksum + mdmflen; + + ixj_write_cid_byte(board, 0x0B); + checksum = checksum + 0x0B; + ixj_write_cid_byte(board, 1); + checksum = checksum + 1; + + if(msg) { + ixj_write_cid_byte(board, 0xFF); + checksum = checksum + 0xFF; + } + else { + ixj_write_cid_byte(board, 0x00); + checksum = checksum + 0x00; + } + + checksum %= 256; + checksum ^= 0xFF; + checksum += 1; + + ixj_write_cid_byte(board, (char) checksum); + + pad = j->fskdcnt % 240; + if (pad) { + pad = 240 - pad; + } + ixj_pad_fsk(board, pad); + SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); + ixj[board].flags.cidplay = 0; + ixj_play_stop(board); +} + static void ixj_write_frame(int board) { int cnt, frame_count, dly; @@ -1547,14 +2543,12 @@ j->write_buffer_rp = j->write_buffer; } j->write_buffers_empty++; - wake_up_interruptible(&(j->write_q)); // Wake any blocked writers + wake_up_interruptible(&j->write_q); // Wake any blocked writers wake_up_interruptible(&j->poll_q); // Wake any blocked selects - kill_fasync(&j->async_queue, SIGIO, POLL_IN); // Send apps notice of empty buffer -#ifdef PERFMON_STATS + ixj_kill_fasync(board, POLL_OUT); ++j->frameswritten; -#endif } } else { j->drybuffer++; @@ -1787,6 +2781,12 @@ unsigned short cmd = 0x0000; IXJ *j = &ixj[board]; + if (j->read_buffer) { + ixj_record_stop(board); + } + j->flags.recording = 1; + ixj_WriteDSPCommand(0x0FE0, board); // Put the DSP in full power mode. + if (!j->rec_mode) { switch (j->rec_codec) { case G723_63: @@ -1885,10 +2885,26 @@ { IXJ *j = &ixj[board]; + if (j->read_buffer) { + kfree(j->read_buffer); + j->read_buffer = NULL; + j->read_buffer_size = 0; + } if (j->rec_mode > -1) { ixj_WriteDSPCommand(0x5120, board); j->rec_mode = -1; } + j->flags.recording = 0; + if (!j->flags.playing) + ixj_WriteDSPCommand(0x0FE3, board); // Put the DSP in 1/5 power mode. + +} +static void ixj_vad(int board, int arg) +{ + if (arg) + ixj_WriteDSPCommand(0x513F, board); + else + ixj_WriteDSPCommand(0x513E, board); } static void set_rec_depth(int board, int depth) @@ -1906,13 +2922,23 @@ ixj_WriteDSPCommand(volume, board); } +static int get_rec_volume(int board) +{ + ixj_WriteDSPCommand(0xCF03, board); + return ixj[board].ssr.high << 8 | ixj[board].ssr.low; +} + static int get_rec_level(int board) { + int retval; + IXJ *j = &ixj[board]; ixj_WriteDSPCommand(0xCF88, board); - return j->ssr.high << 8 | j->ssr.low; + retval = j->ssr.high << 8 | j->ssr.low; + retval = (retval * 256) / 240; + return retval; } static void ixj_aec_start(int board, int level) @@ -1921,7 +2947,7 @@ j->aec_level = level; if (!level) { - ixj_WriteDSPCommand(0xB002, board); + aec_stop(board); } else { if (j->rec_codec == G729 || j->play_codec == G729) { ixj_WriteDSPCommand(0xE022, board); // Move AEC filter buffer @@ -1933,26 +2959,41 @@ ixj_WriteDSPCommand(0xE013, board); // Advanced AEC C1 switch (level) { - case 1: + case AEC_LOW: ixj_WriteDSPCommand(0x0000, board); // Advanced AEC C2 = off ixj_WriteDSPCommand(0xE011, board); ixj_WriteDSPCommand(0xFFFF, board); break; - case 2: + case AEC_MED: ixj_WriteDSPCommand(0x0600, board); // Advanced AEC C2 = on medium ixj_WriteDSPCommand(0xE011, board); ixj_WriteDSPCommand(0x0080, board); break; - case 3: + case AEC_HIGH: ixj_WriteDSPCommand(0x0C00, board); // Advanced AEC C2 = on high ixj_WriteDSPCommand(0xE011, board); ixj_WriteDSPCommand(0x0080, board); break; + + case AEC_AUTO: + ixj_WriteDSPCommand(0x0002, board); // Attenuation scaling factor of 2 + + ixj_WriteDSPCommand(0xE011, board); + ixj_WriteDSPCommand(0x0100, board); // Higher Threshold Floor + + ixj_WriteDSPCommand(0xE012, board); // Set Train and Lock + + ixj_WriteDSPCommand(0x0023, board); + + ixj_WriteDSPCommand(0xE014, board); + ixj_WriteDSPCommand(0x0003, board); // Lock threashold at 3dB + + break; } } } @@ -2140,6 +3181,12 @@ unsigned short cmd = 0x0000; IXJ *j = &ixj[board]; + if (j->write_buffer) { + ixj_play_stop(board); + } + j->flags.playing = 1; + ixj_WriteDSPCommand(0x0FE0, board); // Put the DSP in full power mode. + j->flags.play_first_frame = 1; j->drybuffer = 0; @@ -2175,12 +3222,10 @@ if (ixj_WriteDSPCommand(cmd, board)) return -1; } + j->write_buffer = kmalloc(j->play_frame_size * 2, GFP_ATOMIC); if (!j->write_buffer) { - j->write_buffer = kmalloc(j->play_frame_size * 2, GFP_ATOMIC); - if (!j->write_buffer) { - printk("Write buffer allocation for ixj board %d failed!\n", board); - return -ENOMEM; - } + printk("Write buffer allocation for ixj board %d failed!\n", board); + return -ENOMEM; } j->write_buffers_empty = 2; j->write_buffer_size = j->play_frame_size * 2; @@ -2242,11 +3287,20 @@ { IXJ *j = &ixj[board]; + if (j->write_buffer) { + kfree(j->write_buffer); + j->write_buffer = NULL; + j->write_buffer_size = 0; + } if (j->play_mode > -1) { - ixj_WriteDSPCommand(0x5221, board); // Stop playback + ixj_WriteDSPCommand(0x5221, board); // Stop playback and flush buffers. 8022 reference page 9-40 j->play_mode = -1; } + j->flags.playing = 0; + if (!j->flags.recording) + ixj_WriteDSPCommand(0x0FE3, board); // Put the DSP in 1/5 power mode. + } extern __inline__ void set_play_depth(int board, int depth) @@ -2258,16 +3312,15 @@ ixj_WriteDSPCommand(0x5280 + depth, board); } -extern __inline__ void set_play_volume(int board, int volume) -{ - ixj_WriteDSPCommand(0xCF02, board); - ixj_WriteDSPCommand(volume, board); -} - extern __inline__ int get_play_level(int board) { - ixj_WriteDSPCommand(0xCF8F, board); + int retval; + + ixj_WriteDSPCommand(0xCF8F, board); // 8022 Reference page 9-38 return ixj[board].ssr.high << 8 | ixj[board].ssr.low; + retval = ixj[board].ssr.high << 8 | ixj[board].ssr.low; + retval = (retval * 256) / 240; + return retval; } static unsigned int ixj_poll(struct file *file_p, poll_table * wait) @@ -2476,6 +3529,8 @@ break; } + j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = reg; + switch (j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.bitreg.AGX) { case 0: j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.bitreg.AGR_Z = 0; @@ -2645,7 +3700,7 @@ } pIn += 5, pOut += 4; } - memset(&j->cid, 0, sizeof(IXJ_CID)); + memset(&j->cid, 0, sizeof(PHONE_CID)); pOut = j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID; pOut += 4; strncpy(j->cid.month, pOut, 2); @@ -2721,15 +3776,27 @@ // ALIS-A part. // - BYTES bytes; IXJ *j = &ixj[board]; if (!SCI_Prepare(board)) return 0; - switch (mode) { - case SOP_PU_SLEEP: + switch (mode) { + case SOP_PU_SLEEP: + if(j->daa_mode == SOP_PU_CONVERSATION) + { + j->pld_scrw.bits.daafsyncen = 0; // Turn off DAA Frame Sync + + outb_p(j->pld_scrw.byte, j->XILINXbase); + j->pld_slicw.bits.rly2 = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + bytes.high = 0x10; + bytes.low = j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg; + daa_load(&bytes, board); + if (!SCI_Prepare(board)) + return 0; + } j->pld_scrw.bits.daafsyncen = 0; // Turn off DAA Frame Sync outb_p(j->pld_scrw.byte, j->XILINXbase); @@ -2740,10 +3807,15 @@ daa_load(&bytes, board); if (!SCI_Prepare(board)) return 0; + j->daa_mode = SOP_PU_SLEEP; j->flags.pstn_ringing = 0; - j->pstn_sleeptil = jiffies + (hertz * 3); - break; + j->ex.bits.pstn_ring = 0; + j->pstn_sleeptil = jiffies + (hertz / 2); + wake_up_interruptible(&j->read_q); // Wake any blocked readers + wake_up_interruptible(&j->write_q); // Wake any blocked writers + wake_up_interruptible(&j->poll_q); // Wake any blocked selects + break; case SOP_PU_RINGING: j->pld_scrw.bits.daafsyncen = 0; // Turn off DAA Frame Sync @@ -3281,14 +4353,11 @@ int ixj_set_tone_off(unsigned short arg, int board) { ixj[board].tone_off_time = arg; - if (ixj_WriteDSPCommand(0x6E05, board)) // Set Tone Off Period return -1; - if (ixj_WriteDSPCommand(arg, board)) return -1; - return 0; } @@ -3297,7 +4366,6 @@ if (ixj_WriteDSPCommand(0x6E06, board)) // Get Tone On Period return -1; - return 0; } @@ -3306,7 +4374,6 @@ if (ixj_WriteDSPCommand(0x6E07, board)) // Get Tone Off Period return -1; - return 0; } @@ -3315,7 +4382,6 @@ ixj[board].flags.ringback = 0; ixj[board].flags.dialtone = 0; ixj[board].flags.busytone = 1; - ixj_set_tone_on(0x07D0, board); ixj_set_tone_off(0x07D0, board); ixj_play_tone(board, 27); @@ -3326,13 +4392,11 @@ ixj[board].flags.ringback = 0; ixj[board].flags.dialtone = 1; ixj[board].flags.busytone = 0; - if (ixj[board].dsp.low == 0x20) { return; } else { ixj_set_tone_on(0xFFFF, board); ixj_set_tone_off(0x0000, board); - ixj_play_tone(board, 25); } } @@ -3340,28 +4404,24 @@ static void ixj_cpt_stop(board) { IXJ *j = &ixj[board]; - - j->flags.dialtone = 0; - j->flags.busytone = 0; - j->flags.ringback = 0; - - ixj_set_tone_on(0x0001, board); - ixj_set_tone_off(0x0000, board); - - ixj_play_tone(board, 0); - - j->tone_state = 0; - - ixj_del_timer(); - if (j->cadence_t) { - if (j->cadence_t->ce) { - kfree(j->cadence_t->ce); + if(j->tone_state) + { + j->flags.dialtone = 0; + j->flags.busytone = 0; + j->flags.ringback = 0; + ixj_set_tone_on(0x0001, board); + ixj_set_tone_off(0x0000, board); + ixj_play_tone(board, 0); + j->tone_state = 0; + if (j->cadence_t) { + if (j->cadence_t->ce) { + kfree(j->cadence_t->ce); + } + kfree(j->cadence_t); + j->cadence_t = NULL; } - kfree(j->cadence_t); - j->cadence_t = NULL; } - ixj_add_timer(); - if (j->dsp.low == 0x20 || (j->play_mode == -1 && j->rec_mode == -1)) + if (j->play_mode == -1 && j->rec_mode == -1) idle(board); if (j->play_mode != -1) ixj_play_start(board); @@ -3374,7 +4434,6 @@ ixj[board].flags.busytone = 0; ixj[board].flags.dialtone = 0; ixj[board].flags.ringback = 1; - ixj_set_tone_on(0x0FA0, board); ixj_set_tone_off(0x2EE0, board); ixj_play_tone(board, 26); @@ -3391,14 +4450,11 @@ IXJ_CADENCE_ELEMENT *lcep; IXJ_TONE ti; IXJ *j = &ixj[board]; - lcp = kmalloc(sizeof(IXJ_CADENCE), GFP_KERNEL); if (lcp == NULL) return -ENOMEM; - if (copy_from_user(lcp, (char *) cp, sizeof(IXJ_CADENCE))) return -EFAULT; - lcep = kmalloc(sizeof(IXJ_CADENCE_ELEMENT) * lcp->elements_used, GFP_KERNEL); if (lcep == NULL) { kfree(lcp); @@ -3406,13 +4462,10 @@ } if (copy_from_user(lcep, lcp->ce, sizeof(IXJ_CADENCE_ELEMENT) * lcp->elements_used)) return -EFAULT; - - if(j->cadence_t) - { + if (j->cadence_t) { kfree(j->cadence_t->ce); kfree(j->cadence_t); } - lcp->ce = (void *) lcep; j->cadence_t = lcp; j->tone_cadence_state = 0; @@ -3427,16 +4480,50 @@ ixj_init_tone(board, &ti); } ixj_play_tone(board, lcp->ce[0].index); - return 1; } +static int ixj_build_filter_cadence(int board, IXJ_FILTER_CADENCE * cp) +{ + IXJ_FILTER_CADENCE *lcp; + IXJ *j = &ixj[board]; + lcp = kmalloc(sizeof(IXJ_CADENCE), GFP_KERNEL); + if (lcp == NULL) + return -ENOMEM; + if (copy_from_user(lcp, (char *) cp, sizeof(IXJ_FILTER_CADENCE))) + return -EFAULT; + if (lcp->filter > 4) + return -1; + j->cadence_f[lcp->filter].state = 0; + j->cadence_f[lcp->filter].enable = lcp->enable; + j->filter_en[lcp->filter] = j->cadence_f[lcp->filter].en_filter = lcp->en_filter; + j->cadence_f[lcp->filter].on1 = lcp->on1; + j->cadence_f[lcp->filter].on1min = 0; + j->cadence_f[lcp->filter].on1max = 0; + j->cadence_f[lcp->filter].off1 = lcp->off1; + j->cadence_f[lcp->filter].off1min = 0; + j->cadence_f[lcp->filter].off1max = 0; + j->cadence_f[lcp->filter].on2 = lcp->on2; + j->cadence_f[lcp->filter].on2min = 0; + j->cadence_f[lcp->filter].on2max = 0; + j->cadence_f[lcp->filter].off2 = lcp->off2; + j->cadence_f[lcp->filter].off2min = 0; + j->cadence_f[lcp->filter].off2max = 0; + j->cadence_f[lcp->filter].on3 = lcp->on3; + j->cadence_f[lcp->filter].on3min = 0; + j->cadence_f[lcp->filter].on3max = 0; + j->cadence_f[lcp->filter].off3 = lcp->off3; + j->cadence_f[lcp->filter].off3min = 0; + j->cadence_f[lcp->filter].off3max = 0; + kfree(lcp); + return 0; +} + static void add_caps(int board) { IXJ *j = &ixj[board]; j->caps = 0; - - j->caplist[j->caps].cap = vendor; + j->caplist[j->caps].cap = PHONE_VENDOR_QUICKNET; strcpy(j->caplist[j->caps].desc, "Quicknet Technologies, Inc. (www.quicknet.net)"); j->caplist[j->caps].captype = vendor; j->caplist[j->caps].handle = j->caps++; @@ -3532,10 +4619,9 @@ int cnt; IXJ *j = &ixj[board]; int retval = 0; - for (cnt = 0; cnt < j->caps; cnt++) { - if (pcreq->captype == j->caplist[cnt].captype && - pcreq->cap == j->caplist[cnt].cap) { + if (pcreq->captype == j->caplist[cnt].captype + && pcreq->cap == j->caplist[cnt].cap) { retval = 1; break; } @@ -3543,8 +4629,7 @@ return retval; } -int ixj_ioctl(struct inode *inode, struct file *file_p, - unsigned int cmd, unsigned long arg) +int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd, unsigned long arg) { IXJ_TONE ti; IXJ_FILTER jf; @@ -3552,16 +4637,13 @@ int board = NUM(inode->i_rdev); IXJ *j = &ixj[NUM(inode->i_rdev)]; int retval = 0; - if (ixjdebug > 1) printk(KERN_DEBUG "phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); if (minor >= IXJMAX) return -ENODEV; - /* * Check ioctls only root can use. */ - if (!capable(CAP_SYS_ADMIN)) { switch (cmd) { case IXJCTL_TESTRAM: @@ -3580,10 +4662,33 @@ case IXJCTL_SERIAL: retval = j->serial; break; + case IXJCTL_VERSION: + if (copy_to_user((char *) arg, ixj_c_revision, strlen(ixj_c_revision))) + return -EFAULT; + break; case PHONE_RING_CADENCE: j->ring_cadence = arg; break; + case IXJCTL_CIDCW: + if(arg) { + copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID)); + } + else { + memcpy(&j->cid_send, 0, sizeof(PHONE_CID)); + } + ixj_write_cidcw(board); + break; + /* Binary compatbility */ + case OLD_PHONE_RING_START: + arg = 0; + /* Fall through */ case PHONE_RING_START: + if(arg) { + copy_from_user(&j->cid_send, (char *)arg, sizeof(PHONE_CID)); + } + else { + memcpy(&j->cid_send, 0, sizeof(PHONE_CID)); + } ixj_ring_start(board); break; case PHONE_RING_STOP: @@ -3595,7 +4700,19 @@ break; case PHONE_EXCEPTION: retval = j->ex.bytes; - j->ex.bytes &= 0x03; + j->ex.bits.flash = 0; + j->ex.bits.pstn_ring = 0; + j->ex.bits.caller_id = 0; + j->ex.bits.pstn_wink = 0; + j->ex.bits.f0 = 0; + j->ex.bits.f1 = 0; + j->ex.bits.f2 = 0; + j->ex.bits.f3 = 0; + j->ex.bits.fc0 = 0; + j->ex.bits.fc1 = 0; + j->ex.bits.fc2 = 0; + j->ex.bits.fc3 = 0; + j->ex.bits.reserved = 0; break; case PHONE_HOOKSTATE: j->ex.bits.hookstate = 0; @@ -3610,6 +4727,9 @@ case PHONE_REC_CODEC: retval = set_rec_codec(board, arg); break; + case PHONE_VAD: + ixj_vad(board, arg); + break; case PHONE_REC_START: ixj_record_start(board); break; @@ -3620,7 +4740,13 @@ set_rec_depth(board, arg); break; case PHONE_REC_VOLUME: - set_rec_volume(board, arg); + if(arg == -1) { + retval = get_rec_volume(board); + } + else { + set_rec_volume(board, arg); + retval = arg; + } break; case PHONE_REC_LEVEL: retval = get_rec_level(board); @@ -3638,7 +4764,7 @@ retval = set_play_codec(board, arg); break; case PHONE_PLAY_START: - ixj_play_start(board); + retval = ixj_play_start(board); break; case PHONE_PLAY_STOP: ixj_play_stop(board); @@ -3647,7 +4773,13 @@ set_play_depth(board, arg); break; case PHONE_PLAY_VOLUME: - set_play_volume(board, arg); + if(arg == -1) { + retval = get_play_volume(board); + } + else { + set_play_volume(board, arg); + retval = arg; + } break; case PHONE_PLAY_LEVEL: retval = get_play_level(board); @@ -3828,41 +4960,45 @@ switch (arg) { case DAA_US: DAA_Coeff_US(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; case DAA_UK: DAA_Coeff_UK(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; case DAA_FRANCE: DAA_Coeff_France(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; case DAA_GERMANY: DAA_Coeff_Germany(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; case DAA_AUSTRALIA: DAA_Coeff_Australia(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; case DAA_JAPAN: DAA_Coeff_Japan(board); - ixj_daa_write(board); + retval = ixj_daa_write(board); break; default: + retval = 1; break; } + j->country = arg; break; case IXJCTL_DAA_AGAIN: ixj_daa_cr4(board, arg | 0x02); break; case IXJCTL_PSTN_LINETEST: - case PHONE_PSTN_LINETEST: retval = ixj_linetest(board); break; + case IXJCTL_VMWI: + ixj_write_vmwi(board, arg); + break; case IXJCTL_CID: - if (copy_to_user((char *) arg, &j->cid, sizeof(IXJ_CID))) + if (copy_to_user((char *) arg, &j->cid, sizeof(PHONE_CID))) return -EFAULT; j->ex.bits.caller_id = 0; break; @@ -3883,7 +5019,7 @@ break; case PHONE_CAPABILITIES_LIST: if (copy_to_user((char *) arg, j->caplist, sizeof(struct phone_capability) * j->caps)) - return -EFAULT; + return -EFAULT; break; case PHONE_CAPABILITIES_CHECK: retval = capabilities_check(board, (struct phone_capability *) arg); @@ -3896,7 +5032,7 @@ j->ex.bits.pstn_ring = 0; break; case IXJCTL_SET_FILTER: - if (copy_from_user(&jf, (char *) arg, sizeof(ti))) + if (copy_from_user(&jf, (char *) arg, sizeof(jf))) return -EFAULT; retval = ixj_init_filter(board, &jf); break; @@ -3910,6 +5046,9 @@ case IXJCTL_TONE_CADENCE: retval = ixj_build_cadence(board, (IXJ_CADENCE *) arg); break; + case IXJCTL_FILTER_CADENCE: + retval = ixj_build_filter_cadence(board, (IXJ_FILTER_CADENCE *) arg); + break; case IXJCTL_INTERCOM_STOP: ixj[board].intercom = -1; ixj[arg].intercom = -1; @@ -3948,7 +5087,7 @@ poll: ixj_poll, ioctl: ixj_ioctl, release: ixj_release, - fasync: ixj_fasync, + fasync: ixj_fasync }; static int ixj_linetest(int board) @@ -3956,8 +5095,9 @@ unsigned long jifwait; IXJ *j = &ixj[board]; + j->flags.incheck = 1; // Testing if (!j->flags.pots_correct) { - j->flags.pots_correct = 1; // Testing + j->flags.pots_correct = 1; daa_int_read(board); //Clear DAA Interrupt flags // @@ -4009,23 +5149,23 @@ } } } - if (!j->flags.pstn_present) { - j->pld_slicw.bits.rly3 = 0; - outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); - daa_set_mode(board, SOP_PU_CONVERSATION); - jifwait = jiffies + hertz; - while (time_before(jiffies, jifwait)) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } - daa_int_read(board); - daa_set_mode(board, SOP_PU_SLEEP); - if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { - j->flags.pstn_present = 1; - } else { - j->flags.pstn_present = 0; - } +// if (!j->flags.pstn_present) { + j->pld_slicw.bits.rly3 = 0; + outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); + daa_set_mode(board, SOP_PU_CONVERSATION); + jifwait = jiffies + hertz; + while (time_before(jiffies, jifwait)) { + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(1); + } + daa_int_read(board); + daa_set_mode(board, SOP_PU_SLEEP); + if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { + j->flags.pstn_present = 1; + } else { + j->flags.pstn_present = 0; } +// } if (j->flags.pstn_present) { if (j->flags.pots_correct) { LED_SetState(0xA, board); @@ -4039,6 +5179,7 @@ LED_SetState(0x5, board); } } + j->flags.incheck = 0; // Testing return j->flags.pstn_present; } @@ -4046,59 +5187,44 @@ { unsigned short cmd; unsigned long jif; + int cnt; BYTES bytes; IXJ *j = &ixj[board]; - /* - * First initialise the queues - */ - + init_waitqueue_head(&j->poll_q); init_waitqueue_head(&j->read_q); init_waitqueue_head(&j->write_q); - init_waitqueue_head(&j->poll_q); - - /* - * Now we can probe - */ - if (ixjdebug > 0) printk(KERN_INFO "Write IDLE to Software Control Register\n"); + ixj_WriteDSPCommand(0x0FE0, board); // Put the DSP in full power mode. if (ixj_WriteDSPCommand(0x0000, board)) /* Write IDLE to Software Control Register */ return -1; - // The read values of the SSR should be 0x00 for the IDLE command if (j->ssr.low || j->ssr.high) return -1; - if (ixjdebug > 0) printk(KERN_INFO "Get Device ID Code\n"); - if (ixj_WriteDSPCommand(0x3400, board)) /* Get Device ID Code */ return -1; - j->dsp.low = j->ssr.low; j->dsp.high = j->ssr.high; - if (ixjdebug > 0) printk(KERN_INFO "Get Device Version Code\n"); - if (ixj_WriteDSPCommand(0x3800, board)) /* Get Device Version Code */ return -1; - j->ver.low = j->ssr.low; j->ver.high = j->ssr.high; - if (!j->cardtype) { if (j->dsp.low == 0x21) { - j->XILINXbase = j->DSPbase + 0x10; +// j->XILINXbase = j->DSPbase + 0x10; bytes.high = bytes.low = inb_p(j->XILINXbase + 0x02); outb_p(bytes.low ^ 0xFF, j->XILINXbase + 0x02); - // Test for Internet LineJACK or Internet PhoneJACK Lite +// Test for Internet LineJACK or Internet PhoneJACK Lite bytes.low = inb_p(j->XILINXbase + 0x02); if (bytes.low == bytes.high) // Register is read only on - // Internet PhoneJack Lite - { + // Internet PhoneJack Lite + { j->cardtype = 400; // Internet PhoneJACK Lite if (check_region(j->XILINXbase, 4)) { @@ -4158,18 +5284,18 @@ j->pld_slicw.pcib.e1 = 1; outb_p(j->pld_slicw.byte, j->XILINXbase); break; + case 600: //Internet PhoneCARD + + break; } } if (j->dsp.low == 0x20 || j->cardtype == 400 || j->cardtype == 500) { if (ixjdebug > 0) printk(KERN_INFO "Write CODEC config to Software Control Register\n"); - if (ixj_WriteDSPCommand(0xC462, board)) /* Write CODEC config to Software Control Register */ return -1; - if (ixjdebug > 0) printk(KERN_INFO "Write CODEC timing to Software Control Register\n"); - if (j->cardtype == 100) { cmd = 0x9FF2; } else { @@ -4180,17 +5306,17 @@ } else { if (set_base_frame(board, 30) != 30) return -1; - + if (ixjdebug > 0) + printk(KERN_INFO "Write CODEC config to Software Control Register\n"); + if (j->cardtype == 600) { + if (ixj_WriteDSPCommand(0xC528, board)) /* Write CODEC config to Software Control Register */ + return -1; + } if (j->cardtype == 300) { - if (ixjdebug > 0) - printk(KERN_INFO "Write CODEC config to Software Control Register\n"); - if (ixj_WriteDSPCommand(0xC528, board)) /* Write CODEC config to Software Control Register */ return -1; - if (ixjdebug > 0) printk(KERN_INFO "Turn on the PLD Clock at 8Khz\n"); - j->pld_clock.byte = 0; outb_p(j->pld_clock.byte, j->XILINXbase + 0x04); } @@ -4199,9 +5325,8 @@ if (j->dsp.low == 0x20) { if (ixjdebug > 0) printk(KERN_INFO "Configure GPIO pins\n"); - j->gpio.bytes.high = 0x09; - /* bytes.low = 0xEF; 0xF7 */ +/* bytes.low = 0xEF; 0xF7 */ j->gpio.bits.gpio1 = 1; j->gpio.bits.gpio2 = 1; j->gpio.bits.gpio3 = 0; @@ -4210,10 +5335,8 @@ j->gpio.bits.gpio6 = 1; j->gpio.bits.gpio7 = 1; ixj_WriteDSPCommand(ixj[board].gpio.word, board); /* Set GPIO pin directions */ - if (ixjdebug > 0) printk(KERN_INFO "Enable SLIC\n"); - j->gpio.bytes.high = 0x0B; j->gpio.bytes.low = 0x00; j->gpio.bits.gpio1 = 0; @@ -4248,23 +5371,16 @@ schedule_timeout(1); } LED_SetState(0x0, board); - daa_get_version(board); - if (ixjdebug > 0) printk("Loading DAA Coefficients\n"); - DAA_Coeff_US(board); if (!ixj_daa_write(board)) printk("DAA write failed on board %d\n", board); - ixj_daa_cid_reset(board); - j->flags.pots_correct = 0; j->flags.pstn_present = 0; - ixj_linetest(board); - if (j->flags.pots_correct) { j->pld_scrw.bits.daafsyncen = 0; // Turn off DAA Frame Sync @@ -4275,9 +5391,10 @@ SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); j->port = PORT_POTS; } + ixj_set_port(board, PORT_PSTN); + ixj_set_pots(board, 1); if (ixjdebug > 0) printk(KERN_INFO "Enable Mixer\n"); - ixj_mixer(0x0000, board); //Master Volume Left unmute 0db ixj_mixer(0x0100, board); //Master Volume Right unmute 0db @@ -4301,43 +5418,43 @@ ixj_mixer(0x1800, board); //ADC Source select } else { - j->port = PORT_POTS; - SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); + if (j->cardtype == 600) { + ixj_WriteDSPCommand(0xCF07, board); + ixj_WriteDSPCommand(0x00B0, board); + ixj_set_port(board, PORT_SPEAKER); + } else { + ixj_set_port(board, PORT_POTS); + SLIC_SetState(PLD_SLIC_STATE_STANDBY, board); + } } } j->intercom = -1; j->framesread = j->frameswritten = 0; + j->read_wait = j->write_wait = 0; j->rxreadycheck = j->txreadycheck = 0; - + set_play_volume(board, 0x100); + set_rec_volume(board, 0x100); if (ixj_WriteDSPCommand(0x0000, board)) /* Write IDLE to Software Control Register */ return -1; - - // The read values of the SSR should be 0x00 for the IDLE command +// The read values of the SSR should be 0x00 for the IDLE command if (j->ssr.low || j->ssr.high) return -1; - if (ixjdebug > 0) printk(KERN_INFO "Enable Line Monitor\n"); - if (ixjdebug > 0) printk(KERN_INFO "Set Line Monitor to Asyncronous Mode\n"); - if (ixj_WriteDSPCommand(0x7E01, board)) // Asynchronous Line Monitor return -1; - if (ixjdebug > 0) printk(KERN_INFO "Enable DTMF Detectors\n"); - if (ixj_WriteDSPCommand(0x5151, board)) // Enable DTMF detection return -1; - if (ixj_WriteDSPCommand(0x6E01, board)) // Set Asyncronous Tone Generation return -1; - set_rec_depth(board, 2); // Set Record Channel Limit to 2 frames set_play_depth(board, 2); // Set Playback Channel Limit to 2 frames @@ -4345,7 +5462,6 @@ j->ex.bits.dtmf_ready = 0; j->dtmf_state = 0; j->dtmf_wp = ixj[board].dtmf_rp = 0; - j->rec_mode = ixj[board].play_mode = -1; j->flags.ringing = 0; j->maxrings = MAXRINGS; @@ -4353,25 +5469,595 @@ j->drybuffer = 0; j->winktime = 320; j->flags.dtmf_oob = 0; - + for (cnt = 0; cnt < 4; cnt++) + j->cadence_f[cnt].enable = 0; /* must be a device on the specified address */ + ixj_WriteDSPCommand(0x0FE3, board); // Put the DSP in 1/5 power mode. /* Register with the Telephony for Linux subsystem */ j->p.f_op = &ixj_fops; j->p.open = ixj_open; + j->p.board = board; phone_register_device(&j->p, PHONE_UNIT_ANY); - add_caps(board); + return 0; +} + +int ixj_read_proc(char *buf, char **start, off_t offset, int len, int unused) +{ + int cnt; + IXJ *j; + len = 0; + len += sprintf(buf + len, "\n%s", ixj_c_rcsid); + len += sprintf(buf + len, "\n%s", ixj_h_rcsid); + len += sprintf(buf + len, "\n%s", ixjuser_h_rcsid); + for (cnt = 0; cnt < IXJMAX; cnt++) { + j = &ixj[cnt]; + if (j->DSPbase) { + len += sprintf(buf + len, "\nCard Num %d", cnt); + len += sprintf(buf + len, "\nDSP Base Address 0x%4.4x", j->DSPbase); + if (j->cardtype != 100) + len += sprintf(buf + len, "\nXILINX Base Address 0x%4.4x", j->XILINXbase); + len += sprintf(buf + len, "\nDSP Type %2.2x%2.2x", j->dsp.high, j->dsp.low); + len += sprintf(buf + len, "\nDSP Version %2.2x.%2.2x", j->ver.high, j->ver.low); + len += sprintf(buf + len, "\nSerial Number %8.8x", j->serial); + switch (j->cardtype) { + case (100): + len += sprintf(buf + len, "\nCard Type = Internet PhoneJACK"); + break; + case (300): + len += sprintf(buf + len, "\nCard Type = Internet LineJACK"); + if (j->flags.g729_loaded) + len += sprintf(buf + len, " w/G.729 A/B"); + len += sprintf(buf + len, " Country = %d", j->country); + break; + case (400): + len += sprintf(buf + len, "\nCard Type = Internet PhoneJACK Lite"); + if (j->flags.g729_loaded) + len += sprintf(buf + len, " w/G.729 A/B"); + break; + case (500): + len += sprintf(buf + len, "\nCard Type = Internet PhoneJACK PCI"); + if (j->flags.g729_loaded) + len += sprintf(buf + len, " w/G.729 A/B"); + break; + case (600): + len += sprintf(buf + len, "\nCard Type = Internet PhoneCARD"); + if (j->flags.g729_loaded) + len += sprintf(buf + len, " w/G.729 A/B"); + len += sprintf(buf + len, "\nSmart Cable %spresent", j->pccr1.bits.drf ? "not " : ""); + if (!j->pccr1.bits.drf) + len += sprintf(buf + len, "\nSmart Cable type %d", j->flags.pcmciasct); + len += sprintf(buf + len, "\nSmart Cable state %d", j->flags.pcmciastate); + break; + default: + len += sprintf(buf + len, "\nCard Type = %d", j->cardtype); + break; + } + len += sprintf(buf + len, "\nReaders %d", j->readers); + len += sprintf(buf + len, "\nWriters %d", j->writers); + len += sprintf(buf + len, "\nFSK words %d", ixj[2].fskdcnt); + len += sprintf(buf + len, "\nCapabilities %d", j->caps); + if (j->dsp.low != 0x20) + len += sprintf(buf + len, "\nDSP Processor load %d", j->proc_load); + if (j->flags.cidsent) + len += sprintf(buf + len, "\nCaller ID data sent"); + else + len += sprintf(buf + len, "\nCaller ID data not sent"); + + len += sprintf(buf + len, "\nCaller ID Date %s%s", j->cid_send.month, j->cid_send.day); + len += sprintf(buf + len, "\nCaller ID Time %s%s", j->cid_send.hour, j->cid_send.min); + len += sprintf(buf + len, "\nCaller ID Name %s", j->cid_send.name); + len += sprintf(buf + len, "\nCaller ID Number %s", j->cid_send.number); + + len += sprintf(buf + len, "\nPlay CODEC "); + switch (j->play_codec) { + case G723_63: + len += sprintf(buf + len, "G.723.1 6.3"); + break; + case G723_53: + len += sprintf(buf + len, "G.723.1 5.3"); + break; + case TS85: + len += sprintf(buf + len, "TrueSpeech 8.5"); + break; + case TS48: + len += sprintf(buf + len, "TrueSpeech 4.8"); + break; + case TS41: + len += sprintf(buf + len, "TrueSpeech 4.1"); + break; + case G728: + len += sprintf(buf + len, "G.728"); + break; + case G729: + len += sprintf(buf + len, "G.729"); + break; + case ULAW: + len += sprintf(buf + len, "uLaw"); + break; + case ALAW: + len += sprintf(buf + len, "aLaw"); + break; + case LINEAR16: + len += sprintf(buf + len, "16 bit Linear"); + break; + case LINEAR8: + len += sprintf(buf + len, "8 bit Linear"); + break; + case WSS: + len += sprintf(buf + len, "Windows Sound System"); + break; + default: + len += sprintf(buf + len, "NO CODEC CHOSEN"); + break; + } + len += sprintf(buf + len, "\nRecord CODEC "); + switch (j->rec_codec) { + case G723_63: + len += sprintf(buf + len, "G.723.1 6.3"); + break; + case G723_53: + len += sprintf(buf + len, "G.723.1 5.3"); + break; + case TS85: + len += sprintf(buf + len, "TrueSpeech 8.5"); + break; + case TS48: + len += sprintf(buf + len, "TrueSpeech 4.8"); + break; + case TS41: + len += sprintf(buf + len, "TrueSpeech 4.1"); + break; + case G728: + len += sprintf(buf + len, "G.728"); + break; + case G729: + len += sprintf(buf + len, "G.729"); + break; + case ULAW: + len += sprintf(buf + len, "uLaw"); + break; + case ALAW: + len += sprintf(buf + len, "aLaw"); + break; + case LINEAR16: + len += sprintf(buf + len, "16 bit Linear"); + break; + case LINEAR8: + len += sprintf(buf + len, "8 bit Linear"); + break; + case WSS: + len += sprintf(buf + len, "Windows Sound System"); + break; + default: + len += sprintf(buf + len, "NO CODEC CHOSEN"); + break; + } + switch (j->aec_level) { + case AEC_OFF: + len += sprintf(buf + len, "\n AEC OFF"); + break; + case AEC_LOW: + len += sprintf(buf + len, "\n AEC LOW"); + break; + case AEC_MED: + len += sprintf(buf + len, "\n AEC MED"); + break; + case AEC_HIGH: + len += sprintf(buf + len, "\n AEC HIGH"); + break; + } + len += sprintf(buf + len, "\nHook state %d", j->r_hook); // ixj_hookstate(cnt)); + + if (j->cardtype == 300) { + len += sprintf(buf + len, "\nPOTS Correct %d", j->flags.pots_correct); + len += sprintf(buf + len, "\nPSTN Present %d", j->flags.pstn_present); + len += sprintf(buf + len, "\nPOTS to PSTN %d", j->flags.pots_pstn); + len += sprintf(buf + len, "\nPSTN sleeptil %ld - jiffies %ld", j->pstn_sleeptil, jiffies); + switch (j->daa_mode) { + case SOP_PU_SLEEP: + len += sprintf(buf + len, "\nDAA PSTN On Hook"); + break; + case SOP_PU_RINGING: + len += sprintf(buf + len, "\nDAA PSTN Ringing"); + break; + case SOP_PU_CONVERSATION: + len += sprintf(buf + len, "\nDAA PSTN Off Hook"); + break; + case SOP_PU_PULSEDIALING: + len += sprintf(buf + len, "\nDAA PSTN Pulse Dialing"); + break; + } + } + switch (j->port) { + case PORT_POTS: + len += sprintf(buf + len, "\nPort POTS"); + break; + case PORT_PSTN: + len += sprintf(buf + len, "\nPort PSTN"); + break; + case PORT_SPEAKER: + len += sprintf(buf + len, "\nPort SPEAKER/MIC"); + break; + case PORT_HANDSET: + len += sprintf(buf + len, "\nPort HANDSET"); + break; + } + if (j->dsp.low == 0x21 || j->dsp.low == 0x22) { + len += sprintf(buf + len, "\nSLIC state "); + switch (SLIC_GetState(cnt)) { + case PLD_SLIC_STATE_OC: + len += sprintf(buf + len, "OC"); + break; + case PLD_SLIC_STATE_RINGING: + len += sprintf(buf + len, "RINGING"); + break; + case PLD_SLIC_STATE_ACTIVE: + len += sprintf(buf + len, "ACTIVE"); + break; + case PLD_SLIC_STATE_OHT: // On-hook transmit + + len += sprintf(buf + len, "OHT"); + break; + case PLD_SLIC_STATE_TIPOPEN: + len += sprintf(buf + len, "TIPOPEN"); + break; + case PLD_SLIC_STATE_STANDBY: + len += sprintf(buf + len, "STANDBY"); + break; + case PLD_SLIC_STATE_APR: // Active polarity reversal + + len += sprintf(buf + len, "APR"); + break; + case PLD_SLIC_STATE_OHTPR: // OHT polarity reversal + + len += sprintf(buf + len, "OHTPR"); + break; + default: + len += sprintf(buf + len, "%d", SLIC_GetState(cnt)); + break; + } + } +#ifdef PERFMON_STATS + len += sprintf(buf + len, "\nTimer Checks %ld", j->timerchecks); + len += sprintf(buf + len, "\nRX Ready Checks %ld", j->rxreadycheck); + len += sprintf(buf + len, "\nTX Ready Checks %ld", j->txreadycheck); + len += sprintf(buf + len, "\nBase Frame %2.2x.%2.2x", j->baseframe.high, j->baseframe.low); + len += sprintf(buf + len, "\nFrames Read %ld", j->framesread); + len += sprintf(buf + len, "\nFrames Written %ld", j->frameswritten); + len += sprintf(buf + len, "\nDry Buffer %ld", j->drybuffer); + len += sprintf(buf + len, "\nRead Waits %ld", j->read_wait); + len += sprintf(buf + len, "\nWrite Waits %ld", j->write_wait); +#endif + len += sprintf(buf + len, "\n"); + } + } + return len; +} +int ixj_read_proc_fsk(char *buf, char **start, off_t offset, int len, int unused) +{ + len = 0; + if (ixj[2].fskdcnt) { + memcpy(buf, &ixj[2].fskdata, (ixj[2].fskdcnt) * 2); + len += ixj[2].fskdcnt * 2; + } + return len; +} +static struct proc_dir_entry ixj_proc_entry = +{ + 0, + 3, "ixj", + S_IFREG | S_IRUGO, + 1, 0, 0, + 0, + NULL, + &ixj_read_proc +}; + +static struct proc_dir_entry ixjfsk_proc_entry = +{ + 0, + 6, "ixjfsk", + S_IFREG | S_IRUGO, + 1, 0, 0, + 0, + NULL, + &ixj_read_proc_fsk +}; +MODULE_DESCRIPTION("Internet Phone/Internet LineJack module - www.quicknet.net"); +MODULE_AUTHOR("Ed Okerson "); +#ifdef CONFIG_PCMCIA +#ifdef PCMCIA_DEBUG +static int pc_debug = PCMCIA_DEBUG; +MODULE_PARM(pc_debug, "i"); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) +#else +#define DEBUG(n, args...) +#endif +typedef struct ixj_info_t { + int ndev; + dev_node_t node; + struct ixj *port; +} ixj_info_t; +static dev_link_t *ixj_attach(void); +static void ixj_detach(dev_link_t *); +static void ixj_config(dev_link_t * link); +static void ixj_cs_release(u_long arg); +static int ixj_event(event_t event, int priority, event_callback_args_t * args); +static dev_info_t dev_info = "ixj_cs"; +static dev_link_t *dev_list = NULL; +static void cs_error(client_handle_t handle, int func, int ret) +{ + error_info_t err = + { + func, ret + }; + CardServices(ReportError, handle, &err); +} + +static dev_link_t *ixj_attach(void) +{ + client_reg_t client_reg; + dev_link_t *link; + int ret; + DEBUG(0, "ixj_attach()\n"); + /* Create new ixj device */ + link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + memset(link, 0, sizeof(struct dev_link_t)); + link->release.function = &ixj_cs_release; + link->release.data = (u_long) link; + link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; + link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; + link->io.IOAddrLines = 3; + link->conf.Vcc = 50; + link->conf.IntType = INT_MEMORY_AND_IO; + link->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); + memset(link->priv, 0, sizeof(struct ixj_info_t)); + /* Register with Card Services */ + link->next = dev_list; + dev_list = link; + client_reg.dev_info = &dev_info; + client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; + client_reg.EventMask = + CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | + CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | + CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; + client_reg.event_handler = &ixj_event; + client_reg.Version = 0x0210; + client_reg.event_callback_args.client_data = link; + ret = CardServices(RegisterClient, &link->handle, &client_reg); + if (ret != CS_SUCCESS) { + cs_error(link->handle, RegisterClient, ret); + ixj_detach(link); + return NULL; + } + return link; +} + +static void ixj_detach(dev_link_t * link) +{ + dev_link_t **linkp; + long flags; + int ret; + DEBUG(0, "ixj_detach(0x%p)\n", link); + for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) + if (*linkp == link) + break; + if (*linkp == NULL) + return; + save_flags(flags); + cli(); + if (link->state & DEV_RELEASE_PENDING) { + del_timer(&link->release); + link->state &= ~DEV_RELEASE_PENDING; + } + restore_flags(flags); + if (link->state & DEV_CONFIG) + ixj_cs_release((u_long) link); + if (link->handle) { + ret = CardServices(DeregisterClient, link->handle); + if (ret != CS_SUCCESS) + cs_error(link->handle, DeregisterClient, ret); + } + /* Unlink device structure, free bits */ + *linkp = link->next; + kfree_s(link->priv, sizeof(ixj_info_t)); + kfree_s(link, sizeof(struct dev_link_t)); +} + +#define CS_CHECK(fn, args...) \ +while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed + +#define CFG_CHECK(fn, args...) \ +if (CardServices(fn, args) != 0) goto next_entry + +void ixj_get_serial(dev_link_t * link, IXJ * j) +{ + client_handle_t handle; + tuple_t tuple; + u_short buf[128]; + char *str; + int last_ret, last_fn, i, place; + handle = link->handle; + DEBUG(0, "ixj_get_serial(0x%p)\n", link); + tuple.TupleData = (cisdata_t *) buf; + tuple.TupleOffset = 0; + tuple.TupleDataMax = 80; + tuple.Attributes = 0; + tuple.DesiredTuple = CISTPL_VERS_1; + CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetTupleData, handle, &tuple); + str = (char *) buf; + printk("PCMCIA Version %d.%d\n", str[0], str[1]); + str += 2; + printk("%s", str); + str = str + strlen(str) + 1; + printk(" %s", str); + str = str + strlen(str) + 1; + place = 1; + for (i = strlen(str) - 1; i >= 0; i--) { + switch (str[i]) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + j->serial += (str[i] - 48) * place; + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + j->serial += (str[i] - 55) * place; + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + j->serial += (str[i] - 87) * place; + break; + } + place = place * 0x10; + } + str = str + strlen(str) + 1; + printk(" version %s\n", str); + cs_failed: + return; +} + +void ixj_config(dev_link_t * link) +{ + client_handle_t handle; + ixj_info_t *info; + tuple_t tuple; + u_short buf[128]; + cisparse_t parse; + config_info_t conf; + cistpl_cftable_entry_t *cfg = &parse.cftable_entry; + cistpl_cftable_entry_t dflt = + { + 0 + }; + int last_ret, last_fn; + handle = link->handle; + info = link->priv; + DEBUG(0, "ixj_config(0x%p)\n", link); + tuple.TupleData = (cisdata_t *) buf; + tuple.TupleOffset = 0; + tuple.TupleDataMax = 255; + tuple.Attributes = 0; + tuple.DesiredTuple = CISTPL_CONFIG; + CS_CHECK(GetFirstTuple, handle, &tuple); + CS_CHECK(GetTupleData, handle, &tuple); + CS_CHECK(ParseTuple, handle, &tuple, &parse); + link->conf.ConfigBase = parse.config.base; + link->conf.Present = parse.config.rmask[0]; + link->state |= DEV_CONFIG; + CS_CHECK(GetConfigurationInfo, handle, &conf); + tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; + tuple.Attributes = 0; + CS_CHECK(GetFirstTuple, handle, &tuple); + while (1) { + CFG_CHECK(GetTupleData, handle, &tuple); + CFG_CHECK(ParseTuple, handle, &tuple, &parse); + if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; + link->conf.ConfigIndex = cfg->index; + link->io.BasePort1 = io->win[0].base; + link->io.NumPorts1 = io->win[0].len; + if (io->nwin == 2) { + link->io.BasePort2 = io->win[1].base; + link->io.NumPorts2 = io->win[1].len; + } + CFG_CHECK(RequestIO, link->handle, &link->io); + /* If we've got this far, we're done */ + break; + } + next_entry: + if (cfg->flags & CISTPL_CFTABLE_DEFAULT) + dflt = *cfg; + CS_CHECK(GetNextTuple, handle, &tuple); + } + + CS_CHECK(RequestConfiguration, handle, &link->conf); + ixj[0].DSPbase = link->io.BasePort1; + ixj[0].XILINXbase = link->io.BasePort1 + 0x10; + ixj[0].cardtype = 600; + ixj_selfprobe(0); + info->ndev = 1; + info->node.major = PHONE_MAJOR; + link->dev = &info->node; + ixj_get_serial(link, &ixj[0]); + link->state &= ~DEV_CONFIG_PENDING; + return; + cs_failed: + cs_error(link->handle, last_fn, last_ret); + ixj_cs_release((u_long) link); +} + +void ixj_cs_release(u_long arg) +{ + dev_link_t *link = (dev_link_t *) arg; + ixj_info_t *info = link->priv; + DEBUG(0, "ixj_cs_release(0x%p)\n", link); + info->ndev = 0; + link->dev = NULL; + CardServices(ReleaseConfiguration, link->handle); + CardServices(ReleaseIO, link->handle, &link->io); + link->state &= ~DEV_CONFIG; +} + +int ixj_event(event_t event, int priority, event_callback_args_t * args) +{ + dev_link_t *link = args->client_data; + DEBUG(1, "ixj_event(0x%06x)\n", event); + switch (event) { + case CS_EVENT_CARD_REMOVAL: + link->state &= ~DEV_PRESENT; + if (link->state & DEV_CONFIG) { + link->release.expires = RUN_AT(HZ / 20); + link->state |= DEV_RELEASE_PENDING; + add_timer(&link->release); + } + break; + case CS_EVENT_CARD_INSERTION: + link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; + ixj_config(link); + break; + case CS_EVENT_PM_SUSPEND: + link->state |= DEV_SUSPEND; + /* Fall through... */ + case CS_EVENT_RESET_PHYSICAL: + if (link->state & DEV_CONFIG) + CardServices(ReleaseConfiguration, link->handle); + break; + case CS_EVENT_PM_RESUME: + link->state &= ~DEV_SUSPEND; + /* Fall through... */ + case CS_EVENT_CARD_RESET: + if (DEV_OK(link)) + CardServices(RequestConfiguration, link->handle, &link->conf); + break; + } return 0; } +#endif // PCMCIA + static void cleanup(void) { int cnt; - del_timer(&ixj_timer); -// if (ixj_major) - // unregister_chrdev(ixj_major, "ixj"); for (cnt = 0; cnt < IXJMAX; cnt++) { if (ixj[cnt].cardtype == 300) { ixj[cnt].pld_scrw.bits.daafsyncen = 0; // Turn off DAA Frame Sync @@ -4382,7 +6068,6 @@ ixj[cnt].pld_slicw.bits.rly3 = 0; outb_p(ixj[cnt].pld_slicw.byte, ixj[cnt].XILINXbase + 0x01); LED_SetState(0x0, cnt); - release_region(ixj[cnt].XILINXbase, 8); } if (ixj[cnt].cardtype == 400 || ixj[cnt].cardtype == 500) { @@ -4400,16 +6085,22 @@ if (ixj[cnt].dev) ixj[cnt].dev->deactivate(ixj[cnt].dev); #endif +#ifdef CONFIG_PCMCIA + DEBUG(0, "ixj_cs: unloading\n"); + unregister_pcmcia_driver(&dev_info); + while (dev_list != NULL) + ixj_detach(dev_list); +#endif } + proc_unregister(&proc_root, ixj_proc_entry.low_ino); + proc_unregister(&proc_root, ixjfsk_proc_entry.low_ino); } - // Typedefs typedef struct { BYTE length; DWORD bits; } DATABLOCK; - static void PCIEE_WriteBit(WORD wEEPROMAddress, BYTE lastLCC, BYTE byData) { lastLCC = lastLCC & 0xfb; @@ -4422,7 +6113,6 @@ byData = byData << 1; lastLCC = lastLCC & 0xfe; - udelay(1000); outb(lastLCC, wEEPROMAddress); //after delay, SK falling edge @@ -4447,11 +6137,8 @@ WORD wEEPROMAddress = wAddress + 3; DWORD i; BYTE byResult; - *pwResult = 0; - lastLCC = inb(wEEPROMAddress); - lastLCC = lastLCC | 0x02; lastLCC = lastLCC & 0xfe; outb(lastLCC, wEEPROMAddress); // CS hi, SK lo @@ -4461,7 +6148,6 @@ PCIEE_WriteBit(wEEPROMAddress, lastLCC, 1); PCIEE_WriteBit(wEEPROMAddress, lastLCC, 1); PCIEE_WriteBit(wEEPROMAddress, lastLCC, 0); - for (i = 0; i < 8; i++) { PCIEE_WriteBit(wEEPROMAddress, lastLCC, wLoc & 0x80 ? 1 : 0); wLoc <<= 1; @@ -4483,45 +6169,58 @@ static DWORD PCIEE_GetSerialNumber(WORD wAddress) { WORD wLo, wHi; - if (PCIEE_ReadWord(wAddress, 62, &wLo)) return 0; - if (PCIEE_ReadWord(wAddress, 63, &wHi)) return 0; - return (((DWORD) wHi << 16) | wLo); } -static int dspio[IXJMAX + 1] = {0,}; -static int xio[IXJMAX + 1] = {0,}; - -MODULE_DESCRIPTION("Internet PhoneJACK/Internet LineJACK module - www.quicknet.net"); -MODULE_AUTHOR("Ed Okerson "); +#ifndef CONFIG_PCMCIA +#ifndef CONFIG_ISAPNP +static int dspio[IXJMAX + 1] = +{ + 0, +}; +static int xio[IXJMAX + 1] = +{ + 0, +}; MODULE_PARM(dspio, "1-" __MODULE_STRING(IXJMAX) "i"); MODULE_PARM(xio, "1-" __MODULE_STRING(IXJMAX) "i"); +#endif +#endif -#ifdef MODULE - -void cleanup_module(void) +void ixj_exit(void) { cleanup(); } -int init_module(void) -#else int __init ixj_init(void) -#endif { int result; - - int func = 0x110, i = 0; + int i = 0; int cnt = 0; int probe = 0; +#ifdef CONFIG_ISAPNP + int func = 0x110; struct pci_dev *dev = NULL, *old_dev = NULL; +#endif +#ifdef CONFIG_PCI struct pci_dev *pci = NULL; - +#endif +#ifdef CONFIG_PCMCIA + servinfo_t serv; + DEBUG(0, "%s\n", version); + CardServices(GetCardServicesInfo, &serv); + if (serv.Revision != CS_RELEASE_CODE) { + printk(KERN_NOTICE "ixj_cs: Card Services release does not match!\n"); + return -1; + } + register_pcmcia_driver(&dev_info, &ixj_attach, &ixj_detach); + probe = 0; +#else #ifdef CONFIG_ISAPNP while (1) { do { @@ -4530,7 +6229,6 @@ ISAPNP_FUNCTION(func), old_dev); if (!dev) break; - printk("preparing %x\n", func); result = dev->prepare(dev); if (result < 0) { printk("preparing failed %d \n", result); @@ -4548,7 +6246,6 @@ ixj[cnt].DSPbase = dev->resource[0].start; /* get real port */ if (func != 0x110) ixj[cnt].XILINXbase = dev->resource[1].start; /* get real port */ - result = check_region(ixj[cnt].DSPbase, 16); if (result) { printk(KERN_INFO "ixj: can't get I/O address 0x%x\n", ixj[cnt].DSPbase); @@ -4568,13 +6265,21 @@ break; } probe = ixj_selfprobe(cnt); - ixj[cnt].serial = dev->bus->serial; ixj[cnt].dev = dev; - printk(KERN_INFO "ixj: found card at 0x%x\n", ixj[cnt].DSPbase); + switch (func) { + case 0x110: + printk(KERN_INFO "ixj: found Internet PhoneJACK at 0x%x\n", ixj[cnt].DSPbase); + break; + case 0x310: + printk(KERN_INFO "ixj: found Internet LineJACK at 0x%x\n", ixj[cnt].DSPbase); + break; + case 0x410: + printk(KERN_INFO "ixj: found Internet PhoneJACK Lite at 0x%x\n", ixj[cnt].DSPbase); + break; + } cnt++; } while (dev); - if (func == 0x410) break; if (func == 0x310) @@ -4585,11 +6290,10 @@ } #else //CONFIG_ISAPNP /* Use passed parameters for older kernels without PnP */ - - for (cnt = 0; cnt < IXJMAX; cnt++) { - if (dspio[cnt]) { - ixj[cnt].DSPbase = dspio[cnt]; - ixj[cnt].XILINXbase = xio[cnt]; + for (i = 0; i < IXJMAX; i++) { + if (dspio[i]) { + ixj[cnt].DSPbase = dspio[i]; + ixj[cnt].XILINXbase = xio[i]; ixj[cnt].cardtype = 0; result = check_region(ixj[cnt].DSPbase, 16); if (result) { @@ -4600,22 +6304,21 @@ request_region(ixj[cnt].DSPbase, 16, "ixj DSP"); probe = ixj_selfprobe(cnt); ixj[cnt].dev = NULL; + cnt++; } } -#endif +#endif // !CONFIG_ISAPNP +#endif // CONFIG_PCMCIA #ifdef CONFIG_PCI if (pci_present()) { for (i = 0; i < IXJMAX - cnt; i++) { pci = pci_find_device(0x15E2, 0x0500, pci); if (!pci) break; - if (pci_enable_device(pci)) - break; { ixj[cnt].DSPbase = pci_resource_start(pci, 0); ixj[cnt].XILINXbase = ixj[cnt].DSPbase + 0x10; ixj[cnt].serial = (PCIEE_GetSerialNumber)pci_resource_start(pci, 2); - result = check_region(ixj[cnt].DSPbase, 16); if (result) { printk(KERN_INFO "ixj: can't get I/O address 0x%x\n", ixj[cnt].DSPbase); @@ -4625,32 +6328,38 @@ request_region(ixj[cnt].DSPbase, 16, "ixj DSP"); ixj[cnt].cardtype = 500; probe = ixj_selfprobe(cnt); + if (probe) + printk(KERN_INFO "ixj: found Internet PhoneJACK PCI at 0x%x\n", ixj[cnt].DSPbase); cnt++; } } } #endif printk("%s\n", ixj_c_rcsid); - + proc_register(&proc_root, &ixj_proc_entry); + proc_register(&proc_root, &ixjfsk_proc_entry); ixj_init_timer(); - ixj_add_timer(); + ixj_add_timer(); return probe; } +module_init(ixj_init); +module_exit(ixj_exit); + static void DAA_Coeff_US(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_US; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 0E,32,E2,2F,C2,5A,C0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x0E; +// Bytes for IM-filter part 1 (04): 0E,32,E2,2F,C2,5A,C0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x0E; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0xE2; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0x2F; @@ -4658,7 +6367,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xC0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - // Bytes for IM-filter part 2 (05): 72,85,00,0E,2B,3A,D0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x72; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0x85; @@ -4668,7 +6376,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x3A; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xD0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 03,8F,48,F2,8F,48,70,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x03; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0x8F; @@ -4678,7 +6385,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0x48; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0x70; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 04,8F,38,7F,9B,EA,B0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x04; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x8F; @@ -4688,19 +6394,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xEA; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0xB0; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): 16,55,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0x16; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0x55; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): 52,D3,11,42 j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0xD3; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0x42; - // Bytes for TH-filter part 1 (00): 00,42,48,81,B3,80,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x42; @@ -4710,7 +6413,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,F2,33,A0,68,AB,8A,AD j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0xF2; @@ -4720,7 +6422,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0xAB; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x8A; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0xAD; - // Bytes for TH-filter part 3 (02): 00,88,DA,54,A4,BA,2D,BB j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -4730,7 +6431,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0xBA; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0x2D; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0xBB; - // ; (10K, 0.68uF) // // Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 @@ -4742,7 +6442,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x1C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x13; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0x42; @@ -4752,14 +6451,12 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x73; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // // Levelmetering Ringing (0D):B2,45,0F,8E j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xB2; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -4769,7 +6466,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -4779,64 +6475,52 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // // ;CR Registers // Config. Reg. 0 (filters) (cr0):FE ; CLK gen. by crystal - j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFE; - + j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; // Config. Reg. 1 (dialing) (cr1):05 j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):03 ; SEL Bit==0, HP-disabled j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x03; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 // - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C // Cadence, RING, Caller ID, VDD_OK -// Ext. Reg. 1 (Interrupt enable) (xr1):1C // Cadence, RING, Caller ID, VDD_OK j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x3C; - // Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off == 1 j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x12; //0x32; + // Ext. Reg. 4 (Cadence) (xr4):00 -// Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):40 j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; // 0x40 ??? Should it be 0x00? - -// + // // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz @@ -4845,23 +6529,22 @@ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static void DAA_Coeff_UK(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_UK; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 00,C2,BB,A8,CB,81,A0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; +// Bytes for IM-filter part 1 (04): 00,C2,BB,A8,CB,81,A0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0xC2; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0xBB; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0xA8; @@ -4869,8 +6552,7 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0x81; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xA0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - - // Bytes for IM-filter part 2 (05): 40,00,00,0A,A4,33,E0,08 +// Bytes for IM-filter part 2 (05): 40,00,00,0A,A4,33,E0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x40; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[5] = 0x00; @@ -4879,7 +6561,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x33; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xE0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 07,9B,ED,24,B2,A2,A0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x07; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0x9B; @@ -4889,7 +6570,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0xA2; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0xA0; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 0F,92,F2,B2,87,D2,30,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x92; @@ -4899,19 +6579,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xD2; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0x30; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): 1B,A5,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0xA5; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): E2,27,10,D6 j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0xE2; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0x27; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x10; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0xD6; - // Bytes for TH-filter part 1 (00): 80,2D,38,8B,D0,00,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x2D; @@ -4921,7 +6598,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,5A,53,F0,0B,5F,84,D4 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0x5A; @@ -4931,7 +6607,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0x5F; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x84; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0xD4; - // Bytes for TH-filter part 3 (02): 00,88,6A,A4,8F,52,F5,32 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -4941,10 +6616,8 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0xF5; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0x32; - // ; idle - -// Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 + // Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0x3C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0x93; @@ -4953,7 +6626,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0xA2; @@ -4963,13 +6635,11 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V less possible? j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xAA; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x35; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -4979,7 +6649,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -4989,61 +6658,49 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // ;CR Registers // Config. Reg. 0 (filters) (cr0):FF - j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; //0xFE; - + j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFE; // Config. Reg. 1 (dialing) (cr1):05 j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):00 ; j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x00; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C -// Ext. Reg. 1 (Interrupt enable) (xr1):1C j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x1C; // RING, Caller ID, VDD_OK + // Ext. Reg. 2 (Cadence Time Out) (xr2):7D -// Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):36 ; j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x36; - // Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):46 j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x46; // 0x46 ??? Should it be 0x00? - -// DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz + // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz @@ -5052,24 +6709,23 @@ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static void DAA_Coeff_France(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_FRANCE; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 02,A2,43,2C,22,AF,A0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x02; +// Bytes for IM-filter part 1 (04): 02,A2,43,2C,22,AF,A0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0xA2; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0x43; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0x2C; @@ -5077,7 +6733,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0xAF; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xA0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - // Bytes for IM-filter part 2 (05): 67,CE,00,0C,22,33,E0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x67; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0xCE; @@ -5087,7 +6742,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x33; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xE0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 07,9A,28,F6,23,4A,B0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x07; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0x9A; @@ -5097,7 +6751,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0x4A; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0xB0; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 03,8F,F9,2F,9E,FA,20,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x03; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x8F; @@ -5107,19 +6760,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xFA; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0x20; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): 16,B5,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0x16; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0xB5; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): 52,C7,10,D6 j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0xE2; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0xC7; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x10; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0xD6; - // Bytes for TH-filter part 1 (00): 00,42,48,81,A6,80,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x42; @@ -5129,7 +6779,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,AC,2A,30,78,AC,8A,2C j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0xAC; @@ -5139,7 +6788,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0xAC; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x8A; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0x2C; - // Bytes for TH-filter part 3 (02): 00,88,DA,A5,22,BA,2C,45 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -5149,10 +6797,8 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0xBA; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0x2C; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0x45; - // ; idle - -// Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 + // Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0x3C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0x93; @@ -5161,7 +6807,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0xA2; @@ -5171,13 +6816,11 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0xB5; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x84; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -5187,7 +6830,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -5197,61 +6839,49 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // ;CR Registers // Config. Reg. 0 (filters) (cr0):FF - j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; - + j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFE; // Config. Reg. 1 (dialing) (cr1):05 j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):00 ; j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x00; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C -// Ext. Reg. 1 (Interrupt enable) (xr1):1C j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x1C; // RING, Caller ID, VDD_OK + // Ext. Reg. 2 (Cadence Time Out) (xr2):7D -// Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):36 ; j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x36; - // Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):46 j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x46; // 0x46 ??? Should it be 0x00? - -// DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz + // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz @@ -5260,24 +6890,23 @@ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static void DAA_Coeff_Germany(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_GERMANY; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 00,CE,BB,B8,D2,81,B0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; +// Bytes for IM-filter part 1 (04): 00,CE,BB,B8,D2,81,B0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0xCE; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0xBB; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0xB8; @@ -5285,7 +6914,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0x81; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xB0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - // Bytes for IM-filter part 2 (05): 45,8F,00,0C,D2,3A,D0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0x8F; @@ -5295,7 +6923,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x3A; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xD0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 07,AA,E2,34,24,89,20,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x07; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0xAA; @@ -5305,7 +6932,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0x89; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0x20; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 02,87,FA,37,9A,CA,B0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x87; @@ -5315,19 +6941,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0xB0; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): 72,D5,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0x72; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0xD5; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): 72,42,13,4B j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0x72; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0x42; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x13; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0x4B; - // Bytes for TH-filter part 1 (00): 80,52,48,81,AD,80,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x52; @@ -5337,7 +6960,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,42,5A,20,E8,1A,81,27 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0x42; @@ -5347,7 +6969,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0x1A; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x81; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0x27; - // Bytes for TH-filter part 3 (02): 00,88,63,26,BD,4B,A3,C2 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -5357,10 +6978,8 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0x4B; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0xC2; - // ; (10K, 0.68uF) - -// Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 + // Bytes for Ringing part 1 (03):1B,3B,9B,BA,D4,1C,B3,23 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0x3B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0x9B; @@ -5369,7 +6988,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x1C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):13,42,A6,BA,D4,73,CA,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x13; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0x42; @@ -5379,13 +6997,11 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x73; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // Levelmetering Ringing (0D):B2,45,0F,8E j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xB2; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -5395,7 +7011,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -5405,61 +7020,49 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // ;CR Registers // Config. Reg. 0 (filters) (cr0):FF ; all Filters enabled, CLK from ext. source - j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; - + j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFE; // Config. Reg. 1 (dialing) (cr1):05 ; Manual Ring, Ring metering enabled j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 ; Analog Gain 0dB, FSC internal j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):00 ; SEL Bit==0, HP-enabled j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x00; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C ; Ring, CID, VDDOK Interrupts enabled -// Ext. Reg. 1 (Interrupt enable) (xr1):1C ; Ring, CID, VDDOK Interrupts enabled j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x1C; // RING, Caller ID, VDD_OK + // Ext. Reg. 2 (Cadence Time Out) (xr2):7D -// Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):32 ; B-Filter Off==1, U0=3.5V, R=200Ohm j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x32; - // Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):40 ; VDD=4.25 V j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; // 0x40 ??? Should it be 0x00? - -// DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz + // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz @@ -5468,24 +7071,23 @@ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static void DAA_Coeff_Australia(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_AUSTRALIA; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 00,A3,AA,28,B3,82,D0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; +// Bytes for IM-filter part 1 (04): 00,A3,AA,28,B3,82,D0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0xAA; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0x28; @@ -5493,7 +7095,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0x82; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xD0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - // Bytes for IM-filter part 2 (05): 70,96,00,09,32,6B,C0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x70; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0x96; @@ -5503,7 +7104,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x6B; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xC0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 07,96,E2,34,32,9B,30,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x07; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0x96; @@ -5513,7 +7113,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0x9B; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0x30; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 0F,9A,E9,2F,22,CC,A0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x9A; @@ -5523,19 +7122,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xCC; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0xA0; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): CB,45,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0xCB; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): 1B,67,10,D6 j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0x67; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x10; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0xD6; - // Bytes for TH-filter part 1 (00): 80,52,48,81,AF,80,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x52; @@ -5545,7 +7141,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,DB,52,B0,38,01,82,AC j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0xDB; @@ -5555,7 +7150,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0x01; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x82; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0xAC; - // Bytes for TH-filter part 3 (02): 00,88,4A,3E,2C,3B,24,46 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -5565,10 +7159,8 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0x3B; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0x24; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0x46; - // ; idle - -// Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 + // Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0x3C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0x93; @@ -5577,7 +7169,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0xA2; @@ -5587,13 +7178,11 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x45; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0xB5; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x84; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -5603,7 +7192,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -5613,61 +7201,49 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // ;CR Registers // Config. Reg. 0 (filters) (cr0):FF j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; - // Config. Reg. 1 (dialing) (cr1):05 j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):00 ; j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x00; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C -// Ext. Reg. 1 (Interrupt enable) (xr1):1C j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x1C; // RING, Caller ID, VDD_OK + // Ext. Reg. 2 (Cadence Time Out) (xr2):7D -// Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):2B ; j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x2B; - // Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):40 j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; // 0x40 ??? Should it be 0x00? - -// DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz + // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz @@ -5676,23 +7252,22 @@ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static void DAA_Coeff_Japan(int board) { IXJ *j = &ixj[board]; - int i; + j->daa_country = DAA_JAPAN; //----------------------------------------------- // CAO for (i = 0; i < ALISDAA_CALLERID_SIZE; i++) { j->m_DAAShadowRegs.CAO_REGS.CAO.CallerID[i] = 0; } - // Bytes for IM-filter part 1 (04): 06,BD,E2,2D,BA,F9,A0,00 - j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x06; +// Bytes for IM-filter part 1 (04): 06,BD,E2,2D,BA,F9,A0,00 + j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[7] = 0x06; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[6] = 0xBD; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[5] = 0xE2; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[4] = 0x2D; @@ -5700,7 +7275,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[2] = 0xF9; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[1] = 0xA0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_1[0] = 0x00; - // Bytes for IM-filter part 2 (05): 6F,F7,00,0E,34,33,E0,08 j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[7] = 0x6F; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[6] = 0xF7; @@ -5710,7 +7284,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[2] = 0x33; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[1] = 0xE0; j->m_DAAShadowRegs.COP_REGS.COP.IMFilterCoeff_2[0] = 0x08; - // Bytes for FRX-filter (08): 02,8F,68,77,9C,58,F0,08 j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[6] = 0x8F; @@ -5720,7 +7293,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[2] = 0x58; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[1] = 0xF0; j->m_DAAShadowRegs.COP_REGS.COP.FRXFilterCoeff[0] = 0x08; - // Bytes for FRR-filter (07): 03,8F,38,73,87,EA,20,08 j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[7] = 0x03; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[6] = 0x8F; @@ -5730,19 +7302,16 @@ j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[2] = 0xEA; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[1] = 0x20; j->m_DAAShadowRegs.COP_REGS.COP.FRRFilterCoeff[0] = 0x08; - // Bytes for AX-filter (0A): 51,C5,DD,CA j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[3] = 0x51; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[2] = 0xC5; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[1] = 0xDD; j->m_DAAShadowRegs.COP_REGS.COP.AXFilterCoeff[0] = 0xCA; - // Bytes for AR-filter (09): 25,A7,10,D6 j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[3] = 0x25; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[2] = 0xA7; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[1] = 0x10; j->m_DAAShadowRegs.COP_REGS.COP.ARFilterCoeff[0] = 0xD6; - // Bytes for TH-filter part 1 (00): 00,42,48,81,AE,80,00,98 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[6] = 0x42; @@ -5752,7 +7321,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[2] = 0x80; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_1[0] = 0x98; - // Bytes for TH-filter part 2 (01): 02,AB,2A,20,99,5B,89,28 j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[7] = 0x02; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[6] = 0xAB; @@ -5762,7 +7330,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[2] = 0x5B; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[1] = 0x89; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_2[0] = 0x28; - // Bytes for TH-filter part 3 (02): 00,88,DA,25,34,C5,4C,BA j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[7] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[6] = 0x88; @@ -5772,10 +7339,8 @@ j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[2] = 0xC5; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0x4C; j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0xBA; - // ; idle - -// Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 + // Bytes for Ringing part 1 (03):1B,3C,93,3A,22,12,A3,23 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[7] = 0x1B; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[6] = 0x3C; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[5] = 0x93; @@ -5784,7 +7349,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[2] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[1] = 0xA3; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_1[0] = 0x23; - // Bytes for Ringing part 2 (06):12,A2,A6,BA,22,7A,0A,D5 j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[7] = 0x12; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[6] = 0xA2; @@ -5794,13 +7358,11 @@ j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[2] = 0x7A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[1] = 0x0A; j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5; - // Levelmetering Ringing (0D):AA,35,0F,8E ; 25Hz 30V ????????? j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[3] = 0xAA; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x35; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F; j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E; - // Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E; @@ -5810,7 +7372,6 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99; j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99; - // Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5; @@ -5820,76 +7381,62 @@ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00; j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00; - // ;CR Registers // Config. Reg. 0 (filters) (cr0):FF - j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF; - + j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFE; // Config. Reg. 1 (dialing) (cr1):05 j->m_DAAShadowRegs.SOP_REGS.SOP.cr1.reg = 0x05; - // Config. Reg. 2 (caller ID) (cr2):04 j->m_DAAShadowRegs.SOP_REGS.SOP.cr2.reg = 0x04; - // Config. Reg. 3 (testloops) (cr3):00 ; j->m_DAAShadowRegs.SOP_REGS.SOP.cr3.reg = 0x00; - // Config. Reg. 4 (analog gain) (cr4):01 j->m_DAAShadowRegs.SOP_REGS.SOP.cr4.reg = 0x02; //0x01; - -// Config. Reg. 5 (Version) (cr5):02 + // Config. Reg. 5 (Version) (cr5):02 // Config. Reg. 6 (Reserved) (cr6):00 // Config. Reg. 7 (Reserved) (cr7):00 - -// ;xr Registers + // ;xr Registers // Ext. Reg. 0 (Interrupt Reg.) (xr0):02 + j->m_DAAShadowRegs.XOP_xr0_W.reg = 0x02; // SO_1 set to '1' because it is inverted. + // Ext. Reg. 1 (Interrupt enable) (xr1):1C -// Ext. Reg. 1 (Interrupt enable) (xr1):1C j->m_DAAShadowRegs.XOP_REGS.XOP.xr1.reg = 0x1C; // RING, Caller ID, VDD_OK + // Ext. Reg. 2 (Cadence Time Out) (xr2):7D -// Ext. Reg. 2 (Cadence Time Out) (xr2):7D j->m_DAAShadowRegs.XOP_REGS.XOP.xr2.reg = 0x7D; - // Ext. Reg. 3 (DC Char) (xr3):22 ; j->m_DAAShadowRegs.XOP_REGS.XOP.xr3.reg = 0x22; - // Ext. Reg. 4 (Cadence) (xr4):00 j->m_DAAShadowRegs.XOP_REGS.XOP.xr4.reg = 0x00; - // Ext. Reg. 5 (Ring timer) (xr5):22 j->m_DAAShadowRegs.XOP_REGS.XOP.xr5.reg = 0x22; - // Ext. Reg. 6 (Power State) (xr6):00 j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00; - // Ext. Reg. 7 (Vdd) (xr7):40 j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; // 0x40 ??? Should it be 0x00? - -// DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz + // DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz // 12,33,5A,C3 ; 770 Hz // 13,3C,5B,32 ; 852 Hz // 1D,1B,5C,CC ; 941 Hz + j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A; j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C; - // DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz // EC,1D,52,22 ; 1336 Hz // AA,AC,51,D2 ; 1477 Hz // 9B,3B,51,25 ; 1633 Hz - j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52; j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3; - } static s16 tone_table[][19] = { - { // f20_50[] + { // f20_50[] 11 32538, // A1 = 1.985962 -32325, // A2 = -0.986511 -343, // B2 = -0.010493 @@ -5910,7 +7457,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // f133_200[] + { // f133_200[] 12 32072, // A1 = 1.95752 -31896, // A2 = -0.973419 -435, // B2 = -0.013294 @@ -5931,7 +7478,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // 300.txt + { // 300.txt 13 31769, // A1 = -1.939026 -32584, // A2 = 0.994385 -475, // B2 = -0.014522 @@ -5952,7 +7499,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // f300_420[] + { // f300_420[] 14 30750, // A1 = 1.876892 -31212, // A2 = -0.952515 -804, // B2 = -0.024541 @@ -5973,7 +7520,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // 330.txt + { // 330.txt 15 31613, // A1 = -1.929565 -32646, // A2 = 0.996277 -185, // B2 = -0.005657 @@ -5994,7 +7541,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // f300_425[] + { // f300_425[] 16 30741, // A1 = 1.876282 -31475, // A2 = -0.960541 -703, // B2 = -0.021484 @@ -6015,7 +7562,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // f330_440[] + { // f330_440[] 17 30627, // A1 = 1.869324 -31338, // A2 = -0.95636 -843, // B2 = -0.025749 @@ -6036,7 +7583,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // 340.txt + { // 340.txt 18 31546, // A1 = -1.925476 -32646, // A2 = 0.996277 -445, // B2 = -0.013588 @@ -6057,7 +7604,7 @@ 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 }, - { // f350_400[] + { // f350_400[] 19 31006, // A1 = 1.892517 -32029, // A2 = -0.977448 -461, // B2 = -0.014096 @@ -7421,21 +8968,19 @@ 159, // Minimum in-band energy threshold 21, // 21/32 in-band to broad-band ratio 0x0FF5 // shift-mask 0x0FF (look at 16 half-frames) bit count = 5 - },}; - + }, +}; static int ixj_init_filter(int board, IXJ_FILTER * jf) { unsigned short cmd; int cnt, max; IXJ *j = &ixj[board]; - if (jf->filter > 3) { return -1; } if (ixj_WriteDSPCommand(0x5154 + jf->filter, board)) // Select Filter return -1; - if (!jf->enable) { if (ixj_WriteDSPCommand(0x5152, board)) // Disable Filter @@ -7446,7 +8991,6 @@ if (ixj_WriteDSPCommand(0x5153, board)) // Enable Filter return -1; - // Select the filter (f0 - f3) to use. if (ixj_WriteDSPCommand(0x5154 + jf->filter, board)) return -1; @@ -7463,7 +9007,6 @@ // frequency we want. if (ixj_WriteDSPCommand(0x5170 + jf->filter, board)) return -1; - if (j->ver.low != 0x12) { cmd = 0x515B; max = 19; @@ -7473,23 +9016,12 @@ } if (ixj_WriteDSPCommand(cmd, board)) return -1; - for (cnt = 0; cnt < max; cnt++) { - if (ixj_WriteDSPCommand(tone_table[jf->freq][cnt], board)) + if (ixj_WriteDSPCommand(tone_table[jf->freq - 12][cnt], board)) return -1; } -/* if(j->ver.low != 0x12) - { - if(ixj_WriteDSPCommand(7, board)) - return -1; - if(ixj_WriteDSPCommand(159, board)) - return -1; - if(ixj_WriteDSPCommand(21, board)) - return -1; - if(ixj_WriteDSPCommand(0x0FF5, board)) - return -1; - } */ } + j->filter_en[jf->filter] = jf->enable; return 0; } @@ -7497,7 +9029,6 @@ { int freq0, freq1; unsigned short data; - if (ti->freq0) { freq0 = ti->freq0; } else { @@ -7510,18 +9041,15 @@ freq1 = 0x7FFF; } -// if(ti->tone_index > 12 && ti->tone_index < 28) + if(ti->tone_index > 12 && ti->tone_index < 28) { if (ixj_WriteDSPCommand(0x6800 + ti->tone_index, board)) return -1; - if (ixj_WriteDSPCommand(0x6000 + (ti->gain0 << 4) + ti->gain1, board)) return -1; - data = freq0; if (ixj_WriteDSPCommand(data, board)) return -1; - data = freq1; if (ixj_WriteDSPCommand(data, board)) return -1; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/telephony/ixj.h linux/drivers/telephony/ixj.h --- v2.4.0-test8/linux/drivers/telephony/ixj.h Wed Dec 29 17:13:59 1999 +++ linux/drivers/telephony/ixj.h Mon Sep 18 15:02:03 2000 @@ -1,4 +1,4 @@ -/* +/****************************************************************************** * ixj.h * * Device Driver for the Internet PhoneJACK and @@ -22,9 +22,20 @@ * at our website: http://www.quicknet.net * * Fixes: - * Linux 2.3 port, Alan Cox - */ -static char ixj_h_rcsid[] = "$Id: ixj.h,v 3.4 1999/12/16 22:18:36 root Exp root $"; + * + * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET + * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION + * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + *****************************************************************************/ +static char ixj_h_rcsid[] = "$Id: ixj.h,v 3.14 2000/03/30 22:06:48 eokerson Exp $"; #ifndef _I386_TYPES_H #include @@ -61,6 +72,27 @@ unsigned char high; } BYTES; +typedef union { + BYTES bytes; + short word; +} IXJ_WORD; + +typedef struct{ + unsigned int b0:1; + unsigned int b1:1; + unsigned int b2:1; + unsigned int b3:1; + unsigned int b4:1; + unsigned int b5:1; + unsigned int b6:1; + unsigned int b7:1; +} IXJ_CBITS; + +typedef union{ + IXJ_CBITS cbits; + char cbyte; +} IXJ_CBYTE; + int ixj_WriteDSPCommand(unsigned short, int board); /****************************************************************************** @@ -328,6 +360,199 @@ /****************************************************************************** * +* These structures deal with the control logic on the Internet PhoneCARD +* +******************************************************************************/ +typedef struct { + unsigned int x0:4; // unused bits + + unsigned int ed:1; // Event Detect + + unsigned int drf:1; // Smart Cable Removal Flag 1=no cable + + unsigned int dspf:1; // DSP Flag 1=DSP Ready + + unsigned int crr:1; // Control Register Ready + +} COMMAND_REG1; + +typedef union { + COMMAND_REG1 bits; + unsigned char byte; +} PCMCIA_CR1; + +typedef struct { + unsigned int x0:4; // unused bits + + unsigned int rstc:1; // Smart Cable Reset + + unsigned int pwr:1; // Smart Cable Power + + unsigned int x1:2; // unused bits + +} COMMAND_REG2; + +typedef union { + COMMAND_REG2 bits; + unsigned char byte; +} PCMCIA_CR2; + +typedef struct { + unsigned int addr:5; // R/W Smart Cable Register Address + + unsigned int rw:1; // Read / Write flag + + unsigned int dev:2; // 2 bit Smart Cable Device Address + +} CONTROL_REG; + +typedef union { + CONTROL_REG bits; + unsigned char byte; +} PCMCIA_SCCR; + +typedef struct { + unsigned int hsw:1; + unsigned int det:1; + unsigned int led2:1; + unsigned int led1:1; + unsigned int ring1:1; + unsigned int ring0:1; + unsigned int x:1; + unsigned int powerdown:1; +} PCMCIA_SLIC_REG; + +typedef union { + PCMCIA_SLIC_REG bits; + unsigned char byte; +} PCMCIA_SLIC; + +typedef struct { + unsigned int cpd:1; // Chip Power Down + + unsigned int mpd:1; // MIC Bias Power Down + + unsigned int hpd:1; // Handset Drive Power Down + + unsigned int lpd:1; // Line Drive Power Down + + unsigned int spd:1; // Speaker Drive Power Down + + unsigned int x:2; // unused bits + + unsigned int sr:1; // Software Reset + +} Si3CONTROL1; + +typedef union { + Si3CONTROL1 bits; + unsigned char byte; +} Si3C1; + +typedef struct { + unsigned int al:1; // Analog Loopback DAC analog -> ADC analog + + unsigned int dl2:1; // Digital Loopback DAC -> ADC one bit + + unsigned int dl1:1; // Digital Loopback ADC -> DAC one bit + + unsigned int pll:1; // 1 = div 10, 0 = div 5 + + unsigned int hpd:1; // HPF disable + + unsigned int x:3; // unused bits + +} Si3CONTROL2; + +typedef union { + Si3CONTROL2 bits; + unsigned char byte; +} Si3C2; + +typedef struct { + unsigned int iir:1; // 1 enables IIR, 0 enables FIR + + unsigned int him:1; // Handset Input Mute + + unsigned int mcm:1; // MIC In Mute + + unsigned int mcg:2; // MIC In Gain + + unsigned int lim:1; // Line In Mute + + unsigned int lig:2; // Line In Gain + +} Si3RXGAIN; + +typedef union { + Si3RXGAIN bits; + unsigned char byte; +} Si3RXG; + +typedef struct { + unsigned int hom:1; // Handset Out Mute + + unsigned int lom:1; // Line Out Mute + + unsigned int rxg:5; // RX PGA Gain + + unsigned int x:1; // unused bit + +} Si3ADCVOLUME; + +typedef union { + Si3ADCVOLUME bits; + unsigned char byte; +} Si3ADC; + +typedef struct { + unsigned int srm:1; // Speaker Right Mute + + unsigned int slm:1; // Speaker Left Mute + + unsigned int txg:5; // TX PGA Gain + + unsigned int x:1; // unused bit + +} Si3DACVOLUME; + +typedef union { + Si3DACVOLUME bits; + unsigned char byte; +} Si3DAC; + +typedef struct { + unsigned int x:5; // unused bit + + unsigned int losc:1; // Line Out Short Circuit + + unsigned int srsc:1; // Speaker Right Short Circuit + + unsigned int slsc:1; // Speaker Left Short Circuit + +} Si3STATUSREPORT; + +typedef union { + Si3STATUSREPORT bits; + unsigned char byte; +} Si3STAT; + +typedef struct { + unsigned int sot:2; // Speaker Out Attenuation + + unsigned int lot:2; // Line Out Attenuation + + unsigned int x:4; // unused bits + +} Si3ANALOGATTN; + +typedef union { + Si3ANALOGATTN bits; + unsigned char byte; +} Si3AATT; + +/****************************************************************************** +* * These structures deal with the DAA on the Internet LineJACK * ******************************************************************************/ @@ -855,10 +1080,49 @@ }; typedef struct { + char enable; + char en_filter; + unsigned int filter; + unsigned int state; // State 0 when cadence has not started. + + unsigned int on1; // State 1 + + unsigned long on1min; // State 1 - 10% + jiffies + unsigned long on1dot; // State 1 + jiffies + + unsigned long on1max; // State 1 + 10% + jiffies + + unsigned int off1; // State 2 + + unsigned long off1min; + unsigned long off1max; + unsigned int on2; // State 3 + + unsigned long on2min; + unsigned long on2dot; + unsigned long on2max; + unsigned int off2; // State 4 + + unsigned long off2min; + unsigned long off2max; + unsigned int on3; // State 5 + + unsigned long on3min; + unsigned long on3dot; + unsigned long on3max; + unsigned int off3; // State 6 + + unsigned long off3min; + unsigned long off3max; +} IXJ_CADENCE_F; + +typedef struct { unsigned int busytone:1; unsigned int dialtone:1; unsigned int ringback:1; unsigned int ringing:1; + unsigned int playing:1; + unsigned int recording:1; unsigned int cringing:1; unsigned int play_first_frame:1; unsigned int pstn_present:1; @@ -869,6 +1133,28 @@ unsigned int ts85_loaded:1; unsigned int dtmf_oob:1; // DTMF Out-Of-Band + unsigned int pcmciascp:1; // Smart Cable Present + + unsigned int pcmciasct:2; // Smart Cable Type + + unsigned int pcmciastate:3; // Smart Cable Init State + + unsigned int inwrite:1; // Currently writing + + unsigned int inread:1; // Currently reading + + unsigned int incheck:1; // Currently checking the smart cable + + unsigned int cidplay:1; // Currently playing Caller ID + + unsigned int cidring:1; // This is the ring for Caller ID + + unsigned int cidsent:1; // Caller ID has been sent + + unsigned int cidcw_ack:1; // Caller ID CW ACK (from CPE) + + unsigned int x:6; // unsed bits + } IXJ_FLAGS; /****************************************************************************** @@ -885,15 +1171,19 @@ unsigned int serial; struct phone_capability caplist[30]; unsigned int caps; + unsigned int country; struct pci_dev *dev; unsigned int cardtype; unsigned int rec_codec; char rec_mode; unsigned int play_codec; + unsigned int cid_play_codec; char play_mode; IXJ_FLAGS flags; unsigned int rec_frame_size; unsigned int play_frame_size; + unsigned int cid_base_frame_size; + unsigned long cidcw_wait; int aec_level; int readers, writers; wait_queue_head_t poll_q; @@ -920,6 +1210,7 @@ char maxrings; IXJ_CADENCE *cadence_t; int tone_cadence_state; + IXJ_CADENCE_F cadence_f[4]; DTMF dtmf; CPTF cptf; BYTES dsp; @@ -934,30 +1225,50 @@ PLD_SLICW pld_slicw; PLD_SLICR pld_slicr; PLD_CLOCK pld_clock; + PCMCIA_CR1 pccr1; + PCMCIA_CR2 pccr2; + PCMCIA_SCCR psccr; + PCMCIA_SLIC pslic; + char pscdd; + Si3C1 sic1; + Si3C2 sic2; + Si3RXG sirxg; + Si3ADC siadc; + Si3DAC sidac; + Si3STAT sistat; + Si3AATT siaatt; MIX mix; unsigned short ring_cadence; int ring_cadence_t; unsigned long ring_cadence_jif; + unsigned long checkwait; int intercom; int m_hook; int r_hook; char pstn_envelope; char pstn_cid_intr; + unsigned char fskz; + unsigned char fskphase; + unsigned char fskcnt; unsigned pstn_cid_recieved; - IXJ_CID cid; + PHONE_CID cid; + PHONE_CID cid_send; unsigned long pstn_ring_start; + unsigned long pstn_ring_stop; unsigned long pstn_winkstart; unsigned int winktime; + unsigned long flash_end; char port; union telephony_exception ex; char daa_mode; + char daa_country; unsigned long pstn_sleeptil; DAA_REGS m_DAAShadowRegs; Proc_Info_Type Info_read; Proc_Info_Type Info_write; unsigned short frame_count; - unsigned int filter_cadence; unsigned int filter_hist[4]; + unsigned char filter_en[4]; unsigned short proc_load; unsigned long framesread; unsigned long frameswritten; @@ -966,6 +1277,8 @@ unsigned long timerchecks; unsigned long txreadycheck; unsigned long rxreadycheck; + short fskdata[8000]; + int fskdcnt; } IXJ; typedef int (*IXJ_REGFUNC) (IXJ * j, unsigned long arg); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/telephony/phonedev.c linux/drivers/telephony/phonedev.c --- v2.4.0-test8/linux/drivers/telephony/phonedev.c Mon Jul 24 17:04:12 2000 +++ linux/drivers/telephony/phonedev.c Sun Sep 17 09:45:07 2000 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -143,40 +144,29 @@ * Board init functions */ -extern int ixj_init(void); /* * Initialise Telephony for linux */ -int telephony_init(void) +static int __init telephony_init(void) { printk(KERN_INFO "Linux telephony interface: v1.00\n"); if (register_chrdev(PHONE_MAJOR, "telephony", &phone_fops)) { printk("phonedev: unable to get major %d\n", PHONE_MAJOR); return -EIO; } - /* - * Init kernel installed drivers - */ -#ifdef CONFIG_PHONE_IXJ - ixj_init(); -#endif - return 0; -} -#ifdef MODULE -int init_module(void) -{ - return telephony_init(); + return 0; } -void cleanup_module(void) +static void __exit telephony_exit(void) { unregister_chrdev(PHONE_MAJOR, "telephony"); } -#endif +module_init(telephony_init); +module_exit(telephony_exit); EXPORT_SYMBOL(phone_register_device); EXPORT_SYMBOL(phone_unregister_device); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/Config.in linux/drivers/usb/Config.in --- v2.4.0-test8/linux/drivers/usb/Config.in Tue Aug 22 15:20:52 2000 +++ linux/drivers/usb/Config.in Mon Sep 18 15:23:30 2000 @@ -72,6 +72,7 @@ dep_tristate ' USB Diamond Rio500 support (EXPERIMENTAL)' CONFIG_USB_RIO500 $CONFIG_USB dep_tristate ' D-Link USB FM radio support (EXPERIMENTAL)' CONFIG_USB_DSBR $CONFIG_USB $CONFIG_VIDEO_DEV dep_tristate ' USB Bluetooth support (EXPERIMENTAL)' CONFIG_USB_BLUETOOTH $CONFIG_USB + dep_tristate ' NetChip 1080-based USB Host-to-Host Link (EXPERIMENTAL)' CONFIG_USB_NET1080 $CONFIG_USB $CONFIG_NET fi comment 'USB Human Interface Devices (HID)' diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/Makefile linux/drivers/usb/Makefile --- v2.4.0-test8/linux/drivers/usb/Makefile Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/Makefile Mon Sep 18 15:23:30 2000 @@ -65,6 +65,7 @@ obj-$(CONFIG_USB_DSBR) += dsbr100.o obj-$(CONFIG_USB_MICROTEK) += microtek.o obj-$(CONFIG_USB_BLUETOOTH) += bluetooth.o +obj-$(CONFIG_USB_NET1080) += net1080.o # Object files in subdirectories diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/acm.c linux/drivers/usb/acm.c --- v2.4.0-test8/linux/drivers/usb/acm.c Thu Jul 27 18:36:54 2000 +++ linux/drivers/usb/acm.c Mon Sep 18 15:23:30 2000 @@ -49,7 +49,7 @@ #include #include #include -#define DEBUG +#undef DEBUG #include /* @@ -559,9 +559,11 @@ FILL_BULK_URB(&acm->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress), buf += ctrlsize, readsize, acm_read_bulk, acm); + acm->readurb.transfer_flags |= USB_NO_FSBR; FILL_BULK_URB(&acm->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress), buf += readsize, acm->writesize, acm_write_bulk, acm); + acm->writeurb.transfer_flags |= USB_NO_FSBR; printk(KERN_INFO "ttyACM%d: USB ACM device\n", minor); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/devio.c linux/drivers/usb/devio.c --- v2.4.0-test8/linux/drivers/usb/devio.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/usb/devio.c Mon Sep 18 15:23:30 2000 @@ -55,113 +55,6 @@ urb_t urb; }; -/* - * my own sync control and bulk methods. Here to experiment - * and because the kernel ones set the process to TASK_UNINTERRUPTIBLE. - */ - -struct sync { - wait_queue_head_t wait; -}; - -static void sync_completed(purb_t urb) -{ - struct sync *s = (struct sync *)urb->context; - - wake_up(&s->wait); -} - -static int do_sync(purb_t urb, int timeout) -{ - DECLARE_WAITQUEUE(wait, current); - unsigned long tm; - signed long tmdiff; - struct sync s; - int ret; - - tm = jiffies+timeout; - init_waitqueue_head(&s.wait); - add_wait_queue(&s.wait, &wait); - urb->context = &s; - urb->complete = sync_completed; - set_current_state(TASK_INTERRUPTIBLE); - if ((ret = usb_submit_urb(urb))) - goto out; - while (urb->status == -EINPROGRESS) { - tmdiff = tm - jiffies; - if (tmdiff <= 0) { - ret = -ETIMEDOUT; - goto out; - } - if (signal_pending(current)) { - ret = -EINTR; - goto out; - } - schedule_timeout(tmdiff); - } - ret = urb->status; - out: - set_current_state(TASK_RUNNING); - usb_unlink_urb(urb); - remove_wait_queue(&s.wait, &wait); - return ret; -} - -static int my_usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, - __u16 value, __u16 index, void *data, __u16 size, int timeout) -{ - urb_t *urb; - int ret; - - if (!(urb = usb_alloc_urb(0))) - return -ENOMEM; - if (!(urb->setup_packet = kmalloc(8, GFP_KERNEL))) { - usb_free_urb(urb); - return -ENOMEM; - } - urb->setup_packet[0] = requesttype; - urb->setup_packet[1] = request; - urb->setup_packet[2] = value; - urb->setup_packet[3] = value >> 8; - urb->setup_packet[4] = index; - urb->setup_packet[5] = index >> 8; - urb->setup_packet[6] = size; - urb->setup_packet[7] = size >> 8; - urb->dev = dev; - urb->pipe = pipe; - urb->transfer_buffer = data; - urb->transfer_buffer_length = size; - ret = do_sync(urb, timeout); - //if (ret >= 0) - // ret = urb->status; - if (ret >= 0) - ret = urb->actual_length; - kfree(urb->setup_packet); - usb_free_urb(urb); - return ret; -} - -static int my_usb_bulk_msg(struct usb_device *dev, unsigned int pipe, - void *data, int len, int *actual_length, int timeout) -{ - urb_t *urb; - int ret; - - if (!(urb = usb_alloc_urb(0))) - return -ENOMEM; - urb->dev = dev; - urb->pipe = pipe; - urb->transfer_buffer = data; - urb->transfer_buffer_length = len; - ret = do_sync(urb, timeout); - //if (ret >= 0) - // ret = urb->status; - if (ret >= 0 && actual_length != NULL) - *actual_length = urb->actual_length; - usb_free_urb(urb); - return ret; -} - static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) { switch (orig) { @@ -634,7 +527,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = my_usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, + i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, ctrl.value, ctrl.index, tbuf, ctrl.length, tmo); if ((i > 0) && ctrl.length) { if (copy_to_user(ctrl.data, tbuf, ctrl.length)) @@ -645,7 +538,7 @@ if (copy_from_user(tbuf, ctrl.data, ctrl.length)) return -EFAULT; } - i = my_usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, + i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.request, ctrl.requesttype, ctrl.value, ctrl.index, tbuf, ctrl.length, tmo); } free_page((unsigned long)tbuf); @@ -688,7 +581,7 @@ free_page((unsigned long)tbuf); return -EINVAL; } - i = my_usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); if (!i && len2) { if (copy_to_user(bulk.data, tbuf, len2)) return -EFAULT; @@ -698,7 +591,7 @@ if (copy_from_user(tbuf, bulk.data, len1)) return -EFAULT; } - i = my_usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); + i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); } free_page((unsigned long)tbuf); if (i < 0) { @@ -963,20 +856,23 @@ if (copy_to_user(as->userbuffer, as->urb.transfer_buffer, as->urb.transfer_buffer_length)) return -EFAULT; if (put_user(as->urb.status, - &((struct usbdevfs_urb *)as->userurb)->status) || - __put_user(as->urb.actual_length, - &((struct usbdevfs_urb *)as->userurb)->actual_length) || - __put_user(as->urb.error_count, - &((struct usbdevfs_urb *)as->userurb)->error_count)) + &((struct usbdevfs_urb *)as->userurb)->status)) + return -EFAULT; + if (put_user(as->urb.actual_length, + &((struct usbdevfs_urb *)as->userurb)->actual_length)) + return -EFAULT; + if (put_user(as->urb.error_count, + &((struct usbdevfs_urb *)as->userurb)->error_count)) return -EFAULT; if (!(usb_pipeisoc(as->urb.pipe))) return 0; for (i = 0; i < as->urb.number_of_packets; i++) { if (put_user(as->urb.iso_frame_desc[i].actual_length, - &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].actual_length) || - __put_user(as->urb.iso_frame_desc[i].status, - &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].status)) + &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].actual_length)) + return -EFAULT; + if (put_user(as->urb.iso_frame_desc[i].status, + &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].status)) return -EFAULT; } return 0; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/net1080.c linux/drivers/usb/net1080.c --- v2.4.0-test8/linux/drivers/usb/net1080.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/net1080.c Mon Sep 18 15:23:30 2000 @@ -0,0 +1,1098 @@ +/* + * NetChip 1080 Driver (USB Host-to-Host Link) + * Copyright (C) 2000 by David Brownell + */ + +/* + * This talks to the NetChip 1080, which can appear in "network cables" + * and other designs. This driver interoperates with the Win32 network + * drivers from NetChip, using the NetChip reference design. + * + * The IP-over-USB protocol here may be of interest. Embedded devices + * could implement it at the cost of two bulk endpoints, and whatever + * other system resources the desired IP-based applications need. + * Some Linux palmtops could support that today. + * + * STATUS: + * + * 13-sept-2000 experimental, new + * + * This doesn't yet do any network hotplugging, and there's no matching + * ifup policy script ... it should arrange bridging with "brctl", and + * should handle static and dynamic ("pump") setups. + * + * RX/TX queue sizes currently fixed at one due to URB unlink problems. + * + *-------------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG // error path messages +// #define VERBOSE // more; success messages +#define USE_TTL // timeout our reads + +#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) +# define DEBUG +#endif +#include + + +static const struct product { + char *name; + u16 idVendor; + u16 idProduct; +} products [] = { + { "NetChip TurboCONNECT", 0x0525, 0x1080 }, // reference + // Belkin, ... + { 0, 0, 0 }, // END +}; + +static u8 node_id [ETH_ALEN]; + + +/*------------------------------------------------------------------------- + * + * NetChip protocol: ethernet framing, and only use bulk endpoints (01/81; + * not mailboxes 02/82 or status interrupt 83). Expects Ethernet bridging. + * Odd USB length == always short read. + * - nc_header + * - payload, in Ethernet framing (14 byte header etc) + * - (optional padding byte, if needed so length is odd) + * - nc_trailer + */ + +struct nc_header { + u16 hdr_len; // sizeof nc_header (LE, all) + u16 packet_len; // packet size + u16 packet_id; // detects dropped packets +#define NC_MIN_HEADER 6 + + // all else is optional, and must start with: + // u16 vendorId; // from usb-if + // u16 productId; +}; + +#define NC_PAD_BYTE ((unsigned char)0xAC) + +struct nc_trailer { + u16 packet_id; +}; + +// packetsize == f(mtu setting), with upper limit +#define NC_MAX_PACKET(mtu) (sizeof (struct nc_header) \ + + (mtu) \ + + 1 \ + + sizeof (struct nc_trailer)) + +// zero means no timeout; else, how long a 64 byte bulk +// read may be queued before HW flushes it. +#define NC_READ_TTL ((u8)255) // ms + + +/*-------------------------------------------------------------------------*/ + +// list of all devices we manage +static DECLARE_MUTEX (net1080_mutex); +static LIST_HEAD (net1080_list); + + +// Nineteen USB 1.1 max size bulk transactions per frame, max. +#if 0 +#define RX_QLEN 4 +#define TX_QLEN 4 + +#else +// unlink_urbs() has probs on OHCI without test8-pre patches. +#define RX_QLEN 1 +#define TX_QLEN 1 +#endif + +enum skb_state { + illegal = 0, + tx_start, tx_done, + rx_start, rx_done, rx_cleanup +}; + +struct skb_data { // skb->cb is one of these + struct urb *urb; + struct net1080 *dev; + enum skb_state state; + size_t length; +}; + + +struct net1080 { + // housekeeping + struct usb_device *udev; + const struct product *prod_info; + struct semaphore mutex; + struct list_head dev_list; + wait_queue_head_t *wait; + + // protocol/interface state + struct net_device net; + struct net_device_stats stats; + u16 packet_id; + + // various kinds of pending driver work + struct sk_buff_head rxq; + struct sk_buff_head txq; + struct sk_buff_head done; + struct tasklet_struct bh; +}; + +#define mutex_lock(x) down(x) +#define mutex_unlock(x) up(x) + +static void defer_bh (struct net1080 *dev, struct sk_buff *skb) +{ + unsigned long flags; + + skb_unlink (skb); + spin_lock_irqsave (&dev->done.lock, flags); + __skb_queue_tail (&dev->done, skb); + if (dev->done.qlen == 1) + tasklet_schedule (&dev->bh); + spin_unlock_irqrestore (&dev->done.lock, flags); +} + +/*------------------------------------------------------------------------- + * + * We ignore most registers and EEPROM contents. + */ + +#define REG_USBCTL ((u8)0x04) +#define REG_TTL ((u8)0x10) +#define REG_STATUS ((u8)0x11) + +/* + * Vendor specific requests to read/write data + */ + +#define REQUEST_REGISTER ((u8)0x10) +#define REQUEST_EEPROM ((u8)0x11) + +#define CONTROL_TIMEOUT (500) /* msec */ + +static int +vendor_read (struct net1080 *dev, u8 req, u8 regnum, u16 *retval_ptr) +{ + int status = usb_control_msg (dev->udev, + usb_rcvctrlpipe (dev->udev, 0), + req, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, regnum, + retval_ptr, sizeof *retval_ptr, + CONTROL_TIMEOUT); + if (status > 0) + status = 0; + if (!status) + le16_to_cpus (retval_ptr); + return status; +} + +static inline int +register_read (struct net1080 *dev, u8 regnum, u16 *retval_ptr) +{ + return vendor_read (dev, REQUEST_REGISTER, regnum, retval_ptr); +} + +// without retval, this can become fully async (usable in_interrupt) +static void +vendor_write (struct net1080 *dev, u8 req, u8 regnum, u16 value) +{ + usb_control_msg (dev->udev, + usb_sndctrlpipe (dev->udev, 0), + req, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, regnum, + 0, 0, // data is in setup packet + CONTROL_TIMEOUT); +} + +static inline void +register_write (struct net1080 *dev, u8 regnum, u16 value) +{ + vendor_write (dev, REQUEST_REGISTER, regnum, value); +} + + +#if 0 +static void dump_registers (struct net1080 *dev) +{ + u8 reg; + u16 value; + + dbg ("%s registers:", dev->net.name); + for (reg = 0; reg < 0x20; reg++) { + int retval; + + // reading some registers is trouble + if (reg >= 0x08 && reg <= 0xf) + continue; + if (reg >= 0x12 && reg <= 0x1e) + continue; + + retval = register_read (dev, reg, &value); + if (retval < 0) + dbg ("%s reg [0x%x] ==> error %d", + dev->net.name, reg, retval); + else + dbg ("%s reg [0x%x] = 0x%x", + dev->net.name, reg, value); + } +} +#endif + + +/*------------------------------------------------------------------------- + * + * Control register + */ + +#define USBCTL_WRITABLE_MASK 0x1f0f +// bits 15-13 reserved, r/o +#define USBCTL_ENABLE_LANG (1 << 12) +#define USBCTL_ENABLE_MFGR (1 << 11) +#define USBCTL_ENABLE_PROD (1 << 10) +#define USBCTL_ENABLE_SERIAL (1 << 9) +#define USBCTL_ENABLE_DEFAULTS (1 << 8) +// bits 7-4 reserved, r/o +#define USBCTL_FLUSH_OTHER (1 << 3) +#define USBCTL_FLUSH_THIS (1 << 2) +#define USBCTL_DISCONN_OTHER (1 << 1) +#define USBCTL_DISCONN_THIS (1 << 0) + +#ifdef DEBUG +static void dump_usbctl (struct net1080 *dev, u16 usbctl) +{ + dbg ("%s: USB %d dev %d usbctl 0x%x:%s%s%s%s%s;" + " this%s%s;" + " other%s%s; r/o 0x%x", + dev->net.name, + dev->udev->bus->busnum, dev->udev->devnum, + usbctl, + (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "", + (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "", + (usbctl & USBCTL_ENABLE_PROD) ? " prod" : "", + (usbctl & USBCTL_ENABLE_SERIAL) ? " serial" : "", + (usbctl & USBCTL_ENABLE_DEFAULTS) ? " defaults" : "", + + (usbctl & USBCTL_FLUSH_OTHER) ? " FLUSH" : "", + (usbctl & USBCTL_DISCONN_OTHER) ? " DIS" : "", + (usbctl & USBCTL_FLUSH_THIS) ? " FLUSH" : "", + (usbctl & USBCTL_DISCONN_THIS) ? " DIS" : "", + usbctl & ~USBCTL_WRITABLE_MASK + ); +} +#else +static inline void dump_usbctl (struct net1080 *dev, u16 usbctl) {} +#endif + +/*------------------------------------------------------------------------- + * + * Status register + */ + +#define STATUS_PORT_A (1 << 15) + +#define STATUS_CONN_OTHER (1 << 14) +#define STATUS_SUSPEND_OTHER (1 << 13) +#define STATUS_MAILBOX_OTHER (1 << 12) +#define STATUS_PACKETS_OTHER(n) (((n) >> 8) && 0x03) + +#define STATUS_CONN_THIS (1 << 6) +#define STATUS_SUSPEND_THIS (1 << 5) +#define STATUS_MAILBOX_THIS (1 << 4) +#define STATUS_PACKETS_THIS(n) (((n) >> 0) && 0x03) + +#define STATUS_UNSPEC_MASK 0x0c8c +#define STATUS_NOISE_MASK ((u16)~(0x0303|STATUS_UNSPEC_MASK)) + + +#ifdef DEBUG +static void dump_status (struct net1080 *dev, u16 status) +{ + dbg ("%s: USB %d dev %d status 0x%x:" + " this (%c) PKT=%d%s%s%s;" + " other PKT=%d%s%s%s; unspec 0x%x", + dev->net.name, + dev->udev->bus->busnum, dev->udev->devnum, + status, + + // XXX the packet counts don't seem right + // (1 at reset, not 0); maybe UNSPEC too + + (status & STATUS_PORT_A) ? 'A' : 'B', + STATUS_PACKETS_THIS (status), + (status & STATUS_CONN_THIS) ? " CON" : "", + (status & STATUS_SUSPEND_THIS) ? " SUS" : "", + (status & STATUS_MAILBOX_THIS) ? " MBOX" : "", + + STATUS_PACKETS_OTHER (status), + (status & STATUS_CONN_OTHER) ? " CON" : "", + (status & STATUS_SUSPEND_OTHER) ? " SUS" : "", + (status & STATUS_MAILBOX_OTHER) ? " MBOX" : "", + + status & STATUS_UNSPEC_MASK + ); +} +#else +static inline void dump_status (struct net1080 *dev, u16 status) {} +#endif + +/*------------------------------------------------------------------------- + * + * TTL register + */ + +#define TTL_THIS(ttl) (0x00ff & ttl) +#define TTL_OTHER(ttl) (0x00ff & (ttl >> 8)) +#define MK_TTL(this,other) ((u16)(((other)<<8)|(0x00ff&(this)))) + +#ifdef DEBUG +static void dump_ttl (struct net1080 *dev, u16 ttl) +{ + dbg ("%s: USB %d dev %d ttl 0x%x this = %d, other = %d", + dev->net.name, + dev->udev->bus->busnum, dev->udev->devnum, + ttl, + + TTL_THIS (ttl), + TTL_OTHER (ttl) + ); +} +#else +static inline void dump_ttl (struct net1080 *dev, u16 ttl) {} +#endif + +#define RUN_CONTEXT (in_irq () ? "in_irq" \ + : (in_interrupt () ? "in_interrupt" : "can sleep")) + +/*-------------------------------------------------------------------------*/ + +// ensure that the device is in a known state before using it. + +// preconditions: +// caller owns the device mutex +// caller has a process context + +static int net1080_reset (struct net1080 *dev) +{ + u16 usbctl, status, ttl; + int retval; + + if ((retval = register_read (dev, REG_STATUS, &status)) < 0) { + dbg ("can't read dev %d status: %d", dev->udev->devnum, retval); + goto done; + } + dump_status (dev, status); + + if ((retval = register_read (dev, REG_USBCTL, &usbctl)) < 0) { + dbg ("can't read USBCTL, %d", retval); + goto done; + } + dump_usbctl (dev, usbctl); + + register_write (dev, REG_USBCTL, + USBCTL_FLUSH_THIS | USBCTL_FLUSH_OTHER); + + if ((retval = register_read (dev, REG_TTL, &ttl)) < 0) { + dbg ("can't read TTL, %d", retval); + goto done; + } + dump_ttl (dev, ttl); + +#ifdef USE_TTL + // Have the chip flush reads that seem to be starving for read + // bandwidth ... or we're otherwise reading. Note, Win32 drivers + // may change our read TTL for us. + + register_write (dev, REG_TTL, + MK_TTL (NC_READ_TTL, TTL_OTHER (ttl)) ); + dbg ("%s: assigned TTL, %d ms", dev->net.name, NC_READ_TTL); +#endif + + info ("%s: %s, port %c on USB %d dev %d, peer %sconnected", + dev->net.name, dev->prod_info->name, + (status & STATUS_PORT_A) ? 'A' : 'B', + dev->udev->bus->busnum, + dev->udev->devnum, + (status & STATUS_CONN_OTHER) ? "" : "dis" + ); + retval = 0; + +done: + return retval; +} + + +/*------------------------------------------------------------------------- + * + * Network Device Driver support (peer link to USB Host) + * + --------------------------------------------------------------------------*/ + +static int net1080_change_mtu (struct net_device *net, int new_mtu) +{ + if ((new_mtu < 0) || NC_MAX_PACKET (new_mtu) > 8191) + return -EINVAL; + net->mtu = new_mtu; + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct net_device_stats *net1080_get_stats (struct net_device *net) +{ + return &((struct net1080 *) net->priv)->stats; +} + +/*-------------------------------------------------------------------------*/ + +static void rx_complete (struct urb *urb); + +static void rx_submit (struct net1080 *dev, struct urb *urb, int flags) +{ + struct sk_buff *skb; + struct skb_data *entry; + int retval = 0; + unsigned long lockflags; + + if ((skb = alloc_skb (NC_MAX_PACKET (dev->net.mtu), flags)) == 0) { + err ("no rx skb"); + tasklet_schedule (&dev->bh); + usb_free_urb (urb); + return; + } + + entry = (struct skb_data *) skb->cb; + entry->urb = urb; + entry->dev = dev; + entry->state = rx_start; + entry->length = 0; + + FILL_BULK_URB (urb, dev->udev, usb_rcvbulkpipe (dev->udev, 1), + skb->data, skb->truesize, rx_complete, skb); + urb->transfer_flags |= USB_QUEUE_BULK; + + spin_lock_irqsave (&dev->rxq.lock, lockflags); + if (!netif_queue_stopped (&dev->net)) { + if ((retval = usb_submit_urb (urb)) != 0) { + err ("%s rx submit, %d", dev->net.name, retval); + tasklet_schedule (&dev->bh); + } else { + __skb_queue_tail (&dev->rxq, skb); + } + } else { + dbg ("rx: stopped"); + retval = -ENOLINK; + } + spin_unlock_irqrestore (&dev->rxq.lock, lockflags); + if (retval) { + dev_kfree_skb_any (skb); + usb_free_urb (urb); + } +} + + +/*-------------------------------------------------------------------------*/ + +static void rx_complete (struct urb *urb) +{ + struct sk_buff *skb = (struct sk_buff *) urb->context; + struct skb_data *entry = (struct skb_data *) skb->cb; + struct net1080 *dev = entry->dev; + int urb_status = urb->status; + + urb->dev = 0; + skb->len = urb->actual_length; + entry->state = rx_done; + entry->urb = 0; + + if ((urb->transfer_flags & USB_ASYNC_UNLINK) != 0 + || netif_queue_stopped (&dev->net)) { + dbg ("rx ... shutting down"); + usb_free_urb (urb); + urb = 0; + } + + switch (urb_status) { + // success + case 0: + if (skb->len & 0x01) + break; + entry->state = rx_cleanup; + dev->stats.rx_errors++; + dev->stats.rx_length_errors++; + dbg ("even rx len %d", skb->len); + break; + + // hardware-reported interface shutdown ... which we + // typically see before khubd calls disconnect() + case -ETIMEDOUT: // usb-ohci + case -EILSEQ: // *uhci ... "crc"/timeout error + // netif_device_detach (&dev->net); + // FALLTHROUGH + + // software-driven interface shutdown + case -ECONNRESET: + entry->state = rx_cleanup; + usb_free_urb (urb); + urb = 0; + dbg ("%s ... shutdown rx (%d)", dev->net.name, urb_status); + break; + + // data overrun ... flush fifo? + case -EOVERFLOW: + dev->stats.rx_over_errors++; + // FALLTHROUGH + + default: + entry->state = rx_cleanup; + dev->stats.rx_errors++; + err ("%s rx: status %d", dev->net.name, urb_status); + break; + } + defer_bh (dev, skb); + + if (urb) { + if (!netif_queue_stopped (&dev->net)) { + rx_submit (dev, urb, GFP_ATOMIC); + return; + } else + usb_free_urb (urb); + } +#ifdef VERBOSE + dbg ("no read resubmitted"); +#endif VERBOSE +} + +/*-------------------------------------------------------------------------*/ + +// unlink pending rx/tx; completion handlers do all other cleanup + +static int unlink_urbs (struct sk_buff_head *q) +{ + unsigned long flags; + struct sk_buff *skb; + struct skb_data *entry; + int retval; + int count = 0; + + spin_lock_irqsave (&q->lock, flags); + for (skb = q->next; skb != (struct sk_buff *) q; skb = skb->next) { + entry = (struct skb_data *) skb->cb; + entry->urb->transfer_flags |= USB_ASYNC_UNLINK; + retval = usb_unlink_urb (entry->urb); + if (retval < 0) + dbg ("unlink urb err, %d", retval); + else + count++; + } + spin_unlock_irqrestore (&q->lock, flags); + return count; +} + + +/*-------------------------------------------------------------------------*/ + +// precondition: never called in_interrupt + +static int net1080_stop (struct net_device *net) +{ + struct net1080 *dev = (struct net1080 *) net->priv; + int temp; + DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup); + DECLARE_WAITQUEUE (wait, current); + + mutex_lock (&dev->mutex); + + dbg ("%s stop stats: rx/tx %ld/%ld, errs %ld/%ld", net->name, + dev->stats.rx_packets, dev->stats.tx_packets, + dev->stats.rx_errors, dev->stats.tx_errors + ); + + netif_stop_queue(net); + + // ensure there are no more active urbs + add_wait_queue (&unlink_wakeup, &wait); + dev->wait = &unlink_wakeup; + temp = unlink_urbs (&dev->txq) + unlink_urbs (&dev->rxq); + + // maybe wait for deletions to finish. + if (temp) { + current->state = TASK_UNINTERRUPTIBLE; + schedule (); + dbg ("waited for %d urb completions", temp); + } + dev->wait = 0; + remove_wait_queue (&unlink_wakeup, &wait); + + mutex_unlock (&dev->mutex); + MOD_DEC_USE_COUNT; + return 0; +} + +/*-------------------------------------------------------------------------*/ + +// posts a read, and enables write queing + +// precondition: never called in_interrupt + +static int net1080_open (struct net_device *net) +{ + struct net1080 *dev = (struct net1080 *) net->priv; + int retval; + u16 status; + int i; + + MOD_INC_USE_COUNT; + mutex_lock (&dev->mutex); + + // insist peer be connected -- is this the best place? + if ((retval = register_read (dev, REG_STATUS, &status)) != 0) { + dbg ("%s open: status read failed - %d", net->name, retval); + goto done; + } + if ((status & STATUS_CONN_OTHER) != STATUS_CONN_OTHER) { + retval = -ENOLINK; + dbg ("%s open: peer not connected", net->name); + goto done; + } + + MOD_INC_USE_COUNT; + netif_start_queue (net); + for (i = 0; i < RX_QLEN; i++) + rx_submit (dev, usb_alloc_urb (0), GFP_KERNEL); + + dbg ("%s open: started queueing (rx %d, tx %d)", + net->name, RX_QLEN, TX_QLEN); +done: + mutex_unlock (&dev->mutex); + MOD_DEC_USE_COUNT; + return retval; +} + +/*-------------------------------------------------------------------------*/ + +static void tx_complete (struct urb *urb) +{ + struct sk_buff *skb = (struct sk_buff *) urb->context; + struct skb_data *entry = (struct skb_data *) skb->cb; + struct net1080 *dev = entry->dev; + + urb->dev = 0; + entry->state = tx_done; + defer_bh (dev, skb); + netif_wake_queue (&dev->net); +} + +/*-------------------------------------------------------------------------*/ + +static struct sk_buff *fixup_skb (struct sk_buff *skb) +{ + int padlen; + struct sk_buff *skb2; + + padlen = ((skb->len + sizeof (struct nc_header) + + sizeof (struct nc_trailer)) & 0x01) ? 0 : 1; + if (!skb_cloned (skb)) { + int headroom = skb_headroom (skb); + int tailroom = skb_tailroom (skb); + + if ((padlen + sizeof (struct nc_trailer)) <= tailroom + && sizeof (struct nc_header) <= headroom) + return skb; + + if ((sizeof (struct nc_header) + padlen + + sizeof (struct nc_trailer)) < + (headroom + tailroom)) { + skb->data = memmove (skb->head + + sizeof (struct nc_header), + skb->data, skb->len); + skb->tail = skb->data + skb->len; + return skb; + } + } + skb2 = skb_copy_expand (skb, + sizeof (struct nc_header), + sizeof (struct nc_trailer) + padlen, + in_interrupt () ? GFP_ATOMIC : GFP_KERNEL); + dev_kfree_skb_any (skb); + return skb2; +} + +/*-------------------------------------------------------------------------*/ + +static int net1080_start_xmit (struct sk_buff *skb, struct net_device *net) +{ + struct net1080 *dev = (struct net1080 *) net->priv; + int length = skb->len; + int retval = 0; + struct urb *urb = 0; + struct skb_data *entry; + struct nc_header *header; + struct nc_trailer *trailer; + unsigned long flags; + + if ((skb = fixup_skb (skb)) == 0) { + dbg ("can't fixup skb"); + goto drop; + } + if ((urb = usb_alloc_urb (0)) == 0) { + dbg ("no urb"); + goto drop; + } + + entry = (struct skb_data *) skb->cb; + entry->urb = urb; + entry->dev = dev; + entry->state = tx_start; + entry->length = length; + + header = (struct nc_header *) skb_push (skb, sizeof *header); + header->hdr_len = cpu_to_le16 (sizeof (*header)); + header->packet_len = cpu_to_le16 (length); + if (!((skb->len + sizeof *trailer) & 0x01)) + *skb_put (skb, 1) = NC_PAD_BYTE; + trailer = (struct nc_trailer *) skb_put (skb, sizeof *trailer); + + FILL_BULK_URB (urb, dev->udev, + usb_sndbulkpipe (dev->udev, 1), + skb->data, skb->len, tx_complete, skb); + urb->transfer_flags |= USB_QUEUE_BULK; + // FIXME urb->timeout = ...; + + spin_lock_irqsave (&dev->txq.lock, flags); + if (!netif_queue_stopped (&dev->net)) { + header->packet_id = cpu_to_le16 (dev->packet_id++); + put_unaligned (header->packet_id, &trailer->packet_id); + + netif_stop_queue (net); + if ((retval = usb_submit_urb (urb)) != 0) { + netif_start_queue (net); + dbg ("%s tx: submit urb err %d", net->name, retval); + } else { + net->trans_start = jiffies; + __skb_queue_tail (&dev->txq, skb); + if (dev->txq.qlen < TX_QLEN) + netif_start_queue (net); + } + } else + retval = -ENOLINK; + spin_unlock_irqrestore (&dev->txq.lock, flags); + + if (retval) { + dbg ("drop"); +drop: + dev->stats.tx_dropped++; + dev_kfree_skb_any (skb); + usb_free_urb (urb); +#ifdef VERBOSE + } else { + dbg ("%s: tx %p len %d", net->name, skb, length); +#endif + } + return retval; +} + + +/*-------------------------------------------------------------------------*/ + +static void rx_process (struct net1080 *dev, struct sk_buff *skb) +{ + struct nc_header *header; + struct nc_trailer *trailer; + + header = (struct nc_header *) skb->data; + le16_to_cpus (&header->hdr_len); + le16_to_cpus (&header->packet_len); + if (header->hdr_len < NC_MIN_HEADER) { + dev->stats.rx_frame_errors++; + dbg ("header too short, %d", header->hdr_len); + goto error; + } else if (header->hdr_len != sizeof *header) { + // out of band data for us? + dbg ("header OOB, %d bytes", header->hdr_len - NC_MIN_HEADER); + // switch (vendor/product ids) { ... } + } + skb_pull (skb, header->hdr_len); + + trailer = (struct nc_trailer *) + (skb->data + skb->len - sizeof *trailer); + skb_trim (skb, skb->len - sizeof *trailer); + + if ((header->packet_len & 0x01) == 0) { + if (skb->data [header->packet_len] != NC_PAD_BYTE) { + dev->stats.rx_frame_errors++; + dbg ("bad pad"); + goto error; + } + skb_trim (skb, skb->len - 1); + } + if (skb->len != header->packet_len) { + dev->stats.rx_length_errors++; + dbg ("bad packet len %d (expected %d)", + skb->len, header->packet_len); + goto error; + } + if (header->packet_id != get_unaligned (&trailer->packet_id)) { + dev->stats.rx_fifo_errors++; + dbg ("(2+ dropped) rx packet_id mismatch 0x%x 0x%x", + header->packet_id, trailer->packet_id); + goto error; + } + + if (skb->len) { + skb->dev = &dev->net; + skb->protocol = eth_type_trans (skb, &dev->net); + dev->stats.rx_packets++; + dev->stats.rx_bytes += skb->len; + +#ifdef VERBOSE + dbg ("%s: rx %p len %d, type 0x%x, id 0x%x", + dev->net.name, skb, skb->len, skb->protocol, + le16_to_cpu (header->packet_id)); +#endif + netif_rx (skb); + } else { + dbg ("drop"); +error: + dev->stats.rx_errors++; + dev_kfree_skb (skb); + } +} + +/*-------------------------------------------------------------------------*/ + +// tasklet + +// We can have a state machine in this tasklet monitor the link state, +// using async control messaging and calling attach/detach routines. + +// But then some listener ought to respond to the changes; do those +// network attach/detach notifications get to userland somehow, such +// as by calling "ifup usb0" and "ifdown usb0"? + +static void net1080_bh (unsigned long param) +{ + struct net1080 *dev = (struct net1080 *) param; + struct sk_buff *skb; + struct skb_data *entry; + + while ((skb = skb_dequeue (&dev->done))) { + entry = (struct skb_data *) skb->cb; + switch (entry->state) { + case rx_done: + rx_process (dev, skb); + continue; + case tx_done: + if (entry->urb->status) { + // can this statistic become more specific? + dev->stats.tx_errors++; + dbg ("%s tx: err %d", dev->net.name, + entry->urb->status); + } else { + dev->stats.tx_packets++; + dev->stats.tx_bytes += entry->length; + } + // FALLTHROUGH: + case rx_cleanup: + usb_free_urb (entry->urb); + dev_kfree_skb (skb); + continue; + default: + dbg ("%s: bogus skb state %d", + dev->net.name, entry->state); + } + } + + // waiting for all pending urbs to complete? + if (dev->wait) { + if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { + wake_up (dev->wait); + } + + // or are we maybe short a few urbs? + } else if (!netif_queue_stopped (&dev->net)) { + if (dev->rxq.qlen < TX_QLEN) { + struct urb *urb; + int i; + for (i = 0; i < 3 && dev->rxq.qlen < TX_QLEN; i++) { + if ((urb = usb_alloc_urb (0)) != 0) + rx_submit (dev, urb, GFP_ATOMIC); + } + dbg ("%s: rxqlen now %d", + dev->net.name, dev->rxq.qlen); + } + } +} + +/*------------------------------------------------------------------------- + * + * USB Device Driver support + * + --------------------------------------------------------------------------*/ + +// precondition: never called in_interrupt + +static void net1080_disconnect (struct usb_device *udev, void *ptr) +{ + struct net1080 *dev = (struct net1080 *) ptr; + + info ("%s: USB %d dev %d, %s, disconnected", + dev->net.name, + udev->bus->busnum, udev->devnum, + dev->prod_info->name); + + unregister_netdev (&dev->net); + + mutex_lock (&net1080_mutex); + mutex_lock (&dev->mutex); + list_del (&dev->dev_list); + mutex_unlock (&net1080_mutex); + +#ifdef DEBUG + memset (dev, 0x55, sizeof *dev); +#endif + kfree (dev); + usb_dec_dev_use (udev); +} + + +/*-------------------------------------------------------------------------*/ + +// precondition: never called in_interrupt + +static void *net1080_probe (struct usb_device *udev, unsigned ifnum) +{ + int i; + struct net1080 *dev; + struct net_device *net; + struct usb_interface_descriptor *interface; + int retval; + + for (i = 0; products [i].idVendor != 0; i++) { + if (products [i].idVendor != udev->descriptor.idVendor) + continue; + if (products [i].idProduct != udev->descriptor.idProduct) + continue; + break; + } + if (products [i].idVendor == 0) + return 0; + + // sanity check; expect dedicated interface/devices for now. + interface = &udev->actconfig->interface [ifnum].altsetting[0]; + if (udev->descriptor.bNumConfigurations != 1 + || udev->config[0].bNumInterfaces != 1 + || udev->config[0].bNumInterfaces != 1 + || interface->bInterfaceClass != USB_CLASS_VENDOR_SPEC + || interface->bNumEndpoints != 5 + ) { + dbg ("Bogus config info"); + return 0; + } + + // set up our own records + if (!(dev = kmalloc (sizeof *dev, GFP_KERNEL))) { + dbg ("can't kmalloc dev"); + return 0; + } + memset (dev, 0, sizeof *dev); + + init_MUTEX_LOCKED (&dev->mutex); + usb_inc_dev_use (udev); + dev->udev = udev; + dev->prod_info = &products [i]; + INIT_LIST_HEAD (&dev->dev_list); + skb_queue_head_init (&dev->rxq); + skb_queue_head_init (&dev->txq); + skb_queue_head_init (&dev->done); + dev->bh.func = net1080_bh; + dev->bh.data = (unsigned long) dev; + + // set up network interface records + net = &dev->net; + net->priv = dev; + strcpy (net->name, "usb%d"); + memcpy (net->dev_addr, node_id, sizeof node_id); + + ether_setup (net); + // net->flags |= IFF_POINTOPOINT; + + net->change_mtu = net1080_change_mtu; + net->get_stats = net1080_get_stats; + net->hard_start_xmit = net1080_start_xmit; + net->open = net1080_open; + net->stop = net1080_stop; + + register_netdev (&dev->net); + + // ... talk to the device + // dump_registers (dev); + + if ((retval = net1080_reset (dev)) < 0) { + err ("%s: init reset fail on USB %d dev %d - %d", + dev->net.name, udev->bus->busnum, udev->devnum, retval); + mutex_unlock (&dev->mutex); + net1080_disconnect (udev, dev); + return 0; + } + + // ok, it's ready to go. + mutex_lock (&net1080_mutex); + list_add (&dev->dev_list, &net1080_list); + mutex_unlock (&dev->mutex); + + // start as if the link is up + netif_device_attach (&dev->net); + + mutex_unlock (&net1080_mutex); + + return dev; +} + + +/*-------------------------------------------------------------------------*/ + +static struct usb_driver net1080_driver = { + name: "net1080", + probe: net1080_probe, + disconnect: net1080_disconnect, +}; + +/*-------------------------------------------------------------------------*/ + +static int __init net1080_init (void) +{ + // compiler should optimize this out + if (sizeof (((struct sk_buff *)0)->cb) < sizeof (struct skb_data)) + BUG (); + + if (usb_register (&net1080_driver) < 0) + return -1; + + get_random_bytes (node_id, sizeof node_id); + node_id [0] &= 0x7f; + + return 0; +} +module_init (net1080_init); + +static void __exit net1080_exit (void) +{ + usb_deregister (&net1080_driver); +} +module_exit (net1080_exit); + +MODULE_AUTHOR ("David Brownell "); +MODULE_DESCRIPTION ("NetChip 1080 Driver (USB Host-to-Host Link)"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/pegasus.c linux/drivers/usb/pegasus.c --- v2.4.0-test8/linux/drivers/usb/pegasus.c Tue Aug 22 15:23:13 2000 +++ linux/drivers/usb/pegasus.c Mon Sep 18 15:23:30 2000 @@ -13,6 +13,12 @@ ** from top-halves. ** v0.4.0 Control messages remained unurbified are now URBs. ** Now we can touch the HW at any time. +** v0.4.9 Control urbs again use process context to wait. Argh... +** Some long standing bugs (start_net) fixed. Also nasty +** trick with resubmiting control urb from interrupt +** context used. Please let me know how it behaves. +** Pegasus II support added since this version. +** TODO: suppressing HCD warnings spewage on disconnect. */ /* @@ -42,20 +48,65 @@ #include -static const char *version = __FILE__ ": v0.4.3 2000/08/22 (C) 1999-2000 Petko Manolov (petkan@dce.bg)\n"; +static const char *version = __FILE__ ": v0.4.9 2000/09/14 (C) 1999-2000 Petko Manolov (petkan@dce.bg)"; -#define PEGASUS_USE_WAITQ +#define PEGASUS_USE_INTR +#define PEGASUS_II 0x80000000 +#define HAS_HOME_PNA 0x40000000 + #define PEGASUS_MTU 1500 #define PEGASUS_MAX_MTU 1536 + #define EPROM_WRITE 0x01 #define EPROM_READ 0x02 +#define EPROM_DONE 0x04 +#define EPROM_WR_ENABLE 0x10 +#define EPROM_LOAD 0x20 + +#define MII_BMCR 0x00 +#define MII_BMSR 0x01 +#define BMSR_MEDIA 0x7808 +#define MII_ANLPA 0x05 +#define ANLPA_100TX_FD 0x0100 +#define ANLPA_100TX_HD 0x0080 +#define ANLPA_10T_FD 0x0040 +#define ANLPA_10T_HD 0x0020 +#define PHY_DONE 0x80 +#define PHY_READ 0x40 +#define PHY_WRITE 0x20 +#define DEFAULT_GPIO_RESET 0x24 +#define LINKSYS_GPIO_RESET 0x24 +#define DEFAULT_GPIO_SET 0x26 + +#define PEGASUS_PRESENT 1 +#define PEGASUS_RUNNING 2 +#define CTRL_URB_RUNNING 4 +#define CTRL_URB_SLEEP 8 +#define ETH_REGS_CHANGE 0x40000000 +#define ETH_REGS_CHANGED 0x80000000 + +#define RX_MULTICAST 2 +#define RX_PROMISCUOUS 4 + +#define REG_TIMEOUT (HZ) #define PEGASUS_TX_TIMEOUT (HZ*10) -#define PEGASUS_CTRL_TIMEOUT (HZ*5) -#define PEGASUS_CTRL_WAIT (1<<31) -#define PEGASUS_RUNNING 1 + +#ifdef PEGASUS_USE_INTR + #define INTR_IVAL 0x80 +#else + #define INTR_IVAL 0 +#endif + +#define TX_UNDERRUN 0x80 +#define EXCESSIVE_COL 0x40 +#define LATE_COL 0x20 +#define NO_CARRIER 0x10 +#define LOSS_CARRIER 0x08 +#define JABBER_TIMEOUT 0x04 + #define PEGASUS_REQT_READ 0xc0 #define PEGASUS_REQT_WRITE 0x40 #define PEGASUS_REQ_GET_REGS 0xf0 @@ -64,12 +115,12 @@ #define NUM_CTRL_URBS 0x10 #define ALIGN(x) x __attribute__((aligned(L1_CACHE_BYTES))) - enum pegasus_registers { EthCtrl0 = 0, EthCtrl1 = 1, EthCtrl2 = 2, EthID = 0x10, + Reg1d = 0x1d, EpromOffset = 0x20, EpromData = 0x21, /* 0x21 low, 0x22 high byte */ EpromCtrl = 0x23, @@ -80,348 +131,445 @@ EthTxStat0 = 0x2b, EthTxStat1 = 0x2c, EthRxStat = 0x2d, + Reg7b = 0x7b, Gpio0 = 0x7e, Gpio1 = 0x7f, + Reg81 = 0x81, }; -struct pegasus; -struct ctrl_urb_pool { - struct pegasus *pegasus; - struct urb urb; - devrequest dr; - __u8 busy; -}; - - -struct pegasus { +typedef struct pegasus { struct usb_device *usb; struct net_device *net; struct net_device_stats stats; - int flags; - struct urb rx_urb, tx_urb, intr_urb; - struct ctrl_urb_pool ALIGN(ctrl[NUM_CTRL_URBS]); + unsigned flags; + unsigned features; + struct urb ctrl_urb, rx_urb, tx_urb, intr_urb; + devrequest dr; wait_queue_head_t ctrl_wait; struct semaphore ctrl_sem; unsigned char ALIGN(rx_buff[PEGASUS_MAX_MTU]); unsigned char ALIGN(tx_buff[PEGASUS_MAX_MTU]); unsigned char ALIGN(intr_buff[8]); -}; + __u8 eth_regs[4]; + __u8 phy; + __u8 gpio_res; +} pegasus_t; struct usb_eth_dev { char *name; __u16 vendor; __u16 device; - void *private; + __u32 private; /* LSB is gpio reset value */ }; static int loopback = 0; +static int mode = 0; static int multicast_filter_limit = 32; MODULE_AUTHOR("Petko Manolov "); MODULE_DESCRIPTION("ADMtek AN986 Pegasus USB Ethernet driver"); MODULE_PARM(loopback, "i"); +MODULE_PARM(mode, "i"); MODULE_PARM_DESC(loopback, "Enable MAC loopback mode (bit 0)"); +MODULE_PARM_DESC(mode, "Enable HomePNA mode (bit 0) - default = MII mode = 0"); static struct usb_eth_dev usb_dev_id[] = { - {"Billionton USB-100", 0x08dd, 0x0986, NULL}, - {"Corega FEter USB-TX", 0x7aa, 0x0004, NULL}, - {"MELCO/BUFFALO LUA-TX", 0x0411, 0x0001, NULL}, - {"D-Link DSB-650TX", 0x2001, 0x4001, NULL}, - {"D-Link DSB-650TX", 0x2001, 0x4002, NULL}, - {"D-Link DSB-650TX(PNA)", 0x2001, 0x4003, NULL}, - {"D-Link DSB-650", 0x2001, 0xabc1, NULL}, - {"D-Link DU-E10", 0x07b8, 0xabc1, NULL}, - {"D-Link DU-E100", 0x07b8, 0x4002, NULL}, - {"Linksys USB10TX", 0x066b, 0x2202, NULL}, - {"Linksys USB100TX", 0x066b, 0x2203, NULL}, - {"Linksys USB100TX", 0x066b, 0x2204, NULL}, - {"Linksys USB Ethernet Adapter", 0x066b, 0x2206, NULL}, - {"SMC 202 USB Ethernet", 0x0707, 0x0200, NULL}, - {"ADMtek AN986 \"Pegasus\" USB Ethernet (eval board)", 0x07a6, 0x0986, NULL}, - {"Accton USB 10/100 Ethernet Adapter", 0x083a, 0x1046, NULL}, - {"IO DATA USB ET/TX", 0x04bb, 0x0904, NULL}, - {"LANEED USB Ethernet LD-USB/TX", 0x056e, 0x4002, NULL}, - {"SOHOware NUB100 Ethernet", 0x15e8, 0x9100, NULL}, - {NULL, 0, 0, NULL} + {"Billionton USB-100", 0x08dd, 0x0986, DEFAULT_GPIO_RESET}, + {"Corega FEter USB-TX", 0x7aa, 0x0004, DEFAULT_GPIO_RESET}, + {"MELCO/BUFFALO LUA-TX", 0x0411, 0x0001, DEFAULT_GPIO_RESET}, + {"D-Link DSB-650TX", 0x2001, 0x4001, LINKSYS_GPIO_RESET}, + {"D-Link DSB-650TX", 0x2001, 0x4002, LINKSYS_GPIO_RESET}, + {"D-Link DSB-650TX(PNA)", 0x2001, 0x4003, DEFAULT_GPIO_RESET}, + {"D-Link DSB-650", 0x2001, 0xabc1, DEFAULT_GPIO_RESET}, + {"D-Link DU-E10", 0x07b8, 0xabc1, DEFAULT_GPIO_RESET}, + {"D-Link DU-E100", 0x07b8, 0x4002, DEFAULT_GPIO_RESET}, + {"Linksys USB10TX", 0x066b, 0x2202, LINKSYS_GPIO_RESET}, + {"Linksys USB100TX", 0x066b, 0x2203, LINKSYS_GPIO_RESET}, + {"Linksys USB100TX", 0x066b, 0x2204, LINKSYS_GPIO_RESET}, + {"Linksys USB Ethernet Adapter", 0x066b, 0x2206, LINKSYS_GPIO_RESET}, + {"SMC 202 USB Ethernet", 0x0707, 0x0200, DEFAULT_GPIO_RESET}, + {"ADMtek AN986 \"Pegasus\" USB Ethernet (eval board)", 0x07a6, 0x0986, + HAS_HOME_PNA | DEFAULT_GPIO_RESET}, + {"Accton USB 10/100 Ethernet Adapter", 0x083a, 0x1046, + DEFAULT_GPIO_RESET}, + {"IO DATA USB ET/TX", 0x04bb, 0x0904, DEFAULT_GPIO_RESET}, + {"LANEED USB Ethernet LD-USB/TX", 0x056e, 0x4002, DEFAULT_GPIO_RESET}, + {"SOHOware NUB100 Ethernet", 0x15e8, 0x9100, DEFAULT_GPIO_RESET}, + {"ADMtek ADM8511 \"Pegasus II\" USB Ethernet", 0x07a6, 0x8511, + PEGASUS_II | DEFAULT_GPIO_RESET}, + {NULL, 0, 0, 0} }; -static void pegasus_unlink_ctrl_urbs( struct pegasus *pegasus ) +static int update_eth_regs_async( pegasus_t * ); +/* Aargh!!! I _really_ hate such tweaks */ +static void ctrl_callback( urb_t *urb ) { - int i; + pegasus_t *pegasus = urb->context; + + if ( !pegasus ) + return; - for ( i=0; i < NUM_CTRL_URBS; i++ ) { - if ( pegasus->ctrl[i].urb.status == -EINPROGRESS ) - usb_unlink_urb( &pegasus->ctrl[i].urb ); + switch ( urb->status ) { + case USB_ST_NOERROR: + if ( pegasus->flags & ETH_REGS_CHANGE ) { + pegasus->flags &= ~ETH_REGS_CHANGE; + pegasus->flags |= ETH_REGS_CHANGED; + update_eth_regs_async( pegasus ); + return; + } + break; + case USB_ST_URB_PENDING: + return; + case USB_ST_URB_KILLED: + break; + default: + warn( __FUNCTION__ " status %d", urb->status); + } + pegasus->flags &= ~ETH_REGS_CHANGED; + if ( pegasus->flags & CTRL_URB_SLEEP ) { + pegasus->flags &= ~CTRL_URB_SLEEP; + wake_up_interruptible( &pegasus->ctrl_wait ); } } -static int pegasus_find_ctrl_urb( struct pegasus *pegasus ) +static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) { - int i=0; - - while( i < NUM_CTRL_URBS && (pegasus->ctrl[i].busy == 1 || - (pegasus->ctrl[i].urb.status == -EINPROGRESS)) ) - i++; + int ret; - return i; -} - - -static void pegasus_ctrl_end( urb_t *urb ) -{ - struct ctrl_urb_pool *ctrl = urb->context; - struct pegasus *pegasus = ctrl->pegasus; + if ( pegasus->flags & ETH_REGS_CHANGED ) { + pegasus->flags |= CTRL_URB_SLEEP; + interruptible_sleep_on( &pegasus->ctrl_wait ); + } + pegasus->dr.requesttype = PEGASUS_REQT_READ; + pegasus->dr.request = PEGASUS_REQ_GET_REGS; + pegasus->dr.value = 0; + pegasus->dr.index = cpu_to_le16p(&indx); + pegasus->dr.length = + pegasus->ctrl_urb.transfer_buffer_length = cpu_to_le16p(&size); + FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb, + usb_rcvctrlpipe(pegasus->usb,0), + (char *)&pegasus->dr, + data, size, ctrl_callback, pegasus ); - if ( !pegasus ) - return; + if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) { + err( __FUNCTION__ " BAD CTRLs %d", ret); + return ret; + } + pegasus->flags |= CTRL_URB_SLEEP; + interruptible_sleep_on( &pegasus->ctrl_wait ); - if ( urb->status ) - warn("ctrl_urb end status %d", urb->status); - ctrl->busy = 0; -#ifdef PEGASUS_USE_WAITQ - wake_up_interruptible( &pegasus->ctrl_wait ); -#endif + return ret; } -static int pegasus_get_registers( struct pegasus *pegasus, __u16 indx, __u16 size, void *data ) +static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) { - int ret, i; - struct ctrl_urb_pool *ctrl; - - if ( (i = pegasus_find_ctrl_urb( pegasus )) == NUM_CTRL_URBS ) { - return -1; - } + int ret; - ctrl = &pegasus->ctrl[i]; - ctrl->busy = 1; - ctrl->pegasus = pegasus; - - ctrl->dr.requesttype = PEGASUS_REQT_READ; - ctrl->dr.request = PEGASUS_REQ_GET_REGS; - ctrl->dr.value = 0; - ctrl->dr.index = cpu_to_le16p(&indx); - ctrl->dr.length = - ctrl->urb.transfer_buffer_length = cpu_to_le16p(&size); + if ( pegasus->flags & ETH_REGS_CHANGED ) { + pegasus->flags |= CTRL_URB_SLEEP ; + interruptible_sleep_on( &pegasus->ctrl_wait ); + } + pegasus->dr.requesttype = PEGASUS_REQT_WRITE; + pegasus->dr.request = PEGASUS_REQ_SET_REGS; + pegasus->dr.value = 0; + pegasus->dr.index = cpu_to_le16p( &indx ); + pegasus->dr.length = + pegasus->ctrl_urb.transfer_buffer_length = cpu_to_le16p( &size ); - FILL_CONTROL_URB( &ctrl->urb, pegasus->usb, - usb_rcvctrlpipe(pegasus->usb,0), - (char *)&ctrl->dr, - data, size, pegasus_ctrl_end, ctrl ); + FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb, + usb_sndctrlpipe(pegasus->usb,0), + (char *)&pegasus->dr, + data, size, ctrl_callback, pegasus ); - if ( (ret = usb_submit_urb( &ctrl->urb )) ) - err( __FUNCTION__ " BAD CTRLs %d", ret); -#ifdef PEGASUS_USE_WAITQ + if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) { + err( __FUNCTION__ " BAD CTRL %d", ret); + return ret; + } + pegasus->flags |= CTRL_URB_SLEEP; interruptible_sleep_on( &pegasus->ctrl_wait ); -#endif + return ret; } -static int pegasus_set_registers( struct pegasus *pegasus, __u16 indx, __u16 size, void *data ) +static int set_register( pegasus_t *pegasus, __u16 indx, __u8 data ) { - int ret, i; - struct ctrl_urb_pool *ctrl; - - if ( (i = pegasus_find_ctrl_urb( pegasus )) == NUM_CTRL_URBS ) { - return -1; - } + int ret; - ctrl = &pegasus->ctrl[i]; - ctrl->busy = 1; - ctrl->pegasus = pegasus; - - ctrl->dr.requesttype = PEGASUS_REQT_WRITE; - ctrl->dr.request = PEGASUS_REQ_SET_REGS; - ctrl->dr.value = 0; - ctrl->dr.index = cpu_to_le16p( &indx ); - ctrl->dr.length = - ctrl->urb.transfer_buffer_length = cpu_to_le16p( &size ); + if ( pegasus->flags & ETH_REGS_CHANGED ) { + pegasus->flags |= CTRL_URB_SLEEP; + interruptible_sleep_on( &pegasus->ctrl_wait ); + } + pegasus->dr.requesttype = PEGASUS_REQT_WRITE; + pegasus->dr.request = PEGASUS_REQ_SET_REG; + pegasus->dr.value = data; + pegasus->dr.index = cpu_to_le16p( &indx ); + pegasus->dr.length = pegasus->ctrl_urb.transfer_buffer_length = 1; - FILL_CONTROL_URB( &ctrl->urb, pegasus->usb, + FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb, usb_sndctrlpipe(pegasus->usb,0), - (char *)&ctrl->dr, - data, size, pegasus_ctrl_end, ctrl ); + (char *)&pegasus->dr, + &data, 1, ctrl_callback, pegasus ); - if ( (ret = usb_submit_urb( &ctrl->urb )) ) + if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) { err( __FUNCTION__ " BAD CTRL %d", ret); -#ifdef PEGASUS_USE_WAITQ + return ret; + } + pegasus->flags |= CTRL_URB_SLEEP; interruptible_sleep_on( &pegasus->ctrl_wait ); -#endif + return ret; } -static int pegasus_set_register( struct pegasus *pegasus, __u16 indx,__u8 data ) +static int update_eth_regs_async( pegasus_t *pegasus ) { - int ret, i; - struct ctrl_urb_pool *ctrl; - - if ( (i = pegasus_find_ctrl_urb( pegasus )) == NUM_CTRL_URBS ) { - return -1; - } - - ctrl = &pegasus->ctrl[i]; - ctrl->busy = 1; - ctrl->pegasus = pegasus; + int ret; - ctrl->dr.requesttype = PEGASUS_REQT_WRITE; - ctrl->dr.request = PEGASUS_REQ_SET_REG; - ctrl->dr.value = cpu_to_le16p( &data ); - ctrl->dr.index = cpu_to_le16p( &indx ); - ctrl->dr.length = ctrl->urb.transfer_buffer_length = 1; + pegasus->dr.requesttype = PEGASUS_REQT_WRITE; + pegasus->dr.request = PEGASUS_REQ_SET_REGS; + pegasus->dr.value = 0; + pegasus->dr.index = EthCtrl0; + pegasus->dr.length = + pegasus->ctrl_urb.transfer_buffer_length = 3; - FILL_CONTROL_URB( &ctrl->urb, pegasus->usb, + FILL_CONTROL_URB( &pegasus->ctrl_urb, pegasus->usb, usb_sndctrlpipe(pegasus->usb,0), - (char *)&ctrl->dr, - &data, 1, pegasus_ctrl_end, ctrl ); + (char *)&pegasus->dr, + pegasus->eth_regs, 3, ctrl_callback, pegasus ); + + if ( (ret = usb_submit_urb( &pegasus->ctrl_urb )) ) + err( __FUNCTION__ " BAD CTRL %d, flags %x",ret,pegasus->flags ); - if ( (ret = usb_submit_urb( &ctrl->urb )) ) - err( __FUNCTION__ " BAD CTRL %d", ret); -#ifdef PEGASUS_USE_WAITQ - interruptible_sleep_on( &pegasus->ctrl_wait ); -#endif return ret; } -static int pegasus_read_phy_word(struct pegasus *pegasus, __u8 index, __u16 *regdata) +static int read_phy_word( pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd ) { - int i; - __u8 data[4] = { 1, 0, 0, 0x40 + index }; + int i; + __u8 data[4] = { phy, 0, 0, indx }; - pegasus_set_registers(pegasus, PhyAddr, 4, data); - for (i = 0; i < 100; i++) { - pegasus_get_registers(pegasus, PhyData, 3, data); - if (data[2] & 0x80) { - *regdata = *(__u16 *)(data); - return 0; - } + set_register( pegasus, PhyCtrl, 0 ); + set_registers( pegasus, PhyAddr, sizeof(data), data ); + set_register( pegasus, PhyCtrl, (indx | PHY_READ) ); + for (i = 0; i < REG_TIMEOUT; i++) { + get_registers(pegasus, PhyCtrl, 1, data); + if ( data[0] & PHY_DONE ) + break; } - warn("read_phy_word() failed"); + if ( i < REG_TIMEOUT ) { + get_registers( pegasus, PhyData, 2, regd ); + return 0; + } + warn( __FUNCTION__ " failed" ); return 1; } -static int pegasus_write_phy_word(struct pegasus *pegasus, __u8 index, __u16 regdata) +static int write_phy_word( pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 regd ) { - int i; - __u8 data[4] = { 1, regdata, regdata >> 8, 0x20 + index }; - - pegasus_set_registers(pegasus, PhyAddr, 4, data); - for (i = 0; i < 100; i++) { - pegasus_get_registers(pegasus, PhyCtrl, 1, data); - if (data[0] & 0x80) - return 0; + int i; + __u8 data[4] = { phy, 0, 0, indx }; + + *(data + 1) = cpu_to_le16p( ®d ); + set_register( pegasus, PhyCtrl, 0 ); + set_registers( pegasus, PhyAddr, 4, data ); + set_register( pegasus, PhyCtrl, (indx | PHY_WRITE) ); + for (i = 0; i < REG_TIMEOUT; i++) { + get_registers(pegasus, PhyCtrl, 1, data); + if ( data[0] & PHY_DONE ) + break; } - warn("write_phy_word() failed"); + if ( i < REG_TIMEOUT ) + return 0; + warn( __FUNCTION__ " failed" ); return 1; } -static int pegasus_rw_eprom_word(struct pegasus *pegasus, __u8 index, __u16 *retdata, __u8 direction) +static int read_eprom_word( pegasus_t *pegasus, __u8 index, __u16 *retdata ) { - int i; - __u8 data[4] = { index, 0, 0, direction }; + int i, tmp; - pegasus_set_registers(pegasus, EpromOffset, 4, data); - for (i = 0; i < 100; i++) { - pegasus_get_registers(pegasus, EpromCtrl, 1, data); - if (data[0] & 4) { - pegasus_get_registers(pegasus, EpromData, 2, data); - *retdata = *(__u16 *)data; - return 0; - } + set_register( pegasus, EpromCtrl, 0 ); + set_register( pegasus, EpromOffset, index ); + set_register( pegasus, EpromCtrl, EPROM_READ); + for ( i=0; i < REG_TIMEOUT; i++ ) { + get_registers( pegasus, EpromCtrl, 1, &tmp ); + if ( tmp & EPROM_DONE ) + break; } - warn("pegasus_rw_eprom_word() failed"); - - return 1; + if ( i < REG_TIMEOUT ) { + get_registers( pegasus, EpromData, 2, retdata ); + return 0; + } + warn( __FUNCTION__ " failed" ); + + return -1; } -static int pegasus_get_node_id(struct pegasus *pegasus, __u8 *id) +static inline void enable_eprom_write( pegasus_t *pegasus ) +{ + __u8 tmp; + + get_registers( pegasus, EthCtrl2, 1, &tmp ); + set_register( pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE ); +} + + +static inline void disable_eprom_write( pegasus_t *pegasus ) +{ + __u8 tmp; + + get_registers( pegasus, EthCtrl2, 1, &tmp ); + set_register( pegasus, EpromCtrl, 0 ); + set_register( pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE ); +} + + +static int write_eprom_word( pegasus_t *pegasus, __u8 index, __u16 data ) +{ + int i, tmp; + __u8 d[4] = {0x3f, 0, 0, EPROM_WRITE}; + + set_registers( pegasus, EpromOffset, 4, d ); + enable_eprom_write( pegasus ); + set_register( pegasus, EpromOffset, index ); + set_registers( pegasus, EpromData, 2, &data ); + set_register( pegasus, EpromCtrl, EPROM_WRITE ); + + for ( i=0; i < REG_TIMEOUT; i++ ) { + get_registers( pegasus, EpromCtrl, 1, &tmp ); + if ( tmp & EPROM_DONE ) + break; + } + disable_eprom_write( pegasus ); + if ( i < REG_TIMEOUT ) + return 0; + warn( __FUNCTION__ " failed" ); + return -1; +} + + +static void set_intr_interval( pegasus_t *pegasus ) +{ + __u16 d; + __u8 tmp; + + read_eprom_word( pegasus, 4, &d ); + ((__u8 *)&d)[1] = INTR_IVAL; + write_eprom_word( pegasus, 4, d ); + get_registers( pegasus, EthCtrl2, 1, &tmp ); + set_register( pegasus, EthCtrl2, tmp | EPROM_LOAD ); + udelay( 10000 ); + set_register( pegasus, EthCtrl2, tmp ); +#ifdef PEGASUS_DUMP_EEPROM + { int i; + for ( i=0; i < 0x40; i++ ) { + read_eprom_word( pegasus, i, &d ); + printk( "eepromword %02x-%04x, ", i, d ); + } + printk( "\n" ); + } +#endif +} + + +static inline int get_node_id( pegasus_t *pegasus, __u8 *id ) { int i; + for (i = 0; i < 3; i++) - if (pegasus_rw_eprom_word(pegasus, i, (__u16 *)&id[i*2], EPROM_READ)) + if ( read_eprom_word( pegasus, i, (__u16 *)&id[i*2]) ) return 1; return 0; } -static int pegasus_reset_mac(struct pegasus *pegasus) +static inline int reset_mac( pegasus_t *pegasus ) { - __u8 data = 0x8; - int i; + __u8 data = 0x8; + int i; - pegasus_set_register(pegasus, EthCtrl1, data); - for (i = 0; i < 100; i++) { - pegasus_get_registers(pegasus, EthCtrl1, 1, &data); + set_register(pegasus, EthCtrl1, data); + for (i = 0; i < REG_TIMEOUT; i++) { + get_registers(pegasus, EthCtrl1, 1, &data); if (~data & 0x08) { if (loopback & 1) - return 0; - pegasus_set_register(pegasus, Gpio0, 0x24); - pegasus_set_register(pegasus, Gpio0, 0x27); - return 0; + break; + if ( mode && (pegasus->features & HAS_HOME_PNA) ) + set_register( pegasus, Gpio1, 0x34 ); + else + set_register( pegasus, Gpio1, 0x26 ); + set_register( pegasus, Gpio0, pegasus->features ); + set_register( pegasus, Gpio0, DEFAULT_GPIO_SET ); + break; } } - - return 1; + if ( i == REG_TIMEOUT ) + return 1; + return 0; } -static int pegasus_start_net(struct net_device *dev, struct usb_device *usb) +static int start_net( struct net_device *dev, struct usb_device *usb ) { - __u16 partmedia, temp; - __u8 node_id[6]; - __u8 data[4]; - struct pegasus *pegasus = dev->priv; + __u16 linkpart, bmsr; + __u8 node_id[6]; + __u8 data[4]; + pegasus_t *pegasus = dev->priv; - if (pegasus_get_node_id(pegasus, node_id)) + if ( get_node_id(pegasus, node_id) ) return 1; - pegasus_set_registers(pegasus, EthID, 6, node_id); - memcpy(dev->dev_addr, node_id, 6); - if (pegasus_read_phy_word(pegasus, 1, &temp)) + set_registers( pegasus, EthID, sizeof(node_id), node_id ); + memcpy( dev->dev_addr, node_id, sizeof(node_id) ); + if ( read_phy_word(pegasus, pegasus->phy, MII_BMSR, &bmsr) ) return 2; - - if ((~temp & 4) && !loopback) { - warn("%s: link NOT established (0x%x) - check the cable.", - dev->name, temp); - } - - if (pegasus_read_phy_word(pegasus, 5, &partmedia)) + if ( !(bmsr & 0x20) && !loopback ) + warn( "%s: link NOT established (0x%x) - check the cable.", + dev->name, bmsr ); + if ( read_phy_word(pegasus, pegasus->phy, MII_ANLPA, &linkpart) ) return 4; - - if ((partmedia & 0x1f) != 1) { - warn("party FAIL %x", partmedia); - } + if ( !(linkpart & 1) ) + warn( "link partner stat %x", linkpart ); data[0] = 0xc9; - data[1] = (partmedia & 0x100) ? 0x30 : ((partmedia & 0x80) ? 0x10 : 0); + data[1] = 0; + if ( linkpart & (ANLPA_100TX_FD | ANLPA_10T_FD) ) + data[1] |= 0x20; /* set full duplex */ + if ( linkpart & (ANLPA_100TX_FD | ANLPA_100TX_HD) ) + data[1] |= 0x10; /* set 100 Mbps */ + if ( mode ) + data[1] = 0; data[2] = (loopback & 1) ? 0x09 : 0x01; - pegasus_set_registers(pegasus, EthCtrl0, 3, data); + *(unsigned *)pegasus->eth_regs = *(unsigned *)data; + + set_registers( pegasus, EthCtrl0, 3, data ); return 0; } -static void pegasus_read_bulk_callback( struct urb *urb ) +static void read_bulk_callback( struct urb *urb ) { - struct pegasus *pegasus = urb->context; - struct net_device *net; /* = pegasus->net;*/ + pegasus_t *pegasus = urb->context; + struct net_device *net; int count = urb->actual_length, res; - int rx_status; /*= *(int *)(pegasus->rx_buff + count - 4);*/ + int rx_status; struct sk_buff *skb; __u16 pkt_len; @@ -436,26 +584,26 @@ goto goon; } - if (!count) - goto goon; -#if 0 - if (rx_status & 0x00010000) + if ( !count ) goto goon; -#endif - if (rx_status & 0x000e0000) { + + if ( rx_status & 0x000e0000 ) { dbg("%s: error receiving packet %x", net->name, rx_status & 0xe0000); pegasus->stats.rx_errors++; - if(rx_status & 0x060000) pegasus->stats.rx_length_errors++; - if(rx_status & 0x080000) pegasus->stats.rx_crc_errors++; - if(rx_status & 0x100000) pegasus->stats.rx_frame_errors++; + if ( rx_status & 0x060000 ) + pegasus->stats.rx_length_errors++; + if ( rx_status & 0x080000 ) + pegasus->stats.rx_crc_errors++; + if ( rx_status & 0x100000 ) + pegasus->stats.rx_frame_errors++; goto goon; } pkt_len = (rx_status & 0xfff) - 8; - if(!(skb = dev_alloc_skb(pkt_len+2))) + if ( !(skb = dev_alloc_skb(pkt_len+2)) ) goto goon; skb->dev = net; @@ -470,35 +618,58 @@ goon: if ( (res = usb_submit_urb(&pegasus->rx_urb)) ) - warn("(prb)failed rx_urb %d", res); + warn( __FUNCTION__ " failed submint rx_urb %d", res); } -static void pegasus_irq_callback( urb_t *urb ) +static void write_bulk_callback( struct urb *urb ) { - __u8 *d = urb->transfer_buffer; + pegasus_t *pegasus = urb->context; + if ( !pegasus || !(pegasus->flags & PEGASUS_RUNNING) ) + return; + if ( urb->status ) + info("%s: TX status %d", pegasus->net->name, urb->status); - if ( d[0] ) - dbg("txst0=0x%2x", d[0]); + netif_wake_queue(pegasus->net); } -static void pegasus_write_bulk_callback(struct urb *urb) +static void intr_callback( struct urb *urb ) { - struct pegasus *pegasus = urb->context; + pegasus_t *pegasus = urb->context; + struct net_device *net; + __u8 *d; if ( !pegasus ) return; - - if (urb->status) - info("%s: TX status %d", pegasus->net->name, urb->status); - netif_wake_queue(pegasus->net); + d = urb->transfer_buffer; + net = pegasus->net; + if ( d[0] & 0xfc ) { + pegasus->stats.tx_errors++; + if ( d[0] & TX_UNDERRUN ) + pegasus->stats.tx_fifo_errors++; + if ( d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT) ) + pegasus->stats.tx_aborted_errors++; + if ( d[0] & LATE_COL ) + pegasus->stats.tx_window_errors++; + if ( d[0] & (NO_CARRIER | LOSS_CARRIER) ) + pegasus->stats.tx_carrier_errors++; + } + switch ( urb->status ) { + case USB_ST_NOERROR: + break; + case USB_ST_URB_KILLED: + break; + default: + info("intr status %d", urb->status); + } } -static void pegasus_tx_timeout(struct net_device *net) + +static void pegasus_tx_timeout( struct net_device *net ) { - struct pegasus *pegasus = net->priv; + pegasus_t *pegasus = net->priv; if ( !pegasus ) return; @@ -512,11 +683,11 @@ } -static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net) +static int pegasus_start_xmit( struct sk_buff *skb, struct net_device *net ) { - struct pegasus *pegasus = net->priv; - int count = ((skb->len+2) & 0x3f) ? skb->len+2 : skb->len+3; - int res; + pegasus_t *pegasus = net->priv; + int count = ((skb->len+2) & 0x3f) ? skb->len+2 : skb->len+3; + int res; netif_stop_queue(net); if ( !(pegasus->flags & PEGASUS_RUNNING) ) @@ -543,77 +714,74 @@ } -static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev) +static struct net_device_stats *pegasus_netdev_stats( struct net_device *dev ) { - return &((struct pegasus *)dev->priv)->stats; + return &((pegasus_t *)dev->priv)->stats; } -static inline void pegasus_stop_net( struct pegasus *pegasus ) +static inline void stop_net( pegasus_t *pegasus ) { - int tmp; + int tmp=0; - pegasus_get_registers( pegasus, EthCtrl0, 1, &tmp ); - pegasus_set_register( pegasus, EthCtrl0, tmp & 0x3f ); + set_registers( pegasus, EthCtrl0, 2, &tmp ); } static int pegasus_open(struct net_device *net) { - struct pegasus *pegasus = (struct pegasus *)net->priv; - int res; + pegasus_t *pegasus = (pegasus_t *)net->priv; + int res; - if ((res = pegasus_start_net(net, pegasus->usb))) { + if ((res = start_net(net, pegasus->usb))) { err("can't start_net() - %d", res); return -EIO; } - - if ((res = usb_submit_urb(&pegasus->rx_urb))) - warn("(open)failed rx_urb %d", res); - - if ((res = usb_submit_urb(&pegasus->intr_urb))) - warn("(open)failed intr_urb %d", res); - - netif_start_queue(net); + if ( (res = usb_submit_urb(&pegasus->rx_urb)) ) + warn( __FUNCTION__ " failed rx_urb %d", res ); +#ifdef PEGASUS_USE_INTR + if ( (res = usb_submit_urb(&pegasus->intr_urb)) ) + warn( __FUNCTION__ " failed intr_urb %d", res); +#endif + netif_start_queue( net ); pegasus->flags |= PEGASUS_RUNNING; return 0; } -static int pegasus_close(struct net_device *net) +static int pegasus_close( struct net_device *net ) { - struct pegasus *pegasus = net->priv; + pegasus_t *pegasus = net->priv; + stop_net( pegasus ); pegasus->flags &= ~PEGASUS_RUNNING; - pegasus_stop_net( pegasus ); - netif_stop_queue(net); - usb_unlink_urb(&pegasus->rx_urb); - usb_unlink_urb(&pegasus->tx_urb); - usb_unlink_urb(&pegasus->intr_urb); - pegasus_unlink_ctrl_urbs( pegasus ); + usb_unlink_urb( &pegasus->rx_urb ); + usb_unlink_urb( &pegasus->tx_urb ); + usb_unlink_urb( &pegasus->ctrl_urb ); + usb_unlink_urb( &pegasus->intr_urb ); return 0; } -static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) +static int pegasus_ioctl( struct net_device *net, struct ifreq *rq, int cmd ) { __u16 *data = (__u16 *)&rq->ifr_data; - struct pegasus *pegasus = net->priv; + pegasus_t *pegasus = net->priv; switch(cmd) { case SIOCDEVPRIVATE: - data[0] = 1; + data[0] = pegasus->phy; case SIOCDEVPRIVATE+1: - pegasus_read_phy_word(pegasus, data[1] & 0x1f, &data[3]); + read_phy_word(pegasus, data[0], data[1]&0x1f, &data[3]); return 0; case SIOCDEVPRIVATE+2: - if (!capable(CAP_NET_ADMIN)) + if ( !capable(CAP_NET_ADMIN) ) return -EPERM; - pegasus_write_phy_word(pegasus, data[1] & 0x1f, data[2]); + write_phy_word(pegasus, pegasus->phy, data[1] & 0x1f, data[2]); return 0; default: return -EOPNOTSUPP; @@ -621,36 +789,29 @@ } -static void pegasus_set_rx_mode(struct net_device *net) +static void pegasus_set_multicast( struct net_device *net ) { -#ifndef PEGASUS_USE_WAITQ - struct pegasus *pegasus = net->priv; - __u8 tmp; -#endif + pegasus_t *pegasus = net->priv; netif_stop_queue(net); if (net->flags & IFF_PROMISC) { -#ifndef PEGASUS_USE_WAITQ - pegasus_get_registers(pegasus, EthCtrl2, 1, &tmp); - pegasus_set_register(pegasus, EthCtrl2, tmp | 4); -#endif + pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; info("%s: Promiscuous mode enabled", net->name); } else if ((net->mc_count > multicast_filter_limit) || (net->flags & IFF_ALLMULTI)) { -#ifndef PEGASUS_USE_WAITQ - pegasus_set_register(pegasus, EthCtrl0, 0xfa); - pegasus_set_register(pegasus, EthCtrl2, 0); -#endif + pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; + pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; info("%s set allmulti", net->name); } else { -#ifndef PEGASUS_USE_WAITQ - pegasus_get_registers(pegasus, EthCtrl2, 1, &tmp); - pegasus_set_register(pegasus, EthCtrl2, tmp & ~4); -#endif + pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST; + pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; info("%s: set Rx mode", net->name); } + pegasus->flags |= ETH_REGS_CHANGE; + ctrl_callback( &pegasus->ctrl_urb ); + netif_wake_queue(net); } @@ -669,10 +830,38 @@ } -static void * pegasus_probe(struct usb_device *dev, unsigned int ifnum) +static __u8 mii_phy_probe( pegasus_t *pegasus ) +{ + int i; + __u16 tmp; + + for ( i=0; i < 32; i++ ) { + read_phy_word( pegasus, i, MII_BMSR, &tmp ); + if ( tmp == 0 || tmp == 0xffff || (tmp & BMSR_MEDIA) == 0 ) + continue; + else + return i; + } + + return 0; +} + + +static inline void setup_pegasus_II( pegasus_t *pegasus ) +{ + set_register( pegasus, Reg1d, 0 ); + set_register( pegasus, Reg7b, 2 ); + if ( pegasus->features & HAS_HOME_PNA ) + set_register( pegasus, Reg81, 6 ); + else + set_register( pegasus, Reg81, 2 ); +} + + +static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum ) { struct net_device *net; - struct pegasus *pegasus; + pegasus_t *pegasus; int dev_indx; if ( (dev_indx = check_device_ids(dev->descriptor.idVendor, dev->descriptor.idProduct)) == -1 ) { @@ -698,7 +887,7 @@ net->tx_timeout = pegasus_tx_timeout; net->do_ioctl = pegasus_ioctl; net->hard_start_xmit = pegasus_start_xmit; - net->set_multicast_list = pegasus_set_rx_mode; + net->set_multicast_list = pegasus_set_multicast; net->get_stats = pegasus_netdev_stats; net->mtu = PEGASUS_MTU; @@ -710,22 +899,37 @@ FILL_BULK_URB( &pegasus->rx_urb, dev, usb_rcvbulkpipe(dev, 1), pegasus->rx_buff, PEGASUS_MAX_MTU, - pegasus_read_bulk_callback, pegasus ); + read_bulk_callback, pegasus ); FILL_BULK_URB( &pegasus->tx_urb, dev, usb_sndbulkpipe(dev, 2), pegasus->tx_buff, PEGASUS_MAX_MTU, - pegasus_write_bulk_callback, pegasus ); + write_bulk_callback, pegasus ); FILL_INT_URB( &pegasus->intr_urb, dev, usb_rcvintpipe(dev, 3), - pegasus->intr_buff, 8, pegasus_irq_callback, - pegasus, 128 ); + pegasus->intr_buff, 8, intr_callback, + pegasus, INTR_IVAL ); - if (pegasus_reset_mac(pegasus)) { + pegasus->features = usb_dev_id[dev_indx].private; + if ( reset_mac(pegasus) ) { err("can't reset MAC"); + unregister_netdev( pegasus->net ); kfree(pegasus); pegasus = NULL; return NULL; } - - info( "%s: %s\n", net->name, usb_dev_id[dev_indx].name ); + + if ( pegasus->features & PEGASUS_II ) { + info( "setup Pegasus II specific registers" ); + setup_pegasus_II( pegasus ); + } + + pegasus->phy = mii_phy_probe( pegasus ); + if ( !pegasus->phy ) { + warn( "can't locate MII phy, using default" ); + pegasus->phy = 1; + } + + set_intr_interval( pegasus ); + + info( "%s: %s", net->name, usb_dev_id[dev_indx].name ); MOD_INC_USE_COUNT; @@ -733,24 +937,26 @@ } -static void pegasus_disconnect(struct usb_device *dev, void *ptr) +static void pegasus_disconnect( struct usb_device *dev, void *ptr ) { struct pegasus *pegasus = ptr; - if (!pegasus) { + if ( !pegasus ) { warn("unregistering non-existant device"); return; } + stop_net( pegasus ); pegasus->flags &= ~PEGASUS_RUNNING; - unregister_netdev(pegasus->net); + netif_stop_queue( pegasus->net ); + unregister_netdev( pegasus->net ); - usb_unlink_urb(&pegasus->rx_urb); - usb_unlink_urb(&pegasus->tx_urb); - usb_unlink_urb(&pegasus->intr_urb); - pegasus_unlink_ctrl_urbs( pegasus ); - - kfree(pegasus); + usb_unlink_urb( &pegasus->rx_urb ); + usb_unlink_urb( &pegasus->tx_urb ); + usb_unlink_urb( &pegasus->ctrl_urb ); + usb_unlink_urb( &pegasus->intr_urb ); + + kfree( pegasus ); pegasus = NULL; MOD_DEC_USE_COUNT; @@ -766,13 +972,13 @@ int __init pegasus_init(void) { info( "%s", version ); - return usb_register(&pegasus_driver); + return usb_register( &pegasus_driver ); } void __exit pegasus_exit(void) { - usb_deregister(&pegasus_driver); + usb_deregister( &pegasus_driver ); } -module_init(pegasus_init); -module_exit(pegasus_exit); +module_init( pegasus_init ); +module_exit( pegasus_exit ); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/serial/ftdi_sio.c linux/drivers/usb/serial/ftdi_sio.c --- v2.4.0-test8/linux/drivers/usb/serial/ftdi_sio.c Tue Sep 5 13:42:52 2000 +++ linux/drivers/usb/serial/ftdi_sio.c Mon Sep 18 15:23:25 2000 @@ -12,6 +12,9 @@ * * See Documentation/usb/usb-serial.txt for more information on using this driver * + * (09/11/2000) gkh + * Removed DEBUG #ifdefs with call to usb_serial_debug_data + * * (07/19/2000) gkh * Added module_init and module_exit functions to handle the fact that this * driver is a loadable module now. @@ -331,26 +334,9 @@ first_byte = port->write_urb->transfer_buffer; *first_byte = 1 | ((count-data_offset) << 2) ; -#ifdef CONFIG_USB_SERIAL_DEBUG dbg("Bytes: %d, Control Byte: 0o%03o",count, first_byte[0]); - - if (count) { - int i; - printk (KERN_DEBUG __FILE__ ": data written - length = %d, data = ", count); - for (i = 0; i < count; ++i) { - printk ( "0x%02x ", first_byte[i]); - if (first_byte[i] > ' ' && first_byte[i] < '~') { - printk( "%c ", first_byte[i]); - } else { - printk( " "); - } - } - - - printk ( "\n"); - } - -#endif + usb_serial_debug_data (__FILE__, __FUNCTION__, count, first_byte); + /* send the data out the bulk port */ port->write_urb->transfer_buffer_length = count; @@ -429,23 +415,11 @@ return; } -#ifdef CONFIG_USB_SERIAL_DEBUG if (urb->actual_length > 2) { - printk (KERN_DEBUG __FILE__ ": data read - length = %d, data = ", urb->actual_length); - for (i = 0; i < urb->actual_length; ++i) { - printk ( "0x%.2x ", data[i]); - if (data[i] > ' ' && data[i] < '~') { - printk( "%c ", data[i]); - } else { - printk( " "); - } - } - printk ( "\n"); + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); } else { dbg("Just status"); } -#endif - if (urb->actual_length > data_offset) { for (i = data_offset ; i < urb->actual_length ; ++i) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/serial/usb-serial.h linux/drivers/usb/serial/usb-serial.h --- v2.4.0-test8/linux/drivers/usb/serial/usb-serial.h Tue Sep 5 13:19:08 2000 +++ linux/drivers/usb/serial/usb-serial.h Mon Sep 18 15:23:25 2000 @@ -11,6 +11,10 @@ * * See Documentation/usb/usb-serial.txt for more information on using this driver * + * (09/11/2000) gkh + * Added usb_serial_debug_data function to help get rid of #DEBUG in the + * drivers. + * * (08/28/2000) gkh * Added port_lock to port structure. * @@ -204,6 +208,18 @@ return port->serial; } + +static inline void usb_serial_debug_data (const char *file, const char *function, int size, const unsigned char *data) +{ +#ifdef CONFIG_USB_SERIAL_DEBUG + int i; + printk (KERN_DEBUG "%s: %s - length = %d, data = ", file, function, size); + for (i = 0; i < size; ++i) { + printk ("%.2x ", data[i]); + } + printk ("\n"); +#endif +} #endif /* ifdef __LINUX_USB_SERIAL_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/serial/usbserial.c linux/drivers/usb/serial/usbserial.c --- v2.4.0-test8/linux/drivers/usb/serial/usbserial.c Tue Sep 5 13:19:08 2000 +++ linux/drivers/usb/serial/usbserial.c Mon Sep 18 15:23:25 2000 @@ -15,6 +15,9 @@ * * See Documentation/usb/usb-serial.txt for more information on using this driver * + * (09/11/2000) gkh + * Removed DEBUG #ifdefs with call to usb_serial_debug_data + * * (08/28/2000) gkh * Added port_lock to port structure. * Added locks for SMP safeness to generic driver @@ -766,16 +769,7 @@ spin_lock_irqsave (&port->port_lock, flags); count = (count > port->bulk_out_size) ? port->bulk_out_size : count; -#ifdef DEBUG - { - int i; - printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ " - length = %d, data = ", count); - for (i = 0; i < count; ++i) { - printk ("%.2x ", buf[i]); - } - printk ("\n"); - } -#endif + usb_serial_debug_data (__FILE__, __FUNCTION__, count, buf); if (from_user) { copy_from_user(port->write_urb->transfer_buffer, buf, count); @@ -854,15 +848,7 @@ return; } -#ifdef DEBUG - if (urb->actual_length) { - printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ "- length = %d, data = ", urb->actual_length); - for (i = 0; i < urb->actual_length; ++i) { - printk ("%.2x ", data[i]); - } - printk ("\n"); - } -#endif + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); tty = port->tty; if (urb->actual_length) { diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/serial/visor.c linux/drivers/usb/serial/visor.c --- v2.4.0-test8/linux/drivers/usb/serial/visor.c Tue Sep 5 13:42:52 2000 +++ linux/drivers/usb/serial/visor.c Mon Sep 18 15:23:25 2000 @@ -11,6 +11,17 @@ * * See Documentation/usb/usb-serial.txt for more information on using this driver * + * (09/11/2000) gkh + * Got rid of always calling kmalloc for every urb we wrote out to the + * device. + * Added visor_read_callback so we can keep track of bytes in and out for + * those people who like to know the speed of their device. + * Removed DEBUG #ifdefs with call to usb_serial_debug_data + * + * (09/06/2000) gkh + * Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_ + * the host controller drivers set urb->dev = NULL when the urb is finished. + * * (08/28/2000) gkh * Added locks for SMP safeness. * @@ -71,6 +82,7 @@ #include "visor.h" +#define MIN(a,b) (((a)<(b))?(a):(b)) /* function prototypes for a handspring visor */ static int visor_open (struct usb_serial_port *port, struct file *filp); @@ -82,7 +94,8 @@ static void visor_shutdown (struct usb_serial *serial); static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); static void visor_set_termios (struct usb_serial_port *port, struct termios *old_termios); -static void visor_write_bulk_callback (struct urb *urb); +static void visor_write_bulk_callback (struct urb *urb); +static void visor_read_bulk_callback (struct urb *urb); /* All of the device info needed for the Handspring Visor */ static __u16 handspring_vendor_id = HANDSPRING_VENDOR_ID; @@ -108,12 +121,17 @@ set_termios: visor_set_termios, write: visor_write, write_bulk_callback: visor_write_bulk_callback, + read_bulk_callback: visor_read_bulk_callback, }; -#define NUM_URBS 24 +#define NUM_URBS 24 +#define URB_TRANSFER_BUFFER_SIZE 64 static struct urb *write_urb_pool[NUM_URBS]; static spinlock_t write_urb_pool_lock; +static int bytes_in; +static int bytes_out; + /****************************************************************************** * Handspring Visor specific driver functions @@ -134,6 +152,8 @@ if (!port->active) { port->active = 1; + bytes_in = 0; + bytes_out = 0; /*Start reading from the device*/ if (usb_submit_urb(port->read_urb)) @@ -181,78 +201,79 @@ usb_unlink_urb (port->read_urb); port->active = 0; port->open_count = 0; - } + } spin_unlock_irqrestore (&port->port_lock, flags); + + /* Uncomment the following line if you want to see some statistics in your syslog */ + /* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */ } static int visor_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count) { struct usb_serial *serial = port->serial; - struct urb *urb = NULL; - unsigned char *buffer = NULL; + struct urb *urb; + const unsigned char *current_position = buf; + unsigned long flags; int status; int i; - unsigned long flags; + int bytes_sent = 0; + int transfer_size; dbg(__FUNCTION__ " - port %d", port->number); - if (count == 0) { - dbg(__FUNCTION__ " - write request of 0 bytes"); - return 0; - } - - /* try to find a free urb in our list of them */ - spin_lock_irqsave (&write_urb_pool_lock, flags); - for (i = 0; i < NUM_URBS; ++i) { - if (write_urb_pool[i]->status != -EINPROGRESS) { - urb = write_urb_pool[i]; - break; + usb_serial_debug_data (__FILE__, __FUNCTION__, count, buf); + + while (count > 0) { + /* try to find a free urb in our list of them */ + urb = NULL; + spin_lock_irqsave (&write_urb_pool_lock, flags); + for (i = 0; i < NUM_URBS; ++i) { + if (write_urb_pool[i]->status != -EINPROGRESS) { + urb = write_urb_pool[i]; + break; + } } + spin_unlock_irqrestore (&write_urb_pool_lock, flags); + if (urb == NULL) { + dbg (__FUNCTION__ " - no more free urbs"); + goto exit; + } + if (urb->transfer_buffer == NULL) { + urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); + if (urb->transfer_buffer == NULL) { + err(__FUNCTION__" no more kernel memory..."); + goto exit; + } + } + + transfer_size = MIN (count, URB_TRANSFER_BUFFER_SIZE); + if (from_user) + copy_from_user (urb->transfer_buffer, current_position, transfer_size); + else + memcpy (urb->transfer_buffer, current_position, transfer_size); + + count = (count > port->bulk_out_size) ? port->bulk_out_size : count; + + /* build up our urb */ + FILL_BULK_URB (urb, serial->dev, usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), + urb->transfer_buffer, transfer_size, visor_write_bulk_callback, port); + urb->transfer_flags |= USB_QUEUE_BULK; + + /* send it down the pipe */ + status = usb_submit_urb(urb); + if (status) + dbg(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status); + + current_position += transfer_size; + bytes_sent += transfer_size; + count -= transfer_size; + bytes_out += transfer_size; } - spin_unlock_irqrestore (&write_urb_pool_lock, flags); - if (urb == NULL) { - dbg (__FUNCTION__ " - no free urbs"); - return 0; - } - - count = (count > port->bulk_out_size) ? port->bulk_out_size : count; - -#ifdef DEBUG - printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ " - length = %d, data = ", count); - for (i = 0; i < count; ++i) { - printk ("%.2x ", buf[i]); - } - printk ("\n"); -#endif - if (urb->transfer_buffer != NULL) - kfree(urb->transfer_buffer); - buffer = kmalloc (count, GFP_KERNEL); - if (buffer == NULL) { - err(__FUNCTION__" no more kernel memory..."); - return 0; - } - - if (from_user) { - copy_from_user(buffer, buf, count); - } - else { - memcpy (buffer, buf, count); - } - - /* build up our urb */ - FILL_BULK_URB (urb, serial->dev, usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), - buffer, count, visor_write_bulk_callback, port); - urb->transfer_flags |= USB_QUEUE_BULK; - - /* send it down the pipe */ - status = usb_submit_urb(urb); - if (status) - dbg(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status); - - return (count); +exit: + return bytes_sent; } @@ -277,6 +298,41 @@ } +static void visor_read_bulk_callback (struct urb *urb) +{ + struct usb_serial_port *port = (struct usb_serial_port *)urb->context; + struct tty_struct *tty; + unsigned char *data = urb->transfer_buffer; + int i; + + if (port_paranoia_check (port, __FUNCTION__)) + return; + + dbg(__FUNCTION__ " - port %d", port->number); + + if (urb->status) { + dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status); + return; + } + + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); + + tty = port->tty; + if (urb->actual_length) { + for (i = 0; i < urb->actual_length ; ++i) { + tty_insert_flip_char(tty, data[i], 0); + } + tty_flip_buffer_push(tty); + bytes_in += urb->actual_length; + } + + /* Continue trying to always read */ + if (usb_submit_urb(urb)) + dbg(__FUNCTION__ " - failed resubmitting read urb"); + return; +} + + static void visor_throttle (struct usb_serial_port *port) { unsigned long flags; @@ -372,7 +428,7 @@ kfree (transfer_buffer); /* continue on with initialization */ - return (0); + return 0; } @@ -466,20 +522,27 @@ static int __init visor_init (void) { + struct urb *urb; int i; usb_serial_register (&handspring_device); - /* create our write urb pool */ + /* create our write urb pool and transfer buffers */ spin_lock_init (&write_urb_pool_lock); for (i = 0; i < NUM_URBS; ++i) { - struct urb *urb = usb_alloc_urb(0); + urb = usb_alloc_urb(0); + write_urb_pool[i] = urb; if (urb == NULL) { err("No more urbs???"); continue; } + urb->transfer_buffer = NULL; - write_urb_pool[i] = urb; + urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); + if (!urb->transfer_buffer) { + err (__FUNCTION__ " - out of memory for urb buffers."); + continue; + } } return 0; @@ -496,10 +559,15 @@ spin_lock_irqsave (&write_urb_pool_lock, flags); for (i = 0; i < NUM_URBS; ++i) { - usb_unlink_urb(write_urb_pool[i]); - if (write_urb_pool[i]->transfer_buffer) - kfree(write_urb_pool[i]->transfer_buffer); - usb_free_urb (write_urb_pool[i]); + if (write_urb_pool[i]) { + /* FIXME - uncomment the following usb_unlink_urb call when + * the host controllers get fixed to set urb->dev = NULL after + * the urb is finished. Otherwise this call oopses. */ + /* usb_unlink_urb(write_urb_pool[i]); */ + if (write_urb_pool[i]->transfer_buffer) + kfree(write_urb_pool[i]->transfer_buffer); + usb_free_urb (write_urb_pool[i]); + } } spin_unlock_irqrestore (&write_urb_pool_lock, flags); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/serial/whiteheat.c linux/drivers/usb/serial/whiteheat.c --- v2.4.0-test8/linux/drivers/usb/serial/whiteheat.c Thu Sep 7 08:36:40 2000 +++ linux/drivers/usb/serial/whiteheat.c Mon Sep 18 15:23:25 2000 @@ -11,6 +11,9 @@ * * See Documentation/usb/usb-serial.txt for more information on using this driver * + * (09/11/2000) gkh + * Removed DEBUG #ifdefs with call to usb_serial_debug_data + * * (07/19/2000) gkh * Added module_init and module_exit functions to handle the fact that this * driver is a loadable module now. @@ -130,11 +133,6 @@ *****************************************************************************/ static void command_port_write_callback (struct urb *urb) { -#ifdef DEBUG - int i; - unsigned char *data = urb->transfer_buffer; -#endif - dbg (__FUNCTION__); if (urb->status) { @@ -142,15 +140,7 @@ return; } -#ifdef DEBUG - if (urb->actual_length) { - printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ " - length = %d, data = ", urb->actual_length); - for (i = 0; i < urb->actual_length; ++i) { - printk ("%.2x ", data[i]); - } - printk ("\n"); - } -#endif + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer); return; } @@ -160,9 +150,6 @@ { struct whiteheat_private *info = (struct whiteheat_private *)urb->context; unsigned char *data = urb->transfer_buffer; -#ifdef DEBUG - int i; -#endif dbg (__FUNCTION__); @@ -171,15 +158,7 @@ return; } -#ifdef DEBUG - if (urb->actual_length) { - printk (KERN_DEBUG __FILE__ ": " __FUNCTION__ " - length = %d, data = ", urb->actual_length); - for (i = 0; i < urb->actual_length; ++i) { - printk ("%.2x ", data[i]); - } - printk ("\n"); - } -#endif + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); /* right now, if the command is COMMAND_COMPLETE, just flip the bit saying the command finished */ /* in the future we're going to have to pay attention to the actual command that completed */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/Makefile linux/drivers/usb/storage/Makefile --- v2.4.0-test8/linux/drivers/usb/storage/Makefile Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/Makefile Fri Sep 8 16:39:12 2000 @@ -21,7 +21,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ - $(usb-storage-obj-y) + initializers.o $(usb-storage-obj-y) # Extract lists of the multi-part drivers. # The 'int-*' lists are the intermediate files used to build the multi's. diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/debug.c linux/drivers/usb/storage/debug.c --- v2.4.0-test8/linux/drivers/usb/storage/debug.c Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/debug.c Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Debugging Functions Source Code File * - * $Id: debug.c,v 1.3 2000/08/25 00:13:51 mdharm Exp $ + * $Id: debug.c,v 1.4 2000/09/04 02:12:47 groovyjava Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -206,5 +206,162 @@ sg[i].address[14], sg[i].address[15]); } +} + +void usb_stor_show_sense( + unsigned char key, + unsigned char asc, + unsigned char ascq) { + + char *keys[] = { + "No Sense", + "Recovered Error", + "Not Ready", + "Medium Error", + "Hardware Error", + "Illegal Request", + "Unit Attention", + "Data Protect", + "Blank Check", + "Vendor Specific", + "Copy Aborted", + "Aborted Command", + "(Obsolete)", + "Volume Overflow", + "Miscompare" + }; + + unsigned short qual = asc; + + char *what = 0; + char *keystr = 0; + + qual <<= 8; + qual |= ascq; + + if (key>0x0E) + keystr = "(Unknown Key)"; + else + keystr = keys[key]; + + switch (qual) { + + case 0x0000: what="no additional sense information"; break; + case 0x0001: what="filemark detected"; break; + case 0x0002: what="end of partition/medium detected"; break; + case 0x0003: what="setmark detected"; break; + case 0x0004: what="beginning of partition/medium detected"; break; + case 0x0005: what="end of data detected"; break; + case 0x0006: what="I/O process terminated"; break; + case 0x0011: what="audio play operation in progress"; break; + case 0x0012: what="audio play operation paused"; break; + case 0x0013: what="audio play operation stopped due to error"; break; + case 0x0014: what="audio play operation successfully completed"; break; + case 0x0015: what="no current audio status to return"; break; + case 0x0016: what="operation in progress"; break; + case 0x0017: what="cleaning requested"; break; + case 0x0100: what="no index/sector signal"; break; + case 0x0200: what="no seek complete"; break; + case 0x0300: what="peripheral device write fault"; break; + case 0x0301: what="no write current"; break; + case 0x0302: what="excessive write errors"; break; + case 0x0400: what="LUN not ready, cause not reportable"; break; + case 0x0401: what="LUN in process of becoming ready"; break; + case 0x0402: what="LUN not ready, initializing cmd. required"; break; + case 0x0403: what="LUN not ready, manual intervention required"; break; + case 0x0404: what="LUN not ready, format in progress"; break; + case 0x0405: what="LUN not ready, rebuild in progress"; break; + case 0x0406: what="LUN not ready, recalculation in progress"; break; + case 0x0407: what="LUN not ready, operation in progress"; break; + case 0x0408: what="LUN not ready, long write in progress"; break; + case 0x0500: what="LUN doesn't respond to selection"; break; + case 0x0A00: what="error log overflow"; break; + case 0x0C04: what="compression check miscompare error"; break; + case 0x0C05: what="data expansion occurred during compression"; break; + case 0x0C06: what="block not compressible"; break; + case 0x1102: what="error too long to correct"; break; + case 0x1106: what="CIRC unrecovered error"; break; + case 0x1107: what="data resynchronization error"; break; + case 0x110D: what="decompression CRC error"; break; + case 0x110E: what="can't decompress using declared algorithm"; break; + case 0x110F: what="error reading UPC/EAN number"; break; + case 0x1110: what="error reading ISRC number"; break; + case 0x1200: what="address mark not found for ID field"; break; + case 0x1300: what="address mark not found for data field"; break; + case 0x1403: what="end of data not found"; break; + case 0x1404: what="block sequence error"; break; + case 0x1600: what="data sync mark error"; break; + case 0x1601: what="data sync error: data rewritten"; break; + case 0x1602: what="data sync error: recommend rewrite"; break; + case 0x1603: what="data sync error: data auto-reallocated"; break; + case 0x1604: what="data sync error: recommend reassignment"; break; + case 0x1900: what="defect list error"; break; + case 0x1901: what="defect list not available"; break; + case 0x1902: what="defect list error in primary list"; break; + case 0x1903: what="defect list error in grown list"; break; + case 0x1C00: what="defect list not found"; break; + case 0x2400: what="invalid field in CDB"; break; + case 0x2703: what="associated write protect"; break; + case 0x2903: what="bus device reset function occurred"; break; + case 0x2904: what="device internal reset"; break; + case 0x2B00: what="copy can't execute since host can't disconnect"; + break; + case 0x2C00: what="command sequence error"; break; + case 0x2C03: what="current program area is not empty"; break; + case 0x2C04: what="current program area is empty"; break; + case 0x2F00: what="commands cleared by another initiator"; break; + case 0x3001: what="can't read medium: unknown format"; break; + case 0x3002: what="can't read medium: incompatible format"; break; + case 0x3003: what="cleaning cartridge installed"; break; + case 0x3004: what="can't write medium: unknown format"; break; + case 0x3005: what="can't write medium: incompatible format"; break; + case 0x3006: what="can't format medium: incompatible medium"; break; + case 0x3007: what="cleaning failure"; break; + case 0x3008: what="can't write: application code mismatch"; break; + case 0x3009: what="current session not fixated for append"; break; + case 0x3201: what="defect list update failure"; break; + case 0x3400: what="enclosure failure"; break; + case 0x3500: what="enclosure services failure"; break; + case 0x3502: what="enclosure services unavailable"; break; + case 0x3503: what="enclosure services transfer failure"; break; + case 0x3504: what="enclosure services transfer refused"; break; + case 0x3B0F: what="end of medium reached"; break; + case 0x3F02: what="changed operating definition"; break; + case 0x4100: what="data path failure (should use 40 NN)"; break; + case 0x4A00: what="command phase error"; break; + case 0x4B00: what="data phase error"; break; + case 0x5100: what="erase failure"; break; + case 0x5200: what="cartridge fault"; break; + case 0x6300: what="end of user area encountered on this track"; break; + case 0x6600: what="automatic document feeder cover up"; break; + case 0x6601: what="automatic document feeder lift up"; break; + case 0x6602: what="document jam in auto doc feeder"; break; + case 0x6603: what="document miss feed auto in doc feeder"; break; + case 0x6700: what="configuration failure"; break; + case 0x6701: what="configuration of incapable LUN's failed"; break; + case 0x6702: what="add logical unit failed"; break; + case 0x6706: what="attachment of logical unit failed"; break; + case 0x6707: what="creation of logical unit failed"; break; + case 0x6900: what="data loss on logical unit"; break; + case 0x6E00: what="command to logical unit failed"; break; + case 0x7100: what="decompression exception long algorithm ID"; break; + case 0x7204: what="empty or partially written reserved track"; break; + case 0x7300: what="CD control error"; break; + + default: + if (asc==0x40) { + US_DEBUGP("%s: diagnostic failure on component" + " %02X\n", keystr, ascq); + return; + } + if (asc==0x70) { + US_DEBUGP("%s: decompression exception short" + " algorithm ID of %02X\n", keystr, ascq); + return; + } + what = "(unknown ASC/ASCQ)"; + } + + US_DEBUGP("%s: %s\n", keystr, what); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/debug.h linux/drivers/usb/storage/debug.h --- v2.4.0-test8/linux/drivers/usb/storage/debug.h Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/debug.h Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Debugging Functions Header File * - * $Id: debug.h,v 1.4 2000/08/25 00:13:51 mdharm Exp $ + * $Id: debug.h,v 1.5 2000/09/04 02:12:47 groovyjava Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -55,6 +55,8 @@ #ifdef CONFIG_USB_STORAGE_DEBUG void usb_stor_show_command(Scsi_Cmnd *srb); void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd ); +void usb_stor_show_sense( unsigned char key, + unsigned char asc, unsigned char ascq ); #define US_DEBUGP(x...) printk( KERN_DEBUG USB_STORAGE ## x ) #define US_DEBUGPX(x...) printk( ## x ) #define US_DEBUG(x) x diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/freecom.c linux/drivers/usb/storage/freecom.c --- v2.4.0-test8/linux/drivers/usb/storage/freecom.c Tue Sep 5 12:56:51 2000 +++ linux/drivers/usb/storage/freecom.c Fri Sep 15 21:37:23 2000 @@ -1,6 +1,6 @@ /* Driver for Freecom USB/IDE adaptor * - * $Id: freecom.c,v 1.7 2000/08/25 00:13:51 mdharm Exp $ + * $Id: freecom.c,v 1.8 2000/08/29 14:49:15 dlbrown Exp $ * * Freecom v0.1: * @@ -33,6 +33,7 @@ #include "usb.h" #include "debug.h" #include "freecom.h" +#include "linux/hdreg.h" static void pdump (void *, int); @@ -56,6 +57,18 @@ __u8 Pad[58]; }; +struct freecom_ide_out { + __u8 Type; /* Type + IDE register. */ + __u8 Pad; + __u16 Value; /* Value to write. */ + __u8 Pad2[60]; +}; + +struct freecom_ide_in { + __u8 Type; /* Type | IDE register. */ + __u8 Pad[63]; +}; + struct freecom_status { __u8 Status; __u8 Reason; @@ -63,17 +76,123 @@ __u8 Pad[60]; }; +/* Freecom stuffs the interrupt status in the INDEX_STAT bit of the ide + * register. */ +#define FCM_INT_STATUS INDEX_STAT + /* These are the packet types. The low bit indicates that this command * should wait for an interrupt. */ #define FCM_PACKET_ATAPI 0x21 /* Receive data from the IDE interface. The ATAPI packet has already * waited, so the data should be immediately available. */ -#define FCM_PACKET_INPUT 0x90 +#define FCM_PACKET_INPUT 0x81 + +/* Write a value to an ide register. Or the ide register to write after + * munging the addres a bit. */ +#define FCM_PACKET_IDE_WRITE 0x40 +#define FCM_PACKET_IDE_READ 0xC0 /* All packets (except for status) are 64 bytes long. */ #define FCM_PACKET_LENGTH 64 +/* Write a value to an ide register. */ +static int +freecom_ide_write (struct us_data *us, int reg, int value) +{ + freecom_udata_t extra = (freecom_udata_t) us->extra; + struct freecom_ide_out *ideout = + (struct freecom_ide_out *) extra->buffer; + int opipe; + int result, partial; + + printk (KERN_DEBUG "IDE out 0x%02x <- 0x%02x\n", reg, value); + + /* Get handles for both transports. */ + opipe = usb_sndbulkpipe (us->pusb_dev, us->ep_out); + + if (reg < 0 || reg > 8) + return USB_STOR_TRANSPORT_ERROR; + if (reg < 8) + reg |= 0x20; + else + reg = 0x0e; + + ideout->Type = FCM_PACKET_IDE_WRITE | reg; + ideout->Pad = 0; + ideout->Value = cpu_to_le16 (value); + memset (ideout->Pad2, 0, sizeof (ideout->Pad2)); + + result = usb_stor_bulk_msg (us, ideout, opipe, + FCM_PACKET_LENGTH, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + return USB_STOR_TRANSPORT_GOOD; +} + +/* Read a value from an ide register. */ +static int +freecom_ide_read (struct us_data *us, int reg, int *value) +{ + freecom_udata_t extra = (freecom_udata_t) us->extra; + struct freecom_ide_in *idein = + (struct freecom_ide_in *) extra->buffer; + __u8 *buffer = extra->buffer; + int ipipe, opipe; + int result, partial; + int desired_length; + + /* Get handles for both transports. */ + opipe = usb_sndbulkpipe (us->pusb_dev, us->ep_out); + ipipe = usb_rcvbulkpipe (us->pusb_dev, us->ep_in); + + if (reg < 0 || reg > 8) + return USB_STOR_TRANSPORT_ERROR; + if (reg < 8) + reg |= 0x10; + else + reg = 0x0e; + + idein->Type = FCM_PACKET_IDE_READ | reg; + memset (idein->Pad, 0, sizeof (idein->Pad)); + + result = usb_stor_bulk_msg (us, idein, opipe, + FCM_PACKET_LENGTH, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + desired_length = 1; + if (reg == 0x10) + desired_length = 2; + + result = usb_stor_bulk_msg (us, buffer, ipipe, + desired_length, &partial); + if (result != 0) { + if (result == -ENOENT) + return US_BULK_TRANSFER_ABORTED; + else + return USB_STOR_TRANSPORT_ERROR; + } + + if (desired_length == 1) + *value = buffer[0]; + else + *value = le16_to_cpu (*(__u16 *) buffer); + + printk (KERN_DEBUG "IDE in 0x%02x -> 0x%02x\n", reg, *value); + + return USB_STOR_TRANSPORT_GOOD; +} + static int freecom_readdata (Scsi_Cmnd *srb, struct us_data *us, int ipipe, int opipe, int count) @@ -83,6 +202,7 @@ (struct freecom_xfer_wrap *) extra->buffer; int result, partial; int offset; + int this_read; __u8 *buffer = extra->buffer; fxfr->Type = FCM_PACKET_INPUT | 0x00; @@ -118,6 +238,14 @@ offset = 0; while (offset < count) { +#if 0 + this_read = count - offset; + if (this_read > 64) + this_read = 64; +#else + this_read = 64; +#endif + printk (KERN_DEBUG "Start of read\n"); /* Use the given buffer directly, but only if there * is space for an entire packet. */ @@ -125,7 +253,7 @@ if (offset + 64 <= srb->request_bufflen) { result = usb_stor_bulk_msg ( us, srb->request_buffer+offset, - ipipe, 64, &partial); + ipipe, this_read, &partial); printk (KERN_DEBUG "Read111 = %d, %d\n", result, partial); pdump (srb->request_buffer+offset, @@ -133,7 +261,7 @@ } else { result = usb_stor_bulk_msg ( us, buffer, - ipipe, 64, &partial); + ipipe, this_read, &partial); printk (KERN_DEBUG "Read112 = %d, %d\n", result, partial); memcpy (srb->request_buffer+offset, @@ -156,7 +284,7 @@ return USB_STOR_TRANSPORT_ERROR; } - offset += 64; + offset += this_read; } } @@ -178,17 +306,6 @@ int length; freecom_udata_t extra; - /* Allocate a buffer for us. The upper usb transport code will - * free this for us when cleaning up. */ - if (us->extra == NULL) { - us->extra = kmalloc (sizeof (struct freecom_udata), - GFP_KERNEL); - if (us->extra == NULL) { - printk (KERN_WARNING USB_STORAGE "Out of memory\n"); - return USB_STOR_TRANSPORT_ERROR; - } - } - extra = (freecom_udata_t) us->extra; fcb = (struct freecom_cb_wrap *) extra->buffer; @@ -250,7 +367,7 @@ if (partial != 4 || result != 0) { return USB_STOR_TRANSPORT_ERROR; } - if ((fst->Reason & 1) != 0) { + if ((fst->Status & 1) != 0) { printk (KERN_DEBUG "operation failed\n"); return USB_STOR_TRANSPORT_FAILED; } @@ -274,9 +391,34 @@ switch (us->srb->sc_data_direction) { case SCSI_DATA_READ: + /* Make sure that the status indicates that the device + * wants data as well. */ + if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) { + printk (KERN_DEBUG "SCSI wants data, drive doesn't have any\n"); + return USB_STOR_TRANSPORT_FAILED; + } result = freecom_readdata (srb, us, ipipe, opipe, length); if (result != USB_STOR_TRANSPORT_GOOD) return result; + + printk (KERN_DEBUG "FCM: Waiting for status\n"); + result = usb_stor_bulk_msg (us, fst, ipipe, + FCM_PACKET_LENGTH, &partial); + if (result == -ENOENT) { + US_DEBUGP ("freecom_transport: transfer aborted\n"); + return US_BULK_TRANSFER_ABORTED; + } + if (partial != 4 || result != 0) + return USB_STOR_TRANSPORT_ERROR; + if ((fst->Status & ERR_STAT) != 0) { + printk (KERN_DEBUG "operation failed\n"); + return USB_STOR_TRANSPORT_FAILED; + } + if ((fst->Reason & 3) != 3) { + printk (KERN_DEBUG "Drive seems still hungry\n"); + return USB_STOR_TRANSPORT_FAILED; + } + printk (KERN_DEBUG "Transfer happy\n"); break; default: @@ -310,6 +452,63 @@ srb->sc_data_direction); return USB_STOR_TRANSPORT_ERROR; +} + +int +freecom_init (struct us_data *us) +{ + int result, value; + int counter; + + /* Allocate a buffer for us. The upper usb transport code will + * free this for us when cleaning up. */ + if (us->extra == NULL) { + us->extra = kmalloc (sizeof (struct freecom_udata), + GFP_KERNEL); + if (us->extra == NULL) { + printk (KERN_WARNING USB_STORAGE "Out of memory\n"); + return USB_STOR_TRANSPORT_ERROR; + } + } + + result = freecom_ide_write (us, 0x06, 0xA0); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + result = freecom_ide_write (us, 0x01, 0x00); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + counter = 50; + do { + result = freecom_ide_read (us, 0x07, &value); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + if (counter-- < 0) { + printk (KERN_WARNING USB_STORAGE "Timeout in freecom"); + return USB_STOR_TRANSPORT_ERROR; + } + } while ((value & 0x80) != 0); + + result = freecom_ide_write (us, 0x07, 0x08); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + counter = 50; + do { + result = freecom_ide_read (us, 0x07, &value); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + if (counter-- < 0) { + printk (KERN_WARNING USB_STORAGE "Timeout in freecom"); + return USB_STOR_TRANSPORT_ERROR; + } + } while ((value & 0x80) != 0); + + result = freecom_ide_write (us, 0x08, 0x08); + if (result != USB_STOR_TRANSPORT_GOOD) + return result; + + return USB_STOR_TRANSPORT_GOOD; } int usb_stor_freecom_reset(struct us_data *us) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/freecom.h linux/drivers/usb/storage/freecom.h --- v2.4.0-test8/linux/drivers/usb/storage/freecom.h Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/freecom.h Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for Freecom USB/IDE adaptor * - * $Id: freecom.h,v 1.3 2000/08/25 00:13:51 mdharm Exp $ + * $Id: freecom.h,v 1.4 2000/08/29 14:49:15 dlbrown Exp $ * * Freecom v0.1: * @@ -31,5 +31,6 @@ extern int freecom_transport(Scsi_Cmnd *srb, struct us_data *us); extern int usb_stor_freecom_reset(struct us_data *us); +extern int freecom_init (struct us_data *us); #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/initializers.c linux/drivers/usb/storage/initializers.c --- v2.4.0-test8/linux/drivers/usb/storage/initializers.c Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/storage/initializers.c Fri Sep 8 16:39:12 2000 @@ -0,0 +1,60 @@ +/* Special Initializers for certain USB Mass Storage devices + * + * $Id: initializers.c,v 1.2 2000/09/06 22:35:57 mdharm Exp $ + * + * Current development and maintenance by: + * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * + * This driver is based on the 'USB Mass Storage Class' document. This + * describes in detail the protocol used to communicate with such + * devices. Clearly, the designers had SCSI and ATAPI commands in + * mind when they created this document. The commands are all very + * similar to commands in the SCSI-II and ATAPI specifications. + * + * It is important to note that in a number of cases this class + * exhibits class-specific exemptions from the USB specification. + * Notably the usage of NAK, STALL and ACK differs from the norm, in + * that they are used to communicate wait, failed and OK on commands. + * + * Also, for certain devices, the interrupt endpoint is used to convey + * status of a command. + * + * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more + * information about this driver. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "initializers.h" +#include "debug.h" + +/* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target + * mode */ +int usb_stor_euscsi_init(struct us_data *us) +{ + unsigned char data = 0x1; + int result; + + US_DEBUGP("Attempting to init eUSCSI bridge...\n"); + result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0), + 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, + 0x01, 0x0, &data, 0x1, 5*HZ); + US_DEBUGP("-- result is %d\n", result); + US_DEBUGP("-- data afterwards is %d\n", data); + + return 0; +} + + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/initializers.h linux/drivers/usb/storage/initializers.h --- v2.4.0-test8/linux/drivers/usb/storage/initializers.h Wed Dec 31 16:00:00 1969 +++ linux/drivers/usb/storage/initializers.h Fri Sep 8 16:39:12 2000 @@ -0,0 +1,44 @@ +/* Header file for Special Initializers for certain USB Mass Storage devices + * + * $Id: initializers.h,v 1.1 2000/08/29 23:07:02 mdharm Exp $ + * + * Current development and maintenance by: + * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) + * + * This driver is based on the 'USB Mass Storage Class' document. This + * describes in detail the protocol used to communicate with such + * devices. Clearly, the designers had SCSI and ATAPI commands in + * mind when they created this document. The commands are all very + * similar to commands in the SCSI-II and ATAPI specifications. + * + * It is important to note that in a number of cases this class + * exhibits class-specific exemptions from the USB specification. + * Notably the usage of NAK, STALL and ACK differs from the norm, in + * that they are used to communicate wait, failed and OK on commands. + * + * Also, for certain devices, the interrupt endpoint is used to convey + * status of a command. + * + * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more + * information about this driver. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "usb.h" + +/* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target + * mode */ +int usb_stor_euscsi_init(struct us_data *us); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/protocol.c linux/drivers/usb/storage/protocol.c --- v2.4.0-test8/linux/drivers/usb/storage/protocol.c Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/protocol.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: protocol.c,v 1.5 2000/08/25 00:13:51 mdharm Exp $ + * $Id: protocol.c,v 1.6 2000/09/01 22:03:55 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -170,7 +170,7 @@ usb_stor_invoke_transport(srb, us); /* Fix the MODE_SENSE data if we translated the command */ - if ((old_cmnd == MODE_SENSE) && (srb->result == GOOD)) + if ((old_cmnd == MODE_SENSE) && (status_byte(srb->result) == GOOD)) usb_stor_scsiSense10to6(srb); /* fix the INQUIRY data if necessary */ @@ -265,7 +265,7 @@ usb_stor_invoke_transport(srb, us); /* Fix the MODE_SENSE data if we translated the command */ - if ((old_cmnd == MODE_SENSE) && (srb->result == GOOD)) + if ((old_cmnd == MODE_SENSE) && (status_byte(srb->result) == GOOD)) usb_stor_scsiSense10to6(srb); /* Fix the data for an INQUIRY, if necessary */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/scsiglue.c linux/drivers/usb/storage/scsiglue.c --- v2.4.0-test8/linux/drivers/usb/storage/scsiglue.c Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/scsiglue.c Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * SCSI layer glue code * - * $Id: scsiglue.c,v 1.9 2000/08/25 00:13:51 mdharm Exp $ + * $Id: scsiglue.c,v 1.10 2000/08/30 01:22:42 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -189,12 +189,6 @@ return SUCCESS; } - /* This is a sanity check that we should never hit */ - if (in_interrupt()) { - printk(KERN_ERR "usb-storage: command_abort() called from an interrupt!!! BAD!!! BAD!! BAD!!\n"); - return FAILED; - } - /* if we have an urb pending, let's wake the control thread up */ if (us->current_urb->status == -EINPROGRESS) { /* cancel the URB */ @@ -213,18 +207,63 @@ return FAILED; } -/* FIXME: this doesn't do anything right now */ +/* This invokes the transport reset mechanism to reset the state of the + * device */ +static int device_reset( Scsi_Cmnd *srb ) +{ + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + + US_DEBUGP("device_reset() called\n" ); + return us->transport_reset(us); +} + +/* This resets the device port, and simulates the device + * disconnect/reconnect for all drivers which have claimed other + * interfaces. */ static int bus_reset( Scsi_Cmnd *srb ) { - // struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + struct us_data *us = (struct us_data *)srb->host->hostdata[0]; + int result; + int i; - printk(KERN_CRIT "usb-storage: bus_reset() requested but not implemented\n" ); - US_DEBUGP("Bus reset requested\n"); - // us->transport_reset(us); - return FAILED; + /* we use the usb_reset_device() function to handle this for us */ + US_DEBUGP("bus_reset() called\n"); + result = usb_reset_device(us->pusb_dev) ? FAILED : SUCCESS; + + /* did the reset work? */ + if (result < 0) + return FAILED; + + /* FIXME: This needs to lock out driver probing while it's working + * or we can have race conditions */ + for (i = 0; i < us->pusb_dev->actconfig->bNumInterfaces; i++) { + struct usb_interface *intf = + &us->pusb_dev->actconfig->interface[i]; + + US_DEBUGP("Examinging driver %s...", intf->driver->name); + /* skip interfaces which we've claimed */ + if (intf->driver && !strncmp(intf->driver->name, + "usb-storage", 12)) { + US_DEBUGPX("skipping.\n"); + continue; + } + + /* simulate a disconnect and reconnect for all interfaces */ + if (intf->driver) { + US_DEBUGPX("simulating disconnect/reconnect.\n"); + down(&intf->driver->serialize); + intf->driver->disconnect(us->pusb_dev, + intf->private_data); + intf->driver->probe(us->pusb_dev, i); + up(&intf->driver->serialize); + } + } + + US_DEBUGP("bus_reset() complete\n"); + return SUCCESS; } -/* FIXME: This doesn't actually reset anything */ +/* FIXME: This doesn't do anything right now */ static int host_reset( Scsi_Cmnd *srb ) { printk(KERN_CRIT "usb-storage: host_reset() requested but not implemented\n" ); @@ -313,7 +352,7 @@ queuecommand: queuecommand, eh_abort_handler: command_abort, - eh_device_reset_handler:bus_reset, + eh_device_reset_handler:device_reset, eh_bus_reset_handler: bus_reset, eh_host_reset_handler: host_reset, diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/shuttle_usbat.c linux/drivers/usb/storage/shuttle_usbat.c --- v2.4.0-test8/linux/drivers/usb/storage/shuttle_usbat.c Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/shuttle_usbat.c Fri Sep 8 16:39:12 2000 @@ -1,6 +1,6 @@ /* Driver for SCM Microsystems USB-ATAPI cable * - * $Id: shuttle_usbat.c,v 1.4 2000/08/25 00:13:51 mdharm Exp $ + * $Id: shuttle_usbat.c,v 1.7 2000/09/04 02:08:42 groovyjava Exp $ * * SCM driver v0.2: * @@ -68,6 +68,8 @@ #define LSB_of(s) ((s)&0xFF) #define MSB_of(s) ((s)>>8) +int transferred = 0; + /* * Send a control message and wait for the response. * @@ -192,7 +194,7 @@ if (result == -EPIPE) { US_DEBUGP("usbat_raw_bulk():" " output pipe stalled\n"); - return USB_STOR_TRANSPORT_FAILED; + return US_BULK_TRANSFER_SHORT; } /* the catch-all case */ @@ -225,13 +227,13 @@ int result = USB_STOR_TRANSPORT_GOOD; int transferred = 0; - unsigned char execute[8] = { - 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char execute[8] = { + // 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; int i; struct scatterlist *sg; - char string[64]; - int pipe; + // char string[64]; + // int pipe; /* if (command_len != 0) { @@ -262,10 +264,10 @@ if (command_len != 0) direction = (command[0]&0x80) ? SCSI_DATA_READ : SCSI_DATA_WRITE; - +/* if (direction == SCSI_DATA_WRITE) { - /* Debug-print the first 48 bytes of the write transfer */ + // Debug-print the first 48 bytes of the write transfer if (!use_sg) { string[0] = 0; @@ -281,7 +283,7 @@ US_DEBUGP("%s\n", string); } } - +*/ US_DEBUGP("SCM data %s transfer %d sg buffers %d\n", ( direction==SCSI_DATA_READ ? "in" : "out"), @@ -311,9 +313,9 @@ unsigned char *content) { int result; - unsigned char command[8] = { - 0xC0, access, reg, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0xC0, access, reg, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; result = usbat_send_control(us, usb_rcvctrlpipe(us->pusb_dev,0), @@ -335,9 +337,9 @@ unsigned char content) { int result; - unsigned char command[8] = { - 0x40, access|0x01, reg, content, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0x40, access|0x01, reg, content, 0x00, 0x00, 0x00, 0x00 + // }; result = usbat_send_control(us, usb_sndctrlpipe(us->pusb_dev,0), @@ -427,11 +429,14 @@ unsigned char status; /* Synchronizing cache on a CDR could take a heck of a long time, - but probably not more than 15 minutes or so */ + but probably not more than 10 minutes or so */ + + for (i=0; i<1800; i++) { - for (i=0; i<500; i++) { result = usbat_read(us, USBAT_ATA, 0x17, &status); - US_DEBUGP("SCM: Write ATA data status is %02X\n", status); + + // US_DEBUGP("SCM: Write ATA data status is %02X\n", status); + if (result!=USB_STOR_TRANSPORT_GOOD) return result; if (status&0x01) // check condition @@ -440,19 +445,21 @@ return USB_STOR_TRANSPORT_FAILED; if ((status&0x80)!=0x80) // not busy break; - if (i<5) - wait_ms(100); - else if (i<20) - wait_ms(500); - else if (i<49) - wait_ms(1000); - else if (i<499) - wait_ms(2000); + + if (i<500) + wait_ms(10); // 5 seconds + else if (i<700) + wait_ms(50); // 10 seconds + else if (i<1200) + wait_ms(100); // 50 seconds + else if (i<1800) + wait_ms(1000); // 10 minutes } - if (i==500) + if (i==1800) return USB_STOR_TRANSPORT_FAILED; + US_DEBUGP("Waited not busy for %d steps\n", i); return USB_STOR_TRANSPORT_GOOD; } @@ -493,15 +500,16 @@ return usbat_wait_not_busy(us); } -int usbat_write_block_test(struct us_data *us, +int usbat_rw_block_test(struct us_data *us, unsigned char access, unsigned char *registers, unsigned char *data_out, unsigned short num_registers, unsigned char data_reg, unsigned char status_reg, - unsigned char qualifier, unsigned char timeout, + unsigned char qualifier, + int direction, unsigned char *content, unsigned short len, int use_sg) { @@ -509,91 +517,129 @@ int result; // Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here, - // but that's what came out of the trace. + // but that's what came out of the trace every single time. unsigned char command[16] = { 0x40, access|0x07, 0x07, 0x17, 0xfc, 0xe7, LSB_of(num_registers*2), MSB_of(num_registers*2), - 0x40, access|0x05, data_reg, status_reg, - qualifier, timeout, LSB_of(len), MSB_of(len) + (direction==SCSI_DATA_WRITE ? 0x40 : 0xC0), + access|(direction==SCSI_DATA_WRITE ? 0x05 : 0x04), + data_reg, status_reg, + timeout, qualifier, LSB_of(len), MSB_of(len) }; + int i; unsigned char data[num_registers*2]; - int transferred; - struct scatterlist *sg; - char string[64]; + unsigned char status; for (i=0; ipusb_dev,0), - 0x80, - 0x40, - 0, - 0, - command, - 16); - - if (result != USB_STOR_TRANSPORT_GOOD) - return result; + for (i=0; i<20; i++) { - result = usbat_bulk_transport(us, - NULL, 0, SCSI_DATA_WRITE, data, num_registers*2, 0); - - // result = usbat_bulk_transport(us, - // command, 16, 0, data, num_registers*2, 0); + /* + * The first time we send the full command, which consists + * of downloading the SCSI command followed by downloading + * the data via a write-and-test. Any other time we only + * send the command to download the data -- the SCSI command + * is still 'active' in some sense in the device. + * + * We're only going to try sending the data 10 times. After + * that, we just return a failure. + */ + + result = usbat_send_control(us, + usb_sndctrlpipe(us->pusb_dev,0), + 0x80, + 0x40, + 0, + 0, + (i==0 ? command : command+8), + (i==0 ? 16 : 8)); - if (result!=USB_STOR_TRANSPORT_GOOD) - return result; + if (result != USB_STOR_TRANSPORT_GOOD) + return result; - // transferred = 0; + if (i==0) { - US_DEBUGP("Transfer out %d bytes, sg buffers %d\n", - len, use_sg); + result = usbat_bulk_transport(us, + NULL, 0, SCSI_DATA_WRITE, + data, num_registers*2, 0); - result = usbat_bulk_transport(us, - NULL, 0, SCSI_DATA_WRITE, content, len, use_sg); + if (result!=USB_STOR_TRANSPORT_GOOD) + return result; -/* - if (!use_sg) { + } - // Debug-print the first 48 bytes of the transfer - string[0] = 0; - for (i=0; ipusb_dev, + usb_sndbulkpipe(us->pusb_dev, + us->ep_out)); + /* + * Read status: is the device angry, or just busy? + */ + + result = usbat_read(us, USBAT_ATA, + direction==SCSI_DATA_WRITE ? 0x17 : 0x0E, + &status); + + if (result!=USB_STOR_TRANSPORT_GOOD) + return result; + if (status&0x01) // check condition + return USB_STOR_TRANSPORT_FAILED; + if (status&0x20) // device fault + return USB_STOR_TRANSPORT_FAILED; - result = usbat_raw_bulk(us, SCSI_DATA_WRITE, content, len); + US_DEBUGP("Redoing %s\n", + direction==SCSI_DATA_WRITE ? "write" : "read"); - } else { + } else if (result != US_BULK_TRANSFER_GOOD) + return result; + else + return usbat_wait_not_busy(us); - sg = (struct scatterlist *)content; - for (i=0; i sg[i].length ? - sg[i].length : len-transferred); - if (result!=US_BULK_TRANSFER_GOOD) - break; - transferred += sg[i].length; - } } -*/ - if (result!=USB_STOR_TRANSPORT_GOOD) - return result; - return usbat_wait_not_busy(us); + US_DEBUGP("Bummer! %s bulk data 10 times failed.\n", + direction==SCSI_DATA_WRITE ? "Writing" : "Reading"); + + return USB_STOR_TRANSPORT_FAILED; } int usbat_multiple_write(struct us_data *us, @@ -642,9 +688,9 @@ int usbat_read_user_io(struct us_data *us, unsigned char *data_flags) { - unsigned char command[8] = { - 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + // }; int result; result = usbat_send_control(us, @@ -665,9 +711,9 @@ unsigned char enable_flags, unsigned char data_flags) { - unsigned char command[8] = { - 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00 - }; + // unsigned char command[8] = { + // 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00 + // }; int result; result = usbat_send_control(us, @@ -882,18 +928,18 @@ h = return length/2048 in cmnd[7-8]. */ - static char *lengths = + // static char *lengths = /* 0123456789ABCDEF 0123456789ABCDEF */ - "0XXL0XXXXXXXXXXX" "XXLXXXXXXXX0XX0X" /* 00-1F */ - "XXXXX8XXhXH0XXX0" "XXXXX0XXXXXXXXXX" /* 20-3F */ - "XXHHL0X0XXH0XX0X" "XHH00HXX0TH0H0XX" /* 40-5F */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */ - "X0XXX0XXDXDXXXXX" "XXXXXXXXX000XHBX" /* A0-BF */ - "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */ - "XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */ + // "0XXL0XXXXXXXXXXX" "XXLXXXXXXXX0XX0X" /* 00-1F */ + // "XXXXX8XXhXH0XXX0" "XXXXX0XXXXXXXXXX" /* 20-3F */ + // "XXHHL0X0XXH0XX0X" "XHH00HXX0TH0H0XX" /* 40-5F */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */ + // "X0XXX0XXDXDXXXXX" "XXXXXXXXX000XHBX" /* A0-BF */ + // "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */ + // "XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */ /* if (us->flags & US_FL_NEED_INIT) { US_DEBUGP("8200e: initializing\n"); @@ -986,16 +1032,36 @@ data[5] = 0xB0; // (device sel) = slave data[6] = 0xA0; // (command) = ATA PACKET COMMAND + for (i=7; i<19; i++) { + registers[i] = 0x10; + data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; + } + + if (srb->cmnd[0] == TEST_UNIT_READY) + transferred = 0; + if (srb->sc_data_direction == SCSI_DATA_WRITE) { - for (i=7; i<19; i++) { - registers[i] = 0x10; - data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7]; + result = usbat_rw_block_test(us, USBAT_ATA, + registers, data, 19, + 0x10, 0x17, 0xFD, 0x30, + SCSI_DATA_WRITE, + srb->request_buffer, + len, srb->use_sg); + + if (result == USB_STOR_TRANSPORT_GOOD) { + transferred += len; + US_DEBUGP("Wrote %08X bytes\n", transferred); } - result = usbat_write_block_test(us, USBAT_ATA, + return result; + + } else if (srb->cmnd[0] == READ_10) { + + result = usbat_rw_block_test(us, USBAT_ATA, registers, data, 19, 0x10, 0x17, 0xFD, 0x30, + SCSI_DATA_READ, srb->request_buffer, len, srb->use_sg); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/transport.c linux/drivers/usb/storage/transport.c --- v2.4.0-test8/linux/drivers/usb/storage/transport.c Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/transport.c Fri Sep 15 21:37:23 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: transport.c,v 1.18 2000/08/25 00:13:51 mdharm Exp $ + * $Id: transport.c,v 1.23 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -48,6 +48,7 @@ #include "usb.h" #include "debug.h" +#include #include #include #include @@ -680,7 +681,7 @@ need_auto_sense = 1; } if (result == USB_STOR_TRANSPORT_ERROR) { - /* FIXME: we need to invoke a transport reset here */ + us->transport_reset(us); US_DEBUGP("-- transport indicates transport failure\n"); need_auto_sense = 0; srb->result = DID_ERROR << 16; @@ -742,7 +743,7 @@ /* issue the auto-sense command */ temp_result = us->transport(us->srb, us); if (temp_result != USB_STOR_TRANSPORT_GOOD) { - /* FIXME: we need to invoke a transport reset here */ + us->transport_reset(us); US_DEBUGP("-- auto-sense failure\n"); srb->result = DID_ERROR << 16; return; @@ -754,9 +755,15 @@ srb->sense_buffer[2] & 0xf, srb->sense_buffer[12], srb->sense_buffer[13]); +#ifdef CONFIG_USB_STORAGE_DEBUG + usb_stor_show_sense( + srb->sense_buffer[2] & 0xf, + srb->sense_buffer[12], + srb->sense_buffer[13]); +#endif /* set the result so the higher layers expect this data */ - srb->result = CHECK_CONDITION; + srb->result = CHECK_CONDITION << 1; /* we're done here, let's clean up */ srb->request_buffer = old_request_buffer; @@ -767,15 +774,15 @@ /* If things are really okay, then let's show that */ if ((srb->sense_buffer[2] & 0xf) == 0x0) - srb->result = GOOD; + srb->result = GOOD << 1; } else /* if (need_auto_sense) */ - srb->result = GOOD; + srb->result = GOOD << 1; /* Regardless of auto-sense, if we _know_ we have an error * condition, show that in the result code */ if (result == USB_STOR_TRANSPORT_FAILED) - srb->result = CHECK_CONDITION; + srb->result = CHECK_CONDITION << 1; /* If we think we're good, then make sure the sense data shows it. * This is necessary because the auto-sense for some devices always @@ -822,6 +829,9 @@ { int result; + /* Set up for status notification */ + us->ip_wanted = 1; + /* COMMAND STAGE */ /* let's send the command via the control pipe */ result = usb_stor_control_msg(us, usb_sndctrlpipe(us->pusb_dev,0), @@ -832,6 +842,9 @@ /* check the return code for the command */ US_DEBUGP("Call to usb_stor_control_msg() returned %d\n", result); if (result < 0) { + /* Reset flag for status notification */ + us->ip_wanted = 0; + /* if the command was aborted, indicate that */ if (result == -ENOENT) return USB_STOR_TRANSPORT_ABORTED; @@ -850,9 +863,6 @@ return USB_STOR_TRANSPORT_ERROR; } - /* Set up for status notification */ - us->ip_wanted = 1; - /* DATA STAGE */ /* transfer the data payload for this command, if one exists*/ if (us_transfer_length(srb)) { @@ -1167,6 +1177,9 @@ USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, us->ifnum, cmd, sizeof(cmd), HZ*5); + if (result < 0) + US_DEBUGP("CB[I] soft reset failed %d\n", result); + /* long wait for reset */ schedule_timeout(HZ*6); @@ -1177,7 +1190,8 @@ usb_rcvbulkpipe(us->pusb_dev, us->ep_out)); US_DEBUGP("CB_reset done\n"); - return 0; + /* return a result code based on the result of the control message */ + return result < 0 ? FAILED : SUCCESS; } /* This issues a Bulk-only Reset to the device in question, including @@ -1196,15 +1210,16 @@ 0, us->ifnum, NULL, 0, HZ*5); if (result < 0) - US_DEBUGP("Bulk hard reset failed %d\n", result); + US_DEBUGP("Bulk soft reset failed %d\n", result); + + /* long wait for reset */ + schedule_timeout(HZ*6); clear_halt(us->pusb_dev, usb_rcvbulkpipe(us->pusb_dev, us->ep_in)); clear_halt(us->pusb_dev, usb_sndbulkpipe(us->pusb_dev, us->ep_out)); - /* long wait for reset */ - schedule_timeout(HZ*6); - - return result; + /* return a result code based on the result of the control message */ + return result < 0 ? FAILED : SUCCESS; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/transport.h linux/drivers/usb/storage/transport.h --- v2.4.0-test8/linux/drivers/usb/storage/transport.h Mon Aug 28 16:59:14 2000 +++ linux/drivers/usb/storage/transport.h Fri Sep 8 16:39:12 2000 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Transport Functions Header File * - * $Id: transport.h,v 1.11 2000/08/25 00:13:51 mdharm Exp $ + * $Id: transport.h,v 1.12 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -41,8 +41,8 @@ #ifndef _TRANSPORT_H_ #define _TRANSPORT_H_ -#include #include +#include #include "usb.h" #include "scsi.h" diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/storage/usb.c linux/drivers/usb/storage/usb.c --- v2.4.0-test8/linux/drivers/usb/storage/usb.c Tue Sep 5 12:56:51 2000 +++ linux/drivers/usb/storage/usb.c Fri Sep 15 21:37:23 2000 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: usb.c,v 1.33 2000/08/25 00:13:51 mdharm Exp $ + * $Id: usb.c,v 1.39 2000/09/08 21:20:06 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -49,6 +49,7 @@ #include "transport.h" #include "protocol.h" #include "debug.h" +#include "initializers.h" #ifdef CONFIG_USB_STORAGE_HP8200e #include "shuttle_usbat.h" #endif @@ -206,7 +207,7 @@ */ if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) { US_DEBUGP("UNKNOWN data direction\n"); - us->srb->result = DID_ERROR; + us->srb->result = DID_ERROR << 16; set_current_state(TASK_INTERRUPTIBLE); us->srb->scsi_done(us->srb); us->srb = NULL; @@ -242,7 +243,7 @@ /* handle those devices which can't do a START_STOP */ if ((us->srb->cmnd[0] == START_STOP) && (us->flags & US_FL_START_STOP)) { - us->srb->result = GOOD; + us->srb->result = GOOD << 1; set_current_state(TASK_INTERRUPTIBLE); us->srb->scsi_done(us->srb); @@ -264,12 +265,12 @@ memcpy(us->srb->request_buffer, usb_stor_sense_notready, sizeof(usb_stor_sense_notready)); - us->srb->result = GOOD; + us->srb->result = GOOD << 1; } else { memcpy(us->srb->sense_buffer, usb_stor_sense_notready, sizeof(usb_stor_sense_notready)); - us->srb->result = CHECK_CONDITION; + us->srb->result = CHECK_CONDITION << 1; } } else { /* !us->pusb_dev */ /* we've got a command, let's do it! */ @@ -328,20 +329,6 @@ * restriction. However, if the flag is not present, then you * are free to use as many characters as you like. */ - -int euscsi_init(struct us_data *us) -{ - unsigned char bar = 0x1; - int result; - - US_DEBUGP("Attempting to init eUSCSI bridge...\n"); - result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0), - 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, - 0x01, 0x0, &bar, 0x1, 5*HZ); - US_DEBUGP("-- result is %d\n", result); - US_DEBUGP("-- bar afterwards is %d\n", bar); -} - static struct us_unusual_dev us_unusual_dev_list[] = { { 0x03f0, 0x0107, 0x0200, 0x0200, @@ -367,7 +354,7 @@ { 0x04e6, 0x0002, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_SDDR09 @@ -392,28 +379,34 @@ US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN}, + { 0x04e6, 0x0007, 0x0100, 0x0200, + "Sony", + "Hifd", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN}, + { 0x04e6, 0x0009, 0x0200, 0x0200, "Shuttle", - "ATA/ATAPI Bridge", + "eUSB ATA/ATAPI Adapter", US_SC_8020, US_PR_CB, NULL, US_FL_SINGLE_LUN}, - { 0x04e6, 0x000A, 0x0200, 0x0200, + { 0x04e6, 0x000a, 0x0200, 0x0200, "Shuttle", - "Compact Flash Reader", + "eUSB CompactFlash Adapter", US_SC_8020, US_PR_CB, NULL, US_FL_SINGLE_LUN}, { 0x04e6, 0x000B, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, { 0x04e6, 0x000C, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, { 0x04e6, 0x0101, 0x0200, 0x0200, @@ -424,7 +417,7 @@ { 0x054c, 0x0010, 0x0210, 0x0210, "Sony", - "DSC-S30/S70", + "DSC-S30/S70/505V", US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE }, @@ -454,10 +447,24 @@ { 0x05ab, 0x0031, 0x0100, 0x0100, "In-System", - "USB/IDE Bridge", + "USB/IDE Bridge (ATAPI ONLY!)", US_SC_8070, US_PR_BULK, NULL, 0 }, + { 0x0644, 0x0000, 0x0100, 0x0100, + "TEAC", + "Floppy Drive", + US_SC_UFI, US_PR_CB, NULL, + 0 }, + +#ifdef CONFIG_USB_STORAGE_SDDR09 + { 0x066b, 0x0105, 0x0100, 0x0100, + "Olympus", + "Camedia MAUSB-2", + US_SC_SCSI, US_PR_EUSB_SDDR09, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP }, +#endif + { 0x0693, 0x0005, 0x0100, 0x0100, "Hagiwara", "Flashgate", @@ -493,20 +500,20 @@ { 0x07af, 0x0004, 0x0100, 0x0100, "Microtech", "USB-SCSI-DB25", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_FREECOM { 0x07ab, 0xfc01, 0x0921, 0x0921, "Freecom", "USB-IDE", - US_SC_8070, US_PR_FREECOM, NULL, US_FL_SINGLE_LUN }, + US_SC_8070, US_PR_FREECOM, freecom_init, US_FL_SINGLE_LUN }, #endif { 0x07af, 0x0005, 0x0100, 0x0100, "Microtech", "USB-SCSI-HD50", - US_SC_SCSI, US_PR_BULK, euscsi_init, + US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG }, #ifdef CONFIG_USB_STORAGE_DPCM @@ -613,7 +620,9 @@ unsigned int flags; struct us_unusual_dev *unusual_dev; struct us_data *ss = NULL; +#ifdef CONFIG_USB_STORAGE_SDDR09 int result; +#endif /* these are temporary copies -- we test on these, then put them * in the us-data structure diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/uhci.c linux/drivers/usb/uhci.c --- v2.4.0-test8/linux/drivers/usb/uhci.c Thu Sep 7 08:39:00 2000 +++ linux/drivers/usb/uhci.c Mon Sep 18 15:23:30 2000 @@ -572,7 +572,7 @@ spin_lock_irqsave(&uhci->framelist_lock, flags); - if (!urbp->fsbr) { + if ((!(urb->transfer_flags & USB_NO_FSBR)) && (!urbp->fsbr)) { urbp->fsbr = 1; if (!uhci->fsbr++) uhci->skel_term_qh.link = virt_to_bus(&uhci->skel_hs_control_qh) | UHCI_PTR_QH; @@ -591,7 +591,7 @@ spin_lock_irqsave(&uhci->framelist_lock, flags); - if (urbp->fsbr) { + if ((!(urb->transfer_flags & USB_NO_FSBR)) && urbp->fsbr) { urbp->fsbr = 0; if (!--uhci->fsbr) uhci->skel_term_qh.link = UHCI_PTR_TERM; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-core.c linux/drivers/usb/usb-core.c --- v2.4.0-test8/linux/drivers/usb/usb-core.c Thu Sep 7 08:39:00 2000 +++ linux/drivers/usb/usb-core.c Mon Sep 18 15:23:30 2000 @@ -12,7 +12,6 @@ #include #include -#include #include #include @@ -25,13 +24,6 @@ int usb_major_init(void); void usb_major_cleanup(void); - -/* - * HCI drivers - */ - -int uhci_init(void); -int ohci_hcd_init(void); /* * Cleanup diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-ohci.c linux/drivers/usb/usb-ohci.c --- v2.4.0-test8/linux/drivers/usb/usb-ohci.c Thu Sep 7 08:39:00 2000 +++ linux/drivers/usb/usb-ohci.c Fri Sep 8 16:36:10 2000 @@ -2,6 +2,7 @@ * URB OHCI HCD (Host Controller Driver) for USB. * * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000 David Brownell * * [ Initialisation is based on Linus' ] * [ uhci code and gregs ohci fragments ] @@ -11,6 +12,10 @@ * * History: * + * 2000/08/29 use bandwidth claiming hooks (thanks Randy!), fix some + * urb unlink probs, indentation fixes + * 2000/08/11 various oops fixes mostly affecting iso and cleanup from + * device unplugs. * 2000/06/28 use PCI hotplug framework, for better power management * and for Cardbus support (David Brownell) * 2000/earlier: fixes for NEC/Lucent chips; suspend/resume handling @@ -83,15 +88,29 @@ * URB support functions *-------------------------------------------------------------------------*/ -/* free the private part of an URB */ +/* free HCD-private data associated with this URB */ static void urb_rm_priv (urb_t * urb) { urb_priv_t * urb_priv = urb->hcpriv; int i; - if (!urb_priv) return; - + /* Release int/iso bandwidth for Interrupt or Isoc. transfers */ + if (urb->bandwidth) { + switch (usb_pipetype(urb->pipe)) { + case PIPE_INTERRUPT: + usb_release_bandwidth (urb->dev, urb, 0); + break; + case PIPE_ISOCHRONOUS: + usb_release_bandwidth (urb->dev, urb, 1); + break; + default: + break; + } + } + + if (!urb_priv) + return; for (i = 0; i < urb_priv->length; i++) { if (urb_priv->td [i]) { OHCI_FREE (urb_priv->td [i]); @@ -416,6 +435,7 @@ unsigned int pipe = urb->pipe; int i, size = 0; unsigned long flags; + int bustime = 0; if (!urb->dev || !urb->dev->bus) return -EINVAL; @@ -457,6 +477,10 @@ break; case PIPE_ISOCHRONOUS: /* number of packets from URB */ size = urb->number_of_packets; + if (size <= 0) { + usb_dec_dev_use (urb->dev); + return -EINVAL; + } for (i = 0; i < urb->number_of_packets; i++) { urb->iso_frame_desc[i].actual_length = 0; urb->iso_frame_desc[i].status = -EXDEV; @@ -468,11 +492,10 @@ break; case PIPE_INTERRUPT: /* one TD */ size = 1; - break; } - /* allocate the private part or the URB */ + /* allocate the private part of the URB */ urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (td_t *), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); if (!urb_priv) { @@ -487,13 +510,13 @@ urb_priv->td_cnt = 0; urb_priv->state = 0; urb_priv->ed = ed; - + /* allocate the TDs */ for (i = 0; i < size; i++) { OHCI_ALLOC (urb_priv->td[i], sizeof (td_t)); if (!urb_priv->td[i]) { - usb_dec_dev_use (urb->dev); urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); return -ENOMEM; } } @@ -505,11 +528,30 @@ return -EINVAL; } - /* for ISOC transfers calculate start frame index */ - if (urb->transfer_flags & USB_ISO_ASAP) { - urb->start_frame = ((ed->state == ED_OPER)? (ed->last_iso + 1): - (le16_to_cpu (ohci->hcca.frame_no) + 10)) & 0xffff; - } + /* allocate and claim bandwidth if needed; ISO + * needs start frame index if it was't provided. + */ + switch (usb_pipetype (pipe)) { + case PIPE_ISOCHRONOUS: + if (urb->transfer_flags & USB_ISO_ASAP) { + urb->start_frame = ((ed->state == ED_OPER) + ? (ed->last_iso + 1) + : (le16_to_cpu (ohci->hcca.frame_no) + 10)) & 0xffff; + } + /* FALLTHROUGH */ + case PIPE_INTERRUPT: + if (urb->bandwidth == 0) { + bustime = usb_check_bandwidth (urb->dev, urb); + } + if (bustime < 0) { + urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); + spin_unlock_irqrestore (&usb_ed_lock, flags); + return bustime; + } + usb_claim_bandwidth (urb->dev, urb, bustime, usb_pipeisoc (urb->pipe)); + } + urb->status = USB_ST_URB_PENDING; urb->actual_length = 0; @@ -573,6 +615,10 @@ urb_priv->state = URB_DEL; spin_lock_irqsave (&usb_ed_lock, flags); + + if (urb_priv->ed->state == ED_OPER) + ep_unlink(ohci, urb_priv->ed); + ep_rm_ed (urb->dev, urb_priv->ed); urb_priv->ed->state |= ED_URB_DEL; spin_unlock_irqrestore (&usb_ed_lock, flags); @@ -595,8 +641,8 @@ urb->status = -EINPROGRESS; } } else { - usb_dec_dev_use (urb->dev); urb_rm_priv (urb); + usb_dec_dev_use (urb->dev); if (urb->complete && (urb->transfer_flags & USB_ASYNC_UNLINK)) { urb->complete (urb); urb->status = 0; @@ -873,8 +919,9 @@ int inter; int interval; __u32 * ed_p; - - + + ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); + switch (ed->type) { case CTRL: if (ed->ed_prev == NULL) { @@ -969,16 +1016,17 @@ td_t * td; ed_t * ed_ret; volatile ed_t * ed; + unsigned long flags; - spin_lock (&usb_ed_lock); + spin_lock_irqsave (&usb_ed_lock, flags); ed = ed_ret = &(usb_to_ohci (usb_dev)->ed[(usb_pipeendpoint (pipe) << 1) | (usb_pipecontrol (pipe)? 0: usb_pipeout (pipe))]); if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) { /* pending delete request */ - spin_unlock (&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return NULL; } @@ -987,7 +1035,7 @@ OHCI_ALLOC (td, sizeof (*td)); /* dummy td; end of td list for ed */ if (!td) { /* out of memory */ - spin_unlock (&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return NULL; } ed->hwTailP = cpu_to_le32 (virt_to_bus (td)); @@ -1011,7 +1059,7 @@ ed->int_load = load; } - spin_unlock(&usb_ed_lock); + spin_unlock_irqrestore (&usb_ed_lock, flags); return ed_ret; } @@ -1029,28 +1077,29 @@ if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) return; - ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); + ed->hwINFO |= cpu_to_le32 (OHCI_ED_SKIP); if (!ohci->disabled) { - /* enable SOF interrupt */ - writel (OHCI_INTR_SF, &ohci->regs->intrstatus); - writel (OHCI_INTR_SF, &ohci->regs->intrenable); + switch (ed->type) { + case CTRL: /* stop CTRL list */ + writel (ohci->hc_control &= ~OHCI_CTRL_CLE, + &ohci->regs->control); + break; + case BULK: /* stop BULK list */ + writel (ohci->hc_control &= ~OHCI_CTRL_BLE, + &ohci->regs->control); + break; + } } frame = le16_to_cpu (ohci->hcca.frame_no) & 0x1; ed->ed_rm_list = ohci->ed_rm_list[frame]; ohci->ed_rm_list[frame] = ed; - if (ohci->disabled) - return; - - switch (ed->type) { - case CTRL: /* stop CTRL list */ - writel (ohci->hc_control &= ~OHCI_CTRL_CLE, &ohci->regs->control); - break; - case BULK: /* stop BULK list */ - writel (ohci->hc_control &= ~OHCI_CTRL_BLE, &ohci->regs->control); - break; + if (!ohci->disabled) { + /* enable SOF interrupt */ + writel (OHCI_INTR_SF, &ohci->regs->intrstatus); + writel (OHCI_INTR_SF, &ohci->regs->intrenable); } } @@ -1072,25 +1121,30 @@ td_pt = urb_priv->td [index]; /* fill the old dummy TD */ - td = urb_priv->td [index] = (td_t *) bus_to_virt (le32_to_cpup (&urb_priv->ed->hwTailP) & 0xfffffff0); + td = urb_priv->td [index] = (td_t *) + bus_to_virt (le32_to_cpup (&urb_priv->ed->hwTailP) & 0xfffffff0); td->ed = urb_priv->ed; + td->next_dl_td = NULL; td->index = index; td->urb = urb; td->hwINFO = cpu_to_le32 (info); if ((td->ed->type & 3) == PIPE_ISOCHRONOUS) { - td->hwCBP = cpu_to_le32 (((!data || !len)? - 0 : virt_to_bus (data)) & 0xFFFFF000); + td->hwCBP = cpu_to_le32 (((!data || !len) + ? 0 + : virt_to_bus (data)) & 0xFFFFF000); td->ed->last_iso = info & 0xffff; } else { - td->hwCBP = cpu_to_le32 (((!data || !len)? 0 : virt_to_bus (data))); + td->hwCBP = cpu_to_le32 (((!data || !len) + ? 0 + : virt_to_bus (data))); } - td->hwBE = cpu_to_le32 ((!data || !len )? 0: virt_to_bus (data + len - 1)); + td->hwBE = cpu_to_le32 ((!data || !len ) + ? 0 + : virt_to_bus (data + len - 1)); td->hwNextTD = cpu_to_le32 (virt_to_bus (td_pt)); td->hwPSW [0] = cpu_to_le16 ((virt_to_bus (data) & 0x0FFF) | 0xE000); td_pt->hwNextTD = 0; td->ed->hwTailP = td->hwNextTD; - - td->next_dl_td = NULL; //td_pt; } /*-------------------------------------------------------------------------*/ @@ -1375,12 +1429,19 @@ /* error code of transfer */ cc = TD_CC_GET (tdINFO); - if( cc == TD_CC_STALL) usb_endpoint_halt(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)); + if (cc == TD_CC_STALL) + usb_endpoint_halt(urb->dev, + usb_pipeendpoint(urb->pipe), + usb_pipeout(urb->pipe)); - if (!(urb->transfer_flags & USB_DISABLE_SPD) && (cc == TD_DATAUNDERRUN)) - cc = TD_CC_NOERROR; + if (!(urb->transfer_flags & USB_DISABLE_SPD) + && (cc == TD_DATAUNDERRUN)) + cc = TD_CC_NOERROR; + if (++(urb_priv->td_cnt) == urb_priv->length) { - if (urb_priv->state != URB_DEL && !(ed->state & ED_DEL) && ed->state != ED_NEW) { + if (urb_priv->state != URB_DEL + && !(ed->state & ED_DEL) + && ed->state != ED_NEW) { urb->status = cc_to_error[cc]; sohci_return_urb (urb); } else { @@ -1393,13 +1454,13 @@ edHeadP = le32_to_cpup (&ed->hwHeadP) & 0xfffffff0; edTailP = le32_to_cpup (&ed->hwTailP); - if((edHeadP == edTailP) && (ed->state == ED_OPER)) - ep_unlink (ohci, ed); /* unlink eds if they are not busy */ - - } - spin_unlock_irqrestore (&usb_ed_lock, flags); + /* unlink eds if they are not busy */ + if ((edHeadP == edTailP) && (ed->state == ED_OPER)) + ep_unlink (ohci, ed); + } + spin_unlock_irqrestore (&usb_ed_lock, flags); - td_list = td_list_next; + td_list = td_list_next; } } @@ -2402,5 +2463,5 @@ -MODULE_AUTHOR ("Roman Weissgaerber "); +MODULE_AUTHOR ("Roman Weissgaerber , David Brownell"); MODULE_DESCRIPTION ("USB OHCI Host Controller Driver"); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-ohci.h linux/drivers/usb/usb-ohci.h --- v2.4.0-test8/linux/drivers/usb/usb-ohci.h Sun Aug 13 15:59:10 2000 +++ linux/drivers/usb/usb-ohci.h Fri Sep 8 16:36:10 2000 @@ -1,10 +1,10 @@ - /* +/* * URB OHCI HCD (Host Controller Driver) for USB. * - *(C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 1999 Roman Weissgaerber + * (C) Copyright 2000 David Brownell * * usb-ohci.h - * */ @@ -40,7 +40,7 @@ #define ED_UNLINK 0x01 #define ED_OPER 0x02 #define ED_DEL 0x04 -#define ED_URB_DEL 0x08 +#define ED_URB_DEL 0x08 /* usb_ohci_ed */ typedef struct ed { @@ -372,8 +372,8 @@ struct list_head ohci_hcd_list; /* list of all ohci_hcd */ struct ohci * next; // chain of uhci device contexts - struct list_head urb_list; // list of all pending urbs - spinlock_t urb_list_lock; // lock to keep consistency + // struct list_head urb_list; // list of all pending urbs + // spinlock_t urb_list_lock; // lock to keep consistency int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/ ed_t * ed_rm_list[2]; /* lists of all endpoints to be removed */ @@ -418,7 +418,7 @@ static int rh_unlink_urb(urb_t * urb); static int rh_init_int_timer(urb_t * urb); -#ifdef DEBUG +#ifdef OHCI_VERBOSE_DEBUG #define OHCI_FREE(x) kfree(x); printk("OHCI FREE: %d: %4x\n", -- __ohci_free_cnt, (unsigned int) x) #define OHCI_ALLOC(x,size) (x) = kmalloc(size, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); printk("OHCI ALLO: %d: %4x\n", ++ __ohci_free_cnt,(unsigned int) x) static int __ohci_free_cnt = 0; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/usb/usb-uhci.c linux/drivers/usb/usb-uhci.c --- v2.4.0-test8/linux/drivers/usb/usb-uhci.c Thu Sep 7 08:39:00 2000 +++ linux/drivers/usb/usb-uhci.c Mon Sep 18 15:23:30 2000 @@ -141,6 +141,9 @@ { int flags; + if (urb->transfer_flags & USB_NO_FSBR) + return; + spin_lock_irqsave (&s->qh_lock, flags); s->chain_end->hw.qh.head&=~UHCI_PTR_TERM; mb(); @@ -153,8 +156,10 @@ { int flags; - spin_lock_irqsave (&s->qh_lock, flags); + if (urb->transfer_flags & USB_NO_FSBR) + return; + spin_lock_irqsave (&s->qh_lock, flags); if (((urb_priv_t*)urb->hcpriv)->use_loop) { s->loop_usage--; @@ -2842,6 +2847,7 @@ if(!urb_priv_kmem) { err("kmem_cache_create for urb_priv_t failed (out of memory)"); + kmem_cache_destroy(uhci_desc_kmem); return -ENOMEM; } #endif @@ -2876,6 +2882,15 @@ i++; } +#ifdef DEBUG_SLAB + if (retval < 0 ) { + if (kmem_cache_destroy(urb_priv_kmem)) + err("urb_priv_kmem remained"); + if (kmem_cache_destroy(uhci_desc_kmem)) + err("uhci_desc_kmem remained"); + } +#endif + return retval; } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/Config.in linux/drivers/video/Config.in --- v2.4.0-test8/linux/drivers/video/Config.in Wed Aug 9 14:11:11 2000 +++ linux/drivers/video/Config.in Mon Sep 18 15:15:22 2000 @@ -30,7 +30,7 @@ if [ "$CONFIG_ARCH_ACORN" = "y" ]; then bool ' Acorn VIDC support' CONFIG_FB_ACORN fi - tristate ' Cyber2000 support' CONFIG_FB_CYBER2000 + dep_tristate ' Cyber2000 support' CONFIG_FB_CYBER2000 $CONFIG_PCI if [ "$CONFIG_ARCH_SA1100" = "y" ]; then bool ' SA-1100 LCD support' CONFIG_FB_SA1100 fi diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/Makefile linux/drivers/video/Makefile --- v2.4.0-test8/linux/drivers/video/Makefile Sun Aug 6 11:23:41 2000 +++ linux/drivers/video/Makefile Sun Sep 17 09:48:04 2000 @@ -46,7 +46,10 @@ # Add fbmon.o back into obj-$(CONFIG_FB) in 2.5.x obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o fbcon.o fonts.o +# Only include macmodes.o if we have FB support and are PPC +ifeq ($(CONFIG_FB),y) obj-$(CONFIG_PPC) += macmodes.o +endif obj-$(CONFIG_FB_ACORN) += acornfb.o obj-$(CONFIG_FB_AMIGA) += amifb.o diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/acornfb.c linux/drivers/video/acornfb.c --- v2.4.0-test8/linux/drivers/video/acornfb.c Sun Aug 13 10:04:17 2000 +++ linux/drivers/video/acornfb.c Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/drivers/video/acornfb.c + * linux/drivers/video/acornfb.c * - * Copyright (C) 1998-2000 Russell King + * Copyright (C) 1998-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Frame buffer code for Acorn platforms * @@ -97,6 +101,8 @@ #ifdef HAS_VIDC +#define MAX_SIZE 480*1024 + /* CTL VIDC Actual * 24.000 0 8.000 * 25.175 0 8.392 @@ -335,6 +341,8 @@ #ifdef HAS_VIDC20 #include +#define MAX_SIZE 2*1024*1024 + /* VIDC20 has a different set of rules from the VIDC: * hcr : must be multiple of 4 * hswr : must be even @@ -1561,7 +1569,7 @@ if (current_par.montype == -1 || current_par.montype > NR_MONTYPES) current_par.montype = 4; - if (current_par.montype > 0) { + if (current_par.montype >= 0) { fb_info.monspecs = monspecs[current_par.montype]; fb_info.monspecs.dpms = current_par.dpms; } @@ -1603,8 +1611,13 @@ } else if (current_par.dram_size) size = current_par.dram_size; else - size = (init_var.xres * init_var.yres * - init_var.bits_per_pixel) / 8; + size = MAX_SIZE; + + /* + * Limit maximum screen size. + */ + if (size > MAX_SIZE) + size = MAX_SIZE; size = PAGE_ALIGN(size); @@ -1640,13 +1653,6 @@ } #endif #if defined(HAS_VIDC) -#define MAX_SIZE 480*1024 - /* - * Limit maximum screen size. - */ - if (size > MAX_SIZE) - size = MAX_SIZE; - /* * Free unused pages */ @@ -1661,17 +1667,41 @@ * find it, then we can't restore it if we change * the resolution, so we disable this feature. */ - rc = fb_find_mode(&init_var, &fb_info, NULL, modedb, - sizeof(modedb) / sizeof(*modedb), - &acornfb_default_mode, DEFAULT_BPP); + do { + rc = fb_find_mode(&init_var, &fb_info, NULL, modedb, + sizeof(modedb) / sizeof(*modedb), + &acornfb_default_mode, DEFAULT_BPP); + /* + * If we found an exact match, all ok. + */ + if (rc == 1) + break; + + rc = fb_find_mode(&init_var, &fb_info, NULL, NULL, 0, + &acornfb_default_mode, DEFAULT_BPP); + /* + * If we found an exact match, all ok. + */ + if (rc == 1) + break; + + rc = fb_find_mode(&init_var, &fb_info, NULL, modedb, + sizeof(modedb) / sizeof(*modedb), + &acornfb_default_mode, DEFAULT_BPP); + if (rc) + break; + + rc = fb_find_mode(&init_var, &fb_info, NULL, NULL, 0, + &acornfb_default_mode, DEFAULT_BPP); + } while (0); /* * If we didn't find an exact match, try the * generic database. */ - if (rc != 1 && fb_find_mode(&init_var, &fb_info, NULL, NULL, 0, - &acornfb_default_mode, DEFAULT_BPP)) { + if (rc == 0) { printk("Acornfb: no valid mode found\n"); + return -EINVAL; } h_sync = 1953125000 / init_var.pixclock; diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/acornfb.h linux/drivers/video/acornfb.h --- v2.4.0-test8/linux/drivers/video/acornfb.h Fri May 12 11:21:20 2000 +++ linux/drivers/video/acornfb.h Mon Sep 18 15:15:22 2000 @@ -1,16 +1,20 @@ /* - * linux/drivers/video/acornfb.h + * linux/drivers/video/acornfb.h * - * Copyright (C) 1998,1999 Russell King + * Copyright (C) 1998,1999 Russell King * - * Frame buffer code for Acorn platforms + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Frame buffer code for Acorn platforms */ #if defined(HAS_VIDC20) -#include +#include #define VIDC_PALETTE_SIZE 256 #define VIDC_NAME "VIDC20" #elif defined(HAS_VIDC) -#include +#include #define VIDC_PALETTE_SIZE 16 #define VIDC_NAME "VIDC" #endif diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/aty.h linux/drivers/video/aty.h --- v2.4.0-test8/linux/drivers/video/aty.h Tue Jun 20 14:14:51 2000 +++ linux/drivers/video/aty.h Sun Sep 17 09:48:04 2000 @@ -461,6 +461,7 @@ #define VERTEX_2_SECONDARY_T 0x0738 /* Dword offset 1_CE */ #define VERTEX_2_SECONDARY_W 0x073C /* Dword offset 1_CF */ +#define GTC_3D_RESET_DELAY 3 /* 3D engine reset delay in ms */ /* CRTC control values (mostly CRTC_GEN_CNTL) */ @@ -747,7 +748,8 @@ #define GI_CHIP_ID 0x4749 /* RAGE PRO, BGA, PCI33 only */ #define GP_CHIP_ID 0x4750 /* RAGE PRO, PQFP, PCI33, full 3D */ #define GQ_CHIP_ID 0x4751 /* RAGE PRO, PQFP, PCI33, limited 3D */ -#define LN_CHIP_ID 0x4c4d /* RAGE Mobility AGP */ +#define LM_CHIP_ID 0x4c4d /* RAGE Mobility PCI */ +#define LN_CHIP_ID 0x4c4e /* RAGE Mobility AGP */ /* Mach64 major ASIC revisions */ @@ -998,5 +1000,12 @@ #define LCD_LT_GIO 0x07 #define LCD_POWER_MANAGEMENT 0x08 #define LCD_ZVGPIO 0x09 +#define LCD_MISC_CNTL 0x14 + +/* Values in LCD_MISC_CNTL */ +#define BIAS_MOD_LEVEL_MASK 0x0000ff00 +#define BIAS_MOD_LEVEL_SHIFT 8 +#define BLMOD_EN 0x00010000 +#define BIASMOD_EN 0x00020000 #endif /* REGMACH64_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/aty128.h linux/drivers/video/aty128.h --- v2.4.0-test8/linux/drivers/video/aty128.h Tue Jun 20 14:14:51 2000 +++ linux/drivers/video/aty128.h Sun Sep 17 09:48:04 2000 @@ -43,6 +43,7 @@ #define OVR_CLR 0x0230 #define OVR_WID_LEFT_RIGHT 0x0234 #define OVR_WID_TOP_BOTTOM 0x0238 +#define LVDS_GEN_CNTL 0x02d0 #define DDA_CONFIG 0x02e0 #define DDA_ON_OFF 0x02e4 #define VGA_DDA_CONFIG 0x02e8 @@ -267,7 +268,8 @@ #define DAC_BLANKING 0x00000004 #define DAC_RANGE_CNTL 0x00000003 #define DAC_RANGE_CNTL 0x00000003 -#define PALETTE_ACCESS_CNTL 0x00000020 +#define DAC_PALETTE_ACCESS_CNTL 0x00000020 +#define DAC_PDWN 0x00008000 /* GEN_RESET_CNTL bit constants */ #define SOFT_RESET_GUI 0x00000001 @@ -339,5 +341,12 @@ #define DP_SRC_RECT 0x00000200 #define DP_SRC_HOST 0x00000300 #define DP_SRC_HOST_BYTEALIGN 0x00000400 + +/* LVDS_GEN_CNTL constants */ +#define LVDS_BL_MOD_LEVEL_MASK 0x0000ff00 +#define LVDS_BL_MOD_LEVEL_SHIFT 8 +#define LVDS_BL_MOD_EN 0x00010000 +#define LVDS_DIGION 0x00040000 +#define LVDS_BLON 0x00080000 #endif /* REG_RAGE128_H */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/aty128fb.c linux/drivers/video/aty128fb.c --- v2.4.0-test8/linux/drivers/video/aty128fb.c Wed Jul 26 11:08:40 2000 +++ linux/drivers/video/aty128fb.c Sun Sep 17 09:48:04 2000 @@ -55,6 +55,15 @@ #endif #endif +#ifdef CONFIG_ADB_PMU +#include +#include +#endif + +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif + #ifdef CONFIG_FB_COMPAT_XPMAC #include #endif @@ -211,13 +220,8 @@ #endif #ifdef CONFIG_PPC -#ifdef CONFIG_NVRAM_NOT_DEFINED -static int default_vmode __initdata = VMODE_640_480_60; +static int default_vmode __initdata = VMODE_1024_768_60; static int default_cmode __initdata = CMODE_8; -#else -static int default_vmode __initdata = VMODE_NVRAM; -static int default_cmode __initdata = CMODE_NVRAM; -#endif #endif #ifdef CONFIG_MTRR @@ -419,6 +423,15 @@ fb_rasterimg: aty128fb_rasterimg, }; +#ifdef CONFIG_PMAC_BACKLIGHT +static int aty128_set_backlight_enable(int on, int level, void* data); +static int aty128_set_backlight_level(int level, void* data); + +static struct backlight_controller aty128_backlight_controller = { + aty128_set_backlight_enable, + aty128_set_backlight_level +}; +#endif /* CONFIG_PMAC_BACKLIGHT */ /* * Functions to read from/write to the mmio registers @@ -1712,15 +1725,8 @@ if (!mac_find_mode(&var, &info->fb_info, mode_option, 8)) var = default_var; } else { -#ifdef CONFIG_NVRAM - if (default_vmode == VMODE_NVRAM) - default_vmode = nvram_read_byte(NV_VMODE); - - if (default_cmode == CMODE_NVRAM) - default_cmode = nvram_read_byte(NV_CMODE); -#endif if (default_vmode <= 0 || default_vmode > VMODE_MAX) - default_vmode = VMODE_640_480_60; + default_vmode = VMODE_1024_768_60; if (default_cmode < CMODE_8 || default_cmode > CMODE_32) default_cmode = CMODE_8; @@ -1772,6 +1778,12 @@ if (register_framebuffer(&info->fb_info) < 0) return 0; +#ifdef CONFIG_PMAC_BACKLIGHT + /* Could be extended to Rage128Pro LVDS output too */ + if (info->chip_gen == rage_M3) + register_backlight_controller(&aty128_backlight_controller, info, "ati"); +#endif /* CONFIG_PMAC_BACKLIGHT */ + printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", GET_FB_IDX(info->fb_info.node), aty128fb_name, name); @@ -1916,6 +1928,11 @@ } #endif /* CONFIG_MTRR */ +#ifdef CONFIG_FB_COMPAT_XPMAC + if (!console_fb_info) + console_fb_info = &info->fb_info; +#endif + return 0; err_out: @@ -2136,6 +2153,11 @@ struct fb_info_aty128 *info = (struct fb_info_aty128 *)fb; u8 state = 0; +#ifdef CONFIG_PMAC_BACKLIGHT + if ((_machine == _MACH_Pmac) && blank) + set_backlight_enable(0); +#endif /* CONFIG_PMAC_BACKLIGHT */ + if (blank & VESA_VSYNC_SUSPEND) state |= 2; if (blank & VESA_HSYNC_SUSPEND) @@ -2144,6 +2166,11 @@ state |= 4; aty_st_8(CRTC_EXT_CNTL+1, state); + +#ifdef CONFIG_PMAC_BACKLIGHT + if ((_machine == _MACH_Pmac) && !blank) + set_backlight_enable(1); +#endif /* CONFIG_PMAC_BACKLIGHT */ } @@ -2199,7 +2226,7 @@ int i; if (info->chip_gen == rage_M3) - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~PALETTE_ACCESS_CNTL); + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); for (i=16; i<256; i++) { aty_st_8(PALETTE_INDEX, i); @@ -2208,7 +2235,7 @@ } if (info->chip_gen == rage_M3) { - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | PALETTE_ACCESS_CNTL); + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); for (i=16; i<256; i++) { aty_st_8(PALETTE_INDEX, i); @@ -2221,7 +2248,7 @@ /* initialize palette */ if (info->chip_gen == rage_M3) - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~PALETTE_ACCESS_CNTL); + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); if (info->current_par.crtc.bpp == 16) aty_st_8(PALETTE_INDEX, (regno << 3)); @@ -2230,7 +2257,7 @@ col = (red << 16) | (green << 8) | blue; aty_st_le32(PALETTE_DATA, col); if (info->chip_gen == rage_M3) { - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | PALETTE_ACCESS_CNTL); + aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | DAC_PALETTE_ACCESS_CNTL); if (info->current_par.crtc.bpp == 16) aty_st_8(PALETTE_INDEX, (regno << 3)); else @@ -2282,6 +2309,38 @@ } } + +#ifdef CONFIG_PMAC_BACKLIGHT +static int backlight_conv[] = { + 0xff, 0xc0, 0xb5, 0xaa, 0x9f, 0x94, 0x89, 0x7e, + 0x73, 0x68, 0x5d, 0x52, 0x47, 0x3c, 0x31, 0x24 +}; + +static int +aty128_set_backlight_enable(int on, int level, void* data) +{ + struct fb_info_aty128 *info = (struct fb_info_aty128 *)data; + unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); + + reg |= LVDS_BL_MOD_EN | LVDS_BLON; + if (on && level > BACKLIGHT_OFF) { + reg &= ~LVDS_BL_MOD_LEVEL_MASK; + reg |= (backlight_conv[level] << LVDS_BL_MOD_LEVEL_SHIFT); + } else { + reg &= ~LVDS_BL_MOD_LEVEL_MASK; + reg |= (backlight_conv[0] << LVDS_BL_MOD_LEVEL_SHIFT); + } + aty_st_le32(LVDS_GEN_CNTL, reg); + + return 0; +} + +static int +aty128_set_backlight_level(int level, void* data) +{ + return aty128_set_backlight_enable(1, level, data); +} +#endif /* CONFIG_PMAC_BACKLIGHT */ /* * Accelerated functions diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/atyfb.c linux/drivers/video/atyfb.c --- v2.4.0-test8/linux/drivers/video/atyfb.c Tue Aug 29 14:09:15 2000 +++ linux/drivers/video/atyfb.c Sun Sep 17 09:48:05 2000 @@ -20,6 +20,8 @@ * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. + * + * Many thanks to Nitya from ATI devrel for support and patience ! */ /****************************************************************************** @@ -73,6 +75,10 @@ #ifdef CONFIG_NVRAM #include #endif +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif + #ifdef __sparc__ #include #include @@ -286,6 +292,15 @@ static struct fb_info_aty* first_display = NULL; #endif +#ifdef CONFIG_PMAC_BACKLIGHT +static int aty_set_backlight_enable(int on, int level, void* data); +static int aty_set_backlight_level(int level, void* data); + +static struct backlight_controller aty_backlight_controller = { + aty_set_backlight_enable, + aty_set_backlight_level +}; +#endif /* CONFIG_PMAC_BACKLIGHT */ /* * Frame buffer device API @@ -556,6 +571,8 @@ { 0x4749, 0x4749, "3D RAGE PRO (BGA, PCI)" }, { 0x4750, 0x4750, "3D RAGE PRO (PQFP, PCI)" }, { 0x4751, 0x4751, "3D RAGE PRO (PQFP, PCI, limited 3D)" }, + { 0x4c4d, 0x4c4d, "3D RAGE Mobility (PCI)" }, + { 0x4c4e, 0x4c4e, "3D RAGE Mobility (AGP)" }, }; static const char *aty_gx_ram[8] __initdata = { @@ -567,48 +584,51 @@ }; -static inline u32 aty_ld_le32(unsigned int regindex, +static inline u32 aty_ld_le32(int regindex, const struct fb_info_aty *info) { -#if defined(__powerpc__) - unsigned long temp; - u32 val; + /* Hack for bloc 1, should be cleanly optimized by compiler */ + if (regindex >= 0x400) + regindex -= 0x800; - temp = info->ati_regbase; - asm volatile("lwbrx %0,%1,%2;eieio" : "=r"(val) : "b" (regindex), "r" (temp)); - return val; -#elif defined(__mc68000__) +#if defined(__mc68000__) return le32_to_cpu(*((volatile u32 *)(info->ati_regbase+regindex))); #else return readl (info->ati_regbase + regindex); #endif } -static inline void aty_st_le32(unsigned int regindex, u32 val, +static inline void aty_st_le32(int regindex, u32 val, const struct fb_info_aty *info) { -#if defined(__powerpc__) - unsigned long temp; + /* Hack for bloc 1, should be cleanly optimized by compiler */ + if (regindex >= 0x400) + regindex -= 0x800; - temp = info->ati_regbase; - asm volatile("stwbrx %0,%1,%2;eieio" : : "r" (val), "b" (regindex), "r" (temp) : - "memory"); -#elif defined(__mc68000__) +#if defined(__mc68000__) *((volatile u32 *)(info->ati_regbase+regindex)) = cpu_to_le32(val); #else writel (val, info->ati_regbase + regindex); #endif } -static inline u8 aty_ld_8(unsigned int regindex, +static inline u8 aty_ld_8(int regindex, const struct fb_info_aty *info) { + /* Hack for bloc 1, should be cleanly optimized by compiler */ + if (regindex >= 0x400) + regindex -= 0x800; + return readb (info->ati_regbase + regindex); } -static inline void aty_st_8(unsigned int regindex, u8 val, +static inline void aty_st_8(int regindex, u8 val, const struct fb_info_aty *info) { + /* Hack for bloc 1, should be cleanly optimized by compiler */ + if (regindex >= 0x400) + regindex -= 0x800; + writeb (val, info->ati_regbase + regindex); } @@ -675,6 +695,16 @@ BUS_FIFO_ERR_ACK, info); } +static void reset_GTC_3D_engine(const struct fb_info_aty *info) +{ + aty_st_le32(SCALE_3D_CNTL, 0xc0, info); + mdelay(GTC_3D_RESET_DELAY); + aty_st_le32(SETUP_CNTL, 0x00, info); + mdelay(GTC_3D_RESET_DELAY); + aty_st_le32(SCALE_3D_CNTL, 0x00, info); + mdelay(GTC_3D_RESET_DELAY); +} + static void init_engine(const struct atyfb_par *par, struct fb_info_aty *info) { u32 pitch_value; @@ -688,6 +718,13 @@ pitch_value = pitch_value * 3; } + /* On GTC (RagePro), we need to reset the 3D engine before */ + if (Gx == LB_CHIP_ID || Gx == LD_CHIP_ID || Gx == LI_CHIP_ID || + Gx == LP_CHIP_ID || Gx == GB_CHIP_ID || Gx == GD_CHIP_ID || + Gx == GI_CHIP_ID || Gx == GP_CHIP_ID || Gx == GQ_CHIP_ID || + Gx == LM_CHIP_ID || Gx == LN_CHIP_ID) + reset_GTC_3D_engine(info); + /* Reset engine, enable, and clear any engine errors */ reset_engine(info); /* Ensure that vga page pointers are set to zero - the upper */ @@ -2494,6 +2531,9 @@ } else if ((Gx == VT_CHIP_ID) || (Gx == VU_CHIP_ID)) { aty_st_le32(DAC_CNTL, 0x87010184, info); aty_st_le32(BUS_CNTL, 0x680000f9, info); + } else if ((Gx == LN_CHIP_ID) || (Gx == LM_CHIP_ID)) { + aty_st_le32(DAC_CNTL, 0x80010102, info); + aty_st_le32(BUS_CNTL, 0x7b33a040, info); } else { /* GT */ aty_st_le32(DAC_CNTL, 0x86010102, info); @@ -3375,6 +3415,10 @@ /* Rage LT */ pll = 230; mclk = 63; + } else if ((Gx == LN_CHIP_ID) || (Gx == LM_CHIP_ID)) { + /* Rage mobility M1 */ + pll = 230; + mclk = 50; } else { /* other RAGE */ pll = 135; @@ -3545,13 +3589,15 @@ info->fb_info.blank = &atyfbcon_blank; info->fb_info.flags = FBINFO_FLAG_DEFAULT; -#ifdef CONFIG_PPC +#ifdef CONFIG_PMAC_BACKLIGHT if (Gx == LI_CHIP_ID && machine_is_compatible("PowerBook1,1")) { /* these bits let the 101 powerbook wake up from sleep -- paulus */ aty_st_lcd(LCD_POWER_MANAGEMENT, aty_ld_lcd(LCD_POWER_MANAGEMENT, info) | (USE_F32KHZ | TRISTATE_MEM_EN), info); } -#endif /* CONFIG_PPC */ + if ((Gx == LN_CHIP_ID) || (Gx == LM_CHIP_ID)) + register_backlight_controller(&aty_backlight_controller, info, "ati"); +#endif /* CONFIG_PMAC_BACKLIGHT */ #ifdef MODULE var = default_var; @@ -3580,6 +3626,9 @@ default_vmode = VMODE_1024_768_60; else if (machine_is_compatible("iMac")) default_vmode = VMODE_1024_768_75; + else if (machine_is_compatible("PowerBook2,1")) + /* iBook with 800x600 LCD */ + default_vmode = VMODE_800_600_60; else default_vmode = VMODE_640_480_67; sense = read_aty_sense(info); @@ -4216,10 +4265,10 @@ struct fb_info_aty *info = (struct fb_info_aty *)fb; u8 gen_cntl; -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_PMAC_BACKLIGHT if ((_machine == _MACH_Pmac) && blank) - pmu_enable_backlight(0); -#endif + set_backlight_enable(0); +#endif /* CONFIG_PMAC_BACKLIGHT */ gen_cntl = aty_ld_8(CRTC_GEN_CNTL, info); if (blank > 0) @@ -4241,10 +4290,10 @@ gen_cntl &= ~(0x4c); aty_st_8(CRTC_GEN_CNTL, gen_cntl, info); -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_PMAC_BACKLIGHT if ((_machine == _MACH_Pmac) && !blank) - pmu_enable_backlight(1); -#endif + set_backlight_enable(1); +#endif /* CONFIG_PMAC_BACKLIGHT */ } @@ -4954,6 +5003,40 @@ return result; } #endif /* CONFIG_PMAC_PBOOK */ + +#ifdef CONFIG_PMAC_BACKLIGHT +static int backlight_conv[] = { + 0x00, 0x3f, 0x4c, 0x59, 0x66, 0x73, 0x80, 0x8d, + 0x9a, 0xa7, 0xb4, 0xc1, 0xcf, 0xdc, 0xe9, 0xff +}; + +static int +aty_set_backlight_enable(int on, int level, void* data) +{ + struct fb_info_aty *info = (struct fb_info_aty *)data; + unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, info); + + reg |= (BLMOD_EN | BIASMOD_EN); + if (on && level > BACKLIGHT_OFF) { + reg &= ~BIAS_MOD_LEVEL_MASK; + reg |= (backlight_conv[level] << BIAS_MOD_LEVEL_SHIFT); + } else { + reg &= ~BIAS_MOD_LEVEL_MASK; + reg |= (backlight_conv[0] << BIAS_MOD_LEVEL_SHIFT); + } + aty_st_lcd(LCD_MISC_CNTL, reg, info); + + return 0; +} + +static int +aty_set_backlight_level(int level, void* data) +{ + return aty_set_backlight_enable(1, level, data); +} + +#endif /* CONFIG_PMAC_BACKLIGHT */ + #ifdef MODULE int __init init_module(void) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/chipsfb.c linux/drivers/video/chipsfb.c --- v2.4.0-test8/linux/drivers/video/chipsfb.c Fri Aug 4 18:06:34 2000 +++ linux/drivers/video/chipsfb.c Sun Sep 17 09:48:05 2000 @@ -35,6 +35,9 @@ #include #include #include +#ifdef CONFIG_PMAC_BACKLIGHT +#include +#endif #include #include @@ -245,7 +248,9 @@ // used to disable backlight only for blank > 1, but it seems // useful at blank = 1 too (saves battery, extends backlight life) if (blank) { - pmu_enable_backlight(0); +#ifdef CONFIG_PMAC_BACKLIGHT + set_backlight_enable(0); +#endif /* CONFIG_PMAC_BACKLIGHT */ /* get the palette from the chip */ for (i = 0; i < 256; ++i) { out_8(p->io_base + 0x3c7, i); @@ -262,7 +267,9 @@ out_8(p->io_base + 0x3c9, 0); } } else { - pmu_enable_backlight(1); +#ifdef CONFIG_PMAC_BACKLIGHT + set_backlight_enable(1); +#endif /* CONFIG_PMAC_BACKLIGHT */ for (i = 0; i < 256; ++i) { out_8(p->io_base + 0x3c8, i); udelay(1); @@ -673,8 +680,10 @@ /* Clear the entire framebuffer */ memset(p->frame_buffer, 0, 0x100000); +#ifdef CONFIG_PMAC_BACKLIGHT /* turn on the backlight */ - pmu_enable_backlight(1); + set_backlight_enable(1); +#endif /* CONFIG_PMAC_BACKLIGHT */ init_chips(p); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/controlfb.c linux/drivers/video/controlfb.c --- v2.4.0-test8/linux/drivers/video/controlfb.c Fri Aug 4 18:06:34 2000 +++ linux/drivers/video/controlfb.c Sun Sep 17 09:48:05 2000 @@ -122,6 +122,8 @@ struct fb_info *info); static int control_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info); +static int control_mmap(struct fb_info *info, struct file *file, + struct vm_area_struct *vma); static int controlfb_getcolreg(u_int regno, u_int *red, u_int *green, @@ -171,6 +173,7 @@ fb_get_cmap: control_get_cmap, fb_set_cmap: control_set_cmap, fb_pan_display: control_pan_display, + fb_mmap: control_mmap, }; @@ -327,6 +330,48 @@ return 0; } +/* Private mmap since we want to have a different caching on the framebuffer + * for controlfb. + * Note there's no locking in here; it's done in fb_mmap() in fbmem.c. + */ +static int control_mmap(struct fb_info *info, struct file *file, + struct vm_area_struct *vma) +{ + struct fb_ops *fb = info->fbops; + struct fb_fix_screeninfo fix; + struct fb_var_screeninfo var; + unsigned long off, start; + u32 len; + + fb->fb_get_fix(&fix, PROC_CONSOLE(info), info); + off = vma->vm_pgoff << PAGE_SHIFT; + + /* frame buffer memory */ + start = fix.smem_start; + len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.smem_len); + if (off >= len) { + /* memory mapped io */ + off -= len; + fb->fb_get_var(&var, PROC_CONSOLE(info), info); + if (var.accel_flags) + return -EINVAL; + start = fix.mmio_start; + len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len); + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED; + } else { + /* framebuffer */ + pgprot_val(vma->vm_page_prot) |= _PAGE_WRITETHRU; + } + start &= PAGE_MASK; + vma->vm_pgoff = off >> PAGE_SHIFT; + if (io_remap_page_range(vma->vm_start, off, + vma->vm_end - vma->vm_start, vma->vm_page_prot)) + return -EAGAIN; + + return 0; +} + + /******************** End of controlfb_ops implementation ********************/ /* (new one that is) */ @@ -466,11 +511,6 @@ } } -#ifdef CONFIG_FB_COMPAT_XPMAC -extern struct vc_mode display_info; -extern struct fb_info *console_fb_info; -#endif /* CONFIG_FB_COMPAT_XPMAC */ - static inline int control_vram_reqd(int video_mode, int color_mode) { return (control_reg_init[video_mode-1]->vres @@ -483,12 +523,14 @@ struct adb_request req; int i; +#ifdef CONFIG_ADB_CUDA for (i = 0; i < 3; ++i) { cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x50, i + 1, params[i]); while (!req.complete) cuda_poll(); } +#endif } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/cyber2000fb.c linux/drivers/video/cyber2000fb.c --- v2.4.0-test8/linux/drivers/video/cyber2000fb.c Sun Aug 6 11:25:46 2000 +++ linux/drivers/video/cyber2000fb.c Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * Linux/drivers/video/cyber2000fb.c + * linux/drivers/video/cyber2000fb.c * - * Copyright (C) 1998-2000 Russell King + * Copyright (C) 1998-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Integraphics CyberPro 2000, 2010 and 5000 frame buffer device * @@ -268,9 +272,9 @@ if (regno >= NR_PALETTE) return 1; - red >>= 10; - green >>= 10; - blue >>= 10; + red >>= 8; + green >>= 8; + blue >>= 8; cfb->palette[regno].red = red; cfb->palette[regno].green = green; @@ -706,6 +710,7 @@ int err; hw->width = var->xres_virtual; + hw->palette_ctrl = 0x06; switch (var->bits_per_pixel) { #ifdef FBCON_HAS_CFB8 @@ -713,7 +718,6 @@ hw->pixformat = PIXFORMAT_8BPP; hw->visualid = VISUALID_256; hw->pitch = hw->width >> 3; - hw->palette_ctrl = 0x04; break; #endif #ifdef FBCON_HAS_CFB16 @@ -722,14 +726,14 @@ hw->pixformat = PIXFORMAT_16BPP; hw->visualid = VISUALID_64K; hw->pitch = hw->width >> 2; - hw->palette_ctrl = 0x14; + hw->palette_ctrl |= 0x10; break; #endif case 15:/* DIRECTCOLOUR, 32k */ hw->pixformat = PIXFORMAT_16BPP; hw->visualid = VISUALID_32K; hw->pitch = hw->width >> 2; - hw->palette_ctrl = 0x14; + hw->palette_ctrl |= 0x10; break; #endif @@ -739,7 +743,7 @@ hw->visualid = VISUALID_16M; hw->width *= 3; hw->pitch = hw->width >> 3; - hw->palette_ctrl = 0x14; + hw->palette_ctrl |= 0x10; break; #endif default: diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/cyber2000fb.h linux/drivers/video/cyber2000fb.h --- v2.4.0-test8/linux/drivers/video/cyber2000fb.h Tue Jun 20 14:14:51 2000 +++ linux/drivers/video/cyber2000fb.h Mon Sep 18 15:15:22 2000 @@ -1,5 +1,11 @@ /* - * linux/drivers/video/cyber2000fb.h + * linux/drivers/video/cyber2000fb.h + * + * Copyright (C) 1998-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Integraphics Cyber2000 frame buffer device */ diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/offb.c linux/drivers/video/offb.c --- v2.4.0-test8/linux/drivers/video/offb.c Fri Aug 4 18:06:34 2000 +++ linux/drivers/video/offb.c Sun Sep 17 09:48:05 2000 @@ -43,6 +43,15 @@ static int currcon = 0; +/* Supported palette hacks */ +enum { + cmap_unknown, + cmap_m64, /* ATI Mach64 */ + cmap_r128, /* ATI Rage128 */ + cmap_M3A, /* ATI Rage Mobility M3 Head A */ + cmap_M3B /* ATI Rage Mobility M3 Head B */ +}; + struct fb_info_offb { struct fb_info info; struct fb_fix_screeninfo fix; @@ -51,7 +60,7 @@ struct { u_char red, green, blue, pad; } palette[256]; volatile unsigned char *cmap_adr; volatile unsigned char *cmap_data; - int is_rage_128; + int cmap_type; union { #ifdef FBCON_HAS_CFB16 u16 cfb16[16]; @@ -408,21 +417,27 @@ fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; - info->is_rage_128 = 0; + info->cmap_type = cmap_unknown; if (depth == 8) { /* XXX kludge for ati */ - if (strncmp(name, "ATY,Rage128", 11) == 0) { - if (dp) { + if (dp && !strncmp(name, "ATY,Rage128", 11)) { unsigned long regbase = dp->addrs[2].address; - info->cmap_adr = ioremap(regbase, 0x1FFF) + 0x00b0; - info->cmap_data = info->cmap_adr + 4; - info->is_rage_128 = 1; - } - } else if (strncmp(name, "ATY,", 4) == 0) { + info->cmap_adr = ioremap(regbase, 0x1FFF); + info->cmap_type = cmap_r128; + } else if (dp && !strncmp(name, "ATY,RageM3pA", 12)) { + unsigned long regbase = dp->parent->addrs[2].address; + info->cmap_adr = ioremap(regbase, 0x1FFF); + info->cmap_type = cmap_M3A; + } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { + unsigned long regbase = dp->parent->addrs[2].address; + info->cmap_adr = ioremap(regbase, 0x1FFF); + info->cmap_type = cmap_M3B; + } else if (!strncmp(name, "ATY,", 4)) { unsigned long base = address & 0xff000000UL; info->cmap_adr = ioremap(base + 0x7ff000, 0x1000) + 0xcc0; info->cmap_data = info->cmap_adr + 1; + info->cmap_type = cmap_m64; } fix->visual = info->cmap_adr ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; @@ -580,7 +595,7 @@ display_info.cmap_data_address = 0; display_info.disp_reg_address = 0; /* XXX kludge for ati */ - if (strncmp(name, "ATY,", 4) == 0) { + if (info->cmap_type == cmap_m64) { unsigned long base = address & 0xff000000UL; display_info.disp_reg_address = base + 0x7ffc00; display_info.cmap_adr_address = base + 0x7ffcc0; @@ -628,11 +643,32 @@ if (blank) for (i = 0; i < 256; i++) { - *info2->cmap_adr = i; - mach_eieio(); - for (j = 0; j < 3; j++) { - *info2->cmap_data = 0; - mach_eieio(); + switch(info2->cmap_type) { + case cmap_m64: + *info2->cmap_adr = i; + mach_eieio(); + for (j = 0; j < 3; j++) { + *info2->cmap_data = 0; + mach_eieio(); + } + break; + case cmap_M3A: + /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */ + out_le32((unsigned *)(info2->cmap_adr + 0x58), + in_le32((unsigned *)(info2->cmap_adr + 0x58)) & ~0x20); + case cmap_r128: + /* Set palette index & data */ + out_8(info2->cmap_adr + 0xb0, i); + out_le32((unsigned *)(info2->cmap_adr + 0xb4), 0); + break; + case cmap_M3B: + /* Set PALETTE_ACCESS_CNTL in DAC_CNTL */ + out_le32((unsigned *)(info2->cmap_adr + 0x58), + in_le32((unsigned *)(info2->cmap_adr + 0x58)) | 0x20); + /* Set palette index & data */ + out_8(info2->cmap_adr + 0xb0, i); + out_le32((unsigned *)(info2->cmap_adr + 0xb4), 0); + break; } } else @@ -682,18 +718,36 @@ info2->palette[regno].green = green; info2->palette[regno].blue = blue; - *info2->cmap_adr = regno;/* On some chipsets, add << 3 in 15 bits */ - mach_eieio(); - if (info2->is_rage_128) { - out_le32((unsigned int *)info2->cmap_data, - (red << 16 | green << 8 | blue)); - } else { + switch(info2->cmap_type) { + case cmap_m64: + *info2->cmap_adr = regno; + mach_eieio(); *info2->cmap_data = red; - mach_eieio(); - *info2->cmap_data = green; - mach_eieio(); - *info2->cmap_data = blue; - mach_eieio(); + mach_eieio(); + *info2->cmap_data = green; + mach_eieio(); + *info2->cmap_data = blue; + mach_eieio(); + break; + case cmap_M3A: + /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */ + out_le32((unsigned *)(info2->cmap_adr + 0x58), + in_le32((unsigned *)(info2->cmap_adr + 0x58)) & ~0x20); + case cmap_r128: + /* Set palette index & data */ + out_8(info2->cmap_adr + 0xb0, regno); + out_le32((unsigned *)(info2->cmap_adr + 0xb4), + (red << 16 | green << 8 | blue)); + break; + case cmap_M3B: + /* Set PALETTE_ACCESS_CNTL in DAC_CNTL */ + out_le32((unsigned *)(info2->cmap_adr + 0x58), + in_le32((unsigned *)(info2->cmap_adr + 0x58)) | 0x20); + /* Set palette index & data */ + out_8(info2->cmap_adr + 0xb0, regno); + out_le32((unsigned *)(info2->cmap_adr + 0xb4), + (red << 16 | green << 8 | blue)); + break; } if (regno < 16) diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/riva/fbdev.c linux/drivers/video/riva/fbdev.c --- v2.4.0-test8/linux/drivers/video/riva/fbdev.c Mon Jul 31 11:21:37 2000 +++ linux/drivers/video/riva/fbdev.c Mon Sep 18 14:57:01 2000 @@ -582,7 +582,7 @@ riva_boards = riva_board_list_add(riva_boards, rinfo); - pd->driver_data = rinfo; + pci_set_drvdata (pd, rinfo); printk ("PCI Riva NV%d framebuffer ver %s (%s, %dMB @ 0x%lX)\n", rinfo->riva.Architecture, @@ -610,7 +610,7 @@ static void __devexit rivafb_remove_one (struct pci_dev *pd) { - struct rivafb_info *board = pd->driver_data; + struct rivafb_info *board = pci_get_drvdata (pd); if (!board) return; @@ -630,6 +630,8 @@ board->base1_region_size); kfree (board); + + pci_set_drvdata (pd, NULL); } diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/sa1100fb.c linux/drivers/video/sa1100fb.c --- v2.4.0-test8/linux/drivers/video/sa1100fb.c Sun Aug 13 09:54:15 2000 +++ linux/drivers/video/sa1100fb.c Mon Sep 18 15:15:22 2000 @@ -43,7 +43,17 @@ * * 2000/08/09: * XP860 support added - * Kunihiko IMAI + * Kunihiko IMAI + * + * 2000/08/19: + * Allows standard options to be passed on the kernel command line + * for most common passive displays. + * Mark Huang + * + * 2000/08/29: + * s/save_flags_cli/local_irq_save/ + * remove unneeded extra save_flags_cli in + * sa1100fb_enable_lcd_controller */ #include @@ -164,6 +174,7 @@ /* Shadows for LCD controller registers */ struct sa1100fb_lcd_reg { Address dbar1; + Address dbar2; Word lccr0; Word lccr1; Word lccr2; @@ -667,6 +678,16 @@ init_var.grayscale = 0; init_var.sync = 0; init_var.pixclock = 171521; + } else if (machine_is_cerf()) { + current_par.max_xres = 320; + current_par.max_yres = 240; + current_par.max_bpp = 8; + init_var.red.length = 4; + init_var.green.length = 4; + init_var.blue.length = 4; + init_var.grayscale = 0; + init_var.sync = 0; + init_var.pixclock = 171521; } else if (machine_is_bitsy()) { current_par.max_xres = 320; current_par.max_yres = 240; @@ -784,8 +805,8 @@ u_int required_pages; u_int extra_pages; u_int order; + struct page *page; char *allocated_region; - struct page *page; if (VideoMemRegion != NULL) return -EINVAL; @@ -885,10 +906,11 @@ DPRINTK("activating\n"); /* Disable interrupts and save status */ - save_flags_cli(flags); // disable the interrupts and save flags + local_irq_save(flags); // disable the interrupts and save flags /* Reset the LCD Controller's DMA address if it has changed */ lcd_shadow.dbar1 = (Address)current_par.p_palette_base; + lcd_shadow.dbar2 = (Address)(current_par.p_screen_base + (current_par.xres * current_par.yres * current_par.bits_per_pixel / 8 / 2)); DPRINTK("Configuring xres = %d, yres = %d\n",var->xres, var->yres); @@ -945,6 +967,22 @@ LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH + LCCR3_HorSnchH + LCCR3_ACBsCntOff + LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(44); + } else if (machine_is_cerf()) { + DPRINTK("Configuring Cerf LCD\n"); + lcd_shadow.lccr0 = + LCCR0_LEN + LCCR0_Color + LCCR0_Sngl + + LCCR0_LDM + LCCR0_BAM + LCCR0_ERM + LCCR0_Pas + + LCCR0_LtlEnd + LCCR0_DMADel(0); + lcd_shadow.lccr1 = + LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(6) + + LCCR1_BegLnDel(61) + LCCR1_EndLnDel(9); + lcd_shadow.lccr2 = + LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(1) + + LCCR2_BegFrmDel(3) + LCCR2_EndFrmDel(0); + lcd_shadow.lccr3 = + LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH + + LCCR3_HorSnchH + LCCR3_ACBsCntOff + + LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(38); } else if (machine_is_lart()) { DPRINTK("Configuring LART LCD\n"); lcd_shadow.lccr0 = @@ -1034,13 +1072,14 @@ } /* Restore interrupt status */ - restore_flags(flags); + local_irq_restore(flags); if (( LCCR0 != lcd_shadow.lccr0 ) || ( LCCR1 != lcd_shadow.lccr1 ) || ( LCCR2 != lcd_shadow.lccr2 ) || ( LCCR3 != lcd_shadow.lccr3 ) || - ( DBAR1 != lcd_shadow.dbar1 )) + ( DBAR1 != lcd_shadow.dbar1 ) || + ( DBAR2 != lcd_shadow.dbar2 )) { sa1100fb_enable_lcd_controller(); } @@ -1064,6 +1103,27 @@ if (controller_state == LCD_MODE_DISABLE_BEFORE_ENABLE) { DPRINTK("sa1100fb_inter_handler: re-enabling LCD controller\n"); sa1100fb_enable_lcd_controller(); + } else { + /* + * Second half of sa1100fb_disable_lcd_controller() + */ + if (machine_is_assabet()) { +#ifdef CONFIG_SA1100_ASSABET + BCR_clear(BCR_LCD_ON); +#endif + } else if (machine_is_bitsy()) { +#ifdef CONFIG_SA1100_BITSY + if (current_par.controller_state != LCD_MODE_DISABLE_BEFORE_ENABLE) + clr_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON); +#endif + } else if (machine_is_penny()) { +#ifdef CONFIG_SA1100_PENNY + FpgaLcdCS1 = 0x000; /* LCD Backlight to 0% */ + FpgaPortI &= ~LCD_ON; /* Turn off LCD Backlight */ +#endif + } else if (machine_is_tifon()) { + GPCR = GPIO_GPIO(24); /* turn off display */ + } } } LCSR = 0; /* Clear LCD Status Register */ @@ -1087,29 +1147,10 @@ return; } - if (machine_is_assabet()) { -#ifdef CONFIG_SA1100_ASSABET - BCR_clear(BCR_LCD_ON); -#endif - } else if (machine_is_bitsy()) { -#ifdef CONFIG_SA1100_BITSY - if (current_par.controller_state != LCD_MODE_DISABLE_BEFORE_ENABLE) - clr_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON); -#endif - } else if (machine_is_penny()) { -#ifdef CONFIG_SA1100_PENNY - FpgaLcdCS1 = 0x000; /* LCD Backlight to 0% */ - FpgaPortI &= ~LCD_ON; /* Turn off LCD Backlight */ -#endif - } else if (machine_is_tifon()) { - GPCR = GPIO_GPIO(24); /* turn off display */ - } - LCSR = 0; /* Clear LCD Status Register */ LCCR0 &= ~(LCCR0_LDM); /* Enable LCD Disable Done Interrupt */ enable_irq(IRQ_LCD); /* Enable LCD IRQ */ LCCR0 &= ~(LCCR0_LEN); /* Disable LCD Controller */ - } /* @@ -1122,7 +1163,7 @@ { u_long flags; - save_flags_cli(flags); + local_irq_save(flags); /* Disable controller before changing parameters */ if (current_par.controller_state == LCD_MODE_ENABLED) { @@ -1135,14 +1176,20 @@ current_par.v_palette_base[0] &= 0x0FFF; current_par.v_palette_base[0] |= SA1100_PALETTE_MODE_VAL(current_par.bits_per_pixel); - /* disable the interrupts and save flags */ - save_flags_cli(flags); + /* Enable GPIO<9:2> for LCD usage if dual-scan */ + if (lcd_shadow.lccr0 & LCCR0_SDS) { + GPDR |= 0x3fc; + GAFR |= 0x3fc; + } - DBAR1 = lcd_shadow.dbar1; + /* Sequence from 11.7.10 */ LCCR3 = lcd_shadow.lccr3; LCCR2 = lcd_shadow.lccr2; LCCR1 = lcd_shadow.lccr1; - LCCR0 = lcd_shadow.lccr0; + LCCR0 = lcd_shadow.lccr0 & ~LCCR0_LEN; + DBAR1 = lcd_shadow.dbar1; + DBAR2 = lcd_shadow.dbar2; + LCCR0 |= LCCR0_LEN; if (machine_is_assabet()) { #ifdef CONFIG_SA1100_ASSABET @@ -1172,7 +1219,7 @@ } /* Restore interrupt status */ - restore_flags(flags); + local_irq_restore(flags); } /* @@ -1263,6 +1310,9 @@ } else if (machine_is_bitsy()) { GPDR = (GPIO_LDD15 | GPIO_LDD14 | GPIO_LDD13 | GPIO_LDD12 | GPIO_LDD11 | GPIO_LDD10 | GPIO_LDD9 | GPIO_LDD8); GAFR |= (GPIO_LDD15 | GPIO_LDD14 | GPIO_LDD13 | GPIO_LDD12 | GPIO_LDD11 | GPIO_LDD10 | GPIO_LDD9 | GPIO_LDD8); + } else if (machine_is_cerf()) { + GPDR |= 0x3fc; + GAFR |= 0x3fc; } else if (machine_is_penny()) { #ifdef CONFIG_SA1100_PENNY GPDR |= GPIO_GPDR_GFX; /* GPIO Data Direction register for LCD data bits 8-11 */ @@ -1286,3 +1336,35 @@ return 0; } + +int __init sa1100fb_setup(char *options) +{ + char *this_opt; + + if (!options || !*options) + return 0; + + for (this_opt = strtok(options, ","); this_opt; + this_opt = strtok(NULL, ",")) { + + if (!strncmp(this_opt, "bpp:", 4)) + current_par.max_bpp = simple_strtoul(this_opt+4, NULL, 0); + + if (!strncmp(this_opt, "lccr0:", 6)) + lcd_shadow.lccr0 = simple_strtoul(this_opt+6, NULL, 0); + if (!strncmp(this_opt, "lccr1:", 6)) { + lcd_shadow.lccr1 = simple_strtoul(this_opt+6, NULL, 0); + current_par.max_xres = (lcd_shadow.lccr1 & 0x3ff) + 16; + } + if (!strncmp(this_opt, "lccr2:", 6)) { + lcd_shadow.lccr2 = simple_strtoul(this_opt+6, NULL, 0); + current_par.max_yres = (lcd_shadow.lccr0 & LCCR0_SDS) ? + ((lcd_shadow.lccr2 & 0x3ff) + 1) * 2 : + ((lcd_shadow.lccr2 & 0x3ff) + 1); + } + if (!strncmp(this_opt, "lccr3:", 6)) + lcd_shadow.lccr3 = simple_strtoul(this_opt+6, NULL, 0); + } + return 0; +} + diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/sisfb.c linux/drivers/video/sisfb.c --- v2.4.0-test8/linux/drivers/video/sisfb.c Mon Aug 28 21:25:25 2000 +++ linux/drivers/video/sisfb.c Mon Sep 18 14:57:01 2000 @@ -356,8 +356,6 @@ 0x0B, 0x0C, 0x0D, 0x0F, 0x10 }; -#ifdef CONFIG_FB_SIS_LINUXBIOS - #define Monitor1Sense 0x20 unsigned char SRegsInit[] = { @@ -371,6 +369,8 @@ 0x8e, 0x40, 0x00, 0x00, 0x08, 0x00, 0xff, 0xff }; +#ifdef CONFIG_FB_SIS_LINUXBIOS + unsigned char SRegs[] = { 0x03, 0x01, 0x0F, 0x00, 0x0E, 0xA1, 0x02, 0x13, 0x3F, 0x86, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -1440,7 +1440,6 @@ static u16 get_modeID_length(unsigned long ROMAddr, u16 ModeNo) { - unsigned char ModeID; u16 modeidlength; u16 usModeIDOffset; unsigned short PreviousWord,CurrentWord; @@ -2804,7 +2803,6 @@ u16 cr30flag, cr31flag; unsigned long ROMAddr = rom_vbase; u16 BaseAddr = (u16) ivideo.vga_base; - u_short i; P3c4 = BaseAddr + 0x14; P3d4 = BaseAddr + 0x24; @@ -3420,7 +3418,6 @@ struct board *b; int pdev_valid = 0; unsigned char jTemp; - u32 cmd; outb(0x77, 0x80); @@ -3448,10 +3445,8 @@ return -1; #ifdef CONFIG_FB_SIS_LINUXBIOS - pci_read_config_dword(pdev, PCI_COMMAND, &cmd); - cmd |= PCI_COMMAND_IO; - cmd |= PCI_COMMAND_MEMORY; - pci_write_config_dword(pdev, PCI_COMMAND, cmd); + if (pci_enable_device(pdev)) + return -EIO; #endif ivideo.video_base = pci_resource_start(pdev, 0); diff -u --recursive --new-file v2.4.0-test8/linux/drivers/video/valkyriefb.c linux/drivers/video/valkyriefb.c --- v2.4.0-test8/linux/drivers/video/valkyriefb.c Fri Aug 4 18:06:34 2000 +++ linux/drivers/video/valkyriefb.c Sun Sep 17 09:48:05 2000 @@ -425,12 +425,14 @@ struct adb_request req; int i; +#ifdef CONFIG_ADB_CUDA for (i = 0; i < 3; ++i) { cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 0x50, i + 1, params[i]); while (!req.complete) cuda_poll(); } +#endif } static void __init init_valkyrie(struct fb_info_valkyrie *p) diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/adfs.h linux/fs/adfs/adfs.h --- v2.4.0-test8/linux/fs/adfs/adfs.h Wed Jul 5 21:38:44 2000 +++ linux/fs/adfs/adfs.h Mon Sep 18 15:14:06 2000 @@ -97,6 +97,7 @@ /* dir_*.c */ extern struct inode_operations adfs_dir_inode_operations; extern struct file_operations adfs_dir_operations; +extern struct dentry_operations adfs_dentry_operations; extern struct adfs_dir_ops adfs_f_dir_ops; extern struct adfs_dir_ops adfs_fplus_dir_ops; diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/dir.c linux/fs/adfs/dir.c --- v2.4.0-test8/linux/fs/adfs/dir.c Fri Aug 11 14:29:02 2000 +++ linux/fs/adfs/dir.c Mon Sep 18 15:14:06 2000 @@ -1,9 +1,13 @@ /* - * linux/fs/adfs/dir.c + * linux/fs/adfs/dir.c * - * Copyright (C) 1999-2000 Russell King + * Copyright (C) 1999-2000 Russell King * - * Common directory handling for ADFS + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Common directory handling for ADFS */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/dir_f.c linux/fs/adfs/dir_f.c --- v2.4.0-test8/linux/fs/adfs/dir_f.c Tue Sep 5 14:07:29 2000 +++ linux/fs/adfs/dir_f.c Mon Sep 18 15:14:06 2000 @@ -3,7 +3,11 @@ * * Copyright (C) 1997-1999 Russell King * - * E and F format directory handling + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * E and F format directory handling */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/dir_f.h linux/fs/adfs/dir_f.h --- v2.4.0-test8/linux/fs/adfs/dir_f.h Sun Feb 6 17:45:25 2000 +++ linux/fs/adfs/dir_f.h Mon Sep 18 15:14:06 2000 @@ -1,9 +1,13 @@ /* - * linux/fs/adfs/dir_f.h + * linux/fs/adfs/dir_f.h * - * Copyright (C) 1999 Russell King + * Copyright (C) 1999 Russell King * - * Structures of directories on the F format disk + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Structures of directories on the F format disk */ #ifndef ADFS_DIR_F_H #define ADFS_DIR_F_H diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/dir_fplus.c linux/fs/adfs/dir_fplus.c --- v2.4.0-test8/linux/fs/adfs/dir_fplus.c Wed Jun 21 10:10:02 2000 +++ linux/fs/adfs/dir_fplus.c Mon Sep 18 15:14:06 2000 @@ -1,7 +1,11 @@ /* * linux/fs/adfs/dir_fplus.c * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/dir_fplus.h linux/fs/adfs/dir_fplus.h --- v2.4.0-test8/linux/fs/adfs/dir_fplus.h Sun Feb 6 17:45:25 2000 +++ linux/fs/adfs/dir_fplus.h Mon Sep 18 15:14:06 2000 @@ -1,9 +1,13 @@ /* - * linux/fs/adfs/dir_fplus.h + * linux/fs/adfs/dir_fplus.h * - * Copyright (C) 1999 Russell King + * Copyright (C) 1999 Russell King * - * Structures of directories on the F+ format disk + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Structures of directories on the F+ format disk */ #define ADFS_FPLUS_NAME_LEN 255 diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/inode.c linux/fs/adfs/inode.c --- v2.4.0-test8/linux/fs/adfs/inode.c Sat Jul 8 19:26:12 2000 +++ linux/fs/adfs/inode.c Mon Sep 18 15:14:06 2000 @@ -1,7 +1,11 @@ /* * linux/fs/adfs/inode.c * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/map.c linux/fs/adfs/map.c --- v2.4.0-test8/linux/fs/adfs/map.c Wed Jun 21 10:10:02 2000 +++ linux/fs/adfs/map.c Mon Sep 18 15:14:06 2000 @@ -1,7 +1,11 @@ /* * linux/fs/adfs/map.c * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/adfs/super.c linux/fs/adfs/super.c --- v2.4.0-test8/linux/fs/adfs/super.c Wed Jun 21 10:10:02 2000 +++ linux/fs/adfs/super.c Mon Sep 18 15:14:06 2000 @@ -1,7 +1,11 @@ /* * linux/fs/adfs/super.c * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include @@ -425,7 +429,8 @@ kfree(sb->u.adfs_sb.s_map); adfs_error(sb, "get root inode failed\n"); goto error; - } + } else + sb->s_root->d_op = &adfs_dentry_operations; return sb; error_free_bh: diff -u --recursive --new-file v2.4.0-test8/linux/fs/bfs/inode.c linux/fs/bfs/inode.c --- v2.4.0-test8/linux/fs/bfs/inode.c Tue Sep 5 14:07:29 2000 +++ linux/fs/bfs/inode.c Sun Sep 17 09:51:57 2000 @@ -197,7 +197,7 @@ buf->f_bfree = buf->f_bavail = s->su_freeb; buf->f_files = s->su_lasti + 1 - BFS_ROOT_INO; buf->f_ffree = s->su_freei; - buf->f_fsid.val[0] = s->s_dev; + buf->f_fsid.val[0] = kdev_t_to_nr(s->s_dev); buf->f_namelen = BFS_NAMELEN; return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/fs/block_dev.c linux/fs/block_dev.c --- v2.4.0-test8/linux/fs/block_dev.c Tue Sep 5 14:07:31 2000 +++ linux/fs/block_dev.c Sun Sep 17 09:51:57 2000 @@ -30,17 +30,17 @@ ssize_t block, blocks; loff_t offset; ssize_t chars; - ssize_t written = 0; + ssize_t written; struct buffer_head * bhlist[NBUF]; size_t size; - kdev_t dev; + kdev_t dev = inode->i_rdev; struct buffer_head * bh, *bufferlist[NBUF]; register char * p; - write_error = buffercount = 0; - dev = inode->i_rdev; - if ( is_read_only( inode->i_rdev )) + if (is_read_only(dev)) return -EPERM; + + written = write_error = buffercount = 0; blocksize = BLOCK_SIZE; if (blksize_size[MAJOR(dev)] && blksize_size[MAJOR(dev)][MINOR(dev)]) blocksize = blksize_size[MAJOR(dev)][MINOR(dev)]; @@ -311,6 +311,39 @@ } /* + * private llseek: + * for a block special file file->f_dentry->d_inode->i_size is zero + * so we compute the size by hand (just as in block_read/write above) + */ +static loff_t block_llseek(struct file *file, loff_t offset, int origin) +{ + long long retval; + kdev_t dev; + + switch (origin) { + case 2: + dev = file->f_dentry->d_inode->i_rdev; + if (blk_size[MAJOR(dev)]) + offset += (loff_t) blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS; + /* else? return -EINVAL? */ + break; + case 1: + offset += file->f_pos; + } + retval = -EINVAL; + if (offset >= 0) { + if (offset != file->f_pos) { + file->f_pos = offset; + file->f_reada = 0; + file->f_version = ++event; + } + retval = offset; + } + return retval; +} + + +/* * Filp may be NULL when we are called by an msync of a vma * since the vma has no handle. */ @@ -612,7 +645,7 @@ int blkdev_open(struct inode * inode, struct file * filp) { - int ret = -ENODEV; + int ret = -ENXIO; struct block_device *bdev = inode->i_bdev; down(&bdev->bd_sem); lock_kernel(); @@ -678,6 +711,7 @@ struct file_operations def_blk_fops = { open: blkdev_open, release: blkdev_close, + llseek: block_llseek, read: block_read, write: block_write, fsync: block_fsync, diff -u --recursive --new-file v2.4.0-test8/linux/fs/buffer.c linux/fs/buffer.c --- v2.4.0-test8/linux/fs/buffer.c Wed Sep 6 08:29:45 2000 +++ linux/fs/buffer.c Mon Sep 18 15:26:17 2000 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -409,8 +410,9 @@ */ #define _hashfn(dev,block) \ ((((dev)<<(bh_hash_shift - 6)) ^ ((dev)<<(bh_hash_shift - 9))) ^ \ - (((block)<<(bh_hash_shift - 6)) ^ ((block) >> 13) ^ ((block) << (bh_hash_shift - 12)))) -#define hash(dev,block) hash_table[(_hashfn(dev,block) & bh_hash_mask)] + (((block)<<(bh_hash_shift - 6)) ^ ((block) >> 13) ^ \ + ((block) << (bh_hash_shift - 12)))) +#define hash(dev,block) hash_table[(_hashfn(HASHDEV(dev),block) & bh_hash_mask)] static __inline__ void __hash_link(struct buffer_head *bh, struct buffer_head **head) { @@ -704,8 +706,8 @@ static void refill_freelist(int size) { if (!grow_buffers(size)) { - wakeup_bdflush(1); - current->policy |= SCHED_YIELD; + balance_dirty(NODEV); + wakeup_kswapd(0); /* We can't wait because of __GFP_IO */ schedule(); } } @@ -856,20 +858,31 @@ /* -1 -> no need to flush 0 -> async flush 1 -> sync flush (wait for I/O completation) */ -static int balance_dirty_state(kdev_t dev) +int balance_dirty_state(kdev_t dev) { unsigned long dirty, tot, hard_dirty_limit, soft_dirty_limit; dirty = size_buffers_type[BUF_DIRTY] >> PAGE_SHIFT; tot = nr_free_buffer_pages(); - tot -= size_buffers_type[BUF_PROTECTED] >> PAGE_SHIFT; dirty *= 200; soft_dirty_limit = tot * bdf_prm.b_un.nfract; hard_dirty_limit = soft_dirty_limit * 2; + /* First, check for the "real" dirty limit. */ if (dirty > soft_dirty_limit) { - if (dirty > hard_dirty_limit) + if (dirty > hard_dirty_limit || inactive_shortage()) + return 1; + return 0; + } + + /* + * Then, make sure the number of inactive pages won't overwhelm + * page replacement ... this should avoid stalls. + */ + if (nr_inactive_dirty_pages > + nr_free_pages() + nr_inactive_clean_pages()) { + if (free_shortage() > freepages.min) return 1; return 0; } @@ -1380,6 +1393,19 @@ } /* + * NOTE! All mapped/uptodate combinations are valid: + * + * Mapped Uptodate Meaning + * + * No No "unknown" - must do get_block() + * No Yes "hole" - zero-filled + * Yes No "allocated" - allocated on disk, not read in + * Yes Yes "valid" - allocated and up-to-date in memory. + * + * "Dirty" is valid only with the last case (mapped+uptodate). + */ + +/* * block_write_full_page() is SMP-safe - currently it's still * being called with the kernel lock held, but the code is ready. */ @@ -1471,6 +1497,10 @@ goto out; if (buffer_new(bh)) { unmap_underlying_metadata(bh); + if (Page_Uptodate(page)) { + set_bit(BH_Uptodate, &bh->b_state); + continue; + } if (block_end > to) memset(kaddr+to, 0, block_end-to); if (block_start < from) @@ -1480,6 +1510,10 @@ continue; } } + if (Page_Uptodate(page)) { + set_bit(BH_Uptodate, &bh->b_state); + continue; + } if (!buffer_uptodate(bh) && (block_start < from || block_end > to)) { ll_rw_block(READ, 1, &bh); @@ -1574,8 +1608,10 @@ continue; if (!buffer_mapped(bh)) { - if (iblock < lblock) - get_block(inode, iblock, bh, 0); + if (iblock < lblock) { + if (get_block(inode, iblock, bh, 0)) + continue; + } if (!buffer_mapped(bh)) { if (!kaddr) kaddr = kmap(page); @@ -1758,17 +1794,27 @@ pos += blocksize; } + err = 0; + if (!buffer_mapped(bh)) { + /* Hole? Nothing to do */ + if (buffer_uptodate(bh)) + goto unlock; + get_block(inode, iblock, bh, 0); + /* Still unmapped? Nothing to do */ + if (!buffer_mapped(bh)) + goto unlock; + } + + /* Ok, it's mapped. Make sure it's up-to-date */ + if (Page_Uptodate(page)) + set_bit(BH_Uptodate, &bh->b_state); + if (!buffer_uptodate(bh)) { - err = 0; - if (!buffer_mapped(bh)) { - get_block(inode, iblock, bh, 0); - if (!buffer_mapped(bh)) - goto unlock; - } err = -EIO; bh->b_end_io = end_buffer_io_sync; ll_rw_block(READ, 1, &bh); wait_on_buffer(bh); + /* Uhhuh. Read error. Complain and punt. */ if (!buffer_uptodate(bh)) goto unlock; } @@ -2152,6 +2198,7 @@ page = alloc_page(GFP_BUFFER); if (!page) goto out; + LockPage(page); bh = create_buffers(page, size, 0); if (!bh) goto no_buffer_head; @@ -2184,6 +2231,7 @@ page->buffers = bh; page->flags &= ~(1 << PG_referenced); lru_cache_add(page); + UnlockPage(page); atomic_inc(&buffermem_pages); return 1; @@ -2244,7 +2292,9 @@ { struct buffer_head * tmp, * bh = page->buffers; int index = BUFSIZE_INDEX(bh->b_size); + int loop = 0; +cleaned_buffers_try_again: spin_lock(&lru_list_lock); write_lock(&hash_table_lock); spin_lock(&free_list[index].lock); @@ -2290,8 +2340,14 @@ spin_unlock(&free_list[index].lock); write_unlock(&hash_table_lock); spin_unlock(&lru_list_lock); - if (wait) + if (wait) { sync_page_buffers(bh, wait); + /* We waited synchronously, so we can free the buffers. */ + if (wait > 1 && !loop) { + loop = 1; + goto cleaned_buffers_try_again; + } + } return 0; } @@ -2609,6 +2665,9 @@ CHECK_EMERGENCY_SYNC flushed = flush_dirty_buffers(0); + if (nr_inactive_dirty_pages > nr_free_pages() + + nr_inactive_clean_pages()) + flushed += page_launder(GFP_KSWAPD, 0); /* If wakeup_bdflush will wakeup us after our bdflush_done wakeup, then @@ -2619,14 +2678,16 @@ (as we would be sleeping) and so it would deadlock in SMP. */ __set_current_state(TASK_INTERRUPTIBLE); - wake_up(&bdflush_done); + wake_up_all(&bdflush_done); /* * If there are still a lot of dirty buffers around, * skip the sleep and flush some more. Otherwise, we * go to sleep waiting a wakeup. */ - if (!flushed || balance_dirty_state(NODEV) < 0) + if (!flushed || balance_dirty_state(NODEV) < 0) { + run_task_queue(&tq_disk); schedule(); + } /* Remember to mark us as running otherwise the next schedule will block. */ __set_current_state(TASK_RUNNING); diff -u --recursive --new-file v2.4.0-test8/linux/fs/dcache.c linux/fs/dcache.c --- v2.4.0-test8/linux/fs/dcache.c Fri Aug 11 19:14:46 2000 +++ linux/fs/dcache.c Sun Sep 17 09:45:07 2000 @@ -1248,7 +1248,7 @@ panic("Cannot create buffer head SLAB cache"); names_cachep = kmem_cache_create("names_cache", - PAGE_SIZE, 0, + PATH_MAX + 1, 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if (!names_cachep) panic("Cannot create names SLAB cache"); diff -u --recursive --new-file v2.4.0-test8/linux/fs/ext2/super.c linux/fs/ext2/super.c --- v2.4.0-test8/linux/fs/ext2/super.c Tue Sep 5 14:07:29 2000 +++ linux/fs/ext2/super.c Mon Sep 18 14:57:01 2000 @@ -167,7 +167,7 @@ else if (!strcmp (this_char, "errors")) { if (!value || !*value) { printk ("EXT2-fs: the errors option requires " - "an argument"); + "an argument\n"); return 0; } if (!strcmp (value, "continue")) { diff -u --recursive --new-file v2.4.0-test8/linux/fs/inode.c linux/fs/inode.c --- v2.4.0-test8/linux/fs/inode.c Thu Aug 17 11:27:25 2000 +++ linux/fs/inode.c Mon Sep 11 08:41:07 2000 @@ -71,7 +71,7 @@ int nr_inodes; int nr_unused; int dummy[5]; -} inodes_stat = {0, 0,}; +} inodes_stat; static kmem_cache_t * inode_cachep; diff -u --recursive --new-file v2.4.0-test8/linux/fs/namei.c linux/fs/namei.c --- v2.4.0-test8/linux/fs/namei.c Sun Sep 3 22:49:25 2000 +++ linux/fs/namei.c Mon Sep 18 14:57:01 2000 @@ -107,7 +107,7 @@ static inline int do_getname(const char *filename, char *page) { int retval; - unsigned long len = PAGE_SIZE; + unsigned long len = PATH_MAX + 1; if ((unsigned long) filename >= TASK_SIZE) { if (!segment_eq(get_fs(), KERNEL_DS)) @@ -180,7 +180,7 @@ /* read and search access */ if ((mask == S_IROTH) || - (S_ISDIR(mode) && !(mask & ~(S_IROTH | S_IXOTH)))) + (S_ISDIR(inode->i_mode) && !(mask & ~(S_IROTH | S_IXOTH)))) if (capable(CAP_DAC_READ_SEARCH)) return 0; @@ -683,7 +683,7 @@ } /* SMP-safe */ -int path_init(const char *name,unsigned int flags,struct nameidata *nd) +int path_init(const char *name, unsigned int flags, struct nameidata *nd) { nd->last_type = LAST_ROOT; /* if there are only slashes... */ nd->flags = flags; diff -u --recursive --new-file v2.4.0-test8/linux/fs/ncpfs/file.c linux/fs/ncpfs/file.c --- v2.4.0-test8/linux/fs/ncpfs/file.c Wed Jul 5 11:56:28 2000 +++ linux/fs/ncpfs/file.c Fri Sep 15 14:26:23 2000 @@ -256,7 +256,7 @@ } if (ncp_write_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, - pos, to_write, buf, &written_this_time) != 0) { + pos, to_write, bouncebuffer, &written_this_time) != 0) { errno = -EIO; break; } diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/dir.c linux/fs/nfs/dir.c --- v2.4.0-test8/linux/fs/nfs/dir.c Tue Sep 5 14:02:41 2000 +++ linux/fs/nfs/dir.c Mon Sep 11 08:38:25 2000 @@ -809,14 +809,9 @@ dentry->d_parent->d_name.name, dentry->d_name.name, atomic_read(&dentry->d_count)); - /* - * Note that a silly-renamed file can be deleted once it's - * no longer in use -- it's just an ordinary file now. - */ - if (atomic_read(&dentry->d_count) == 1) { - dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; + if (atomic_read(&dentry->d_count) == 1) goto out; /* No need to silly rename. */ - } + #ifdef NFS_PARANOIA if (!dentry->d_inode) @@ -900,12 +895,21 @@ #endif goto out; } + + /* If the dentry was sillyrenamed, we simply call d_delete() */ + if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { + error = 0; + goto out_delete; + } + nfs_zap_caches(dir_i); if (inode) NFS_CACHEINV(inode); error = NFS_PROTO(dir_i)->remove(dir, &dentry->d_name); if (error < 0) goto out; + + out_delete: /* * Free the inode */ diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/file.c linux/fs/nfs/file.c --- v2.4.0-test8/linux/fs/nfs/file.c Thu Jun 29 16:02:40 2000 +++ linux/fs/nfs/file.c Mon Sep 18 15:18:56 2000 @@ -291,10 +291,13 @@ status = 0; /* - * Make sure we re-validate anything we've got cached. + * Make sure we clear the cache whenever we try to get the lock. * This makes locking act as a cache coherency point. */ out_ok: - NFS_CACHEINV(inode); + if ((cmd == F_SETLK || cmd == F_SETLKW) && fl->fl_type != F_UNLCK) { + nfs_wb_all(inode); /* we may have slept */ + nfs_zap_caches(inode); + } return status; } diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/nfs3proc.c linux/fs/nfs/nfs3proc.c --- v2.4.0-test8/linux/fs/nfs/nfs3proc.c Tue Sep 5 14:02:41 2000 +++ linux/fs/nfs/nfs3proc.c Mon Sep 11 08:38:25 2000 @@ -279,6 +279,7 @@ arg->fh = NFS_FH(dir); arg->name = name->name; arg->len = name->len; + res->valid = 0; msg->rpc_proc = NFS3PROC_REMOVE; msg->rpc_argp = arg; msg->rpc_resp = res; @@ -288,10 +289,13 @@ static void nfs3_proc_unlink_done(struct dentry *dir, struct rpc_message *msg) { - struct nfs_fattr *dir_attr = (struct nfs_fattr*)msg->rpc_resp; + struct nfs_fattr *dir_attr; - nfs_refresh_inode(dir->d_inode, dir_attr); - kfree(msg->rpc_argp); + if (msg->rpc_argp) { + dir_attr = (struct nfs_fattr*)msg->rpc_resp; + nfs_refresh_inode(dir->d_inode, dir_attr); + kfree(msg->rpc_argp); + } } static int diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/proc.c linux/fs/nfs/proc.c --- v2.4.0-test8/linux/fs/nfs/proc.c Tue Sep 5 14:02:41 2000 +++ linux/fs/nfs/proc.c Mon Sep 11 08:38:25 2000 @@ -251,8 +251,10 @@ static void nfs_proc_unlink_done(struct dentry *dir, struct rpc_message *msg) { - NFS_CACHEINV(dir->d_inode); - kfree(msg->rpc_argp); + if (msg->rpc_argp) { + NFS_CACHEINV(dir->d_inode); + kfree(msg->rpc_argp); + } } static int diff -u --recursive --new-file v2.4.0-test8/linux/fs/nfs/unlink.c linux/fs/nfs/unlink.c --- v2.4.0-test8/linux/fs/nfs/unlink.c Tue Sep 5 14:02:41 2000 +++ linux/fs/nfs/unlink.c Mon Sep 11 08:38:25 2000 @@ -121,8 +121,11 @@ { struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; struct dentry *dir = data->dir; - struct inode *dir_i = dir->d_inode; + struct inode *dir_i; + if (!dir) + return; + dir_i = dir->d_inode; nfs_zap_caches(dir_i); NFS_PROTO(dir_i)->unlink_done(dir, &task->tk_msg); rpcauth_releasecred(task->tk_auth, data->cred); @@ -206,6 +209,7 @@ return; data->count++; nfs_copy_dname(dentry, data); + dentry->d_flags &= ~DCACHE_NFSFS_RENAMED; if (data->task.tk_rpcwait == &nfs_delete_queue) rpc_wake_up_task(&data->task); nfs_put_unlinkdata(data); diff -u --recursive --new-file v2.4.0-test8/linux/fs/partitions/acorn.c linux/fs/partitions/acorn.c --- v2.4.0-test8/linux/fs/partitions/acorn.c Wed Aug 9 14:11:11 2000 +++ linux/fs/partitions/acorn.c Mon Sep 18 15:15:26 2000 @@ -1,12 +1,17 @@ /* - * linux/arch/arm/drivers/block/adfspart.c + * linux/fs/partitions/acorn.c * - * Copyright (c) 1996-2000 Russell King. + * Copyright (c) 1996-2000 Russell King. * - * Scan ADFS partitions on hard disk drives. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Scan ADFS partitions on hard disk drives. */ #include #include +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/fs/partitions/mac.c linux/fs/partitions/mac.c --- v2.4.0-test8/linux/fs/partitions/mac.c Wed Feb 9 19:43:53 2000 +++ linux/fs/partitions/mac.c Sun Sep 17 09:51:57 2000 @@ -21,7 +21,7 @@ #include "mac.h" #ifdef CONFIG_PPC -extern void note_bootable_part(kdev_t dev, int part); +extern void note_bootable_part(kdev_t dev, int part, int goodness); #endif /* @@ -67,7 +67,7 @@ brelse(bh); dev_pos = secsize; if ((bh = bread(dev, secsize/dev_bsize, dev_bsize)) == 0) { - printk("%s: error reading partition table\n", + printk("%s: error reading Mac partition table\n", kdevname(dev)); return -1; } @@ -77,6 +77,7 @@ brelse(bh); return 0; /* not a MacOS disk */ } + printk(" [mac]"); blocks_in_map = be32_to_cpu(part->map_count); for (blk = 1; blk <= blocks_in_map; ++blk) { pos = blk * secsize; @@ -114,7 +115,8 @@ goodness++; if (strcasecmp(part->type, "Apple_UNIX_SVR2") == 0 - || strcasecmp(part->type, "Linux_PPC") == 0) { + || (strnicmp(part->type, "Linux", 5) == 0 + && strcasecmp(part->type, "Linux_swap") != 0)) { int i, l; goodness++; @@ -143,7 +145,7 @@ } #ifdef CONFIG_PPC if (found_root_goodness) - note_bootable_part(dev, found_root); + note_bootable_part(dev, found_root, found_root_goodness); #endif brelse(bh); printk("\n"); diff -u --recursive --new-file v2.4.0-test8/linux/fs/proc/proc_misc.c linux/fs/proc/proc_misc.c --- v2.4.0-test8/linux/fs/proc/proc_misc.c Mon Aug 28 21:29:17 2000 +++ linux/fs/proc/proc_misc.c Sun Sep 17 10:13:25 2000 @@ -156,22 +156,30 @@ * have been updated. */ len += sprintf(page+len, - "MemTotal: %8lu kB\n" - "MemFree: %8lu kB\n" - "MemShared: %8lu kB\n" - "Buffers: %8lu kB\n" - "Cached: %8u kB\n" - "HighTotal: %8lu kB\n" - "HighFree: %8lu kB\n" - "LowTotal: %8lu kB\n" - "LowFree: %8lu kB\n" - "SwapTotal: %8lu kB\n" - "SwapFree: %8lu kB\n", + "MemTotal: %8lu kB\n" + "MemFree: %8lu kB\n" + "MemShared: %8lu kB\n" + "Buffers: %8lu kB\n" + "Cached: %8u kB\n" + "Active: %8u kB\n" + "Inact_dirty: %8u kB\n" + "Inact_clean: %8u kB\n" + "Inact_target: %8lu kB\n" + "HighTotal: %8lu kB\n" + "HighFree: %8lu kB\n" + "LowTotal: %8lu kB\n" + "LowFree: %8lu kB\n" + "SwapTotal: %8lu kB\n" + "SwapFree: %8lu kB\n", K(i.totalram), K(i.freeram), K(i.sharedram), K(i.bufferram), K(atomic_read(&page_cache_size)), + K(nr_active_pages), + K(nr_inactive_dirty_pages), + K(nr_inactive_clean_pages()), + K(inactive_target), K(i.totalhigh), K(i.freehigh), K(i.totalram-i.totalhigh), @@ -328,14 +336,14 @@ for (major = 0; major < DK_MAX_MAJOR; major++) { for (disk = 0; disk < DK_MAX_DISK; disk++) { - int active = kstat.dk_drive_rio[major][disk] + + int active = kstat.dk_drive[major][disk] + kstat.dk_drive_rblk[major][disk] + - kstat.dk_drive_wio[major][disk] + kstat.dk_drive_wblk[major][disk]; if (active) len += sprintf(page + len, - "(%u,%u):(%u,%u,%u,%u) ", + "(%u,%u):(%u,%u,%u,%u,%u) ", major, disk, + kstat.dk_drive[major][disk], kstat.dk_drive_rio[major][disk], kstat.dk_drive_rblk[major][disk], kstat.dk_drive_wio[major][disk], diff -u --recursive --new-file v2.4.0-test8/linux/fs/proc/procfs_syms.c linux/fs/proc/procfs_syms.c --- v2.4.0-test8/linux/fs/proc/procfs_syms.c Mon May 8 11:17:47 2000 +++ linux/fs/proc/procfs_syms.c Mon Sep 11 08:41:07 2000 @@ -28,7 +28,9 @@ if (!err) { proc_mnt = kern_mount(&proc_fs_type); err = PTR_ERR(proc_mnt); - if (!IS_ERR(proc_mnt)) + if (IS_ERR(proc_mnt)) + unregister_filesystem(&proc_fs_type); + else err = 0; } return err; diff -u --recursive --new-file v2.4.0-test8/linux/fs/ramfs/inode.c linux/fs/ramfs/inode.c --- v2.4.0-test8/linux/fs/ramfs/inode.c Sun Aug 6 11:43:18 2000 +++ linux/fs/ramfs/inode.c Sun Sep 17 09:51:57 2000 @@ -121,7 +121,7 @@ inode->i_size = 0; inode->i_blksize = PAGE_CACHE_SIZE; inode->i_blocks = 0; - inode->i_rdev = dev; + inode->i_rdev = to_kdev_t(dev); inode->i_nlink = 1; inode->i_op = NULL; inode->i_fop = NULL; diff -u --recursive --new-file v2.4.0-test8/linux/fs/super.c linux/fs/super.c --- v2.4.0-test8/linux/fs/super.c Fri Aug 11 14:31:45 2000 +++ linux/fs/super.c Sun Sep 17 09:51:57 2000 @@ -1303,20 +1303,21 @@ * information (or be NULL). * * NOTE! As pre-0.97 versions of mount() didn't use this setup, the - * flags have to have a special 16-bit magic number in the high word: - * 0xC0ED. If this magic word isn't present, the flags and data info - * aren't used, as the syscall assumes we are talking to an older - * version that didn't understand them. + * flags used to have a special 16-bit magic number in the high word: + * 0xC0ED. If this magic number is present, the high word is discarded. */ long do_mount(char * dev_name, char * dir_name, char *type_page, - unsigned long new_flags, void *data_page) + unsigned long flags, void *data_page) { struct file_system_type * fstype; struct nameidata nd; struct vfsmount *mnt = NULL; struct super_block *sb; int retval = 0; - unsigned long flags = 0; + + /* Discard magic */ + if ((flags & MS_MGC_MSK) == MS_MGC_VAL) + flags &= ~MS_MGC_MSK; /* Basic sanity checks */ @@ -1328,21 +1329,25 @@ /* OK, looks good, now let's see what do they want */ /* just change the flags? - capabilities are checked in do_remount() */ - if ((new_flags & (MS_MGC_MSK|MS_REMOUNT)) == (MS_MGC_VAL|MS_REMOUNT)) - return do_remount(dir_name, new_flags&~(MS_MGC_MSK|MS_REMOUNT), - (char *) data_page); - - if ((new_flags & MS_MGC_MSK) == MS_MGC_VAL) - flags = new_flags & ~MS_MGC_MSK; + if (flags & MS_REMOUNT) + return do_remount(dir_name, flags & ~MS_REMOUNT, + (char *) data_page); + + /* "mount --bind"? Equivalent to older "mount -t bind" */ + /* No capabilities? What if users do thousands of these? */ + if (flags & MS_BIND) + return do_loopback(dev_name, dir_name); /* For the rest we need the type */ if (!type_page || !memchr(type_page, 0, PAGE_SIZE)) return -EINVAL; +#if 0 /* Can be deleted again. Introduced in patch-2.3.99-pre6 */ /* loopback mount? This is special - requires fewer capabilities */ if (strcmp(type_page, "bind")==0) return do_loopback(dev_name, dir_name); +#endif /* for the rest we _really_ need capabilities... */ if (!capable(CAP_SYS_ADMIN)) @@ -1354,7 +1359,8 @@ return -ENODEV; /* ... and mountpoint. Do the lookup first to force automounting. */ - if (path_init(dir_name, LOOKUP_FOLLOW|LOOKUP_POSITIVE|LOOKUP_DIRECTORY, &nd)) + if (path_init(dir_name, + LOOKUP_FOLLOW|LOOKUP_POSITIVE|LOOKUP_DIRECTORY, &nd)) retval = path_walk(dir_name, &nd); if (retval) goto fs_out; @@ -1363,7 +1369,7 @@ if (fstype->fs_flags & FS_NOMOUNT) sb = ERR_PTR(-EINVAL); else if (fstype->fs_flags & FS_REQUIRES_DEV) - sb = get_sb_bdev(fstype, dev_name,flags, data_page); + sb = get_sb_bdev(fstype, dev_name, flags, data_page); else if (fstype->fs_flags & FS_SINGLE) sb = get_sb_single(fstype, flags, data_page); else @@ -1376,6 +1382,13 @@ /* Something was mounted here while we slept */ while(d_mountpoint(nd.dentry) && follow_down(&nd.mnt, &nd.dentry)) ; + + /* Refuse the same filesystem on the same mount point */ + retval = -EBUSY; + if (nd.mnt && nd.mnt->mnt_sb == sb + && nd.mnt->mnt_root == nd.dentry) + goto fail; + retval = -ENOENT; if (!nd.dentry->d_inode) goto fail; @@ -1403,7 +1416,7 @@ } asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, - unsigned long new_flags, void * data) + unsigned long flags, void * data) { int retval; unsigned long data_page; @@ -1423,14 +1436,18 @@ retval = copy_mount_options (dev_name, &dev_page); if (retval < 0) goto out2; + retval = copy_mount_options (data, &data_page); - if (retval >= 0) { - lock_kernel(); - retval = do_mount((char*)dev_page,dir_page,(char*)type_page, - new_flags, (void*)data_page); - unlock_kernel(); - free_page(data_page); - } + if (retval < 0) + goto out3; + + lock_kernel(); + retval = do_mount((char*)dev_page, dir_page, (char*)type_page, + flags, (void*)data_page); + unlock_kernel(); + free_page(data_page); + +out3: free_page(dev_page); out2: putname(dir_page); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/dma.h linux/include/asm-arm/arch-arc/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/dma.h Tue Jul 18 22:43:24 2000 +++ linux/include/asm-arm/arch-arc/dma.h Mon Sep 18 15:15:22 2000 @@ -1,13 +1,17 @@ /* - * linux/include/asm-arm/arch-arc/dma.h + * linux/include/asm-arm/arch-arc/dma.h * - * Copyright (C) 1996-1998 Russell King + * Copyright (C) 1996-1998 Russell King * - * Acorn Archimedes/A5000 architecture virtual DMA - * implementation + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Modifications: - * 04-04-1998 RMK Merged arc and a5k versions + * Acorn Archimedes/A5000 architecture virtual DMA + * implementation + * + * Modifications: + * 04-04-1998 RMK Merged arc and a5k versions */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/hardware.h linux/include/asm-arm/arch-arc/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-arc/hardware.h Mon Sep 18 15:15:22 2000 @@ -1,13 +1,17 @@ /* - * linux/include/asm-arm/arch-arc/hardware.h + * linux/include/asm-arm/arch-arc/hardware.h * - * Copyright (C) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * This file contains the hardware definitions of the - * Acorn Archimedes/A5000 machines. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Modifications: - * 04-04-1998 PJB/RMK Merged arc and a5k versions + * This file contains the hardware definitions of the + * Acorn Archimedes/A5000 machines. + * + * Modifications: + * 04-04-1998 PJB/RMK Merged arc and a5k versions */ #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H @@ -22,7 +26,7 @@ */ #define HAS_IOC #define HAS_MEMC -#include +#include #define HAS_VIDC /* Hardware addresses of major areas. diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/ide.h linux/include/asm-arm/arch-arc/ide.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/ide.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-arc/ide.h Mon Sep 18 15:15:22 2000 @@ -1,15 +1,19 @@ /* - * linux/include/asm-arm/arch-arc/ide.h + * linux/include/asm-arm/arch-arc/ide.h * - * Copyright (c) 1997,1998 Russell King + * Copyright (C) 1997,1998 Russell King * - * IDE definitions for the Acorn Archimedes/A5000 - * architecture + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Modifications: - * 04-04-1998 PJB Merged `arc' and `a5k' versions - * 01-07-1998 RMK Added new ide_ioregspec_t - * 29-07-1998 RMK Major re-work of IDE architecture specific code + * IDE definitions for the Acorn Archimedes/A5000 + * architecture + * + * Modifications: + * 04-04-1998 PJB Merged `arc' and `a5k' versions + * 01-07-1998 RMK Added new ide_ioregspec_t + * 29-07-1998 RMK Major re-work of IDE architecture specific code */ #include #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/io.h linux/include/asm-arm/arch-arc/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/io.h Thu Feb 24 22:44:47 2000 +++ linux/include/asm-arm/arch-arc/io.h Mon Sep 18 15:15:22 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-arc/io.h + * linux/include/asm-arm/arch-arc/io.h * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997 Russell King * - * Modifications: - * 06-Dec-1997 RMK Created. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 06-Dec-1997 RMK Created. */ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/irq.h linux/include/asm-arm/arch-arc/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/irq.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-arc/irq.h Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * include/asm-arm/arch-arc/irq.h + * linux/include/asm-arm/arch-arc/irq.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * Changelog: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: * 24-09-1996 RMK Created * 10-10-1996 RMK Brought up to date with arch-sa110eval * 22-10-1996 RMK Changed interrupt numbers & uses new inb/outb macros @@ -11,7 +15,7 @@ * 22-08-1998 RMK Restructured IRQ routines */ #include -#include +#include #ifdef CONFIG_ARCH_ARC #define a_clf() clf() @@ -168,7 +172,7 @@ } } - irq_mask[IRQ_KEYBOARDTX].noautoenable = 1; + irq_desc[IRQ_KEYBOARDTX].noautoenable = 1; init_FIQ(); } diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/irqs.h linux/include/asm-arm/arch-arc/irqs.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/irqs.h Fri May 8 00:42:39 1998 +++ linux/include/asm-arm/arch-arc/irqs.h Mon Sep 18 15:15:22 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-arc/irqs.h + * linux/include/asm-arm/arch-arc/irqs.h * - * Copyright (C) 1996 Russell King, Dave Gilbert + * Copyright (C) 1996 Russell King, Dave Gilbert * - * Modifications: - * 04-04-1998 PJB Merged arc and a5k versions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 04-04-1998 PJB Merged arc and a5k versions */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/keyboard.h linux/include/asm-arm/arch-arc/keyboard.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/keyboard.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-arc/keyboard.h Mon Sep 18 15:15:22 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-arc/keyboard.h + * linux/include/asm-arm/arch-arc/keyboard.h * - * Keyboard driver definitions for Acorn Archimedes/A5000 - * architecture + * Copyright (C) 1998 Russell King * - * Copyright (C) 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Keyboard driver definitions for Acorn Archimedes/A5000 + * architecture */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/memory.h linux/include/asm-arm/arch-arc/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/memory.h Thu Oct 28 10:16:02 1999 +++ linux/include/asm-arm/arch-arc/memory.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-arc/memory.h + * linux/include/asm-arm/arch-arc/memory.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Changelog: * 22-Nov-1996 RMK Created diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/oldlatches.h linux/include/asm-arm/arch-arc/oldlatches.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/oldlatches.h Tue Jul 18 22:43:24 2000 +++ linux/include/asm-arm/arch-arc/oldlatches.h Mon Sep 18 15:15:22 2000 @@ -1,12 +1,14 @@ /* - * linux/include/asm-arm/arch-arc/oldlatches.h + * linux/include/asm-arm/arch-arc/oldlatches.h * - * Copyright (C) 1996 Russell King, Dave Gilbert + * Copyright (C) 1996 Russell King, Dave Gilbert * - * Dummy oldlatches.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Modifications: - * 04-04-1998 PJB/RMK Merged arc and a5k versions + * Modifications: + * 04-04-1998 PJB/RMK Merged arc and a5k versions */ #ifndef _ASM_ARCH_OLDLATCH_H #define _ASM_ARCH_OLDLATCH_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/processor.h linux/include/asm-arm/arch-arc/processor.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/processor.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/arch-arc/processor.h Mon Sep 18 15:15:22 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/arch-arc/processor.h + * linux/include/asm-arm/arch-arc/processor.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (c) 1996-1999 Russell King. * - * Changelog: - * 10-Sep-1996 RMK Created - * 21-Mar-1999 RMK Added asm/arch/memory.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/serial.h linux/include/asm-arm/arch-arc/serial.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/serial.h Thu Jan 13 13:30:31 2000 +++ linux/include/asm-arm/arch-arc/serial.h Mon Sep 18 15:15:22 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/arch-arc/serial.h + * linux/include/asm-arm/arch-arc/serial.h * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 15-10-1996 RMK Created - * 04-04-1998 PJB Merged `arc' and `a5k' architectures + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-10-1996 RMK Created + * 04-04-1998 PJB Merged `arc' and `a5k' architectures */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/system.h linux/include/asm-arm/arch-arc/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/system.h Mon Aug 14 13:09:07 2000 +++ linux/include/asm-arm/arch-arc/system.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-arc/system.h + * linux/include/asm-arm/arch-arc/system.h * - * Copyright (c) 1996-1999 Russell King and Dave Gilbert + * Copyright (C) 1996-1999 Russell King and Dave Gilbert + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ static void arch_idle(void) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/time.h linux/include/asm-arm/arch-arc/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/time.h Sun Feb 6 17:45:25 2000 +++ linux/include/asm-arm/arch-arc/time.h Mon Sep 18 15:15:22 2000 @@ -1,12 +1,16 @@ /* - * linux/include/asm-arm/arch-arc/time.h + * linux/include/asm-arm/arch-arc/time.h * - * Copyright (c) 1996-2000 Russell King. + * Copyright (C) 1996-2000 Russell King. * - * Changelog: - * 24-Sep-1996 RMK Created - * 10-Oct-1996 RMK Brought up to date with arch-sa110eval - * 04-Dec-1997 RMK Updated for new arch/arm/time.c + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 24-Sep-1996 RMK Created + * 10-Oct-1996 RMK Brought up to date with arch-sa110eval + * 04-Dec-1997 RMK Updated for new arch/arm/time.c */ extern void ioctime_init(void); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/timex.h linux/include/asm-arm/arch-arc/timex.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/timex.h Sun Apr 12 11:42:15 1998 +++ linux/include/asm-arm/arch-arc/timex.h Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-arc/timex.h + * linux/include/asm-arm/arch-arc/timex.h * - * Acorn Archimedes/A5000 architecture timex specifications + * Copyright (C) 1997, 1998 Russell King * - * Copyright (C) 1997, 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Acorn Archimedes/A5000 architecture timex specifications */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-arc/uncompress.h linux/include/asm-arm/arch-arc/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-arc/uncompress.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-arc/uncompress.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-arc/uncompress.h + * linux/include/asm-arm/arch-arc/uncompress.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define VIDMEM ((char *)0x02000000) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-cl7500/hardware.h linux/include/asm-arm/arch-cl7500/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-cl7500/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-cl7500/hardware.h Mon Sep 18 15:15:22 2000 @@ -11,7 +11,7 @@ #define __ASM_ARCH_HARDWARE_H #include -#include +#include /* * What hardware must be present diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-cl7500/irq.h linux/include/asm-arm/arch-cl7500/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-cl7500/irq.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/arch-cl7500/irq.h Mon Sep 18 15:15:22 2000 @@ -9,7 +9,7 @@ * 22-08-1998 RMK Restructured IRQ routines * 11-08-1999 PJB Created ARM7500 version, derived from RiscPC code */ -#include +#include static inline int fixup_irq(unsigned int irq) { diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-cl7500/system.h linux/include/asm-arm/arch-cl7500/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-cl7500/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-cl7500/system.h Mon Sep 18 15:15:22 2000 @@ -6,7 +6,7 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -#include +#include static void arch_idle(void) { diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/dma.h linux/include/asm-arm/arch-ebsa110/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/dma.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-ebsa110/dma.h Mon Sep 18 15:15:22 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-ebsa110/dma.h + * linux/include/asm-arm/arch-ebsa110/dma.h * - * Architecture DMA routes + * Copyright (C) 1997,1998 Russell King * - * Copyright (C) 1997,1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * EBSA110 DMA definitions */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/hardware.h linux/include/asm-arm/arch-ebsa110/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-ebsa110/hardware.h Mon Sep 18 15:15:22 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/hardware.h + * linux/include/asm-arm/arch-ebsa110/hardware.h * - * Copyright (C) 1996-2000 Russell King. + * Copyright (C) 1996-2000 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * This file contains the hardware definitions of the EBSA-110. */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/io.h linux/include/asm-arm/arch-ebsa110/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/io.h Thu Feb 24 22:44:47 2000 +++ linux/include/asm-arm/arch-ebsa110/io.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/io.h + * linux/include/asm-arm/arch-ebsa110/io.h * - * Copyright (C) 1997,1998 Russell King + * Copyright (C) 1997,1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Modifications: * 06-Dec-1997 RMK Created. diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/irq.h linux/include/asm-arm/arch-ebsa110/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/irq.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-ebsa110/irq.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * include/asm-arm/arch-ebsa110/irq.h + * linux/include/asm-arm/arch-ebsa110/irq.h * - * Copyright (C) 1996-1998 Russell King + * Copyright (C) 1996-1998 Russell King * - * Changelog: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: * 22-08-1998 RMK Restructured IRQ routines */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/irqs.h linux/include/asm-arm/arch-ebsa110/irqs.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/irqs.h Sun Sep 6 10:45:30 1998 +++ linux/include/asm-arm/arch-ebsa110/irqs.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/irqs.h + * linux/include/asm-arm/arch-ebsa110/irqs.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define NR_IRQS 8 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/memory.h linux/include/asm-arm/arch-ebsa110/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/memory.h Thu Oct 28 10:16:02 1999 +++ linux/include/asm-arm/arch-ebsa110/memory.h Mon Sep 18 15:15:23 2000 @@ -1,13 +1,17 @@ /* - * linux/include/asm-arm/arch-ebsa110/memory.h + * linux/include/asm-arm/arch-ebsa110/memory.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * Changelog: - * 20-Oct-1996 RMK Created - * 31-Dec-1997 RMK Fixed definitions to reduce warnings - * 21-Mar-1999 RMK Renamed to memory.h - * RMK Moved TASK_SIZE and PAGE_OFFSET here + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Moved TASK_SIZE and PAGE_OFFSET here */ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/processor.h linux/include/asm-arm/arch-ebsa110/processor.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/processor.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/arch-ebsa110/processor.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-ebsa110/processor.h + * linux/include/asm-arm/arch-ebsa110/processor.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King * - * Changelog: - * 21-Mar-1999 RMK Added asm/arch/memory.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/serial.h linux/include/asm-arm/arch-ebsa110/serial.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/serial.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/arch-ebsa110/serial.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-ebsa110/serial.h + * linux/include/asm-arm/arch-ebsa110/serial.h * - * Copyright (c) 1996,1997,1998 Russell King. + * Copyright (C) 1996,1997,1998 Russell King. * - * Changelog: - * 15-10-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-10-1996 RMK Created */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/system.h linux/include/asm-arm/arch-ebsa110/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-ebsa110/system.h Mon Sep 18 15:15:23 2000 @@ -1,14 +1,25 @@ /* - * linux/include/asm-arm/arch-ebsa110/system.h + * linux/include/asm-arm/arch-ebsa110/system.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-2000 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H /* - * This machine must never stop it MCLK. However, if we are - * idle for a long time, slow the processor clock to MCLK. + * EBSA110 idling methodology: + * + * We can not execute the "wait for interrupt" instruction since that + * will stop our MCLK signal (which provides the clock for the glue + * logic, and therefore the timer interrupt). + * + * Instead, we spin, waiting for either hlt_counter or need_resched + * to be set. If we have been spinning for 2cs, then we drop the + * core clock down to the memory clock. */ static void arch_idle(void) { @@ -19,7 +30,7 @@ do { if (current->need_resched || hlt_counter) goto slow_out; - } while (time_before(start_idle, jiffies + HZ/3)); + } while (time_before(jiffies, start_idle + HZ/50)); cpu_do_idle(IDLE_CLOCK_SLOW); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/time.h linux/include/asm-arm/arch-ebsa110/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/time.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-ebsa110/time.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/time.h + * linux/include/asm-arm/arch-ebsa110/time.h * - * Copyright (c) 1996,1997,1998 Russell King. + * Copyright (C) 1996,1997,1998 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * No real time clock on the evalulation board! * diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/timex.h linux/include/asm-arm/arch-ebsa110/timex.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/timex.h Sun Sep 6 10:45:30 1998 +++ linux/include/asm-arm/arch-ebsa110/timex.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-ebsa110/timex.h + * linux/include/asm-arm/arch-ebsa110/timex.h * - * EBSA110 architecture timex specifications + * Copyright (C) 1997, 1998 Russell King * - * Copyright (C) 1997, 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * EBSA110 architecture timex specifications */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/uncompress.h linux/include/asm-arm/arch-ebsa110/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/uncompress.h Sun Sep 6 10:45:30 1998 +++ linux/include/asm-arm/arch-ebsa110/uncompress.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/uncompress.h + * linux/include/asm-arm/arch-ebsa110/uncompress.h * - * Copyright (C) 1996,1997,1998 Russell King + * Copyright (C) 1996,1997,1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/vmalloc.h linux/include/asm-arm/arch-ebsa110/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa110/vmalloc.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/arch-ebsa110/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa110/vmalloc.h + * linux/include/asm-arm/arch-ebsa110/vmalloc.h + * + * Copyright (C) 1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/dma.h linux/include/asm-arm/arch-ebsa285/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/dma.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-ebsa285/dma.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,10 @@ /* - * linux/include/asm-arm/arch-ebsa285/dma.h + * linux/include/asm-arm/arch-ebsa285/dma.h * - * Architecture DMA routines + * Architecture DMA routines * - * Copyright (C) 1998,1999 Russell King - * Copyright (C) 1998,1999 Philip Blundell + * Copyright (C) 1998,1999 Russell King + * Copyright (C) 1998,1999 Philip Blundell */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/hardware.h linux/include/asm-arm/arch-ebsa285/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/hardware.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-ebsa285/hardware.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-ebsa285/hardware.h + * linux/include/asm-arm/arch-ebsa285/hardware.h * - * Copyright (C) 1998-1999 Russell King. + * Copyright (C) 1998-1999 Russell King. * - * This file contains the hardware definitions of the EBSA-285. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains the hardware definitions of the EBSA-285. */ #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/ide.h linux/include/asm-arm/arch-ebsa285/ide.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/ide.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/arch-ebsa285/ide.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-ebsa285/ide.h + * linux/include/asm-arm/arch-ebsa285/ide.h * - * Copyright (c) 1998 Russell King + * Copyright (C) 1998 Russell King * - * Modifications: - * 29-07-1998 RMK Major re-work of IDE architecture specific code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 29-07-1998 RMK Major re-work of IDE architecture specific code */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/io.h linux/include/asm-arm/arch-ebsa285/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/io.h Thu Feb 24 22:44:47 2000 +++ linux/include/asm-arm/arch-ebsa285/io.h Mon Sep 18 15:15:23 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/arch-ebsa285/io.h + * linux/include/asm-arm/arch-ebsa285/io.h * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King * - * Modifications: - * 06-12-1997 RMK Created. - * 07-04-1999 RMK Major cleanup + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 06-12-1997 RMK Created. + * 07-04-1999 RMK Major cleanup */ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H @@ -74,7 +78,7 @@ #define outw(v,p) __arch_putw(v,__io_pci(p)) #define outl(v,p) __arch_putl(v,__io_pci(p)) -#include +#include /* * ioremap support - validate a PCI memory address, diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/irq.h linux/include/asm-arm/arch-ebsa285/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/irq.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-ebsa285/irq.h Mon Sep 18 15:15:23 2000 @@ -1,17 +1,21 @@ /* - * include/asm-arm/arch-ebsa285/irq.h + * linux/include/asm-arm/arch-ebsa285/irq.h * - * Copyright (C) 1996-1998 Russell King + * Copyright (C) 1996-1998 Russell King * - * Changelog: - * 22-Aug-1998 RMK Restructured IRQ routines - * 03-Sep-1998 PJB Merged CATS support - * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder - * 26-Jan-1999 PJB Don't use IACK on CATS - * 16-Mar-1999 RMK Added autodetect of ISA PICs + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 22-Aug-1998 RMK Restructured IRQ routines + * 03-Sep-1998 PJB Merged CATS support + * 20-Jan-1998 RMK Started merge of EBSA286, CATS and NetWinder + * 26-Jan-1999 PJB Don't use IACK on CATS + * 16-Mar-1999 RMK Added autodetect of ISA PICs */ #include -#include +#include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/memory.h linux/include/asm-arm/arch-ebsa285/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/memory.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-ebsa285/memory.h Mon Sep 18 15:15:23 2000 @@ -1,14 +1,18 @@ /* - * linux/include/asm-arm/arch-ebsa285/memory.h + * linux/include/asm-arm/arch-ebsa285/memory.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * Changelog: - * 20-Oct-1996 RMK Created - * 31-Dec-1997 RMK Fixed definitions to reduce warnings. - * 17-May-1998 DAG Added __virt_to_bus and __bus_to_virt functions. - * 21-Nov-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros. - * 21-Mar-1999 RMK Added PAGE_OFFSET for co285 architecture. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings. + * 17-May-1998 DAG Added __virt_to_bus and __bus_to_virt functions. + * 21-Nov-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros. + * 21-Mar-1999 RMK Added PAGE_OFFSET for co285 architecture. * Renamed to memory.h * Moved PAGE_OFFSET and TASK_SIZE here */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/processor.h linux/include/asm-arm/arch-ebsa285/processor.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/processor.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/arch-ebsa285/processor.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-ebsa110/processor.h + * linux/include/asm-arm/arch-ebsa110/processor.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King * - * Changelog: - * 21-Mar-1999 RMK Added asm/arch/memory.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/serial.h linux/include/asm-arm/arch-ebsa285/serial.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/serial.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/arch-ebsa285/serial.h Mon Sep 18 15:15:23 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/arch-ebsa285/serial.h + * linux/include/asm-arm/arch-ebsa285/serial.h * - * Copyright (c) 1996,1997,1998 Russell King. + * Copyright (C) 1996,1997,1998 Russell King. * - * Changelog: - * 15-10-1996 RMK Created - * 25-05-1998 PJB CATS support + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-10-1996 RMK Created + * 25-05-1998 PJB CATS support */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/system.h linux/include/asm-arm/arch-ebsa285/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/system.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-ebsa285/system.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-ebsa285/system.h + * linux/include/asm-arm/arch-ebsa285/system.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ -#include +#include #include #include #include @@ -19,7 +23,7 @@ if (current->need_resched || hlt_counter) goto slow_out; cpu_do_idle(IDLE_WAIT_FAST); - } while (time_before(start_idle, jiffies + HZ/3)); + } while (time_before(jiffies, start_idle + HZ/50)); cpu_do_idle(IDLE_CLOCK_SLOW); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/time.h linux/include/asm-arm/arch-ebsa285/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/time.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-ebsa285/time.h Mon Sep 18 15:15:23 2000 @@ -1,8 +1,8 @@ /* - * linux/include/asm-arm/arch-ebsa285/time.h + * linux/include/asm-arm/arch-ebsa285/time.h * - * Copyright (c) 1998 Russell King. - * Copyright (c) 1998 Phil Blundell + * Copyright (C) 1998 Russell King. + * Copyright (C) 1998 Phil Blundell * * CATS has a real-time clock, though the evaluation board doesn't. * @@ -19,7 +19,7 @@ #include -#include +#include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/timex.h linux/include/asm-arm/arch-ebsa285/timex.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/timex.h Tue Apr 25 16:54:38 2000 +++ linux/include/asm-arm/arch-ebsa285/timex.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-ebsa285/timex.h + * linux/include/asm-arm/arch-ebsa285/timex.h * - * EBSA285 architecture timex specifications + * Copyright (C) 1998 Russell King * - * Copyright (C) 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * EBSA285 architecture timex specifications */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/uncompress.h linux/include/asm-arm/arch-ebsa285/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/uncompress.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-ebsa285/uncompress.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-ebsa285/uncompress.h + * linux/include/asm-arm/arch-ebsa285/uncompress.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/vmalloc.h linux/include/asm-arm/arch-ebsa285/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-ebsa285/vmalloc.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/arch-ebsa285/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,9 @@ /* - * linux/include/asm-arm/arch-ebsa285/vmalloc.h + * linux/include/asm-arm/arch-ebsa285/vmalloc.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/dma.h linux/include/asm-arm/arch-nexuspci/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/dma.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-nexuspci/dma.h Mon Sep 18 15:15:23 2000 @@ -7,6 +7,13 @@ */ /* + * 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 is the maximum DMA address that can be DMAd to. */ #define MAX_DMA_ADDRESS 0xffffffff diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/hardware.h linux/include/asm-arm/arch-nexuspci/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/hardware.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-nexuspci/hardware.h Mon Sep 18 15:15:23 2000 @@ -5,6 +5,14 @@ * * This file contains the hardware definitions of the FTV PCI card. */ + +/* + * 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. + */ + #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/irq.h linux/include/asm-arm/arch-nexuspci/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/irq.h Mon Feb 28 14:16:37 2000 +++ linux/include/asm-arm/arch-nexuspci/irq.h Mon Sep 18 15:15:23 2000 @@ -4,6 +4,13 @@ * Copyright (C) 1998, 1999, 2000 Philip Blundell */ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + #include #define fixup_irq(x) (x) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/irqs.h linux/include/asm-arm/arch-nexuspci/irqs.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/irqs.h Mon Feb 28 14:16:37 2000 +++ linux/include/asm-arm/arch-nexuspci/irqs.h Mon Sep 18 15:15:23 2000 @@ -4,9 +4,18 @@ * Copyright (C) 1997, 1998, 2000 Philip Blundell */ -/* The hardware is capable of routing any interrupt source (except the - DUART) to either IRQ or FIQ. We ignore FIQ and use IRQ exclusively - for simplicity. */ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +/* + * The hardware is capable of routing any interrupt source (except the + * DUART) to either IRQ or FIQ. We ignore FIQ and use IRQ exclusively + * for simplicity. + */ #define IRQ_DUART 0 #define IRQ_PLX 1 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/system.h linux/include/asm-arm/arch-nexuspci/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-nexuspci/system.h Mon Sep 18 15:15:23 2000 @@ -3,6 +3,14 @@ * * Copyright (c) 1996, 97, 98, 99, 2000 FutureTV Labs Ltd. */ + +/* + * 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. + */ + #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/time.h linux/include/asm-arm/arch-nexuspci/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/time.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-nexuspci/time.h Mon Sep 18 15:15:23 2000 @@ -7,6 +7,13 @@ * SCC chip. */ +/* + * 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. + */ + static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { static int count = 25; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/uncompress.h linux/include/asm-arm/arch-nexuspci/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-nexuspci/uncompress.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-nexuspci/uncompress.h Mon Sep 18 15:15:23 2000 @@ -4,6 +4,13 @@ * Copyright (C) 1998, 1999, 2000 Philip Blundell */ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + #include #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/acornfb.h linux/include/asm-arm/arch-rpc/acornfb.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/acornfb.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/arch-rpc/acornfb.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-rpc/acornfb.h + * linux/include/asm-arm/arch-rpc/acornfb.h * - * (C) 1999 Russell King + * Copyright (C) 1999 Russell King * - * AcornFB architecture specific code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * AcornFB architecture specific code */ #define acornfb_valid_pixrate(rate) (1) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/dma.h linux/include/asm-arm/arch-rpc/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/dma.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-rpc/dma.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/arch-rpc/dma.h + * linux/include/asm-arm/arch-rpc/dma.h + * + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_ARCH_DMA_H #define __ASM_ARCH_DMA_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/hardware.h linux/include/asm-arm/arch-rpc/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-rpc/hardware.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-rpc/hardware.h + * linux/include/asm-arm/arch-rpc/hardware.h * - * Copyright (C) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * This file contains the hardware definitions of the RiscPC series machines. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains the hardware definitions of the RiscPC series machines. */ #ifndef __ASM_ARCH_HARDWARE_H #define __ASM_ARCH_HARDWARE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/ide.h linux/include/asm-arm/arch-rpc/ide.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/ide.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/arch-rpc/ide.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-rpc/ide.h + * linux/include/asm-arm/arch-rpc/ide.h * - * Copyright (c) 1997 Russell King + * Copyright (C) 1997 Russell King * - * Modifications: - * 29-07-1998 RMK Major re-work of IDE architecture specific code + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 29-07-1998 RMK Major re-work of IDE architecture specific code */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/io.h linux/include/asm-arm/arch-rpc/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/io.h Thu Feb 24 22:44:47 2000 +++ linux/include/asm-arm/arch-rpc/io.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-rpc/io.h + * linux/include/asm-arm/arch-rpc/io.h * - * Copyright (C) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Modifications: * 06-Dec-1997 RMK Created. diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/irq.h linux/include/asm-arm/arch-rpc/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/irq.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/arch-rpc/irq.h Mon Sep 18 15:15:23 2000 @@ -1,13 +1,17 @@ /* - * include/asm-arm/arch-rpc/irq.h + * linux/include/asm-arm/arch-rpc/irq.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * Changelog: + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: * 10-10-1996 RMK Brought up to date with arch-sa110eval * 22-08-1998 RMK Restructured IRQ routines */ -#include +#include #define fixup_irq(x) (x) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/irqs.h linux/include/asm-arm/arch-rpc/irqs.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/irqs.h Sun Sep 6 10:45:30 1998 +++ linux/include/asm-arm/arch-rpc/irqs.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-rpc/irqs.h + * linux/include/asm-arm/arch-rpc/irqs.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define IRQ_PRINTER 0 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/keyboard.h linux/include/asm-arm/arch-rpc/keyboard.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/keyboard.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-rpc/keyboard.h Mon Sep 18 15:15:23 2000 @@ -1,11 +1,14 @@ /* - * linux/include/asm-arm/arch-rpc/keyboard.h + * linux/include/asm-arm/arch-rpc/keyboard.h * - * Keyboard driver definitions for RiscPC architecture + * Copyright (C) 1998 Russell King * - * (C) 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Keyboard driver definitions for RiscPC architecture */ - #include #define NR_SCANCODES 128 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/memory.h linux/include/asm-arm/arch-rpc/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/memory.h Thu Oct 28 10:16:02 1999 +++ linux/include/asm-arm/arch-rpc/memory.h Mon Sep 18 15:15:23 2000 @@ -1,15 +1,19 @@ /* - * linux/include/asm-arm/arch-rpc/memory.h + * linux/include/asm-arm/arch-rpc/memory.h * - * Copyright (c) 1996,1997,1998 Russell King. + * Copyright (C) 1996,1997,1998 Russell King. * - * Changelog: - * 20-Oct-1996 RMK Created - * 31-Dec-1997 RMK Fixed definitions to reduce warnings - * 11-Jan-1998 RMK Uninlined to reduce hits on cache - * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt - * 21-Mar-1999 RMK Renamed to memory.h - * RMK Added TASK_SIZE and PAGE_OFFSET + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 11-Jan-1998 RMK Uninlined to reduce hits on cache + * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Added TASK_SIZE and PAGE_OFFSET */ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/processor.h linux/include/asm-arm/arch-rpc/processor.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/processor.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/arch-rpc/processor.h Mon Sep 18 15:15:23 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/arch-rpc/processor.h + * linux/include/asm-arm/arch-rpc/processor.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * Changelog: - * 10-Sep-1996 RMK Created - * 21-Mar-1999 RMK Added asm/arch/memory.h + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h */ #ifndef __ASM_ARCH_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/serial.h linux/include/asm-arm/arch-rpc/serial.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/serial.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/arch-rpc/serial.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-rpc/serial.h + * linux/include/asm-arm/arch-rpc/serial.h * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 15-10-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-10-1996 RMK Created */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/system.h linux/include/asm-arm/arch-rpc/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-rpc/system.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/arch-rpc/system.h + * linux/include/asm-arm/arch-rpc/system.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include -#include +#include #include static void arch_idle(void) @@ -17,7 +21,7 @@ if (current->need_resched || hlt_counter) goto slow_out; cpu_do_idle(IDLE_WAIT_FAST); - } while (time_before(start_idle, jiffies + HZ/3)); + } while (time_before(jiffies, start_idle + HZ/50)); cpu_do_idle(IDLE_CLOCK_SLOW); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/time.h linux/include/asm-arm/arch-rpc/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/time.h Sun Feb 6 17:45:25 2000 +++ linux/include/asm-arm/arch-rpc/time.h Mon Sep 18 15:15:23 2000 @@ -1,12 +1,16 @@ /* - * linux/include/asm-arm/arch-rpc/time.h + * linux/include/asm-arm/arch-rpc/time.h * - * Copyright (c) 1996-2000 Russell King. + * Copyright (C) 1996-2000 Russell King. * - * Changelog: - * 24-Sep-1996 RMK Created - * 10-Oct-1996 RMK Brought up to date with arch-sa110eval - * 04-Dec-1997 RMK Updated for new arch/arm/time.c + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 24-Sep-1996 RMK Created + * 10-Oct-1996 RMK Brought up to date with arch-sa110eval + * 04-Dec-1997 RMK Updated for new arch/arm/time.c */ extern void ioctime_init(void); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/timex.h linux/include/asm-arm/arch-rpc/timex.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/timex.h Tue Jan 20 16:39:42 1998 +++ linux/include/asm-arm/arch-rpc/timex.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/arch-rpc/timex.h + * linux/include/asm-arm/arch-rpc/timex.h * - * RiscPC architecture timex specifications + * Copyright (C) 1997, 1998 Russell King * - * Copyright (C) 1997, 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * RiscPC architecture timex specifications */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/uncompress.h linux/include/asm-arm/arch-rpc/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/uncompress.h Sat May 8 11:06:57 1999 +++ linux/include/asm-arm/arch-rpc/uncompress.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/arch-a5k/uncompress.h + * linux/include/asm-arm/arch-rpc/uncompress.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define VIDMEM ((char *)SCREEN_START) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-rpc/vmalloc.h linux/include/asm-arm/arch-rpc/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-rpc/vmalloc.h Tue Apr 25 16:54:38 2000 +++ linux/include/asm-arm/arch-rpc/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/arch-rpc/vmalloc.h + * linux/include/asm-arm/arch-rpc/vmalloc.h + * + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/SA-1100.h linux/include/asm-arm/arch-sa1100/SA-1100.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/SA-1100.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-sa1100/SA-1100.h Mon Sep 18 15:15:23 2000 @@ -2417,8 +2417,8 @@ (0xF << FShft (DDAR_DS)) #define DDAR_DA Fld (24, 8) /* Device Address */ #define DDAR_DevAdd(Add) /* Device Address */ \ - ((Add) & 0xF0000000 | \ - ((Add) & 0X003FFFFC) << (FShft (DDAR_DA) - 2)) + (((Add) & 0xF0000000) | \ + (((Add) & 0X003FFFFC) << (FShft (DDAR_DA) - 2))) #define DDAR_Ser0UDCWr /* Ser. port 0 UDC Write */ \ (DDAR_DevWr + DDAR_Brst8 + DDAR_8BitDev + \ DDAR_Ser0UDCTr + DDAR_DevAdd (_Ser0UDCDR)) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/assabet.h linux/include/asm-arm/arch-sa1100/assabet.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/assabet.h Mon Jun 19 17:59:35 2000 +++ linux/include/asm-arm/arch-sa1100/assabet.h Mon Sep 18 15:15:23 2000 @@ -28,7 +28,7 @@ /* Board Control Register */ -#define BCR_BASE 0xdc000000 +#define BCR_BASE 0xf1000000 #define BCR (*(volatile unsigned int *)(BCR_BASE)) #define BCR_DB1110 (0x00A07410) @@ -105,8 +105,8 @@ #define NEPONSET_USAR_IRQ MISC_IRQ1 #define NEPONSET_CPLD_BASE (0x10000000) -#define Nep_p2v( x ) ((x) - NEPONSET_CPLD_BASE + 0xd4000000) -#define Nep_v2p( x ) ((x) - 0xd4000000 + NEPONSET_CPLD_BASE) +#define Nep_p2v( x ) ((x) - NEPONSET_CPLD_BASE + 0xf0000000) +#define Nep_v2p( x ) ((x) - 0xf0000000 + NEPONSET_CPLD_BASE) #define _IRR 0x10000024 /* Interrupt Reason Register */ #define _AUD_CTL 0x100000c0 /* Audio controls (RW) */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/bitsy.h linux/include/asm-arm/arch-sa1100/bitsy.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/bitsy.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-sa1100/bitsy.h Mon Sep 18 15:15:23 2000 @@ -38,6 +38,7 @@ #define EGPIO_BITSY_LVDD_ON (1 << 15) /* enable 9V and -6.5V to LCD. */ #ifndef __ASSEMBLY__ +#define BITSY_EGPIO (*(volatile int *)0xf0000000) extern void clr_bitsy_egpio(unsigned long x); extern void set_bitsy_egpio(unsigned long x); #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/cerf.h linux/include/asm-arm/arch-sa1100/cerf.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/cerf.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-sa1100/cerf.h Mon Sep 18 15:15:23 2000 @@ -12,5 +12,8 @@ #define IRQ_GPIO_CF_BVD2 IRQ_GPIO19 #define IRQ_GPIO_CF_BVD1 IRQ_GPIO20 +#define GPIO_UCB1200_IRQ GPIO_GPIO (18) +#define IRQ_GPIO_UCB1200_IRQ IRQ_GPIO18 + #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/hardware.h linux/include/asm-arm/arch-sa1100/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-sa1100/hardware.h Mon Sep 18 15:15:23 2000 @@ -13,17 +13,28 @@ #define __ASM_ARCH_HARDWARE_H #include +#include + /* Flushing areas */ #define FLUSH_BASE_PHYS 0xe0000000 /* SA1100 zero bank */ -#define FLUSH_BASE 0xdf000000 -#define FLUSH_BASE_MINICACHE 0xdf800000 +#define FLUSH_BASE 0xf5000000 +#define FLUSH_BASE_MINICACHE 0xf5800000 #define UNCACHEABLE_ADDR 0xfa050000 /* - * We requires absolute addresses i.e. (0xe00000 + 0x3f8) for in*()/out*() - * macros to be useful for all cases. + * Those are statically mapped PCMCIA IO space for designs using it as a + * generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc. + * The actual PCMCIA code is mapping required IO region at run time. + */ +#define PCMCIA_IO_0_BASE 0xf6000000 +#define PCMCIA_IO_1_BASE 0xf7000000 + + +/* + * We requires absolute addresses i.e. (PCMCIA_IO_0_BASE + 0x3f8) for + * in*()/out*() macros to be usable for all cases. */ #define PCIO_BASE 0 @@ -37,8 +48,6 @@ * 90000000 fa000000 * a0000000 fc000000 * b0000000 fe000000 - * - * Nb: PCMCIA is mapped from 0xe0000000 to f7ffffff in mm-sa1100.c */ #define VIO_BASE 0xf8000000 /* virtual start of IO space */ @@ -89,20 +98,24 @@ #include "bitsy.h" #endif -#if defined(CONFIG_SA1100_GRAPHICSCLIENT) || defined(CONFIG_SA1100_THINCLIENT) +#if defined(CONFIG_SA1100_THINCLIENT) #include "thinclient.h" #endif +#if defined(CONFIG_SA1100_GRAPHICSCLIENT) +#include "graphicsclient.h" +#endif + #ifdef CONFIG_SA1101 /* * We have mapped the sa1101 depending on the value of SA1101_BASE. - * It then appears from 0xdc000000. + * It then appears from 0xf4000000. */ -#define SA1101_p2v( x ) ((x) - SA1101_BASE + 0xdc000000) -#define SA1101_v2p( x ) ((x) - 0xdc000000 + SA1101_BASE) +#define SA1101_p2v( x ) ((x) - SA1101_BASE + 0xf4000000) +#define SA1101_v2p( x ) ((x) - 0xf4000000 + SA1101_BASE) #include "SA-1101.h" @@ -111,8 +124,8 @@ #ifdef CONFIG_SA1111 -#define SA1111_p2v( x ) ((x) - SA1111_BASE + 0xd8000000) -#define SA1111_v2p( x ) ((x) - 0xd8000000 + SA1111_BASE) +#define SA1111_p2v( x ) ((x) - SA1111_BASE + 0xf4000000) +#define SA1111_v2p( x ) ((x) - 0xf4000000 + SA1111_BASE) #include "SA-1111.h" diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/ide.h linux/include/asm-arm/arch-sa1100/ide.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/ide.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-sa1100/ide.h Mon Sep 18 15:15:23 2000 @@ -3,14 +3,22 @@ * * Copyright (c) 1998 Hugo Fiennes & Nicolas Pitre * + * 18-aug-2000: Cleanup by Erik Mouw (J.A.K.Mouw@its.tudelft.nl) + * Get rid of the special ide_init_hwif_ports() functions + * and make a generalised function that can be used by all + * architectures. */ #include - #include #include #include + +#define PCMCIA_IO_0_BASE 0xe0000000 +#define PCMCIA_IO_1_BASE 0xe4000000 + + /* * Set up a hw structure for a specified data port, control port and IRQ. * This should follow whatever the default interface uses. @@ -20,47 +28,33 @@ { ide_ioreg_t reg; int i; - int ioshift = 0; - + int regincr = 1; + /* The Empeg board has the first two address lines unused */ if (machine_is_empeg()) - ioshift = 2; - + regincr = 1 << 2; + + /* The LART doesn't use A0 for IDE */ + if (machine_is_lart()) + regincr = 1 << 1; + memset(hw, 0, sizeof(*hw)); - reg = (ide_ioreg_t) (data_port << ioshift); + reg = (ide_ioreg_t)data_port; + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw->io_ports[i] = reg; - reg += (1 << ioshift); + reg += regincr; } - hw->io_ports[IDE_CONTROL_OFFSET] = - (ide_ioreg_t) (ctrl_port << ioshift); + hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; if (irq) *irq = 0; } -/* - * Special case for the empeg board which has the first two - * address lines unused - */ -static __inline__ void -empeg_ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port) -{ - ide_ioreg_t reg; - int i; - memset(hw, 0, sizeof(*hw)); - reg = (ide_ioreg_t) (0xe0000000 + (data_port << 2)); - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += (1 << 2); - } - hw->io_ports[IDE_CONTROL_OFFSET] = - (ide_ioreg_t) (0xe0000000 + (ctrl_port << 2)); -} /* * This registers the standard ports for this architecture with the IDE @@ -92,10 +86,10 @@ /* MAC 23/4/1999, swap these round so that the left hand hard disk is hda when viewed from the front. This doesn't match the silkscreen however. */ - empeg_ide_init_hwif_ports(&hw,0x10,0x1e); + ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x40, PCMCIA_IO_0_BASE + 0x78, NULL); hw.irq = EMPEG_IRQ_IDE2; ide_register_hw(&hw, NULL); - empeg_ide_init_hwif_ports(&hw,0x00,0x0e); + ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x00, PCMCIA_IO_0_BASE + 0x38, NULL); hw.irq = ,EMPEG_IRQ_IDE1; ide_register_hw(&hw, NULL); #endif @@ -112,7 +106,7 @@ /* set the pcmcia interface timing */ MECR = 0x00060006; - ide_init_hwif_ports(&hw, 0xe00001f0, 0xe00003f6, NULL); + ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x1f0, PCMCIA_IO_0_BASE + 0x3f6, NULL); hw.irq = IRQ_GPIO7; ide_register_hw(&hw, NULL); #endif @@ -129,8 +123,7 @@ MECR = 0x00060006; /* init the interface */ -/* ide_init_hwif_ports(&hw, 0xe00000000, 0xe00001000, NULL); */ - ide_init_hwif_ports(&hw, 0xe00001000, 0xe00000000, NULL); + ide_init_hwif_ports(&hw, PCMCIA_IO_0_BASE + 0x0000, PCMCIA_IO_0_BASE + 0x1000, NULL); hw.irq = IRQ_GPIO1; ide_register_hw(&hw, NULL); #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/memory.h linux/include/asm-arm/arch-sa1100/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/memory.h Thu Jan 13 13:30:31 2000 +++ linux/include/asm-arm/arch-sa1100/memory.h Mon Sep 18 15:15:23 2000 @@ -24,22 +24,22 @@ */ #define PHYS_OFFSET (0xc0000000UL) - -#define __virt_to_phys__is_a_macro -#define __phys_to_virt__is_a_macro - /* - * The following gives a maximum memory size of 128MB (32MB in each bank). + * We take advantage of the fact that physical and virtual address can be the + * same. The NUMA code is handling the large holes that might exist between + * all memory banks. */ -#define __virt_to_phys(x) (((x) & 0xf9ffffff) | ((x) & 0x06000000) << 2) -#define __phys_to_virt(x) (((x) & 0xe7ffffff) | ((x) & 0x18000000) >> 2) +#define __virt_to_phys__is_a_macro +#define __phys_to_virt__is_a_macro +#define __virt_to_phys(x) (x) +#define __phys_to_virt(x) (x) /* * Virtual view <-> DMA view memory address translations * virt_to_bus: Used to translate the virtual address to an - * address suitable to be passed to set_dma_addr + * address suitable to be passed to set_dma_addr * bus_to_virt: Used to convert an address for DMA operations - * to an address that the kernel can use. + * to an address that the kernel can use. * * On the SA1100, bus addresses are equivalent to physical addresses. */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/mmzone.h linux/include/asm-arm/arch-sa1100/mmzone.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/mmzone.h Wed Aug 9 13:46:01 2000 +++ linux/include/asm-arm/arch-sa1100/mmzone.h Mon Sep 18 15:15:23 2000 @@ -11,6 +11,14 @@ * * Of course, all this isn't mandatory for SA1100 implementations with only * one used memory bank. For those, simply undefine CONFIG_DISCONTIGMEM. + * + * The nodes are matched with the physical memory bank addresses which are + * incidentally the same as virtual addresses. + * + * node 0: 0xc0000000 - 0xc7ffffff + * node 1: 0xc8000000 - 0xcfffffff + * node 2: 0xd0000000 - 0xd7ffffff + * node 3: 0xd8000000 - 0xdfffffff */ @@ -20,18 +28,6 @@ extern pg_data_t sa1100_node_data[]; /* - * 32MB max in each bank, must fit with __virt_to_phys() & __phys_to_virt() - */ -#define NODE_MAX_MEM_SHIFT 25 -#define NODE_MAX_MEM_SIZE (1<> NODE_MAX_MEM_SHIFT) - -/* * Return a pointer to the node data for node n. */ #define NODE_DATA(nid) (&sa1100_node_data[nid]) @@ -42,11 +38,10 @@ #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) /* - * Given a mem_map_t, LOCAL_MAP_BASE finds the owning node for the - * physical page and returns the kaddr for the mem_map of that node. + * Given a kernel address, find the home node of the underlying memory. */ -#define LOCAL_MAP_BASE(page) \ - NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(page))) +#define KVADDR_TO_NID(addr) \ + (((unsigned long)(addr) & 0x18000000) >> 27) /* * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory @@ -56,28 +51,22 @@ NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr))) /* - * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory - * and returns the kaddr corresponding to first physical page in the - * node's mem_map. - */ -#define LOCAL_BASE_ADDR(kaddr) ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1)) - -/* * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory * and returns the index corresponding to the appropriate page in the * node's mem_map. */ #define LOCAL_MAP_NR(kvaddr) \ - (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT) + (((unsigned long)(kvaddr) & 0x07ffffff) >> PAGE_SHIFT) -/* - * With discontigmem, the conceptual mem_map array starts from PAGE_OFFSET. - * Given a kaddr, MAP_NR returns the appropriate global mem_map index so - * it matches the corresponding node's local mem_map. - */ -#define MAP_NR(kaddr) (LOCAL_MAP_NR((kaddr)) + \ - (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \ - sizeof(mem_map_t))) +/* + * Given a kaddr, virt_to_page returns a pointer to the corresponding + * mem_map entry. + */ +#define virt_to_page(kaddr) \ + (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)) + +/* + * Didn't find the best way to validate a page pointer yet... + */ -#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) -#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) +#define VALID_PAGE(page) (1) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/system.h linux/include/asm-arm/arch-sa1100/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-sa1100/system.h Mon Sep 18 15:15:23 2000 @@ -5,13 +5,10 @@ */ #include -static void arch_idle(void) +static inline void arch_idle(void) { - while (!current->need_resched && !hlt_counter) { - cpu_do_idle(IDLE_CLOCK_SLOW); - cpu_do_idle(IDLE_WAIT_FAST); - cpu_do_idle(IDLE_CLOCK_FAST); - } + while (!current->need_resched && !hlt_counter) + cpu_do_idle(0); } #ifdef CONFIG_SA1100_VICTOR diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/thinclient.h linux/include/asm-arm/arch-sa1100/thinclient.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/thinclient.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-sa1100/thinclient.h Mon Sep 18 15:15:23 2000 @@ -13,8 +13,8 @@ #define ADS_CPLD_BASE (0x10000000) -#define ADS_p2v( x ) ((x) - ADS_CPLD_BASE + 0xdc000000) -#define ADS_v2p( x ) ((x) - 0xdc000000 + ADS_CPLD_BASE) +#define ADS_p2v( x ) ((x) - ADS_CPLD_BASE + 0xf0000000) +#define ADS_v2p( x ) ((x) - 0xf0000000 + ADS_CPLD_BASE) /* Parallel Port */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-sa1100/vmalloc.h linux/include/asm-arm/arch-sa1100/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-sa1100/vmalloc.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/arch-sa1100/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -13,4 +13,4 @@ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (PAGE_OFFSET + 0x10000000) +#define VMALLOC_END (0xe8000000) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/hardware.h linux/include/asm-arm/arch-shark/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/hardware.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/arch-shark/hardware.h Mon Sep 18 15:15:23 2000 @@ -20,7 +20,7 @@ /* * RAM definitions */ -#define FLUSH_BASE_PHYS 0x60000000 +#define FLUSH_BASE_PHYS 0x80000000 #else @@ -28,22 +28,26 @@ #endif -#define IO_SIZE 0x10000000 +#define IO_SIZE 0x08000000 #define IO_START 0x40000000 +#define ROMCARD_SIZE 0x08000000 +#define ROMCARD_START 0x10000000 #define FLUSH_BASE 0xdf000000 #define PCIO_BASE 0xe0000000 /* defines for the Framebuffer */ -#define FB_BASE 0xd0000000 #define FB_START 0x06000000 -#define FB_SIZE 0x00200000 /* Registers for Framebuffer */ -#define FBREG_BASE (FB_BASE + FB_SIZE) -#define FBREG_START 0x06800000 -#define FBREG_SIZE 0x000c0000 +/*#define FBREG_START 0x06800000*/ + +#define UNCACHEABLE_ADDR 0xdf010000 + +#define SEQUOIA_LED_GREEN (1<<6) +#define SEQUOIA_LED_AMBER (1<<5) +#define SEQUOIA_LED_BACK (1<<7) #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/io.h linux/include/asm-arm/arch-shark/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/io.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/arch-shark/io.h Mon Sep 18 15:15:23 2000 @@ -11,6 +11,8 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H +#define __arch_ioremap(off,size,nocache) __ioremap(off,size,0) + #define IO_SPACE_LIMIT 0xffffffff /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/keyboard.h linux/include/asm-arm/arch-shark/keyboard.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/keyboard.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/arch-shark/keyboard.h Mon Sep 18 15:15:23 2000 @@ -1,8 +1,8 @@ /* - * linux/include/asm-arm/arch-ebsa285/keyboard.h - * - * Keyboard driver definitions for EBSA285 architecture - * + * linux/include/asm-arm/arch-shark/keyboard.h + * by Alexander.Schulz@stud.uni-karlsruhe.de + * + * Derived from linux/include/asm-arm/arch-ebsa285/keyboard.h * (C) 1998 Russell King * (C) 1998 Phil Blundell */ @@ -24,45 +24,12 @@ #define NR_SCANCODES 128 -#define kbd_setkeycode(sc,kc) \ - ({ \ - int __ret; \ - if (have_isa_bridge) \ - __ret = pckbd_setkeycode(sc,kc);\ - else \ - __ret = -EINVAL; \ - __ret; \ - }) - -#define kbd_getkeycode(sc) \ - ({ \ - int __ret; \ - if (have_isa_bridge) \ - __ret = pckbd_getkeycode(sc); \ - else \ - __ret = -EINVAL; \ - __ret; \ - }) - -#define kbd_translate(sc, kcp, rm) \ - ({ \ - pckbd_translate(sc, kcp, rm); \ - }) - +#define kbd_setkeycode(sc,kc) pckbd_setkeycode(sc,kc) +#define kbd_getkeycode(sc) pckbd_getkeycode(sc) +#define kbd_translate(sc, kcp, rm) pckbd_translate(sc, kcp, rm) #define kbd_unexpected_up pckbd_unexpected_up - -#define kbd_leds(leds) \ - do { \ - if (have_isa_bridge) \ - pckbd_leds(leds); \ - } while (0) - -#define kbd_init_hw() \ - do { \ - if (have_isa_bridge) \ - pckbd_init_hw(); \ - } while (0) - +#define kbd_leds(leds) pckbd_leds(leds) +#define kbd_init_hw() pckbd_init_hw() #define kbd_sysrq_xlate pckbd_sysrq_xlate #define kbd_disable_irq() diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/system.h linux/include/asm-arm/arch-shark/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/system.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/arch-shark/system.h Mon Sep 18 15:15:23 2000 @@ -6,12 +6,19 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H +#include + static void arch_reset(char mode) { - /* - * loop endlessly - */ + short temp; cli(); + /* Reset the Machine via pc[3] of the sequoia chipset */ + outw(0x09,0x24); + temp=inw(0x26); + temp = temp | (1<<3) | (1<<10); + outw(0x09,0x24); + outw(temp,0x26); + } static void arch_idle(void) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/time.h linux/include/asm-arm/arch-shark/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/time.h Mon Jun 19 17:59:35 2000 +++ linux/include/asm-arm/arch-shark/time.h Mon Sep 18 15:15:23 2000 @@ -43,15 +43,6 @@ } } -static struct irqaction timerirq = { - timer_interrupt, - SA_INTERRUPT, - 0, - "timer", - NULL, - NULL -}; - /* * Set up timer interrupt, and return the current time in seconds. */ @@ -88,5 +79,7 @@ xtime.tv_sec = mktime(r_time.tm_year+epoch, r_time.tm_mon+1, r_time.tm_mday, r_time.tm_hour, r_time.tm_min, r_time.tm_sec); - setup_arm_irq(IRQ_TIMER, &timerirq); + timer_irq.handler = timer_interrupt; + timer_irq.flags = SA_INTERRUPT; /* FIXME: really? */ + setup_arm_irq(IRQ_TIMER, &timer_irq); } diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-shark/vmalloc.h linux/include/asm-arm/arch-shark/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-shark/vmalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-shark/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,17 @@ +/* + * linux/include/asm-arm/arch-rpc/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/dma.h linux/include/asm-arm/arch-tbox/dma.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/dma.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/dma.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,37 @@ +/* + * linux/include/asm-arm/arch-tbox/dma.h + * + * Architecture DMA routines. We have to contend with the bizarre DMA + * machine built into the Tbox hardware. + * + * Copyright (C) 1998 Philip Blundell + */ + +/* + * 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. + */ + +/* + * DMA channel definitions. Some of these are physically strange but + * we sort it out inside dma.c so the user never has to care. The + * exception is the double-buffering which we can't really abstract + * away sensibly. + */ +#define DMA_VIDEO 0 +#define DMA_MPEG_B 1 +#define DMA_AUDIO_B 2 +#define DMA_ASHRX_B 3 +#define DMA_ASHTX 4 +#define DMA_MPEG 5 +#define DMA_AUDIO 6 +#define DMA_ASHRX 7 + +#define MAX_DMA_CHANNELS 0 /* XXX */ + +/* + * This is the maximum DMA address that can be DMAd to. + */ +#define MAX_DMA_ADDRESS 0xffffffff diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/hardware.h linux/include/asm-arm/arch-tbox/hardware.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/hardware.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/hardware.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,60 @@ +/* + * linux/include/asm-arm/arch-tbox/hardware.h + * + * Copyright (C) 1998, 1999, 2000 Philip Blundell + * Copyright (C) 2000 FutureTV Labs Ltd + * + * This file contains the hardware definitions of the Tbox + */ + +/* + * 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. + */ + +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/* Logical Physical + * 0xfff00000 0x00100000 I/O + * 0xfff00000 0x00100000 Expansion CS0 + * 0xfff10000 0x00110000 DMA + * 0xfff20000 0x00120000 C-Cube + * 0xfff30000 0x00130000 FPGA 1 + * 0xfff40000 0x00140000 UART 2 + * 0xfff50000 0x00150000 UART 1 + * 0xfff60000 0x00160000 CS8900 + * 0xfff70000 0x00170000 INTCONT + * 0xfff80000 0x00180000 RAMDAC + * 0xfff90000 0x00190000 Control 0 + * 0xfffa0000 0x001a0000 Control 1 + * 0xfffb0000 0x001b0000 Control 2 + * 0xfffc0000 0x001c0000 FPGA 2 + * 0xfffd0000 0x001d0000 INTRESET + * 0xfffe0000 0x001e0000 C-Cube DMA throttle + * 0xffff0000 0x001f0000 Expansion CS1 + * 0xffe00000 0x82000000 cache flush + */ + +/* + * Mapping areas + */ +#define IO_BASE 0xfff00000 +#define IO_START 0x00100000 +#define FLUSH_BASE 0xffe00000 + +#define INTCONT 0xfff70000 + +#define FPGA1CONT 0xffff3000 + +/* + * RAM definitions + */ +#define RAM_BASE 0x80000000 +#define FLUSH_BASE_PHYS 0x82000000 + +#define UNCACHEABLE_ADDR INTCONT + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/ide.h linux/include/asm-arm/arch-tbox/ide.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/ide.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/ide.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,3 @@ +/* + * linux/include/asm-arm/arch-tbox/ide.h + */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/io.h linux/include/asm-arm/arch-tbox/io.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/io.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/io.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,55 @@ +/* + * linux/include/asm-arm/arch-tbox/io.h + * + * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1998, 1999 Philip Blundell + * + */ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +#define __io_pc(_x) ((_x) << 2) + +/* + * Generic virtual read/write + */ +#define __arch_getb(a) (*(volatile unsigned char *)(a)) +#define __arch_getl(a) (*(volatile unsigned long *)(a)) + +extern __inline__ unsigned int __arch_getw(unsigned long a) +{ + unsigned int value; + __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw" + : "=&r" (value) + : "r" (a)); + return value; +} + + +#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v)) +#define __arch_putl(v,a) (*(volatile unsigned long *)(a) = (v)) + +extern __inline__ void __arch_putw(unsigned int value, unsigned long a) +{ + __asm__ __volatile__("str%?h %0, [%1, #0] @ putw" + : : "r" (value), "r" (a)); +} + +#define inb(p) __arch_getb(__io_pc(p)) +#define inw(p) __arch_getw(__io_pc(p)) +#define inl(p) __arch_getl(__io_pc(p)) + +#define outb(v,p) __arch_putb(v,__io_pc(p)) +#define outw(v,p) __arch_putw(v,__io_pc(p)) +#define outl(v,p) __arch_putl(v,__io_pc(p)) + +/* Idem, for devices on the upper byte lanes */ +#define inb_u(p) __arch_getb(__io_pc(p) + 2) +#define inw_u(p) __arch_getw(__io_pc(p) + 2) + +#define outb_u(v,p) __arch_putb(v,__io_pc(p) + 2) +#define outw_u(v,p) __arch_putw(v,__io_pc(p) + 2) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/irq.h linux/include/asm-arm/arch-tbox/irq.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/irq.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/irq.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,50 @@ +/* + * include/asm-arm/arch-tbox/irq.h + * + * Copyright (C) 1998, 1999, 2000 Philip Blundell + */ + +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include + +#define fixup_irq(x) (x) + +extern unsigned long soft_irq_mask; + +static void tbox_mask_irq(unsigned int irq) +{ + __raw_writel(0, INTCONT + (irq << 2)); + soft_irq_mask &= ~(1<= 12 && i <= 13)) { + irq_desc[i].valid = 1; + irq_desc[i].probe_ok = 0; + irq_desc[i].mask_ack = tbox_mask_irq; + irq_desc[i].mask = tbox_mask_irq; + irq_desc[i].unmask = tbox_unmask_irq; + tbox_mask_irq(i); + } else { + irq_desc[i].valid = 0; + irq_desc[i].probe_ok = 0; + } + } +} diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/irqs.h linux/include/asm-arm/arch-tbox/irqs.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/irqs.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/irqs.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-tbox/irqs.h + * + * Copyright (C) 1998, 2000 Philip Blundell + */ + +/* + * 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. + */ + +#define IRQ_MPEGDMA 0 +#define IRQ_ASHTX 1 +#define IRQ_ASHRX 2 +#define IRQ_VSYNC 3 +#define IRQ_HSYNC 4 +#define IRQ_MPEG 5 +#define IRQ_UART2 6 +#define IRQ_UART1 7 +#define IRQ_ETHERNET 8 +#define IRQ_TIMER 9 +#define IRQ_AUDIODMA 10 +/* bit 11 used for video field ident */ +#define IRQ_EXPMODCS0 12 +#define IRQ_EXPMODCS1 13 + +#define irq_cannonicalize(i) (i) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/keyboard.h linux/include/asm-arm/arch-tbox/keyboard.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/keyboard.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/keyboard.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-tbox/keyboard.h + * + * Driver definitions for Tbox dummy keyboard. + * + * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Philip Blundell + */ + +#define NR_SCANCODES 128 + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +/* Prototype: int kbd_pretranslate(scancode, raw_mode) + * Returns : 0 to ignore scancode + */ +#define kbd_pretranslate(sc,rm) (1) + +/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) + * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag + * set to 0200 if scancode indicates release + */ +#define kbd_translate(sc, kcp, rm) 0 +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) do { } while (0) +#define kbd_init_hw() do { } while (0) +#define kbd_disable_irq() do { } while (0) +#define kbd_enable_irq() do { } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/memory.h linux/include/asm-arm/arch-tbox/memory.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/memory.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/memory.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,38 @@ +/* + * linux/include/asm-arm/arch-tbox/memory.h + * + * Copyright (c) 1996-1999 Russell King. + * Copyright (c) 1998-1999 Phil Blundell + */ +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) +#define TASK_SIZE_26 (0x04000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) +#define PHYS_OFFSET (0x80000000UL) + +/* + * DRAM is contiguous + */ +#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET) +#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET) +#define __virt_to_phys__is_a_macro +#define __phys_to_virt__is_a_macro + +/* + * Bus view is the same as physical view + */ +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/param.h linux/include/asm-arm/arch-tbox/param.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/param.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/param.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1 @@ +#define HZ 1000 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/processor.h linux/include/asm-arm/arch-tbox/processor.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/processor.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/processor.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,24 @@ +/* + * linux/include/asm-arm/arch-tbox/processor.h + * from linux/include/asm-arm/arch-ebsa110/processor.h + * + * Copyright (C) 1996,1997,1998 Russell King + */ + +#ifndef __ASM_ARCH_PROCESSOR_H +#define __ASM_ARCH_PROCESSOR_H + +/* + * Bus types + */ +#define EISA_bus 0 +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/serial.h linux/include/asm-arm/arch-tbox/serial.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/serial.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/serial.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,34 @@ +/* + * linux/include/asm-arm/arch-tbox/serial.h + * + * Copyright (c) 1996 Russell King. + * Copyright (c) 1998 Phil Blundell + * + * Changelog: + * 15-10-1996 RMK Created + * 09-06-1998 PJB tbox version + */ +#ifndef __ASM_ARCH_SERIAL_H +#define __ASM_ARCH_SERIAL_H + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD (1843200 / 16) + +#define RS_TABLE_SIZE 2 + +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) + + /* UART CLK PORT IRQ FLAGS */ +#define STD_SERIAL_PORT_DEFNS \ + { 0, BASE_BAUD, 0xffff4000 >> 2, 6, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0xffff5000 >> 2, 7, STD_COM_FLAGS }, /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/system.h linux/include/asm-arm/arch-tbox/system.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/system.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/system.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,33 @@ +/* + * linux/include/asm-arm/arch-tbox/system.h + * + * Copyright (c) 1996-1999 Russell King. + */ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +static void arch_idle(void) +{ + unsigned long start_idle; + + start_idle = jiffies; + + do { + if (current->need_resched || hlt_counter) + goto slow_out; + cpu_do_idle(IDLE_WAIT_FAST); + } while (time_before(jiffies, start_idle + HZ/50)); + + cpu_do_idle(IDLE_CLOCK_SLOW); + + while (!current->need_resched && !hlt_counter) { + cpu_do_idle(IDLE_WAIT_SLOW); + } + + cpu_do_idle(IDLE_CLOCK_FAST); +slow_out: +} + +#define arch_reset(mode) do { } while (0) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/time.h linux/include/asm-arm/arch-tbox/time.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/time.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/time.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,36 @@ +/* + * linux/include/asm-arm/arch-tbox/time.h + * + * Copyright (c) 1997, 1999 Phil Blundell. + * Copyright (c) 2000 FutureTV Labs Ltd + * + * Tbox has no real-time clock -- we get millisecond ticks to update + * our soft copy. + */ + +#include +#include + +#define update_rtc() + +static void timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) +{ + /* Clear irq */ + __raw_writel(1, FPGA1CONT + 0xc); + __raw_writel(0, FPGA1CONT + 0xc); + + do_timer(regs); +} + +extern __inline__ void setup_timer (void) +{ + /* + * Default the date to 1 Jan 1970 0:0:0 + * You will have to run a time daemon to set the + * clock correctly at bootup + */ + xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); + + timer_irq.handler = timer_interrupt; + setup_arm_irq(IRQ_TIMER, &timer_irq); +} diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/timex.h linux/include/asm-arm/arch-tbox/timex.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/timex.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/timex.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,8 @@ +/* + * linux/include/asm-arm/arch-tbox/timex.h + * + * Tbox timex specifications + * + * Copyright (C) 1999 Philip Blundell + */ + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/uncompress.h linux/include/asm-arm/arch-tbox/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/uncompress.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/uncompress.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,42 @@ +/* + * linux/include/asm-arm/arch-nexuspci/uncompress.h + * from linux/include/asm-arm/arch-ebsa110/uncompress.h + * + * Copyright (C) 1996,1997,1998 Russell King + * Copyright (C) 1998, 1999 Phil Blundell + */ + +#include + +#define UARTBASE 0x00400000 + +/* + * This does not append a newline + */ +static void puts(const char *s) +{ + while (*s) + { + char c = *(s++); + while (!(__raw_readb(UARTBASE + 0x14) & 0x20)); + __raw_writeb(c, UARTBASE); + if (c == 10) { + while (!(__raw_readb(UARTBASE + 0x14) & 0x20)); + __raw_writeb(13, UARTBASE); + } + } +} + +/* + * nothing to do + */ +#define arch_decomp_setup() + +/* + * Stroke the watchdog so we don't get reset during decompression. + */ +#define arch_decomp_wdog() \ + do { \ + __raw_writel(1, 0xa00000); \ + __raw_writel(0, 0xa00000); \ + } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/arch-tbox/vmalloc.h linux/include/asm-arm/arch-tbox/vmalloc.h --- v2.4.0-test8/linux/include/asm-arm/arch-tbox/vmalloc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/arch-tbox/vmalloc.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,17 @@ +/* + * linux/include/asm-arm/arch-rpc/vmalloc.h + */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/atomic.h linux/include/asm-arm/atomic.h --- v2.4.0-test8/linux/include/asm-arm/atomic.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/atomic.h Mon Sep 18 15:15:23 2000 @@ -1,13 +1,17 @@ /* - * linux/include/asm-arm/atomic.h + * linux/include/asm-arm/atomic.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996 Russell King. * - * Changelog: - * 27-06-1996 RMK Created - * 13-04-1997 RMK Made functions atomic! - * 07-12-1997 RMK Upgraded for v2.1. - * 26-08-1998 PJB Added #ifdef __KERNEL__ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 27-06-1996 RMK Created + * 13-04-1997 RMK Made functions atomic! + * 07-12-1997 RMK Upgraded for v2.1. + * 26-08-1998 PJB Added #ifdef __KERNEL__ */ #ifndef __ASM_ARM_ATOMIC_H #define __ASM_ARM_ATOMIC_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/bugs.h linux/include/asm-arm/bugs.h --- v2.4.0-test8/linux/include/asm-arm/bugs.h Mon Aug 30 18:15:21 1999 +++ linux/include/asm-arm/bugs.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * include/asm-arm/bugs.h + * linux/include/asm-arm/bugs.h * * Copyright (C) 1995 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_BUGS_H #define __ASM_BUGS_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/cache.h linux/include/asm-arm/cache.h --- v2.4.0-test8/linux/include/asm-arm/cache.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/cache.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/cache.h + * linux/include/asm-arm/cache.h */ #ifndef __ASMARM_CACHE_H #define __ASMARM_CACHE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/checksum.h linux/include/asm-arm/checksum.h --- v2.4.0-test8/linux/include/asm-arm/checksum.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/checksum.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/checksum.h + * linux/include/asm-arm/checksum.h * * IP checksum routines * diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/cpu-multi26.h linux/include/asm-arm/cpu-multi26.h --- v2.4.0-test8/linux/include/asm-arm/cpu-multi26.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/cpu-multi26.h Mon Sep 18 15:15:23 2000 @@ -1,3 +1,12 @@ +/* + * linux/include/asm-arm/cpu-multi26.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #ifndef __ASSEMBLY__ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/cpu-multi32.h linux/include/asm-arm/cpu-multi32.h --- v2.4.0-test8/linux/include/asm-arm/cpu-multi32.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/cpu-multi32.h Mon Sep 18 15:15:23 2000 @@ -1,3 +1,12 @@ +/* + * linux/include/asm-arm/cpu-multi32.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #ifndef __ASSEMBLY__ #include @@ -27,79 +36,91 @@ */ void (*_proc_fin)(void); /* - * Processor architecture specific - */ - /* CACHE - * - * flush all caches - */ - void (*_flush_cache_all)(void); - /* - * flush a specific page or pages - */ - void (*_flush_cache_area)(unsigned long address, unsigned long end, int flags); - /* - * flush cache entry for an address - */ - void (*_flush_cache_entry)(unsigned long address); - /* - * clean a virtual address range from the - * D-cache without flushing the cache. - */ - void (*_clean_cache_area)(unsigned long start, unsigned long size); - /* - * flush a page to RAM - */ - void (*_flush_ram_page)(unsigned long page); - /* TLB - * - * flush all TLBs - */ - void (*_flush_tlb_all)(void); - /* - * flush a specific TLB - */ - void (*_flush_tlb_area)(unsigned long address, unsigned long end, int flags); - /* - * Set the page table - */ - void (*_set_pgd)(unsigned long pgd_phys); - /* - * Set a PMD (handling IMP bit 4) - */ - void (*_set_pmd)(pmd_t *pmdp, pmd_t pmd); - /* - * Set a PTE - */ - void (*_set_pte)(pte_t *ptep, pte_t pte); - /* * Special stuff for a reset */ volatile void (*reset)(unsigned long addr); /* - * flush an icached page - */ - void (*_flush_icache_area)(unsigned long start, unsigned long size); - /* - * write back dirty cached data - */ - void (*_cache_wback_area)(unsigned long start, unsigned long end); - /* - * purge cached data without (necessarily) writing it back - */ - void (*_cache_purge_area)(unsigned long start, unsigned long end); - /* - * flush a specific TLB - */ - void (*_flush_tlb_page)(unsigned long address, int flags); - /* * Idle the processor */ int (*_do_idle)(int mode); /* - * flush I cache for a page + * Processor architecture specific */ - void (*_flush_icache_page)(unsigned long address); + struct { /* CACHE */ + /* + * flush all caches + */ + void (*clean_invalidate_all)(void); + /* + * flush a specific page or pages + */ + void (*clean_invalidate_range)(unsigned long address, unsigned long end, int flags); + /* + * flush a page to RAM + */ + void (*_flush_ram_page)(void *virt_page); + } cache; + + struct { /* D-cache */ + /* + * invalidate the specified data range + */ + void (*invalidate_range)(unsigned long start, unsigned long end); + /* + * clean specified data range + */ + void (*clean_range)(unsigned long start, unsigned long end); + /* + * obsolete flush cache entry + */ + void (*clean_page)(void *virt_page); + /* + * clean a virtual address range from the + * D-cache without flushing the cache. + */ + void (*clean_entry)(unsigned long start); + } dcache; + + struct { /* I-cache */ + /* + * invalidate the I-cache for the specified range + */ + void (*invalidate_range)(unsigned long start, unsigned long end); + /* + * invalidate the I-cache for the specified virtual page + */ + void (*invalidate_page)(void *virt_page); + } icache; + + struct { /* TLB */ + /* + * flush all TLBs + */ + void (*invalidate_all)(void); + /* + * flush a specific TLB + */ + void (*invalidate_range)(unsigned long address, unsigned long end); + /* + * flush a specific TLB + */ + void (*invalidate_page)(unsigned long address, int flags); + } tlb; + + struct { /* PageTable */ + /* + * Set the page table + */ + void (*set_pgd)(unsigned long pgd_phys); + /* + * Set a PMD (handling IMP bit 4) + */ + void (*set_pmd)(pmd_t *pmdp, pmd_t pmd); + /* + * Set a PTE + */ + void (*set_pte)(pte_t *ptep, pte_t pte); + } pgtable; } processor; extern const struct processor arm6_processor_functions; @@ -110,24 +131,28 @@ #define cpu_check_bugs() processor._check_bugs() #define cpu_proc_init() processor._proc_init() #define cpu_proc_fin() processor._proc_fin() +#define cpu_reset(addr) processor.reset(addr) #define cpu_do_idle(mode) processor._do_idle(mode) -#define cpu_flush_cache_all() processor._flush_cache_all() -#define cpu_flush_cache_area(start,end,flags) processor._flush_cache_area(start,end,flags) -#define cpu_flush_cache_entry(addr) processor._flush_cache_entry(addr) -#define cpu_clean_cache_area(start,size) processor._clean_cache_area(start,size) -#define cpu_flush_ram_page(page) processor._flush_ram_page(page) -#define cpu_flush_tlb_all() processor._flush_tlb_all() -#define cpu_flush_tlb_area(start,end,flags) processor._flush_tlb_area(start,end,flags) -#define cpu_flush_tlb_page(addr,flags) processor._flush_tlb_page(addr,flags) -#define cpu_set_pgd(pgd) processor._set_pgd(pgd) -#define cpu_set_pmd(pmdp, pmd) processor._set_pmd(pmdp, pmd) -#define cpu_set_pte(ptep, pte) processor._set_pte(ptep, pte) -#define cpu_reset(addr) processor.reset(addr) -#define cpu_flush_icache_area(start,end) processor._flush_icache_area(start,end) -#define cpu_cache_wback_area(start,end) processor._cache_wback_area(start,end) -#define cpu_cache_purge_area(start,end) processor._cache_purge_area(start,end) -#define cpu_flush_icache_page(virt) processor._flush_icache_page(virt) +#define cpu_cache_clean_invalidate_all() processor.cache.clean_invalidate_all() +#define cpu_cache_clean_invalidate_range(s,e,f) processor.cache.clean_invalidate_range(s,e,f) +#define cpu_flush_ram_page(vp) processor.cache._flush_ram_page(vp) + +#define cpu_dcache_clean_page(vp) processor.dcache.clean_page(vp) +#define cpu_dcache_clean_entry(addr) processor.dcache.clean_entry(addr) +#define cpu_dcache_clean_range(s,e) processor.dcache.clean_range(s,e) +#define cpu_dcache_invalidate_range(s,e) processor.dcache.invalidate_range(s,e) + +#define cpu_icache_invalidate_range(s,e) processor.icache.invalidate_range(s,e) +#define cpu_icache_invalidate_page(vp) processor.icache.invalidate_page(vp) + +#define cpu_tlb_invalidate_all() processor.tlb.invalidate_all() +#define cpu_tlb_invalidate_range(s,e) processor.tlb.invalidate_range(s,e) +#define cpu_tlb_invalidate_page(vp,f) processor.tlb.invalidate_page(vp,f) + +#define cpu_set_pgd(pgd) processor.pgtable.set_pgd(pgd) +#define cpu_set_pmd(pmdp, pmd) processor.pgtable.set_pmd(pmdp, pmd) +#define cpu_set_pte(ptep, pte) processor.pgtable.set_pte(ptep, pte) #define cpu_switch_mm(pgd,tsk) cpu_set_pgd(__virt_to_phys((unsigned long)(pgd))) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/cpu-single.h linux/include/asm-arm/cpu-single.h --- v2.4.0-test8/linux/include/asm-arm/cpu-single.h Mon Mar 27 10:46:29 2000 +++ linux/include/asm-arm/cpu-single.h Mon Sep 18 15:15:23 2000 @@ -1,4 +1,13 @@ /* + * linux/include/asm-arm/cpu-single.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +/* * Single CPU */ #ifdef __STDC__ @@ -9,33 +18,36 @@ #define cpu_fn(name,x) __cpu_fn(name,x) /* - * If we are supporting multiple CPUs, then - * we must use a table of function pointers - * for this lot. Otherwise, we can optimise - * the table away. + * If we are supporting multiple CPUs, then we must use a table of + * function pointers for this lot. Otherwise, we can optimise the + * table away. */ #define cpu_data_abort cpu_fn(CPU_NAME,_data_abort) #define cpu_check_bugs cpu_fn(CPU_NAME,_check_bugs) #define cpu_proc_init cpu_fn(CPU_NAME,_proc_init) #define cpu_proc_fin cpu_fn(CPU_NAME,_proc_fin) +#define cpu_reset cpu_fn(CPU_NAME,_reset) #define cpu_do_idle cpu_fn(CPU_NAME,_do_idle) -#define cpu_flush_cache_all cpu_fn(CPU_NAME,_flush_cache_all) -#define cpu_flush_cache_area cpu_fn(CPU_NAME,_flush_cache_area) -#define cpu_flush_cache_entry cpu_fn(CPU_NAME,_flush_cache_entry) -#define cpu_clean_cache_area cpu_fn(CPU_NAME,_clean_cache_area) +#define cpu_cache_clean_invalidate_all cpu_fn(CPU_NAME,_cache_clean_invalidate_all) +#define cpu_cache_clean_invalidate_range cpu_fn(CPU_NAME,_cache_clean_invalidate_range) #define cpu_flush_ram_page cpu_fn(CPU_NAME,_flush_ram_page) -#define cpu_flush_tlb_all cpu_fn(CPU_NAME,_flush_tlb_all) -#define cpu_flush_tlb_area cpu_fn(CPU_NAME,_flush_tlb_area) -#define cpu_flush_tlb_page cpu_fn(CPU_NAME,_flush_tlb_page) + +#define cpu_dcache_invalidate_range cpu_fn(CPU_NAME,_dcache_invalidate_range) +#define cpu_dcache_clean_range cpu_fn(CPU_NAME,_dcache_clean_range) +#define cpu_dcache_clean_page cpu_fn(CPU_NAME,_dcache_clean_page) +#define cpu_dcache_clean_entry cpu_fn(CPU_NAME,_dcache_clean_entry) + +#define cpu_icache_invalidate_range cpu_fn(CPU_NAME,_icache_invalidate_range) +#define cpu_icache_invalidate_page cpu_fn(CPU_NAME,_icache_invalidate_page) + +#define cpu_tlb_invalidate_all cpu_fn(CPU_NAME,_tlb_invalidate_all) +#define cpu_tlb_invalidate_range cpu_fn(CPU_NAME,_tlb_invalidate_range) +#define cpu_tlb_invalidate_page cpu_fn(CPU_NAME,_tlb_invalidate_page) + #define cpu_set_pgd cpu_fn(CPU_NAME,_set_pgd) #define cpu_set_pmd cpu_fn(CPU_NAME,_set_pmd) #define cpu_set_pte cpu_fn(CPU_NAME,_set_pte) -#define cpu_reset cpu_fn(CPU_NAME,_reset) -#define cpu_flush_icache_area cpu_fn(CPU_NAME,_flush_icache_area) -#define cpu_cache_wback_area cpu_fn(CPU_NAME,_cache_wback_area) -#define cpu_cache_purge_area cpu_fn(CPU_NAME,_cache_purge_area) -#define cpu_flush_icache_page cpu_fn(CPU_NAME,_flush_icache_page) #ifndef __ASSEMBLY__ @@ -51,22 +63,26 @@ extern void cpu_proc_fin(void); extern int cpu_do_idle(int mode); -extern void cpu_flush_cache_all(void); -extern void cpu_flush_cache_area(unsigned long address, unsigned long end, int flags); -extern void cpu_flush_cache_entry(unsigned long address); -extern void cpu_clean_cache_area(unsigned long start, unsigned long size); -extern void cpu_flush_ram_page(unsigned long page); -extern void cpu_flush_tlb_all(void); -extern void cpu_flush_tlb_area(unsigned long address, unsigned long end, int flags); -extern void cpu_flush_tlb_page(unsigned long address, int flags); +extern void cpu_cache_clean_invalidate_all(void); +extern void cpu_cache_clean_invalidate_range(unsigned long address, unsigned long end, int flags); +extern void cpu_flush_ram_page(void *virt_page); + +extern void cpu_dcache_invalidate_range(unsigned long start, unsigned long end); +extern void cpu_dcache_clean_range(unsigned long start, unsigned long end); +extern void cpu_dcache_clean_page(void *virt_page); +extern void cpu_dcache_clean_entry(unsigned long address); + +extern void cpu_icache_invalidate_range(unsigned long start, unsigned long end); +extern void cpu_icache_invalidate_page(void *virt_page); + +extern void cpu_tlb_invalidate_all(void); +extern void cpu_tlb_invalidate_range(unsigned long address, unsigned long end); +extern void cpu_tlb_invalidate_page(unsigned long address, int flags); + extern void cpu_set_pgd(unsigned long pgd_phys); extern void cpu_set_pmd(pmd_t *pmdp, pmd_t pmd); extern void cpu_set_pte(pte_t *ptep, pte_t pte); extern volatile void cpu_reset(unsigned long addr); -extern void cpu_flush_icache_area(unsigned long start, unsigned long size); -extern void cpu_cache_wback_area(unsigned long start, unsigned long end); -extern void cpu_cache_purge_area(unsigned long start, unsigned long end); -extern void cpu_flush_icache_page(unsigned long virt); #define cpu_switch_mm(pgd,tsk) cpu_set_pgd(__virt_to_phys((unsigned long)(pgd))) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/dec21285.h linux/include/asm-arm/dec21285.h --- v2.4.0-test8/linux/include/asm-arm/dec21285.h Tue Jul 18 22:43:25 2000 +++ linux/include/asm-arm/dec21285.h Wed Dec 31 16:00:00 1969 @@ -1,144 +0,0 @@ -/* - * include/asm-arm/dec21285.h - * - * Copyright (C) 1998 Russell King - * - * DC21285 registers - */ -#define DC21285_PCI_IACK 0x79000000 -#define DC21285_ARMCSR_BASE 0x42000000 -#define DC21285_PCI_TYPE_0_CONFIG 0x7b000000 -#define DC21285_PCI_TYPE_1_CONFIG 0x7a000000 -#define DC21285_OUTBOUND_WRITE_FLUSH 0x78000000 -#define DC21285_FLASH 0x41000000 -#define DC21285_PCI_IO 0x7c000000 -#define DC21285_PCI_MEM 0x80000000 - -#include -#ifndef __ASSEMBLY__ -#include -#define DC21285_IO(x) ((volatile unsigned long *)(ARMCSR_BASE+(x))) -#else -#define DC21285_IO(x) (x) -#endif - -#define CSR_PCICMD DC21285_IO(0x0004) -#define CSR_CLASSREV DC21285_IO(0x0008) -#define CSR_PCICACHELINESIZE DC21285_IO(0x000c) -#define CSR_PCICSRBASE DC21285_IO(0x0010) -#define CSR_PCICSRIOBASE DC21285_IO(0x0014) -#define CSR_PCISDRAMBASE DC21285_IO(0x0018) -#define CSR_PCIROMBASE DC21285_IO(0x0030) -#define CSR_MBOX0 DC21285_IO(0x0050) -#define CSR_MBOX1 DC21285_IO(0x0054) -#define CSR_MBOX2 DC21285_IO(0x0058) -#define CSR_MBOX3 DC21285_IO(0x005c) -#define CSR_DOORBELL DC21285_IO(0x0060) -#define CSR_DOORBELL_SETUP DC21285_IO(0x0064) -#define CSR_ROMWRITEREG DC21285_IO(0x0068) -#define CSR_CSRBASEMASK DC21285_IO(0x00f8) -#define CSR_CSRBASEOFFSET DC21285_IO(0x00fc) -#define CSR_SDRAMBASEMASK DC21285_IO(0x0100) -#define CSR_SDRAMBASEOFFSET DC21285_IO(0x0104) -#define CSR_ROMBASEMASK DC21285_IO(0x0108) -#define CSR_SDRAMTIMING DC21285_IO(0x010c) -#define CSR_SDRAMADDRSIZE0 DC21285_IO(0x0110) -#define CSR_SDRAMADDRSIZE1 DC21285_IO(0x0114) -#define CSR_SDRAMADDRSIZE2 DC21285_IO(0x0118) -#define CSR_SDRAMADDRSIZE3 DC21285_IO(0x011c) -#define CSR_I2O_INFREEHEAD DC21285_IO(0x0120) -#define CSR_I2O_INPOSTTAIL DC21285_IO(0x0124) -#define CSR_I2O_OUTPOSTHEAD DC21285_IO(0x0128) -#define CSR_I2O_OUTFREETAIL DC21285_IO(0x012c) -#define CSR_I2O_INFREECOUNT DC21285_IO(0x0130) -#define CSR_I2O_OUTPOSTCOUNT DC21285_IO(0x0134) -#define CSR_I2O_INPOSTCOUNT DC21285_IO(0x0138) -#define CSR_SA110_CNTL DC21285_IO(0x013c) -#define SA110_CNTL_INITCMPLETE (1 << 0) -#define SA110_CNTL_ASSERTSERR (1 << 1) -#define SA110_CNTL_RXSERR (1 << 3) -#define SA110_CNTL_SA110DRAMPARITY (1 << 4) -#define SA110_CNTL_PCISDRAMPARITY (1 << 5) -#define SA110_CNTL_DMASDRAMPARITY (1 << 6) -#define SA110_CNTL_DISCARDTIMER (1 << 8) -#define SA110_CNTL_PCINRESET (1 << 9) -#define SA110_CNTL_I2O_256 (0 << 10) -#define SA110_CNTL_I20_512 (1 << 10) -#define SA110_CNTL_I2O_1024 (2 << 10) -#define SA110_CNTL_I2O_2048 (3 << 10) -#define SA110_CNTL_I2O_4096 (4 << 10) -#define SA110_CNTL_I2O_8192 (5 << 10) -#define SA110_CNTL_I2O_16384 (6 << 10) -#define SA110_CNTL_I2O_32768 (7 << 10) -#define SA110_CNTL_WATCHDOG (1 << 13) -#define SA110_CNTL_ROMWIDTH_UNDEF (0 << 14) -#define SA110_CNTL_ROMWIDTH_16 (1 << 14) -#define SA110_CNTL_ROMWIDTH_32 (2 << 14) -#define SA110_CNTL_ROMWIDTH_8 (3 << 14) -#define SA110_CNTL_ROMACCESSTIME(x) ((x)<<16) -#define SA110_CNTL_ROMBURSTTIME(x) ((x)<<20) -#define SA110_CNTL_ROMTRISTATETIME(x) ((x)<<24) -#define SA110_CNTL_XCSDIR(x) ((x)<<28) -#define SA110_CNTL_PCICFN (1 << 31) - -/* - * footbridge_cfn_mode() is used when we want - * to check whether we are the central function - */ -#define __footbridge_cfn_mode() (*CSR_SA110_CNTL & SA110_CNTL_PCICFN) -#if defined(CONFIG_FOOTBRIDGE_HOST) && defined(CONFIG_FOOTBRIDGE_ADDIN) -#define footbridge_cfn_mode() __footbridge_cfn_mode() -#elif defined(CONFIG_FOOTBRIDGE_HOST) -#define footbridge_cfn_mode() (1) -#else -#define footbridge_cfn_mode() (0) -#endif - -#define CSR_PCIADDR_EXTN DC21285_IO(0x0140) -#define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144) -#define CSR_XBUS_CYCLE DC21285_IO(0x0148) -#define CSR_XBUS_IOSTROBE DC21285_IO(0x014c) -#define CSR_DOORBELL_PCI DC21285_IO(0x0150) -#define CSR_DOORBELL_SA110 DC21285_IO(0x0154) -#define CSR_UARTDR DC21285_IO(0x0160) -#define CSR_RXSTAT DC21285_IO(0x0164) -#define CSR_H_UBRLCR DC21285_IO(0x0168) -#define CSR_M_UBRLCR DC21285_IO(0x016c) -#define CSR_L_UBRLCR DC21285_IO(0x0170) -#define CSR_UARTCON DC21285_IO(0x0174) -#define CSR_UARTFLG DC21285_IO(0x0178) -#define CSR_IRQ_STATUS DC21285_IO(0x0180) -#define CSR_IRQ_RAWSTATUS DC21285_IO(0x0184) -#define CSR_IRQ_ENABLE DC21285_IO(0x0188) -#define CSR_IRQ_DISABLE DC21285_IO(0x018c) -#define CSR_IRQ_SOFT DC21285_IO(0x0190) -#define CSR_FIQ_STATUS DC21285_IO(0x0280) -#define CSR_FIQ_RAWSTATUS DC21285_IO(0x0284) -#define CSR_FIQ_ENABLE DC21285_IO(0x0288) -#define CSR_FIQ_DISABLE DC21285_IO(0x028c) -#define CSR_FIQ_SOFT DC21285_IO(0x0290) -#define CSR_TIMER1_LOAD DC21285_IO(0x0300) -#define CSR_TIMER1_VALUE DC21285_IO(0x0304) -#define CSR_TIMER1_CNTL DC21285_IO(0x0308) -#define CSR_TIMER1_CLR DC21285_IO(0x030c) -#define CSR_TIMER2_LOAD DC21285_IO(0x0320) -#define CSR_TIMER2_VALUE DC21285_IO(0x0324) -#define CSR_TIMER2_CNTL DC21285_IO(0x0328) -#define CSR_TIMER2_CLR DC21285_IO(0x032c) -#define CSR_TIMER3_LOAD DC21285_IO(0x0340) -#define CSR_TIMER3_VALUE DC21285_IO(0x0344) -#define CSR_TIMER3_CNTL DC21285_IO(0x0348) -#define CSR_TIMER3_CLR DC21285_IO(0x034c) -#define CSR_TIMER4_LOAD DC21285_IO(0x0360) -#define CSR_TIMER4_VALUE DC21285_IO(0x0364) -#define CSR_TIMER4_CNTL DC21285_IO(0x0368) -#define CSR_TIMER4_CLR DC21285_IO(0x036c) - -#define TIMER_CNTL_ENABLE (1 << 7) -#define TIMER_CNTL_AUTORELOAD (1 << 6) -#define TIMER_CNTL_DIV1 (0) -#define TIMER_CNTL_DIV16 (1 << 2) -#define TIMER_CNTL_DIV256 (2 << 2) -#define TIMER_CNTL_CNTEXT (3 << 2) - - diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/dma.h linux/include/asm-arm/dma.h --- v2.4.0-test8/linux/include/asm-arm/dma.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/dma.h Mon Sep 18 15:15:23 2000 @@ -22,11 +22,6 @@ #define DMA_MODE_CASCADE 2 #define DMA_AUTOINIT 4 -typedef struct { - unsigned long address; - unsigned long length; -} dmasg_t; - extern spinlock_t dma_spin_lock; extern __inline__ unsigned long claim_dma_lock(void) @@ -85,7 +80,7 @@ * especially since some DMA architectures don't update the * DMA address immediately, but defer it to the enable_dma(). */ -extern void set_dma_sg(dmach_t channel, dmasg_t *sg, int nr_sg); +extern void set_dma_sg(dmach_t channel, struct scatterlist *sg, int nr_sg); /* Set the DMA address for this channel * diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/floppy.h linux/include/asm-arm/floppy.h --- v2.4.0-test8/linux/include/asm-arm/floppy.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/floppy.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/floppy.h + * linux/include/asm-arm/floppy.h * - * (C) 1996-2000 Russell King + * Copyright (C) 1996-2000 Russell King * - * Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here */ #ifndef __ASM_ARM_FLOPPY_H #define __ASM_ARM_FLOPPY_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/dec21285.h linux/include/asm-arm/hardware/dec21285.h --- v2.4.0-test8/linux/include/asm-arm/hardware/dec21285.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/dec21285.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,148 @@ +/* + * linux/include/asm-arm/hardware/dec21285.h + * + * Copyright (C) 1998 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * DC21285 registers + */ +#define DC21285_PCI_IACK 0x79000000 +#define DC21285_ARMCSR_BASE 0x42000000 +#define DC21285_PCI_TYPE_0_CONFIG 0x7b000000 +#define DC21285_PCI_TYPE_1_CONFIG 0x7a000000 +#define DC21285_OUTBOUND_WRITE_FLUSH 0x78000000 +#define DC21285_FLASH 0x41000000 +#define DC21285_PCI_IO 0x7c000000 +#define DC21285_PCI_MEM 0x80000000 + +#include +#ifndef __ASSEMBLY__ +#include +#define DC21285_IO(x) ((volatile unsigned long *)(ARMCSR_BASE+(x))) +#else +#define DC21285_IO(x) (x) +#endif + +#define CSR_PCICMD DC21285_IO(0x0004) +#define CSR_CLASSREV DC21285_IO(0x0008) +#define CSR_PCICACHELINESIZE DC21285_IO(0x000c) +#define CSR_PCICSRBASE DC21285_IO(0x0010) +#define CSR_PCICSRIOBASE DC21285_IO(0x0014) +#define CSR_PCISDRAMBASE DC21285_IO(0x0018) +#define CSR_PCIROMBASE DC21285_IO(0x0030) +#define CSR_MBOX0 DC21285_IO(0x0050) +#define CSR_MBOX1 DC21285_IO(0x0054) +#define CSR_MBOX2 DC21285_IO(0x0058) +#define CSR_MBOX3 DC21285_IO(0x005c) +#define CSR_DOORBELL DC21285_IO(0x0060) +#define CSR_DOORBELL_SETUP DC21285_IO(0x0064) +#define CSR_ROMWRITEREG DC21285_IO(0x0068) +#define CSR_CSRBASEMASK DC21285_IO(0x00f8) +#define CSR_CSRBASEOFFSET DC21285_IO(0x00fc) +#define CSR_SDRAMBASEMASK DC21285_IO(0x0100) +#define CSR_SDRAMBASEOFFSET DC21285_IO(0x0104) +#define CSR_ROMBASEMASK DC21285_IO(0x0108) +#define CSR_SDRAMTIMING DC21285_IO(0x010c) +#define CSR_SDRAMADDRSIZE0 DC21285_IO(0x0110) +#define CSR_SDRAMADDRSIZE1 DC21285_IO(0x0114) +#define CSR_SDRAMADDRSIZE2 DC21285_IO(0x0118) +#define CSR_SDRAMADDRSIZE3 DC21285_IO(0x011c) +#define CSR_I2O_INFREEHEAD DC21285_IO(0x0120) +#define CSR_I2O_INPOSTTAIL DC21285_IO(0x0124) +#define CSR_I2O_OUTPOSTHEAD DC21285_IO(0x0128) +#define CSR_I2O_OUTFREETAIL DC21285_IO(0x012c) +#define CSR_I2O_INFREECOUNT DC21285_IO(0x0130) +#define CSR_I2O_OUTPOSTCOUNT DC21285_IO(0x0134) +#define CSR_I2O_INPOSTCOUNT DC21285_IO(0x0138) +#define CSR_SA110_CNTL DC21285_IO(0x013c) +#define SA110_CNTL_INITCMPLETE (1 << 0) +#define SA110_CNTL_ASSERTSERR (1 << 1) +#define SA110_CNTL_RXSERR (1 << 3) +#define SA110_CNTL_SA110DRAMPARITY (1 << 4) +#define SA110_CNTL_PCISDRAMPARITY (1 << 5) +#define SA110_CNTL_DMASDRAMPARITY (1 << 6) +#define SA110_CNTL_DISCARDTIMER (1 << 8) +#define SA110_CNTL_PCINRESET (1 << 9) +#define SA110_CNTL_I2O_256 (0 << 10) +#define SA110_CNTL_I20_512 (1 << 10) +#define SA110_CNTL_I2O_1024 (2 << 10) +#define SA110_CNTL_I2O_2048 (3 << 10) +#define SA110_CNTL_I2O_4096 (4 << 10) +#define SA110_CNTL_I2O_8192 (5 << 10) +#define SA110_CNTL_I2O_16384 (6 << 10) +#define SA110_CNTL_I2O_32768 (7 << 10) +#define SA110_CNTL_WATCHDOG (1 << 13) +#define SA110_CNTL_ROMWIDTH_UNDEF (0 << 14) +#define SA110_CNTL_ROMWIDTH_16 (1 << 14) +#define SA110_CNTL_ROMWIDTH_32 (2 << 14) +#define SA110_CNTL_ROMWIDTH_8 (3 << 14) +#define SA110_CNTL_ROMACCESSTIME(x) ((x)<<16) +#define SA110_CNTL_ROMBURSTTIME(x) ((x)<<20) +#define SA110_CNTL_ROMTRISTATETIME(x) ((x)<<24) +#define SA110_CNTL_XCSDIR(x) ((x)<<28) +#define SA110_CNTL_PCICFN (1 << 31) + +/* + * footbridge_cfn_mode() is used when we want + * to check whether we are the central function + */ +#define __footbridge_cfn_mode() (*CSR_SA110_CNTL & SA110_CNTL_PCICFN) +#if defined(CONFIG_FOOTBRIDGE_HOST) && defined(CONFIG_FOOTBRIDGE_ADDIN) +#define footbridge_cfn_mode() __footbridge_cfn_mode() +#elif defined(CONFIG_FOOTBRIDGE_HOST) +#define footbridge_cfn_mode() (1) +#else +#define footbridge_cfn_mode() (0) +#endif + +#define CSR_PCIADDR_EXTN DC21285_IO(0x0140) +#define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144) +#define CSR_XBUS_CYCLE DC21285_IO(0x0148) +#define CSR_XBUS_IOSTROBE DC21285_IO(0x014c) +#define CSR_DOORBELL_PCI DC21285_IO(0x0150) +#define CSR_DOORBELL_SA110 DC21285_IO(0x0154) +#define CSR_UARTDR DC21285_IO(0x0160) +#define CSR_RXSTAT DC21285_IO(0x0164) +#define CSR_H_UBRLCR DC21285_IO(0x0168) +#define CSR_M_UBRLCR DC21285_IO(0x016c) +#define CSR_L_UBRLCR DC21285_IO(0x0170) +#define CSR_UARTCON DC21285_IO(0x0174) +#define CSR_UARTFLG DC21285_IO(0x0178) +#define CSR_IRQ_STATUS DC21285_IO(0x0180) +#define CSR_IRQ_RAWSTATUS DC21285_IO(0x0184) +#define CSR_IRQ_ENABLE DC21285_IO(0x0188) +#define CSR_IRQ_DISABLE DC21285_IO(0x018c) +#define CSR_IRQ_SOFT DC21285_IO(0x0190) +#define CSR_FIQ_STATUS DC21285_IO(0x0280) +#define CSR_FIQ_RAWSTATUS DC21285_IO(0x0284) +#define CSR_FIQ_ENABLE DC21285_IO(0x0288) +#define CSR_FIQ_DISABLE DC21285_IO(0x028c) +#define CSR_FIQ_SOFT DC21285_IO(0x0290) +#define CSR_TIMER1_LOAD DC21285_IO(0x0300) +#define CSR_TIMER1_VALUE DC21285_IO(0x0304) +#define CSR_TIMER1_CNTL DC21285_IO(0x0308) +#define CSR_TIMER1_CLR DC21285_IO(0x030c) +#define CSR_TIMER2_LOAD DC21285_IO(0x0320) +#define CSR_TIMER2_VALUE DC21285_IO(0x0324) +#define CSR_TIMER2_CNTL DC21285_IO(0x0328) +#define CSR_TIMER2_CLR DC21285_IO(0x032c) +#define CSR_TIMER3_LOAD DC21285_IO(0x0340) +#define CSR_TIMER3_VALUE DC21285_IO(0x0344) +#define CSR_TIMER3_CNTL DC21285_IO(0x0348) +#define CSR_TIMER3_CLR DC21285_IO(0x034c) +#define CSR_TIMER4_LOAD DC21285_IO(0x0360) +#define CSR_TIMER4_VALUE DC21285_IO(0x0364) +#define CSR_TIMER4_CNTL DC21285_IO(0x0368) +#define CSR_TIMER4_CLR DC21285_IO(0x036c) + +#define TIMER_CNTL_ENABLE (1 << 7) +#define TIMER_CNTL_AUTORELOAD (1 << 6) +#define TIMER_CNTL_DIV1 (0) +#define TIMER_CNTL_DIV16 (1 << 2) +#define TIMER_CNTL_DIV256 (2 << 2) +#define TIMER_CNTL_CNTEXT (3 << 2) + + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/ioc.h linux/include/asm-arm/hardware/ioc.h --- v2.4.0-test8/linux/include/asm-arm/hardware/ioc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/ioc.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,67 @@ +/* + * linux/include/asm-arm/hardware/ioc.h + * + * Copyright (C) Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Use these macros to read/write the IOC. All it does is perform the actual + * read/write. + */ + +#ifndef IOC_CONTROL + +#ifndef __ASSEMBLY__ +#define __IOC(offset) (IOC_BASE + (offset >> 2)) +#else +#define __IOC(offset) offset +#endif + +#define IOC_CONTROL __IOC(0x00) +#define IOC_KARTTX __IOC(0x04) +#define IOC_KARTRX __IOC(0x04) + +#define IOC_IRQSTATA __IOC(0x10) +#define IOC_IRQREQA __IOC(0x14) +#define IOC_IRQCLRA __IOC(0x14) +#define IOC_IRQMASKA __IOC(0x18) + +#define IOC_IRQSTATB __IOC(0x20) +#define IOC_IRQREQB __IOC(0x24) +#define IOC_IRQMASKB __IOC(0x28) + +#define IOC_FIQSTAT __IOC(0x30) +#define IOC_FIQREQ __IOC(0x34) +#define IOC_FIQMASK __IOC(0x38) + +#define IOC_T0CNTL __IOC(0x40) +#define IOC_T0LTCHL __IOC(0x40) +#define IOC_T0CNTH __IOC(0x44) +#define IOC_T0LTCHH __IOC(0x44) +#define IOC_T0GO __IOC(0x48) +#define IOC_T0LATCH __IOC(0x4c) + +#define IOC_T1CNTL __IOC(0x50) +#define IOC_T1LTCHL __IOC(0x50) +#define IOC_T1CNTH __IOC(0x54) +#define IOC_T1LTCHH __IOC(0x54) +#define IOC_T1GO __IOC(0x58) +#define IOC_T1LATCH __IOC(0x5c) + +#define IOC_T2CNTL __IOC(0x60) +#define IOC_T2LTCHL __IOC(0x60) +#define IOC_T2CNTH __IOC(0x64) +#define IOC_T2LTCHH __IOC(0x64) +#define IOC_T2GO __IOC(0x68) +#define IOC_T2LATCH __IOC(0x6c) + +#define IOC_T3CNTL __IOC(0x70) +#define IOC_T3LTCHL __IOC(0x70) +#define IOC_T3CNTH __IOC(0x74) +#define IOC_T3LTCHH __IOC(0x74) +#define IOC_T3GO __IOC(0x78) +#define IOC_T3LATCH __IOC(0x7c) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/iomd.h linux/include/asm-arm/hardware/iomd.h --- v2.4.0-test8/linux/include/asm-arm/hardware/iomd.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/iomd.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,249 @@ +/* + * linux/include/asm-arm/iomd.h + * + * Copyright (C) 1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains information out the IOMD ASIC used in the + * Acorn RiscPC and subsequently integrated into the CLPS7500 chips. + */ +#include + +#ifndef __ASSEMBLY__ +#define __IOMD(offset) (IO_IOMD_BASE + (offset >> 2)) +#else +#define __IOMD(offset) offset +#endif + +#define IOMD_CONTROL __IOMD(0x000) +#define IOMD_KARTTX __IOMD(0x004) +#define IOMD_KARTRX __IOMD(0x004) +#define IOMD_KCTRL __IOMD(0x008) + +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_IOLINES __IOMD(0x00C) +#endif + +#define IOMD_IRQSTATA __IOMD(0x010) +#define IOMD_IRQREQA __IOMD(0x014) +#define IOMD_IRQCLRA __IOMD(0x014) +#define IOMD_IRQMASKA __IOMD(0x018) + +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_SUSMODE __IOMD(0x01C) +#endif + +#define IOMD_IRQSTATB __IOMD(0x020) +#define IOMD_IRQREQB __IOMD(0x024) +#define IOMD_IRQMASKB __IOMD(0x028) + +#define IOMD_FIQSTAT __IOMD(0x030) +#define IOMD_FIQREQ __IOMD(0x034) +#define IOMD_FIQMASK __IOMD(0x038) + +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_CLKCTL __IOMD(0x03C) +#endif + +#define IOMD_T0CNTL __IOMD(0x040) +#define IOMD_T0LTCHL __IOMD(0x040) +#define IOMD_T0CNTH __IOMD(0x044) +#define IOMD_T0LTCHH __IOMD(0x044) +#define IOMD_T0GO __IOMD(0x048) +#define IOMD_T0LATCH __IOMD(0x04c) + +#define IOMD_T1CNTL __IOMD(0x050) +#define IOMD_T1LTCHL __IOMD(0x050) +#define IOMD_T1CNTH __IOMD(0x054) +#define IOMD_T1LTCHH __IOMD(0x054) +#define IOMD_T1GO __IOMD(0x058) +#define IOMD_T1LATCH __IOMD(0x05c) + +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_IRQSTATC __IOMD(0x060) +#define IOMD_IRQREQC __IOMD(0x064) +#define IOMD_IRQMASKC __IOMD(0x068) + +#define IOMD_VIDMUX __IOMD(0x06c) + +#define IOMD_IRQSTATD __IOMD(0x070) +#define IOMD_IRQREQD __IOMD(0x074) +#define IOMD_IRQMASKD __IOMD(0x078) +#endif + +#define IOMD_ROMCR0 __IOMD(0x080) +#define IOMD_ROMCR1 __IOMD(0x084) +#ifdef CONFIG_ARCH_RPC +#define IOMD_DRAMCR __IOMD(0x088) +#endif +#define IOMD_REFCR __IOMD(0x08C) + +#define IOMD_FSIZE __IOMD(0x090) +#define IOMD_ID0 __IOMD(0x094) +#define IOMD_ID1 __IOMD(0x098) +#define IOMD_VERSION __IOMD(0x09C) + +#ifdef CONFIG_ARCH_RPC +#define IOMD_MOUSEX __IOMD(0x0A0) +#define IOMD_MOUSEY __IOMD(0x0A4) +#endif + +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_MSEDAT __IOMD(0x0A8) +#define IOMD_MSECTL __IOMD(0x0Ac) +#endif + +#ifdef CONFIG_ARCH_RPC +#define IOMD_DMATCR __IOMD(0x0C0) +#endif +#define IOMD_IOTCR __IOMD(0x0C4) +#define IOMD_ECTCR __IOMD(0x0C8) +#ifdef CONFIG_ARCH_RPC +#define IOMD_DMAEXT __IOMD(0x0CC) +#endif +#ifdef CONFIG_ARCH_CLPS7500 +#define IOMD_ASTCR __IOMD(0x0CC) +#define IOMD_DRAMCR __IOMD(0x0D0) +#define IOMD_SELFREF __IOMD(0x0D4) +#define IOMD_ATODICR __IOMD(0x0E0) +#define IOMD_ATODSR __IOMD(0x0E4) +#define IOMD_ATODCC __IOMD(0x0E8) +#define IOMD_ATODCNT1 __IOMD(0x0EC) +#define IOMD_ATODCNT2 __IOMD(0x0F0) +#define IOMD_ATODCNT3 __IOMD(0x0F4) +#define IOMD_ATODCNT4 __IOMD(0x0F8) +#endif + +#ifdef CONFIG_ARCH_RPC +#define DMA_EXT_IO0 1 +#define DMA_EXT_IO1 2 +#define DMA_EXT_IO2 4 +#define DMA_EXT_IO3 8 + +#define IOMD_IO0CURA __IOMD(0x100) +#define IOMD_IO0ENDA __IOMD(0x104) +#define IOMD_IO0CURB __IOMD(0x108) +#define IOMD_IO0ENDB __IOMD(0x10C) +#define IOMD_IO0CR __IOMD(0x110) +#define IOMD_IO0ST __IOMD(0x114) + +#define IOMD_IO1CURA __IOMD(0x120) +#define IOMD_IO1ENDA __IOMD(0x124) +#define IOMD_IO1CURB __IOMD(0x128) +#define IOMD_IO1ENDB __IOMD(0x12C) +#define IOMD_IO1CR __IOMD(0x130) +#define IOMD_IO1ST __IOMD(0x134) + +#define IOMD_IO2CURA __IOMD(0x140) +#define IOMD_IO2ENDA __IOMD(0x144) +#define IOMD_IO2CURB __IOMD(0x148) +#define IOMD_IO2ENDB __IOMD(0x14C) +#define IOMD_IO2CR __IOMD(0x150) +#define IOMD_IO2ST __IOMD(0x154) + +#define IOMD_IO3CURA __IOMD(0x160) +#define IOMD_IO3ENDA __IOMD(0x164) +#define IOMD_IO3CURB __IOMD(0x168) +#define IOMD_IO3ENDB __IOMD(0x16C) +#define IOMD_IO3CR __IOMD(0x170) +#define IOMD_IO3ST __IOMD(0x174) +#endif + +#define IOMD_SD0CURA __IOMD(0x180) +#define IOMD_SD0ENDA __IOMD(0x184) +#define IOMD_SD0CURB __IOMD(0x188) +#define IOMD_SD0ENDB __IOMD(0x18C) +#define IOMD_SD0CR __IOMD(0x190) +#define IOMD_SD0ST __IOMD(0x194) + +#ifdef CONFIG_ARCH_RPC +#define IOMD_SD1CURA __IOMD(0x1A0) +#define IOMD_SD1ENDA __IOMD(0x1A4) +#define IOMD_SD1CURB __IOMD(0x1A8) +#define IOMD_SD1ENDB __IOMD(0x1AC) +#define IOMD_SD1CR __IOMD(0x1B0) +#define IOMD_SD1ST __IOMD(0x1B4) +#endif + +#define IOMD_CURSCUR __IOMD(0x1C0) +#define IOMD_CURSINIT __IOMD(0x1C4) + +#define IOMD_VIDCUR __IOMD(0x1D0) +#define IOMD_VIDEND __IOMD(0x1D4) +#define IOMD_VIDSTART __IOMD(0x1D8) +#define IOMD_VIDINIT __IOMD(0x1DC) +#define IOMD_VIDCR __IOMD(0x1E0) + +#define IOMD_DMASTAT __IOMD(0x1F0) +#define IOMD_DMAREQ __IOMD(0x1F4) +#define IOMD_DMAMASK __IOMD(0x1F8) + +#define DMA_END_S (1 << 31) +#define DMA_END_L (1 << 30) + +#define DMA_CR_C 0x80 +#define DMA_CR_D 0x40 +#define DMA_CR_E 0x20 + +#define DMA_ST_OFL 4 +#define DMA_ST_INT 2 +#define DMA_ST_AB 1 + +#ifndef IOC_CONTROL +/* + * IOC compatability + */ +#define IOC_CONTROL IOMD_CONTROL +#define IOC_IRQSTATA IOMD_IRQSTATA +#define IOC_IRQREQA IOMD_IRQREQA +#define IOC_IRQCLRA IOMD_IRQCLRA +#define IOC_IRQMASKA IOMD_IRQMASKA + +#define IOC_IRQSTATB IOMD_IRQSTATB +#define IOC_IRQREQB IOMD_IRQREQB +#define IOC_IRQMASKB IOMD_IRQMASKB + +#define IOC_FIQSTAT IOMD_FIQSTAT +#define IOC_FIQREQ IOMD_FIQREQ +#define IOC_FIQMASK IOMD_FIQMASK + +#define IOC_T0CNTL IOMD_T0CNTL +#define IOC_T0LTCHL IOMD_T0LTCHL +#define IOC_T0CNTH IOMD_T0CNTH +#define IOC_T0LTCHH IOMD_T0LTCHH +#define IOC_T0GO IOMD_T0GO +#define IOC_T0LATCH IOMD_T0LATCH + +#define IOC_T1CNTL IOMD_T1CNTL +#define IOC_T1LTCHL IOMD_T1LTCHL +#define IOC_T1CNTH IOMD_T1CNTH +#define IOC_T1LTCHH IOMD_T1LTCHH +#define IOC_T1GO IOMD_T1GO +#define IOC_T1LATCH IOMD_T1LATCH +#endif + +/* + * DMA (MEMC) compatability + */ +#define HALF_SAM vram_half_sam +#define VDMA_ALIGNMENT (HALF_SAM * 2) +#define VDMA_XFERSIZE (HALF_SAM) +#define VDMA_INIT IOMD_VIDINIT +#define VDMA_START IOMD_VIDSTART +#define VDMA_END IOMD_VIDEND + +#ifndef __ASSEMBLY__ +extern unsigned int vram_half_sam; +#define video_set_dma(start,end,offset) \ +do { \ + outl (SCREEN_START + start, VDMA_START); \ + outl (SCREEN_START + end - VDMA_XFERSIZE, VDMA_END); \ + if (offset >= end - VDMA_XFERSIZE) \ + offset |= 0x40000000; \ + outl (SCREEN_START + offset, VDMA_INIT); \ +} while (0) +#endif + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/memc.h linux/include/asm-arm/hardware/memc.h --- v2.4.0-test8/linux/include/asm-arm/hardware/memc.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/memc.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,26 @@ +/* + * linux/include/asm-arm/hardware/memc.h + * + * Copyright (C) Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#define VDMA_ALIGNMENT PAGE_SIZE +#define VDMA_XFERSIZE 16 +#define VDMA_INIT 0 +#define VDMA_START 1 +#define VDMA_END 2 + +#ifndef __ASSEMBLY__ +extern void memc_write(unsigned int reg, unsigned long val); + +#define video_set_dma(start,end,offset) \ +do { \ + memc_write (VDMA_START, (start >> 2)); \ + memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2); \ + memc_write (VDMA_INIT, (offset >> 2)); \ +} while (0) + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/pci_v3.h linux/include/asm-arm/hardware/pci_v3.h --- v2.4.0-test8/linux/include/asm-arm/hardware/pci_v3.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/pci_v3.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,148 @@ +/* + * linux/include/asm-arm/hardware/pci_v3.h + * + * Internal header file PCI V3 chip + * + * Copyright (C) ARM Limited + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * + * 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 + */ +#ifndef ASM_ARM_HARDWARE_PCI_V3_H +#define ASM_ARM_HARDWARE_PCI_V3_H + +/* ------------------------------------------------------------------------------- + * V3 Local Bus to PCI Bridge definitions + * ------------------------------------------------------------------------------- + * Registers (these are taken from page 129 of the EPC User's Manual Rev 1.04 + * All V3 register names are prefaced by V3_ to avoid clashing with any other + * PCI definitions. Their names match the user's manual. + * + * I'm assuming that I20 is disabled. + * + */ +#define V3_PCI_VENDOR 0x00000000 +#define V3_PCI_DEVICE 0x00000002 +#define V3_PCI_CMD 0x00000004 +#define V3_PCI_STAT 0x00000006 +#define V3_PCI_CC_REV 0x00000008 +#define V3_PCI_HDR_CFG 0x0000000C +#define V3_PCI_IO_BASE 0x00000010 +#define V3_PCI_BASE0 0x00000014 +#define V3_PCI_BASE1 0x00000018 +#define V3_PCI_SUB_VENDOR 0x0000002C +#define V3_PCI_SUB_ID 0x0000002E +#define V3_PCI_ROM 0x00000030 +#define V3_PCI_BPARAM 0x0000003C +#define V3_PCI_MAP0 0x00000040 +#define V3_PCI_MAP1 0x00000044 +#define V3_PCI_INT_STAT 0x00000048 +#define V3_PCI_INT_CFG 0x0000004C +#define V3_LB_BASE0 0x00000054 +#define V3_LB_BASE1 0x00000058 +#define V3_LB_MAP0 0x0000005E +#define V3_LB_MAP1 0x00000062 +#define V3_LB_BASE2 0x00000064 +#define V3_LB_MAP2 0x00000066 +#define V3_LB_SIZE 0x00000068 +#define V3_LB_IO_BASE 0x0000006E +#define V3_FIFO_CFG 0x00000070 +#define V3_FIFO_PRIORITY 0x00000072 +#define V3_FIFO_STAT 0x00000074 +#define V3_LB_ISTAT 0x00000076 +#define V3_LB_IMASK 0x00000077 +#define V3_SYSTEM 0x00000078 +#define V3_LB_CFG 0x0000007A +#define V3_PCI_CFG 0x0000007C +#define V3_DMA_PCI_ADR0 0x00000080 +#define V3_DMA_PCI_ADR1 0x00000090 +#define V3_DMA_LOCAL_ADR0 0x00000084 +#define V3_DMA_LOCAL_ADR1 0x00000094 +#define V3_DMA_LENGTH0 0x00000088 +#define V3_DMA_LENGTH1 0x00000098 +#define V3_DMA_CSR0 0x0000008B +#define V3_DMA_CSR1 0x0000009B +#define V3_DMA_CTLB_ADR0 0x0000008C +#define V3_DMA_CTLB_ADR1 0x0000009C +#define V3_DMA_DELAY 0x000000E0 +#define V3_MAIL_DATA 0x000000C0 +#define V3_PCI_MAIL_IEWR 0x000000D0 +#define V3_PCI_MAIL_IERD 0x000000D2 +#define V3_LB_MAIL_IEWR 0x000000D4 +#define V3_LB_MAIL_IERD 0x000000D6 +#define V3_MAIL_WR_STAT 0x000000D8 +#define V3_MAIL_RD_STAT 0x000000DA +#define V3_QBA_MAP 0x000000DC + +/* PCI COMMAND REGISTER bits + */ +#define V3_COMMAND_M_FBB_EN BIT9 +#define V3_COMMAND_M_SERR_EN BIT8 +#define V3_COMMAND_M_PAR_EN BIT6 +#define V3_COMMAND_M_MASTER_EN BIT2 +#define V3_COMMAND_M_MEM_EN BIT1 +#define V3_COMMAND_M_IO_EN BIT0 + +/* SYSTEM REGISTER bits + */ +#define V3_SYSTEM_M_RST_OUT BIT15 +#define V3_SYSTEM_M_LOCK BIT14 + +/* PCI_CFG bits + */ +#define V3_PCI_CFG_M_RETRY_EN BIT10 +#define V3_PCI_CFG_M_AD_LOW1 BIT9 +#define V3_PCI_CFG_M_AD_LOW0 BIT8 + +/* PCI_BASE register bits (PCI -> Local Bus) + */ +#define V3_PCI_BASE_M_ADR_BASE 0xFFF00000 +#define V3_PCI_BASE_M_ADR_BASEL 0x000FFF00 +#define V3_PCI_BASE_M_PREFETCH BIT3 +#define V3_PCI_BASE_M_TYPE BIT2+BIT1 +#define V3_PCI_BASE_M_IO BIT0 + +/* PCI MAP register bits (PCI -> Local bus) + */ +#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000 +#define V3_PCI_MAP_M_RD_POST_INH BIT15 +#define V3_PCI_MAP_M_ROM_SIZE BIT11+BIT10 +#define V3_PCI_MAP_M_SWAP BIT9+BIT8 +#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0 +#define V3_PCI_MAP_M_REG_EN BIT1 +#define V3_PCI_MAP_M_ENABLE BIT0 + +/* 9 => 512M window size + */ +#define V3_PCI_MAP_M_ADR_SIZE_512M 0x00000090 +/* A => 1024M window size + */ +#define V3_PCI_MAP_M_ADR_SIZE_1024M 0x000000A0 + +/* LB_BASE register bits (Local bus -> PCI) + */ +#define V3_LB_BASE_M_MAP_ADR 0xFFF00000 +#define V3_LB_BASE_M_SWAP BIT9+BIT8 +#define V3_LB_BASE_M_ADR_SIZE 0x000000F0 +#define V3_LB_BASE_M_PREFETCH BIT3 +#define V3_LB_BASE_M_ENABLE BIT0 + +/* LB_MAP register bits (Local bus -> PCI) + */ +#define V3_LB_MAP_M_MAP_ADR 0xFFF0 +#define V3_LB_MAP_M_TYPE 0x000E +#define V3_LB_MAP_M_AD_LOW_EN BIT0 + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware/serial_amba.h linux/include/asm-arm/hardware/serial_amba.h --- v2.4.0-test8/linux/include/asm-arm/hardware/serial_amba.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-arm/hardware/serial_amba.h Mon Sep 18 15:15:23 2000 @@ -0,0 +1,91 @@ +/* + * linux/include/asm-arm/hardware/serial_amba.h + * + * Internal header file for AMBA serial ports + * + * Copyright (C) ARM Limited + * Copyright (C) 2000 Deep Blue Solutions Ltd. + * + * 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 + */ +#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H +#define ASM_ARM_HARDWARE_SERIAL_AMBA_H + +/* ------------------------------------------------------------------------------- + * From AMBA UART (PL010) Block Specification (ARM-0001-CUST-DSPC-A03) + * ------------------------------------------------------------------------------- + * UART Register Offsets. + */ +#define AMBA_UARTDR 0x00 /* Data read or written from the interface. */ +#define AMBA_UARTRSR 0x04 /* Receive status register (Read). */ +#define AMBA_UARTECR 0x04 /* Error clear register (Write). */ +#define AMBA_UARTLCR_H 0x08 /* Line control register, high byte. */ +#define AMBA_UARTLCR_M 0x0C /* Line control register, middle byte. */ +#define AMBA_UARTLCR_L 0x10 /* Line control register, low byte. */ +#define AMBA_UARTCR 0x14 /* Control register. */ +#define AMBA_UARTFR 0x18 /* Flag register (Read only). */ +#define AMBA_UARTIIR 0x1C /* Interrupt indentification register (Read). */ +#define AMBA_UARTICR 0x1C /* Interrupt clear register (Write). */ +#define AMBA_UARTILPR 0x20 /* IrDA low power counter register. */ + +#define AMBA_UARTRSR_OE 0x08 +#define AMBA_UARTRSR_BE 0x04 +#define AMBA_UARTRSR_PE 0x02 +#define AMBA_UARTRSR_FE 0x01 + +#define AMBA_UARTFR_TXFF 0x20 +#define AMBA_UARTFR_RXFE 0x10 +#define AMBA_UARTFR_BUSY 0x08 +#define AMBA_UARTFR_DCD 0x04 +#define AMBA_UARTFR_DSR 0x02 +#define AMBA_UARTFR_CTS 0x01 +#define AMBA_UARTFR_TMSK (AMBA_UARTFR_TXFF + AMBA_UARTFR_BUSY) + +#define AMBA_UARTCR_RTIE 0x40 +#define AMBA_UARTCR_TIE 0x20 +#define AMBA_UARTCR_RIE 0x10 +#define AMBA_UARTCR_MSIE 0x08 +#define AMBA_UARTCR_IIRLP 0x04 +#define AMBA_UARTCR_SIREN 0x02 +#define AMBA_UARTCR_UARTEN 0x01 + +#define AMBA_UARTLCR_H_WLEN_8 0x60 +#define AMBA_UARTLCR_H_WLEN_7 0x40 +#define AMBA_UARTLCR_H_WLEN_6 0x20 +#define AMBA_UARTLCR_H_WLEN_5 0x00 +#define AMBA_UARTLCR_H_FEN 0x10 +#define AMBA_UARTLCR_H_STP2 0x08 +#define AMBA_UARTLCR_H_EPS 0x04 +#define AMBA_UARTLCR_H_PEN 0x02 +#define AMBA_UARTLCR_H_BRK 0x01 + +#define AMBA_UARTIIR_RTIS 0x08 +#define AMBA_UARTIIR_TIS 0x04 +#define AMBA_UARTIIR_RIS 0x02 +#define AMBA_UARTIIR_MIS 0x01 + +#define ARM_BAUD_460800 1 +#define ARM_BAUD_230400 3 +#define ARM_BAUD_115200 7 +#define ARM_BAUD_57600 15 +#define ARM_BAUD_38400 23 +#define ARM_BAUD_19200 47 +#define ARM_BAUD_14400 63 +#define ARM_BAUD_9600 95 +#define ARM_BAUD_4800 191 +#define ARM_BAUD_2400 383 +#define ARM_BAUD_1200 767 + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/hardware.h linux/include/asm-arm/hardware.h --- v2.4.0-test8/linux/include/asm-arm/hardware.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/hardware.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/hardware.h + * linux/include/asm-arm/hardware.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * Common hardware definitions + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Common hardware definitions */ #ifndef __ASM_HARDWARE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/io.h linux/include/asm-arm/io.h --- v2.4.0-test8/linux/include/asm-arm/io.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/io.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/io.h + * linux/include/asm-arm/io.h * - * Copyright (C) 1996-2000 Russell King + * Copyright (C) 1996-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * * Modifications: * 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both @@ -19,7 +23,6 @@ #include #include #include -#include #define outb_p(val,port) outb((val),(port)) #define outw_p(val,port) outw((val),(port)) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/ioc.h linux/include/asm-arm/ioc.h --- v2.4.0-test8/linux/include/asm-arm/ioc.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/ioc.h Wed Dec 31 16:00:00 1969 @@ -1,59 +0,0 @@ -/* - * Use these macros to read/write the IOC. All it does is perform the actual - * read/write. - */ - -#ifndef IOC_CONTROL - -#ifndef __ASSEMBLY__ -#define __IOC(offset) (IOC_BASE + (offset >> 2)) -#else -#define __IOC(offset) offset -#endif - -#define IOC_CONTROL __IOC(0x00) -#define IOC_KARTTX __IOC(0x04) -#define IOC_KARTRX __IOC(0x04) - -#define IOC_IRQSTATA __IOC(0x10) -#define IOC_IRQREQA __IOC(0x14) -#define IOC_IRQCLRA __IOC(0x14) -#define IOC_IRQMASKA __IOC(0x18) - -#define IOC_IRQSTATB __IOC(0x20) -#define IOC_IRQREQB __IOC(0x24) -#define IOC_IRQMASKB __IOC(0x28) - -#define IOC_FIQSTAT __IOC(0x30) -#define IOC_FIQREQ __IOC(0x34) -#define IOC_FIQMASK __IOC(0x38) - -#define IOC_T0CNTL __IOC(0x40) -#define IOC_T0LTCHL __IOC(0x40) -#define IOC_T0CNTH __IOC(0x44) -#define IOC_T0LTCHH __IOC(0x44) -#define IOC_T0GO __IOC(0x48) -#define IOC_T0LATCH __IOC(0x4c) - -#define IOC_T1CNTL __IOC(0x50) -#define IOC_T1LTCHL __IOC(0x50) -#define IOC_T1CNTH __IOC(0x54) -#define IOC_T1LTCHH __IOC(0x54) -#define IOC_T1GO __IOC(0x58) -#define IOC_T1LATCH __IOC(0x5c) - -#define IOC_T2CNTL __IOC(0x60) -#define IOC_T2LTCHL __IOC(0x60) -#define IOC_T2CNTH __IOC(0x64) -#define IOC_T2LTCHH __IOC(0x64) -#define IOC_T2GO __IOC(0x68) -#define IOC_T2LATCH __IOC(0x6c) - -#define IOC_T3CNTL __IOC(0x70) -#define IOC_T3LTCHL __IOC(0x70) -#define IOC_T3CNTH __IOC(0x74) -#define IOC_T3LTCHH __IOC(0x74) -#define IOC_T3GO __IOC(0x78) -#define IOC_T3LATCH __IOC(0x7c) - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/iomd.h linux/include/asm-arm/iomd.h --- v2.4.0-test8/linux/include/asm-arm/iomd.h Fri May 12 11:21:20 2000 +++ linux/include/asm-arm/iomd.h Wed Dec 31 16:00:00 1969 @@ -1,245 +0,0 @@ -/* - * linux/include/asm-arm/iomd.h - * - * Copyright (C) 1999 Russell King - * - * This file contains information out the IOMD ASIC used in the - * Acorn RiscPC and subsequently integrated into the CLPS7500 chips. - */ -#include - -#ifndef __ASSEMBLY__ -#define __IOMD(offset) (IO_IOMD_BASE + (offset >> 2)) -#else -#define __IOMD(offset) offset -#endif - -#define IOMD_CONTROL __IOMD(0x000) -#define IOMD_KARTTX __IOMD(0x004) -#define IOMD_KARTRX __IOMD(0x004) -#define IOMD_KCTRL __IOMD(0x008) - -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_IOLINES __IOMD(0x00C) -#endif - -#define IOMD_IRQSTATA __IOMD(0x010) -#define IOMD_IRQREQA __IOMD(0x014) -#define IOMD_IRQCLRA __IOMD(0x014) -#define IOMD_IRQMASKA __IOMD(0x018) - -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_SUSMODE __IOMD(0x01C) -#endif - -#define IOMD_IRQSTATB __IOMD(0x020) -#define IOMD_IRQREQB __IOMD(0x024) -#define IOMD_IRQMASKB __IOMD(0x028) - -#define IOMD_FIQSTAT __IOMD(0x030) -#define IOMD_FIQREQ __IOMD(0x034) -#define IOMD_FIQMASK __IOMD(0x038) - -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_CLKCTL __IOMD(0x03C) -#endif - -#define IOMD_T0CNTL __IOMD(0x040) -#define IOMD_T0LTCHL __IOMD(0x040) -#define IOMD_T0CNTH __IOMD(0x044) -#define IOMD_T0LTCHH __IOMD(0x044) -#define IOMD_T0GO __IOMD(0x048) -#define IOMD_T0LATCH __IOMD(0x04c) - -#define IOMD_T1CNTL __IOMD(0x050) -#define IOMD_T1LTCHL __IOMD(0x050) -#define IOMD_T1CNTH __IOMD(0x054) -#define IOMD_T1LTCHH __IOMD(0x054) -#define IOMD_T1GO __IOMD(0x058) -#define IOMD_T1LATCH __IOMD(0x05c) - -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_IRQSTATC __IOMD(0x060) -#define IOMD_IRQREQC __IOMD(0x064) -#define IOMD_IRQMASKC __IOMD(0x068) - -#define IOMD_VIDMUX __IOMD(0x06c) - -#define IOMD_IRQSTATD __IOMD(0x070) -#define IOMD_IRQREQD __IOMD(0x074) -#define IOMD_IRQMASKD __IOMD(0x078) -#endif - -#define IOMD_ROMCR0 __IOMD(0x080) -#define IOMD_ROMCR1 __IOMD(0x084) -#ifdef CONFIG_ARCH_RPC -#define IOMD_DRAMCR __IOMD(0x088) -#endif -#define IOMD_REFCR __IOMD(0x08C) - -#define IOMD_FSIZE __IOMD(0x090) -#define IOMD_ID0 __IOMD(0x094) -#define IOMD_ID1 __IOMD(0x098) -#define IOMD_VERSION __IOMD(0x09C) - -#ifdef CONFIG_ARCH_RPC -#define IOMD_MOUSEX __IOMD(0x0A0) -#define IOMD_MOUSEY __IOMD(0x0A4) -#endif - -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_MSEDAT __IOMD(0x0A8) -#define IOMD_MSECTL __IOMD(0x0Ac) -#endif - -#ifdef CONFIG_ARCH_RPC -#define IOMD_DMATCR __IOMD(0x0C0) -#endif -#define IOMD_IOTCR __IOMD(0x0C4) -#define IOMD_ECTCR __IOMD(0x0C8) -#ifdef CONFIG_ARCH_RPC -#define IOMD_DMAEXT __IOMD(0x0CC) -#endif -#ifdef CONFIG_ARCH_CLPS7500 -#define IOMD_ASTCR __IOMD(0x0CC) -#define IOMD_DRAMCR __IOMD(0x0D0) -#define IOMD_SELFREF __IOMD(0x0D4) -#define IOMD_ATODICR __IOMD(0x0E0) -#define IOMD_ATODSR __IOMD(0x0E4) -#define IOMD_ATODCC __IOMD(0x0E8) -#define IOMD_ATODCNT1 __IOMD(0x0EC) -#define IOMD_ATODCNT2 __IOMD(0x0F0) -#define IOMD_ATODCNT3 __IOMD(0x0F4) -#define IOMD_ATODCNT4 __IOMD(0x0F8) -#endif - -#ifdef CONFIG_ARCH_RPC -#define DMA_EXT_IO0 1 -#define DMA_EXT_IO1 2 -#define DMA_EXT_IO2 4 -#define DMA_EXT_IO3 8 - -#define IOMD_IO0CURA __IOMD(0x100) -#define IOMD_IO0ENDA __IOMD(0x104) -#define IOMD_IO0CURB __IOMD(0x108) -#define IOMD_IO0ENDB __IOMD(0x10C) -#define IOMD_IO0CR __IOMD(0x110) -#define IOMD_IO0ST __IOMD(0x114) - -#define IOMD_IO1CURA __IOMD(0x120) -#define IOMD_IO1ENDA __IOMD(0x124) -#define IOMD_IO1CURB __IOMD(0x128) -#define IOMD_IO1ENDB __IOMD(0x12C) -#define IOMD_IO1CR __IOMD(0x130) -#define IOMD_IO1ST __IOMD(0x134) - -#define IOMD_IO2CURA __IOMD(0x140) -#define IOMD_IO2ENDA __IOMD(0x144) -#define IOMD_IO2CURB __IOMD(0x148) -#define IOMD_IO2ENDB __IOMD(0x14C) -#define IOMD_IO2CR __IOMD(0x150) -#define IOMD_IO2ST __IOMD(0x154) - -#define IOMD_IO3CURA __IOMD(0x160) -#define IOMD_IO3ENDA __IOMD(0x164) -#define IOMD_IO3CURB __IOMD(0x168) -#define IOMD_IO3ENDB __IOMD(0x16C) -#define IOMD_IO3CR __IOMD(0x170) -#define IOMD_IO3ST __IOMD(0x174) -#endif - -#define IOMD_SD0CURA __IOMD(0x180) -#define IOMD_SD0ENDA __IOMD(0x184) -#define IOMD_SD0CURB __IOMD(0x188) -#define IOMD_SD0ENDB __IOMD(0x18C) -#define IOMD_SD0CR __IOMD(0x190) -#define IOMD_SD0ST __IOMD(0x194) - -#ifdef CONFIG_ARCH_RPC -#define IOMD_SD1CURA __IOMD(0x1A0) -#define IOMD_SD1ENDA __IOMD(0x1A4) -#define IOMD_SD1CURB __IOMD(0x1A8) -#define IOMD_SD1ENDB __IOMD(0x1AC) -#define IOMD_SD1CR __IOMD(0x1B0) -#define IOMD_SD1ST __IOMD(0x1B4) -#endif - -#define IOMD_CURSCUR __IOMD(0x1C0) -#define IOMD_CURSINIT __IOMD(0x1C4) - -#define IOMD_VIDCUR __IOMD(0x1D0) -#define IOMD_VIDEND __IOMD(0x1D4) -#define IOMD_VIDSTART __IOMD(0x1D8) -#define IOMD_VIDINIT __IOMD(0x1DC) -#define IOMD_VIDCR __IOMD(0x1E0) - -#define IOMD_DMASTAT __IOMD(0x1F0) -#define IOMD_DMAREQ __IOMD(0x1F4) -#define IOMD_DMAMASK __IOMD(0x1F8) - -#define DMA_END_S (1 << 31) -#define DMA_END_L (1 << 30) - -#define DMA_CR_C 0x80 -#define DMA_CR_D 0x40 -#define DMA_CR_E 0x20 - -#define DMA_ST_OFL 4 -#define DMA_ST_INT 2 -#define DMA_ST_AB 1 - -#ifndef IOC_CONTROL -/* - * IOC compatability - */ -#define IOC_CONTROL IOMD_CONTROL -#define IOC_IRQSTATA IOMD_IRQSTATA -#define IOC_IRQREQA IOMD_IRQREQA -#define IOC_IRQCLRA IOMD_IRQCLRA -#define IOC_IRQMASKA IOMD_IRQMASKA - -#define IOC_IRQSTATB IOMD_IRQSTATB -#define IOC_IRQREQB IOMD_IRQREQB -#define IOC_IRQMASKB IOMD_IRQMASKB - -#define IOC_FIQSTAT IOMD_FIQSTAT -#define IOC_FIQREQ IOMD_FIQREQ -#define IOC_FIQMASK IOMD_FIQMASK - -#define IOC_T0CNTL IOMD_T0CNTL -#define IOC_T0LTCHL IOMD_T0LTCHL -#define IOC_T0CNTH IOMD_T0CNTH -#define IOC_T0LTCHH IOMD_T0LTCHH -#define IOC_T0GO IOMD_T0GO -#define IOC_T0LATCH IOMD_T0LATCH - -#define IOC_T1CNTL IOMD_T1CNTL -#define IOC_T1LTCHL IOMD_T1LTCHL -#define IOC_T1CNTH IOMD_T1CNTH -#define IOC_T1LTCHH IOMD_T1LTCHH -#define IOC_T1GO IOMD_T1GO -#define IOC_T1LATCH IOMD_T1LATCH -#endif - -/* - * DMA (MEMC) compatability - */ -#define HALF_SAM vram_half_sam -#define VDMA_ALIGNMENT (HALF_SAM * 2) -#define VDMA_XFERSIZE (HALF_SAM) -#define VDMA_INIT IOMD_VIDINIT -#define VDMA_START IOMD_VIDSTART -#define VDMA_END IOMD_VIDEND - -#ifndef __ASSEMBLY__ -extern unsigned int vram_half_sam; -#define video_set_dma(start,end,offset) \ -do { \ - outl (SCREEN_START + start, VDMA_START); \ - outl (SCREEN_START + end - VDMA_XFERSIZE, VDMA_END); \ - if (offset >= end - VDMA_XFERSIZE) \ - offset |= 0x40000000; \ - outl (SCREEN_START + offset, VDMA_INIT); \ -} while (0) -#endif - diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/keyboard.h linux/include/asm-arm/keyboard.h --- v2.4.0-test8/linux/include/asm-arm/keyboard.h Thu Dec 17 09:05:43 1998 +++ linux/include/asm-arm/keyboard.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/keyboard.h + * linux/include/asm-arm/keyboard.h * - * Keyboard driver definitions for ARM + * Copyright (C) 1998 Russell King * - * (C) 1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Keyboard driver definitions for ARM */ #ifndef __ASM_ARM_KEYBOARD_H #define __ASM_ARM_KEYBOARD_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/leds.h linux/include/asm-arm/leds.h --- v2.4.0-test8/linux/include/asm-arm/leds.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/leds.h Mon Sep 18 15:15:23 2000 @@ -1,11 +1,14 @@ /* - * include/asm-arm/leds.h + * linux/include/asm-arm/leds.h * - * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Russell King * - * Event-driven interface for LEDs on machines + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Added led_start and led_stop- Alex Holden, 28th Dec 1998. + * Event-driven interface for LEDs on machines + * Added led_start and led_stop- Alex Holden, 28th Dec 1998. */ #ifndef ASM_ARM_LEDS_H #define ASM_ARM_LEDS_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/linux_logo.h linux/include/asm-arm/linux_logo.h --- v2.4.0-test8/linux/include/asm-arm/linux_logo.h Thu Dec 17 09:05:43 1998 +++ linux/include/asm-arm/linux_logo.h Mon Sep 18 15:15:23 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/linux_logo.h + * linux/include/asm-arm/linux_logo.h * - * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Russell King * - * Linux console driver logo definitions for ARM + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Linux console driver logo definitions for ARM */ #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mach/arch.h linux/include/asm-arm/mach/arch.h --- v2.4.0-test8/linux/include/asm-arm/mach/arch.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/mach/arch.h Mon Sep 18 15:15:23 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/mach/arch.h + * linux/include/asm-arm/mach/arch.h * - * Copyright (C) 2000 Russell King + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mach/dma.h linux/include/asm-arm/mach/dma.h --- v2.4.0-test8/linux/include/asm-arm/mach/dma.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/mach/dma.h Mon Sep 18 15:15:23 2000 @@ -1,10 +1,14 @@ /* - * linux/arch/arm/kernel/dma.h + * linux/include/asm-arm/mach/dma.h * - * Copyright (C) 1998-2000 Russell King + * Copyright (C) 1998-2000 Russell King * - * This header file describes the interface between the generic DMA handler - * (dma.c) and the architecture-specific DMA backends (dma-*.c) + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This header file describes the interface between the generic DMA handler + * (dma.c) and the architecture-specific DMA backends (dma-*.c) */ struct dma_struct; @@ -46,4 +50,6 @@ * Purpose : Initialise architecture specific DMA * Params : dma - pointer to array of DMA structures */ -void arch_dma_init(dma_t *dma); +extern void arch_dma_init(dma_t *dma); + +extern void isa_init_dma(dma_t *dma); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mach/map.h linux/include/asm-arm/mach/map.h --- v2.4.0-test8/linux/include/asm-arm/mach/map.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/mach/map.h Mon Sep 18 15:15:23 2000 @@ -3,6 +3,10 @@ * * Copyright (C) 1999-2000 Russell King * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * * Page table mapping constructs and function prototypes */ struct map_desc { diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mach/pci.h linux/include/asm-arm/mach/pci.h --- v2.4.0-test8/linux/include/asm-arm/mach/pci.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/mach/pci.h Mon Sep 18 15:15:23 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/mach/pci.h + * linux/include/asm-arm/mach/pci.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define MAX_NR_BUS 2 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/memc.h linux/include/asm-arm/memc.h --- v2.4.0-test8/linux/include/asm-arm/memc.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/memc.h Wed Dec 31 16:00:00 1969 @@ -1,17 +0,0 @@ -#define VDMA_ALIGNMENT PAGE_SIZE -#define VDMA_XFERSIZE 16 -#define VDMA_INIT 0 -#define VDMA_START 1 -#define VDMA_END 2 - -#ifndef __ASSEMBLY__ -extern void memc_write(unsigned int reg, unsigned long val); - -#define video_set_dma(start,end,offset) \ -do { \ - memc_write (VDMA_START, (start >> 2)); \ - memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2); \ - memc_write (VDMA_INIT, (offset >> 2)); \ -} while (0) - -#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/memory.h linux/include/asm-arm/memory.h --- v2.4.0-test8/linux/include/asm-arm/memory.h Mon Jun 26 12:04:42 2000 +++ linux/include/asm-arm/memory.h Mon Sep 18 15:15:24 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/memory.h + * linux/include/asm-arm/memory.h * - * Copyright (C) 2000 Russell King + * Copyright (C) 2000 Russell King * - * Note: this file should not be included by non-asm/.h files + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Modifications: + * Note: this file should not be included by non-asm/.h files + * + * Modifications: */ #ifndef __ASM_ARM_MEMORY_H #define __ASM_ARM_MEMORY_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mmu_context.h linux/include/asm-arm/mmu_context.h --- v2.4.0-test8/linux/include/asm-arm/mmu_context.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/mmu_context.h Mon Sep 18 15:15:24 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/mmu_context.h + * linux/include/asm-arm/mmu_context.h * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 27-06-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 27-06-1996 RMK Created */ #ifndef __ASM_ARM_MMU_CONTEXT_H #define __ASM_ARM_MMU_CONTEXT_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/mmzone.h linux/include/asm-arm/mmzone.h --- v2.4.0-test8/linux/include/asm-arm/mmzone.h Mon Jun 19 17:59:35 2000 +++ linux/include/asm-arm/mmzone.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,12 @@ /* - * linux/include/asm-arm/mmzone.h + * linux/include/asm-arm/mmzone.h * - * 1999-12-29 Nicolas Pitre Created + * 1999-12-29 Nicolas Pitre Created + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #ifndef __ASM_MMZONE_H #define __ASM_MMZONE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/param.h linux/include/asm-arm/param.h --- v2.4.0-test8/linux/include/asm-arm/param.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/param.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/param.h + * linux/include/asm-arm/param.h * - * Copyright (C) 1995-1999 Russell King + * Copyright (C) 1995-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PARAM_H #define __ASM_PARAM_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/parport.h linux/include/asm-arm/parport.h --- v2.4.0-test8/linux/include/asm-arm/parport.h Tue Mar 14 18:04:50 2000 +++ linux/include/asm-arm/parport.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,7 @@ /* - * parport.h: ARM-specific parport initialisation + * linux/include/asm-arm/parport.h: ARM-specific parport initialisation * - * Copyright (C) 1999, 2000 Tim Waugh + * Copyright (C) 1999, 2000 Tim Waugh * * This file should only be included by drivers/parport/parport_pc.c. */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/pgalloc.h linux/include/asm-arm/pgalloc.h --- v2.4.0-test8/linux/include/asm-arm/pgalloc.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/pgalloc.h Mon Sep 18 15:15:24 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/pgalloc.h + * linux/include/asm-arm/pgalloc.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef _ASMARM_PGALLOC_H #define _ASMARM_PGALLOC_H @@ -49,7 +55,7 @@ if ((ret = pgd_quicklist) != NULL) { pgd_quicklist = (unsigned long *)__pgd_next(ret); ret[1] = ret[2]; - clean_cache_area(ret + 1, 4); + clean_dcache_entry(ret + 1); pgtable_cache_size--; } return (pgd_t *)ret; @@ -76,7 +82,7 @@ if((ret = pte_quicklist) != NULL) { pte_quicklist = (unsigned long *)__pte_next(ret); ret[0] = ret[1]; - clean_cache_area(ret, 4); + clean_dcache_entry(ret); pgtable_cache_size--; } return (pte_t *)ret; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/pgtable.h linux/include/asm-arm/pgtable.h --- v2.4.0-test8/linux/include/asm-arm/pgtable.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/pgtable.h Mon Sep 18 15:15:24 2000 @@ -1,5 +1,11 @@ /* - * linux/include/asm-arm/pgtable.h + * linux/include/asm-arm/pgtable.h + * + * Copyright (C) 2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef _ASMARM_PGTABLE_H #define _ASMARM_PGTABLE_H @@ -88,7 +94,7 @@ * which, if __va and __pa are expensive causes twice the expense for * zero gain. --rmk */ -#define pte_page(x) (mem_map + MAP_NR(__va(pte_val((x))))) +#define pte_page(x) (virt_to_page(__va(pte_val((x))))) #endif #define pmd_none(pmd) (!pmd_val(pmd)) @@ -172,6 +178,10 @@ #define module_map vmalloc #define module_unmap vfree + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +/* FIXME: this is not correct */ +#define kern_addr_valid(addr) (1) #define io_remap_page_range remap_page_range diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/posix_types.h linux/include/asm-arm/posix_types.h --- v2.4.0-test8/linux/include/asm-arm/posix_types.h Sat Jan 15 22:08:28 2000 +++ linux/include/asm-arm/posix_types.h Mon Sep 18 15:15:24 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/posix_types.h + * linux/include/asm-arm/posix_types.h * - * Copyright (c) 1996-1998 Russell King. + * Copyright (C) 1996-1998 Russell King. * - * Changelog: - * 27-06-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 27-06-1996 RMK Created */ #ifndef __ARCH_ARM_POSIX_TYPES_H #define __ARCH_ARM_POSIX_TYPES_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/assembler.h linux/include/asm-arm/proc-armo/assembler.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/assembler.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/proc-armo/assembler.h Mon Sep 18 15:15:24 2000 @@ -1,10 +1,14 @@ /* - * linux/asm-arm/proc-armo/assembler.h + * linux/asm-arm/proc-armo/assembler.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * This file contains arm architecture specific defines - * for the different processors + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains arm architecture specific defines + * for the different processors */ #define MODE_USR USR26_MODE #define MODE_FIQ FIQ26_MODE diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/cache.h linux/include/asm-arm/proc-armo/cache.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/cache.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/proc-armo/cache.h Mon Sep 18 15:15:24 2000 @@ -1,5 +1,13 @@ /* - * Cache handling for 26-bit ARM processors. + * linux/include/asm-arm/proc-armo/cache.h + * + * Copyright (C) 1999-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Cache handling for 26-bit ARM processors. */ #define flush_cache_all() do { } while (0) #define flush_cache_mm(mm) do { } while (0) @@ -74,6 +82,3 @@ if (mm == current->active_mm) processor._set_pgd(mm->pgd); } - -#define __flush_entry_to_ram(entry) - diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/io.h linux/include/asm-arm/proc-armo/io.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/io.h Sun Sep 6 10:45:30 1998 +++ linux/include/asm-arm/proc-armo/io.h Wed Dec 31 16:00:00 1969 @@ -1,8 +0,0 @@ -/* - * linux/include/asm-arm/proc-armo/io.h - */ - -/* Nothing to do */ -#define dma_cache_inv(_start,_size) do { } while (0) -#define dma_cache_wback(_start,_size) do { } while (0) -#define dma_cache_wback_inv(_start,_size) do { } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/locks.h linux/include/asm-arm/proc-armo/locks.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/locks.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/proc-armo/locks.h Mon Sep 18 15:15:24 2000 @@ -1,11 +1,14 @@ /* - * linux/include/asm-arm/proc-armo/locks.h + * linux/include/asm-arm/proc-armo/locks.h * - * Copyright (C) 2000 Russell King - * Fixes for 26 bit machines, (C) 2000 Dave Gilbert + * Copyright (C) 2000 Russell King + * Fixes for 26 bit machines, (C) 2000 Dave Gilbert * - * Interrupt safe locking assembler. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * + * Interrupt safe locking assembler. */ #ifndef __ASM_PROC_LOCKS_H #define __ASM_PROC_LOCKS_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/page.h linux/include/asm-arm/proc-armo/page.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/page.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/proc-armo/page.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armo/page.h + * linux/include/asm-arm/proc-armo/page.h * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROC_PAGE_H #define __ASM_PROC_PAGE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/pgtable.h linux/include/asm-arm/proc-armo/pgtable.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/pgtable.h Thu Oct 28 10:16:02 1999 +++ linux/include/asm-arm/proc-armo/pgtable.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/proc-armo/pgtable.h + * linux/include/asm-arm/proc-armo/pgtable.h * - * Copyright (C) 1995-1999 Russell King + * Copyright (C) 1995-1999 Russell King * - * 18-Oct-1997 RMK Now two-level (32x32) + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 18-Oct-1997 RMK Now two-level (32x32) */ #ifndef __ASM_PROC_PGTABLE_H #define __ASM_PROC_PGTABLE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/processor.h linux/include/asm-arm/proc-armo/processor.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/processor.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/proc-armo/processor.h Mon Sep 18 15:15:24 2000 @@ -1,16 +1,20 @@ /* - * linux/include/asm-arm/proc-armo/processor.h + * linux/include/asm-arm/proc-armo/processor.h * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 27-06-1996 RMK Created - * 10-10-1996 RMK Brought up to date with SA110 - * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' - * 28-09-1996 RMK Moved start_thread into the processor dependencies - * 11-01-1998 RMK Added new uaccess_t - * 09-09-1998 PJB Delete redundant `wp_works_ok' - * 30-05-1999 PJB Save sl across context switches + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 27-06-1996 RMK Created + * 10-10-1996 RMK Brought up to date with SA110 + * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' + * 28-09-1996 RMK Moved start_thread into the processor dependencies + * 11-01-1998 RMK Added new uaccess_t + * 09-09-1998 PJB Delete redundant `wp_works_ok' + * 30-05-1999 PJB Save sl across context switches */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/ptrace.h linux/include/asm-arm/proc-armo/ptrace.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/ptrace.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/proc-armo/ptrace.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armo/ptrace.h + * linux/include/asm-arm/proc-armo/ptrace.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROC_PTRACE_H #define __ASM_PROC_PTRACE_H @@ -53,6 +57,8 @@ #define user_mode(regs) \ (processor_mode(regs) == USR26_MODE) + +#define thumb_mode(regs) (0) #define interrupts_enabled(regs) \ (!((regs)->ARM_pc & I_BIT)) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/shmparam.h linux/include/asm-arm/proc-armo/shmparam.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/shmparam.h Wed Nov 3 11:31:09 1999 +++ linux/include/asm-arm/proc-armo/shmparam.h Mon Sep 18 15:15:24 2000 @@ -1,11 +1,14 @@ /* - * linux/include/asm-arm/proc-armo/shmparam.h + * linux/include/asm-arm/proc-armo/shmparam.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * definitions for the shared process memory on the ARM3 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * definitions for the shared process memory on the ARM3 */ - #ifndef __ASM_PROC_SHMPARAM_H #define __ASM_PROC_SHMPARAM_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/system.h linux/include/asm-arm/proc-armo/system.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/system.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/proc-armo/system.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,12 @@ /* - * linux/include/asm-arm/proc-armo/system.h + * linux/include/asm-arm/proc-armo/system.h * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #ifndef __ASM_PROC_SYSTEM_H #define __ASM_PROC_SYSTEM_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/uaccess.h linux/include/asm-arm/proc-armo/uaccess.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/uaccess.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/proc-armo/uaccess.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armo/segment.h + * linux/include/asm-arm/proc-armo/segment.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ /* diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armo/uncompress.h linux/include/asm-arm/proc-armo/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/proc-armo/uncompress.h Tue Jan 20 16:39:43 1998 +++ linux/include/asm-arm/proc-armo/uncompress.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armo/uncompress.h + * linux/include/asm-arm/proc-armo/uncompress.h * - * (c) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #define proc_decomp_setup() diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/assembler.h linux/include/asm-arm/proc-armv/assembler.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/assembler.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/proc-armv/assembler.h Mon Sep 18 15:15:24 2000 @@ -1,10 +1,14 @@ /* - * linux/asm-arm/proc-armv/assembler.h + * linux/asm-arm/proc-armv/assembler.h * - * Copyright (C) 1996-2000 Russell King + * Copyright (C) 1996-2000 Russell King * - * This file contains ARM processor specifics for - * the ARM6 and better processors. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This file contains ARM processor specifics for + * the ARM6 and better processors. */ #define MODE_USR USR_MODE #define MODE_FIQ FIQ_MODE diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/cache.h linux/include/asm-arm/proc-armv/cache.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/cache.h Sun Aug 6 11:43:18 2000 +++ linux/include/asm-arm/proc-armv/cache.h Mon Sep 18 15:15:24 2000 @@ -1,57 +1,98 @@ +/* + * linux/include/asm-arm/proc-armv/cache.h + * + * Copyright (C) 1999-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ #include /* - * Cache flushing... + * Cache handling for 32-bit ARM processors. + * + * Note that on ARM, we have a more accurate specification than that + * Linux's "flush". We therefore do not use "flush" here, but instead + * use: + * + * clean: the act of pushing dirty cache entries out to memory. + * invalidate: the act of discarding data held within the cache, + * whether it is dirty or not. + */ + +/* + * Generic I + D cache */ #define flush_cache_all() \ - cpu_flush_cache_all() + do { \ + cpu_cache_clean_invalidate_all(); \ + } while (0) +/* This is always called for current->mm */ #define flush_cache_mm(_mm) \ do { \ - if ((_mm) == current->mm) \ - cpu_flush_cache_all(); \ + if ((_mm) == current->active_mm) \ + cpu_cache_clean_invalidate_all(); \ } while (0) #define flush_cache_range(_mm,_start,_end) \ do { \ if ((_mm) == current->mm) \ - cpu_flush_cache_area((_start), (_end), 1); \ + cpu_cache_clean_invalidate_range((_start), (_end), 1); \ } while (0) #define flush_cache_page(_vma,_vmaddr) \ do { \ - if ((_vma)->vm_mm == current->mm) \ - cpu_flush_cache_area((_vmaddr), \ + if ((_vma)->vm_mm == current->mm) { \ + cpu_cache_clean_invalidate_range((_vmaddr), \ (_vmaddr) + PAGE_SIZE, \ ((_vma)->vm_flags & VM_EXEC)); \ + } \ } while (0) -#define clean_cache_range(_start,_end) \ - do { \ - unsigned long _s, _sz; \ - _s = (unsigned long)_start; \ - _sz = (unsigned long)_end - _s; \ - cpu_clean_cache_area(_s, _sz); \ - } while (0) +/* + * This flushes back any buffered write data. We have to clean the entries + * in the cache for this page. This does not invalidate either I or D caches. + */ +static __inline__ void flush_page_to_ram(struct page *page) +{ + cpu_flush_ram_page(page_address(page)); +} -#define clean_cache_area(_start,_size) \ +/* + * D cache only + */ + +#define invalidate_dcache_range(_s,_e) cpu_dcache_invalidate_range((_s),(_e)) +#define clean_dcache_range(_s,_e) cpu_dcache_clean_range((_s),(_e)) +#define flush_dcache_range(_s,_e) cpu_cache_clean_invalidate_range((_s),(_e),0) + +/* + * FIXME: We currently clean the dcache for this page. Should we + * also invalidate the Dcache? And what about the Icache? -- rmk + */ +#define flush_dcache_page(page) cpu_dcache_clean_page(page_address(page)) + +#define clean_dcache_entry(_s) cpu_dcache_clean_entry((unsigned long)(_s)) + +/* + * I cache only + */ +#define flush_icache_range(_s,_e) \ do { \ - unsigned long _s; \ - _s = (unsigned long)_start; \ - cpu_clean_cache_area(_s, _size); \ + cpu_icache_invalidate_range((_s), (_e)); \ } while (0) -#define flush_icache_range(_start,_end) \ - cpu_flush_icache_area((_start), (_end) - (_start)) - #define flush_icache_page(vma,pg) \ do { \ if ((vma)->vm_flags & PROT_EXEC) \ - cpu_flush_icache_page((unsigned long) page_address(pg)); \ + cpu_icache_invalidate_page(page_address(pg)); \ } while (0) /* - * We don't have a MEMC chip... + * Old ARM MEMC stuff. This supports the reversed mapping handling that + * we have on the older 26-bit machines. We don't have a MEMC chip, so... */ #define memc_update_all() do { } while (0) #define memc_update_mm(mm) do { } while (0) @@ -59,48 +100,57 @@ #define memc_clear(mm,physaddr) do { } while (0) /* - * This flushes back any buffered write data. We have to clean the entries - * in the cache for this page. This does not invalidate either I or D caches. - */ -static __inline__ void flush_page_to_ram(struct page *page) -{ - cpu_flush_ram_page((unsigned long) page_address(page)); -} - -/* You guys might need to do something here. -DaveM */ -#define flush_dcache_page(page) do { } while (0) - -/* - * TLB flushing: + * TLB flushing. * - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages + * - flush_tlb_all() flushes all processes TLBs + * - flush_tlb_mm(mm) flushes the specified mm context TLB's + * - flush_tlb_page(vma, vmaddr) flushes TLB for specified page + * - flush_tlb_range(mm, start, end) flushes TLB for specified range of pages * * We drain the write buffer in here to ensure that the page tables in ram * are really up to date. It is more efficient to do this here... */ -#define flush_tlb_all() \ - cpu_flush_tlb_all() -#define flush_tlb_mm(_mm) \ - do { \ - if ((_mm) == current->mm) \ - cpu_flush_tlb_all(); \ - } while (0) - -#define flush_tlb_range(_mm,_start,_end) \ - do { \ - if ((_mm) == current->mm) \ - cpu_flush_tlb_area((_start), (_end), 1); \ - } while (0) - -#define flush_tlb_page(_vma,_vmaddr) \ - do { \ - if ((_vma)->vm_mm == current->mm) \ - cpu_flush_tlb_page((_vmaddr), \ - ((_vma)->vm_flags & VM_EXEC)); \ +/* + * Notes: + * current->active_mm is the currently active memory description. + * current->mm == NULL iff we are lazy. + */ +#define flush_tlb_all() \ + do { \ + cpu_tlb_invalidate_all(); \ } while (0) +/* + * Flush all user virtual address space translations described by `_mm'. + * + * Currently, this is always called for current->mm, which should be + * the same as current->active_mm. This is currently not be called for + * the lazy TLB case. + */ +#define flush_tlb_mm(_mm) \ + do { \ + if ((_mm) == current->active_mm) \ + cpu_tlb_invalidate_all(); \ + } while (0) + +/* + * Flush the specified range of user virtual address space translations. + * + * _mm may not be current->active_mm, but may not be NULL. + */ +#define flush_tlb_range(_mm,_start,_end) \ + do { \ + if ((_mm) == current->active_mm) \ + cpu_tlb_invalidate_range((_start), (_end)); \ + } while (0) +/* + * Flush the specified user virtual address space translation. + */ +#define flush_tlb_page(_vma,_page) \ + do { \ + if ((_vma)->vm_mm == current->active_mm) \ + cpu_tlb_invalidate_page((_page), \ + ((_vma)->vm_flags & VM_EXEC)); \ + } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/domain.h linux/include/asm-arm/proc-armv/domain.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/domain.h Mon Aug 2 10:19:52 1999 +++ linux/include/asm-arm/proc-armv/domain.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armv/domain.h + * linux/include/asm-arm/proc-armv/domain.h * - * Copyright (C) 1999 Russell King. + * Copyright (C) 1999 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROC_DOMAIN_H #define __ASM_PROC_DOMAIN_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/io.h linux/include/asm-arm/proc-armv/io.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/io.h Mon Aug 30 18:15:21 1999 +++ linux/include/asm-arm/proc-armv/io.h Wed Dec 31 16:00:00 1969 @@ -1,35 +0,0 @@ -/* - * linux/include/asm-arm/proc-armv/io.h - */ - -/* - * The caches on some architectures aren't dma-coherent and have need to - * handle this in software. There are two types of operations that - * can be applied to dma buffers. - * - * - dma_cache_wback_inv(start, size) makes caches and RAM coherent by - * writing the content of the caches back to memory, if necessary. - * The function also invalidates the affected part of the caches as - * necessary before DMA transfers from outside to memory. - * - dma_cache_inv(start, size) invalidates the affected parts of the - * caches. Dirty lines of the caches may be written back or simply - * be discarded. This operation is necessary before dma operations - * to the memory. - * - dma_cache_wback(start, size) writes back any dirty lines but does - * not invalidate the cache. This can be used before DMA reads from - * memory, - */ - -#include - -#define dma_cache_inv(start, size) \ - do { cpu_cache_purge_area((unsigned long)(start), \ - ((unsigned long)(start)+(size))); } while (0) - -#define dma_cache_wback(start, size) \ - do { cpu_cache_wback_area((unsigned long)(start), \ - ((unsigned long)(start)+(size))); } while (0) - -#define dma_cache_wback_inv(start, size) \ - do { cpu_flush_cache_area((unsigned long)(start), \ - ((unsigned long)(start)+(size)), 0); } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/locks.h linux/include/asm-arm/proc-armv/locks.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/locks.h Mon Jun 19 17:59:35 2000 +++ linux/include/asm-arm/proc-armv/locks.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/proc-armv/locks.h + * linux/include/asm-arm/proc-armv/locks.h * - * Copyright (C) 2000 Russell King + * Copyright (C) 2000 Russell King * - * Interrupt safe locking assembler. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Interrupt safe locking assembler. */ #ifndef __ASM_PROC_LOCKS_H #define __ASM_PROC_LOCKS_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/page.h linux/include/asm-arm/proc-armv/page.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/page.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/proc-armv/page.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armv/page.h + * linux/include/asm-arm/proc-armv/page.h * - * Copyright (C) 1995, 1996 Russell King + * Copyright (C) 1995, 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROC_PAGE_H #define __ASM_PROC_PAGE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/pgtable.h linux/include/asm-arm/proc-armv/pgtable.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/pgtable.h Tue Apr 25 16:54:38 2000 +++ linux/include/asm-arm/proc-armv/pgtable.h Mon Sep 18 15:15:24 2000 @@ -1,11 +1,15 @@ /* - * linux/include/asm-arm/proc-armv/pgtable.h + * linux/include/asm-arm/proc-armv/pgtable.h * - * Copyright (C) 1995-1999 Russell King + * Copyright (C) 1995-1999 Russell King * - * 12-Jan-1997 RMK Altered flushing routines to use function pointers + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 12-Jan-1997 RMK Altered flushing routines to use function pointers * now possible to combine ARM6, ARM7 and StrongARM versions. - * 17-Apr-1999 RMK Now pass an area size to clean_cache_area and + * 17-Apr-1999 RMK Now pass an area size to clean_cache_area and * flush_icache_area. */ #ifndef __ASM_PROC_PGTABLE_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/processor.h linux/include/asm-arm/proc-armv/processor.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/processor.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/proc-armv/processor.h Mon Sep 18 15:15:24 2000 @@ -1,15 +1,19 @@ /* - * linux/include/asm-arm/proc-armv/processor.h + * linux/include/asm-arm/proc-armv/processor.h * - * Copyright (c) 1996-1999 Russell King. + * Copyright (C) 1996-1999 Russell King. * - * Changelog: - * 20-09-1996 RMK Created - * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' - * 28-09-1996 RMK Moved start_thread into the processor dependencies - * 09-09-1998 PJB Delete redundant `wp_works_ok' - * 30-05-1999 PJB Save sl across context switches - * 31-07-1999 RMK Added 'domain' stuff + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 20-09-1996 RMK Created + * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' + * 28-09-1996 RMK Moved start_thread into the processor dependencies + * 09-09-1998 PJB Delete redundant `wp_works_ok' + * 30-05-1999 PJB Save sl across context switches + * 31-07-1999 RMK Added 'domain' stuff */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/ptrace.h linux/include/asm-arm/proc-armv/ptrace.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/ptrace.h Wed Oct 20 16:29:08 1999 +++ linux/include/asm-arm/proc-armv/ptrace.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armv/ptrace.h + * linux/include/asm-arm/proc-armv/ptrace.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROC_PTRACE_H #define __ASM_PROC_PTRACE_H @@ -18,6 +22,7 @@ #define UND_MODE 0x1b #define SYSTEM_MODE 0x1f #define MODE_MASK 0x1f +#define T_BIT 0x20 #define F_BIT 0x40 #define I_BIT 0x80 #define CC_V_BIT (1 << 28) @@ -58,6 +63,9 @@ #define user_mode(regs) \ (((regs)->ARM_cpsr & 0xf) == 0) + +#define thumb_mode(regs) \ + (((regs)->ARM_cpsr & T_BIT)) #define processor_mode(regs) \ ((regs)->ARM_cpsr & MODE_MASK) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/shmparam.h linux/include/asm-arm/proc-armv/shmparam.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/shmparam.h Wed Nov 3 11:31:09 1999 +++ linux/include/asm-arm/proc-armv/shmparam.h Mon Sep 18 15:15:24 2000 @@ -1,12 +1,15 @@ /* - * linux/include/asm-arm/proc-armv/shmparam.h + * linux/include/asm-arm/proc-armv/shmparam.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King * - * definitions for the shared process memory on ARM v3 or v4 - * processors + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * definitions for the shared process memory on ARM v3 or v4 + * processors */ - #ifndef __ASM_PROC_SHMPARAM_H #define __ASM_PROC_SHMPARAM_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/system.h linux/include/asm-arm/proc-armv/system.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/system.h Sun Sep 3 11:19:11 2000 +++ linux/include/asm-arm/proc-armv/system.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,12 @@ /* - * linux/include/asm-arm/proc-armv/system.h + * linux/include/asm-arm/proc-armv/system.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #ifndef __ASM_PROC_SYSTEM_H #define __ASM_PROC_SYSTEM_H @@ -72,36 +75,6 @@ __asm__ __volatile__( \ "mrs %0, cpsr @ cli\n" \ " orr %0, %0, #128\n" \ -" msr cpsr_c, %0" \ - : "=r" (temp) \ - : \ - : "memory"); \ - }) - -/* - * Enable FIQs - */ -#define __stf() \ - ({ \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %0, cpsr @ stf\n" \ -" bic %0, %0, #64\n" \ -" msr cpsr_c, %0" \ - : "=r" (temp) \ - : \ - : "memory"); \ - }) - -/* - * Disable FIQs - */ -#define __clf() \ - ({ \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %0, cpsr @ clf\n" \ -" orr %0, %0, #64\n" \ " msr cpsr_c, %0" \ : "=r" (temp) \ : \ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/uaccess.h linux/include/asm-arm/proc-armv/uaccess.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/uaccess.h Sun Aug 13 09:54:15 2000 +++ linux/include/asm-arm/proc-armv/uaccess.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,10 @@ /* - * linux/include/asm-arm/proc-armv/uaccess.h + * linux/include/asm-arm/proc-armv/uaccess.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ - #include #include diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-armv/uncompress.h linux/include/asm-arm/proc-armv/uncompress.h --- v2.4.0-test8/linux/include/asm-arm/proc-armv/uncompress.h Thu Jan 13 13:30:31 2000 +++ linux/include/asm-arm/proc-armv/uncompress.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/proc-armv/uncompress.h + * linux/include/asm-arm/proc-armv/uncompress.h * - * (c) 1997 Russell King + * Copyright (C) 1997 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ static inline void proc_decomp_setup (void) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/proc-fns.h linux/include/asm-arm/proc-fns.h --- v2.4.0-test8/linux/include/asm-arm/proc-fns.h Fri May 12 11:21:20 2000 +++ linux/include/asm-arm/proc-fns.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,12 @@ /* - * linux/include/asm-arm/proc-fns.h + * linux/include/asm-arm/proc-fns.h * - * Copyright (C) 1997-1999 Russell King + * Copyright (C) 1997-1999 Russell King + * Copyright (C) 2000 Deep Blue Solutions Ltd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROCFNS_H #define __ASM_PROCFNS_H @@ -39,28 +44,36 @@ # define CPU_NAME arm7 # endif # endif -# ifdef CONFIG_CPU_SA110 +# ifdef CONFIG_CPU_ARM720 # ifdef CPU_NAME # undef MULTI_CPU # define MULTI_CPU # else -# define CPU_NAME sa110 +# define CPU_NAME arm720 # endif # endif -# ifdef CONFIG_CPU_SA1100 +# ifdef CONFIG_CPU_ARM920 # ifdef CPU_NAME # undef MULTI_CPU # define MULTI_CPU # else -# define CPU_NAME sa1100 +# define CPU_NAME arm920 # endif # endif -# ifdef CONFIG_CPU_ARM720 +# ifdef CONFIG_CPU_SA110 # ifdef CPU_NAME # undef MULTI_CPU # define MULTI_CPU # else -# define CPU_NAME arm720 +# define CPU_NAME sa110 +# endif +# endif +# ifdef CONFIG_CPU_SA1100 +# ifdef CPU_NAME +# undef MULTI_CPU +# define MULTI_CPU +# else +# define CPU_NAME sa1100 # endif # endif #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/processor.h linux/include/asm-arm/processor.h --- v2.4.0-test8/linux/include/asm-arm/processor.h Fri Jan 7 12:59:42 2000 +++ linux/include/asm-arm/processor.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * include/asm-arm/processor.h + * linux/include/asm-arm/processor.h * - * Copyright (C) 1995 Russell King + * Copyright (C) 1995 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_ARM_PROCESSOR_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/procinfo.h linux/include/asm-arm/procinfo.h --- v2.4.0-test8/linux/include/asm-arm/procinfo.h Sun Mar 12 19:39:39 2000 +++ linux/include/asm-arm/procinfo.h Mon Sep 18 15:15:24 2000 @@ -1,7 +1,11 @@ /* - * linux/include/asm-arm/procinfo.h + * linux/include/asm-arm/procinfo.h * - * Copyright (C) 1996-1999 Russell King + * Copyright (C) 1996-1999 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __ASM_PROCINFO_H #define __ASM_PROCINFO_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/serial.h linux/include/asm-arm/serial.h --- v2.4.0-test8/linux/include/asm-arm/serial.h Tue Nov 23 22:23:11 1999 +++ linux/include/asm-arm/serial.h Mon Sep 18 15:15:24 2000 @@ -1,10 +1,14 @@ /* - * linux/include/asm-arm/serial.h + * linux/include/asm-arm/serial.h * - * Copyright (c) 1996 Russell King. + * Copyright (C) 1996 Russell King. * - * Changelog: - * 15-10-1996 RMK Created + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Changelog: + * 15-10-1996 RMK Created */ #ifndef __ASM_SERIAL_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/setup.h linux/include/asm-arm/setup.h --- v2.4.0-test8/linux/include/asm-arm/setup.h Mon Jun 19 17:59:35 2000 +++ linux/include/asm-arm/setup.h Mon Sep 18 15:15:24 2000 @@ -1,11 +1,15 @@ /* - * include/asm/setup.h + * linux/include/asm/setup.h * - * Structure passed to kernel to tell it about the - * hardware it's running on. See linux/Documentation/arm/Setup - * for more info. + * Copyright (C) 1997-1999 Russell King * - * Copyright (C) 1997-1999 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Structure passed to kernel to tell it about the + * hardware it's running on. See linux/Documentation/arm/Setup + * for more info. */ #ifndef __ASMARM_SETUP_H #define __ASMARM_SETUP_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-arm/timex.h linux/include/asm-arm/timex.h --- v2.4.0-test8/linux/include/asm-arm/timex.h Thu Jan 7 15:51:33 1999 +++ linux/include/asm-arm/timex.h Mon Sep 18 15:15:24 2000 @@ -1,9 +1,13 @@ /* - * linux/include/asm-arm/timex.h + * linux/include/asm-arm/timex.h * - * Architecture Specific TIME specifications + * Copyright (C) 1997,1998 Russell King * - * Copyright (C) 1997,1998 Russell King + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Architecture Specific TIME specifications */ #ifndef _ASMARM_TIMEX_H #define _ASMARM_TIMEX_H diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-i386/semaphore.h linux/include/asm-i386/semaphore.h --- v2.4.0-test8/linux/include/asm-i386/semaphore.h Fri Sep 8 12:52:41 2000 +++ linux/include/asm-i386/semaphore.h Mon Sep 18 15:37:55 2000 @@ -64,7 +64,7 @@ #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) -extern inline void sema_init (struct semaphore *sem, int val) +static inline void sema_init (struct semaphore *sem, int val) { /* * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); @@ -105,7 +105,7 @@ * "__down_failed" is a special asm handler that calls the C * routine that actually waits. See arch/i386/kernel/semaphore.c */ -extern inline void down(struct semaphore * sem) +static inline void down(struct semaphore * sem) { #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); @@ -125,7 +125,7 @@ :"memory"); } -extern inline int down_interruptible(struct semaphore * sem) +static inline int down_interruptible(struct semaphore * sem) { int result; @@ -149,7 +149,7 @@ return result; } -extern inline int down_trylock(struct semaphore * sem) +static inline int down_trylock(struct semaphore * sem) { int result; @@ -179,7 +179,7 @@ * The default case (no contention) will result in NO * jumps for both down() and up(). */ -extern inline void up(struct semaphore * sem) +static inline void up(struct semaphore * sem) { #if WAITQUEUE_DEBUG CHECK_MAGIC(sem->__magic); @@ -252,7 +252,7 @@ #define DECLARE_RWSEM_READ_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1) #define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0) -extern inline void init_rwsem(struct rw_semaphore *sem) +static inline void init_rwsem(struct rw_semaphore *sem) { atomic_set(&sem->count, RW_LOCK_BIAS); sem->read_bias_granted = 0; @@ -271,7 +271,7 @@ extern struct rw_semaphore *FASTCALL(__down_write_failed(struct rw_semaphore *sem)); extern struct rw_semaphore *FASTCALL(__rwsem_wake(struct rw_semaphore *sem)); -extern inline void down_read(struct rw_semaphore *sem) +static inline void down_read(struct rw_semaphore *sem) { #if WAITQUEUE_DEBUG if (sem->__magic != (long)&sem->__magic) @@ -287,7 +287,7 @@ #endif } -extern inline void down_write(struct rw_semaphore *sem) +static inline void down_write(struct rw_semaphore *sem) { #if WAITQUEUE_DEBUG if (sem->__magic != (long)&sem->__magic) @@ -311,7 +311,7 @@ * case is when there was a writer waiting, and we've * bumped the count to 0: we must wake the writer up. */ -extern inline void __up_read(struct rw_semaphore *sem) +static inline void __up_read(struct rw_semaphore *sem) { __asm__ __volatile__( "# up_read\n\t" @@ -330,7 +330,7 @@ /* releasing the writer is easy -- just release it and * wake up any sleepers. */ -extern inline void __up_write(struct rw_semaphore *sem) +static inline void __up_write(struct rw_semaphore *sem) { __asm__ __volatile__( "# up_write\n\t" @@ -346,7 +346,7 @@ ); } -extern inline void up_read(struct rw_semaphore *sem) +static inline void up_read(struct rw_semaphore *sem) { #if WAITQUEUE_DEBUG if (sem->write_bias_granted) @@ -358,7 +358,7 @@ __up_read(sem); } -extern inline void up_write(struct rw_semaphore *sem) +static inline void up_write(struct rw_semaphore *sem) { #if WAITQUEUE_DEBUG if (sem->read_bias_granted) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/atomic.h linux/include/asm-ppc/atomic.h --- v2.4.0-test8/linux/include/asm-ppc/atomic.h Tue May 2 13:05:40 2000 +++ linux/include/asm-ppc/atomic.h Sun Sep 17 09:48:07 2000 @@ -21,7 +21,7 @@ extern void atomic_clear_mask(unsigned long mask, unsigned long *addr); extern void atomic_set_mask(unsigned long mask, unsigned long *addr); -extern __inline__ int atomic_add_return(int a, atomic_t *v) +extern __inline__ int atomic_add_return(int a, volatile atomic_t *v) { int t; @@ -37,7 +37,7 @@ return t; } -extern __inline__ int atomic_sub_return(int a, atomic_t *v) +extern __inline__ int atomic_sub_return(int a, volatile atomic_t *v) { int t; @@ -53,7 +53,7 @@ return t; } -extern __inline__ int atomic_inc_return(atomic_t *v) +extern __inline__ int atomic_inc_return(volatile atomic_t *v) { int t; @@ -69,7 +69,7 @@ return t; } -extern __inline__ int atomic_dec_return(atomic_t *v) +extern __inline__ int atomic_dec_return(volatile atomic_t *v) { int t; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/backlight.h linux/include/asm-ppc/backlight.h --- v2.4.0-test8/linux/include/asm-ppc/backlight.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/backlight.h Sun Sep 17 09:48:07 2000 @@ -25,4 +25,4 @@ extern int set_backlight_level(int level); extern int get_backlight_level(void); -#endif \ No newline at end of file +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/bitops.h linux/include/asm-ppc/bitops.h --- v2.4.0-test8/linux/include/asm-ppc/bitops.h Wed Jul 5 22:15:26 2000 +++ linux/include/asm-ppc/bitops.h Sun Sep 17 09:48:07 2000 @@ -230,6 +230,8 @@ tmp = *p; found_first: tmp |= ~0UL << size; + if (tmp == ~0UL) /* Are any bits zero? */ + return result + size; /* Nope. */ found_middle: return result + ffz(tmp); } @@ -320,6 +322,8 @@ tmp = cpu_to_le32p(p); found_first: tmp |= ~0U << size; + if (tmp == ~0UL) /* Are any bits zero? */ + return result + size; /* Nope. */ found_middle: return result + ffz(tmp); } diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/bootx.h linux/include/asm-ppc/bootx.h --- v2.4.0-test8/linux/include/asm-ppc/bootx.h Sat Nov 27 15:42:33 1999 +++ linux/include/asm-ppc/bootx.h Sun Sep 17 09:48:08 2000 @@ -133,4 +133,3 @@ #endif #endif - \ No newline at end of file diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/cpm_8260.h linux/include/asm-ppc/cpm_8260.h --- v2.4.0-test8/linux/include/asm-ppc/cpm_8260.h Mon May 15 14:53:31 2000 +++ linux/include/asm-ppc/cpm_8260.h Sun Sep 17 09:48:08 2000 @@ -85,6 +85,7 @@ #define CPM_DATAONLY_BASE ((uint)128) #define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE) #define CPM_DP_NOSPACE ((uint)0x7fffffff) +#define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000) /* The number of pages of host memory we allocate for CPM. This is * done early in kernel initialization to get physically contiguous @@ -97,8 +98,8 @@ * and dual port ram. */ extern cpm8260_t *cpmp; /* Pointer to comm processor */ -uint m8260_cpm_dpalloc(uint size); -uint m8260_cpm_hostalloc(uint size); +uint m8260_cpm_dpalloc(uint size, uint align); +uint m8260_cpm_hostalloc(uint size, uint align); void m8260_cpm_setbrg(uint brg, uint rate); void m8260_cpm_fastbrg(uint brg, uint rate, int div16); @@ -153,7 +154,7 @@ #define PROFF_REVNUM ((uint)0x8af0) #define PROFF_RAND ((uint)0x8af8) #define PROFF_I2C_BASE ((uint)0x8afc) -#define PROFF_IDMA4_BASE ((uint)0x89fe) +#define PROFF_IDMA4_BASE ((uint)0x8afe) /* The SMCs are relocated to any of the first eight DPRAM pages. * We will fix these at the first locations of DPRAM, until we @@ -403,40 +404,44 @@ #define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */ #define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */ -/* SCC Mode Register (PMSR) as used by Ethernet. +/* SCC Mode Register (PSMR) as used by Ethernet. */ -#define SCC_PMSR_HBC ((ushort)0x8000) /* Enable heartbeat */ -#define SCC_PMSR_FC ((ushort)0x4000) /* Force collision */ -#define SCC_PMSR_RSH ((ushort)0x2000) /* Receive short frames */ -#define SCC_PMSR_IAM ((ushort)0x1000) /* Check individual hash */ -#define SCC_PMSR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */ -#define SCC_PMSR_PRO ((ushort)0x0200) /* Promiscuous mode */ -#define SCC_PMSR_BRO ((ushort)0x0100) /* Catch broadcast pkts */ -#define SCC_PMSR_SBT ((ushort)0x0080) /* Special backoff timer */ -#define SCC_PMSR_LPB ((ushort)0x0040) /* Set Loopback mode */ -#define SCC_PMSR_SIP ((ushort)0x0020) /* Sample Input Pins */ -#define SCC_PMSR_LCW ((ushort)0x0010) /* Late collision window */ -#define SCC_PMSR_NIB22 ((ushort)0x000a) /* Start frame search */ -#define SCC_PMSR_FDE ((ushort)0x0001) /* Full duplex enable */ +#define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */ +#define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */ +#define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */ +#define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */ +#define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */ +#define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */ +#define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */ +#define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */ +#define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */ +#define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */ +#define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */ +#define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */ +#define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */ /* Buffer descriptor control/status used by Ethernet receive. -*/ + * Common to SCC and FCC. + */ #define BD_ENET_RX_EMPTY ((ushort)0x8000) #define BD_ENET_RX_WRAP ((ushort)0x2000) #define BD_ENET_RX_INTR ((ushort)0x1000) #define BD_ENET_RX_LAST ((ushort)0x0800) #define BD_ENET_RX_FIRST ((ushort)0x0400) #define BD_ENET_RX_MISS ((ushort)0x0100) +#define BD_ENET_RX_BC ((ushort)0x0080) /* FCC Only */ +#define BD_ENET_RX_MC ((ushort)0x0040) /* FCC Only */ #define BD_ENET_RX_LG ((ushort)0x0020) #define BD_ENET_RX_NO ((ushort)0x0010) #define BD_ENET_RX_SH ((ushort)0x0008) #define BD_ENET_RX_CR ((ushort)0x0004) #define BD_ENET_RX_OV ((ushort)0x0002) #define BD_ENET_RX_CL ((ushort)0x0001) -#define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */ +#define BD_ENET_RX_STATS ((ushort)0x01ff) /* All status bits */ /* Buffer descriptor control/status used by Ethernet transmit. -*/ + * Common to SCC and FCC. + */ #define BD_ENET_TX_READY ((ushort)0x8000) #define BD_ENET_TX_PAD ((ushort)0x4000) #define BD_ENET_TX_WRAP ((ushort)0x2000) @@ -522,6 +527,152 @@ } scc_trans_t; #define BD_SCC_TX_LAST ((ushort)0x0800) + +/* How about some FCCs..... +*/ +#define FCC_GFMR_DIAG_NORM ((uint)0x00000000) +#define FCC_GFMR_DIAG_LE ((uint)0x40000000) +#define FCC_GFMR_DIAG_AE ((uint)0x80000000) +#define FCC_GFMR_DIAG_ALE ((uint)0xc0000000) +#define FCC_GFMR_TCI ((uint)0x20000000) +#define FCC_GFMR_TRX ((uint)0x10000000) +#define FCC_GFMR_TTX ((uint)0x08000000) +#define FCC_GFMR_TTX ((uint)0x08000000) +#define FCC_GFMR_CDP ((uint)0x04000000) +#define FCC_GFMR_CTSP ((uint)0x02000000) +#define FCC_GFMR_CDS ((uint)0x01000000) +#define FCC_GFMR_CTSS ((uint)0x00800000) +#define FCC_GFMR_SYNL_NONE ((uint)0x00000000) +#define FCC_GFMR_SYNL_AUTO ((uint)0x00004000) +#define FCC_GFMR_SYNL_8 ((uint)0x00008000) +#define FCC_GFMR_SYNL_16 ((uint)0x0000c000) +#define FCC_GFMR_RTSM ((uint)0x00002000) +#define FCC_GFMR_RENC_NRZ ((uint)0x00000000) +#define FCC_GFMR_RENC_NRZI ((uint)0x00000800) +#define FCC_GFMR_REVD ((uint)0x00000400) +#define FCC_GFMR_TENC_NRZ ((uint)0x00000000) +#define FCC_GFMR_TENC_NRZI ((uint)0x00000100) +#define FCC_GFMR_TCRC_16 ((uint)0x00000000) +#define FCC_GFMR_TCRC_32 ((uint)0x00000080) +#define FCC_GFMR_ENR ((uint)0x00000020) +#define FCC_GFMR_ENT ((uint)0x00000010) +#define FCC_GFMR_MODE_ENET ((uint)0x0000000c) +#define FCC_GFMR_MODE_ATM ((uint)0x0000000a) +#define FCC_GFMR_MODE_HDLC ((uint)0x00000000) + +/* Generic FCC parameter ram. +*/ +typedef struct fcc_param { + ushort fcc_riptr; /* Rx Internal temp pointer */ + ushort fcc_tiptr; /* Tx Internal temp pointer */ + ushort fcc_res1; + ushort fcc_mrblr; /* Max receive buffer length, mod 32 bytes */ + uint fcc_rstate; /* Upper byte is Func code, must be set */ + uint fcc_rbase; /* Receive BD base */ + ushort fcc_rbdstat; /* RxBD status */ + ushort fcc_rbdlen; /* RxBD down counter */ + uint fcc_rdptr; /* RxBD internal data pointer */ + uint fcc_tstate; /* Upper byte is Func code, must be set */ + uint fcc_tbase; /* Transmit BD base */ + ushort fcc_tbdstat; /* TxBD status */ + ushort fcc_tbdlen; /* TxBD down counter */ + uint fcc_tdptr; /* TxBD internal data pointer */ + uint fcc_rbptr; /* Rx BD Internal buf pointer */ + uint fcc_tbptr; /* Tx BD Internal buf pointer */ + uint fcc_rcrc; /* Rx temp CRC */ + uint fcc_res2; + uint fcc_tcrc; /* Tx temp CRC */ +} fccp_t; + + +/* Ethernet controller through FCC. +*/ +typedef struct fcc_enet { + fccp_t fen_genfcc; + uint fen_statbuf; /* Internal status buffer */ + uint fen_camptr; /* CAM address */ + uint fen_cmask; /* Constant mask for CRC */ + uint fen_cpres; /* Preset CRC */ + uint fen_crcec; /* CRC Error counter */ + uint fen_alec; /* alignment error counter */ + uint fen_disfc; /* discard frame counter */ + ushort fen_retlim; /* Retry limit */ + ushort fen_retcnt; /* Retry counter */ + ushort fen_pper; /* Persistence */ + ushort fen_boffcnt; /* backoff counter */ + uint fen_gaddrh; /* Group address filter, high 32-bits */ + uint fen_gaddrl; /* Group address filter, low 32-bits */ + ushort fen_tfcstat; /* out of sequence TxBD */ + ushort fen_tfclen; + uint fen_tfcptr; + ushort fen_mflr; /* Maximum frame length (1518) */ + ushort fen_paddrh; /* MAC address */ + ushort fen_paddrm; + ushort fen_paddrl; + ushort fen_ibdcount; /* Internal BD counter */ + ushort fen_idbstart; /* Internal BD start pointer */ + ushort fen_ibdend; /* Internal BD end pointer */ + ushort fen_txlen; /* Internal Tx frame length counter */ + uint fen_ibdbase[8]; /* Internal use */ + uint fen_iaddrh; /* Individual address filter */ + uint fen_iaddrl; + ushort fen_minflr; /* Minimum frame length (64) */ + ushort fen_taddrh; /* Filter transfer MAC address */ + ushort fen_taddrm; + ushort fen_taddrl; + ushort fen_padptr; /* Pointer to pad byte buffer */ + ushort fen_cftype; /* control frame type */ + ushort fen_cfrange; /* control frame range */ + ushort fen_maxb; /* maximum BD count */ + ushort fen_maxd1; /* Max DMA1 length (1520) */ + ushort fen_maxd2; /* Max DMA2 length (1520) */ + ushort fen_maxd; /* internal max DMA count */ + ushort fen_dmacnt; /* internal DMA counter */ + uint fen_octc; /* Total octect counter */ + uint fen_colc; /* Total collision counter */ + uint fen_broc; /* Total broadcast packet counter */ + uint fen_mulc; /* Total multicast packet count */ + uint fen_uspc; /* Total packets < 64 bytes */ + uint fen_frgc; /* Total packets < 64 bytes with errors */ + uint fen_ospc; /* Total packets > 1518 */ + uint fen_jbrc; /* Total packets > 1518 with errors */ + uint fen_p64c; /* Total packets == 64 bytes */ + uint fen_p65c; /* Total packets 64 < bytes <= 127 */ + uint fen_p128c; /* Total packets 127 < bytes <= 255 */ + uint fen_p256c; /* Total packets 256 < bytes <= 511 */ + uint fen_p512c; /* Total packets 512 < bytes <= 1023 */ + uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */ + uint fen_cambuf; /* Internal CAM buffer poiner */ + ushort fen_rfthr; /* Received frames threshold */ + ushort fen_rfcnt; /* Received frames count */ +} fcc_enet_t; + +/* FCC Event/Mask register as used by Ethernet. +*/ +#define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */ +#define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */ +#define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */ +#define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */ +#define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */ +#define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */ +#define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */ +#define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received */ + +/* FCC Mode Register (FPSMR) as used by Ethernet. +*/ +#define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */ +#define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */ +#define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */ +#define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */ +#define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */ +#define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */ +#define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */ +#define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */ +#define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */ +#define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */ +#define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */ +#define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */ +#define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC */ /* IIC parameter RAM. */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/fcntl.h linux/include/asm-ppc/fcntl.h --- v2.4.0-test8/linux/include/asm-ppc/fcntl.h Wed Jul 5 11:13:39 2000 +++ linux/include/asm-ppc/fcntl.h Sun Sep 17 09:48:08 2000 @@ -35,6 +35,10 @@ #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -66,6 +70,14 @@ off_t l_start; off_t l_len; pid_t l_pid; +}; + +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; }; #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/feature.h linux/include/asm-ppc/feature.h --- v2.4.0-test8/linux/include/asm-ppc/feature.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/feature.h Sun Sep 17 09:48:08 2000 @@ -7,7 +7,9 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1998 Paul Mackerras. + * Copyright (C) 1998 Paul Mackerras & + * Ben. Herrenschmidt. + * * */ #ifndef __ASM_PPC_FEATURE_H @@ -75,6 +77,9 @@ * Additional functions related to Core99 machines */ extern void feature_set_gmac_power(struct device_node* device, int power); + + /* use constants in KeyLargo.h for the reset parameter */ +extern void feature_set_gmac_phy_reset(struct device_node* device, int reset); extern void feature_set_usb_power(struct device_node* device, int power); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/hardirq.h linux/include/asm-ppc/hardirq.h --- v2.4.0-test8/linux/include/asm-ppc/hardirq.h Fri Aug 4 16:15:37 2000 +++ linux/include/asm-ppc/hardirq.h Sun Sep 17 09:48:08 2000 @@ -5,16 +5,23 @@ #include /* entry.S is sensitive to the offsets of these fields */ +/* The __last_jiffy_stamp field is needed to ensure that no decrementer + * interrupt is lost on SMP machines. Since on most CPUs it is in the same + * cache line as local_irq_count, it is cheap to access and is also used on UP + * for uniformity. + */ typedef struct { unsigned int __softirq_active; unsigned int __softirq_mask; unsigned int __local_irq_count; unsigned int __local_bh_count; unsigned int __syscall_count; + unsigned int __last_jiffy_stamp; } ____cacheline_aligned irq_cpustat_t; #include /* Standard mappings for irq_cpustat_t above */ +#define last_jiffy_stamp(cpu) __IRQ_STAT((cpu), __last_jiffy_stamp) /* * Are we in an interrupt context? Either doing bottom half * or hardware interrupt processing? diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/heathrow.h linux/include/asm-ppc/heathrow.h --- v2.4.0-test8/linux/include/asm-ppc/heathrow.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/heathrow.h Sun Sep 17 09:48:08 2000 @@ -44,4 +44,9 @@ #define HRW_BMAC_IO_ENABLE 0x60000000 /* two bits, not documented in OF */ #define HRW_BMAC_RESET 0x80000000 /* not documented in OF */ +/* We OR those features at boot on desktop G3s */ +#define HRW_DEFAULTS (HRW_SCCA_IO | HRW_SCCB_IO | HRW_SCC_ENABLE) + +/* Those seem to be different on paddington */ #define PADD_MODEM_POWER_N 0x00000001 /* modem power on paddington */ +#define PADD_RESET_SCC 0x02000000 /* check this please */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/highmem.h linux/include/asm-ppc/highmem.h --- v2.4.0-test8/linux/include/asm-ppc/highmem.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-ppc/highmem.h Sun Sep 17 09:48:08 2000 @@ -0,0 +1,121 @@ +/* + * highmem.h: virtual kernel memory mappings for high memory + * + * PowerPC version, stolen from the i386 version. + * + * Used in CONFIG_HIGHMEM systems for memory pages which + * are not addressable by direct kernel virtual adresses. + * + * Copyright (C) 1999 Gerhard Wichert, Siemens AG + * Gerhard.Wichert@pdb.siemens.de + * + * + * Redesigned the x86 32-bit VM architecture to deal with + * up to 16 Terrabyte physical memory. With current x86 CPUs + * we now support up to 64 Gigabytes physical RAM. + * + * Copyright (C) 1999 Ingo Molnar + */ + +#ifndef _ASM_HIGHMEM_H +#define _ASM_HIGHMEM_H + +#ifdef __KERNEL__ + +#include +#include +#include +#include + +/* undef for production */ +#define HIGHMEM_DEBUG 1 + +extern pte_t *kmap_pte; +extern pgprot_t kmap_prot; +extern pte_t *pkmap_page_table; + +extern void kmap_init(void) __init; + +/* + * Right now we initialize only a single pte table. It can be extended + * easily, subsequent pte tables have to be allocated in one physical + * chunk of RAM. + */ +#define PKMAP_BASE (0xfe000000UL) +#define LAST_PKMAP 1024 +#define LAST_PKMAP_MASK (LAST_PKMAP-1) +#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) +#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) + +#define KMAP_FIX_BEGIN (0xfe400000UL) + +extern unsigned long kmap_high(struct page *page); +extern void kunmap_high(struct page *page); + +extern inline unsigned long kmap(struct page *page) +{ + if (in_interrupt()) + BUG(); + if (page < highmem_start_page) + return (unsigned long) page_address(page); + return kmap_high(page); +} + +extern inline void kunmap(struct page *page) +{ + if (in_interrupt()) + BUG(); + if (page < highmem_start_page) + return; + kunmap_high(page); +} + +/* + * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap + * gives a more generic (and caching) interface. But kmap_atomic can + * be used in IRQ contexts, so in some (very limited) cases we need + * it. + */ +extern inline unsigned long kmap_atomic(struct page *page, enum km_type type) +{ + unsigned int idx; + unsigned long vaddr; + + if (page < highmem_start_page) + return (unsigned long) page_address(page); + + idx = type + KM_TYPE_NR*smp_processor_id(); + vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE; +#if HIGHMEM_DEBUG + if (!pte_none(*(kmap_pte+idx))) + BUG(); +#endif + set_pte(kmap_pte+idx, mk_pte(page, kmap_prot)); + flush_hash_page(0, vaddr); + + return vaddr; +} + +extern inline void kunmap_atomic(unsigned long vaddr, enum km_type type) +{ +#if HIGHMEM_DEBUG + unsigned int idx = type + KM_TYPE_NR*smp_processor_id(); + + if (vaddr < KMAP_FIX_BEGIN) // FIXME + return; + + if (vaddr != KMAP_FIX_BEGIN + idx * PAGE_SIZE) + BUG(); + + /* + * force other mappings to Oops if they'll try to access + * this pte without first remap it + */ + pte_clear(kmap_pte+idx); + flush_hash_page(0, vaddr); +#endif +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_HIGHMEM_H */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/ide.h linux/include/asm-ppc/ide.h --- v2.4.0-test8/linux/include/asm-ppc/ide.h Tue May 2 13:05:40 2000 +++ linux/include/asm-ppc/ide.h Sun Sep 17 09:48:08 2000 @@ -63,7 +63,6 @@ void ide_outsw(ide_ioreg_t port, void *buf, int ns); void ppc_generic_ide_fix_driveid(struct hd_driveid *id); -#if 0 #undef insw #define insw(port, buf, ns) do { \ ppc_ide_md.insw((port), (buf), (ns)); \ @@ -73,7 +72,6 @@ #define outsw(port, buf, ns) do { \ ppc_ide_md.outsw((port), (buf), (ns)); \ } while (0) -#endif #undef SUPPORT_SLOW_DATA_PORTS #define SUPPORT_SLOW_DATA_PORTS 0 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/immap_8260.h linux/include/asm-ppc/immap_8260.h --- v2.4.0-test8/linux/include/asm-ppc/immap_8260.h Tue May 2 13:05:40 2000 +++ linux/include/asm-ppc/immap_8260.h Sun Sep 17 09:48:08 2000 @@ -241,10 +241,12 @@ char res1[2]; ushort fcc_fdsr; char res2[2]; - uint fcc_fcce; - uint fcc_fccm; + ushort fcc_fcce; + char res3[2]; + ushort fcc_fccm; + char res4[2]; u_char fcc_fccs; - char res3[3]; + char res5[3]; u_char fcc_ftirr_phy[4]; } fcc_t; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/io.h linux/include/asm-ppc/io.h --- v2.4.0-test8/linux/include/asm-ppc/io.h Mon Jun 19 17:59:37 2000 +++ linux/include/asm-ppc/io.h Sun Sep 17 09:48:08 2000 @@ -25,12 +25,12 @@ #include #elif defined(CONFIG_8260) #include -#else +#else /* 4xx/8xx/8260 */ #ifdef CONFIG_APUS #define _IO_BASE 0 #define _ISA_MEM_BASE 0 #define PCI_DRAM_OFFSET 0 -#else +#else /* CONFIG_APUS */ extern unsigned long isa_io_base; extern unsigned long isa_mem_base; extern unsigned long pci_dram_offset; @@ -54,6 +54,14 @@ #define writel(b,addr) out_le32((volatile u32 *)(addr),(b)) #endif + +#define __raw_readb(addr) (*(volatile unsigned char *)(addr)) +#define __raw_readw(addr) (*(volatile unsigned short *)(addr)) +#define __raw_readl(addr) (*(volatile unsigned int *)(addr)) +#define __raw_writeb(v, addr) (*(volatile unsigned char *)(addr) = (v)) +#define __raw_writew(v, addr) (*(volatile unsigned short *)(addr) = (v)) +#define __raw_writel(v, addr) (*(volatile unsigned int *)(addr) = (v)) + /* * The insw/outsw/insl/outsl macros don't do byte-swapping. * They are only used in practice for transferring buffers which @@ -67,26 +75,76 @@ #define insl(port, buf, nl) _insl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) #define outsl(port, buf, nl) _outsl_ns((u32 *)((port)+_IO_BASE), (buf), (nl)) +#ifdef CONFIG_ALL_PPC +/* + * We have to handle possible machine checks here on powermacs + * and potentially some CHRPs -- paulus. + */ +#define __do_in_asm(name, op) \ +extern __inline__ unsigned int name(unsigned int port) \ +{ \ + unsigned int x; \ + __asm__ __volatile__( \ + op " %0,0,%1\n" \ + "1: sync\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + "3: li %0,-1\n" \ + " b 2b\n" \ + ".previous\n" \ + ".section __ex_table,\"ax\"\n" \ + " .align 2\n" \ + " .long 1b,3b\n" \ + ".previous" \ + : "=&r" (x) \ + : "r" (port + _IO_BASE)); \ + return x; \ +} + +#define __do_out_asm(name, op) \ +extern __inline__ void name(unsigned int val, unsigned int port) \ +{ \ + __asm__ __volatile__( \ + op " %0,0,%1\n" \ + "1: sync\n" \ + "2:\n" \ + ".section __ex_table,\"ax\"\n" \ + " .align 2\n" \ + " .long 1b,2b\n" \ + ".previous" \ + : : "r" (val), "r" (port + _IO_BASE)); \ +} + +__do_in_asm(inb, "lbzx") +__do_in_asm(inw, "lhbrx") +__do_in_asm(inl, "lwbrx") +__do_out_asm(outb, "stbx") +__do_out_asm(outw, "sthbrx") +__do_out_asm(outl, "stwbrx") + +#elif defined(CONFIG_APUS) #define inb(port) in_8((u8 *)((port)+_IO_BASE)) #define outb(val, port) out_8((u8 *)((port)+_IO_BASE), (val)) -#if defined(CONFIG_APUS) #define inw(port) in_be16((u16 *)((port)+_IO_BASE)) #define outw(val, port) out_be16((u16 *)((port)+_IO_BASE), (val)) #define inl(port) in_be32((u32 *)((port)+_IO_BASE)) #define outl(val, port) out_be32((u32 *)((port)+_IO_BASE), (val)) -#else + +#else /* not APUS or ALL_PPC */ +#define inb(port) in_8((u8 *)((port)+_IO_BASE)) +#define outb(val, port) out_8((u8 *)((port)+_IO_BASE), (val)) #define inw(port) in_le16((u16 *)((port)+_IO_BASE)) #define outw(val, port) out_le16((u16 *)((port)+_IO_BASE), (val)) #define inl(port) in_le32((u32 *)((port)+_IO_BASE)) #define outl(val, port) out_le32((u32 *)((port)+_IO_BASE), (val)) #endif -#define inb_p(port) in_8((u8 *)((port)+_IO_BASE)) -#define outb_p(val, port) out_8((u8 *)((port)+_IO_BASE), (val)) -#define inw_p(port) in_le16((u16 *)((port)+_IO_BASE)) -#define outw_p(val, port) out_le16((u16 *)((port)+_IO_BASE), (val)) -#define inl_p(port) in_le32((u32 *)((port)+_IO_BASE)) -#define outl_p(val, port) out_le32((u32 *)((port)+_IO_BASE), (val)) +#define inb_p(port) inb((port)) +#define outb_p(val, port) outb((val), (port)) +#define inw_p(port) inw((port)) +#define outw_p(val, port) outw((val), (port)) +#define inl_p(port) inl((port)) +#define outl_p(val, port) outl((val), (port)) extern void _insb(volatile u8 *port, void *buf, int ns); extern void _outsb(volatile u8 *port, const void *buf, int ns); @@ -123,6 +181,8 @@ */ extern void *__ioremap(unsigned long address, unsigned long size, unsigned long flags); +extern void *__ioremap_at(unsigned long phys, unsigned long size, + unsigned long flags); extern void *ioremap(unsigned long address, unsigned long size); #define ioremap_nocache(addr, size) ioremap((addr), (size)) extern void iounmap(void *addr); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/irq.h linux/include/asm-ppc/irq.h --- v2.4.0-test8/linux/include/asm-ppc/irq.h Tue May 2 13:05:40 2000 +++ linux/include/asm-ppc/irq.h Sun Sep 17 09:48:08 2000 @@ -184,6 +184,9 @@ */ #define SIU_INT_SMC1 ((uint)0x04) #define SIU_INT_SMC2 ((uint)0x05) +#define SIU_INT_FCC1 ((uint)0x20) +#define SIU_INT_FCC2 ((uint)0x21) +#define SIU_INT_FCC3 ((uint)0x22) #define SIU_INT_SCC1 ((uint)0x28) #define SIU_INT_SCC2 ((uint)0x29) #define SIU_INT_SCC3 ((uint)0x2a) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/keylargo.h linux/include/asm-ppc/keylargo.h --- v2.4.0-test8/linux/include/asm-ppc/keylargo.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-ppc/keylargo.h Sun Sep 17 09:48:08 2000 @@ -0,0 +1,103 @@ +/* + * keylargo.h: definitions for using the "KeyLargo" I/O controller chip. + * + */ + +/* offset from base for feature control registers */ +#define KEYLARGO_MBCR 0x34 /* Media bay control/status */ +#define KEYLARGO_FCR0 0x38 +#define KEYLARGO_FCR1 0x3c +#define KEYLARGO_FCR2 0x40 +#define KEYLARGO_FCR3 0x44 +#define KEYLARGO_FCR4 0x48 + +/* GPIO registers */ +#define KEYLARGO_GPIO_LEVELS0 0x50 +#define KEYLARGO_GPIO_LEVELS1 0x54 +#define KEYLARGO_GPIO_EXTINT_0 0x58 +#define KEYLARGO_GPIO_EXTINT_CNT 18 +#define KEYLARGO_GPIO_0 0x6A +#define KEYLARGO_GPIO_CNT 17 + +/* Specific GPIO regs */ +#define KL_GPIO_ETH_PHY_RESET (KEYLARGO_GPIO_0+0x10) +#define KL_GPIO_ETH_PHY_RESET_ASSERT 0x04 +#define KL_GPIO_ETH_PHY_RESET_RELEASE 0x05 +#define KL_GPIO_ETH_PHY_RESET_TRISTATE 0x00 +/* + * Bits in feature control register + */ +#define KL_MBCR_MBDEV_ENABLE 0x00001000 + +#define KL0_SCC_B_INTF_ENABLE 0x00000001 /* ??? */ +#define KL0_SCC_A_INTF_ENABLE 0x00000002 /* ??? */ +#define KL0_SCC_SLOWPCLK 0x00000004 +#define KL0_SCC_RESET 0x00000008 +#define KL0_SCCA_ENABLE 0x00000010 +#define KL0_SCCB_ENABLE 0x00000020 +#define KL0_SCC_CELL_ENABLE 0x00000040 +#define KL0_IRDA_ENABLE 0x00008000 +#define KL0_IRDA_CLK32_ENABLE 0x00010000 +#define KL0_IRDA_CLK19_ENABLE 0x00020000 +#define KL0_USB0_PAD_SUSPEND0 0x00040000 +#define KL0_USB0_PAD_SUSPEND1 0x00080000 +#define KL0_USB0_CELL_ENABLE 0x00100000 +#define KL0_USB1_PAD_SUSPEND0 0x00400000 +#define KL0_USB1_PAD_SUSPEND1 0x00800000 +#define KL0_USB1_CELL_ENABLE 0x01000000 +#define KL0_USB_REF_SUSPEND 0x10000000 + +#define KL0_SERIAL_ENABLE (KL0_SCC_B_INTF_ENABLE | \ + KL0_SCC_SLOWPCLK | \ + KL0_SCC_CELL_ENABLE | KL0_SCCA_ENABLE) + +#define KL1_AUDIO_SEL_22MCLK 0x00000002 +#define KL1_AUDIO_CLK_ENABLE_BIT 0x00000008 +#define KL1_AUDIO_CLK_OUT_ENABLE 0x00000020 /* Burgundy only ? */ +#define KL1_AUDIO_CELL_ENABLE 0x00000040 +#define KL1_AUDIO_CHOOSE 0x00000080 /* Burgundy only ? */ +#define KL1_I2S0_CELL_ENABLE 0x00000400 +#define KL1_I2S0_CLK_ENABLE_BIT 0x00001000 +#define KL1_I2S0_ENABLE 0x00002000 +#define KL1_I2S1_CELL_ENABLE 0x00020000 +#define KL1_I2S1_CLK_ENABLE_BIT 0x00080000 +#define KL1_I2S1_ENABLE 0x00100000 +#define KL1_EIDE0_ENABLE 0x00800000 +#define KL1_EIDE0_RESET_N 0x01000000 +#define KL1_EIDE1_ENABLE 0x04000000 +#define KL1_EIDE1_RESET_N 0x08000000 +#define KL1_UIDE_ENABLE 0x20000000 +#define KL1_UIDE_RESET_N 0x40000000 + +#define KL2_IOBUS_ENABLE 0x00000002 +#define KL2_SLEEP_STATE_BIT 0x00000100 +#define KL2_MPIC_ENABLE 0x00020000 +#define KL2_MODEM_POWER_N 0x02000000 +#define KL2_AIRPORT_RESET_N 0x08000000 /* Or power ? */ + +#define KL3_SHUTDOWN_PLL_TOTAL 0x00000001 +#define KL3_SHUTDOWN_PLLKW6 0x00000002 +#define KL3_SHUTDOWN_PLLKW4 0x00000004 +#define KL3_SHUTDOWN_PLLKW35 0x00000008 +#define KL3_SHUTDOWN_PLLKW12 0x00000010 +#define KL3_PLL_RESET 0x00000020 +#define KL3_SHUTDOWN_PLL2X 0x00000080 +#define KL3_CLK66_ENABLE 0x00000100 +#define KL3_CLK49_ENABLE 0x00000200 +#define KL3_CLK45_ENABLE 0x00000400 +#define KL3_CLK31_ENABLE 0x00000800 +#define KL3_TIMER_CLK18_ENABLE 0x00001000 +#define KL3_I2S1_CLK18_ENABLE 0x00002000 +#define KL3_I2S0_CLK18_ENABLE 0x00004000 +#define KL3_VIA_CLK16_ENABLE 0x00008000 +#define KL3_STOPPING33_ENABLED 0x00080000 + +/* Port 0,1 : bus 0, port 2,3 : bus 1 */ +#define KL4_SET_PORT_ENABLE(p) (0x00000008 << (p<<3)) +#define KL4_SET_PORT_RESUME(p) (0x00000004 << (p<<3)) +#define KL4_SET_PORT_CONNECT(p) (0x00000002 << (p<<3)) +#define KL4_SET_PORT_DISCONNECT(p) (0x00000001 << (p<<3)) +#define KL4_GET_PORT_RESUME(p) (0x00000040 << (p<<3)) +#define KL4_GET_PORT_CONNECT(p) (0x00000020 << (p<<3)) +#define KL4_GET_PORT_DISCONNECT(p) (0x00000010 << (p<<3)) + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/kmap_types.h linux/include/asm-ppc/kmap_types.h --- v2.4.0-test8/linux/include/asm-ppc/kmap_types.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-ppc/kmap_types.h Sun Sep 17 09:48:08 2000 @@ -0,0 +1,10 @@ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { + KM_BOUNCE_READ, + KM_BOUNCE_WRITE, + KM_TYPE_NR +}; + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/machdep.h linux/include/asm-ppc/machdep.h --- v2.4.0-test8/linux/include/asm-ppc/machdep.h Tue Jul 18 23:02:09 2000 +++ linux/include/asm-ppc/machdep.h Sun Sep 17 09:48:08 2000 @@ -31,7 +31,7 @@ void (*power_off)(void); void (*halt)(void); - void (*time_init)(void); /* Optional, may be NULL */ + long (*time_init)(void); /* Optional, may be NULL */ int (*set_rtc_time)(unsigned long nowtime); unsigned long (*get_rtc_time)(void); void (*calibrate_decr)(void); @@ -75,7 +75,7 @@ void (*pcibios_fixup)(void); void (*pcibios_fixup_bus)(struct pci_bus *); - void* (*pci_dev_io_base)(unsigned char bus, unsigned char devfn); + void* (*pci_dev_io_base)(unsigned char bus, unsigned char devfn, int physical); void* (*pci_dev_mem_base)(unsigned char bus, unsigned char devfn); int (*pci_dev_root_bridge)(unsigned char bus, unsigned char devfn); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/mbx.h linux/include/asm-ppc/mbx.h --- v2.4.0-test8/linux/include/asm-ppc/mbx.h Sat Nov 27 15:42:33 1999 +++ linux/include/asm-ppc/mbx.h Sun Sep 17 09:48:08 2000 @@ -25,6 +25,7 @@ unsigned int bi_busfreq; /* Bus Freq, in Hz */ unsigned int bi_clun; /* Boot device controller */ unsigned int bi_dlun; /* Boot device logical dev */ + unsigned int bi_baudrate; /* ...to be like everyone else */ } bd_t; /* Memory map for the MBX as configured by EPPC-Bug. We could reprogram diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/mman.h linux/include/asm-ppc/mman.h --- v2.4.0-test8/linux/include/asm-ppc/mman.h Tue Mar 21 10:49:32 2000 +++ linux/include/asm-ppc/mman.h Sun Sep 17 09:48:08 2000 @@ -22,8 +22,8 @@ #define MS_INVALIDATE 2 /* invalidate the caches */ #define MS_SYNC 4 /* synchronous memory sync */ -#define MCL_CURRENT 1 /* lock all current mappings */ -#define MCL_FUTURE 2 /* lock all future mappings */ +#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ +#define MCL_FUTURE 0x4000 /* lock all additions to address space */ #define MADV_NORMAL 0x0 /* default page-in behavior */ #define MADV_RANDOM 0x1 /* page-in minimum required */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/nvram.h linux/include/asm-ppc/nvram.h --- v2.4.0-test8/linux/include/asm-ppc/nvram.h Tue May 2 13:05:40 2000 +++ linux/include/asm-ppc/nvram.h Sun Sep 17 09:48:08 2000 @@ -38,6 +38,8 @@ pmac_nvram_NR /* MacOS Name Registry partition */ }; +#ifdef __KERNEL__ + /* Return partition offset in nvram */ extern int pmac_get_partition(int partition); @@ -45,15 +47,20 @@ extern u8 pmac_xpram_read(int xpaddr); extern void pmac_xpram_write(int xpaddr, u8 data); +#endif /* __KERNEL__ */ + /* Some offsets in XPRAM */ #define PMAC_XPRAM_MACHINE_LOC 0xe4 #define PMAC_XPRAM_SOUND_VOLUME 0x08 /* Machine location structure in XPRAM */ struct pmac_machine_location { - u32 latitude; /* 2+30 bit Fractional number */ - u32 longitude; /* 2+30 bit Fractional number */ - u32 delta; /* mix of GMT delta and DLS */ + unsigned int latitude; /* 2+30 bit Fractional number */ + unsigned int longitude; /* 2+30 bit Fractional number */ + unsigned int delta; /* mix of GMT delta and DLS */ }; + +/* /dev/nvram ioctls */ +#define PMAC_NVRAM_GET_OFFSET _IOWR('p', 0x40, int) /* Get NVRAM partition offset */ #endif diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/pci-bridge.h linux/include/asm-ppc/pci-bridge.h --- v2.4.0-test8/linux/include/asm-ppc/pci-bridge.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/pci-bridge.h Sun Sep 17 09:48:08 2000 @@ -15,8 +15,12 @@ /* This version handles the new Uni-N host bridge, the iobase is now * a per-device thing. I also added the memory base so PReP can * be fixed to return 0xc0000000 (I didn't actually implement it) + * + * pci_dev_io_base() returns either a virtual (ioremap'ed) address or + * a physical address. In-kernel clients will use logical while the + * sys_pciconfig_iobase syscall returns a physical one to userland. */ -void *pci_dev_io_base(unsigned char bus, unsigned char devfn); +void *pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical); void *pci_dev_mem_base(unsigned char bus, unsigned char devfn); /* Returns the root-bridge number (Uni-N number) of a device */ @@ -33,7 +37,8 @@ struct bridge_data { volatile unsigned int *cfg_addr; volatile unsigned char *cfg_data; - void *io_base; + void *io_base; /* virtual */ + unsigned long io_base_phys; int bus_number; int max_bus; struct bridge_data *next; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/pgtable.h linux/include/asm-ppc/pgtable.h --- v2.4.0-test8/linux/include/asm-ppc/pgtable.h Mon Aug 7 21:02:27 2000 +++ linux/include/asm-ppc/pgtable.h Sun Sep 17 09:48:08 2000 @@ -69,7 +69,7 @@ extern void flush_icache_range(unsigned long, unsigned long); extern void __flush_page_to_ram(unsigned long page_va); -#define flush_page_to_ram(page) __flush_page_to_ram((unsigned long) page_address(page)) +extern void flush_page_to_ram(struct page *page); #define flush_dcache_page(page) do { } while (0) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/processor.h linux/include/asm-ppc/processor.h --- v2.4.0-test8/linux/include/asm-ppc/processor.h Mon Aug 7 21:02:27 2000 +++ linux/include/asm-ppc/processor.h Sun Sep 17 09:48:08 2000 @@ -287,6 +287,7 @@ #define SPRN_UPMC3 0x3AD /* User Performance Counter Register 3 */ #define SPRN_UPMC4 0x3AE /* User Performance Counter Register 4 */ #define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */ +#define SPRN_VRSAVE 0x100 /* Vector Register Save Register */ #define SPRN_XER 0x001 /* Fixed Point Exception Register */ #define SPRN_ZPR 0x3B0 /* Zone Protection Register */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/prom.h linux/include/asm-ppc/prom.h --- v2.4.0-test8/linux/include/asm-ppc/prom.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/prom.h Sun Sep 17 09:48:08 2000 @@ -12,6 +12,9 @@ extern char *prom_display_paths[]; extern unsigned int prom_num_displays; +#ifndef CONFIG_MACH_SPECIFIC +extern int have_of; +#endif struct address_range { unsigned int space; diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/serial.h linux/include/asm-ppc/serial.h --- v2.4.0-test8/linux/include/asm-ppc/serial.h Sat Nov 27 15:42:33 1999 +++ linux/include/asm-ppc/serial.h Sun Sep 17 09:48:08 2000 @@ -23,16 +23,6 @@ #define RS_TABLE_SIZE 4 #endif -#ifdef CONFIG_PMAC -/* - * Auto-probing will cause machine checks on powermacs. - */ -#define SERIAL_PORT_DFNS -#else -/* - * PReP, CHRP, etc. - */ - /* Standard COM flags (except for COM4, because of the 8514 problem) */ #ifdef CONFIG_SERIAL_DETECT_IRQ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) @@ -136,5 +126,4 @@ HUB6_SERIAL_PORT_DFNS \ MCA_SERIAL_PORT_DFNS -#endif /* CONFIG_PMAC */ #endif /* CONFIG_GEMINI */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/smp.h linux/include/asm-ppc/smp.h --- v2.4.0-test8/linux/include/asm-ppc/smp.h Mon Jun 19 17:59:37 2000 +++ linux/include/asm-ppc/smp.h Sun Sep 17 09:48:08 2000 @@ -24,10 +24,11 @@ extern unsigned long smp_proc_in_lock[NR_CPUS]; -extern void smp_message_pass(int target, int msg, unsigned long data, int wait); extern void smp_store_cpu_info(int id); -extern void smp_message_recv(int); -void smp_send_tlb_invalidate(int); +extern void smp_send_tlb_invalidate(int); +extern void smp_send_xmon_break(int cpu); +struct pt_regs; +extern void smp_message_recv(int, struct pt_regs *); #define NO_PROC_ID 0xFF /* No processor magic marker */ #define PROC_CHANGE_PENALTY 20 diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/spinlock.h linux/include/asm-ppc/spinlock.h --- v2.4.0-test8/linux/include/asm-ppc/spinlock.h Sun Feb 13 10:47:01 2000 +++ linux/include/asm-ppc/spinlock.h Sun Sep 17 09:48:08 2000 @@ -41,6 +41,7 @@ } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } +#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) extern void _read_lock(rwlock_t *rw); extern void _read_unlock(rwlock_t *rw); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/time.h linux/include/asm-ppc/time.h --- v2.4.0-test8/linux/include/asm-ppc/time.h Thu Jul 13 09:42:51 2000 +++ linux/include/asm-ppc/time.h Sun Sep 17 09:48:08 2000 @@ -12,11 +12,10 @@ #include /* time.c */ -extern unsigned decrementer_count; -extern unsigned count_period_num; -extern unsigned count_period_den; -extern unsigned long mktime(unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, unsigned int); +extern unsigned tb_ticks_per_jiffy; +extern unsigned tb_to_us; +extern unsigned tb_last_stamp; + extern void to_tm(int tim, struct rtc_time * tm); extern time_t last_rtc_update; @@ -37,6 +36,80 @@ #if defined(CONFIG_4xx) mtspr(SPRN_PIT, val); #else +#ifdef CONFIG_8xx_CPU6 + set_dec_cpu6(val); +#else mtspr(SPRN_DEC, val); #endif +#endif +} + +/* Accessor functions for the timebase (RTC on 601) registers. */ +/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ +#ifdef CONFIG_6xx +extern __inline__ int const __USE_RTC(void) { + return (mfspr(SPRN_PVR)>>16) == 1; +} +#else +#define __USE_RTC() 0 +#endif + +extern __inline__ unsigned long get_tbl(void) { + unsigned long tbl; + asm volatile("mftb %0" : "=r" (tbl)); + return tbl; +} + +extern __inline__ unsigned long get_rtcl(void) { + unsigned long rtcl; + asm volatile("mfrtcl %0" : "=r" (rtcl)); + return rtcl; } + +extern __inline__ unsigned get_native_tbl(void) { + if (__USE_RTC()) + return get_rtcl(); + else + return get_tbl(); +} + +/* On machines with RTC, this function can only be used safely + * after the timestamp and for 1 second. It is only used by gettimeofday + * however so it should not matter. + */ +extern __inline__ unsigned tb_ticks_since(unsigned tstamp) { + if (__USE_RTC()) { + int delta = get_rtcl() - tstamp; + return delta<0 ? delta + 1000000000 : delta; + } else { + return get_tbl() - tstamp; + } +} + +#if 0 +extern __inline__ unsigned long get_bin_rtcl(void) { + unsigned long rtcl, rtcu1, rtcu2; + asm volatile("\ +1: mfrtcu %0\n\ + mfrtcl %1\n\ + mfrtcu %2\n\ + cmpw %0,%2\n\ + bne- 1b\n" + : "=r" (rtcu1), "=r" (rtcl), "=r" (rtcu2) + : : "cr0"); + return rtcu2*1000000000+rtcl; +} + +extern __inline__ unsigned binary_tbl(void) { + if (__USE_RTC()) + return get_bin_rtcl(); + else + return get_tbl(); +} +#endif + +/* Use mulhwu to scale processor timebase to timeval */ +#define mulhwu(x,y) \ +({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) + +unsigned mulhwu_scale_factor(unsigned, unsigned); diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/uaccess.h linux/include/asm-ppc/uaccess.h --- v2.4.0-test8/linux/include/asm-ppc/uaccess.h Tue Aug 29 14:09:15 2000 +++ linux/include/asm-ppc/uaccess.h Sun Sep 17 09:48:08 2000 @@ -57,7 +57,7 @@ /* Returns 0 if exception not found and fixup otherwise. */ extern unsigned long search_exception_table(unsigned long); - +extern void sort_exception_table(void); /* * These are the main single-value transfer routines. They automatically @@ -131,10 +131,11 @@ ".section .fixup,\"ax\"\n" \ "3: li %0,%3\n" \ " b 2b\n" \ + ".previous\n" \ ".section __ex_table,\"a\"\n" \ " .align 2\n" \ " .long 1b,3b\n" \ - ".text" \ + ".previous" \ : "=r"(err) \ : "r"(x), "b"(addr), "i"(-EFAULT), "0"(err)) @@ -178,10 +179,11 @@ "3: li %0,%3\n" \ " li %1,0\n" \ " b 2b\n" \ + ".previous\n" \ ".section __ex_table,\"a\"\n" \ " .align 2\n" \ " .long 1b,3b\n" \ - ".text" \ + ".previous" \ : "=r"(err), "=r"(x) \ : "b"(addr), "i"(-EFAULT), "0"(err)) diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/uninorth.h linux/include/asm-ppc/uninorth.h --- v2.4.0-test8/linux/include/asm-ppc/uninorth.h Wed Dec 31 16:00:00 1969 +++ linux/include/asm-ppc/uninorth.h Sun Sep 17 09:48:08 2000 @@ -0,0 +1,83 @@ +/* + * uninorth.h: definitions for using the "UniNorth" host bridge chip + * from Apple. This chip is used on "Core99" machines + * + */ + + +/* + * Uni-N config space reg. definitions + * + * (Little endian) + */ + +/* Address ranges selection. This one should work with Bandit too */ +#define UNI_N_ADDR_SELECT 0x48 +#define UNI_N_ADDR_COARSE_MASK 0xffff0000 /* 256Mb regions at *0000000 */ +#define UNI_N_ADDR_FINE_MASK 0x0000ffff /* 16Mb regions at f*000000 */ + +/* AGP registers */ +#define UNI_N_CFG_GART_BASE 0x8c +#define UNI_N_CFG_AGP_BASE 0x90 +#define UNI_N_CFG_GART_CTRL 0x94 +#define UNI_N_CFG_INTERNAL_STATUS 0x98 + +/* UNI_N_CFG_GART_CTRL bits definitions */ +#define UNI_N_CFG_GART_INVAL 0x00000001 +#define UNI_N_CFG_GART_ENABLE 0x00000100 +#define UNI_N_CFG_GART_2xRESET 0x00010000 + + +/* + * Uni-N memory mapped reg. definitions + * + * Those registers are Big-Endian !! + * + * Their meaning come from either Darwin and/or from experiments I made with + * the bootrom, I'm not sure about their exact meaning yet + * + */ + +/* Version of the UniNorth chip */ +#define UNI_N_VERSION 0x0000 /* Known versions: 3,7 and 8 */ + +/* This register is used to enable/disable various parts */ +#define UNI_N_CLOCK_CNTL 0x0020 +#define UNI_N_CLOCK_CNTL_PCI 0x00000001 /* guess ? */ +#define UNI_N_CLOCK_CNTL_GMAC 0x00000002 +#define UNI_N_CLOCK_CNTL_FW 0x00000004 /* guess ? */ + +/* Power Management control ? (from Darwin) */ +#define UNI_N_POWER_MGT 0x0030 +#define UNI_N_POWER_MGT_NORMAL 0x00 +#define UNI_N_POWER_MGT_IDLE2 0x01 +#define UNI_N_POWER_MGT_SLEEP 0x02 + +/* This register is configured by Darwin depending on the UniN + * revision + */ +#define UNI_N_ARB_CTRL 0x0040 +#define UNI_N_ARB_CTRL_QACK_DELAY_SHIFT 15 +#define UNI_N_ARB_CTRL_QACK_DELAY_MASK 0x0e1f8000 +#define UNI_N_ARB_CTRL_QACK_DELAY 0x30 +#define UNI_N_ARB_CTRL_QACK_DELAY105 0x00 + +/* This one _might_ return the CPU number of the CPU reading it; + * the bootROM decides wether to boot or to sleep/spinloop depending + * on this register beeing 0 or not + */ +#define UNI_N_CPU_NUMBER 0x0050 + +/* This register appear to be read by the bootROM to decide what + * to do on a non-recoverable reset (powerup or wakeup) + */ +#define UNI_N_HWINIT_STATE 0x0070 +#define UNI_N_HWINIT_STATE_SLEEPING 0x01 +#define UNI_N_HWINIT_STATE_RUNNING 0x02 +/* This last bit appear to be used by the bootROM to know the second + * CPU has started and will enter it's sleep loop with IP=0 + */ +#define UNI_N_HWINIT_STATE_CPU1_FLAG 0x10000000 + + + diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-ppc/unistd.h linux/include/asm-ppc/unistd.h --- v2.4.0-test8/linux/include/asm-ppc/unistd.h Fri Aug 11 14:29:03 2000 +++ linux/include/asm-ppc/unistd.h Sun Sep 17 09:48:08 2000 @@ -201,10 +201,10 @@ #define __NR_stat64 195 #define __NR_lstat64 196 #define __NR_fstat64 197 -#define __NR_sys_pciconfig_read 198 -#define __NR_sys_pciconfig_write 199 -#define __NR_sys_pciconfig_iobase 200 -#define __NR_multiplexer 201 +#define __NR_pciconfig_read 198 +#define __NR_pciconfig_write 199 +#define __NR_pciconfig_iobase 200 +#define __NR_multiplexer 201 #define __NR_getdents64 202 #define __NR(n) #n diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-sparc/io.h linux/include/asm-sparc/io.h --- v2.4.0-test8/linux/include/asm-sparc/io.h Fri Apr 14 09:37:10 2000 +++ linux/include/asm-sparc/io.h Sun Sep 17 09:50:02 2000 @@ -1,5 +1,5 @@ /* - * $Id: io.h,v 1.27 2000/04/13 04:45:59 davem Exp $ + * $Id: io.h,v 1.28 2000/09/17 05:12:00 davem Exp $ */ #ifndef __SPARC_IO_H #define __SPARC_IO_H @@ -164,6 +164,8 @@ return (void *) dst; } +#ifdef __KERNEL__ + /* * Bus number may be embedded in the higher bits of the physical address. * This is why we have no bus number argument to ioremap(). @@ -199,5 +201,7 @@ #define dma_cache_inv(_start,_size) do { } while (0) #define dma_cache_wback(_start,_size) do { } while (0) #define dma_cache_wback_inv(_start,_size) do { } while (0) + +#endif #endif /* !(__SPARC_IO_H) */ diff -u --recursive --new-file v2.4.0-test8/linux/include/asm-sparc64/io.h linux/include/asm-sparc64/io.h --- v2.4.0-test8/linux/include/asm-sparc64/io.h Fri Apr 14 09:37:10 2000 +++ linux/include/asm-sparc64/io.h Sun Sep 17 09:50:02 2000 @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.35 2000/04/13 04:45:59 davem Exp $ */ +/* $Id: io.h,v 1.36 2000/09/17 05:12:00 davem Exp $ */ #ifndef __SPARC64_IO_H #define __SPARC64_IO_H @@ -363,6 +363,8 @@ return retval; } +#ifdef __KERNEL__ + /* On sparc64 we have the whole physical IO address space accessible * using physically addressed loads and stores, so this does nothing. */ @@ -388,5 +390,7 @@ #define dma_cache_inv(_start,_size) do { } while (0) #define dma_cache_wback(_start,_size) do { } while (0) #define dma_cache_wback_inv(_start,_size) do { } while (0) + +#endif #endif /* !(__SPARC64_IO_H) */ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/adb.h linux/include/linux/adb.h --- v2.4.0-test8/linux/include/linux/adb.h Tue Oct 12 10:00:58 1999 +++ linux/include/linux/adb.h Sun Sep 17 09:48:05 2000 @@ -58,7 +58,6 @@ int (*probe)(void); int (*init)(void); int (*send_request)(struct adb_request *req, int sync); - /*int (*write)(struct adb_request *req);*/ int (*autopoll)(int devs); void (*poll)(void); int (*reset_bus)(void); @@ -83,6 +82,7 @@ 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)); +int adb_unregister(int index); void adb_poll(void); void adb_input(unsigned char *, int, struct pt_regs *, int); int adb_reset_bus(void); diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/arcdevice.h linux/include/linux/arcdevice.h --- v2.4.0-test8/linux/include/linux/arcdevice.h Mon Jul 31 14:25:52 2000 +++ linux/include/linux/arcdevice.h Sun Sep 17 09:45:05 2000 @@ -340,7 +340,6 @@ void arcnet_raw_init(void); int com90xx_probe(struct net_device *dev); -void com20020pci_probe_all(void); #endif /* __KERNEL__ */ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/blk.h linux/include/linux/blk.h --- v2.4.0-test8/linux/include/linux/blk.h Fri Sep 8 12:54:09 2000 +++ linux/include/linux/blk.h Mon Sep 18 15:39:41 2000 @@ -308,7 +308,7 @@ #elif (MAJOR_NR == I2O_MAJOR) #define DEVICE_NAME "I2O block" -#define DEVICE_REQUEST do_i2ob_request +#define DEVICE_REQUEST i2ob_request #define DEVICE_NR(device) (MINOR(device)>>4) #elif (MAJOR_NR == COMPAQ_SMART2_MAJOR) diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/cuda.h linux/include/linux/cuda.h --- v2.4.0-test8/linux/include/linux/cuda.h Tue Oct 12 10:00:58 1999 +++ linux/include/linux/cuda.h Sun Sep 17 09:48:05 2000 @@ -28,7 +28,8 @@ #ifdef __KERNEL__ -void find_via_cuda(void); +extern int find_via_cuda(void); +extern int via_cuda_start(void); extern int cuda_request(struct adb_request *req, void (*done)(struct adb_request *), int nbytes, ...); extern void cuda_poll(void); diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/fs.h linux/include/linux/fs.h --- v2.4.0-test8/linux/include/linux/fs.h Fri Sep 8 12:52:42 2000 +++ linux/include/linux/fs.h Mon Sep 18 15:37:55 2000 @@ -93,7 +93,7 @@ * as nfs_rename() will be cleaned up */ /* - * These are the fs-independent mount-flags: up to 16 flags are supported + * These are the fs-independent mount-flags: up to 32 flags are supported */ #define MS_RDONLY 1 /* Mount read-only */ #define MS_NOSUID 2 /* Ignore suid and sgid bits */ @@ -104,6 +104,7 @@ #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ +#define MS_BIND 4096 /* * Flags that can be altered by MS_REMOUNT diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/ixjuser.h linux/include/linux/ixjuser.h --- v2.4.0-test8/linux/include/linux/ixjuser.h Wed Dec 29 17:13:02 1999 +++ linux/include/linux/ixjuser.h Mon Sep 18 15:02:03 2000 @@ -1,7 +1,8 @@ -/* +/****************************************************************************** + * * ixjuser.h * - * User-space include file for the Internet PhoneJACK and + * Device Driver for the Internet PhoneJACK and * Internet LineJACK Telephony Cards. * * (c) Copyright 1999 Quicknet Technologies, Inc. @@ -22,31 +23,48 @@ * at our website: http://www.quicknet.net * * Fixes: - */ + * + * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET + * TECHNOLOGIES, INC.HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION + * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + *****************************************************************************/ -static char ixjuser_h_rcsid[] = "$Id: ixjuser.h,v 3.4 1999/12/16 22:18:36 root Exp root $"; +static char ixjuser_h_rcsid[] = "$Id: ixjuser.h,v 3.11 2000/03/30 22:06:48 eokerson Exp $"; -#include +#include "telephony.h" -/*************************************************************************** - If you use the IXJCTL_TESTRAM command, the card must be power - cycled to reset the SRAM values before futher use. +/****************************************************************************** +* +* IOCTL's used for the Quicknet Cards +* +* If you use the IXJCTL_TESTRAM command, the card must be power cycled to +* reset the SRAM values before futher use. +* +******************************************************************************/ -***************************************************************************/ #define IXJCTL_DSP_RESET _IO ('q', 0xC0) -#define IXJCTL_RING PHONE_RING -#define IXJCTL_HOOKSTATE PHONE_HOOKSTATE +#define IXJCTL_RING PHONE_RING +#define IXJCTL_HOOKSTATE PHONE_HOOKSTATE #define IXJCTL_MAXRINGS PHONE_MAXRINGS -#define IXJCTL_RING_CADENCE PHONE_RING_CADENCE +#define IXJCTL_RING_CADENCE PHONE_RING_CADENCE #define IXJCTL_RING_START PHONE_RING_START #define IXJCTL_RING_STOP PHONE_RING_STOP #define IXJCTL_CARDTYPE _IOR ('q', 0xC1, int) -#define IXJCTL_SERIAL _IOR ('q', 0xC2, int) -#define IXJCTL_DSP_TYPE _IOR ('q', 0xC3, int) -#define IXJCTL_DSP_VERSION _IOR ('q', 0xC4, int) +#define IXJCTL_SERIAL _IOR ('q', 0xC2, int) +#define IXJCTL_DSP_TYPE _IOR ('q', 0xC3, int) +#define IXJCTL_DSP_VERSION _IOR ('q', 0xC4, int) +#define IXJCTL_VERSION _IOR ('q', 0xDA, char *) #define IXJCTL_DSP_IDLE _IO ('q', 0xC5) #define IXJCTL_TESTRAM _IO ('q', 0xC6) @@ -104,8 +122,22 @@ char enable; } IXJ_FILTER; +typedef struct { + char enable; + char en_filter; + unsigned int filter; + unsigned int on1; + unsigned int off1; + unsigned int on2; + unsigned int off2; + unsigned int on3; + unsigned int off3; +} IXJ_FILTER_CADENCE; + #define IXJCTL_SET_FILTER _IOW ('q', 0xC7, IXJ_FILTER *) #define IXJCTL_GET_FILTER_HIST _IOW ('q', 0xC8, int) +#define IXJCTL_FILTER_CADENCE _IOW ('q', 0xD6, IXJ_FILTER_CADENCE *) +#define IXJCTL_PLAY_CID _IO ('q', 0xD7) /****************************************************************************** * * This IOCTL allows you to reassign values in the tone index table. The @@ -222,7 +254,9 @@ hz1800 = 0x1405, hz1860 = 0xe0b, hz2100 = 0xf5f6, - hz2450 = 0xd3b3 + hz2130 = 0xf2f5, + hz2450 = 0xd3b3, + hz2750 = 0xb8e4 } IXJ_FREQ; typedef enum { @@ -344,6 +378,7 @@ #define AEC_LOW 1 #define AEC_MED 2 #define AEC_HIGH 3 +#define AEC_AUTO 4 /****************************************************************************** * * Call Progress Tones, DTMF, etc. @@ -533,16 +568,16 @@ /****************************************************************************** * -* The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), +* The DAA Analog GAIN sets 2 parameters at one time, the recieve gain (AGRR), * and the transmit gain (AGX). OR together the components and pass them * as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB. * ******************************************************************************/ #define IXJCTL_DAA_AGAIN _IOW ('q', 0xD2, int) -#define AGRR00DB 0x00 // Analog gain in receive direction 0dB -#define AGRR3_5DB 0x10 // Analog gain in receive direction 3.5dB -#define AGRR06DB 0x30 // Analog gain in receive direction 6dB +#define AGRR00DB 0x00 // Analog gain in recieve direction 0dB +#define AGRR3_5DB 0x10 // Analog gain in recieve direction 3.5dB +#define AGRR06DB 0x30 // Analog gain in recieve direction 6dB #define AGX00DB 0x00 // Analog gain in transmit direction 0dB #define AGX_6DB 0x04 // Analog gain in transmit direction -6dB @@ -551,18 +586,9 @@ #define IXJCTL_PSTN_LINETEST _IO ('q', 0xD3) -typedef struct { - char month[3]; - char day[3]; - char hour[3]; - char min[3]; - int numlen; - char number[11]; - int namelen; - char name[80]; -} IXJ_CID; - -#define IXJCTL_CID _IOR ('q', 0xD4, IXJ_CID *) +#define IXJCTL_CID _IOR ('q', 0xD4, PHONE_CID *) +#define IXJCTL_VMWI _IOR ('q', 0xD8, int) +#define IXJCTL_CIDCW _IOW ('q', 0xD9, PHONE_CID *) /****************************************************************************** * * The wink duration is tunable with this ioctl. The default wink duration diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/mm.h linux/include/linux/mm.h --- v2.4.0-test8/linux/include/linux/mm.h Fri Sep 8 12:52:42 2000 +++ linux/include/linux/mm.h Mon Sep 18 15:37:56 2000 @@ -15,7 +15,9 @@ extern unsigned long num_physpages; extern void * high_memory; extern int page_cluster; -extern struct list_head lru_cache; +/* The inactive_clean lists are per zone. */ +extern struct list_head active_list; +extern struct list_head inactive_dirty_list; #include #include @@ -149,6 +151,7 @@ atomic_t count; unsigned long flags; /* atomic flags, some possibly updated asynchronously */ struct list_head lru; + unsigned long age; wait_queue_head_t wait; struct page **pprev_hash; struct buffer_head * buffers; @@ -169,12 +172,12 @@ #define PG_uptodate 3 #define PG_dirty 4 #define PG_decr_after 5 -#define PG_unused_01 6 -#define PG__unused_02 7 +#define PG_active 6 +#define PG_inactive_dirty 7 #define PG_slab 8 #define PG_swap_cache 9 #define PG_skip 10 -#define PG_unused_03 11 +#define PG_inactive_clean 11 #define PG_highmem 12 /* bits 21-30 unused */ #define PG_reserved 31 @@ -199,6 +202,7 @@ #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags) +#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags) #define PageTestandClearReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) #define SetPageDecrAfter(page) set_bit(PG_decr_after, &(page)->flags) @@ -216,6 +220,18 @@ #define PageClearSwapCache(page) clear_bit(PG_swap_cache, &(page)->flags) #define PageTestandClearSwapCache(page) test_and_clear_bit(PG_swap_cache, &(page)->flags) + +#define PageActive(page) test_bit(PG_active, &(page)->flags) +#define SetPageActive(page) set_bit(PG_active, &(page)->flags) +#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) + +#define PageInactiveDirty(page) test_bit(PG_inactive_dirty, &(page)->flags) +#define SetPageInactiveDirty(page) set_bit(PG_inactive_dirty, &(page)->flags) +#define ClearPageInactiveDirty(page) clear_bit(PG_inactive_dirty, &(page)->flags) + +#define PageInactiveClean(page) test_bit(PG_inactive_clean, &(page)->flags) +#define SetPageInactiveClean(page) set_bit(PG_inactive_clean, &(page)->flags) +#define ClearPageInactiveClean(page) clear_bit(PG_inactive_clean, &(page)->flags) #ifdef CONFIG_HIGHMEM #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/mmzone.h linux/include/linux/mmzone.h --- v2.4.0-test8/linux/include/linux/mmzone.h Fri Sep 8 12:52:41 2000 +++ linux/include/linux/mmzone.h Mon Sep 18 15:37:55 2000 @@ -28,13 +28,14 @@ spinlock_t lock; unsigned long offset; unsigned long free_pages; - char low_on_memory; - char zone_wake_kswapd; + unsigned long inactive_clean_pages; + unsigned long inactive_dirty_pages; unsigned long pages_min, pages_low, pages_high; /* * free areas of different sizes */ + struct list_head inactive_clean_list; free_area_t free_area[MAX_ORDER]; /* diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/module.h linux/include/linux/module.h --- v2.4.0-test8/linux/include/linux/module.h Fri Sep 8 12:52:41 2000 +++ linux/include/linux/module.h Mon Sep 18 15:37:56 2000 @@ -279,14 +279,6 @@ #define EXPORT_SYMBOL(var) #define EXPORT_SYMBOL_NOVERS(var) -#elif !defined(EXPORT_SYMTAB) - -/* If things weren't set up in the Makefiles to get EXPORT_SYMTAB defined, - then they weren't set up to run genksyms properly so MODVERSIONS breaks. */ -#define __EXPORT_SYMBOL(sym,str) error EXPORT_SYMTAB_not_defined -#define EXPORT_SYMBOL(var) error EXPORT_SYMTAB_not_defined -#define EXPORT_SYMBOL_NOVERS(var) error EXPORT_SYMTAB_not_defined - #else #define __EXPORT_SYMBOL(sym, str) \ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/mount.h linux/include/linux/mount.h --- v2.4.0-test8/linux/include/linux/mount.h Mon Jul 24 17:04:13 2000 +++ linux/include/linux/mount.h Sun Sep 17 09:51:57 2000 @@ -27,8 +27,7 @@ struct list_head mnt_child; /* and going through their mnt_child */ atomic_t mnt_count; int mnt_flags; - - char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ + char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; uid_t mnt_owner; }; diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/pci.h linux/include/linux/pci.h --- v2.4.0-test8/linux/include/linux/pci.h Fri Sep 8 12:52:44 2000 +++ linux/include/linux/pci.h Mon Sep 18 15:38:23 2000 @@ -553,14 +553,14 @@ */ #ifndef CONFIG_PCI -extern inline int pcibios_present(void) { return 0; } -extern inline int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn) +static inline int pcibios_present(void) { return 0; } +static inline int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn) { return PCIBIOS_DEVICE_NOT_FOUND; } #define _PCI_NOP(o,s,t) \ - extern inline int pcibios_##o##_config_##s## (u8 bus, u8 dfn, u8 where, t val) \ + static inline int pcibios_##o##_config_##s## (u8 bus, u8 dfn, u8 where, t val) \ { return PCIBIOS_FUNC_NOT_SUPPORTED; } \ - extern inline int pci_##o##_config_##s## (struct pci_dev *dev, int where, t val) \ + static inline int pci_##o##_config_##s## (struct pci_dev *dev, int where, t val) \ { return PCIBIOS_FUNC_NOT_SUPPORTED; } #define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ _PCI_NOP(o,word,u16 x) \ @@ -568,27 +568,27 @@ _PCI_NOP_ALL(read, *) _PCI_NOP_ALL(write,) -extern inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) +static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) { return NULL; } -extern inline struct pci_dev *pci_find_class(unsigned int class, const struct pci_dev *from) +static inline struct pci_dev *pci_find_class(unsigned int class, const struct pci_dev *from) { return NULL; } -extern inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) +static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) { return NULL; } -extern inline struct pci_dev *pci_find_subsys(unsigned int vendor, unsigned int device, +static inline struct pci_dev *pci_find_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, const struct pci_dev *from) { return NULL; } -extern inline void pci_set_master(struct pci_dev *dev) { } -extern inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } -extern inline int pci_module_init(struct pci_driver *drv) { return -ENODEV; } -extern inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} -extern inline int pci_register_driver(struct pci_driver *drv) { return 0;} -extern inline void pci_unregister_driver(struct pci_driver *drv) { } -extern inline int scsi_to_pci_dma_dir(unsigned char scsi_dir) { return scsi_dir; } -extern inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } +static inline void pci_set_master(struct pci_dev *dev) { } +static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } +static inline int pci_module_init(struct pci_driver *drv) { return -ENODEV; } +static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} +static inline int pci_register_driver(struct pci_driver *drv) { return 0;} +static inline void pci_unregister_driver(struct pci_driver *drv) { } +static inline int scsi_to_pci_dma_dir(unsigned char scsi_dir) { return scsi_dir; } +static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } #else @@ -598,7 +598,7 @@ * * This MUST stay in a header, as it checks for -DMODULE */ -extern inline int pci_module_init(struct pci_driver *drv) +static inline int pci_module_init(struct pci_driver *drv) { int rc = pci_register_driver (drv); @@ -635,6 +635,20 @@ \ (pci_resource_end((dev),(bar)) - \ pci_resource_start((dev),(bar)) + 1)) + +/* Similar to the helpers above, these manipulate per-pci_dev + * driver-specific data. Currently stored as pci_dev::driver_data, + * a void pointer, but it is not present on older kernels. + */ +static inline void *pci_get_drvdata (struct pci_dev *pdev) +{ + return pdev->driver_data; +} + +static inline void pci_set_drvdata (struct pci_dev *pdev, void *data) +{ + pdev->driver_data = data; +} /* * The world is not perfect and supplies us with broken PCI devices. diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/pmu.h linux/include/linux/pmu.h --- v2.4.0-test8/linux/include/linux/pmu.h Wed Feb 9 19:43:47 2000 +++ linux/include/linux/pmu.h Sun Sep 17 09:48:05 2000 @@ -10,6 +10,7 @@ /* * PMU commands */ +#define PMU_POWER_CTRL0 0x10 /* control power of some devices */ #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 */ @@ -26,15 +27,25 @@ #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_POWER_EVENTS 0x8f /* Send power-event commands to PMU */ #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 */ +#define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */ + +/* Bits to use with the PMU_POWER_CTRL0 command */ +#define PMU_POW0_ON 0x80 /* OR this to power ON the device */ +#define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */ +#define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */ /* 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_CHARGER 0x02 /* battery charger power */ #define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */ +#define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */ + /* Bits in PMU interrupt and interrupt mask bytes */ #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */ @@ -54,6 +65,25 @@ PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */ }; +/* PMU PMU_POWER_EVENTS commands */ +enum { + PMU_PWR_GET_POWERUP_EVENTS = 0x00, + PMU_PWR_SET_POWERUP_EVENTS = 0x01, + PMU_PWR_CLR_POWERUP_EVENTS = 0x02, + PMU_PWR_GET_WAKEUP_EVENTS = 0x03, + PMU_PWR_SET_WAKEUP_EVENTS = 0x04, + PMU_PWR_CLR_WAKEUP_EVENTS = 0x05, +}; + +/* Power events wakeup bits */ +enum { + PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */ + PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */ + PMU_PWR_WAKEUP_AC_CHANGE = 0x04, + PMU_PWR_WAKEUP_LID_OPEN = 0x08, + PMU_PWR_WAKEUP_RING = 0x10, +}; + /* * Ioctl commands for the /dev/pmu device */ @@ -61,34 +91,38 @@ /* no param */ #define PMU_IOC_SLEEP _IO('B', 0) -/* out param: u32* backlight value: 0 to 31 */ +/* out param: u32* backlight value: 0 to 15 */ #define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, sizeof(__u32*)) -/* in param: u32 backlight value: 0 to 31 */ +/* in param: u32 backlight value: 0 to 15 */ #define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, sizeof(__u32)) -/* out param: u32* backlight value: 0 to 31 */ +/* out param: u32* PMU model */ #define PMU_IOC_GET_MODEL _IOR('B', 3, sizeof(__u32*)) /* out param: u32* has_adb: 0 or 1 */ #define PMU_IOC_HAS_ADB _IOR('B', 4, sizeof(__u32*)) #ifdef __KERNEL__ -int find_via_pmu(void); -int via_pmu_init(void); +extern int find_via_pmu(void); +extern int via_pmu_start(void); -int pmu_request(struct adb_request *req, +extern 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); +extern void pmu_poll(void); + +/* For use before switching interrupts off for a long time; + * warning: not stackable + */ +extern void pmu_suspend(void); +extern void pmu_resume(void); -void pmu_enable_irled(int on); +extern void pmu_enable_irled(int on); -void pmu_restart(void); -void pmu_shutdown(void); +extern void pmu_restart(void); +extern void pmu_shutdown(void); -int pmu_present(void); -int pmu_get_model(void); +extern int pmu_present(void); +extern int pmu_get_model(void); #ifdef CONFIG_PMAC_PBOOK /* @@ -135,4 +169,4 @@ #endif /* CONFIG_PMAC_PBOOK */ -#endif /* __KERNEL */ +#endif /* __KERNEL__ */ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/raid/md_compatible.h linux/include/linux/raid/md_compatible.h --- v2.4.0-test8/linux/include/linux/raid/md_compatible.h Fri Sep 8 12:52:42 2000 +++ linux/include/linux/raid/md_compatible.h Mon Sep 18 15:37:56 2000 @@ -77,11 +77,7 @@ /* 011 */ #define md_signal_pending signal_pending -/* 012 */ -extern inline void md_set_global_readahead(int * table) -{ - max_readahead[MD_MAJOR] = table; -} +/* 012 - md_set_global_readahead - nowhere used */ /* 013 */ #define md_mdelay(x) mdelay(x) diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/signal.h linux/include/linux/signal.h --- v2.4.0-test8/linux/include/linux/signal.h Fri Sep 8 12:52:42 2000 +++ linux/include/linux/signal.h Mon Sep 18 15:37:55 2000 @@ -28,7 +28,7 @@ /* We don't use for these because there is no need to be atomic. */ -extern inline void sigaddset(sigset_t *set, int _sig) +static inline void sigaddset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if (_NSIG_WORDS == 1) @@ -37,7 +37,7 @@ set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW); } -extern inline void sigdelset(sigset_t *set, int _sig) +static inline void sigdelset(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if (_NSIG_WORDS == 1) @@ -46,7 +46,7 @@ set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW)); } -extern inline int sigismember(sigset_t *set, int _sig) +static inline int sigismember(sigset_t *set, int _sig) { unsigned long sig = _sig - 1; if (_NSIG_WORDS == 1) @@ -55,7 +55,7 @@ return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); } -extern inline int sigfindinword(unsigned long word) +static inline int sigfindinword(unsigned long word) { return ffz(~word); } @@ -68,7 +68,7 @@ #include #define _SIG_SET_BINOP(name, op) \ -extern inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ +static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ { \ unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ unsigned long i; \ @@ -119,7 +119,7 @@ #undef _sig_nand #define _SIG_SET_OP(name, op) \ -extern inline void name(sigset_t *set) \ +static inline void name(sigset_t *set) \ { \ unsigned long i; \ \ @@ -142,7 +142,7 @@ #undef _SIG_SET_OP #undef _sig_not -extern inline void sigemptyset(sigset_t *set) +static inline void sigemptyset(sigset_t *set) { switch (_NSIG_WORDS) { default: @@ -154,7 +154,7 @@ } } -extern inline void sigfillset(sigset_t *set) +static inline void sigfillset(sigset_t *set) { switch (_NSIG_WORDS) { default: @@ -170,22 +170,22 @@ /* Some extensions for manipulating the low 32 signals in particular. */ -extern inline void sigaddsetmask(sigset_t *set, unsigned long mask) +static inline void sigaddsetmask(sigset_t *set, unsigned long mask) { set->sig[0] |= mask; } -extern inline void sigdelsetmask(sigset_t *set, unsigned long mask) +static inline void sigdelsetmask(sigset_t *set, unsigned long mask) { set->sig[0] &= ~mask; } -extern inline int sigtestsetmask(sigset_t *set, unsigned long mask) +static inline int sigtestsetmask(sigset_t *set, unsigned long mask) { return (set->sig[0] & mask) != 0; } -extern inline void siginitset(sigset_t *set, unsigned long mask) +static inline void siginitset(sigset_t *set, unsigned long mask) { set->sig[0] = mask; switch (_NSIG_WORDS) { @@ -197,7 +197,7 @@ } } -extern inline void siginitsetinv(sigset_t *set, unsigned long mask) +static inline void siginitsetinv(sigset_t *set, unsigned long mask) { set->sig[0] = ~mask; switch (_NSIG_WORDS) { diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/swap.h linux/include/linux/swap.h --- v2.4.0-test8/linux/include/linux/swap.h Fri Sep 8 12:52:41 2000 +++ linux/include/linux/swap.h Mon Sep 18 15:37:55 2000 @@ -65,13 +65,17 @@ extern int nr_swap_pages; FASTCALL(unsigned int nr_free_pages(void)); +FASTCALL(unsigned int nr_inactive_clean_pages(void)); FASTCALL(unsigned int nr_free_buffer_pages(void)); FASTCALL(unsigned int nr_free_highpages(void)); -extern int nr_lru_pages; +extern int nr_active_pages; +extern int nr_inactive_dirty_pages; extern atomic_t nr_async_pages; extern struct address_space swapper_space; extern atomic_t page_cache_size; extern atomic_t buffermem_pages; +extern spinlock_t pagecache_lock; +extern void __remove_inode_page(struct page *); /* Incomplete types for prototype declarations: */ struct task_struct; @@ -83,9 +87,29 @@ extern int shm_swap(int, int); /* linux/mm/swap.c */ +extern int memory_pressure; +extern void age_page_up(struct page *); +extern void age_page_up_nolock(struct page *); +extern void age_page_down(struct page *); +extern void age_page_down_nolock(struct page *); +extern void deactivate_page(struct page *); +extern void deactivate_page_nolock(struct page *); +extern void activate_page(struct page *); +extern void activate_page_nolock(struct page *); +extern void lru_cache_add(struct page *); +extern void __lru_cache_del(struct page *); +extern void lru_cache_del(struct page *); +extern void recalculate_vm_stats(void); extern void swap_setup(void); /* linux/mm/vmscan.c */ +extern struct page * reclaim_page(zone_t *); +extern wait_queue_head_t kswapd_wait; +extern wait_queue_head_t kreclaimd_wait; +extern int page_launder(int, int); +extern int free_shortage(void); +extern int inactive_shortage(void); +extern void wakeup_kswapd(int); extern int try_to_free_pages(unsigned int gfp_mask); /* linux/mm/page_io.c */ @@ -161,30 +185,102 @@ extern spinlock_t pagemap_lru_lock; /* - * Helper macros for lru_pages handling. + * Page aging defines. + * Since we do exponential decay of the page age, we + * can chose a fairly large maximum. */ -#define lru_cache_add(page) \ -do { \ - spin_lock(&pagemap_lru_lock); \ - list_add(&(page)->lru, &lru_cache); \ - nr_lru_pages++; \ - spin_unlock(&pagemap_lru_lock); \ -} while (0) - -#define __lru_cache_del(page) \ -do { \ - list_del(&(page)->lru); \ - nr_lru_pages--; \ -} while (0) - -#define lru_cache_del(page) \ -do { \ - if (!PageLocked(page)) \ - BUG(); \ - spin_lock(&pagemap_lru_lock); \ - __lru_cache_del(page); \ - spin_unlock(&pagemap_lru_lock); \ -} while (0) +#define PAGE_AGE_START 2 +#define PAGE_AGE_ADV 3 +#define PAGE_AGE_MAX 64 + +/* + * List add/del helper macros. These must be called + * with the pagemap_lru_lock held! + */ +#define DEBUG_ADD_PAGE \ + if (PageActive(page) || PageInactiveDirty(page) || \ + PageInactiveClean(page)) BUG(); + +#define ZERO_PAGE_BUG \ + if (page_count(page) == 0) BUG(); + +#define add_page_to_active_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageActive(page); \ + list_add(&(page)->lru, &active_list); \ + nr_active_pages++; \ +} + +#define add_page_to_inactive_dirty_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageInactiveDirty(page); \ + list_add(&(page)->lru, &inactive_dirty_list); \ + nr_inactive_dirty_pages++; \ + page->zone->inactive_dirty_pages++; \ +} + +#define add_page_to_inactive_clean_list(page) { \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ + SetPageInactiveClean(page); \ + list_add(&(page)->lru, &page->zone->inactive_clean_list); \ + page->zone->inactive_clean_pages++; \ +} + +#define del_page_from_active_list(page) { \ + list_del(&(page)->lru); \ + ClearPageActive(page); \ + nr_active_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +#define del_page_from_inactive_dirty_list(page) { \ + list_del(&(page)->lru); \ + ClearPageInactiveDirty(page); \ + nr_inactive_dirty_pages--; \ + page->zone->inactive_dirty_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +#define del_page_from_inactive_clean_list(page) { \ + list_del(&(page)->lru); \ + ClearPageInactiveClean(page); \ + page->zone->inactive_clean_pages--; \ + DEBUG_ADD_PAGE \ + ZERO_PAGE_BUG \ +} + +/* + * In mm/swap.c::recalculate_vm_stats(), we substract + * inactive_target from memory_pressure every second. + * This means that memory_pressure is smoothed over + * 64 (1 << INACTIVE_SHIFT) seconds. + */ +#define INACTIVE_SHIFT 6 +#define inactive_min(a,b) ((a) < (b) ? (a) : (b)) +#define inactive_target inactive_min((memory_pressure >> INACTIVE_SHIFT), \ + (num_physpages / 4)) + +/* + * Ugly ugly ugly HACK to make sure the inactive lists + * don't fill up with unfreeable ramdisk pages. We really + * want to fix the ramdisk driver to mark its pages as + * unfreeable instead of using dirty buffer magic, but the + * next code-change time is when 2.5 is forked... + */ +#ifndef _LINUX_KDEV_T_H +#include +#endif +#ifndef _LINUX_MAJOR_H +#include +#endif + +#define page_ramdisk(page) \ + (page->buffers && (MAJOR(page->buffers->b_dev) == RAMDISK_MAJOR)) extern spinlock_t swaplock; diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/sysctl.h linux/include/linux/sysctl.h --- v2.4.0-test8/linux/include/linux/sysctl.h Thu Aug 10 13:01:26 2000 +++ linux/include/linux/sysctl.h Sun Sep 17 09:48:04 2000 @@ -522,7 +522,8 @@ DEV_CDROM=1, DEV_HWMON=2, DEV_PARPORT=3, - DEV_RAID=4 + DEV_RAID=4, + DEV_MAC_HID=5 }; /* /proc/sys/dev/cdrom */ @@ -571,6 +572,16 @@ /* /proc/sys/dev/parport/parport n/devices/device n */ enum { DEV_PARPORT_DEVICE_TIMESLICE=1, +}; + +/* /proc/sys/dev/mac_hid */ +enum { + DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, + DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, + DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, + DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, + DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, + DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; #ifdef __KERNEL__ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/tcp.h linux/include/linux/tcp.h --- v2.4.0-test8/linux/include/linux/tcp.h Fri Sep 8 12:52:42 2000 +++ linux/include/linux/tcp.h Mon Sep 18 15:37:56 2000 @@ -125,5 +125,63 @@ #define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ #define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ #define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +#define TCP_INFO 11 /* Information about this connection. */ + +#define TCPI_OPT_TIMESTAMPS 1 +#define TCPI_OPT_SACK 2 +#define TCPI_OPT_WSCALE 4 +#define TCPI_OPT_ECN 8 + +enum tcp_ca_state +{ + TCP_CA_Open = 0, +#define TCPF_CA_Open (1< - * Greg Herlein, + * Authors: Ed Okerson, + * Greg Herlein, * - * Contributors: Alan Cox, - * David Erhart, + * Contributors: Alan Cox, + * David W. Erhart, * * Version: 0.1.0 - December 19, 1999 * * Fixes: - */ + * + *****************************************************************************/ #ifndef TELEPHONY_H #define TELEPHONY_H -/* vendor identification numbers */ #define PHONE_VENDOR_IXJ 1 -#define PHONE_VENDOR_QUICKNET PHONE_IXJ +#define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ #define PHONE_VENDOR_VOICETRONIX 2 #define PHONE_VENDOR_ACULAB 3 #define PHONE_VENDOR_DIGI 4 @@ -43,7 +44,6 @@ * *****************************************************************************/ - /****************************************************************************** * * The capabilities ioctls can inform you of the capabilities of each phone @@ -81,11 +81,23 @@ #define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *) #define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *) +typedef struct { + char month[3]; + char day[3]; + char hour[3]; + char min[3]; + int numlen; + char number[11]; + int namelen; + char name[80]; +} PHONE_CID; + #define PHONE_RING _IO ('q', 0x83) #define PHONE_HOOKSTATE _IO ('q', 0x84) #define PHONE_MAXRINGS _IOW ('q', 0x85, char) #define PHONE_RING_CADENCE _IOW ('q', 0x86, short) -#define PHONE_RING_START _IO ('q', 0x87) +#define OLD_PHONE_RING_START _IO ('q', 0x87) +#define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *) #define PHONE_RING_STOP _IO ('q', 0x88) #define USA_RING_CADENCE 0xC0C0 @@ -167,6 +179,23 @@ #define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *) #define PHONE_PSTN_LINETEST _IO ('q', 0xA8) +/****************************************************************************** +* +* This controls the VAD/CNG functionality of G.723.1. The driver will +* always pass full size frames, any unused bytes will be padded with zeros, +* and frames passed to the driver should also be padded with zeros. The +* frame type is encoded in the least significant two bits of the first +* WORD of the frame as follows: +* +* bits 1-0 Frame Type Data Rate Significant Words +* 00 0 G.723.1 6.3 12 +* 01 1 G.723.1 5.3 10 +* 10 2 VAD/CNG 2 +* 11 3 Repeat last CNG 2 bits +* +******************************************************************************/ +#define PHONE_VAD _IOW ('q', 0xA9, int) + /****************************************************************************** * @@ -198,7 +227,12 @@ unsigned int f1:1; unsigned int f2:1; unsigned int f3:1; - unsigned int reserved:23; + unsigned int flash:1; + unsigned int fc0:1; + unsigned int fc1:1; + unsigned int fc2:1; + unsigned int fc3:1; + unsigned int reserved:18; }; union telephony_exception { diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/time.h linux/include/linux/time.h --- v2.4.0-test8/linux/include/linux/time.h Fri Sep 8 12:52:41 2000 +++ linux/include/linux/time.h Mon Sep 18 15:37:54 2000 @@ -45,7 +45,42 @@ value->tv_nsec = (jiffies % HZ) * (1000000000L / HZ); value->tv_sec = jiffies / HZ; } - + + +/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. + * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 + * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. + * + * [For the Julian calendar (which was used in Russia before 1917, + * Britain & colonies before 1752, anywhere else before 1582, + * and is still in use by some communities) leave out the + * -year/100+year/400 terms, and add 10.] + * + * This algorithm was first published by Gauss (I think). + * + * WARNING: this function will overflow on 2106-02-07 06:28:16 on + * machines were long is 32-bit! (However, as time_t is signed, we + * will already get problems at other places on 2038-01-19 03:14:08) + */ +static inline unsigned long +mktime (unsigned int year, unsigned int mon, + unsigned int day, unsigned int hour, + unsigned int min, unsigned int sec) +{ + if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ + mon += 12; /* Puts Feb last since it has leap day */ + year -= 1; + } + + return ((( + (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) + + year*365 - 719499 + )*24 + hour /* now have hours */ + )*60 + min /* now have minutes */ + )*60 + sec; /* finally seconds */ +} + + struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* microseconds */ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/toshiba.h linux/include/linux/toshiba.h --- v2.4.0-test8/linux/include/linux/toshiba.h Wed Dec 31 16:00:00 1969 +++ linux/include/linux/toshiba.h Mon Sep 18 15:02:03 2000 @@ -0,0 +1,36 @@ +/* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops + * + * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk) + * + * Thanks to Juergen Heinzl for the pointers + * on making sure the structure is aligned and packed. + * + * 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, 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. + * + */ + +#ifndef _LINUX_TOSHIBA_H +#define _LINUX_TOSHIBA_H + +#define TOSH_PROC "/proc/toshiba" +#define TOSH_DEVICE "/dev/toshiba" +#define TOSH_SMM _IOWR('t', 0x90, 24) + +typedef struct { + unsigned int eax; + unsigned int ebx __attribute__ ((packed)); + unsigned int ecx __attribute__ ((packed)); + unsigned int edx __attribute__ ((packed)); + unsigned int esi __attribute__ ((packed)); + unsigned int edi __attribute__ ((packed)); +} SMMRegisters; + +#endif diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/usb.h linux/include/linux/usb.h --- v2.4.0-test8/linux/include/linux/usb.h Tue Aug 22 09:06:31 2000 +++ linux/include/linux/usb.h Mon Sep 18 15:23:30 2000 @@ -348,6 +348,7 @@ #define USB_URB_EARLY_COMPLETE 0x0004 #define USB_ASYNC_UNLINK 0x0008 #define USB_QUEUE_BULK 0x0010 +#define USB_NO_FSBR 0x0020 #define USB_TIMEOUT_KILLED 0x1000 // only set by HCD! typedef struct @@ -775,13 +776,13 @@ #else /* CONFIG_USB_DEVICEFS */ -extern inline void usbdevfs_add_bus(struct usb_bus *bus) {} -extern inline void usbdevfs_remove_bus(struct usb_bus *bus) {} -extern inline void usbdevfs_add_device(struct usb_device *dev) {} -extern inline void usbdevfs_remove_device(struct usb_device *dev) {} +static inline void usbdevfs_add_bus(struct usb_bus *bus) {} +static inline void usbdevfs_remove_bus(struct usb_bus *bus) {} +static inline void usbdevfs_add_device(struct usb_device *dev) {} +static inline void usbdevfs_remove_device(struct usb_device *dev) {} -extern inline int usbdevfs_init(void) { return 0; } -extern inline void usbdevfs_cleanup(void) { } +static inline int usbdevfs_init(void) { return 0; } +static inline void usbdevfs_cleanup(void) { } #endif /* CONFIG_USB_DEVICEFS */ diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/vt_buffer.h linux/include/linux/vt_buffer.h --- v2.4.0-test8/linux/include/linux/vt_buffer.h Fri Sep 8 12:53:46 2000 +++ linux/include/linux/vt_buffer.h Mon Sep 18 15:39:03 2000 @@ -32,7 +32,7 @@ #endif #ifndef VT_BUF_HAVE_MEMSETW -extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) +static inline void scr_memsetw(u16 *s, u16 c, unsigned int count) { count /= 2; while (count--) @@ -41,7 +41,7 @@ #endif #ifndef VT_BUF_HAVE_MEMCPYW -extern inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count) +static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) @@ -50,7 +50,7 @@ #endif #ifndef VT_BUF_HAVE_MEMMOVEW -extern inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count) +static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count) { if (d < s) scr_memcpyw(d, s, count); @@ -65,14 +65,14 @@ #endif #ifndef VT_BUF_HAVE_MEMCPYF -extern inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count) +static inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) *d++ = scr_readw(s++); } -extern inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count) +static inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count) { count /= 2; while (count--) diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/wait.h linux/include/linux/wait.h --- v2.4.0-test8/linux/include/linux/wait.h Fri Sep 8 12:52:41 2000 +++ linux/include/linux/wait.h Mon Sep 18 15:37:55 2000 @@ -158,7 +158,7 @@ return !list_empty(&q->task_list); } -extern inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) +static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) { #if WAITQUEUE_DEBUG if (!head || !new) @@ -174,7 +174,7 @@ /* * Used for wake-one threads: */ -extern inline void __add_wait_queue_tail(wait_queue_head_t *head, +static inline void __add_wait_queue_tail(wait_queue_head_t *head, wait_queue_t *new) { #if WAITQUEUE_DEBUG @@ -188,7 +188,7 @@ list_add_tail(&new->task_list, &head->task_list); } -extern inline void __remove_wait_queue(wait_queue_head_t *head, +static inline void __remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old) { #if WAITQUEUE_DEBUG diff -u --recursive --new-file v2.4.0-test8/linux/include/linux/zftape.h linux/include/linux/zftape.h --- v2.4.0-test8/linux/include/linux/zftape.h Tue Nov 25 14:45:28 1997 +++ linux/include/linux/zftape.h Sun Sep 17 09:37:02 2000 @@ -56,7 +56,7 @@ extern int zft_init(void); -extern inline __s64 zft_div_blksz(__s64 value, __u32 blk_sz) +static inline __s64 zft_div_blksz(__s64 value, __u32 blk_sz) { if (blk_sz == 1) { return value; @@ -66,7 +66,7 @@ } } -extern inline __s64 zft_mul_blksz(__s64 value, __u32 blk_sz) +static inline __s64 zft_mul_blksz(__s64 value, __u32 blk_sz) { if (blk_sz == 1) { return value; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/addrconf.h linux/include/net/addrconf.h --- v2.4.0-test8/linux/include/net/addrconf.h Mon Aug 23 10:01:02 1999 +++ linux/include/net/addrconf.h Sun Sep 17 10:03:43 2000 @@ -87,7 +87,7 @@ extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); -extern __inline__ struct inet6_dev * +static inline struct inet6_dev * __in6_dev_get(struct net_device *dev) { return (struct inet6_dev *)dev->ip6_ptr; @@ -95,7 +95,7 @@ extern rwlock_t addrconf_lock; -extern __inline__ struct inet6_dev * +static inline struct inet6_dev * in6_dev_get(struct net_device *dev) { struct inet6_dev *idev = NULL; @@ -109,7 +109,7 @@ extern void in6_dev_finish_destroy(struct inet6_dev *idev); -extern __inline__ void +static inline void in6_dev_put(struct inet6_dev *idev) { if (atomic_dec_and_test(&idev->refcnt)) @@ -122,7 +122,7 @@ extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp); -extern __inline__ void in6_ifa_put(struct inet6_ifaddr *ifp) +static inline void in6_ifa_put(struct inet6_ifaddr *ifp) { if (atomic_dec_and_test(&ifp->refcnt)) inet6_ifa_finish_destroy(ifp); @@ -157,7 +157,7 @@ * compute link-local solicited-node multicast address */ -extern __inline__ void addrconf_addr_solict_mult_old(struct in6_addr *addr, +static inline void addrconf_addr_solict_mult_old(struct in6_addr *addr, struct in6_addr *solicited) { ipv6_addr_set(solicited, @@ -165,7 +165,7 @@ __constant_htonl(0x1), addr->s6_addr32[3]); } -extern __inline__ void addrconf_addr_solict_mult_new(struct in6_addr *addr, +static inline void addrconf_addr_solict_mult_new(struct in6_addr *addr, struct in6_addr *solicited) { ipv6_addr_set(solicited, @@ -175,21 +175,21 @@ } -extern __inline__ void ipv6_addr_all_nodes(struct in6_addr *addr) +static inline void ipv6_addr_all_nodes(struct in6_addr *addr) { ipv6_addr_set(addr, __constant_htonl(0xFF020000), 0, 0, __constant_htonl(0x1)); } -extern __inline__ void ipv6_addr_all_routers(struct in6_addr *addr) +static inline void ipv6_addr_all_routers(struct in6_addr *addr) { ipv6_addr_set(addr, __constant_htonl(0xFF020000), 0, 0, __constant_htonl(0x2)); } -extern __inline__ int ipv6_addr_is_multicast(struct in6_addr *addr) +static inline int ipv6_addr_is_multicast(struct in6_addr *addr) { return (addr->s6_addr32[0] & __constant_htonl(0xFF000000)) == __constant_htonl(0xFF000000); } diff -u --recursive --new-file v2.4.0-test8/linux/include/net/checksum.h linux/include/net/checksum.h --- v2.4.0-test8/linux/include/net/checksum.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/checksum.h Mon Sep 18 15:39:27 2000 @@ -93,7 +93,7 @@ #endif #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER -extern __inline__ +static inline unsigned int csum_and_copy_from_user (const char *src, char *dst, int len, int sum, int *err_ptr) { diff -u --recursive --new-file v2.4.0-test8/linux/include/net/dn_route.h linux/include/net/dn_route.h --- v2.4.0-test8/linux/include/net/dn_route.h Sat Jan 8 21:36:20 2000 +++ linux/include/net/dn_route.h Sun Sep 17 10:03:43 2000 @@ -91,12 +91,12 @@ #include #include -extern __inline__ void dn_rt_send(struct sk_buff *skb) +static inline void dn_rt_send(struct sk_buff *skb) { dev_queue_xmit(skb); } -extern __inline__ void dn_rt_finish_output(struct sk_buff *skb, char *dst) +static inline void dn_rt_finish_output(struct sk_buff *skb, char *dst) { struct net_device *dev = skb->dev; @@ -110,7 +110,7 @@ kfree_skb(skb); } -extern __inline__ void dn_nsp_send(struct sk_buff *skb) +static inline void dn_nsp_send(struct sk_buff *skb) { struct sock *sk = skb->sk; struct dn_scp *scp = &sk->protinfo.dn; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/dsfield.h linux/include/net/dsfield.h --- v2.4.0-test8/linux/include/net/dsfield.h Tue Feb 8 18:23:13 2000 +++ linux/include/net/dsfield.h Mon Sep 18 15:04:13 2000 @@ -12,19 +12,19 @@ #include -extern __inline__ __u8 ipv4_get_dsfield(struct iphdr *iph) +static inline __u8 ipv4_get_dsfield(struct iphdr *iph) { return iph->tos; } -extern __inline__ __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) +static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) { return ntohs(*(__u16 *) ipv6h) >> 4; } -extern __inline__ void ipv4_change_dsfield(struct iphdr *iph,__u8 mask, +static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask, __u8 value) { __u32 check = ntohs(iph->check); @@ -40,7 +40,7 @@ } -extern __inline__ void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask, +static inline void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask, __u8 value) { __u16 tmp; @@ -53,7 +53,7 @@ #if 0 /* put this later into asm-i386 or such ... */ -extern __inline__ void ip_change_dsfield(struct iphdr *iph,__u16 dsfield) +static inline void ip_change_dsfield(struct iphdr *iph,__u16 dsfield) { __u16 check; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/dst.h linux/include/net/dst.h --- v2.4.0-test8/linux/include/net/dst.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/dst.h Mon Sep 18 15:39:06 2000 @@ -88,12 +88,12 @@ #ifdef __KERNEL__ -extern __inline__ void dst_hold(struct dst_entry * dst) +static inline void dst_hold(struct dst_entry * dst) { atomic_inc(&dst->__refcnt); } -extern __inline__ +static inline struct dst_entry * dst_clone(struct dst_entry * dst) { if (dst) @@ -101,7 +101,7 @@ return dst; } -extern __inline__ +static inline void dst_release(struct dst_entry * dst) { if (dst) @@ -112,7 +112,7 @@ extern void __dst_free(struct dst_entry * dst); extern void dst_destroy(struct dst_entry * dst); -extern __inline__ +static inline void dst_free(struct dst_entry * dst) { if (dst->obsolete > 1) @@ -124,27 +124,27 @@ __dst_free(dst); } -extern __inline__ void dst_confirm(struct dst_entry *dst) +static inline void dst_confirm(struct dst_entry *dst) { if (dst) neigh_confirm(dst->neighbour); } -extern __inline__ void dst_negative_advice(struct dst_entry **dst_p) +static inline void dst_negative_advice(struct dst_entry **dst_p) { struct dst_entry * dst = *dst_p; if (dst && dst->ops->negative_advice) *dst_p = dst->ops->negative_advice(dst); } -extern __inline__ void dst_link_failure(struct sk_buff *skb) +static inline void dst_link_failure(struct sk_buff *skb) { struct dst_entry * dst = skb->dst; if (dst && dst->ops && dst->ops->link_failure) dst->ops->link_failure(skb); } -extern __inline__ void dst_set_expires(struct dst_entry *dst, int timeout) +static inline void dst_set_expires(struct dst_entry *dst, int timeout) { unsigned long expires = jiffies + timeout; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/if_inet6.h linux/include/net/if_inet6.h --- v2.4.0-test8/linux/include/net/if_inet6.h Thu Jun 22 07:23:26 2000 +++ linux/include/net/if_inet6.h Mon Sep 18 15:04:13 2000 @@ -108,7 +108,7 @@ extern struct ipv6_devconf ipv6_devconf; -extern __inline__ void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) +static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) { /* * +-------+-------+-------+-------+-------+-------+ @@ -122,7 +122,7 @@ memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); } -extern __inline__ void ipv6_tr_mc_map(struct in6_addr *addr, char *buf) +static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf) { /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */ diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ip.h linux/include/net/ip.h --- v2.4.0-test8/linux/include/net/ip.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/ip.h Mon Sep 18 15:39:26 2000 @@ -115,7 +115,7 @@ * multicast packets. */ -extern __inline__ void ip_tr_mc_map(u32 addr, char *buf) +static inline void ip_tr_mc_map(u32 addr, char *buf) { buf[0]=0xC0; buf[1]=0x00; @@ -159,7 +159,7 @@ extern int sysctl_ip_default_ttl; #ifdef CONFIG_INET -extern __inline__ int ip_send(struct sk_buff *skb) +static inline int ip_send(struct sk_buff *skb) { if (skb->len > skb->dst->pmtu) return ip_fragment(skb, ip_finish_output); @@ -169,7 +169,7 @@ /* The function in 2.2 was invalid, producing wrong result for * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ -extern __inline__ +static inline int ip_decrease_ttl(struct iphdr *iph) { u32 check = iph->check; @@ -178,7 +178,7 @@ return --iph->ttl; } -extern __inline__ +static inline int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) { return (sk->protinfo.af_inet.pmtudisc == IP_PMTUDISC_DO || @@ -188,7 +188,7 @@ extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst); -extern __inline__ void ip_select_ident(struct iphdr *iph, struct dst_entry *dst) +static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst) { if (iph->frag_off&__constant_htons(IP_DF)) iph->id = 0; @@ -200,7 +200,7 @@ * Map a multicast IP onto multicast MAC for type ethernet. */ -extern __inline__ void ip_eth_mc_map(u32 addr, char *buf) +static inline void ip_eth_mc_map(u32 addr, char *buf) { addr=ntohl(addr); buf[0]=0x01; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ip6_fib.h linux/include/net/ip6_fib.h --- v2.4.0-test8/linux/include/net/ip6_fib.h Mon Aug 23 10:01:02 1999 +++ linux/include/net/ip6_fib.h Mon Sep 18 15:04:13 2000 @@ -96,7 +96,7 @@ extern struct fib6_walker_t fib6_walker_list; extern rwlock_t fib6_walker_lock; -extern __inline__ void fib6_walker_link(struct fib6_walker_t *w) +static inline void fib6_walker_link(struct fib6_walker_t *w) { write_lock_bh(&fib6_walker_lock); w->next = fib6_walker_list.next; @@ -106,7 +106,7 @@ write_unlock_bh(&fib6_walker_lock); } -extern __inline__ void fib6_walker_unlink(struct fib6_walker_t *w) +static inline void fib6_walker_unlink(struct fib6_walker_t *w) { write_lock_bh(&fib6_walker_lock); w->next->prev = w->prev; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ip6_route.h linux/include/net/ip6_route.h --- v2.4.0-test8/linux/include/net/ip6_route.h Mon Aug 23 10:01:02 1999 +++ linux/include/net/ip6_route.h Mon Sep 18 15:04:13 2000 @@ -94,7 +94,7 @@ * For UDP/RAW sockets this is done on udp_connect. */ -extern __inline__ void ip6_dst_store(struct sock *sk, struct dst_entry *dst, +static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, struct in6_addr *daddr) { struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ip_fib.h linux/include/net/ip_fib.h --- v2.4.0-test8/linux/include/net/ip_fib.h Mon Aug 23 10:01:02 1999 +++ linux/include/net/ip_fib.h Mon Sep 18 15:04:13 2000 @@ -140,19 +140,19 @@ extern struct fib_table *local_table; extern struct fib_table *main_table; -extern __inline__ struct fib_table *fib_get_table(int id) +static inline struct fib_table *fib_get_table(int id) { if (id != RT_TABLE_LOCAL) return main_table; return local_table; } -extern __inline__ struct fib_table *fib_new_table(int id) +static inline struct fib_table *fib_new_table(int id) { return fib_get_table(id); } -extern __inline__ int fib_lookup(const struct rt_key *key, struct fib_result *res) +static inline int fib_lookup(const struct rt_key *key, struct fib_result *res) { if (local_table->tb_lookup(local_table, key, res) && main_table->tb_lookup(main_table, key, res)) @@ -160,7 +160,7 @@ return 0; } -extern __inline__ void fib_select_default(const struct rt_key *key, struct fib_result *res) +static inline void fib_select_default(const struct rt_key *key, struct fib_result *res) { if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) main_table->tb_select_default(main_table, key, res); @@ -175,7 +175,7 @@ extern struct fib_table *__fib_new_table(int id); extern void fib_rule_put(struct fib_rule *r); -extern __inline__ struct fib_table *fib_get_table(int id) +static inline struct fib_table *fib_get_table(int id) { if (id == 0) id = RT_TABLE_MAIN; @@ -183,7 +183,7 @@ return fib_tables[id]; } -extern __inline__ struct fib_table *fib_new_table(int id) +static inline struct fib_table *fib_new_table(int id) { if (id == 0) id = RT_TABLE_MAIN; @@ -241,7 +241,7 @@ extern void fib_rules_init(void); #endif -extern __inline__ void fib_combine_itag(u32 *itag, struct fib_result *res) +static inline void fib_combine_itag(u32 *itag, struct fib_result *res) { #ifdef CONFIG_NET_CLS_ROUTE #ifdef CONFIG_IP_MULTIPLE_TABLES @@ -259,13 +259,13 @@ extern void free_fib_info(struct fib_info *fi); -extern __inline__ void fib_info_put(struct fib_info *fi) +static inline void fib_info_put(struct fib_info *fi) { if (atomic_dec_and_test(&fi->fib_clntref)) free_fib_info(fi); } -extern __inline__ void fib_res_put(struct fib_result *res) +static inline void fib_res_put(struct fib_result *res) { if (res->fi) fib_info_put(res->fi); diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ipv6.h linux/include/net/ipv6.h --- v2.4.0-test8/linux/include/net/ipv6.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/ipv6.h Mon Sep 18 15:41:09 2000 @@ -4,7 +4,7 @@ * Authors: * Pedro Roque * - * $Id: ipv6.h,v 1.21 2000/07/07 22:29:42 davem Exp $ + * $Id: ipv6.h,v 1.22 2000/09/18 05:54:13 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -169,7 +169,7 @@ extern void ip6_flowlabel_init(void); extern void ip6_flowlabel_cleanup(void); -extern __inline__ void fl6_sock_release(struct ip6_flowlabel *fl) +static inline void fl6_sock_release(struct ip6_flowlabel *fl) { if (fl) atomic_dec(&fl->users); @@ -206,23 +206,23 @@ extern int ipv6_addr_type(struct in6_addr *addr); -extern __inline__ int ipv6_addr_scope(struct in6_addr *addr) +static inline int ipv6_addr_scope(struct in6_addr *addr) { return ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; } -extern __inline__ int ipv6_addr_cmp(struct in6_addr *a1, struct in6_addr *a2) +static inline int ipv6_addr_cmp(struct in6_addr *a1, struct in6_addr *a2) { return memcmp((void *) a1, (void *) a2, sizeof(struct in6_addr)); } -extern __inline__ void ipv6_addr_copy(struct in6_addr *a1, struct in6_addr *a2) +static inline void ipv6_addr_copy(struct in6_addr *a1, struct in6_addr *a2) { memcpy((void *) a1, (void *) a2, sizeof(struct in6_addr)); } #ifndef __HAVE_ARCH_ADDR_SET -extern __inline__ void ipv6_addr_set(struct in6_addr *addr, +static inline void ipv6_addr_set(struct in6_addr *addr, __u32 w1, __u32 w2, __u32 w3, __u32 w4) { @@ -233,7 +233,7 @@ } #endif -extern __inline__ int ipv6_addr_any(struct in6_addr *a) +static inline int ipv6_addr_any(struct in6_addr *a) { return ((a->s6_addr32[0] | a->s6_addr32[1] | a->s6_addr32[2] | a->s6_addr32[3] ) == 0); diff -u --recursive --new-file v2.4.0-test8/linux/include/net/ndisc.h linux/include/net/ndisc.h --- v2.4.0-test8/linux/include/net/ndisc.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/ndisc.h Mon Sep 18 15:39:27 2000 @@ -101,7 +101,7 @@ extern void igmp6_cleanup(void); -extern __inline__ struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr) +static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr) { if (dev) diff -u --recursive --new-file v2.4.0-test8/linux/include/net/neighbour.h linux/include/net/neighbour.h --- v2.4.0-test8/linux/include/net/neighbour.h Fri Sep 8 12:53:53 2000 +++ linux/include/net/neighbour.h Mon Sep 18 15:39:06 2000 @@ -212,13 +212,13 @@ * Neighbour references */ -extern __inline__ void neigh_release(struct neighbour *neigh) +static inline void neigh_release(struct neighbour *neigh) { if (atomic_dec_and_test(&neigh->refcnt)) neigh_destroy(neigh); } -extern __inline__ struct neighbour * neigh_clone(struct neighbour *neigh) +static inline struct neighbour * neigh_clone(struct neighbour *neigh) { if (neigh) atomic_inc(&neigh->refcnt); @@ -227,23 +227,23 @@ #define neigh_hold(n) atomic_inc(&(n)->refcnt) -extern __inline__ void neigh_confirm(struct neighbour *neigh) +static inline void neigh_confirm(struct neighbour *neigh) { if (neigh) neigh->confirmed = jiffies; } -extern __inline__ int neigh_is_connected(struct neighbour *neigh) +static inline int neigh_is_connected(struct neighbour *neigh) { return neigh->nud_state&NUD_CONNECTED; } -extern __inline__ int neigh_is_valid(struct neighbour *neigh) +static inline int neigh_is_valid(struct neighbour *neigh) { return neigh->nud_state&NUD_VALID; } -extern __inline__ int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) +static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) { neigh->used = jiffies; if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE))) @@ -251,7 +251,7 @@ return 0; } -extern __inline__ struct neighbour * +static inline struct neighbour * __neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat) { struct neighbour *n = neigh_lookup(tbl, pkey, dev); @@ -263,7 +263,7 @@ return IS_ERR(n) ? NULL : n; } -extern __inline__ struct neighbour * +static inline struct neighbour * __neigh_lookup_errno(struct neigh_table *tbl, const void *pkey, struct net_device *dev) { diff -u --recursive --new-file v2.4.0-test8/linux/include/net/pkt_cls.h linux/include/net/pkt_cls.h --- v2.4.0-test8/linux/include/net/pkt_cls.h Fri Jan 7 18:11:45 2000 +++ linux/include/net/pkt_cls.h Mon Sep 18 15:04:13 2000 @@ -63,7 +63,7 @@ specific classifiers. */ -extern __inline__ int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) +static inline int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) { int err = 0; u32 protocol = skb->protocol; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/pkt_sched.h linux/include/net/pkt_sched.h --- v2.4.0-test8/linux/include/net/pkt_sched.h Fri Sep 8 12:53:56 2000 +++ linux/include/net/pkt_sched.h Mon Sep 18 15:39:09 2000 @@ -104,32 +104,32 @@ int refcnt; }; -extern __inline__ void sch_tree_lock(struct Qdisc *q) +static inline void sch_tree_lock(struct Qdisc *q) { write_lock(&qdisc_tree_lock); spin_lock_bh(&q->dev->queue_lock); } -extern __inline__ void sch_tree_unlock(struct Qdisc *q) +static inline void sch_tree_unlock(struct Qdisc *q) { spin_unlock_bh(&q->dev->queue_lock); write_unlock(&qdisc_tree_lock); } -extern __inline__ void tcf_tree_lock(struct tcf_proto *tp) +static inline void tcf_tree_lock(struct tcf_proto *tp) { write_lock(&qdisc_tree_lock); spin_lock_bh(&tp->q->dev->queue_lock); } -extern __inline__ void tcf_tree_unlock(struct tcf_proto *tp) +static inline void tcf_tree_unlock(struct tcf_proto *tp) { spin_unlock_bh(&tp->q->dev->queue_lock); write_unlock(&qdisc_tree_lock); } -extern __inline__ unsigned long +static inline unsigned long cls_set_class(struct tcf_proto *tp, unsigned long *clp, unsigned long cl) { unsigned long old_cl; @@ -141,7 +141,7 @@ return old_cl; } -extern __inline__ unsigned long +static inline unsigned long __cls_set_class(unsigned long *clp, unsigned long cl) { unsigned long old_cl; @@ -401,7 +401,7 @@ extern int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p); extern int tcf_police(struct sk_buff *skb, struct tcf_police *p); -extern __inline__ void tcf_police_release(struct tcf_police *p) +static inline void tcf_police_release(struct tcf_police *p) { if (p && --p->refcnt == 0) tcf_police_destroy(p); @@ -433,7 +433,7 @@ extern int qdisc_restart(struct net_device *dev); -extern __inline__ void qdisc_run(struct net_device *dev) +static inline void qdisc_run(struct net_device *dev) { while (!netif_queue_stopped(dev) && qdisc_restart(dev)<0) @@ -443,7 +443,7 @@ /* Calculate maximal size of packet seen by hard_start_xmit routine of this device. */ -extern __inline__ unsigned psched_mtu(struct net_device *dev) +static inline unsigned psched_mtu(struct net_device *dev) { unsigned mtu = dev->mtu; return dev->hard_header ? mtu + dev->hard_header_len : mtu; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/profile.h linux/include/net/profile.h --- v2.4.0-test8/linux/include/net/profile.h Fri Sep 8 12:52:42 2000 +++ linux/include/net/profile.h Mon Sep 18 15:37:56 2000 @@ -31,12 +31,12 @@ #ifdef CONFIG_X86_TSC -extern __inline__ void net_profile_stamp(struct timeval *pstamp) +static inline void net_profile_stamp(struct timeval *pstamp) { rdtsc(pstamp->tv_usec, pstamp->tv_sec); } -extern __inline__ void net_profile_accumulate(struct timeval *entered, +static inline void net_profile_accumulate(struct timeval *entered, struct timeval *leaved, struct timeval *acc) { @@ -52,7 +52,7 @@ "0" (acc->tv_usec), "1" (acc->tv_sec)); } -extern __inline__ void net_profile_sub(struct timeval *sub, +static inline void net_profile_sub(struct timeval *sub, struct timeval *acc) { __asm__ __volatile__ ("subl %2,%0\n\t" @@ -62,7 +62,7 @@ "0" (acc->tv_usec), "1" (acc->tv_sec)); } -extern __inline__ void net_profile_add(struct timeval *add, +static inline void net_profile_add(struct timeval *add, struct timeval *acc) { __asm__ __volatile__ ("addl %2,%0\n\t" @@ -80,7 +80,7 @@ /* On alpha cycle counter has only 32 bits :-( :-( */ -extern __inline__ void net_profile_stamp(struct timeval *pstamp) +static inline void net_profile_stamp(struct timeval *pstamp) { __u32 result; __asm__ __volatile__ ("rpcc %0" : "r="(result)); @@ -91,7 +91,7 @@ pstamp->tv_usec = alpha_lo; } -extern __inline__ void net_profile_accumulate(struct timeval *entered, +static inline void net_profile_accumulate(struct timeval *entered, struct timeval *leaved, struct timeval *acc) { @@ -113,7 +113,7 @@ acc->tv_usec = usecs; } -extern __inline__ void net_profile_sub(struct timeval *entered, +static inline void net_profile_sub(struct timeval *entered, struct timeval *leaved) { time_t usecs = leaved->tv_usec - entered->tv_usec; @@ -127,7 +127,7 @@ leaved->tv_usec = usecs; } -extern __inline__ void net_profile_add(struct timeval *entered, struct timeval *leaved) +static inline void net_profile_add(struct timeval *entered, struct timeval *leaved) { time_t usecs = leaved->tv_usec + entered->tv_usec; time_t secs = leaved->tv_sec + entered->tv_sec; @@ -143,7 +143,7 @@ #else -extern __inline__ void net_profile_stamp(struct timeval *pstamp) +static inline void net_profile_stamp(struct timeval *pstamp) { /* Not "fast" counterpart! On architectures without cpu clock "fast" routine is absolutely useless in this @@ -154,7 +154,7 @@ do_gettimeofday(pstamp); } -extern __inline__ void net_profile_accumulate(struct timeval *entered, +static inline void net_profile_accumulate(struct timeval *entered, struct timeval *leaved, struct timeval *acc) { @@ -176,7 +176,7 @@ acc->tv_usec = usecs; } -extern __inline__ void net_profile_sub(struct timeval *entered, +static inline void net_profile_sub(struct timeval *entered, struct timeval *leaved) { time_t usecs = leaved->tv_usec - entered->tv_usec; @@ -190,7 +190,7 @@ leaved->tv_usec = usecs; } -extern __inline__ void net_profile_add(struct timeval *entered, struct timeval *leaved) +static inline void net_profile_add(struct timeval *entered, struct timeval *leaved) { time_t usecs = leaved->tv_usec + entered->tv_usec; time_t secs = leaved->tv_sec + entered->tv_sec; @@ -207,7 +207,7 @@ #endif -extern __inline__ void net_profile_enter(struct net_profile_slot *s) +static inline void net_profile_enter(struct net_profile_slot *s) { unsigned long flags; @@ -220,7 +220,7 @@ restore_flags(flags); } -extern __inline__ void net_profile_leave_irq(struct net_profile_slot *s) +static inline void net_profile_leave_irq(struct net_profile_slot *s) { unsigned long flags; @@ -241,7 +241,7 @@ restore_flags(flags); } -extern __inline__ void net_profile_leave(struct net_profile_slot *s) +static inline void net_profile_leave(struct net_profile_slot *s) { unsigned long flags; save_flags(flags); diff -u --recursive --new-file v2.4.0-test8/linux/include/net/route.h linux/include/net/route.h --- v2.4.0-test8/linux/include/net/route.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/route.h Mon Sep 18 15:39:08 2000 @@ -113,7 +113,7 @@ extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); /* Deprecated: use ip_route_output_key directly */ -extern __inline__ int ip_route_output(struct rtable **rp, +static inline int ip_route_output(struct rtable **rp, u32 daddr, u32 saddr, u32 tos, int oif) { struct rt_key key = { dst:daddr, src:saddr, oif:oif, tos:tos }; @@ -122,7 +122,7 @@ } -extern __inline__ void ip_rt_put(struct rtable * rt) +static inline void ip_rt_put(struct rtable * rt) { if (rt) dst_release(&rt->u.dst); @@ -137,12 +137,12 @@ extern __u8 ip_tos2prio[16]; -extern __inline__ char rt_tos2priority(u8 tos) +static inline char rt_tos2priority(u8 tos) { return ip_tos2prio[IPTOS_TOS(tos)>>1]; } -extern __inline__ int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif) +static inline int ip_route_connect(struct rtable **rp, u32 dst, u32 src, u32 tos, int oif) { int err; err = ip_route_output(rp, dst, src, tos, oif); @@ -157,7 +157,7 @@ extern void rt_bind_peer(struct rtable *rt, int create); -extern __inline__ struct inet_peer *rt_get_peer(struct rtable *rt) +static inline struct inet_peer *rt_get_peer(struct rtable *rt) { if (rt->peer) return rt->peer; diff -u --recursive --new-file v2.4.0-test8/linux/include/net/sock.h linux/include/net/sock.h --- v2.4.0-test8/linux/include/net/sock.h Fri Sep 8 12:53:54 2000 +++ linux/include/net/sock.h Mon Sep 18 15:39:25 2000 @@ -470,7 +470,6 @@ #define sock_lock_init(__sk) \ do { spin_lock_init(&((__sk)->lock.slock)); \ - (__sk)->dst_lock = RW_LOCK_UNLOCKED; \ (__sk)->lock.users = 0; \ init_waitqueue_head(&((__sk)->lock.wq)); \ } while(0); @@ -749,6 +748,7 @@ #define SOCK_SNDBUF_LOCK 1 #define SOCK_RCVBUF_LOCK 2 #define SOCK_BINDADDR_LOCK 4 +#define SOCK_BINDPORT_LOCK 8 /* Used by processes to "lock" a socket state, so that @@ -818,7 +818,6 @@ int priority); extern void sock_wfree(struct sk_buff *skb); extern void sock_rfree(struct sk_buff *skb); -extern unsigned long sock_wspace(struct sock *sk); extern int sock_setsockopt(struct socket *sock, int level, int op, char *optval, @@ -901,7 +900,7 @@ * be accepted or 1 if the packet should be tossed. */ -extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) +static inline int sk_filter(struct sk_buff *skb, struct sk_filter *filter) { int pkt_len; @@ -922,7 +921,7 @@ * Remove a filter from a socket and release its resources. */ -extern __inline__ void sk_filter_release(struct sock *sk, struct sk_filter *fp) +static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) { unsigned int size = sk_filter_len(fp); @@ -932,7 +931,7 @@ kfree(fp); } -extern __inline__ void sk_filter_charge(struct sock *sk, struct sk_filter *fp) +static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) { atomic_inc(&fp->refcnt); atomic_add(sk_filter_len(fp), &sk->omem_alloc); @@ -971,7 +970,7 @@ modifications. */ -extern __inline__ void sock_hold(struct sock *sk) +static inline void sock_hold(struct sock *sk) { atomic_inc(&sk->refcnt); } @@ -979,13 +978,13 @@ /* Ungrab socket in the context, which assumes that socket refcnt cannot hit zero, f.e. it is true in context of any socketcall. */ -extern __inline__ void __sock_put(struct sock *sk) +static inline void __sock_put(struct sock *sk) { atomic_dec(&sk->refcnt); } /* Ungrab socket and destroy it, if it was the last reference. */ -extern __inline__ void sock_put(struct sock *sk) +static inline void sock_put(struct sock *sk) { if (atomic_dec_and_test(&sk->refcnt)) sk_free(sk); @@ -998,7 +997,7 @@ * probably wants some additional cleanups or even continuing * to work with this socket (TCP). */ -extern __inline__ void sock_orphan(struct sock *sk) +static inline void sock_orphan(struct sock *sk) { write_lock_bh(&sk->callback_lock); sk->dead = 1; @@ -1007,7 +1006,7 @@ write_unlock_bh(&sk->callback_lock); } -extern __inline__ void sock_graft(struct sock *sk, struct socket *parent) +static inline void sock_graft(struct sock *sk, struct socket *parent) { write_lock_bh(&sk->callback_lock); sk->sleep = &parent->wait; @@ -1036,13 +1035,13 @@ return ino; } -extern __inline__ struct dst_entry * +static inline struct dst_entry * __sk_dst_get(struct sock *sk) { return sk->dst_cache; } -extern __inline__ struct dst_entry * +static inline struct dst_entry * sk_dst_get(struct sock *sk) { struct dst_entry *dst; @@ -1055,7 +1054,7 @@ return dst; } -extern __inline__ void +static inline void __sk_dst_set(struct sock *sk, struct dst_entry *dst) { struct dst_entry *old_dst; @@ -1065,7 +1064,7 @@ dst_release(old_dst); } -extern __inline__ void +static inline void sk_dst_set(struct sock *sk, struct dst_entry *dst) { write_lock(&sk->dst_lock); @@ -1073,7 +1072,7 @@ write_unlock(&sk->dst_lock); } -extern __inline__ void +static inline void __sk_dst_reset(struct sock *sk) { struct dst_entry *old_dst; @@ -1083,7 +1082,7 @@ dst_release(old_dst); } -extern __inline__ void +static inline void sk_dst_reset(struct sock *sk) { write_lock(&sk->dst_lock); @@ -1091,7 +1090,7 @@ write_unlock(&sk->dst_lock); } -extern __inline__ struct dst_entry * +static inline struct dst_entry * __sk_dst_check(struct sock *sk, u32 cookie) { struct dst_entry *dst = sk->dst_cache; @@ -1104,7 +1103,7 @@ return dst; } -extern __inline__ struct dst_entry * +static inline struct dst_entry * sk_dst_check(struct sock *sk, u32 cookie) { struct dst_entry *dst = sk_dst_get(sk); @@ -1127,7 +1126,7 @@ * packet ever received. */ -extern __inline__ void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) +static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) { sock_hold(sk); skb->sk = sk; @@ -1135,14 +1134,14 @@ atomic_add(skb->truesize, &sk->wmem_alloc); } -extern __inline__ void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) +static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) { skb->sk = sk; skb->destructor = sock_rfree; atomic_add(skb->truesize, &sk->rmem_alloc); } -extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) +static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces number of warnings when compiling with -W --ANK @@ -1175,7 +1174,7 @@ return 0; } -extern __inline__ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) +static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) { /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces number of warnings when compiling with -W --ANK @@ -1193,13 +1192,13 @@ * Recover an error report and clear atomically */ -extern __inline__ int sock_error(struct sock *sk) +static inline int sock_error(struct sock *sk) { int err=xchg(&sk->err,0); return -err; } -extern __inline__ unsigned long sock_wspace(struct sock *sk) +static inline unsigned long sock_wspace(struct sock *sk) { int amt = 0; @@ -1211,7 +1210,7 @@ return amt; } -extern __inline__ void sk_wake_async(struct sock *sk, int how, int band) +static inline void sk_wake_async(struct sock *sk, int how, int band) { if (sk->socket && sk->socket->fasync_list) sock_wake_async(sk->socket, how, band); @@ -1226,27 +1225,27 @@ * Default write policy as shown to user space via poll/select/SIGIO * Kernel internally doesn't use the MIN_WRITE_SPACE threshold. */ -extern __inline__ int sock_writeable(struct sock *sk) +static inline int sock_writeable(struct sock *sk) { return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE; } -extern __inline__ int gfp_any(void) +static inline int gfp_any(void) { return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; } -extern __inline__ long sock_rcvtimeo(struct sock *sk, int noblock) +static inline long sock_rcvtimeo(struct sock *sk, int noblock) { return noblock ? 0 : sk->rcvtimeo; } -extern __inline__ long sock_sndtimeo(struct sock *sk, int noblock) +static inline long sock_sndtimeo(struct sock *sk, int noblock) { return noblock ? 0 : sk->sndtimeo; } -extern __inline__ int sock_rcvlowat(struct sock *sk, int waitall, int len) +static inline int sock_rcvlowat(struct sock *sk, int waitall, int len) { return (waitall ? len : min(sk->rcvlowat, len)) ? : 1; } @@ -1254,7 +1253,7 @@ /* Alas, with timeout socket operations are not restartable. * Compare this to poll(). */ -extern __inline__ int sock_intr_errno(long timeo) +static inline int sock_intr_errno(long timeo) { return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; } diff -u --recursive --new-file v2.4.0-test8/linux/include/net/tcp.h linux/include/net/tcp.h --- v2.4.0-test8/linux/include/net/tcp.h Fri Sep 8 12:54:06 2000 +++ linux/include/net/tcp.h Mon Sep 18 15:39:27 2000 @@ -166,7 +166,7 @@ extern kmem_cache_t *tcp_timewait_cachep; -extern __inline__ void tcp_tw_put(struct tcp_tw_bucket *tw) +static inline void tcp_tw_put(struct tcp_tw_bucket *tw) { if (atomic_dec_and_test(&tw->refcnt)) { #ifdef INET_REFCNT_DEBUG @@ -495,7 +495,7 @@ #define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC) #define tcp_openreq_fastfree(req) kmem_cache_free(tcp_openreq_cachep, req) -extern __inline__ void tcp_openreq_free(struct open_request *req) +static inline void tcp_openreq_free(struct open_request *req) { req->class->destructor(req); tcp_openreq_fastfree(req); @@ -656,20 +656,6 @@ memset(&tp->ack, 0, sizeof(tp->ack)); } -enum tcp_ca_state -{ - TCP_CA_Open = 0, -#define TCPF_CA_Open (1<tp_pinfo.af_tcp; @@ -1034,7 +1020,7 @@ * one half the current congestion window, but no * less than two segments */ -extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp) +static inline __u32 tcp_recalc_ssthresh(struct tcp_opt *tp) { return max(tp->snd_cwnd>>1, 2); } @@ -1043,7 +1029,7 @@ * The exception is rate halving phase, when cwnd is decreasing towards * ssthresh. */ -extern __inline__ __u32 tcp_current_ssthresh(struct tcp_opt *tp) +static inline __u32 tcp_current_ssthresh(struct tcp_opt *tp) { if ((1<ca_state)&(TCPF_CA_CWR|TCPF_CA_Recovery)) return tp->snd_ssthresh; @@ -1072,7 +1058,7 @@ } /* Set slow start threshould and cwnd not falling to slow start */ -extern __inline__ void __tcp_enter_cwr(struct tcp_opt *tp) +static inline void __tcp_enter_cwr(struct tcp_opt *tp) { tp->undo_marker = 0; tp->snd_ssthresh = tcp_recalc_ssthresh(tp); @@ -1083,7 +1069,7 @@ TCP_ECN_queue_cwr(tp); } -extern __inline__ void tcp_enter_cwr(struct tcp_opt *tp) +static inline void tcp_enter_cwr(struct tcp_opt *tp) { tp->prior_ssthresh = 0; if (tp->ca_state < TCP_CA_CWR) { @@ -1307,6 +1293,8 @@ case TCP_CLOSE: sk->prot->unhash(sk); + if (sk->prev && !(sk->userlocks&SOCK_BINDPORT_LOCK)) + tcp_put_port(sk); /* fall through */ default: if (oldstate==TCP_ESTABLISHED) @@ -1378,7 +1366,7 @@ * MAX_SYN_SIZE to match the new maximum number of options that you * can generate. */ -extern __inline__ void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, +static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent) { /* We always get an MSS option. @@ -1418,7 +1406,7 @@ * be a multiple of mss if possible. We assume here that mss >= 1. * This MUST be enforced by all callers. */ -extern __inline__ void tcp_select_initial_window(int space, __u32 mss, +static inline void tcp_select_initial_window(int space, __u32 mss, __u32 *rcv_wnd, __u32 *window_clamp, int wscale_ok, @@ -1477,32 +1465,32 @@ } /* Note: caller must be prepared to deal with negative returns */ -extern __inline__ int tcp_space(struct sock *sk) +static inline int tcp_space(struct sock *sk) { return tcp_win_from_space(sk->rcvbuf - atomic_read(&sk->rmem_alloc)); } -extern __inline__ int tcp_full_space( struct sock *sk) +static inline int tcp_full_space( struct sock *sk) { return tcp_win_from_space(sk->rcvbuf); } -extern __inline__ void tcp_acceptq_removed(struct sock *sk) +static inline void tcp_acceptq_removed(struct sock *sk) { sk->ack_backlog--; } -extern __inline__ void tcp_acceptq_added(struct sock *sk) +static inline void tcp_acceptq_added(struct sock *sk) { sk->ack_backlog++; } -extern __inline__ int tcp_acceptq_is_full(struct sock *sk) +static inline int tcp_acceptq_is_full(struct sock *sk) { return sk->ack_backlog > sk->max_ack_backlog; } -extern __inline__ void tcp_acceptq_queue(struct sock *sk, struct open_request *req, +static inline void tcp_acceptq_queue(struct sock *sk, struct open_request *req, struct sock *child) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; @@ -1528,7 +1516,7 @@ struct open_request *syn_table[TCP_SYNQ_HSIZE]; }; -extern __inline__ void +static inline void tcp_synq_removed(struct sock *sk, struct open_request *req) { struct tcp_listen_opt *lopt = sk->tp_pinfo.af_tcp.listen_opt; @@ -1539,7 +1527,7 @@ lopt->qlen_young--; } -extern __inline__ void tcp_synq_added(struct sock *sk) +static inline void tcp_synq_added(struct sock *sk) { struct tcp_listen_opt *lopt = sk->tp_pinfo.af_tcp.listen_opt; @@ -1548,22 +1536,22 @@ lopt->qlen_young++; } -extern __inline__ int tcp_synq_len(struct sock *sk) +static inline int tcp_synq_len(struct sock *sk) { return sk->tp_pinfo.af_tcp.listen_opt->qlen; } -extern __inline__ int tcp_synq_young(struct sock *sk) +static inline int tcp_synq_young(struct sock *sk) { return sk->tp_pinfo.af_tcp.listen_opt->qlen_young; } -extern __inline__ int tcp_synq_is_full(struct sock *sk) +static inline int tcp_synq_is_full(struct sock *sk) { return tcp_synq_len(sk)>>sk->tp_pinfo.af_tcp.listen_opt->max_qlen_log; } -extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req, +static inline void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req, struct open_request **prev) { write_lock(&tp->syn_wait_lock); @@ -1571,7 +1559,7 @@ write_unlock(&tp->syn_wait_lock); } -extern __inline__ void tcp_synq_drop(struct sock *sk, struct open_request *req, +static inline void tcp_synq_drop(struct sock *sk, struct open_request *req, struct open_request **prev) { tcp_synq_unlink(&sk->tp_pinfo.af_tcp, req, prev); @@ -1679,7 +1667,7 @@ * use plain read_(un)lock(&tcp_lhash_lock). */ -extern __inline__ void tcp_listen_lock(void) +static inline void tcp_listen_lock(void) { /* read_lock synchronizes to candidates to writers */ read_lock(&tcp_lhash_lock); @@ -1687,7 +1675,7 @@ read_unlock(&tcp_lhash_lock); } -extern __inline__ void tcp_listen_unlock(void) +static inline void tcp_listen_unlock(void) { if (atomic_dec_and_test(&tcp_lhash_users)) wake_up(&tcp_lhash_wait); diff -u --recursive --new-file v2.4.0-test8/linux/include/net/x25.h linux/include/net/x25.h --- v2.4.0-test8/linux/include/net/x25.h Fri Apr 14 09:37:20 2000 +++ linux/include/net/x25.h Sun Sep 17 10:03:43 2000 @@ -188,7 +188,7 @@ extern void x25_link_free(void); /* x25_out.c */ -extern void x25_output(struct sock *, struct sk_buff *); +extern int x25_output(struct sock *, struct sk_buff *); extern void x25_kick(struct sock *); extern void x25_enquiry_response(struct sock *); diff -u --recursive --new-file v2.4.0-test8/linux/include/pcmcia/ss.h linux/include/pcmcia/ss.h --- v2.4.0-test8/linux/include/pcmcia/ss.h Sat Sep 2 00:13:49 2000 +++ linux/include/pcmcia/ss.h Fri Sep 15 16:31:09 2000 @@ -82,6 +82,7 @@ #define SS_DMA_MODE 0x0080 #define SS_SPKR_ENA 0x0100 #define SS_OUTPUT_ENA 0x0200 +#define SS_DEBOUNCED 0x0400 /* Tell driver that the debounce delay has ended */ /* Flags for I/O port and memory windows */ #define MAP_ACTIVE 0x01 diff -u --recursive --new-file v2.4.0-test8/linux/ipc/shm.c linux/ipc/shm.c --- v2.4.0-test8/linux/ipc/shm.c Thu Sep 7 08:34:28 2000 +++ linux/ipc/shm.c Fri Sep 15 16:51:21 2000 @@ -1522,7 +1522,7 @@ } /* - * Goes through counter = (shm_rss / (prio + 1)) present shm pages. + * Goes through counter = (shm_rss >> prio) present shm pages. */ static unsigned long swap_id; /* currently being swapped */ static unsigned long swap_idx; /* next to swap */ @@ -1537,7 +1537,7 @@ struct page * page_map; zshm_swap(prio, gfp_mask); - counter = shm_rss / (prio + 1); + counter = shm_rss >> prio; if (!counter) return 0; if (shm_swap_preop(&swap_entry)) @@ -1863,7 +1863,7 @@ int counter; struct page * page_map; - counter = zshm_rss / (prio + 1); + counter = zshm_rss >> prio; if (!counter) return; next: diff -u --recursive --new-file v2.4.0-test8/linux/kernel/exit.c linux/kernel/exit.c --- v2.4.0-test8/linux/kernel/exit.c Fri Sep 1 18:08:46 2000 +++ linux/kernel/exit.c Sun Sep 17 09:51:57 2000 @@ -229,6 +229,7 @@ { __exit_files(tsk); } + static inline void __put_fs_struct(struct fs_struct *fs) { /* No need to hold fs->lock if we are killing it */ diff -u --recursive --new-file v2.4.0-test8/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v2.4.0-test8/linux/kernel/ksyms.c Tue Sep 5 18:56:47 2000 +++ linux/kernel/ksyms.c Sun Sep 17 09:45:05 2000 @@ -361,8 +361,6 @@ #if !defined(CONFIG_ARCH_S390) EXPORT_SYMBOL(probe_irq_on); EXPORT_SYMBOL(probe_irq_off); -EXPORT_SYMBOL(autoirq_setup); -EXPORT_SYMBOL(autoirq_report); #endif #ifdef CONFIG_SMP diff -u --recursive --new-file v2.4.0-test8/linux/kernel/signal.c linux/kernel/signal.c --- v2.4.0-test8/linux/kernel/signal.c Tue Sep 5 09:53:59 2000 +++ linux/kernel/signal.c Mon Sep 11 08:41:08 2000 @@ -41,7 +41,7 @@ __alignof__(struct sigqueue), SIG_SLAB_DEBUG, NULL, NULL); if (!sigqueue_cachep) - panic("signals_init(): cannot create sigueue SLAB cache"); + panic("signals_init(): cannot create sigqueue SLAB cache"); } diff -u --recursive --new-file v2.4.0-test8/linux/kernel/sys.c linux/kernel/sys.c --- v2.4.0-test8/linux/kernel/sys.c Wed Aug 9 18:59:17 2000 +++ linux/kernel/sys.c Mon Sep 11 08:48:53 2000 @@ -123,18 +123,15 @@ int ret=NOTIFY_DONE; struct notifier_block *nb = *n; - read_lock(¬ifier_lock); while(nb) { ret=nb->notifier_call(nb,val,v); if(ret&NOTIFY_STOP_MASK) { - read_unlock(¬ifier_lock); return ret; } nb=nb->next; } - read_unlock(¬ifier_lock); return ret; } diff -u --recursive --new-file v2.4.0-test8/linux/kernel/sysctl.c linux/kernel/sysctl.c --- v2.4.0-test8/linux/kernel/sysctl.c Mon Jul 31 19:36:11 2000 +++ linux/kernel/sysctl.c Fri Sep 15 16:51:21 2000 @@ -235,7 +235,7 @@ static ctl_table vm_table[] = { {VM_FREEPG, "freepages", - &freepages, sizeof(freepages_t), 0644, NULL, &proc_dointvec}, + &freepages, sizeof(freepages_t), 0444, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, diff -u --recursive --new-file v2.4.0-test8/linux/mm/filemap.c linux/mm/filemap.c --- v2.4.0-test8/linux/mm/filemap.c Fri Sep 8 12:37:34 2000 +++ linux/mm/filemap.c Fri Sep 15 16:51:21 2000 @@ -46,7 +46,7 @@ struct page **page_hash_table; struct list_head lru_cache; -static spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED; +spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED; /* * NOTE: to avoid deadlocking you must never acquire the pagecache_lock with * the pagemap_lru_lock held. @@ -92,7 +92,7 @@ * sure the page is locked and that nobody else uses it - or that usage * is safe. */ -static inline void __remove_inode_page(struct page *page) +void __remove_inode_page(struct page *page) { remove_page_from_inode_queue(page); remove_page_from_hash_queue(page); @@ -235,141 +235,6 @@ spin_unlock(&pagecache_lock); } -/* - * nr_dirty represents the number of dirty pages that we will write async - * before doing sync writes. We can only do sync writes if we can - * wait for IO (__GFP_IO set). - */ -int shrink_mmap(int priority, int gfp_mask) -{ - int ret = 0, count, nr_dirty; - struct list_head * page_lru; - struct page * page = NULL; - - count = nr_lru_pages / (priority + 1); - nr_dirty = priority; - - /* we need pagemap_lru_lock for list_del() ... subtle code below */ - spin_lock(&pagemap_lru_lock); - while (count > 0 && (page_lru = lru_cache.prev) != &lru_cache) { - page = list_entry(page_lru, struct page, lru); - list_del(page_lru); - - if (PageTestandClearReferenced(page)) - goto dispose_continue; - - count--; - /* - * Avoid unscalable SMP locking for pages we can - * immediate tell are untouchable.. - */ - if (!page->buffers && page_count(page) > 1) - goto dispose_continue; - - if (TryLockPage(page)) - goto dispose_continue; - - /* Release the pagemap_lru lock even if the page is not yet - queued in any lru queue since we have just locked down - the page so nobody else may SMP race with us running - a lru_cache_del() (lru_cache_del() always run with the - page locked down ;). */ - spin_unlock(&pagemap_lru_lock); - - /* avoid freeing the page while it's locked */ - page_cache_get(page); - - /* - * Is it a buffer page? Try to clean it up regardless - * of zone - it's old. - */ - if (page->buffers) { - int wait; - /* - * 0 - free it if can do so without IO - * 1 - start write-out of dirty buffers - * 2 - wait for locked buffers - */ - wait = (gfp_mask & __GFP_IO) ? (nr_dirty-- < 0) ? 2 : 1 : 0; - if (!try_to_free_buffers(page, wait)) - goto unlock_continue; - /* page was locked, inode can't go away under us */ - if (!page->mapping) { - atomic_dec(&buffermem_pages); - goto made_buffer_progress; - } - } - - /* Take the pagecache_lock spinlock held to avoid - other tasks to notice the page while we are looking at its - page count. If it's a pagecache-page we'll free it - in one atomic transaction after checking its page count. */ - spin_lock(&pagecache_lock); - - /* - * We can't free pages unless there's just one user - * (count == 2 because we added one ourselves above). - */ - if (page_count(page) != 2) - goto cache_unlock_continue; - - /* - * Is it a page swap page? If so, we want to - * drop it if it is no longer used, even if it - * were to be marked referenced.. - */ - if (PageSwapCache(page)) { - spin_unlock(&pagecache_lock); - __delete_from_swap_cache(page); - goto made_inode_progress; - } - - /* - * Page is from a zone we don't care about. - * Don't drop page cache entries in vain. - */ - if (page->zone->free_pages > page->zone->pages_high) - goto cache_unlock_continue; - - /* is it a page-cache page? */ - if (page->mapping) { - if (!PageDirty(page) && !pgcache_under_min()) { - __remove_inode_page(page); - spin_unlock(&pagecache_lock); - goto made_inode_progress; - } - goto cache_unlock_continue; - } - - printk(KERN_ERR "shrink_mmap: unknown LRU page!\n"); - -cache_unlock_continue: - spin_unlock(&pagecache_lock); -unlock_continue: - spin_lock(&pagemap_lru_lock); - UnlockPage(page); - page_cache_release(page); -dispose_continue: - list_add(page_lru, &lru_cache); - } - goto out; - -made_inode_progress: - page_cache_release(page); -made_buffer_progress: - UnlockPage(page); - page_cache_release(page); - ret = 1; - spin_lock(&pagemap_lru_lock); - /* nr_lru_pages needs the spinlock */ - nr_lru_pages--; - -out: - spin_unlock(&pagemap_lru_lock); - - return ret; -} - static inline struct page * __find_page_nolock(struct address_space *mapping, unsigned long offset, struct page *page) { goto inside; @@ -384,7 +249,14 @@ if (page->index == offset) break; } - SetPageReferenced(page); + /* + * Touching the page may move it to the active list. + * If we end up with too few inactive pages, we wake + * up kswapd. + */ + age_page_up(page); + if (inactive_shortage() > (inactive_target * 3) / 4) + wakeup_kswapd(0); not_found: return page; } @@ -616,6 +488,7 @@ set_task_state(tsk, TASK_UNINTERRUPTIBLE); if (!PageLocked(page)) break; + run_task_queue(&tq_disk); schedule(); } while (PageLocked(page)); tsk->state = TASK_RUNNING; @@ -739,6 +612,53 @@ #endif /* + * We combine this with read-ahead to deactivate pages when we + * think there's sequential IO going on. Note that this is + * harmless since we don't actually evict the pages from memory + * but just move them to the inactive list. + * + * TODO: + * - make the readahead code smarter + * - move readahead to the VMA level so we can do the same + * trick with mmap() + * + * Rik van Riel, 2000 + */ +static void drop_behind(struct file * file, unsigned long index) +{ + struct inode *inode = file->f_dentry->d_inode; + struct address_space *mapping = inode->i_mapping; + struct page **hash; + struct page *page; + unsigned long start; + + /* Nothing to drop-behind if we're on the first page. */ + if (!index) + return; + + if (index > file->f_rawin) + start = index - file->f_rawin; + else + start = 0; + + /* + * Go backwards from index-1 and drop all pages in the + * readahead window. Since the readahead window may have + * been increased since the last time we were called, we + * stop when the page isn't there. + */ + spin_lock(&pagecache_lock); + while (--index >= start) { + hash = page_hash(mapping, index); + page = __find_page_nolock(mapping, index, *hash); + if (!page) + break; + deactivate_page(page); + } + spin_unlock(&pagecache_lock); +} + +/* * Read-ahead profiling information * -------------------------------- * Every PROFILE_MAXREADCOUNT, the following information is written @@ -961,6 +881,12 @@ if (filp->f_ramax > max_readahead) filp->f_ramax = max_readahead; + /* + * Move the pages that have already been passed + * to the inactive list. + */ + drop_behind(filp, index); + #ifdef PROFILE_READAHEAD profile_readahead((reada_ok == 2), filp); #endif @@ -2527,6 +2453,7 @@ unlock: /* Mark it unlocked again and drop the page.. */ UnlockPage(page); + deactivate_page(page); page_cache_release(page); if (status < 0) diff -u --recursive --new-file v2.4.0-test8/linux/mm/memory.c linux/mm/memory.c --- v2.4.0-test8/linux/mm/memory.c Fri Sep 1 13:51:10 2000 +++ linux/mm/memory.c Fri Sep 15 16:51:21 2000 @@ -67,7 +67,7 @@ copy_user_highpage(to, from, address); } -mem_map_t * mem_map = NULL; +mem_map_t * mem_map; /* * Note: this doesn't free the actual pages themselves. That @@ -1040,7 +1040,8 @@ num = valid_swaphandles(entry, &offset); for (i = 0; i < num; offset++, i++) { /* Don't block on I/O for read-ahead */ - if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster) { + if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster + * (1 << page_cluster)) { while (i++ < num) swap_free(SWP_ENTRY(SWP_TYPE(entry), offset++)); break; @@ -1239,7 +1240,7 @@ pgd = pgd_offset(mm, address); pmd = pmd_alloc(pgd, address); - + if (pmd) { pte_t * pte = pte_alloc(pmd, address); if (pte) diff -u --recursive --new-file v2.4.0-test8/linux/mm/page_alloc.c linux/mm/page_alloc.c --- v2.4.0-test8/linux/mm/page_alloc.c Thu Sep 7 08:44:50 2000 +++ linux/mm/page_alloc.c Fri Sep 15 16:51:21 2000 @@ -25,7 +25,8 @@ #endif int nr_swap_pages; -int nr_lru_pages; +int nr_active_pages; +int nr_inactive_dirty_pages; pg_data_t *pgdat_list; static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" }; @@ -33,6 +34,8 @@ static int zone_balance_min[MAX_NR_ZONES] = { 10 , 10, 10, }; static int zone_balance_max[MAX_NR_ZONES] = { 255 , 255, 255, }; +struct list_head active_list; +struct list_head inactive_dirty_list; /* * Free_page() adds the page to the free lists. This is optimized for * fast normal cases (no error jumps taken normally). @@ -96,7 +99,16 @@ BUG(); if (PageDirty(page)) BUG(); + if (PageActive(page)) + BUG(); + if (PageInactiveDirty(page)) + BUG(); + if (PageInactiveClean(page)) + BUG(); + page->flags &= ~(1<age = PAGE_AGE_START; + zone = page->zone; mask = (~0UL) << order; @@ -142,10 +154,13 @@ spin_unlock_irqrestore(&zone->lock, flags); - if (zone->free_pages > zone->pages_high) { - zone->zone_wake_kswapd = 0; - zone->low_on_memory = 0; - } + /* + * We don't want to protect this variable from race conditions + * since it's nothing important, but we do want to make sure + * it never gets negative. + */ + if (memory_pressure > NR_CPUS) + memory_pressure--; } #define MARK_USED(index, order, area) \ @@ -203,6 +218,7 @@ set_page_count(page, 1); if (BAD_RANGE(zone,page)) BUG(); + DEBUG_ADD_PAGE return page; } curr_order++; @@ -213,13 +229,77 @@ return NULL; } +#define PAGES_MIN 0 +#define PAGES_LOW 1 +#define PAGES_HIGH 2 + +/* + * This function does the dirty work for __alloc_pages + * and is separated out to keep the code size smaller. + * (suggested by Davem at 1:30 AM, typed by Rik at 6 AM) + */ +static struct page * __alloc_pages_limit(zonelist_t *zonelist, + unsigned long order, int limit, int direct_reclaim) +{ + zone_t **zone = zonelist->zones; + + for (;;) { + zone_t *z = *(zone++); + unsigned long water_mark; + + if (!z) + break; + if (!z->size) + BUG(); + + /* + * We allocate if the number of free + inactive_clean + * pages is above the watermark. + */ + switch (limit) { + default: + case 0: + water_mark = z->pages_min; + break; + case 1: + water_mark = z->pages_low; + break; + case 2: + water_mark = z->pages_high; + } + + if (z->free_pages + z->inactive_clean_pages > water_mark) { + struct page *page = NULL; + /* If possible, reclaim a page directly. */ + if (direct_reclaim && z->free_pages < z->pages_min + 8) + page = reclaim_page(z); + /* If that fails, fall back to rmqueue. */ + if (!page) + page = rmqueue(z, order); + if (page) + return page; + } + } + + /* Found nothing. */ + return NULL; +} + + /* * This is the 'heart' of the zoned buddy allocator: */ struct page * __alloc_pages(zonelist_t *zonelist, unsigned long order) { zone_t **zone; - extern wait_queue_head_t kswapd_wait; + int direct_reclaim = 0; + unsigned int gfp_mask = zonelist->gfp_mask; + struct page * page = NULL; + + /* + * Allocations put pressure on the VM subsystem. + */ + memory_pressure++; /* * (If anyone calls gfp from interrupts nonatomically then it @@ -229,6 +309,27 @@ * in a higher zone fails. */ + /* + * Can we take pages directly from the inactive_clean + * list? + */ + if (order == 0 && (gfp_mask & __GFP_WAIT) && + !(current->flags & PF_MEMALLOC)) + direct_reclaim = 1; + + /* + * Are we low on inactive pages? + */ + if (inactive_shortage() > inactive_target / 2 && free_shortage()) + wakeup_kswapd(0); + +try_again: + /* + * First, see if we have any zones with lots of free memory. + * + * We allocate free memory first because it doesn't contain + * any data ... DUH! + */ zone = zonelist->zones; for (;;) { zone_t *z = *(zone++); @@ -237,82 +338,143 @@ if (!z->size) BUG(); - /* Are we supposed to free memory? Don't make it worse.. */ - if (!z->zone_wake_kswapd) { - struct page *page = rmqueue(z, order); - if (z->free_pages < z->pages_low) { - z->zone_wake_kswapd = 1; - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); - } + if (z->free_pages > z->pages_low) { + page = rmqueue(z, order); if (page) return page; + } else if (z->free_pages < z->pages_min && + waitqueue_active(&kreclaimd_wait)) { + wake_up_interruptible(&kreclaimd_wait); } } - /* Three possibilities to get here - * - Previous alloc_pages resulted in last zone set to have - * zone_wake_kswapd and start it. kswapd has not been able - * to release enough pages so that one zone does not have - * zone_wake_kswapd set. - * - Different sets of zones (zonelist) - * previous did not have all zones with zone_wake_kswapd but - * this one has... should kswapd be woken up? it will run once. - * - SMP race, kswapd went to sleep slightly after it as running - * in 'if (waitqueue_active(...))' above. - * + anyway the test is very cheap to do... + /* + * Try to allocate a page from a zone with a HIGH + * amount of free + inactive_clean pages. + * + * If there is a lot of activity, inactive_target + * will be high and we'll have a good chance of + * finding a page using the HIGH limit. */ - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); + page = __alloc_pages_limit(zonelist, order, PAGES_HIGH, direct_reclaim); + if (page) + return page; /* - * Ok, we don't have any zones that don't need some - * balancing.. See if we have any that aren't critical.. + * Then try to allocate a page from a zone with more + * than zone->pages_low free + inactive_clean pages. + * + * When the working set is very large and VM activity + * is low, we're most likely to have our allocation + * succeed here. */ - zone = zonelist->zones; - for (;;) { - zone_t *z = *(zone++); - if (!z) - break; - if (!z->low_on_memory) { - struct page *page = rmqueue(z, order); - if (z->free_pages < z->pages_min) - z->low_on_memory = 1; - if (page) - return page; - } - } + page = __alloc_pages_limit(zonelist, order, PAGES_LOW, direct_reclaim); + if (page) + return page; + + /* + * OK, none of the zones on our zonelist has lots + * of pages free. + * + * We wake up kswapd, in the hope that kswapd will + * resolve this situation before memory gets tight. + */ + wakeup_kswapd(0); /* - * Uhhuh. All the zones have been critical, which means that - * we'd better do some synchronous swap-out. kswapd has not - * been able to cope.. + * After waking up kswapd, we try to allocate a page + * from any zone which isn't critical yet. + * + * Kswapd should, in most situations, bring the situation + * back to normal in no time. + */ + page = __alloc_pages_limit(zonelist, order, PAGES_MIN, direct_reclaim); + if (page) + return page; + + /* + * Damn, we didn't succeed. + * + * This can be due to 2 reasons: + * - we're doing a higher-order allocation + * --> move pages to the free list until we succeed + * - we're /really/ tight on memory + * --> wait on the kswapd waitqueue until memory is freed */ if (!(current->flags & PF_MEMALLOC)) { - int gfp_mask = zonelist->gfp_mask; - if (!try_to_free_pages(gfp_mask)) { - if (!(gfp_mask & __GFP_HIGH)) - goto fail; + /* + * Are we dealing with a higher order allocation? + * + * Move pages from the inactive_clean to the free list + * in the hope of creating a large, physically contiguous + * piece of free memory. + */ + if (order > 0 && (gfp_mask & __GFP_WAIT)) { + zone = zonelist->zones; + /* First, clean some dirty pages. */ + page_launder(gfp_mask, 1); + for (;;) { + zone_t *z = *(zone++); + if (!z) + break; + if (!z->size) + continue; + while (z->inactive_clean_pages) { + struct page * page; + /* Move one page to the free list. */ + page = reclaim_page(z); + if (!page) + break; + __free_page(page); + /* Try if the allocation succeeds. */ + page = rmqueue(z, order); + if (page) + return page; + } + } + } + /* + * When we arrive here, we are really tight on memory. + * + * We wake up kswapd and sleep until kswapd wakes us + * up again. After that we loop back to the start. + * + * We have to do this because something else might eat + * the memory kswapd frees for us (interrupts, other + * processes, etc). + */ + if (gfp_mask & __GFP_WAIT) { + wakeup_kswapd(1); + goto try_again; } } /* * Final phase: allocate anything we can! + * + * This is basically reserved for PF_MEMALLOC and + * GFP_ATOMIC allocations... */ zone = zonelist->zones; for (;;) { - struct page *page; - zone_t *z = *(zone++); + struct page * page = NULL; if (!z) break; - page = rmqueue(z, order); + if (!z->size) + BUG(); + + if (direct_reclaim) + page = reclaim_page(z); + if (!page) + page = rmqueue(z, order); if (page) return page; } -fail: /* No luck.. */ + if (!order) + show_free_areas(); return NULL; } @@ -377,18 +539,39 @@ } /* - * Amount of free RAM allocatable as buffer memory: + * Total amount of inactive_clean (allocatable) RAM: */ -unsigned int nr_free_buffer_pages (void) +unsigned int nr_inactive_clean_pages (void) { unsigned int sum; zone_t *zone; int i; - sum = nr_lru_pages / 3; + sum = 0; for (i = 0; i < NUMNODES; i++) - for (zone = NODE_DATA(i)->node_zones; zone <= NODE_DATA(i)->node_zones+ZONE_NORMAL; zone++) - sum += zone->free_pages; + for (zone = NODE_DATA(i)->node_zones; zone < NODE_DATA(i)->node_zones + MAX_NR_ZONES; zone++) + sum += zone->inactive_clean_pages; + return sum; +} + +/* + * Amount of free RAM allocatable as buffer memory: + */ +unsigned int nr_free_buffer_pages (void) +{ + unsigned int sum; + + sum = nr_free_pages(); + sum += nr_inactive_clean_pages(); + sum += nr_inactive_dirty_pages; + /* + * We don't want dirty page writebehind to put too + * much pressure on the working set, but we want it + * to be possible to have some dirty pages in the + * working set without upsetting the writebehind logic. + */ + sum += nr_active_pages >> 4; + return sum; } @@ -418,9 +601,11 @@ nr_free_pages() << (PAGE_SHIFT-10), nr_free_highpages() << (PAGE_SHIFT-10)); - printk("( Free: %d, lru_cache: %d (%d %d %d) )\n", + printk("( Active: %d, inactive_dirty: %d, inactive_clean: %d, free: %d (%d %d %d) )\n", + nr_active_pages, + nr_inactive_dirty_pages, + nr_inactive_clean_pages(), nr_free_pages(), - nr_lru_pages, freepages.min, freepages.low, freepages.high); @@ -430,17 +615,6 @@ zone_t *zone = NODE_DATA(nid)->node_zones + type; unsigned long nr, total, flags; - printk(" %c%d%d %s: ", - (zone->free_pages > zone->pages_low - ? (zone->free_pages > zone->pages_high - ? ' ' - : 'H') - : (zone->free_pages > zone->pages_min - ? 'M' - : 'L')), - zone->zone_wake_kswapd, zone->low_on_memory, - zone->name); - total = 0; if (zone->size) { spin_lock_irqsave(&zone->lock, flags); @@ -570,7 +744,8 @@ freepages.min += i; freepages.low += i * 2; freepages.high += i * 3; - memlist_init(&lru_cache); + memlist_init(&active_list); + memlist_init(&inactive_dirty_list); /* * Some architectures (with lots of mem and discontinous memory @@ -618,6 +793,9 @@ zone->lock = SPIN_LOCK_UNLOCKED; zone->zone_pgdat = pgdat; zone->free_pages = 0; + zone->inactive_clean_pages = 0; + zone->inactive_dirty_pages = 0; + memlist_init(&zone->inactive_clean_list); if (!size) continue; @@ -631,8 +809,6 @@ zone->pages_min = mask; zone->pages_low = mask*2; zone->pages_high = mask*3; - zone->low_on_memory = 0; - zone->zone_wake_kswapd = 0; zone->zone_mem_map = mem_map + offset; zone->zone_start_mapnr = offset; zone->zone_start_paddr = zone_start_paddr; diff -u --recursive --new-file v2.4.0-test8/linux/mm/page_io.c linux/mm/page_io.c --- v2.4.0-test8/linux/mm/page_io.c Mon Aug 7 21:01:36 2000 +++ linux/mm/page_io.c Fri Sep 15 16:51:21 2000 @@ -43,7 +43,8 @@ struct inode *swapf = 0; /* Don't allow too many pending pages in flight.. */ - if (atomic_read(&nr_async_pages) > pager_daemon.swap_cluster) + if ((rw == WRITE) && atomic_read(&nr_async_pages) > + pager_daemon.swap_cluster * (1 << page_cluster)) wait = 1; if (rw == READ) { diff -u --recursive --new-file v2.4.0-test8/linux/mm/slab.c linux/mm/slab.c --- v2.4.0-test8/linux/mm/slab.c Fri Aug 11 15:04:54 2000 +++ linux/mm/slab.c Sun Sep 17 09:56:03 2000 @@ -1772,14 +1772,6 @@ /* It's safe to test this without holding the cache-lock. */ if (searchp->flags & SLAB_NO_REAP) goto next; - /* FIXME: is this really a good idea? */ - if (gfp_mask & GFP_DMA) { - if (!(searchp->gfpflags & GFP_DMA)) - goto next; - } else { - if (searchp->gfpflags & GFP_DMA) - goto next; - } spin_lock_irq(&searchp->spinlock); if (searchp->growing) goto next_unlock; diff -u --recursive --new-file v2.4.0-test8/linux/mm/swap.c linux/mm/swap.c --- v2.4.0-test8/linux/mm/swap.c Mon Dec 6 10:14:13 1999 +++ linux/mm/swap.c Sun Sep 17 09:56:02 2000 @@ -40,7 +40,18 @@ }; /* How many pages do we try to swap or page in/out together? */ -int page_cluster = 4; /* Default value modified in swap_setup() */ +int page_cluster; + +/* + * This variable contains the amount of page steals the system + * is doing, averaged over a minute. We use this to determine how + * many inactive pages we should have. + * + * In reclaim_page and __alloc_pages: memory_pressure++ + * In __free_pages_ok: memory_pressure-- + * In recalculate_vm_stats the value is decayed (once a second) + */ +int memory_pressure; /* We track the number of pages currently being asynchronously swapped out, so that we don't try to swap TOO many pages out at once */ @@ -61,13 +72,244 @@ pager_daemon_t pager_daemon = { 512, /* base number for calculating the number of tries */ SWAP_CLUSTER_MAX, /* minimum number of tries */ - SWAP_CLUSTER_MAX, /* do swap I/O in clusters of this size */ + 8, /* do swap I/O in clusters of this size */ }; +/** + * age_page_{up,down} - page aging helper functions + * @page - the page we want to age + * @nolock - are we already holding the pagelist_lru_lock? + * + * If the page is on one of the lists (active, inactive_dirty or + * inactive_clean), we will grab the pagelist_lru_lock as needed. + * If you're already holding the lock, call this function with the + * nolock argument non-zero. + */ +void age_page_up_nolock(struct page * page) +{ + /* + * We're dealing with an inactive page, move the page + * to the active list. + */ + if (!page->age) + activate_page_nolock(page); + + /* The actual page aging bit */ + page->age += PAGE_AGE_ADV; + if (page->age > PAGE_AGE_MAX) + page->age = PAGE_AGE_MAX; +} + +void age_page_down_nolock(struct page * page) +{ + /* The actual page aging bit */ + page->age /= 2; + + /* + * The page is now an old page. Move to the inactive + * list (if possible ... see below). + */ + if (!page->age) + deactivate_page_nolock(page); +} + +void age_page_up(struct page * page) +{ + /* + * We're dealing with an inactive page, move the page + * to the active list. + */ + if (!page->age) + activate_page(page); + + /* The actual page aging bit */ + page->age += PAGE_AGE_ADV; + if (page->age > PAGE_AGE_MAX) + page->age = PAGE_AGE_MAX; +} + +void age_page_down(struct page * page) +{ + /* The actual page aging bit */ + page->age /= 2; + + /* + * The page is now an old page. Move to the inactive + * list (if possible ... see below). + */ + if (!page->age) + deactivate_page(page); +} + + +/** + * (de)activate_page - move pages from/to active and inactive lists + * @page: the page we want to move + * @nolock - are we already holding the pagemap_lru_lock? + * + * Deactivate_page will move an active page to the right + * inactive list, while activate_page will move a page back + * from one of the inactive lists to the active list. If + * called on a page which is not on any of the lists, the + * page is left alone. + */ +void deactivate_page_nolock(struct page * page) +{ + page->age = 0; + + /* + * Don't touch it if it's not on the active list. + * (some pages aren't on any list at all) + */ + if (PageActive(page) && (page_count(page) <= 2 || page->buffers) && + !page_ramdisk(page)) { + + /* + * We can move the page to the inactive_dirty list + * if we know there is backing store available. + * + * We also move pages here that we cannot free yet, + * but may be able to free later - because most likely + * we're holding an extra reference on the page which + * will be dropped right after deactivate_page(). + */ + if (page->buffers || page_count(page) == 2) { + del_page_from_active_list(page); + add_page_to_inactive_dirty_list(page); + /* + * If the page is clean and immediately reusable, + * we can move it to the inactive_clean list. + */ + } else if (page->mapping && !PageDirty(page) && + !PageLocked(page)) { + del_page_from_active_list(page); + add_page_to_inactive_clean_list(page); + } + /* + * OK, we cannot free the page. Leave it alone. + */ + } +} + +void deactivate_page(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + deactivate_page_nolock(page); + spin_unlock(&pagemap_lru_lock); +} + /* - * Perform any setup for the swap system + * Move an inactive page to the active list. + */ +void activate_page_nolock(struct page * page) +{ + if (PageInactiveDirty(page)) { + del_page_from_inactive_dirty_list(page); + add_page_to_active_list(page); + } else if (PageInactiveClean(page)) { + del_page_from_inactive_clean_list(page); + add_page_to_active_list(page); + } else { + /* + * The page was not on any list, so we take care + * not to do anything. + */ + } +} + +void activate_page(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + activate_page_nolock(page); + spin_unlock(&pagemap_lru_lock); +} + +/** + * lru_cache_add: add a page to the page lists + * @page: the page to add + */ +void lru_cache_add(struct page * page) +{ + spin_lock(&pagemap_lru_lock); + if (!PageLocked(page)) + BUG(); + /* + * Heisenbug Compensator(tm) + * This bug shouldn't trigger, but for unknown reasons it + * sometimes does. If there are no signs of list corruption, + * we ignore the problem. Else we BUG()... + */ + if (PageActive(page) || PageInactiveDirty(page) || + PageInactiveClean(page)) { + struct list_head * page_lru = &page->lru; + if (page_lru->next->prev != page_lru) { + printk("VM: lru_cache_add, bit or list corruption..\n"); + BUG(); + } + printk("VM: lru_cache_add, page already in list!\n"); + goto page_already_on_list; + } + add_page_to_active_list(page); + /* This should be relatively rare */ + if (!page->age) + deactivate_page_nolock(page); +page_already_on_list: + spin_unlock(&pagemap_lru_lock); +} + +/** + * __lru_cache_del: remove a page from the page lists + * @page: the page to add + * + * This function is for when the caller already holds + * the pagemap_lru_lock. */ +void __lru_cache_del(struct page * page) +{ + if (PageActive(page)) { + del_page_from_active_list(page); + } else if (PageInactiveDirty(page)) { + del_page_from_inactive_dirty_list(page); + } else if (PageInactiveClean(page)) { + del_page_from_inactive_clean_list(page); + } else { + printk("VM: __lru_cache_del, found unknown page ?!\n"); + } + DEBUG_ADD_PAGE +} +/** + * lru_cache_del: remove a page from the page lists + * @page: the page to remove + */ +void lru_cache_del(struct page * page) +{ + if (!PageLocked(page)) + BUG(); + spin_lock(&pagemap_lru_lock); + __lru_cache_del(page); + spin_unlock(&pagemap_lru_lock); +} + +/** + * recalculate_vm_stats - recalculate VM statistics + * + * This function should be called once a second to recalculate + * some useful statistics the VM subsystem uses to determine + * its behaviour. + */ +void recalculate_vm_stats(void) +{ + /* + * Substract one second worth of memory_pressure from + * memory_pressure. + */ + memory_pressure -= (memory_pressure >> INACTIVE_SHIFT); +} + +/* + * Perform any setup for the swap system + */ void __init swap_setup(void) { /* Use a smaller cluster for memory <16MB or <32MB */ diff -u --recursive --new-file v2.4.0-test8/linux/mm/swap_state.c linux/mm/swap_state.c --- v2.4.0-test8/linux/mm/swap_state.c Mon Aug 7 21:01:36 2000 +++ linux/mm/swap_state.c Fri Sep 15 16:51:21 2000 @@ -73,7 +73,7 @@ PAGE_BUG(page); PageClearSwapCache(page); - remove_inode_page(page); + __remove_inode_page(page); } /* @@ -105,7 +105,9 @@ if (block_flushpage(page, 0)) lru_cache_del(page); + spin_lock(&pagecache_lock); __delete_from_swap_cache(page); + spin_unlock(&pagecache_lock); page_cache_release(page); } diff -u --recursive --new-file v2.4.0-test8/linux/mm/vmscan.c linux/mm/vmscan.c --- v2.4.0-test8/linux/mm/vmscan.c Fri Sep 1 14:25:26 2000 +++ linux/mm/vmscan.c Sun Sep 17 09:56:02 2000 @@ -9,6 +9,7 @@ * to bring the system back to freepages.high: 2.4.97, Rik van Riel. * Version: $Id: vmscan.c,v 1.5 1998/02/23 22:14:28 sct Exp $ * Zone aware kswapd started 02/00, Kanoj Sarcar (kanoj@sgi.com). + * Multiqueue VM started 5.8.00, Rik van Riel. */ #include @@ -40,6 +41,7 @@ swp_entry_t entry; struct page * page; int (*swapout)(struct page *, struct file *); + int onlist; pte = *page_table; if (!pte_present(pte)) @@ -51,16 +53,36 @@ if (mm->swap_cnt) mm->swap_cnt--; + onlist = PageActive(page); /* Don't look at this pte if it's been accessed recently. */ if (pte_young(pte)) { - /* - * Transfer the "accessed" bit from the page - * tables to the global page map. - */ set_pte(page_table, pte_mkold(pte)); - SetPageReferenced(page); + if (onlist) { + /* + * Transfer the "accessed" bit from the page + * tables to the global page map. Page aging + * will be done by refill_inactive_scan(). + */ + SetPageReferenced(page); + } else { + /* + * The page is not on the active list, so + * we have to do the page aging ourselves. + */ + age_page_up(page); + } goto out_failed; } + if (!onlist) + age_page_down(page); + + /* + * If the page is in active use by us, or if the page + * is in active use by others, don't unmap it or + * (worse) start unneeded IO. + */ + if (page->age > 0) + goto out_failed; if (TryLockPage(page)) goto out_failed; @@ -81,6 +103,7 @@ UnlockPage(page); vma->vm_mm->rss--; flush_tlb_page(vma, address); + deactivate_page(page); page_cache_release(page); goto out_failed; } @@ -116,7 +139,9 @@ * Don't do any of the expensive stuff if * we're not really interested in this zone. */ - if (page->zone->free_pages > page->zone->pages_high) + if (page->zone->free_pages + page->zone->inactive_clean_pages + + page->zone->inactive_dirty_pages + > page->zone->pages_high + inactive_target) goto out_unlock; /* @@ -152,6 +177,7 @@ if (file) fput(file); if (!error) goto out_free_success; + deactivate_page(page); page_cache_release(page); return error; } @@ -182,6 +208,7 @@ /* OK, do a physical asynchronous write to swap. */ rw_swap_page(WRITE, page, 0); + deactivate_page(page); out_free_success: page_cache_release(page); @@ -323,17 +350,22 @@ int result = swap_out_vma(mm, vma, address, gfp_mask); if (result) return result; + if (!mm->swap_cnt) + goto out_unlock; vma = vma->vm_next; if (!vma) break; address = vma->vm_start; } } + /* Reset to 0 when we reach the end of address space */ + mm->swap_address = 0; + mm->swap_cnt = 0; + +out_unlock: vmlist_access_unlock(mm); /* We didn't find anything for the process */ - mm->swap_cnt = 0; - mm->swap_address = 0; return 0; } @@ -342,6 +374,9 @@ * N.B. This function returns only 0 or 1. Return values != 1 from * the lower level routines result in continued processing. */ +#define SWAP_SHIFT 5 +#define SWAP_MIN 8 + static int swap_out(unsigned int priority, int gfp_mask) { struct task_struct * p; @@ -363,7 +398,7 @@ * Think of swap_cnt as a "shadow rss" - it tells us which process * we want to page out (always try largest first). */ - counter = (nr_threads << 2) >> (priority >> 2); + counter = (nr_threads << SWAP_SHIFT) >> priority; if (counter < 1) counter = 1; @@ -382,8 +417,11 @@ if (mm->rss <= 0) continue; /* Refresh swap_cnt? */ - if (assign == 1) - mm->swap_cnt = mm->rss; + if (assign == 1) { + mm->swap_cnt = (mm->rss >> SWAP_SHIFT); + if (mm->swap_cnt < SWAP_MIN) + mm->swap_cnt = SWAP_MIN; + } if (mm->swap_cnt > max_cnt) { max_cnt = mm->swap_cnt; best = mm; @@ -418,50 +456,393 @@ return __ret; } -/* - * Check if there is any memory pressure (free_pages < pages_low) + +/** + * reclaim_page - reclaims one page from the inactive_clean list + * @zone: reclaim a page from this zone + * + * The pages on the inactive_clean can be instantly reclaimed. + * The tests look impressive, but most of the time we'll grab + * the first page of the list and exit successfully. */ -static inline int memory_pressure(void) +struct page * reclaim_page(zone_t * zone) { - pg_data_t *pgdat = pgdat_list; + struct page * page = NULL; + struct list_head * page_lru; + int maxscan; - do { - int i; - for(i = 0; i < MAX_NR_ZONES; i++) { - zone_t *zone = pgdat->node_zones+ i; - if (zone->size && - zone->free_pages < zone->pages_low) - return 1; + /* + * We only need the pagemap_lru_lock if we don't reclaim the page, + * but we have to grab the pagecache_lock before the pagemap_lru_lock + * to avoid deadlocks and most of the time we'll succeed anyway. + */ + spin_lock(&pagecache_lock); + spin_lock(&pagemap_lru_lock); + maxscan = zone->inactive_clean_pages; + while ((page_lru = zone->inactive_clean_list.prev) != + &zone->inactive_clean_list && maxscan--) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageInactiveClean(page)) { + printk("VM: reclaim_page, wrong page on list.\n"); + list_del(page_lru); + page->zone->inactive_clean_pages--; + continue; } - pgdat = pgdat->node_next; - } while (pgdat); - return 0; + /* Page is or was in use? Move it to the active list. */ + if (PageTestandClearReferenced(page) || page->age > 0 || + (!page->buffers && page_count(page) > 1)) { + del_page_from_inactive_clean_list(page); + add_page_to_active_list(page); + continue; + } + + /* The page is dirty, or locked, move to inactive_diry list. */ + if (page->buffers || TryLockPage(page)) { + del_page_from_inactive_clean_list(page); + add_page_to_inactive_dirty_list(page); + continue; + } + + /* OK, remove the page from the caches. */ + if (PageSwapCache(page)) { + __delete_from_swap_cache(page); + goto found_page; + } + + if (page->mapping) { + __remove_inode_page(page); + goto found_page; + } + + /* We should never ever get here. */ + printk(KERN_ERR "VM: reclaim_page, found unknown page\n"); + list_del(page_lru); + zone->inactive_clean_pages--; + UnlockPage(page); + } + /* Reset page pointer, maybe we encountered an unfreeable page. */ + page = NULL; + goto out; + +found_page: + del_page_from_inactive_clean_list(page); + UnlockPage(page); + if (page_count(page) != 1) + printk("VM: reclaim_page, found page with count %d!\n", + page_count(page)); +out: + spin_unlock(&pagemap_lru_lock); + spin_unlock(&pagecache_lock); + memory_pressure++; + return page; +} + +/** + * page_launder - clean dirty inactive pages, move to inactive_clean list + * @gfp_mask: what operations we are allowed to do + * @sync: should we wait synchronously for the cleaning of pages + * + * When this function is called, we are most likely low on free + + * inactive_clean pages. Since we want to refill those pages as + * soon as possible, we'll make two loops over the inactive list, + * one to move the already cleaned pages to the inactive_clean lists + * and one to (often asynchronously) clean the dirty inactive pages. + * + * In situations where kswapd cannot keep up, user processes will + * end up calling this function. Since the user process needs to + * have a page before it can continue with its allocation, we'll + * do synchronous page flushing in that case. + * + * This code is heavily inspired by the FreeBSD source code. Thanks + * go out to Matthew Dillon. + */ +#define MAX_SYNC_LAUNDER (1 << page_cluster) +#define MAX_LAUNDER (MAX_SYNC_LAUNDER * 4) +int page_launder(int gfp_mask, int sync) +{ + int synclaunder, launder_loop, maxscan, cleaned_pages, maxlaunder; + struct list_head * page_lru; + struct page * page; + + launder_loop = 0; + synclaunder = 0; + maxlaunder = 0; + cleaned_pages = 0; + + if (!(gfp_mask & __GFP_IO)) + return 0; + +dirty_page_rescan: + spin_lock(&pagemap_lru_lock); + maxscan = nr_inactive_dirty_pages; + while ((page_lru = inactive_dirty_list.prev) != &inactive_dirty_list && + maxscan-- > 0) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageInactiveDirty(page)) { + printk("VM: page_launder, wrong page on list.\n"); + list_del(page_lru); + nr_inactive_dirty_pages--; + page->zone->inactive_dirty_pages--; + continue; + } + + /* Page is or was in use? Move it to the active list. */ + if (PageTestandClearReferenced(page) || page->age > 0 || + (!page->buffers && page_count(page) > 1) || + page_ramdisk(page)) { + del_page_from_inactive_dirty_list(page); + add_page_to_active_list(page); + continue; + } + + /* + * The page is locked. IO in progress? + * Move it to the back of the list. + */ + if (TryLockPage(page)) { + list_del(page_lru); + list_add(page_lru, &inactive_dirty_list); + continue; + } + + /* + * If the page has buffers, try to free the buffer mappings + * associated with this page. If we succeed we either free + * the page (in case it was a buffercache only page) or we + * move the page to the inactive_clean list. + * + * On the first round, we should free all previously cleaned + * buffer pages + */ + if (page->buffers) { + int wait, clearedbuf; + int freed_page = 0; + /* + * Since we might be doing disk IO, we have to + * drop the spinlock and take an extra reference + * on the page so it doesn't go away from under us. + */ + del_page_from_inactive_dirty_list(page); + page_cache_get(page); + spin_unlock(&pagemap_lru_lock); + + /* Will we do (asynchronous) IO? */ + if (launder_loop && synclaunder-- > 0) + wait = 2; /* Synchrounous IO */ + else if (launder_loop && maxlaunder-- > 0) + wait = 1; /* Async IO */ + else + wait = 0; /* No IO */ + + /* Try to free the page buffers. */ + clearedbuf = try_to_free_buffers(page, wait); + + /* + * Re-take the spinlock. Note that we cannot + * unlock the page yet since we're still + * accessing the page_struct here... + */ + spin_lock(&pagemap_lru_lock); + + /* The buffers were not freed. */ + if (!clearedbuf) { + add_page_to_inactive_dirty_list(page); + + /* The page was only in the buffer cache. */ + } else if (!page->mapping) { + atomic_dec(&buffermem_pages); + freed_page = 1; + cleaned_pages++; + + /* The page has more users besides the cache and us. */ + } else if (page_count(page) > 2) { + add_page_to_active_list(page); + + /* OK, we "created" a freeable page. */ + } else /* page->mapping && page_count(page) == 2 */ { + add_page_to_inactive_clean_list(page); + cleaned_pages++; + } + + /* + * Unlock the page and drop the extra reference. + * We can only do it here because we ar accessing + * the page struct above. + */ + UnlockPage(page); + page_cache_release(page); + + /* + * If we're freeing buffer cache pages, stop when + * we've got enough free memory. + */ + if (freed_page && !free_shortage()) + break; + continue; + } else if (page->mapping && !PageDirty(page)) { + /* + * If a page had an extra reference in + * deactivate_page(), we will find it here. + * Now the page is really freeable, so we + * move it to the inactive_clean list. + */ + UnlockPage(page); + del_page_from_inactive_dirty_list(page); + add_page_to_inactive_clean_list(page); + cleaned_pages++; + } else { + /* + * OK, we don't know what to do with the page. + * It's no use keeping it here, so we move it to + * the active list. + */ + UnlockPage(page); + del_page_from_inactive_dirty_list(page); + add_page_to_active_list(page); + } + } + spin_unlock(&pagemap_lru_lock); + + /* + * If we don't have enough free pages, we loop back once + * to queue the dirty pages for writeout. When we were called + * by a user process (that /needs/ a free page) and we didn't + * free anything yet, we wait synchronously on the writeout of + * MAX_SYNC_LAUNDER pages. + * + * We also wake up bdflush, since bdflush should, under most + * loads, flush out the dirty pages before we have to wait on + * IO. + */ + if (!launder_loop && free_shortage()) { + launder_loop = 1; + if (sync && !cleaned_pages) + synclaunder = MAX_SYNC_LAUNDER; + /* We only do a few "out of order" flushes. */ + maxlaunder = MAX_LAUNDER; + /* Kflushd takes care of the rest. */ + wakeup_bdflush(0); + goto dirty_page_rescan; + } + + /* Return the number of pages moved to the inactive_clean list. */ + return cleaned_pages; +} + +/** + * refill_inactive_scan - scan the active list and find pages to deactivate + * @priority: the priority at which to scan + * @oneshot: exit after deactivating one page + * + * This function will scan a portion of the active list to find + * unused pages, those pages will then be moved to the inactive list. + */ +int refill_inactive_scan(unsigned int priority, int oneshot) +{ + struct list_head * page_lru; + struct page * page; + int maxscan, page_active = 0; + int ret = 0; + + /* Take the lock while messing with the list... */ + spin_lock(&pagemap_lru_lock); + maxscan = nr_active_pages >> priority; + while (maxscan-- > 0 && (page_lru = active_list.prev) != &active_list) { + page = list_entry(page_lru, struct page, lru); + + /* Wrong page on list?! (list corruption, should not happen) */ + if (!PageActive(page)) { + printk("VM: refill_inactive, wrong page on list.\n"); + list_del(page_lru); + nr_active_pages--; + continue; + } + + /* Do aging on the pages. */ + if (PageTestandClearReferenced(page)) { + age_page_up_nolock(page); + page_active = 1; + } else { + age_page_down_nolock(page); + page_active = 0; + } + /* + * If the page is still on the active list, move it + * to the other end of the list. Otherwise it was + * deactivated by age_page_down and we exit successfully. + */ + if (page_active || PageActive(page)) { + list_del(page_lru); + list_add(page_lru, &active_list); + } else { + ret = 1; + if (oneshot) + break; + } + } + spin_unlock(&pagemap_lru_lock); + + return ret; } /* - * Check if all zones have recently had memory_pressure (zone_wake_kswapd) + * Check if there are zones with a severe shortage of free pages, + * or if all zones have a minor shortage. */ -static inline int keep_kswapd_awake(void) +int free_shortage(void) { - int all_recent = 1; pg_data_t *pgdat = pgdat_list; + int sum = 0; + int freeable = nr_free_pages() + nr_inactive_clean_pages(); + /* Are we low on truly free pages? */ + if (nr_free_pages() < freepages.min) + return freepages.high - nr_free_pages(); + + /* Are we low on free pages over-all? */ + if (freeable < freepages.high) + return freepages.high - freeable; + + /* If not, are we very low on any particular zone? */ do { int i; for(i = 0; i < MAX_NR_ZONES; i++) { zone_t *zone = pgdat->node_zones+ i; - if (zone->size) { - if (zone->free_pages < zone->pages_min) - return 1; - if (!zone->zone_wake_kswapd) - all_recent = 0; + if (zone->size && (zone->inactive_clean_pages + + zone->free_pages < zone->pages_min)) { + sum += zone->pages_min; + sum -= zone->free_pages; + sum -= zone->inactive_clean_pages; } } pgdat = pgdat->node_next; } while (pgdat); - return all_recent; + return sum; +} + +/* + * How many inactive pages are we short? + */ +int inactive_shortage(void) +{ + int shortage = 0; + + shortage += freepages.high; + shortage += inactive_target; + shortage -= nr_free_pages(); + shortage -= nr_inactive_clean_pages(); + shortage -= nr_inactive_dirty_pages; + + if (shortage > 0) + return shortage; + + return 0; } /* @@ -472,41 +853,37 @@ * We want to try to free "count" pages, and we want to * cluster them so that we get good swap-out behaviour. * - * Don't try _too_ hard, though. We don't want to have bad - * latency. - * - * Note: only called by kswapd and try_to_free_pages - * both can WAIT at top level. + * OTOH, if we're a user process (and not kswapd), we + * really care about latency. In that case we don't try + * to free too many pages. */ -#define FREE_COUNT 8 -#define SWAP_COUNT 16 -static int do_try_to_free_pages(unsigned int gfp_mask) -{ - int priority; - int count = FREE_COUNT; - int swap_count; +static int refill_inactive(unsigned int gfp_mask, int user) +{ + int priority, count, start_count, made_progress; + + count = inactive_shortage() + free_shortage(); + if (user) + count = (1 << page_cluster); + start_count = count; /* Always trim SLAB caches when memory gets low. */ kmem_cache_reap(gfp_mask); - priority = 64; + priority = 6; do { + made_progress = 0; + if (current->need_resched) { + __set_current_state(TASK_RUNNING); schedule(); - /* time has passed - pressure too? */ - if (!memory_pressure()) - goto done; } - while (shrink_mmap(priority, gfp_mask)) { + while (refill_inactive_scan(priority, 1)) { + made_progress = 1; if (!--count) goto done; } - /* check if mission completed */ - if (!keep_kswapd_awake()) - goto done; - /* Try to get rid of some shared memory pages.. */ if (gfp_mask & __GFP_IO) { /* @@ -525,10 +902,9 @@ * if (count <= 0) * goto done; */ - if (!keep_kswapd_awake()) - goto done; while (shm_swap(priority, gfp_mask)) { + made_progress = 1; if (!--count) goto done; } @@ -536,32 +912,82 @@ /* * Then, try to page stuff out.. - * - * This will not actually free any pages (they get - * put in the swap cache), so we must not count this - * as a "count" success. - */ - swap_count = SWAP_COUNT; - while (swap_out(priority, gfp_mask)) - if (--swap_count < 0) - break; + */ + while (swap_out(priority, gfp_mask)) { + made_progress = 1; + if (!--count) + goto done; + } - } while (--priority >= 0); + /* + * If we either have enough free memory, or if + * page_launder() will be able to make enough + * free memory, then stop. + */ + if (!inactive_shortage() || !free_shortage()) + goto done; + + /* + * Only switch to a lower "priority" if we + * didn't make any useful progress in the + * last loop. + */ + if (!made_progress) + priority--; + } while (priority >= 0); /* Always end on a shrink_mmap.., may sleep... */ - while (shrink_mmap(0, gfp_mask)) { + while (refill_inactive_scan(0, 1)) { if (!--count) goto done; } - /* Return 1 if any page is freed, or - * there are no more memory pressure */ - return (count < FREE_COUNT || !keep_kswapd_awake()); - + done: - return 1; + return (count < start_count); +} + +static int do_try_to_free_pages(unsigned int gfp_mask, int user) +{ + int ret = 0; + + /* + * First, reclaim unused slab cache memory. + */ + kmem_cache_reap(gfp_mask); + + /* + * If we're low on free pages, move pages from the + * inactive_dirty list to the inactive_clean list. + * + * Usually bdflush will have pre-cleaned the pages + * before we get around to moving them to the other + * list, so this is a relatively cheap operation. + */ + if (free_shortage()) + ret += page_launder(gfp_mask, user); + + /* + * If needed, we move pages from the active list + * to the inactive list. We also "eat" pages from + * the inode and dentry cache whenever we do this. + */ + if (free_shortage() || inactive_shortage()) { + if (gfp_mask & __GFP_IO) { + ret += shrink_dcache_memory(6, gfp_mask); + ret += shrink_icache_memory(6, gfp_mask); + } + + ret += refill_inactive(gfp_mask, user); + } else { + ret = 1; + } + + return ret; } DECLARE_WAIT_QUEUE_HEAD(kswapd_wait); +DECLARE_WAIT_QUEUE_HEAD(kswapd_done); +struct task_struct *kswapd_task; /* * The background pageout daemon, started as a kernel thread @@ -584,6 +1010,7 @@ tsk->pgrp = 1; strcpy(tsk->comm, "kswapd"); sigfillset(&tsk->blocked); + kswapd_task = tsk; /* * Tell the memory management that we're a "memory allocator", @@ -599,15 +1026,91 @@ */ tsk->flags |= PF_MEMALLOC; + /* + * Kswapd main loop. + */ for (;;) { - if (!keep_kswapd_awake()) { - interruptible_sleep_on(&kswapd_wait); + static int recalc = 0; + + /* If needed, try to free some memory. */ + if (inactive_shortage() || free_shortage()) { + int wait = 0; + /* Do we need to do some synchronous flushing? */ + if (waitqueue_active(&kswapd_done)) + wait = 1; + if (!do_try_to_free_pages(GFP_KSWAPD, wait)) { + /* + * if (out_of_memory()) { + * try again a few times; + * oom_kill(); + * } + */ + } } - do_try_to_free_pages(GFP_KSWAPD); + /* + * Do some (very minimal) background scanning. This + * will scan all pages on the active list once + * every minute. This clears old referenced bits + * and moves unused pages to the inactive list. + */ + refill_inactive_scan(6, 0); + + /* Once a second, recalculate some VM stats. */ + if (time_after(jiffies, recalc + HZ)) { + recalc = jiffies; + recalculate_vm_stats(); + } + + /* + * Wake up everybody waiting for free memory + * and unplug the disk queue. + */ + wake_up_all(&kswapd_done); + run_task_queue(&tq_disk); + + /* + * If we've either completely gotten rid of the + * free page shortage or the inactive page shortage + * is getting low, then stop eating CPU time. + * + * We go to sleep for one second, but if it's needed + * we'll be woken up earlier... + */ + if (!free_shortage() || !inactive_shortage()) + interruptible_sleep_on_timeout(&kswapd_wait, HZ); } } +void wakeup_kswapd(int block) +{ + DECLARE_WAITQUEUE(wait, current); + + if (current == kswapd_task) + return; + + if (!block) { + if (waitqueue_active(&kswapd_wait)) + wake_up(&kswapd_wait); + return; + } + + /* + * Kswapd could wake us up before we get a chance + * to sleep, so we have to be very careful here to + * prevent SMP races... + */ + __set_current_state(TASK_UNINTERRUPTIBLE); + add_wait_queue(&kswapd_done, &wait); + + if (waitqueue_active(&kswapd_wait)) + wake_up(&kswapd_wait); + schedule(); + + remove_wait_queue(&kswapd_done, &wait); + __set_current_state(TASK_RUNNING); +} + /* * Called by non-kswapd processes when they want more * memory. @@ -625,28 +1128,72 @@ */ int try_to_free_pages(unsigned int gfp_mask) { - int retval = 1; + int ret = 1; if (gfp_mask & __GFP_WAIT) { - current->state = TASK_RUNNING; - current->flags |= PF_MEMALLOC; - retval = do_try_to_free_pages(gfp_mask); - current->flags &= ~PF_MEMALLOC; + ret = do_try_to_free_pages(gfp_mask, 1); } - /* someone needed memory that kswapd had not provided - * make sure kswapd runs, should not happen often */ - if (waitqueue_active(&kswapd_wait)) - wake_up_interruptible(&kswapd_wait); + return ret; +} + +DECLARE_WAIT_QUEUE_HEAD(kreclaimd_wait); +/* + * Kreclaimd will move pages from the inactive_clean list to the + * free list, in order to keep atomic allocations possible under + * all circumstances. Even when kswapd is blocked on IO. + */ +int kreclaimd(void *unused) +{ + struct task_struct *tsk = current; + pg_data_t *pgdat; - return retval; + tsk->session = 1; + tsk->pgrp = 1; + strcpy(tsk->comm, "kreclaimd"); + sigfillset(&tsk->blocked); + current->flags |= PF_MEMALLOC; + + while (1) { + + /* + * We sleep until someone wakes us up from + * page_alloc.c::__alloc_pages(). + */ + interruptible_sleep_on(&kreclaimd_wait); + + /* + * Move some pages from the inactive_clean lists to + * the free lists, if it is needed. + */ + pgdat = pgdat_list; + do { + int i; + for(i = 0; i < MAX_NR_ZONES; i++) { + zone_t *zone = pgdat->node_zones + i; + if (!zone->size) + continue; + + while (zone->free_pages < zone->pages_low) { + struct page * page; + page = reclaim_page(zone); + if (!page) + break; + __free_page(page); + } + } + pgdat = pgdat->node_next; + } while (pgdat); + } } + static int __init kswapd_init(void) { - printk("Starting kswapd v1.7\n"); + printk("Starting kswapd v1.8\n"); swap_setup(); kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); + kernel_thread(kreclaimd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/net/appletalk/aarp.c linux/net/appletalk/aarp.c --- v2.4.0-test8/linux/net/appletalk/aarp.c Tue Jul 18 16:09:27 2000 +++ linux/net/appletalk/aarp.c Mon Sep 18 14:57:01 2000 @@ -1017,7 +1017,10 @@ * cycle during probing of a slow to respond host addr. */ if (a != NULL) + { a->expires_at = jiffies - 1; + mod_timer(&aarp_timer, jiffies + sysctl_aarp_tick_time); + } } if (sa.s_node != ma->s_node) diff -u --recursive --new-file v2.4.0-test8/linux/net/core/sock.c linux/net/core/sock.c --- v2.4.0-test8/linux/net/core/sock.c Fri Aug 18 10:26:25 2000 +++ linux/net/core/sock.c Mon Sep 18 15:04:13 2000 @@ -7,7 +7,7 @@ * handler for protocols to use and generic option handler. * * - * Version: $Id: sock.c,v 1.98 2000/08/16 16:09:15 davem Exp $ + * Version: $Id: sock.c,v 1.100 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -609,7 +609,9 @@ { sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0, SLAB_HWCACHE_ALIGN, 0, 0); - + if (!sk_cachep) + printk(KERN_CRIT "sk_init: Cannot create sock SLAB cache!"); + if (num_physpages <= 4096) { sysctl_wmem_max = 32767; sysctl_rmem_max = 32767; @@ -1142,6 +1144,7 @@ } else sk->sleep = NULL; + sk->dst_lock = RW_LOCK_UNLOCKED; sk->callback_lock = RW_LOCK_UNLOCKED; sk->state_change = sock_def_wakeup; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c --- v2.4.0-test8/linux/net/ipv4/af_inet.c Fri Aug 18 10:26:25 2000 +++ linux/net/ipv4/af_inet.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * PF_INET protocol family socket handler. * - * Version: $Id: af_inet.c,v 1.112 2000/08/16 16:20:56 davem Exp $ + * Version: $Id: af_inet.c,v 1.114 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -258,7 +258,6 @@ return -EAGAIN; } sk->sport = htons(sk->num); - sk->prot->hash(sk); } release_sock(sk); return 0; @@ -390,7 +389,6 @@ if (sk->prot->init) { int err = sk->prot->init(sk); if (err != 0) { - sk->dead = 1; inet_sock_release(sk); return(err); } @@ -460,7 +458,7 @@ if (addr_len < sizeof(struct sockaddr_in)) return -EINVAL; - + chk_addr_ret = inet_addr_type(addr->sin_addr.s_addr); snum = ntohs(addr->sin_port); @@ -495,10 +493,11 @@ if (sk->rcv_saddr) sk->userlocks |= SOCK_BINDADDR_LOCK; + if (snum) + sk->userlocks |= SOCK_BINDPORT_LOCK; sk->sport = htons(sk->num); sk->daddr = 0; sk->dport = 0; - sk->prot->hash(sk); sk_dst_reset(sk); err = 0; out: diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/ip_sockglue.c linux/net/ipv4/ip_sockglue.c --- v2.4.0-test8/linux/net/ipv4/ip_sockglue.c Thu Aug 10 13:01:26 2000 +++ linux/net/ipv4/ip_sockglue.c Sun Sep 17 10:03:43 2000 @@ -5,7 +5,7 @@ * * The IP to API glue. * - * Version: $Id: ip_sockglue.c,v 1.51 2000/08/09 11:59:04 davem Exp $ + * Version: $Id: ip_sockglue.c,v 1.52 2000/09/09 08:26:04 davem Exp $ * * Authors: see ip.c * @@ -380,31 +380,39 @@ { int val=0,err; - if(optlen>=sizeof(int)) { - if(get_user(val, (int *) optval)) - return -EFAULT; - } else if(optlen>=sizeof(char)) { - unsigned char ucval; - if(get_user(ucval, (unsigned char *) optval)) - return -EFAULT; - val = (int)ucval; + if (optname == IP_PKTINFO || optname == IP_RECVTTL || + optname == IP_RECVTOS || optname == IP_RECVOPTS || + optname == IP_RETOPTS || optname == IP_TOS || + optname == IP_TTL || optname == IP_HDRINCL || + optname == IP_MTU_DISCOVER || optname == IP_RECVERR || + optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP || + optname == IP_ROUTER_ALERT) { + if (optlen >= sizeof(int)) { + if (get_user(val, (int *) optval)) + return -EFAULT; + } else if (optlen >= sizeof(char)) { + unsigned char ucval; + + if (get_user(ucval, (unsigned char *) optval)) + return -EFAULT; + val = (int) ucval; + } } + /* If optlen==0, it is equivalent to val == 0 */ - if(level!=SOL_IP) + if (level != SOL_IP) return -ENOPROTOOPT; + #ifdef CONFIG_IP_MROUTE - if(optname>=MRT_BASE && optname <=MRT_BASE+10) - { + if (optname >= MRT_BASE && optname <= (MRT_BASE + 10)) return ip_mroute_setsockopt(sk,optname,optval,optlen); - } #endif err = 0; lock_sock(sk); - switch(optname) - { + switch (optname) { case IP_OPTIONS: { struct ip_options * opt = NULL; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ip_fw_compat.c linux/net/ipv4/netfilter/ip_fw_compat.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ip_fw_compat.c Fri Aug 4 13:07:24 2000 +++ linux/net/ipv4/netfilter/ip_fw_compat.c Mon Sep 18 15:09:55 2000 @@ -15,6 +15,10 @@ #include #include +/* Theoretically, we could one day use 2.4 helpers, but for now it + just confuses depmod --RR */ +EXPORT_NO_SYMBOLS; + static struct firewall_ops *fwops; /* From ip_fw_compat_redir.c */ diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ip_fw_compat_masq.c linux/net/ipv4/netfilter/ip_fw_compat_masq.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ip_fw_compat_masq.c Fri Jul 14 12:20:22 2000 +++ linux/net/ipv4/netfilter/ip_fw_compat_masq.c Mon Sep 18 15:09:55 2000 @@ -85,7 +85,12 @@ newsrc, newsrc, { htons(61000) }, { htons(65095) } } } }); - ip_nat_setup_info(ct, &range, NF_IP_POST_ROUTING); + ret = ip_nat_setup_info(ct, &range, NF_IP_POST_ROUTING); + if (ret != NF_ACCEPT) { + WRITE_UNLOCK(&ip_nat_lock); + return ret; + } + place_in_hashes(ct, info); info->initialized = 1; } else diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ip_nat_ftp.c linux/net/ipv4/netfilter/ip_nat_ftp.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ip_nat_ftp.c Thu Aug 10 12:35:15 2000 +++ linux/net/ipv4/netfilter/ip_nat_ftp.c Sun Sep 17 10:15:00 2000 @@ -372,8 +372,9 @@ newseq = ntohl(tcph->seq) + ftp[dir].syn_offset_before; newseq = htonl(newseq); - /* Ack adjust */ - if (after(ntohl(tcph->ack_seq), ftp[!dir].syn_correction_pos)) + /* Ack adjust: other dir sees offset seq numbers */ + if (after(ntohl(tcph->ack_seq) - ftp[!dir].syn_offset_before, + ftp[!dir].syn_correction_pos)) newack = ntohl(tcph->ack_seq) - ftp[!dir].syn_offset_after; else newack = ntohl(tcph->ack_seq) - ftp[!dir].syn_offset_before; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ip_nat_standalone.c linux/net/ipv4/netfilter/ip_nat_standalone.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ip_nat_standalone.c Thu Sep 7 08:32:01 2000 +++ linux/net/ipv4/netfilter/ip_nat_standalone.c Fri Sep 15 21:37:23 2000 @@ -7,6 +7,7 @@ /* (c) 1999 Paul `Rusty' Russell. Licenced under the GNU General Public Licence. */ +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ip_queue.c linux/net/ipv4/netfilter/ip_queue.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ip_queue.c Thu Aug 10 12:35:15 2000 +++ linux/net/ipv4/netfilter/ip_queue.c Mon Sep 18 15:09:55 2000 @@ -414,7 +414,7 @@ return skb; nlmsg_failure: if (skb) - kfree(skb); + kfree_skb(skb); *errp = 0; printk(KERN_ERR "ip_queue: error creating netlink message\n"); return NULL; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ipt_MIRROR.c linux/net/ipv4/netfilter/ipt_MIRROR.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ipt_MIRROR.c Thu Jul 6 21:20:00 2000 +++ linux/net/ipv4/netfilter/ipt_MIRROR.c Mon Sep 18 15:09:55 2000 @@ -89,7 +89,7 @@ dst->neighbour->output(skb); else { printk(KERN_DEBUG "khm in MIRROR\n"); - kfree(skb); + kfree_skb(skb); } } diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/ipt_REJECT.c linux/net/ipv4/netfilter/ipt_REJECT.c --- v2.4.0-test8/linux/net/ipv4/netfilter/ipt_REJECT.c Thu Aug 10 12:35:15 2000 +++ linux/net/ipv4/netfilter/ipt_REJECT.c Mon Sep 18 15:09:55 2000 @@ -27,6 +27,7 @@ struct tcphdr *otcph, *tcph; struct rtable *rt; unsigned int otcplen; + u_int16_t tmp; int needs_ack; /* IP header checks: fragment, too short. */ @@ -64,8 +65,11 @@ tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl); + /* Swap source and dest */ nskb->nh.iph->daddr = xchg(&nskb->nh.iph->saddr, nskb->nh.iph->daddr); - tcph->source = xchg(&tcph->dest, tcph->source); + tmp = tcph->source; + tcph->source = tcph->dest; + tcph->dest = tmp; /* Truncate to length (no data) */ tcph->doff = sizeof(struct tcphdr)/4; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/netfilter/iptable_mangle.c linux/net/ipv4/netfilter/iptable_mangle.c --- v2.4.0-test8/linux/net/ipv4/netfilter/iptable_mangle.c Thu Sep 7 08:32:01 2000 +++ linux/net/ipv4/netfilter/iptable_mangle.c Fri Sep 15 21:37:23 2000 @@ -3,6 +3,7 @@ * * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling */ +#include #include #include #include diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c --- v2.4.0-test8/linux/net/ipv4/sysctl_net_ipv4.c Thu Sep 7 08:32:01 2000 +++ linux/net/ipv4/sysctl_net_ipv4.c Sun Sep 17 10:03:43 2000 @@ -1,7 +1,7 @@ /* * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. * - * $Id: sysctl_net_ipv4.c,v 1.45 2000/09/06 23:30:29 davem Exp $ + * $Id: sysctl_net_ipv4.c,v 1.46 2000/09/16 09:38:30 davem Exp $ * * Begun April 1, 1996, Mike Shaver. * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS] @@ -15,19 +15,6 @@ #include #include -/* - * TCP configuration parameters - */ - -#define TCP_PMTU_DISC 0x00000001 /* perform PMTU discovery */ -#define TCP_CONG_AVOID 0x00000002 /* congestion avoidance algorithm */ -#define TCP_DELAY_ACKS 0x00000003 /* delayed ack stategy */ - -#if 0 -static int boolean_min = 0; -static int boolean_max = 1; -#endif - /* From icmp.c */ extern int sysctl_icmp_echo_ignore_all; extern int sysctl_icmp_echo_ignore_broadcasts; @@ -57,7 +44,10 @@ extern int inet_peer_gc_mintime; extern int inet_peer_gc_maxtime; -int tcp_retr1_max = 255; +static int tcp_retr1_max = 255; + +static int ip_local_port_range_min[] = { 1, 1 }; +static int ip_local_port_range_max[] = { 65535, 65535 }; struct ipv4_config ipv4_config; @@ -170,7 +160,8 @@ sizeof(int), 0644, NULL, &proc_dointvec}, {NET_IPV4_LOCAL_PORT_RANGE, "ip_local_port_range", &sysctl_local_port_range, sizeof(sysctl_local_port_range), 0644, - NULL, &proc_dointvec}, + NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, + ip_local_port_range_min, ip_local_port_range_max }, {NET_IPV4_ICMP_ECHO_IGNORE_ALL, "icmp_echo_ignore_all", &sysctl_icmp_echo_ignore_all, sizeof(int), 0644, NULL, &proc_dointvec}, diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c --- v2.4.0-test8/linux/net/ipv4/tcp.c Fri Aug 18 10:26:25 2000 +++ linux/net/ipv4/tcp.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp.c,v 1.173 2000/08/15 20:15:23 davem Exp $ + * Version: $Id: tcp.c,v 1.174 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -1952,12 +1952,14 @@ sk->dport = 0; - sk->rcv_saddr = 0; - sk->saddr = 0; + if (!(sk->userlocks&SOCK_BINDADDR_LOCK)) { + sk->rcv_saddr = 0; + sk->saddr = 0; #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) - memset(&sk->net_pinfo.af_inet6.saddr, 0, 16); - memset(&sk->net_pinfo.af_inet6.rcv_saddr, 0, 16); + memset(&sk->net_pinfo.af_inet6.saddr, 0, 16); + memset(&sk->net_pinfo.af_inet6.rcv_saddr, 0, 16); #endif + } sk->shutdown = 0; sk->done = 0; @@ -2281,6 +2283,68 @@ case TCP_WINDOW_CLAMP: val = tp->window_clamp; break; + case TCP_INFO: + { + struct tcp_info info; + u32 now = tcp_time_stamp; + + if(get_user(len,optlen)) + return -EFAULT; + info.tcpi_state = sk->state; + info.tcpi_ca_state = tp->ca_state; + info.tcpi_retransmits = tp->retransmits; + info.tcpi_probes = tp->probes_out; + info.tcpi_backoff = tp->backoff; + info.tcpi_options = 0; + if (tp->tstamp_ok) + info.tcpi_options |= TCPI_OPT_TIMESTAMPS; + if (tp->sack_ok) + info.tcpi_options |= TCPI_OPT_SACK; + if (tp->wscale_ok) { + info.tcpi_options |= TCPI_OPT_WSCALE; + info.tcpi_snd_wscale = tp->snd_wscale; + info.tcpi_rcv_wscale = tp->rcv_wscale; + } else { + info.tcpi_snd_wscale = 0; + info.tcpi_rcv_wscale = 0; + } +#ifdef CONFIG_INET_ECN + if (tp->ecn_flags&TCP_ECN_OK) + info.tcpi_options |= TCPI_OPT_ECN; +#endif + + info.tcpi_rto = (1000000*tp->rto)/HZ; + info.tcpi_ato = (1000000*tp->ack.ato)/HZ; + info.tcpi_snd_mss = tp->mss_cache; + info.tcpi_rcv_mss = tp->ack.rcv_mss; + + info.tcpi_unacked = tp->packets_out; + info.tcpi_sacked = tp->sacked_out; + info.tcpi_lost = tp->lost_out; + info.tcpi_retrans = tp->retrans_out; + info.tcpi_fackets = tp->fackets_out; + + info.tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ; + info.tcpi_last_ack_sent = 0; + info.tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ; + info.tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ; + + info.tcpi_pmtu = tp->pmtu_cookie; + info.tcpi_rcv_ssthresh = tp->rcv_ssthresh; + info.tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3; + info.tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2; + info.tcpi_snd_ssthresh = tp->snd_ssthresh; + info.tcpi_snd_cwnd = tp->snd_cwnd; + info.tcpi_advmss = tp->advmss; + info.tcpi_reordering = tp->reordering; + + len = min(len, sizeof(info)); + if(put_user(len, optlen)) + return -EFAULT; + if(copy_to_user(optval, &info,len)) + return -EFAULT; + return 0; + } default: return -ENOPROTOOPT; }; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/tcp_input.c linux/net/ipv4/tcp_input.c --- v2.4.0-test8/linux/net/ipv4/tcp_input.c Thu Sep 7 08:32:01 2000 +++ linux/net/ipv4/tcp_input.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_input.c,v 1.199 2000/09/06 23:30:29 davem Exp $ + * Version: $Id: tcp_input.c,v 1.201 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -1492,10 +1492,8 @@ case TCP_CA_Disorder: tcp_try_undo_dsack(sk, tp); - if (IsReno(tp) || !tp->undo_marker) { - tp->undo_marker = 0; - tp->ca_state = TCP_CA_Open; - } + tp->undo_marker = 0; + tp->ca_state = TCP_CA_Open; break; case TCP_CA_Recovery: @@ -1823,7 +1821,9 @@ #ifdef TCP_DEBUG if (before(tp->snd_una + tp->snd_wnd, tp->snd_nxt)) { if (net_ratelimit()) - printk(KERN_DEBUG "TCP: peer shrinks window. Bad, what else can I say?\n"); + printk(KERN_DEBUG "TCP: peer %u.%u.%u.%u:%u/%u shrinks window %u:%u:%u. Bad, what else can I say?\n", + NIPQUAD(sk->daddr), htons(sk->dport), sk->num, + tp->snd_una, tp->snd_wnd, tp->snd_nxt); } #endif @@ -1952,7 +1952,7 @@ if (opsize < 2) /* "silly options" */ return; if (opsize > length) - break; /* don't parse partial options */ + return; /* don't parse partial options */ switch(opcode) { case TCPOPT_MSS: if(opsize==TCPOLEN_MSS && th->syn) { diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/tcp_ipv4.c linux/net/ipv4/tcp_ipv4.c --- v2.4.0-test8/linux/net/ipv4/tcp_ipv4.c Fri Aug 18 10:26:25 2000 +++ linux/net/ipv4/tcp_ipv4.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_ipv4.c,v 1.212 2000/08/18 17:10:04 davem Exp $ + * Version: $Id: tcp_ipv4.c,v 1.213 2000/09/18 05:59:48 davem Exp $ * * IPv4 specific functions * @@ -300,6 +300,7 @@ sk->bind_next->bind_pprev = sk->bind_pprev; *(sk->bind_pprev) = sk->bind_next; sk->prev = NULL; + sk->num = 0; if (tb->owners == NULL) { if (tb->next) tb->next->pprev = tb->pprev; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/tcp_minisocks.c linux/net/ipv4/tcp_minisocks.c --- v2.4.0-test8/linux/net/ipv4/tcp_minisocks.c Thu Sep 7 08:32:01 2000 +++ linux/net/ipv4/tcp_minisocks.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_minisocks.c,v 1.3 2000/09/05 23:13:48 davem Exp $ + * Version: $Id: tcp_minisocks.c,v 1.4 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -662,6 +662,7 @@ sock_lock_init(newsk); bh_lock_sock(newsk); + newsk->dst_lock = RW_LOCK_UNLOCKED; atomic_set(&newsk->rmem_alloc, 0); skb_queue_head_init(&newsk->receive_queue); atomic_set(&newsk->wmem_alloc, 0); @@ -671,6 +672,7 @@ newsk->forward_alloc = 0; newsk->done = 0; + newsk->userlocks = sk->userlocks & ~SOCK_BINDPORT_LOCK; newsk->proc = 0; newsk->backlog.head = newsk->backlog.tail = NULL; newsk->callback_lock = RW_LOCK_UNLOCKED; diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv4/udp.c linux/net/ipv4/udp.c --- v2.4.0-test8/linux/net/ipv4/udp.c Thu Aug 10 13:01:26 2000 +++ linux/net/ipv4/udp.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * * The User Datagram Protocol (UDP). * - * Version: $Id: udp.c,v 1.85 2000/08/09 11:59:04 davem Exp $ + * Version: $Id: udp.c,v 1.86 2000/09/18 05:59:48 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -188,6 +188,15 @@ } } sk->num = snum; + if (sk->pprev == NULL) { + struct sock **skp = &udp_hash[snum & (UDP_HTABLE_SIZE - 1)]; + if ((sk->next = *skp) != NULL) + (*skp)->pprev = &sk->next; + *skp = sk; + sk->pprev = skp; + sock_prot_inc_use(sk->prot); + sock_hold(sk); + } write_unlock_bh(&udp_hash_lock); return 0; @@ -198,16 +207,7 @@ static void udp_v4_hash(struct sock *sk) { - struct sock **skp = &udp_hash[sk->num & (UDP_HTABLE_SIZE - 1)]; - - write_lock_bh(&udp_hash_lock); - if ((sk->next = *skp) != NULL) - (*skp)->pprev = &sk->next; - *skp = sk; - sk->pprev = skp; - sock_prot_inc_use(sk->prot); - sock_hold(sk); - write_unlock_bh(&udp_hash_lock); + BUG(); } static void udp_v4_unhash(struct sock *sk) @@ -218,6 +218,7 @@ sk->next->pprev = sk->pprev; *sk->pprev = sk->next; sk->pprev = NULL; + sk->num = 0; sock_prot_dec_use(sk->prot); __sock_put(sk); } @@ -797,10 +798,21 @@ */ sk->state = TCP_CLOSE; - sk->rcv_saddr = 0; sk->daddr = 0; sk->dport = 0; sk->bound_dev_if = 0; + if (!(sk->userlocks&SOCK_BINDADDR_LOCK)) { + sk->rcv_saddr = 0; + sk->saddr = 0; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + memset(&sk->net_pinfo.af_inet6.saddr, 0, 16); + memset(&sk->net_pinfo.af_inet6.rcv_saddr, 0, 16); +#endif + } + if (!(sk->userlocks&SOCK_BINDPORT_LOCK)) { + sk->prot->unhash(sk); + sk->sport = 0; + } sk_dst_reset(sk); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv6/af_inet6.c linux/net/ipv6/af_inet6.c --- v2.4.0-test8/linux/net/ipv6/af_inet6.c Wed Apr 26 12:13:17 2000 +++ linux/net/ipv6/af_inet6.c Mon Sep 18 15:04:13 2000 @@ -7,10 +7,11 @@ * * Adapted from linux/net/ipv4/af_inet.c * - * $Id: af_inet6.c,v 1.56 2000/04/25 04:13:34 davem Exp $ + * $Id: af_inet6.c,v 1.58 2000/09/18 05:59:48 davem Exp $ * * Fixes: * Hideaki YOSHIFUJI : sin6_scope_id support + * Arnaldo Melo : check proc_net_create return, cleanups * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -189,7 +190,7 @@ if (sk->prot->init) { int err = sk->prot->init(sk); if (err != 0) { - sk->dead = 1; + MOD_DEC_USE_COUNT; inet_sock_release(sk); return(err); } @@ -295,10 +296,13 @@ return -EADDRINUSE; } + if (addr_type != IPV6_ADDR_ANY) + sk->userlocks |= SOCK_BINDADDR_LOCK; + if (snum) + sk->userlocks |= SOCK_BINDPORT_LOCK; sk->sport = ntohs(sk->num); sk->dport = 0; sk->daddr = 0; - sk->prot->hash(sk); release_sock(sk); return 0; @@ -395,10 +399,8 @@ { case FIOSETOWN: case SIOCSPGRP: - err = get_user(pid, (int *) arg); - if(err) - return err; - + if (get_user(pid, (int *) arg)) + return -EFAULT; /* see sock_no_fcntl */ if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN)) @@ -407,10 +409,7 @@ return(0); case FIOGETOWN: case SIOCGPGRP: - err = put_user(sk->proc,(int *)arg); - if(err) - return err; - return(0); + return put_user(sk->proc,(int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; @@ -550,6 +549,20 @@ err = igmp6_init(&inet6_family_ops); if (err) goto igmp_fail; + /* Create /proc/foo6 entries. */ +#ifdef CONFIG_PROC_FS + err = -ENOMEM; + if (!proc_net_create("raw6", 0, raw6_get_info)) + goto proc_raw6_fail; + if (!proc_net_create("tcp6", 0, tcp6_get_info)) + goto proc_tcp6_fail; + if (!proc_net_create("udp6", 0, udp6_get_info)) + goto proc_udp6_fail; + if (!proc_net_create("sockstat6", 0, afinet6_get_info)) + goto proc_sockstat6_fail; + if (!proc_net_create("snmp6", 0, afinet6_get_snmp)) + goto proc_snmp6_fail; +#endif ipv6_netdev_notif_init(); ipv6_packet_init(); ip6_route_init(); @@ -561,15 +574,6 @@ udpv6_init(); tcpv6_init(); - /* Create /proc/foo6 entries. */ -#ifdef CONFIG_PROC_FS - proc_net_create("raw6", 0, raw6_get_info); - proc_net_create("tcp6", 0, tcp6_get_info); - proc_net_create("udp6", 0, udp6_get_info); - proc_net_create("sockstat6", 0, afinet6_get_info); - proc_net_create("snmp6", 0, afinet6_get_snmp); -#endif - /* Now the userspace is allowed to create INET6 sockets. */ (void) sock_register(&inet6_family_ops); @@ -579,6 +583,18 @@ return; #endif +#ifdef CONFIG_PROC_FS +proc_snmp6_fail: + proc_net_remove("sockstat6"); +proc_sockstat6_fail: + proc_net_remove("udp6"); +proc_udp6_fail: + proc_net_remove("tcp6"); +proc_tcp6_fail: + proc_net_remove("raw6"); +proc_raw6_fail: + igmp6_cleanup(); +#endif igmp_fail: ndisc_cleanup(); ndisc_fail: diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv6/ip6_fib.c linux/net/ipv6/ip6_fib.c --- v2.4.0-test8/linux/net/ipv6/ip6_fib.c Wed May 3 01:48:04 2000 +++ linux/net/ipv6/ip6_fib.c Sun Sep 17 10:03:43 2000 @@ -5,7 +5,7 @@ * Authors: * Pedro Roque * - * $Id: ip6_fib.c,v 1.21 2000/05/03 06:37:07 davem Exp $ + * $Id: ip6_fib.c,v 1.22 2000/09/12 00:38:34 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -638,10 +638,8 @@ if (narg->addr) { st = fib6_lookup_1(fn->subtree, narg); - if (!(st->fn_flags & RTN_ROOT)) - { + if (st && !(st->fn_flags & RTN_ROOT)) return st; - } } } #endif diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv6/mcast.c linux/net/ipv6/mcast.c --- v2.4.0-test8/linux/net/ipv6/mcast.c Fri Aug 4 18:18:49 2000 +++ linux/net/ipv6/mcast.c Mon Sep 18 15:04:13 2000 @@ -5,7 +5,7 @@ * Authors: * Pedro Roque * - * $Id: mcast.c,v 1.32 2000/07/26 01:04:21 davem Exp $ + * $Id: mcast.c,v 1.33 2000/09/18 05:59:48 davem Exp $ * * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c * @@ -766,7 +766,6 @@ return 0; } -#ifdef MODULE void igmp6_cleanup(void) { sock_release(igmp6_socket); @@ -775,4 +774,3 @@ remove_proc_entry("net/igmp6", 0); #endif } -#endif diff -u --recursive --new-file v2.4.0-test8/linux/net/ipv6/udp.c linux/net/ipv6/udp.c --- v2.4.0-test8/linux/net/ipv6/udp.c Thu Aug 10 13:01:26 2000 +++ linux/net/ipv6/udp.c Mon Sep 18 15:04:13 2000 @@ -7,7 +7,7 @@ * * Based on linux/ipv4/udp.c * - * $Id: udp.c,v 1.56 2000/08/09 11:59:04 davem Exp $ + * $Id: udp.c,v 1.57 2000/09/18 05:59:48 davem Exp $ * * Fixes: * Hideaki YOSHIFUJI : sin6_scope_id support @@ -119,6 +119,15 @@ } sk->num = snum; + if (sk->pprev == NULL) { + struct sock **skp = &udp_hash[snum & (UDP_HTABLE_SIZE - 1)]; + if ((sk->next = *skp) != NULL) + (*skp)->pprev = &sk->next; + *skp = sk; + sk->pprev = skp; + sock_prot_inc_use(sk->prot); + sock_hold(sk); + } write_unlock_bh(&udp_hash_lock); return 0; @@ -129,16 +138,7 @@ static void udp_v6_hash(struct sock *sk) { - struct sock **skp = &udp_hash[sk->num & (UDP_HTABLE_SIZE - 1)]; - - write_lock_bh(&udp_hash_lock); - if ((sk->next = *skp) != NULL) - (*skp)->pprev = &sk->next; - *skp = sk; - sk->pprev = skp; - sock_prot_inc_use(sk->prot); - sock_hold(sk); - write_unlock_bh(&udp_hash_lock); + BUG(); } static void udp_v6_unhash(struct sock *sk) @@ -149,6 +149,7 @@ sk->next->pprev = sk->pprev; *sk->pprev = sk->next; sk->pprev = NULL; + sk->num = 0; sock_prot_dec_use(sk->prot); __sock_put(sk); } diff -u --recursive --new-file v2.4.0-test8/linux/net/sunrpc/xprt.c linux/net/sunrpc/xprt.c --- v2.4.0-test8/linux/net/sunrpc/xprt.c Tue Jul 18 12:39:29 2000 +++ linux/net/sunrpc/xprt.c Mon Sep 18 15:19:49 2000 @@ -1037,7 +1037,7 @@ return; /* Wait until we have enough socket memory */ - if (sock_wspace(sk) < min(sk->sndbuf,XPRT_MIN_WRITE_SPACE)) + if (!sock_writeable(sk)) return; spin_lock_bh(&xprt_sock_lock); @@ -1212,9 +1212,6 @@ */ while (1) { xprt->write_space = 0; - status = -ENOMEM; - if (sock_wspace(xprt->inet) < req->rq_slen + SOCK_MIN_WRITE_SPACE) - break; status = xprt_sendmsg(xprt, req); if (status < 0) diff -u --recursive --new-file v2.4.0-test8/linux/net/x25/af_x25.c linux/net/x25/af_x25.c --- v2.4.0-test8/linux/net/x25/af_x25.c Mon Aug 28 21:16:05 2000 +++ linux/net/x25/af_x25.c Sun Sep 17 10:03:43 2000 @@ -21,6 +21,8 @@ * facilities negotiation and increased * the throughput upper limit. * 2000-27-08 Arnaldo C. Melo s/suser/capable/ + micro cleanups + * 2000-04-09 Henner Eisen Set sock->state in x25_accept(). + * Fixed x25_output() related skb leakage. */ #include @@ -721,6 +723,7 @@ kfree_skb(skb); sk->ack_backlog--; newsock->sk = newsk; + newsock->state = SS_CONNECTED; return 0; } @@ -971,7 +974,11 @@ if (msg->msg_flags & MSG_OOB) { skb_queue_tail(&sk->protinfo.x25->interrupt_out_queue, skb); } else { - x25_output(sk, skb); + err = x25_output(sk, skb); + if(err){ + len = err; + kfree_skb(skb); + } } x25_kick(sk); diff -u --recursive --new-file v2.4.0-test8/linux/net/x25/x25_dev.c linux/net/x25/x25_dev.c --- v2.4.0-test8/linux/net/x25/x25_dev.c Mon Aug 23 10:01:02 1999 +++ linux/net/x25/x25_dev.c Sun Sep 17 10:03:43 2000 @@ -14,6 +14,7 @@ * * History * X.25 001 Jonathan Naylor Started coding. + * 2000-09-04 Henner Eisen Prevent freeing a dangling skb. */ #include @@ -78,12 +79,13 @@ return x25_rx_call_request(skb, neigh, lci); /* - * Its not a Call Request, nor is it a control frame, throw it awa + * Its not a Call Request, nor is it a control frame. + * Let caller throw it away. */ /* x25_transmit_clear_request(neigh, lci, 0x0D); */ - kfree_skb(skb); + printk(KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n",frametype); return 0; } diff -u --recursive --new-file v2.4.0-test8/linux/net/x25/x25_link.c linux/net/x25/x25_link.c --- v2.4.0-test8/linux/net/x25/x25_link.c Fri Apr 14 09:38:10 2000 +++ linux/net/x25/x25_link.c Sun Sep 17 10:03:43 2000 @@ -17,6 +17,7 @@ * X.25 002 Jonathan Naylor New timer architecture. * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. + * 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ #include @@ -292,6 +293,7 @@ init_timer(&x25_neigh->t20timer); + dev_hold(dev); x25_neigh->dev = dev; x25_neigh->state = X25_LINK_STATE_0; x25_neigh->extended = 0; @@ -349,8 +351,10 @@ neigh = x25_neigh; x25_neigh = x25_neigh->next; - if (neigh->dev == dev) + if (neigh->dev == dev){ x25_remove_neigh(neigh); + dev_put(dev); + } } } diff -u --recursive --new-file v2.4.0-test8/linux/net/x25/x25_out.c linux/net/x25/x25_out.c --- v2.4.0-test8/linux/net/x25/x25_out.c Tue Feb 10 13:07:49 1998 +++ linux/net/x25/x25_out.c Sun Sep 17 10:03:43 2000 @@ -15,6 +15,7 @@ * History * X.25 001 Jonathan Naylor Started coding. * X.25 002 Jonathan Naylor New timer architecture. + * 2000-09-04 Henner Eisen Prevented x25_output() skb leakage. */ #include @@ -56,7 +57,7 @@ /* * This is where all X.25 information frames pass; */ -void x25_output(struct sock *sk, struct sk_buff *skb) +int x25_output(struct sock *sk, struct sk_buff *skb) { struct sk_buff *skbn; unsigned char header[X25_EXT_MIN_LEN]; @@ -73,9 +74,12 @@ frontlen = skb_headroom(skb); while (skb->len > 0) { - if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 0, 0, &err)) == NULL) - return; - + if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 0, 0, &err)) == NULL){ + int unsent = skb->len - header_len; + SOCK_DEBUG(sk, "x25_output: framgent allocation failed, err=%d, %d bytes unsent\n", err, unsent); + return err; + } + skb_reserve(skbn, frontlen); len = (max_len > skb->len) ? skb->len : max_len; @@ -102,6 +106,7 @@ } else { skb_queue_tail(&sk->write_queue, skb); } + return 0; } /* diff -u --recursive --new-file v2.4.0-test8/linux/scripts/makelst linux/scripts/makelst --- v2.4.0-test8/linux/scripts/makelst Wed Dec 31 16:00:00 1969 +++ linux/scripts/makelst Mon Sep 18 14:59:23 2000 @@ -0,0 +1,21 @@ +#!/bin/bash +# A script to dump mixed source code & assembly +# with correct relocations from System.map +# Requires the following lines in Rules.make. +# +#%.lst: %.c +# $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< +# $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP) +# +# Copyright (C) 2000 IBM Corporation +# Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) +# + +t1=`$3 --syms $2/$1.o | grep .text | grep " F " | head -n 1` +t2=`echo $t1 | gawk '{ print $6 }'` +t3=`grep $t2 $2/System.map` +t4=`echo $t3 | gawk '{ print $1 }'` +t5=`echo $t1 | gawk '{ print $1 }'` +t6=`echo $t4 - $t5 | sed s/a/A/g | sed s/b/B/g | sed s/c/C/g | sed s/d/D/g | sed s/e/E/g | sed s/f/F/g` +t7=`( echo ibase=16 ; echo $t6 ) | bc` +$3 --source --adjust-vma=$t7 $2/$1.o > $2/$1.lst diff -u --recursive --new-file v2.4.0-test8/linux/scripts/ver_linux linux/scripts/ver_linux --- v2.4.0-test8/linux/scripts/ver_linux Tue Dec 14 23:05:03 1999 +++ linux/scripts/ver_linux Sun Sep 17 09:45:06 2000 @@ -10,6 +10,8 @@ uname -a insmod -V 2>&1 | awk 'NR==1 {print "Kernel modules ",$NF}' echo "Gnu C " `gcc --version` +make --version 2>&1 | awk -F, '{print $1}' | awk \ + '/GNU Make/{print "Gnu Make ",$NF}' ld -v 2>&1 | awk -F\) '{print $1}' | awk \ '/BFD/{print "Binutils ",$NF}' ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed -e 's/\.so$//' \