diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS Fri Jul 26 19:58:50 2002
+++ b/CREDITS Fri Jul 26 19:58:50 2002
@@ -1670,6 +1670,7 @@
D: USB Bluetooth driver, USB Skeleton driver
D: bits and pieces of USB core code.
D: PCI Hotplug core, PCI Hotplug Compaq driver modifications
+D: portions of the Linux Security Module (LSM) framework
N: Russell Kroll
E: rkroll@exploits.org
@@ -2155,6 +2156,14 @@
E: tmolina@cox.net
D: bug fixes, documentation, minor hackery
+N: James Morris
+E: jmorris@intercode.com.au
+W: http://www.intercode.com.au/jmorris/
+D: Netfilter, Linux Security Modules (LSM).
+S: PO Box 707
+S: Spit Junction NSW 2088
+S: Australia
+
N: David Mosberger-Tang
E: davidm@hpl.hp.com if IA-64 related, else David.Mosberger@acm.org
D: Linux/Alpha and Linux/ia64
@@ -2649,6 +2658,11 @@
S: 8006 Zuerich
S: Switzerland
+N: Wayne Salamon
+E: wsalamon@tislabs.com
+E: wsalamon@nai.com
+D: portions of the Linux Security Module (LSM) framework and security modules
+
N: Robert Sanders
E: gt8134b@prism.gatech.edu
D: Dosemu
@@ -2775,6 +2789,11 @@
S: Minto, NSW, 2566
S: Australia
+N: Stephen Smalley
+E: sds@tislabs.com
+E: ssmalley@nai.com
+D: portions of the Linux Security Module (LSM) framework and security modules
+
N: Chris Smith
E: csmith@convex.com
D: Read only HPFS filesystem
@@ -3041,6 +3060,11 @@
S: B-3128 Baal
S: Belgium
+N: Chris Vance
+E: cvance@tislabs.com
+E: cvance@nai.com
+D: portions of the Linux Security Module (LSM) framework and security modules
+
N: Petr Vandrovec
E: vandrove@vc.cvut.cz
D: Small contributions to ncpfs
@@ -3272,6 +3296,14 @@
S: 60 Clifton Road
S: Cambridge. CB1 7EG
S: England
+
+N: Chris Wright
+E: chris@wirex.com
+D: hacking on LSM framework and security modules.
+S: c/o WireX
+S: 920 SW 3rd, Ste. 100
+S: Portland, OR 97204
+S: USA
N: Frank Xia
E: qx@math.columbia.edu
diff -Nru a/Documentation/00-INDEX b/Documentation/00-INDEX
--- a/Documentation/00-INDEX Fri Jul 26 19:58:51 2002
+++ b/Documentation/00-INDEX Fri Jul 26 19:58:51 2002
@@ -118,6 +118,8 @@
- summary listing of command line / boot prompt args for the kernel.
kmod.txt
- info on the kernel module loader/unloader (kerneld replacement).
+ldm.txt
+ - a brief description of LDM (Windows Dynamic Disks).
locks.txt
- info on file locking implementations, flock() vs. fcntl(), etc.
logo.gif
diff -Nru a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
--- a/Documentation/DocBook/Makefile Fri Jul 26 19:58:51 2002
+++ b/Documentation/DocBook/Makefile Fri Jul 26 19:58:51 2002
@@ -1,169 +1,161 @@
-BOOKS := wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml \
- kernel-api.sgml parportbook.sgml kernel-hacking.sgml \
- kernel-locking.sgml via-audio.sgml mousedrivers.sgml sis900.sgml \
- deviceiobook.sgml procfs-guide.sgml tulip-user.sgml \
- writing_usb_driver.sgml scsidrivers.sgml
-
-PS := $(patsubst %.sgml, %.ps, $(BOOKS))
-PDF := $(patsubst %.sgml, %.pdf, $(BOOKS))
-HTML := $(patsubst %.sgml, %, $(BOOKS))
-IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig
-EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
-PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
-C-procfs-example = procfs_example.sgml
-
-$(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
-$(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc: doc-progs ;
-
-dochelp:
- @echo ' Linux kernel internal documentation in different formats:'
- @echo ' sgmldocs (SGML), psdocs (Postscript), pdfdocs (PDF), htmldocs (HTML)'
-
-.PHONY: doc-progs
-doc-progs:
- @$(MAKE) -C $(TOPDIR)/scripts doc-progs
-
-$(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
- $(TOPDIR)/scripts/kernel-doc $(TOPDIR)/scripts/docproc
+###
+# This makefile is used to generate the kernel documentation,
+# primarily based on in-line comments in various source files.
+# See Documentation/kernel-doc-nano-HOWTO.txt for instruction in how
+# to ducument the SRC - and how to read it.
+# To add a new book the only step required is to add the book to the
+# list of DOCBOOKS.
+
+DOCBOOKS := wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml \
+ parportbook.sgml kernel-hacking.sgml \
+ kernel-locking.sgml via-audio.sgml mousedrivers.sgml \
+ deviceiobook.sgml procfs-guide.sgml tulip-user.sgml \
+ writing_usb_driver.sgml scsidrivers.sgml sis900.sgml \
+ kernel-api.sgml
+
+###
+# The build process is as follows (targets):
+# (sgmldocs)
+# file.tmpl --> file.sgml +--> file.ps (psdocs)
+# +--> file.pdf (pdfdocs)
+# +--> DIR=file (htmldocs)
+###
+# The targets that may be used.
.PHONY: sgmldocs psdocs pdfdocs htmldocs clean mrproper
+BOOKS := $(addprefix Documentation/DocBook/,$(DOCBOOKS))
sgmldocs: $(BOOKS)
+PS := $(patsubst %.sgml, %.ps, $(BOOKS))
psdocs: $(PS)
+PDF := $(patsubst %.sgml, %.pdf, $(BOOKS))
pdfdocs: $(PDF)
+HTML := $(patsubst %.sgml, %.html, $(BOOKS))
htmldocs: $(HTML)
+###
+#External programs used
+KERNELDOC=$(objtree)/scripts/kernel-doc
+DOCPROC=$(objtree)/scripts/docproc
+
+###
+# DOCPROC is used for two purposes:
+# 1) To generate a dependency list for a .tmpl file
+# 2) To preprocess a .tmpl file and call kernel-doc with
+# appropriate parameters.
+# The following rules are used to generate the .sgml documentation
+# required to generate the final targets. (ps, pdf, html).
+quiet_cmd_docproc = DOCPROC $@
+cmd_docproc = $(DOCPROC) doc $< >$@
+define rule_docproc
+ set -e
+ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';)
+ $(cmd_$(1)); \
+ ( \
+ echo 'cmd_$@ := $(cmd_$(1))'; \
+ echo $@: `$(DOCPROC) depend $<`; \
+ ) > $(dir $@).$(notdir $@).cmd
+endef
+
+%.sgml: %.tmpl FORCE
+ $(call if_changed_rule,docproc)
+
+###
+#Read in all saved dependency files
+cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd))
+
+ifneq ($(cmd_files),)
+ include $(cmd_files)
+endif
+
+###
+# Changes in kernel-doc force a rebuild of all documentation
+$(BOOKS): $(KERNELDOC)
+
+###
+# procfs guide uses a .c file as example code.
+# This requires an explicit dependency
+C-procfs-example = Documentation/DocBook/procfs_example.sgml
+Documentation/DocBook/procfs-guide.sgml: $(C-procfs-example)
+
+###
+# The parportbook includes a few images.
+# Force them to be build before the books
+IMG-parportbook := parport-share.fig parport-multi.fig parport-structure.fig
+IMG-parportbook2 := $(addprefix Documentation/DocBook/,$(IMG-parportbook))
+EPS-parportbook := $(patsubst %.fig,%.eps, $(IMG-parportbook2))
+PNG-parportbook := $(patsubst %.fig,%.png, $(IMG-parportbook2))
+Documentation/DocBook/parportbook.ps: $(EPS-parportbook)
+Documentation/DocBook/parportbook.html Documentation/DocBook/parportbook.pdf:\
+ $(PNG-parportbook)
+
+###
+# Rules to generate postscript, PDF and HTML
+# db2html creates a directory. Generate a html file used for timestamp
+%.ps : %.sgml
+ @(which db2ps > /dev/null 2>&1) || \
+ (echo "*** You need to install DocBook stylesheets ***"; \
+ exit 1)
+ @echo ' DB2PS $@'
+ @db2ps -o $(dir $@) $<
+
+%.pdf : %.sgml
+ @(which db2pdf > /dev/null 2>&1) || \
+ (echo "*** You need to install DocBook stylesheets ***"; \
+ exit 1)
+ @echo ' DB2PDF $@'
+ @db2pdf -o $(dir $@) $<
+
+%.html: %.sgml
+ @(which db2html > /dev/null 2>&1) || \
+ (echo "*** You need to install DocBook stylesheets ***"; \
+ exit 1)
+ @rm -rf $@ $(patsubst %.html,%,$@)
+ @echo ' DB2HTML $@'
+ @db2html -o $(patsubst %.html,%,$@) $< && \
+ echo '\
+ Goto $(patsubst %.html,%,$(notdir $@))
' > $@
+ @if [ ! -z "$(PNG-$(basename $(notdir $@)))" ]; then \
+ cp $(PNG-$(basename $(notdir $@))) $(patsubst %.html,%,$@); fi
+
+###
+# Rules to generate postscripts and PNG imgages from .fig format files
%.eps: %.fig
- fig2dev -Leps $< $@
+ @echo ' FIG2DEV -Leps $@'
+ @fig2dev -Leps $< $@
%.png: %.fig
+ @echo ' FIG2DEV -Lpng $@'
fig2dev -Lpng $< $@
+###
+# Rule to convert a .c file to inline SGML documentation
%.sgml: %.c
- echo "" > $@
- expand --tabs=8 < $< | \
+ @echo ' Generating $@'
+ @echo "" > $@
+ @expand --tabs=8 < $< | \
sed -e "s/&/\\&/g" \
- -e "s/\\</g" \
- -e "s/>/\\>/g" >> $@
- echo "" >> $@
-
-
-mousedrivers.sgml: mousedrivers.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-kernel-hacking.sgml: kernel-hacking.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-kernel-locking.sgml: kernel-locking.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-wanbook.sgml: wanbook.tmpl $(TOPDIR)/drivers/net/wan/syncppp.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/wan/syncppp.c \
- wanbook.sgml
-
-z8530book.sgml: z8530book.tmpl $(TOPDIR)/drivers/net/wan/z85230.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/wan/z85230.c \
- z8530book.sgml
-
-via-audio.sgml: via-audio.tmpl $(TOPDIR)/sound/oss/via82cxxx_audio.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/sound/oss/via82cxxx_audio.c \
- via-audio.sgml
-
-tulip-user.sgml: tulip-user.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-writing_usb_driver.sgml: writing_usb_driver.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-scsidrivers.sgml : scsidrivers.tmpl
- $(TOPDIR)/scripts/docgen <$< >$@
-
-sis900.sgml: sis900.tmpl $(TOPDIR)/drivers/net/sis900.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/net/sis900.c \
- sis900.sgml
-
-deviceiobook.sgml: deviceiobook.tmpl
- $(TOPDIR)/scripts/docgen deviceiobook.sgml
-
-mcabook.sgml: mcabook.tmpl $(TOPDIR)/arch/i386/kernel/mca.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/arch/i386/kernel/mca.c \
- mcabook.sgml
-
-videobook.sgml: videobook.tmpl $(TOPDIR)/drivers/media/video/videodev.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/media/video/videodev.c \
- videobook.sgml
-
-procfs-guide.sgml: procfs-guide.tmpl procfs_example.sgml
- $(TOPDIR)/scripts/docgen < procfs-guide.tmpl >$@
-
-APISOURCES := $(TOPDIR)/drivers/media/video/videodev.c \
- $(TOPDIR)/arch/i386/kernel/irq.c \
- $(TOPDIR)/arch/i386/kernel/mca.c \
- $(TOPDIR)/arch/i386/kernel/mtrr.c \
- $(TOPDIR)/drivers/char/misc.c \
- $(TOPDIR)/kernel/printk.c \
- $(TOPDIR)/drivers/net/net_init.c \
- $(TOPDIR)/drivers/net/8390.c \
- $(TOPDIR)/drivers/char/serial.c \
- $(TOPDIR)/drivers/pci/pci.c \
- $(TOPDIR)/drivers/hotplug/pci_hotplug_core.c \
- $(TOPDIR)/drivers/hotplug/pci_hotplug_util.c \
- $(TOPDIR)/drivers/block/ll_rw_blk.c \
- $(TOPDIR)/sound/sound_core.c \
- $(TOPDIR)/sound/sound_firmware.c \
- $(TOPDIR)/drivers/net/wan/syncppp.c \
- $(TOPDIR)/drivers/net/wan/z85230.c \
- $(TOPDIR)/drivers/usb/core/hcd.c \
- $(TOPDIR)/drivers/usb/core/urb.c \
- $(TOPDIR)/drivers/usb/core/message.c \
- $(TOPDIR)/drivers/usb/core/config.c \
- $(TOPDIR)/drivers/usb/core/file.c \
- $(TOPDIR)/drivers/usb/core/usb.c \
- $(TOPDIR)/drivers/video/fbmem.c \
- $(TOPDIR)/drivers/video/fbcmap.c \
- $(TOPDIR)/drivers/video/fbcon.c \
- $(TOPDIR)/drivers/video/fbgen.c \
- $(TOPDIR)/drivers/video/fonts.c \
- $(TOPDIR)/drivers/video/macmodes.c \
- $(TOPDIR)/drivers/video/modedb.c \
- $(TOPDIR)/fs/devfs/base.c \
- $(TOPDIR)/fs/locks.c \
- $(TOPDIR)/fs/bio.c \
- $(TOPDIR)/include/asm-i386/bitops.h \
- $(TOPDIR)/include/linux/usb.h \
- $(TOPDIR)/kernel/pm.c \
- $(TOPDIR)/kernel/ksyms.c \
- $(TOPDIR)/kernel/kmod.c \
- $(TOPDIR)/kernel/module.c \
- $(TOPDIR)/kernel/printk.c \
- $(TOPDIR)/kernel/sched.c \
- $(TOPDIR)/kernel/sysctl.c \
- $(TOPDIR)/lib/string.c \
- $(TOPDIR)/lib/vsprintf.c \
- $(TOPDIR)/net/netsyms.c
-
-kernel-api.sgml: kernel-api.tmpl $(APISOURCES)
- $(TOPDIR)/scripts/docgen $(APISOURCES) \
- kernel-api.sgml
-
-kernel-api-man: $(APISOURCES)
- @rm -rf $(TOPDIR)/Documentation/man
- $(TOPDIR)/scripts/kernel-doc -man $^ | \
- $(PERL) $(TOPDIR)/scripts/split-man $(TOPDIR)/Documentation/man
-
-parportbook parportbook.pdf: $(PNG-parportbook)
-parportbook.ps: $(EPS-parportbook)
-parportbook.sgml: parportbook.tmpl $(TOPDIR)/drivers/parport/init.c
- $(TOPDIR)/scripts/docgen $(TOPDIR)/drivers/parport/init.c <$< >$@
-
-DVI := $(patsubst %.sgml, %.dvi, $(BOOKS))
-AUX := $(patsubst %.sgml, %.aux, $(BOOKS))
-TEX := $(patsubst %.sgml, %.tex, $(BOOKS))
-LOG := $(patsubst %.sgml, %.log, $(BOOKS))
-OUT := $(patsubst %.sgml, %.out, $(BOOKS))
+ -e "s/\\</g" \
+ -e "s/>/\\>/g" >> $@
+ @echo "" >> $@
+
+###
+# Help targets as used by the top-level makefile
+dochelp:
+ @echo ' Linux kernel internal documentation in different formats:'
+ @echo ' sgmldocs (SGML), psdocs (Postscript), pdfdocs (PDF), htmldocs (HTML)'
+
+###
+# clean and mrproper as used by the top-level makefile
+# Temporary files left by various tools
+DVI := $(patsubst %.sgml, %.dvi, $(BOOKS))
+AUX := $(patsubst %.sgml, %.aux, $(BOOKS))
+TEX := $(patsubst %.sgml, %.tex, $(BOOKS))
+LOG := $(patsubst %.sgml, %.log, $(BOOKS))
+OUT := $(patsubst %.sgml, %.out, $(BOOKS))
clean:
@echo 'Cleaning up (DocBook)'
@@ -176,37 +168,7 @@
mrproper:
@echo 'Making mrproper (DocBook)'
@rm -f $(PS) $(PDF)
- @rm -f -r $(HTML)
- @rm -f .depend
- @rm -f $(TOPDIR)/scripts/mkdep-docbook
- @rm -rf DBTOHTML_OUTPUT*
-
-%.ps : %.sgml
- @(which db2ps > /dev/null 2>&1) || \
- (echo "*** You need to install DocBook stylesheets ***"; \
- exit 1)
- db2ps $<
-
-%.pdf : %.sgml
- @(which db2pdf > /dev/null 2>&1) || \
- (echo "*** You need to install DocBook stylesheets ***"; \
- exit 1)
- db2pdf $<
-
-%: %.sgml
- @(which db2html > /dev/null 2>&1) || \
- (echo "*** You need to install DocBook stylesheets ***"; \
- exit 1)
- rm -rf $@
- db2html $<
- if [ ! -z "$(PNG-$@)" ]; then cp $(PNG-$@) $@; fi
-
-#
-# we could have our own dependency generator
-#
-#
-# .depend: $(TOPDIR)/scripts/mkdep-docbook
-# $(TOPDIR)/scripts/mkdep-docbook $(wildcard *.tmpl) > .depend
+ @rm -f -r $(HTML) $(patsubst %.html,%,$(HTML))
include $(TOPDIR)/Rules.make
diff -Nru a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
--- a/Documentation/DocBook/kernel-api.tmpl Fri Jul 26 19:58:50 2002
+++ b/Documentation/DocBook/kernel-api.tmpl Fri Jul 26 19:58:50 2002
@@ -50,7 +50,7 @@
kernel/sched.c has no docs, which stuffs up the sgml. Comment
out until somebody adds docs. KAO
Delaying, scheduling, and timer routines
-!Ekernel/sched.c
+X!Ekernel/sched.c
KAO -->
@@ -305,7 +305,8 @@
16x50 UART Driver
-!Edrivers/char/serial.c
+!Edrivers/serial/core.c
+!Edrivers/serial/8250.c
@@ -366,7 +367,7 @@
drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
out until somebody adds docs. KAO
Frame Buffer Generic Functions
-!Idrivers/video/fbgen.c
+X!Idrivers/video/fbgen.c
KAO -->
Frame Buffer Video Mode Database
@@ -380,5 +381,9 @@
!Idrivers/video/fonts.c
-
+
diff -Nru a/Documentation/DocBook/parportbook.tmpl b/Documentation/DocBook/parportbook.tmpl
--- a/Documentation/DocBook/parportbook.tmpl Fri Jul 26 19:58:50 2002
+++ b/Documentation/DocBook/parportbook.tmpl Fri Jul 26 19:58:50 2002
@@ -2729,7 +2729,9 @@
-
+
diff -Nru a/Documentation/cli-sti-removal.txt b/Documentation/cli-sti-removal.txt
--- a/Documentation/cli-sti-removal.txt Fri Jul 26 19:58:51 2002
+++ b/Documentation/cli-sti-removal.txt Fri Jul 26 19:58:51 2002
@@ -96,8 +96,8 @@
drivers that want to disable local interrupts (interrupts on the
current CPU), can use the following five macros:
- local_irq_disable(), local_irq_enable(), local_irq_save(flags),
- local_irq_save_off(flags), local_irq_restore(flags)
+ local_irq_disable(), local_irq_enable(), local_save_flags(flags),
+ local_irq_save(flags), local_irq_restore(flags)
but beware, their meaning and semantics are much simpler, far from
that of the old cli(), sti(), save_flags(flags) and restore_flags(flags)
@@ -107,11 +107,11 @@
local_irq_enable() => turn local IRQs on
- local_irq_save(flags) => save the current IRQ state into flags. The
+ local_save_flags(flags) => save the current IRQ state into flags. The
state can be on or off. (on some
architectures there's even more bits in it.)
- local_irq_save_off(flags) => save the current IRQ state into flags and
+ local_irq_save(flags) => save the current IRQ state into flags and
disable interrupts.
local_irq_restore(flags) => restore the IRQ state from flags.
diff -Nru a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt
--- a/Documentation/input/input-programming.txt Fri Jul 26 19:58:50 2002
+++ b/Documentation/input/input-programming.txt Fri Jul 26 19:58:50 2002
@@ -23,6 +23,7 @@
static void button_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1);
+ input_sync(&button_dev);
}
static int __init button_init(void)
@@ -86,12 +87,21 @@
which upon every interrupt from the button checks its state and reports it
via the
- input_report_btn()
+ input_report_key()
call to the input system. There is no need to check whether the interrupt
routine isn't reporting two same value events (press, press for example) to
the input system, because the input_report_* functions check that
themselves.
+
+Then there is the
+
+ input_sync()
+
+call to tell those who receive the events that we've sent a complete report.
+This doesn't seem important in the one button case, but is quite important
+for for example mouse movement, where you don't want the X and Y values
+to be interpreted separately, because that'd result in a different movement.
1.2 dev->open() and dev->close()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff -Nru a/Documentation/input/input.txt b/Documentation/input/input.txt
--- a/Documentation/input/input.txt Fri Jul 26 19:58:51 2002
+++ b/Documentation/input/input.txt Fri Jul 26 19:58:51 2002
@@ -207,7 +207,7 @@
these. You'll need ImPS/2 if you want to make use of a wheel on a USB
mouse and ExplorerPS/2 if you want to use extra (up to 5) buttons.
-3.2.3 joydev.c
+3.2.3 joydev.o
~~~~~~~~~~~~~~
Joydev implements v0.x and v1.x Linux joystick api, much like
drivers/char/joystick/joystick.c used to in earlier versions. See
diff -Nru a/Documentation/input/xpad.txt b/Documentation/input/xpad.txt
--- a/Documentation/input/xpad.txt Fri Jul 26 19:58:52 2002
+++ b/Documentation/input/xpad.txt Fri Jul 26 19:58:52 2002
@@ -1,8 +1,11 @@
-usb-xpad - Linux USB driver for XBOX HID gamecontrollers
+xpad - Linux USB driver for X-Box gamepads
-This is the very first release of a driver for XBOX gamecontrollers.
+This is the very first release of a driver for X-Box gamepads.
Basically, this was hacked away in just a few hours, so don't expect
miracles.
+In particular, there is currently NO support for the rumble pack.
+You won't find many ff-aware linux applications anyway.
+
0. Status
---------
@@ -14,31 +17,38 @@
8 axes and 10 buttons.
Alls 8 axes work, though they all have the same range (-32768..32767)
-and the zero-setting is not correct for the triggers.
-9 of the 10 buttons work (my black button does not work, though I can
-see no reason for it not to), all of them are in digital mode, though
-(the six buttons on the right side are "analog" ones).
+and the zero-setting is not correct for the triggers (I don't know if that
+is some limitation of jstest, since the input device setup should be fine. I
+didn't have a look at jstest itself yet).
+
+All of the 10 buttons work (in digital mode). The six buttons on the
+right side (A, B, X, Y, black, white) are said to be "analog" and
+report their values as 8 bit unsigned, not sure what this is good for.
+
+I tested the controller with quake3, and configuration and
+in game functionality were OK. However, I find it rather difficult to
+play first person shooters with a pad. Your mileage may vary.
1. USB adapter
--------------
Before you can actually use the driver, you need to get yourself an
-adapter cable to connect the XBOX-controller to your Linux-Box.
+adapter cable to connect the X-Box controller to your Linux-Box.
-Such a cable is pretty easy to build. The Controller itself is a USB device
-(a hub with three ports; two expansion slots and the controller device)
-with the only differnce in a nonstandard connector (5 pins vs. 4 on
+Such a cable is pretty easy to build. The Controller itself is a USB compound
+device (a hub with three ports for two expansion slots and the controller
+device) with the only difference in a nonstandard connector (5 pins vs. 4 on
standard USB connector).
-You just need to solder an USB connector onto the cable and keep the
+You just need to solder a USB connector onto the cable and keep the
yellow wire unconnected. The other pins have the same order on both
-connectors so there no magic to it. Detailed info on these matters can be found
-on the net.
+connectors so there is no magic to it. Detailed info on these matters
+can be found on the net ([1], [2], [3]).
Thanks to the trip splitter found on the cable you don't even need to cut the
-original cable, you can buy an extension cable and cut that instead. That way,
-you can still use the controller with your XBOX, if you have one ;)
+original one. You can buy an extension cable and cut that instead. That way,
+you can still use the controller with your X-Box, if you have one ;)
2. driver installation
@@ -46,22 +56,26 @@
Once you have the adapter cable and the controller is connected, you need
to load your USB subsystem and should cat /proc/bus/usb/devices.
-There should be an entry like the one in InterAct_german.dump.
+There should be an entry like the one at the end [4].
-Don't worry if the vendor and/or product ID don't match, those are easy to
-add to the driver. You could do it yourself, just add the appropriate line
-into the list after the line
- '} xpad_device[] = {'
-, but before the line that says
- '{ 0x0000, 0x0000, "unknown...." }'.
+Currently (as of version 0.0.4), the following three devices are included:
+ original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202
+ original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285
+ InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a
+
+If you have another controller that is not listed above and is not recognized
+by the driver, please drop me a line with the appropriate info (that is, include
+the name, vendor and product ID, as well as the country where you bought it;
+sending the whole dump out of /proc/bus/usb/devices along would be even better).
In theory, the driver should work with other controllers than mine
-(InterAct PowerPad pro, bought in Germany) just fine, but see for yourself.
+(InterAct PowerPad pro, bought in Germany) just fine, but I cannot test this
+for I only have this one controller.
If you compiled and installed the driver, test the functionality:
-> modprobe usb-xpad
+> modprobe xpad
> modprobe joydev
-> jstest /dev/input/js0
+> jstest /dev/js0
There should be a single line showing 18 inputs (8 axes, 10 buttons), and
it's values should change if you move the sticks and push the buttons.
@@ -76,9 +90,27 @@
http://euc.jp/periphs/xbox-controller.ja.html.
His useful info and both the usb-skeleton as well as the iforce input driver
-helped a lot in rapid prototyping the basic functionality.
+(Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototyping
+the basic functionality.
+
+
+4. References
+-------------
+1. http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki)
+2. http://xpad.xbox-scene.com/
+3. http://www.xboxhackz.com/Hackz-Reference.htm
+
+4. /proc/bus/usb/devices - dump from InterAct PowerPad Pro (Germany):
+
+T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
+D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs= 1
+P: Vendor=05fd ProdID=107a Rev= 1.00
+C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
+I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none)
+E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms
+E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms
--
Marko Friedemann
-2002-07-02
+2002-07-16
diff -Nru a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
--- a/Documentation/kernel-doc-nano-HOWTO.txt Fri Jul 26 19:58:51 2002
+++ b/Documentation/kernel-doc-nano-HOWTO.txt Fri Jul 26 19:58:51 2002
@@ -20,18 +20,14 @@
- scripts/docproc.c
This is a program for converting SGML template files into SGML
- files. It invokes kernel-doc, giving it the list of functions that
+ files. When a file is referenced it is searched for symbols
+ exported (EXPORT_SYMBOL), to be able to distingush between internal
+ and external functions.
+ It invokes kernel-doc, giving it the list of functions that
are to be documented.
-
-- scripts/gen-all-syms
-
- This is a script that lists the EXPORT_SYMBOL symbols in a list of C
- files.
-
-- scripts/docgen
-
- This script invokes docproc, telling it which functions are to be
- documented (this list comes from gen-all-syms).
+ Additionally it is used to scan the SGML template files to locate
+ all the files referenced herein. This is used to generate dependency
+ information as used by make.
- Makefile
@@ -141,6 +137,10 @@
!I is replaced by the documentation for functions that are
_not_ exported using EXPORT_SYMBOL.
+
+!D is used to name additional files to search for functions
+exported using EXPORT_SYMBOL. For example many symbols are only exported
+in kernel/ksyms.c, therefore kernel-api.sgml include this file with !D.
!F is replaced by the
documentation, in , for the functions listed.
diff -Nru a/Documentation/ldm.txt b/Documentation/ldm.txt
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/Documentation/ldm.txt Fri Jul 26 19:58:52 2002
@@ -0,0 +1,102 @@
+
+ LDM - Logical Disk Manager (Dynamic Disks)
+ ------------------------------------------
+
+Overview
+--------
+
+Windows 2000 and XP use a new partitioning scheme. It is a complete
+replacement for the MSDOS style partitions. It stores its information in a
+1MiB journalled database at the end of the physical disk. The size of
+partitions is limited only by disk space. The maximum number of partitions is
+nearly 2000.
+
+Any partitions created under the LDM are called "Dynamic Disks". There are no
+longer any primary or extended partitions. Normal MSDOS style partitions are
+now known as Basic Disks.
+
+If you wish to use Spanned, Striped, Mirrored or RAID 5 Volumes, you must use
+Dynamic Disks. The journalling allows Windows to make changes to these
+partitions and filesystems without the need to reboot.
+
+Once the LDM driver has divided up the disk, you can use the MD driver to
+assemble any multi-partition volumes, e.g. Stripes, RAID5.
+
+To prevent legacy applications from repartitioning the disk, the LDM creates a
+dummy MSDOS partition containing one disk-sized partition.
+
+
+Example
+-------
+
+Below we have a 50MiB disk, divided into seven partitions.
+N.B. The missing 1MiB at the end of the disk is where the LDM database is
+ stored.
+
+ Device | Offset Bytes Sectors MiB | Size Bytes Sectors MiB
+ -------+----------------------------+---------------------------
+ hda | 0 0 0 | 52428800 102400 50
+ hda1 | 51380224 100352 49 | 1048576 2048 1
+ hda2 | 16384 32 0 | 6979584 13632 6
+ hda3 | 6995968 13664 6 | 10485760 20480 10
+ hda4 | 17481728 34144 16 | 4194304 8192 4
+ hda5 | 21676032 42336 20 | 5242880 10240 5
+ hda6 | 26918912 52576 25 | 10485760 20480 10
+ hda7 | 37404672 73056 35 | 13959168 27264 13
+
+The LDM Database may not store the partitions in the order that they appear on
+disk, but the driver will sort them.
+
+When Linux boots, you will see something like:
+
+ hda: 102400 sectors w/32KiB Cache, CHS=50/64/32
+ hda: [LDM] hda1 hda2 hda3 hda4 hda5 hda6 hda7
+
+
+Compiling LDM Support
+---------------------
+
+To enable LDM, choose the following two options:
+
+ "Advanced partition selection" CONFIG_PARTITION_ADVANCED
+ "Windows Logical Disk Manager (Dynamic Disk) support" CONFIG_LDM_PARTITION
+
+If you believe the driver isn't working as it should, you can enable the extra
+debugging code. This will produce a LOT of output. The option is:
+
+ "Windows LDM extra logging" CONFIG_LDM_DEBUG
+
+N.B. The partition code cannot be compiled as a module.
+
+As with all the partition code, if the driver doesn't see signs of its type of
+partition, it will pass control to another driver, so there is no harm in
+enabling it.
+
+If you have Dynamic Disks but don't enable the driver, then all you will see
+is a dummy MSDOS partition filling the whole disk. You won't be able to mount
+any of the volumes on the disk.
+
+
+Booting
+-------
+
+If you enable LDM support, then lilo is capable of booting from any of the
+discovered partitions. However, grub does not understand the LDM partitioning
+and cannot boot from a Dynamic Disk.
+
+
+More Documentation
+------------------
+
+There is an Overview of the LDM online together with complete Technical
+Documentation. It can also be downloaded in html.
+
+ http://linux-ntfs.sourceforge.net/ldm/index.html
+ http://linux-ntfs.sourceforge.net/downloads.html
+
+If you have any LDM questions that aren't answered on the website, email me.
+
+Cheers,
+ FlatCap - Richard Russon
+ ldm@flatcap.org
+
diff -Nru a/Documentation/serial/driver b/Documentation/serial/driver
--- a/Documentation/serial/driver Fri Jul 26 19:58:50 2002
+++ b/Documentation/serial/driver Fri Jul 26 19:58:50 2002
@@ -120,7 +120,7 @@
TTY stop to the driver (equiv to rs_stop).
Locking: port->lock taken.
- Interrupts: caller dependent.
+ Interrupts: locally disabled.
This call must not sleep
start_tx(port,tty_start)
diff -Nru a/Makefile b/Makefile
--- a/Makefile Fri Jul 26 19:58:50 2002
+++ b/Makefile Fri Jul 26 19:58:50 2002
@@ -1,6 +1,6 @@
VERSION = 2
PATCHLEVEL = 5
-SUBLEVEL = 28
+SUBLEVEL = 29
EXTRAVERSION =
# *DOCUMENTATION*
@@ -166,6 +166,15 @@
help tags TAGS sgmldocs psdocs pdfdocs htmldocs \
checkconfig checkhelp checkincludes
+# Helpers built in scripts/
+# ---------------------------------------------------------------------------
+
+scripts/docproc scripts/fixdep scripts/split-include : scripts ;
+
+.PHONY: scripts
+scripts:
+ @$(MAKE) -C scripts
+
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# Here goes the main Makefile
@@ -212,7 +221,7 @@
CPPFLAGS := -D__KERNEL__ -I$(HPATH)
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -g \
+CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-fomit-frame-pointer -fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
@@ -357,15 +366,6 @@
) > $@.tmp
@$(update-if-changed)
-# Helpers built in scripts/
-# ---------------------------------------------------------------------------
-
-scripts/fixdep scripts/split-include : scripts ;
-
-.PHONY: scripts
-scripts:
- @$(MAKE) -C scripts
-
# Generate module versions
# ---------------------------------------------------------------------------
@@ -650,7 +650,7 @@
-name .\*.tmp -o -name .\*.d \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
@rm -f $(CLEAN_FILES)
- @$(MAKE) -C Documentation/DocBook clean
+ @$(MAKE) -f Documentation/DocBook/Makefile clean
mrproper: clean archmrproper
@echo 'Making mrproper'
@@ -659,7 +659,7 @@
-type f -print | xargs rm -f
@rm -f $(MRPROPER_FILES)
@rm -rf $(MRPROPER_DIRS)
- @$(MAKE) -C Documentation/DocBook mrproper
+ @$(MAKE) -f Documentation/DocBook/Makefile mrproper
distclean: mrproper
@echo 'Making distclean'
@@ -732,10 +732,8 @@
# Documentation targets
# ---------------------------------------------------------------------------
-
-sgmldocs psdocs pdfdocs htmldocs:
- @$(MAKE) -C Documentation/DocBook $@
-
+sgmldocs psdocs pdfdocs htmldocs: scripts
+ @$(MAKE) -f Documentation/DocBook/Makefile $@
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
diff -Nru a/arch/alpha/config.in b/arch/alpha/config.in
--- a/arch/alpha/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/alpha/config.in Fri Jul 26 19:58:51 2002
@@ -283,9 +283,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -393,4 +393,5 @@
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/arm/config.in b/arch/arm/config.in
--- a/arch/arm/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/arm/config.in Fri Jul 26 19:58:50 2002
@@ -529,9 +529,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -658,4 +658,5 @@
dep_bool ' Kernel low-level debugging messages via UART2' CONFIG_DEBUG_CLPS711X_UART2 $CONFIG_DEBUG_LL $CONFIG_ARCH_CLPS711X
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/cris/config.in b/arch/cris/config.in
--- a/arch/cris/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/cris/config.in Fri Jul 26 19:58:51 2002
@@ -228,5 +228,7 @@
int ' Profile shift count' CONFIG_PROFILE_SHIFT 2
fi
-source lib/Config.in
endmenu
+
+source security/Config.in
+source lib/Config.in
diff -Nru a/arch/i386/config.in b/arch/i386/config.in
--- a/arch/i386/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/i386/config.in Fri Jul 26 19:58:51 2002
@@ -298,18 +298,10 @@
source drivers/block/Config.in
-source drivers/md/Config.in
-
-if [ "$CONFIG_NET" = "y" ]; then
- source net/Config.in
-fi
-
-source drivers/telephony/Config.in
-
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL device support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL device support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -319,15 +311,32 @@
endmenu
mainmenu_option next_comment
-comment 'SCSI support'
+comment 'SCSI device support'
-tristate 'SCSI support' CONFIG_SCSI
+tristate 'SCSI device support' CONFIG_SCSI
if [ "$CONFIG_SCSI" != "n" ]; then
source drivers/scsi/Config.in
fi
endmenu
+mainmenu_option next_comment
+comment 'Old non-SCSI/ATAPI CD-ROM drives'
+
+bool 'Support non-SCSI/ATAPI CDROM drives' CONFIG_CD_NO_IDESCSI
+if [ "$CONFIG_CD_NO_IDESCSI" != "n" ]; then
+ source drivers/cdrom/Config.in
+fi
+endmenu
+
+source drivers/md/Config.in
+
+if [ "$CONFIG_NET" = "y" ]; then
+ source net/Config.in
+fi
+
+source drivers/telephony/Config.in
+
source drivers/message/fusion/Config.in
source drivers/ieee1394/Config.in
@@ -353,15 +362,6 @@
source net/irda/Config.in
source drivers/isdn/Config.in
-
-mainmenu_option next_comment
-comment 'Old CD-ROM drivers (not SCSI, not IDE)'
-
-bool 'Support non-SCSI/IDE/ATAPI CDROM drives' CONFIG_CD_NO_IDESCSI
-if [ "$CONFIG_CD_NO_IDESCSI" != "n" ]; then
- source drivers/cdrom/Config.in
-fi
-endmenu
#
# input before char - char/joystick depends on it. As does USB.
diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
--- a/arch/i386/kernel/apic.c Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/apic.c Fri Jul 26 19:58:51 2002
@@ -796,9 +796,9 @@
apic_write_around(APIC_TMICT, clocks/APIC_DIVISOR);
}
-void setup_APIC_timer(void * data)
+static void setup_APIC_timer(unsigned int clocks)
{
- unsigned int clocks = (unsigned int) data, slice, t0, t1;
+ unsigned int slice, t0, t1;
unsigned long flags;
int delta;
@@ -924,7 +924,7 @@
int dont_use_local_apic_timer __initdata = 0;
-void __init setup_APIC_clocks (void)
+void __init setup_boot_APIC_clock(void)
{
/* Disabled by DMI scan or kernel option? */
if (dont_use_local_apic_timer)
@@ -939,12 +939,16 @@
/*
* Now set up the timer for real.
*/
- setup_APIC_timer((void *)calibration_result);
+ setup_APIC_timer(calibration_result);
local_irq_enable();
+}
- /* and update all other cpus */
- smp_call_function(setup_APIC_timer, (void *)calibration_result, 1, 1);
+void __init setup_secondary_APIC_clock(void)
+{
+ local_irq_disable(); /* FIXME: Do we need this? --RR */
+ setup_APIC_timer(calibration_result);
+ local_irq_enable();
}
void __init disable_APIC_timer(void)
@@ -1177,7 +1181,7 @@
if (!skip_ioapic_setup && nr_ioapics)
setup_IO_APIC();
#endif
- setup_APIC_clocks();
+ setup_boot_APIC_clock();
return 0;
}
diff -Nru a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
--- a/arch/i386/kernel/apm.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/apm.c Fri Jul 26 19:58:50 2002
@@ -1589,7 +1589,7 @@
p = buf;
- if ((num_online_cpus() == 1) &&
+ if ((num_possible_cpus() == 1) &&
!(error = apm_get_power_status(&bx, &cx, &dx))) {
ac_line_status = (bx >> 8) & 0xff;
battery_status = bx & 0xff;
@@ -1720,7 +1720,7 @@
}
}
- if (debug && (num_online_cpus() == 1)) {
+ if (debug && (num_possible_cpus() == 1)) {
error = apm_get_power_status(&bx, &cx, &dx);
if (error)
printk(KERN_INFO "apm: power status not available\n");
@@ -1764,7 +1764,7 @@
pm_power_off = apm_power_off;
register_sysrq_key('o', &sysrq_poweroff_op);
- if (num_online_cpus() == 1) {
+ if (num_possible_cpus() == 1) {
#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
console_blank_hook = apm_console_blank;
#endif
@@ -1907,9 +1907,7 @@
printk(KERN_NOTICE "apm: disabled on user request.\n");
return -ENODEV;
}
- /* FIXME: When boot code changes, this will need to be
- deactivated when/if a CPU comes up --RR */
- if ((num_online_cpus() > 1) && !power_off) {
+ if ((num_possible_cpus() > 1) && !power_off) {
printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n");
return -ENODEV;
}
@@ -1924,35 +1922,38 @@
* that extends up to the end of page zero (that we have reserved).
* This is for buggy BIOS's that refer to (real mode) segment 0x40
* even though they are called in protected mode.
+ *
+ * NOTE: on SMP we call into the APM BIOS only on CPU#0, so it's
+ * enough to modify CPU#0's GDT.
*/
- set_base(gdt[APM_40 >> 3],
+ set_base(cpu_gdt_table[0][APM_40 >> 3],
__va((unsigned long)0x40 << 4));
- _set_limit((char *)&gdt[APM_40 >> 3], 4095 - (0x40 << 4));
+ _set_limit((char *)&cpu_gdt_table[0][APM_40 >> 3], 4095 - (0x40 << 4));
apm_bios_entry.offset = apm_info.bios.offset;
apm_bios_entry.segment = APM_CS;
- set_base(gdt[APM_CS >> 3],
+ set_base(cpu_gdt_table[0][APM_CS >> 3],
__va((unsigned long)apm_info.bios.cseg << 4));
- set_base(gdt[APM_CS_16 >> 3],
+ set_base(cpu_gdt_table[0][APM_CS_16 >> 3],
__va((unsigned long)apm_info.bios.cseg_16 << 4));
- set_base(gdt[APM_DS >> 3],
+ set_base(cpu_gdt_table[0][APM_DS >> 3],
__va((unsigned long)apm_info.bios.dseg << 4));
#ifndef APM_RELAX_SEGMENTS
if (apm_info.bios.version == 0x100) {
#endif
/* For ASUS motherboard, Award BIOS rev 110 (and others?) */
- _set_limit((char *)&gdt[APM_CS >> 3], 64 * 1024 - 1);
+ _set_limit((char *)&cpu_gdt_table[0][APM_CS >> 3], 64 * 1024 - 1);
/* For some unknown machine. */
- _set_limit((char *)&gdt[APM_CS_16 >> 3], 64 * 1024 - 1);
+ _set_limit((char *)&cpu_gdt_table[0][APM_CS_16 >> 3], 64 * 1024 - 1);
/* For the DEC Hinote Ultra CT475 (and others?) */
- _set_limit((char *)&gdt[APM_DS >> 3], 64 * 1024 - 1);
+ _set_limit((char *)&cpu_gdt_table[0][APM_DS >> 3], 64 * 1024 - 1);
#ifndef APM_RELAX_SEGMENTS
} else {
- _set_limit((char *)&gdt[APM_CS >> 3],
+ _set_limit((char *)&cpu_gdt_table[0][APM_CS >> 3],
(apm_info.bios.cseg_len - 1) & 0xffff);
- _set_limit((char *)&gdt[APM_CS_16 >> 3],
+ _set_limit((char *)&cpu_gdt_table[0][APM_CS_16 >> 3],
(apm_info.bios.cseg_16_len - 1) & 0xffff);
- _set_limit((char *)&gdt[APM_DS >> 3],
+ _set_limit((char *)&cpu_gdt_table[0][APM_DS >> 3],
(apm_info.bios.dseg_len - 1) & 0xffff);
}
#endif
@@ -1963,9 +1964,7 @@
kernel_thread(apm, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
- /* FIXME: When boot code changes, this will need to be
- deactivated when/if a CPU comes up --RR */
- if (num_online_cpus() > 1) {
+ if (num_possible_cpus() > 1) {
printk(KERN_NOTICE
"apm: disabled - APM is not SMP safe (power off active).\n");
return 0;
diff -Nru a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/cpu/common.c Fri Jul 26 19:58:50 2002
@@ -421,14 +421,14 @@
*/
void __init cpu_init (void)
{
- int nr = smp_processor_id();
- struct tss_struct * t = &init_tss[nr];
+ int cpu = smp_processor_id();
+ struct tss_struct * t = init_tss + cpu;
- if (test_and_set_bit(nr, &cpu_initialized)) {
- printk(KERN_WARNING "CPU#%d already initialized!\n", nr);
+ if (test_and_set_bit(cpu, &cpu_initialized)) {
+ printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
for (;;) local_irq_enable();
}
- printk(KERN_INFO "Initializing CPU#%d\n", nr);
+ printk(KERN_INFO "Initializing CPU#%d\n", cpu);
if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
@@ -441,7 +441,17 @@
}
#endif
- __asm__ __volatile__("lgdt %0": "=m" (gdt_descr));
+ /*
+ * Initialize the per-CPU GDT with the boot GDT,
+ * and set up the GDT descriptor:
+ */
+ if (cpu) {
+ memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE);
+ cpu_gdt_descr[cpu].size = GDT_SIZE;
+ cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu];
+ }
+
+ __asm__ __volatile__("lgdt %0": "=m" (cpu_gdt_descr[cpu]));
__asm__ __volatile__("lidt %0": "=m" (idt_descr));
/*
@@ -450,18 +460,18 @@
__asm__("pushfl ; andl $0xffffbfff,(%esp) ; popfl");
/*
- * set up and load the per-CPU TSS and LDT
+ * Set up and load the per-CPU TSS and LDT
*/
atomic_inc(&init_mm.mm_count);
current->active_mm = &init_mm;
if(current->mm)
BUG();
- enter_lazy_tlb(&init_mm, current, nr);
+ enter_lazy_tlb(&init_mm, current, cpu);
t->esp0 = current->thread.esp0;
- set_tss_desc(nr,t);
- gdt_table[__TSS(nr)].b &= 0xfffffdff;
- load_TR(nr);
+ set_tss_desc(cpu,t);
+ cpu_gdt_table[cpu][TSS_ENTRY].b &= 0xfffffdff;
+ load_TR_desc();
load_LDT(&init_mm.context);
/* Clear %fs and %gs. */
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/entry.S Fri Jul 26 19:58:51 2002
@@ -417,7 +417,6 @@
ENTRY(device_not_available)
pushl $-1 # mark this as an int
SAVE_ALL
- GET_THREAD_INFO(%ebx)
movl %cr0, %eax
testl $0x4, %eax # EM (math emulation bit)
jne device_not_available_emulate
@@ -753,6 +752,7 @@
.long sys_futex /* 240 */
.long sys_sched_setaffinity
.long sys_sched_getaffinity
+ .long sys_set_thread_area
.rept NR_syscalls-(.-sys_call_table)/4
.long sys_ni_syscall
diff -Nru a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/head.S Fri Jul 26 19:58:50 2002
@@ -231,7 +231,7 @@
call check_x87
incb ready
- lgdt gdt_descr
+ lgdt cpu_gdt_descr
lidt idt_descr
ljmp $(__KERNEL_CS),$1f
1: movl $(__KERNEL_DS),%eax # reload all the segment registers
@@ -338,29 +338,28 @@
iret
/*
- * The interrupt descriptor table has room for 256 idt's,
- * the global descriptor table is dependent on the number
- * of tasks we can have..
+ * The IDT and GDT 'descriptors' are a strange 48-bit object
+ * only used by the lidt and lgdt instructions. They are not
+ * like usual segment descriptors - they consist of a 16-bit
+ * segment size, and 32-bit linear address value:
*/
-#define IDT_ENTRIES 256
-#define GDT_ENTRIES (__TSS(NR_CPUS))
-
-.globl idt
-.globl gdt
+.globl idt_descr
+.globl cpu_gdt_descr
ALIGN
- .word 0
+ .word 0 # 32-bit align idt_desc.address
idt_descr:
.word IDT_ENTRIES*8-1 # idt contains 256 entries
-idt:
.long idt_table
- .word 0
-gdt_descr:
+# boot GDT descriptor (later on used by CPU#0):
+
+cpu_gdt_descr:
.word GDT_ENTRIES*8-1
-gdt:
- .long gdt_table
+ .long cpu_gdt_table
+
+ .fill NR_CPUS-1,6,0 # space for the other GDT descriptors
/*
* This is initialized to create an identity-mapping at 0-8M (for bootup
@@ -413,20 +412,17 @@
ALIGN
/*
- * This contains typically 140 quadwords, depending on NR_CPUS.
- *
- * NOTE! Make sure the gdt descriptor in head.S matches this if you
- * change anything.
+ * The Global Descriptor Table contains 20 quadwords, per-CPU.
*/
-ENTRY(gdt_table)
+ENTRY(cpu_gdt_table)
.quad 0x0000000000000000 /* NULL descriptor */
- .quad 0x0000000000000000 /* not used */
+ .quad 0x0000000000000000 /* TLS descriptor */
.quad 0x00cf9a000000ffff /* 0x10 kernel 4GB code at 0x00000000 */
.quad 0x00cf92000000ffff /* 0x18 kernel 4GB data at 0x00000000 */
.quad 0x00cffa000000ffff /* 0x23 user 4GB code at 0x00000000 */
.quad 0x00cff2000000ffff /* 0x2b user 4GB data at 0x00000000 */
- .quad 0x0000000000000000 /* not used */
- .quad 0x0000000000000000 /* not used */
+ .quad 0x0000000000000000 /* TSS descriptor */
+ .quad 0x0000000000000000 /* LDT descriptor */
/*
* The APM segments have byte granularity and their bases
* and limits are set at run time.
@@ -444,5 +440,8 @@
.quad 0x0000000000000000 /* 0x88 not used */
.quad 0x0000000000000000 /* 0x90 not used */
.quad 0x0000000000000000 /* 0x98 not used */
- /* Per CPU segments */
- .fill NR_CPUS*4,8,0 /* space for TSS's and LDT's */
+
+#if CONFIG_SMP
+ .fill (NR_CPUS-1)*GDT_ENTRIES,8,0 /* other CPU's GDT */
+#endif
+
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/i386_ksyms.c Fri Jul 26 19:58:51 2002
@@ -74,7 +74,6 @@
EXPORT_SYMBOL(pm_power_off);
EXPORT_SYMBOL(get_cmos_time);
EXPORT_SYMBOL(apm_info);
-EXPORT_SYMBOL(gdt);
#ifdef CONFIG_DEBUG_IOVIRT
EXPORT_SYMBOL(__io_virt_debug);
diff -Nru a/arch/i386/kernel/mtrr.c b/arch/i386/kernel/mtrr.c
--- a/arch/i386/kernel/mtrr.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/mtrr.c Fri Jul 26 19:58:50 2002
@@ -1055,7 +1055,7 @@
wait_barrier_cache_disable = TRUE;
wait_barrier_execute = TRUE;
wait_barrier_cache_enable = TRUE;
- atomic_set (&undone_count, num_online_cpus() - 1);
+ atomic_set (&undone_count, num_booting_cpus() - 1);
/* Start the ball rolling on other CPUs */
if (smp_call_function (ipi_handler, &data, 1, 0) != 0)
panic ("mtrr: timed out waiting for other CPUs\n");
@@ -1064,14 +1064,14 @@
/* Wait for all other CPUs to flush and disable their caches */
while (atomic_read (&undone_count) > 0) { rep_nop(); barrier(); }
/* Set up for completion wait and then release other CPUs to change MTRRs*/
- atomic_set (&undone_count, num_online_cpus() - 1);
+ atomic_set (&undone_count, num_booting_cpus() - 1);
wait_barrier_cache_disable = FALSE;
set_mtrr_cache_disable (&ctxt);
/* Wait for all other CPUs to flush and disable their caches */
while (atomic_read (&undone_count) > 0) { rep_nop(); barrier(); }
/* Set up for completion wait and then release other CPUs to change MTRRs*/
- atomic_set (&undone_count, num_online_cpus() - 1);
+ atomic_set (&undone_count, num_booting_cpus() - 1);
wait_barrier_execute = FALSE;
(*set_mtrr_up) (reg, base, size, type, FALSE);
/* Now wait for other CPUs to complete the function */
diff -Nru a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
--- a/arch/i386/kernel/nmi.c Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/nmi.c Fri Jul 26 19:58:51 2002
@@ -72,19 +72,22 @@
int __init check_nmi_watchdog (void)
{
- irq_cpustat_t tmp[NR_CPUS];
+ unsigned int prev_nmi_count[NR_CPUS];
int cpu;
printk(KERN_INFO "testing NMI watchdog ... ");
- memcpy(tmp, irq_stat, sizeof(tmp));
+ for (cpu = 0; cpu < NR_CPUS; cpu++)
+ prev_nmi_count[cpu] = irq_stat[cpu].__nmi_count;
local_irq_enable();
mdelay((10*1000)/nmi_hz); // wait 10 ticks
+ /* FIXME: Only boot CPU is online at this stage. Check CPUs
+ as they come up. */
for (cpu = 0; cpu < NR_CPUS; cpu++) {
if (!cpu_online(cpu))
continue;
- if (nmi_count(cpu) - tmp[cpu].__nmi_count <= 5) {
+ if (nmi_count(cpu) - prev_nmi_count[cpu] <= 5) {
printk("CPU#%d: NMI appears to be stuck!\n", cpu);
return -1;
}
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c Fri Jul 26 19:58:49 2002
+++ b/arch/i386/kernel/process.c Fri Jul 26 19:58:50 2002
@@ -662,7 +662,8 @@
{
struct thread_struct *prev = &prev_p->thread,
*next = &next_p->thread;
- struct tss_struct *tss = init_tss + smp_processor_id();
+ int cpu = smp_processor_id();
+ struct tss_struct *tss = init_tss + cpu;
/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
@@ -689,6 +690,14 @@
}
/*
+ * Load the per-thread Thread-Local Storage descriptor.
+ *
+ * NOTE: it's faster to do the two stores unconditionally
+ * than to branch away.
+ */
+ load_TLS_desc(next, cpu);
+
+ /*
* Now maybe reload the debug registers
*/
if (unlikely(next->debugreg[7])) {
@@ -818,3 +827,58 @@
}
#undef last_sched
#undef first_sched
+
+/*
+ * Set the Thread-Local Storage area:
+ */
+asmlinkage int sys_set_thread_area(unsigned int base, unsigned int limit, unsigned int flags)
+{
+ struct thread_struct *t = ¤t->thread;
+ int limit_in_pages = 0, writable = 0;
+ int cpu;
+
+ /* do not allow unused flags */
+ if (flags & ~TLS_FLAGS_MASK)
+ return -EINVAL;
+
+ /* check limit */
+ if (limit & 0xfff00000)
+ return -EINVAL;
+
+ /*
+ * Clear the TLS?
+ */
+ if (flags & TLS_FLAG_CLEAR) {
+ cpu = get_cpu();
+ t->tls_base = t->tls_limit = t->tls_flags = 0;
+ t->tls_desc.a = t->tls_desc.b = 0;
+ load_TLS_desc(t, cpu);
+ put_cpu();
+ return 0;
+ }
+
+ if (flags & TLS_FLAG_LIMIT_IN_PAGES)
+ limit_in_pages = 1;
+ if (flags & TLS_FLAG_WRITABLE)
+ writable = 1;
+
+ /*
+ * We must not get preempted while modifying the TLS.
+ */
+ cpu = get_cpu();
+ t->tls_base = base;
+ t->tls_limit = limit;
+ t->tls_flags = flags;
+
+ t->tls_desc.a = ((base & 0x0000ffff) << 16) | (limit & 0x0ffff);
+
+ t->tls_desc.b = (base & 0xff000000) | ((base & 0x00ff0000) >> 16) |
+ (limit & 0xf0000) | (writable << 9) | (1 << 15) |
+ (1 << 22) | (limit_in_pages << 23) | 0x7000;
+
+ load_TLS_desc(t, cpu);
+ put_cpu();
+
+ return TLS_ENTRY*8 + 3;
+}
+
diff -Nru a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
--- a/arch/i386/kernel/smp.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/smp.c Fri Jul 26 19:58:50 2002
@@ -646,7 +646,10 @@
/*
* At this point the info structure may be out of scope unless wait==1
*/
+ irq_enter();
(*func)(info);
+ irq_exit();
+
if (wait) {
mb();
atomic_inc(&call_data->finished);
diff -Nru a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
--- a/arch/i386/kernel/smpboot.c Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/smpboot.c Fri Jul 26 19:58:51 2002
@@ -31,7 +31,7 @@
* Maciej W. Rozycki : Bits for genuine 82489DX APICs
* Martin J. Bligh : Added support for multi-quad systems
* Dave Jones : Report invalid combinations of Athlon CPUs.
- */
+* Rusty Russell : Hacked into shape for new "hotplug" boot process. */
#include
#include
@@ -53,9 +53,6 @@
/* Set if we find a B stepping CPU */
static int __initdata smp_b_stepping;
-/* Setup configured maximum number of CPUs to activate */
-static int __initdata max_cpus = NR_CPUS;
-
/* Number of siblings per CPU package */
int smp_num_siblings = 1;
int __initdata phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */
@@ -64,7 +61,8 @@
unsigned long cpu_online_map;
static volatile unsigned long cpu_callin_map;
-static volatile unsigned long cpu_callout_map;
+volatile unsigned long cpu_callout_map;
+static unsigned long smp_commenced_mask;
/* Per CPU bogomips and other parameters */
struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
@@ -73,33 +71,6 @@
int smp_threads_ready;
/*
- * Setup routine for controlling SMP activation
- *
- * Command-line option of "nosmp" or "maxcpus=0" will disable SMP
- * activation entirely (the MPS table probe still happens, though).
- *
- * Command-line option of "maxcpus=", where is an integer
- * greater than 0, limits the maximum number of CPUs activated in
- * SMP mode to .
- */
-
-static int __init nosmp(char *str)
-{
- max_cpus = 0;
- return 1;
-}
-
-__setup("nosmp", nosmp);
-
-static int __init maxcpus(char *str)
-{
- get_option(&str, &max_cpus);
- return 1;
-}
-
-__setup("maxcpus=", maxcpus);
-
-/*
* Trampoline 80x86 program as an array.
*/
@@ -139,7 +110,7 @@
* a given CPU
*/
-void __init smp_store_cpu_info(int id)
+static void __init smp_store_cpu_info(int id)
{
struct cpuinfo_x86 *c = cpu_data + id;
@@ -193,29 +164,6 @@
}
/*
- * Architecture specific routine called by the kernel just before init is
- * fired off. This allows the BP to have everything in order [we hope].
- * At the end of this all the APs will hit the system scheduling and off
- * we go. Each AP will load the system gdt's and jump through the kernel
- * init into idle(). At this point the scheduler will one day take over
- * and give them jobs to do. smp_callin is a standard routine
- * we use to track CPUs as they power up.
- */
-
-static atomic_t smp_commenced = ATOMIC_INIT(0);
-
-void __init smp_commence(void)
-{
- /*
- * Lets the callins below out of their loop.
- */
- Dprintk("Setting commenced=1, go go go\n");
-
- wmb();
- atomic_set(&smp_commenced,1);
-}
-
-/*
* TSC synchronization.
*
* We first check wether all CPUs have their TSC's synchronized,
@@ -268,7 +216,7 @@
unsigned long one_usec;
int buggy = 0;
- printk("checking TSC synchronization across CPUs: ");
+ printk("checking TSC synchronization across %u CPUs: ", num_booting_cpus());
one_usec = ((1<<30)/fast_gettimeoffset_quotient)*(1<<2);
@@ -289,7 +237,7 @@
/*
* all APs synchronize but they loop on '== num_cpus'
*/
- while (atomic_read(&tsc_count_start) != num_online_cpus()-1)
+ while (atomic_read(&tsc_count_start) != num_booting_cpus()-1)
mb();
atomic_set(&tsc_count_stop, 0);
wmb();
@@ -308,7 +256,7 @@
/*
* Wait for all APs to leave the synchronization point:
*/
- while (atomic_read(&tsc_count_stop) != num_online_cpus()-1)
+ while (atomic_read(&tsc_count_stop) != num_booting_cpus()-1)
mb();
atomic_set(&tsc_count_start, 0);
wmb();
@@ -317,16 +265,16 @@
sum = 0;
for (i = 0; i < NR_CPUS; i++) {
- if (cpu_online(i)) {
+ if (test_bit(i, &cpu_callout_map)) {
t0 = tsc_values[i];
sum += t0;
}
}
- avg = div64(sum, num_online_cpus());
+ avg = div64(sum, num_booting_cpus());
sum = 0;
for (i = 0; i < NR_CPUS; i++) {
- if (!cpu_online(i))
+ if (!test_bit(i, &cpu_callout_map))
continue;
delta = tsc_values[i] - avg;
if (delta < 0)
@@ -359,7 +307,7 @@
int i;
/*
- * num_online_cpus is not necessarily known at the time
+ * Not every cpu is online at the time
* this gets called, so we first wait for the BP to
* finish SMP initialization:
*/
@@ -367,7 +315,7 @@
for (i = 0; i < NR_LOOPS; i++) {
atomic_inc(&tsc_count_start);
- while (atomic_read(&tsc_count_start) != num_online_cpus())
+ while (atomic_read(&tsc_count_start) != num_booting_cpus())
mb();
rdtscll(tsc_values[smp_processor_id()]);
@@ -375,7 +323,7 @@
write_tsc(0, 0);
atomic_inc(&tsc_count_stop);
- while (atomic_read(&tsc_count_stop) != num_online_cpus()) mb();
+ while (atomic_read(&tsc_count_stop) != num_booting_cpus()) mb();
}
}
#undef NR_LOOPS
@@ -403,7 +351,7 @@
*/
phys_id = GET_APIC_ID(apic_read(APIC_ID));
cpuid = smp_processor_id();
- if (test_and_set_bit(cpuid, &cpu_online_map)) {
+ if (test_bit(cpuid, &cpu_callin_map)) {
printk("huh, phys CPU#%d, CPU#%d already present??\n",
phys_id, cpuid);
BUG();
@@ -501,15 +449,17 @@
*/
cpu_init();
smp_callin();
- while (!atomic_read(&smp_commenced))
+ while (!test_bit(smp_processor_id(), &smp_commenced_mask))
rep_nop();
+ setup_secondary_APIC_clock();
enable_APIC_timer();
/*
* low-memory mappings have been cleared, flush them from
* the local TLBs too.
*/
local_flush_tlb();
-
+ set_bit(smp_processor_id(), &cpu_online_map);
+ wmb();
return cpu_idle();
}
@@ -943,7 +893,6 @@
unmap_cpu_to_boot_apicid(cpu, apicid);
clear_bit(cpu, &cpu_callout_map); /* was set here (do_boot_cpu()) */
clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
- clear_bit(cpu, &cpu_online_map); /* was set in smp_callin() */
cpucount--;
}
@@ -1015,7 +964,7 @@
int cpu_sibling_map[NR_CPUS] __cacheline_aligned;
-void __init smp_boot_cpus(void)
+static void __init smp_boot_cpus(unsigned int max_cpus)
{
int apicid, cpu, bit;
@@ -1057,6 +1006,7 @@
* We have the boot CPU online for sure.
*/
set_bit(0, &cpu_online_map);
+ set_bit(0, &cpu_callout_map);
boot_cpu_logical_apicid = logical_smp_processor_id();
map_cpu_to_boot_apicid(0, boot_cpu_apicid);
@@ -1072,11 +1022,11 @@
#ifndef CONFIG_VISWS
io_apic_irqs = 0;
#endif
- cpu_online_map = phys_cpu_present_map = 1;
+ phys_cpu_present_map = 1;
if (APIC_init_uniprocessor())
printk(KERN_NOTICE "Local APIC not detected."
" Using dummy APIC emulation.\n");
- goto smp_done;
+ return;
}
/*
@@ -1101,8 +1051,8 @@
#ifndef CONFIG_VISWS
io_apic_irqs = 0;
#endif
- cpu_online_map = phys_cpu_present_map = 1;
- goto smp_done;
+ phys_cpu_present_map = 1;
+ return;
}
verify_local_APIC();
@@ -1116,8 +1066,8 @@
#ifndef CONFIG_VISWS
io_apic_irqs = 0;
#endif
- cpu_online_map = phys_cpu_present_map = 1;
- goto smp_done;
+ phys_cpu_present_map = 1;
+ return;
}
connect_bsp_APIC();
@@ -1189,7 +1139,7 @@
} else {
unsigned long bogosum = 0;
for (cpu = 0; cpu < NR_CPUS; cpu++)
- if (cpu_online_map & (1<mm->context); /* This does lldt */
/*
diff -Nru a/arch/i386/kernel/trampoline.S b/arch/i386/kernel/trampoline.S
--- a/arch/i386/kernel/trampoline.S Fri Jul 26 19:58:51 2002
+++ b/arch/i386/kernel/trampoline.S Fri Jul 26 19:58:51 2002
@@ -63,9 +63,14 @@
.word 0 # idt limit = 0
.word 0, 0 # idt base = 0L
+#
+# NOTE: here we actually use CPU#0's GDT - but that is OK, we reload
+# the proper GDT shortly after booting up the secondary CPUs.
+#
+
gdt_48:
.word 0x0800 # gdt limit = 2048, 256 GDT entries
- .long gdt_table-__PAGE_OFFSET # gdt base = gdt (first SMP CPU)
+ .long cpu_gdt_table-__PAGE_OFFSET # gdt base = gdt (first SMP CPU)
.globl trampoline_end
trampoline_end:
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/kernel/traps.c Fri Jul 26 19:58:50 2002
@@ -784,11 +784,10 @@
__set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO);
/*
- * "idt" is magic - it overlaps the idt_descr
- * variable so that updating idt will automatically
- * update the idt descriptor..
+ * Update the IDT descriptor and reload the IDT so that
+ * it uses the read-only mapped virtual address.
*/
- idt = (struct desc_struct *) fix_to_virt(FIX_F00F_IDT);
+ idt_descr.address = fix_to_virt(FIX_F00F_IDT);
__asm__ __volatile__("lidt %0": "=m" (idt_descr));
}
#endif
@@ -831,37 +830,6 @@
static void __init set_call_gate(void *a, void *addr)
{
_set_gate(a,12,3,addr);
-}
-
-#define _set_seg_desc(gate_addr,type,dpl,base,limit) {\
- *((gate_addr)+1) = ((base) & 0xff000000) | \
- (((base) & 0x00ff0000)>>16) | \
- ((limit) & 0xf0000) | \
- ((dpl)<<13) | \
- (0x00408000) | \
- ((type)<<8); \
- *(gate_addr) = (((base) & 0x0000ffff)<<16) | \
- ((limit) & 0x0ffff); }
-
-#define _set_tssldt_desc(n,addr,limit,type) \
-__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
- "movw %%ax,2(%2)\n\t" \
- "rorl $16,%%eax\n\t" \
- "movb %%al,4(%2)\n\t" \
- "movb %4,5(%2)\n\t" \
- "movb $0,6(%2)\n\t" \
- "movb %%ah,7(%2)\n\t" \
- "rorl $16,%%eax" \
- : "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type))
-
-void set_tss_desc(unsigned int n, void *addr)
-{
- _set_tssldt_desc(gdt_table+__TSS(n), (int)addr, 235, 0x89);
-}
-
-void set_ldt_desc(unsigned int n, void *addr, unsigned int size)
-{
- _set_tssldt_desc(gdt_table+__LDT(n), (int)addr, ((size << 3)-1), 0x82);
}
#ifdef CONFIG_X86_VISWS_APIC
diff -Nru a/arch/i386/mm/Makefile b/arch/i386/mm/Makefile
--- a/arch/i386/mm/Makefile Fri Jul 26 19:58:51 2002
+++ b/arch/i386/mm/Makefile Fri Jul 26 19:58:51 2002
@@ -9,7 +9,7 @@
O_TARGET := mm.o
-obj-y := init.o fault.o ioremap.o extable.o pageattr.o
+obj-y := init.o pgtable.o fault.o ioremap.o extable.o pageattr.o
export-objs := pageattr.o
include $(TOPDIR)/Rules.make
diff -Nru a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
--- a/arch/i386/mm/fault.c Fri Jul 26 19:58:50 2002
+++ b/arch/i386/mm/fault.c Fri Jul 26 19:58:50 2002
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
extern void die(const char *,struct pt_regs *,long);
@@ -129,7 +130,6 @@
}
asmlinkage void do_invalid_op(struct pt_regs *, unsigned long);
-extern unsigned long idt;
/*
* This routine handles page faults. It determines the address,
@@ -293,7 +293,7 @@
if (boot_cpu_data.f00f_bug) {
unsigned long nr;
- nr = (address - idt) >> 3;
+ nr = (address - idt_descr.address) >> 3;
if (nr == 6) {
do_invalid_op(regs, 0);
diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c
--- a/arch/i386/mm/init.c Fri Jul 26 19:58:51 2002
+++ b/arch/i386/mm/init.c Fri Jul 26 19:58:51 2002
@@ -38,15 +38,146 @@
#include
#include
#include
+#include
mmu_gather_t mmu_gathers[NR_CPUS];
unsigned long highstart_pfn, highend_pfn;
/*
- * NOTE: pagetable_init alloc all the fixmap pagetables contiguous on the
- * physical space so we can cache the place of the first one and move
- * around without checking the pgd every time.
+ * Creates a middle page table and puts a pointer to it in the
+ * given global directory entry. This only returns the gd entry
+ * in non-PAE compilation mode, since the middle layer is folded.
*/
+static pmd_t * __init one_md_table_init(pgd_t *pgd)
+{
+ pmd_t *pmd_table;
+
+#if CONFIG_X86_PAE
+ pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
+ set_pgd(pgd, __pgd(__pa(md_table) | _PAGE_PRESENT));
+ if (pmd_table != pmd_offset(pgd, 0))
+ BUG();
+#else
+ pmd_table = pmd_offset(pgd, 0);
+#endif
+
+ return pmd_table;
+}
+
+/*
+ * Create a page table and place a pointer to it in a middle page
+ * directory entry.
+ */
+static pte_t * __init one_page_table_init(pmd_t *pmd)
+{
+ pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
+ set_pmd(pmd, __pmd(__pa(page_table) | _KERNPG_TABLE));
+ if (page_table != pte_offset_kernel(pmd, 0))
+ BUG();
+
+ return page_table;
+}
+
+/*
+ * This function initializes a certain range of kernel virtual memory
+ * with new bootmem page tables, everywhere page tables are missing in
+ * the given range.
+ */
+
+/*
+ * NOTE: The pagetables are allocated contiguous on the physical space
+ * so we can cache the place of the first one and move around without
+ * checking the pgd every time.
+ */
+static void __init page_table_range_init (unsigned long start, unsigned long end, pgd_t *pgd_base)
+{
+ pgd_t *pgd;
+ pmd_t *pmd;
+ int pgd_ofs, pmd_ofs;
+ unsigned long vaddr;
+
+ vaddr = start;
+ pgd_ofs = __pgd_offset(vaddr);
+ pmd_ofs = __pmd_offset(vaddr);
+ pgd = pgd_base + pgd_ofs;
+
+ for ( ; (pgd_ofs < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_ofs++) {
+ if (pgd_none(*pgd))
+ one_md_table_init(pgd);
+
+ pmd = pmd_offset(pgd, vaddr);
+ for (; (pmd_ofs < PTRS_PER_PMD) && (vaddr != end); pmd++, pmd_ofs++) {
+ if (pmd_none(*pmd))
+ one_page_table_init(pmd);
+
+ vaddr += PMD_SIZE;
+ }
+ pmd_ofs = 0;
+ }
+}
+
+/*
+ * This maps the physical memory to kernel virtual address space, a total
+ * of max_low_pfn pages, by creating page tables starting from address
+ * PAGE_OFFSET.
+ */
+static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
+{
+ unsigned long pfn;
+ pgd_t *pgd;
+ pmd_t *pmd;
+ pte_t *pte;
+ int pgd_ofs, pmd_ofs, pte_ofs;
+
+ pgd_ofs = __pgd_offset(PAGE_OFFSET);
+ pgd = pgd_base + pgd_ofs;
+ pfn = 0;
+
+ for (; pgd_ofs < PTRS_PER_PGD && pfn < max_low_pfn; pgd++, pgd_ofs++) {
+ pmd = one_md_table_init(pgd);
+ for (pmd_ofs = 0; pmd_ofs < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_ofs++) {
+ /* Map with big pages if possible, otherwise create normal page tables. */
+ if (cpu_has_pse) {
+ set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE));
+ pfn += PTRS_PER_PTE;
+ } else {
+ pte = one_page_table_init(pmd);
+
+ for (pte_ofs = 0; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++)
+ set_pte(pte, pfn_pte(pfn, PAGE_KERNEL));
+ }
+ }
+ }
+}
+
+static inline int page_kills_ppro(unsigned long pagenr)
+{
+ if (pagenr >= 0x70000 && pagenr <= 0x7003F)
+ return 1;
+ return 0;
+}
+
+static inline int page_is_ram(unsigned long pagenr)
+{
+ int i;
+
+ for (i = 0; i < e820.nr_map; i++) {
+ unsigned long addr, end;
+
+ if (e820.map[i].type != E820_RAM) /* not usable memory */
+ continue;
+ /*
+ * !!!FIXME!!! Some BIOSen report areas as RAM that
+ * are not. Notably the 640->1Mb area. We need a sanity
+ * check here.
+ */
+ addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
+ end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
+ if ((pagenr >= addr) && (pagenr < end))
+ return 1;
+ }
+ return 0;
+}
#if CONFIG_HIGHMEM
pte_t *kmap_pte;
@@ -65,186 +196,88 @@
kmap_prot = PAGE_KERNEL;
}
-#endif /* CONFIG_HIGHMEM */
-void show_mem(void)
-{
- int i, total = 0, reserved = 0;
- int shared = 0, cached = 0;
- int highmem = 0;
-
- printk("Mem-info:\n");
- show_free_areas();
- printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
- 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))
- cached++;
- else if (page_count(mem_map+i))
- shared += page_count(mem_map+i) - 1;
- }
- printk("%d pages of RAM\n", total);
- printk("%d pages of HIGHMEM\n",highmem);
- printk("%d reserved pages\n",reserved);
- printk("%d pages shared\n",shared);
- printk("%d pages swap cached\n",cached);
-}
-
-/* References to section boundaries */
-
-extern char _text, _etext, _edata, __bss_start, _end;
-extern char __init_begin, __init_end;
-
-static inline void set_pte_phys (unsigned long vaddr,
- unsigned long phys, pgprot_t flags)
+void __init permanent_kmaps_init(pgd_t *pgd_base)
{
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
+ unsigned long vaddr;
+
+ vaddr = PKMAP_BASE;
+ page_table_range_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
pgd = swapper_pg_dir + __pgd_offset(vaddr);
- if (pgd_none(*pgd)) {
- printk("PAE BUG #00!\n");
- return;
- }
pmd = pmd_offset(pgd, vaddr);
- if (pmd_none(*pmd)) {
- printk("PAE BUG #01!\n");
- return;
- }
pte = pte_offset_kernel(pmd, vaddr);
- /* stored as-is, to permit clearing entries */
- set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
-
- /*
- * It's enough to flush this one mapping.
- * (PGE mappings get flushed as well)
- */
- __flush_tlb_one(vaddr);
+ pkmap_page_table = pte;
}
-void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
+void __init set_highmem_pages_init(int bad_ppro)
{
- unsigned long address = __fix_to_virt(idx);
-
- if (idx >= __end_of_fixed_addresses) {
- printk("Invalid __set_fixmap\n");
- return;
- }
- set_pte_phys(address, phys, flags);
-}
+ int pfn;
+ for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) {
+ struct page *page = mem_map + pfn;
-static void __init fixrange_init (unsigned long start, unsigned long end, pgd_t *pgd_base)
-{
- pgd_t *pgd;
- pmd_t *pmd;
- pte_t *pte;
- int i, j;
- unsigned long vaddr;
-
- vaddr = start;
- i = __pgd_offset(vaddr);
- j = __pmd_offset(vaddr);
- pgd = pgd_base + i;
-
- for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
-#if CONFIG_X86_PAE
- if (pgd_none(*pgd)) {
- pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- set_pgd(pgd, __pgd(__pa(pmd) + 0x1));
- if (pmd != pmd_offset(pgd, 0))
- printk("PAE BUG #02!\n");
+ if (!page_is_ram(pfn)) {
+ SetPageReserved(page);
+ continue;
}
- pmd = pmd_offset(pgd, vaddr);
-#else
- pmd = (pmd_t *)pgd;
-#endif
- for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) {
- if (pmd_none(*pmd)) {
- pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte)));
- if (pte != pte_offset_kernel(pmd, 0))
- BUG();
- }
- vaddr += PMD_SIZE;
+ if (bad_ppro && page_kills_ppro(pfn))
+ {
+ SetPageReserved(page);
+ continue;
}
- j = 0;
+ ClearPageReserved(page);
+ set_bit(PG_highmem, &page->flags);
+ atomic_set(&page->count, 1);
+ __free_page(page);
+ totalhigh_pages++;
}
+ totalram_pages += totalhigh_pages;
}
+#else
+#define kmap_init() do { } while (0)
+#define permanent_kmaps_init(pgd_base) do { } while (0)
+#define set_highmem_pages_init(bad_ppro) do { } while (0)
+#endif /* CONFIG_HIGHMEM */
+
unsigned long __PAGE_KERNEL = _PAGE_KERNEL;
static void __init pagetable_init (void)
{
- unsigned long vaddr, pfn;
- pgd_t *pgd, *pgd_base;
- int i, j, k;
- pmd_t *pmd;
- pte_t *pte, *pte_base;
+ unsigned long vaddr;
+ pgd_t *pgd_base = swapper_pg_dir;
- pgd_base = swapper_pg_dir;
#if CONFIG_X86_PAE
+ int i;
+ /* Init entries of the first-level page table to the zero page */
for (i = 0; i < PTRS_PER_PGD; i++)
set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT));
#endif
+
+ /* Enable PSE if available */
if (cpu_has_pse) {
set_in_cr4(X86_CR4_PSE);
}
+
+ /* Enable PGE if available */
if (cpu_has_pge) {
set_in_cr4(X86_CR4_PGE);
__PAGE_KERNEL |= _PAGE_GLOBAL;
}
- i = __pgd_offset(PAGE_OFFSET);
- pfn = 0;
- pgd = pgd_base + i;
-
- for (; i < PTRS_PER_PGD && pfn < max_low_pfn; pgd++, i++) {
-#if CONFIG_X86_PAE
- pmd = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- set_pgd(pgd, __pgd(__pa(pmd) | _PAGE_PRESENT));
-#else
- pmd = (pmd_t *) pgd;
-#endif
- for (j = 0; j < PTRS_PER_PMD && pfn < max_low_pfn; pmd++, j++) {
- if (cpu_has_pse) {
- set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE));
- pfn += PTRS_PER_PTE;
- } else {
- pte_base = pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
-
- for (k = 0; k < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, k++)
- set_pte(pte, pfn_pte(pfn, PAGE_KERNEL));
-
- set_pmd(pmd, __pmd(__pa(pte_base) | _KERNPG_TABLE));
- }
- }
- }
+ kernel_physical_mapping_init(pgd_base);
/*
* Fixed mappings, only the page table structure has to be
* created - mappings will be set by set_fixmap():
*/
vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
- fixrange_init(vaddr, 0, pgd_base);
+ page_table_range_init(vaddr, 0, pgd_base);
-#if CONFIG_HIGHMEM
- /*
- * Permanent kmaps:
- */
- vaddr = PKMAP_BASE;
- fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
-
- pgd = swapper_pg_dir + __pgd_offset(vaddr);
- pmd = pmd_offset(pgd, vaddr);
- pte = pte_offset_kernel(pmd, vaddr);
- pkmap_page_table = pte;
-#endif
+ permanent_kmaps_init(pgd_base);
#if CONFIG_X86_PAE
/*
@@ -276,6 +309,27 @@
flush_tlb_all();
}
+void __init zone_sizes_init(void)
+{
+ unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned int max_dma, high, low;
+
+ max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
+ low = max_low_pfn;
+ high = highend_pfn;
+
+ if (low < max_dma)
+ zones_size[ZONE_DMA] = low;
+ else {
+ zones_size[ZONE_DMA] = max_dma;
+ zones_size[ZONE_NORMAL] = low - max_dma;
+#ifdef CONFIG_HIGHMEM
+ zones_size[ZONE_HIGHMEM] = high - low;
+#endif
+ }
+ free_area_init(zones_size);
+}
+
/*
* paging_init() sets up the page tables - note that the first 8MB are
* already mapped by head.S.
@@ -297,32 +351,10 @@
if (cpu_has_pae)
set_in_cr4(X86_CR4_PAE);
#endif
-
__flush_tlb_all();
-#ifdef CONFIG_HIGHMEM
kmap_init();
-#endif
- {
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
- unsigned int max_dma, high, low;
-
- max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
- low = max_low_pfn;
- high = highend_pfn;
-
- if (low < max_dma)
- zones_size[ZONE_DMA] = low;
- else {
- zones_size[ZONE_DMA] = max_dma;
- zones_size[ZONE_NORMAL] = low - max_dma;
-#ifdef CONFIG_HIGHMEM
- zones_size[ZONE_HIGHMEM] = high - low;
-#endif
- }
- free_area_init(zones_size);
- }
- return;
+ zone_sizes_init();
}
/*
@@ -373,35 +405,6 @@
printk("Ok.\n");
}
}
-
-static inline int page_is_ram (unsigned long pagenr)
-{
- int i;
-
- for (i = 0; i < e820.nr_map; i++) {
- unsigned long addr, end;
-
- if (e820.map[i].type != E820_RAM) /* not usable memory */
- continue;
- /*
- * !!!FIXME!!! Some BIOSen report areas as RAM that
- * are not. Notably the 640->1Mb area. We need a sanity
- * check here.
- */
- addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
- end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
- if ((pagenr >= addr) && (pagenr < end))
- return 1;
- }
- return 0;
-}
-
-static inline int page_kills_ppro(unsigned long pagenr)
-{
- if(pagenr >= 0x70000 && pagenr <= 0x7003F)
- return 1;
- return 0;
-}
void __init mem_init(void)
{
@@ -436,27 +439,9 @@
*/
if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
reservedpages++;
-#ifdef CONFIG_HIGHMEM
- for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
- struct page *page = mem_map + tmp;
- if (!page_is_ram(tmp)) {
- SetPageReserved(page);
- continue;
- }
- if (bad_ppro && page_kills_ppro(tmp))
- {
- SetPageReserved(page);
- continue;
- }
- ClearPageReserved(page);
- set_bit(PG_highmem, &page->flags);
- atomic_set(&page->count, 1);
- __free_page(page);
- totalhigh_pages++;
- }
- totalram_pages += totalhigh_pages;
-#endif
+ set_highmem_pages_init(bad_ppro);
+
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
@@ -487,8 +472,22 @@
#ifndef CONFIG_SMP
zap_low_mappings();
#endif
+}
+
+#if CONFIG_X86_PAE
+struct kmem_cache_s *pae_pgd_cachep;
+void __init pgtable_cache_init(void)
+{
+ /*
+ * PAE pgds must be 16-byte aligned:
+ */
+ pae_pgd_cachep = kmem_cache_create("pae_pgd", 32, 0,
+ SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, NULL, NULL);
+ if (!pae_pgd_cachep)
+ panic("init_pae(): Cannot alloc pae_pgd SLAB cache");
}
+#endif
/* Put this after the callers, so that it cannot be inlined */
static int do_test_wp_bit(unsigned long vaddr)
@@ -541,110 +540,3 @@
}
}
#endif
-
-#if defined(CONFIG_X86_PAE)
-static struct kmem_cache_s *pae_pgd_cachep;
-
-void __init pgtable_cache_init(void)
-{
- /*
- * PAE pgds must be 16-byte aligned:
- */
- pae_pgd_cachep = kmem_cache_create("pae_pgd", 32, 0,
- SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, NULL, NULL);
- if (!pae_pgd_cachep)
- panic("init_pae(): Cannot alloc pae_pgd SLAB cache");
-}
-
-pgd_t *pgd_alloc(struct mm_struct *mm)
-{
- int i;
- pgd_t *pgd = kmem_cache_alloc(pae_pgd_cachep, GFP_KERNEL);
-
- if (pgd) {
- for (i = 0; i < USER_PTRS_PER_PGD; i++) {
- unsigned long pmd = __get_free_page(GFP_KERNEL);
- if (!pmd)
- goto out_oom;
- clear_page(pmd);
- set_pgd(pgd + i, __pgd(1 + __pa(pmd)));
- }
- memcpy(pgd + USER_PTRS_PER_PGD,
- swapper_pg_dir + USER_PTRS_PER_PGD,
- (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
- }
- return pgd;
-out_oom:
- for (i--; i >= 0; i--)
- free_page((unsigned long)__va(pgd_val(pgd[i])-1));
- kmem_cache_free(pae_pgd_cachep, pgd);
- return NULL;
-}
-
-void pgd_free(pgd_t *pgd)
-{
- int i;
-
- for (i = 0; i < USER_PTRS_PER_PGD; i++)
- free_page((unsigned long)__va(pgd_val(pgd[i])-1));
- kmem_cache_free(pae_pgd_cachep, pgd);
-}
-
-#else
-
-pgd_t *pgd_alloc(struct mm_struct *mm)
-{
- pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
-
- if (pgd) {
- memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
- memcpy(pgd + USER_PTRS_PER_PGD,
- swapper_pg_dir + USER_PTRS_PER_PGD,
- (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
- }
- return pgd;
-}
-
-void pgd_free(pgd_t *pgd)
-{
- free_page((unsigned long)pgd);
-}
-#endif /* CONFIG_X86_PAE */
-
-pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
-{
- int count = 0;
- pte_t *pte;
-
- do {
- pte = (pte_t *) __get_free_page(GFP_KERNEL);
- if (pte)
- clear_page(pte);
- else {
- current->state = TASK_UNINTERRUPTIBLE;
- schedule_timeout(HZ);
- }
- } while (!pte && (count++ < 10));
- return pte;
-}
-
-struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
-{
- int count = 0;
- struct page *pte;
-
- do {
-#if CONFIG_HIGHPTE
- pte = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, 0);
-#else
- pte = alloc_pages(GFP_KERNEL, 0);
-#endif
- if (pte)
- clear_highpage(pte);
- else {
- current->state = TASK_UNINTERRUPTIBLE;
- schedule_timeout(HZ);
- }
- } while (!pte && (count++ < 10));
- return pte;
-}
diff -Nru a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mm/pgtable.c Fri Jul 26 19:58:52 2002
@@ -0,0 +1,188 @@
+/*
+ * linux/arch/i386/mm/pgtable.c
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+void show_mem(void)
+{
+ int i, total = 0, reserved = 0;
+ int shared = 0, cached = 0;
+ int highmem = 0;
+
+ printk("Mem-info:\n");
+ show_free_areas();
+ printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
+ 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))
+ cached++;
+ else if (page_count(mem_map+i))
+ shared += page_count(mem_map+i) - 1;
+ }
+ printk("%d pages of RAM\n", total);
+ printk("%d pages of HIGHMEM\n",highmem);
+ printk("%d reserved pages\n",reserved);
+ printk("%d pages shared\n",shared);
+ printk("%d pages swap cached\n",cached);
+}
+
+/*
+ * Associate a virtual page frame with a given physical page frame
+ * and protection flags for that frame.
+ */
+static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
+{
+ pgd_t *pgd;
+ pmd_t *pmd;
+ pte_t *pte;
+
+ pgd = swapper_pg_dir + __pgd_offset(vaddr);
+ if (pgd_none(*pgd)) {
+ BUG();
+ return;
+ }
+ pmd = pmd_offset(pgd, vaddr);
+ if (pmd_none(*pmd)) {
+ BUG();
+ return;
+ }
+ pte = pte_offset_kernel(pmd, vaddr);
+ /* stored as-is, to permit clearing entries */
+ set_pte(pte, pfn_pte(pfn, flags));
+
+ /*
+ * It's enough to flush this one mapping.
+ * (PGE mappings get flushed as well)
+ */
+ __flush_tlb_one(vaddr);
+}
+
+void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
+{
+ unsigned long address = __fix_to_virt(idx);
+
+ if (idx >= __end_of_fixed_addresses) {
+ BUG();
+ return;
+ }
+ set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
+}
+
+pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+{
+ int count = 0;
+ pte_t *pte;
+
+ do {
+ pte = (pte_t *) __get_free_page(GFP_KERNEL);
+ if (pte)
+ clear_page(pte);
+ else {
+ current->state = TASK_UNINTERRUPTIBLE;
+ schedule_timeout(HZ);
+ }
+ } while (!pte && (count++ < 10));
+ return pte;
+}
+
+struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+ int count = 0;
+ struct page *pte;
+
+ do {
+#if CONFIG_HIGHPTE
+ pte = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, 0);
+#else
+ pte = alloc_pages(GFP_KERNEL, 0);
+#endif
+ if (pte)
+ clear_highpage(pte);
+ else {
+ current->state = TASK_UNINTERRUPTIBLE;
+ schedule_timeout(HZ);
+ }
+ } while (!pte && (count++ < 10));
+ return pte;
+}
+
+#if CONFIG_X86_PAE
+
+pgd_t *pgd_alloc(struct mm_struct *mm)
+{
+ int i;
+ pgd_t *pgd = kmem_cache_alloc(pae_pgd_cachep, GFP_KERNEL);
+
+ if (pgd) {
+ for (i = 0; i < USER_PTRS_PER_PGD; i++) {
+ unsigned long pmd = __get_free_page(GFP_KERNEL);
+ if (!pmd)
+ goto out_oom;
+ clear_page(pmd);
+ set_pgd(pgd + i, __pgd(1 + __pa(pmd)));
+ }
+ memcpy(pgd + USER_PTRS_PER_PGD,
+ swapper_pg_dir + USER_PTRS_PER_PGD,
+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+ }
+ return pgd;
+out_oom:
+ for (i--; i >= 0; i--)
+ free_page((unsigned long)__va(pgd_val(pgd[i])-1));
+ kmem_cache_free(pae_pgd_cachep, pgd);
+ return NULL;
+}
+
+void pgd_free(pgd_t *pgd)
+{
+ int i;
+
+ for (i = 0; i < USER_PTRS_PER_PGD; i++)
+ free_page((unsigned long)__va(pgd_val(pgd[i])-1));
+ kmem_cache_free(pae_pgd_cachep, pgd);
+}
+
+#else
+
+pgd_t *pgd_alloc(struct mm_struct *mm)
+{
+ pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
+
+ if (pgd) {
+ memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
+ memcpy(pgd + USER_PTRS_PER_PGD,
+ swapper_pg_dir + USER_PTRS_PER_PGD,
+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+ }
+ return pgd;
+}
+
+void pgd_free(pgd_t *pgd)
+{
+ free_page((unsigned long)pgd);
+}
+
+#endif /* CONFIG_X86_PAE */
+
diff -Nru a/arch/ia64/config.in b/arch/ia64/config.in
--- a/arch/ia64/config.in Fri Jul 26 19:58:52 2002
+++ b/arch/ia64/config.in Fri Jul 26 19:58:52 2002
@@ -133,9 +133,9 @@
source drivers/message/fusion/Config.in
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -263,3 +263,5 @@
fi
endmenu
+
+source security/Config.in
diff -Nru a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
--- a/arch/ia64/kernel/ptrace.c Fri Jul 26 19:58:52 2002
+++ b/arch/ia64/kernel/ptrace.c Fri Jul 26 19:58:52 2002
@@ -15,6 +15,7 @@
#include
#include
#include
+#include
#include
#include
@@ -1099,6 +1100,9 @@
if (request == PTRACE_TRACEME) {
/* are we already being traced? */
if (current->ptrace & PT_PTRACED)
+ goto out;
+ ret = security_ops->ptrace(current->parent, current);
+ if (ret)
goto out;
current->ptrace |= PT_PTRACED;
ret = 0;
diff -Nru a/arch/m68k/config.in b/arch/m68k/config.in
--- a/arch/m68k/config.in Fri Jul 26 19:58:52 2002
+++ b/arch/m68k/config.in Fri Jul 26 19:58:52 2002
@@ -160,9 +160,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL device support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL device support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -172,9 +172,9 @@
endmenu
mainmenu_option next_comment
-comment 'SCSI support'
+comment 'SCSI device support'
-tristate 'SCSI support' CONFIG_SCSI
+tristate 'SCSI device support' CONFIG_SCSI
if [ "$CONFIG_SCSI" != "n" ]; then
@@ -547,4 +547,5 @@
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/mips/config.in b/arch/mips/config.in
--- a/arch/mips/config.in Fri Jul 26 19:58:52 2002
+++ b/arch/mips/config.in Fri Jul 26 19:58:52 2002
@@ -343,9 +343,9 @@
"$CONFIG_DECSTATION" != "y" ]; then
mainmenu_option next_comment
- comment 'ATA/IDE/MFM/RLL support'
+ comment 'ATA/ATAPI/MFM/RLL support'
- tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+ tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -503,4 +503,5 @@
fi
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/mips64/config.in b/arch/mips64/config.in
--- a/arch/mips64/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/mips64/config.in Fri Jul 26 19:58:50 2002
@@ -138,9 +138,9 @@
source drivers/telephony/Config.in
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -248,4 +248,5 @@
fi
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/parisc/config.in b/arch/parisc/config.in
--- a/arch/parisc/config.in Fri Jul 26 19:58:52 2002
+++ b/arch/parisc/config.in Fri Jul 26 19:58:52 2002
@@ -200,4 +200,5 @@
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/ppc/4xx_io/Makefile b/arch/ppc/4xx_io/Makefile
--- a/arch/ppc/4xx_io/Makefile Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/4xx_io/Makefile Fri Jul 26 19:58:51 2002
@@ -6,7 +6,6 @@
#obj-y :=
-obj-$(CONFIG_STB_KB) += stb_kb.o
obj-$(CONFIG_SERIAL_SICC) += serial_sicc.o
include $(TOPDIR)/Rules.make
diff -Nru a/arch/ppc/4xx_io/stb_kb.c b/arch/ppc/4xx_io/stb_kb.c
--- a/arch/ppc/4xx_io/stb_kb.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/4xx_io/stb_kb.c Fri Jul 26 19:58:51 2002
@@ -1,289 +0,0 @@
-/*
- * arch/ppc/4xx_io/stb_kb.c
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive for
- * more details.
- */
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* the following are borrowed from pc_keyb.c, thanks to those involved! */
-/*
- * Translation of escaped scancodes to keycodes.
- * This is now user-settable.
- * The keycodes 1-88,96-111,119 are fairly standard, and
- * should probably not be changed - changing might confuse X.
- * X also interprets scancode 0x5d (KEY_Begin).
- *
- * For 1-88 keycode equals scancode.
- */
-
-#define E0_KPENTER 96
-#define E0_RCTRL 97
-#define E0_KPSLASH 98
-#define E0_PRSCR 99
-#define E0_RALT 100
-#define E0_BREAK 101 /* (control-pause) */
-#define E0_HOME 102
-#define E0_UP 103
-#define E0_PGUP 104
-#define E0_LEFT 105
-#define E0_RIGHT 106
-#define E0_END 107
-#define E0_DOWN 108
-#define E0_PGDN 109
-#define E0_INS 110
-#define E0_DEL 111
-
-#define E1_PAUSE 119
-
-/*
- * The keycodes below are randomly located in 89-95,112-118,120-127.
- * They could be thrown away (and all occurrences below replaced by 0),
- * but that would force many users to use the `setkeycodes' utility, where
- * they needed not before. It does not matter that there are duplicates, as
- * long as no duplication occurs for any single keyboard.
- */
-#define SC_LIM 89
-
-#define FOCUS_PF1 85 /* actual code! */
-#define FOCUS_PF2 89
-#define FOCUS_PF3 90
-#define FOCUS_PF4 91
-#define FOCUS_PF5 92
-#define FOCUS_PF6 93
-#define FOCUS_PF7 94
-#define FOCUS_PF8 95
-#define FOCUS_PF9 120
-#define FOCUS_PF10 121
-#define FOCUS_PF11 122
-#define FOCUS_PF12 123
-
-#define JAP_86 124
-/* tfj@olivia.ping.dk:
- * The four keys are located over the numeric keypad, and are
- * labelled A1-A4. It's an rc930 keyboard, from
- * Regnecentralen/RC International, Now ICL.
- * Scancodes: 59, 5a, 5b, 5c.
- */
-#define RGN1 124
-#define RGN2 125
-#define RGN3 126
-#define RGN4 127
-
-static unsigned char high_keys[128 - SC_LIM] = {
- RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
- 0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12, /* 0x68-0x6f */
- 0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */
- FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */
- FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */
-};
-
-/* BTC */
-#define E0_MACRO 112
-/* LK450 */
-#define E0_F13 113
-#define E0_F14 114
-#define E0_HELP 115
-#define E0_DO 116
-#define E0_F17 117
-#define E0_KPMINPLUS 118
-/*
- * My OmniKey generates e0 4c for the "OMNI" key and the
- * right alt key does nada. [kkoller@nyx10.cs.du.edu]
- */
-#define E0_OK 124
-/*
- * New microsoft keyboard is rumoured to have
- * e0 5b (left window button), e0 5c (right window button),
- * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
- * [or: Windows_L, Windows_R, TaskMan]
- */
-#define E0_MSLW 125
-#define E0_MSRW 126
-#define E0_MSTM 127
-
-static unsigned char e0_keys[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
- 0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 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, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
- E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP, /* 0x38-0x3f */
- E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME, /* 0x40-0x47 */
- E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END,/* 0x48-0x4f */
- E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0, /* 0x50-0x57 */
- 0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0, /* 0x58-0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
- 0, 0, 0, 0, 0, 0, 0, E0_MACRO, /* 0x68-0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0 /* 0x78-0x7f */
-};
-
-void __init rawirkbd_init_hw(void) {
-
-}
-/*
-int rawirkbd_setkeycode(unsigned int scancode, unsigned int keycode)
-{
- return -EINVAL;
-}
-
-int rawirkbd_getkeycode(unsigned int scancode)
-{
- return -EINVAL;
-}
-*/
-
-int rawirkbd_setkeycode(unsigned int scancode, unsigned int keycode)
-{
- if (scancode < SC_LIM || scancode > 255 || keycode > 127)
- return -EINVAL;
- if (scancode < 128)
- high_keys[scancode - SC_LIM] = keycode;
- else
- e0_keys[scancode - 128] = keycode;
- return 0;
-}
-
-int rawirkbd_getkeycode(unsigned int scancode)
-{
- return
- (scancode < SC_LIM || scancode > 255) ? -EINVAL :
- (scancode < 128) ? high_keys[scancode - SC_LIM] :
- e0_keys[scancode - 128];
-}
-
-int rawirkbd_translate(unsigned char scancode, unsigned char *keycode,
- char raw_mode)
-{
- static int prev_scancode = 0;
-
- /* special prefix scancodes.. */
- if (scancode == 0xe0 || scancode == 0xe1) {
- prev_scancode = scancode;
- return 0;
- }
-
- /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
- if (scancode == 0x00 || scancode == 0xff) {
- prev_scancode = 0;
- return 0;
- }
-
- scancode &= 0x7f;
-
- if (prev_scancode) {
- /*
- * usually it will be 0xe0, but a Pause key generates
- * e1 1d 45 e1 9d c5 when pressed, and nothing when released
- */
- if (prev_scancode != 0xe0) {
- if (prev_scancode == 0xe1 && scancode == 0x1d) {
- prev_scancode = 0x100;
- return 0;
- } else if (prev_scancode == 0x100 && scancode == 0x45) {
- *keycode = E1_PAUSE;
- prev_scancode = 0;
- } else {
-#ifdef KBD_REPORT_UNKN
- if (!raw_mode)
- printk(KERN_INFO "keyboard: unknown e1 escape sequence\n");
-#endif
- prev_scancode = 0;
- return 0;
- }
- } else {
- prev_scancode = 0;
- /*
- * The keyboard maintains its own internal caps lock and
- * num lock statuses. In caps lock mode E0 AA precedes make
- * code and E0 2A follows break code. In num lock mode,
- * E0 2A precedes make code and E0 AA follows break code.
- * We do our own book-keeping, so we will just ignore these.
- */
- /*
- * For my keyboard there is no caps lock mode, but there are
- * both Shift-L and Shift-R modes. The former mode generates
- * E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
- * So, we should also ignore the latter. - aeb@cwi.nl
- */
- if (scancode == 0x2a || scancode == 0x36)
- return 0;
-
- if (e0_keys[scancode])
- *keycode = e0_keys[scancode];
- else {
-#ifdef KBD_REPORT_UNKN
- if (!raw_mode)
- printk(KERN_INFO "keyboard: unknown scancode e0 %02x\n",
- scancode);
-#endif
- return 0;
- }
- }
- } else if (scancode >= SC_LIM) {
- /* This happens with the FOCUS 9000 keyboard
- Its keys PF1..PF12 are reported to generate
- 55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
- Moreover, unless repeated, they do not generate
- key-down events, so we have to zero up_flag below */
- /* Also, Japanese 86/106 keyboards are reported to
- generate 0x73 and 0x7d for \ - and \ | respectively. */
- /* Also, some Brazilian keyboard is reported to produce
- 0x73 and 0x7e for \ ? and KP-dot, respectively. */
-
- *keycode = high_keys[scancode - SC_LIM];
-
- if (!*keycode) {
- if (!raw_mode) {
-#ifdef KBD_REPORT_UNKN
- printk(KERN_INFO "keyboard: unrecognized scancode (%02x)"
- " - ignored\n", scancode);
-#endif
- }
- return 0;
- }
- } else
- *keycode = scancode;
- return 1;
-}
-
-char rawirkbd_unexpected_up(unsigned char keycode)
-{
- /* unexpected, but this can happen: maybe this was a key release for a
- FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
- if (keycode >= SC_LIM || keycode == 85)
- return 0;
- else
- return 0200;
-}
-
-#include
-
-void redwood_irkb_init(void)
-{
- extern struct machdep_calls ppc_md;
-
- ppc_md.kbd_translate = rawirkbd_translate;
- ppc_md.kbd_unexpected_up = rawirkbd_unexpected_up;
-}
-
diff -Nru a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c
--- a/arch/ppc/8xx_io/uart.c Fri Jul 26 19:58:52 2002
+++ b/arch/ppc/8xx_io/uart.c Fri Jul 26 19:58:52 2002
@@ -3103,19 +3103,3 @@
return 0;
}
-
-#ifdef CONFIG_INPUT_KEYBDEV
-
-void handle_scancode(unsigned char scancode, int down)
-{
- printk("handle_scancode(scancode=0x%x, down=%d)\n", scancode, down);
-}
-
-static void kbd_bh(unsigned long dummy)
-{
-}
-
-DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
-void (*kbd_ledfunc)(unsigned int led);
-
-#endif
diff -Nru a/arch/ppc/amiga/config.c b/arch/ppc/amiga/config.c
--- a/arch/ppc/amiga/config.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/amiga/config.c Fri Jul 26 19:58:51 2002
@@ -36,7 +36,6 @@
#include
#include
#include
-#include
#include
#include
@@ -76,9 +75,6 @@
extern char m68k_debug_device[];
static void amiga_sched_init(void (*handler)(int, void *, struct pt_regs *));
-/* amiga specific keyboard functions */
-extern int amiga_keyb_init(void);
-extern int amiga_kbdrate (struct kbd_repeat *);
/* amiga specific irq functions */
extern void amiga_init_IRQ (void);
extern void (*amiga_default_handler[]) (int, void *, struct pt_regs *);
@@ -119,18 +115,6 @@
index: -1,
};
-#ifdef CONFIG_MAGIC_SYSRQ
-char amiga_sysrq_xlate[128] =
- "\0001234567890-=\\\000\000" /* 0x00 - 0x0f */
- "qwertyuiop[]\000123" /* 0x10 - 0x1f */
- "asdfghjkl;'\000\000456" /* 0x20 - 0x2f */
- "\000zxcvbnm,./\000+789" /* 0x30 - 0x3f */
- " \177\t\r\r\000\177\000\000\000-\000\000\000\000\000" /* 0x40 - 0x4f */
- "\000\201\202\203\204\205\206\207\210\211()/*+\000" /* 0x50 - 0x5f */
- "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" /* 0x60 - 0x6f */
- "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; /* 0x70 - 0x7f */
-#endif
-
extern void (*kd_mksound)(unsigned int, unsigned int);
@@ -407,8 +391,6 @@
request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
mach_sched_init = amiga_sched_init;
- mach_keyb_init = amiga_keyb_init;
- mach_kbdrate = amiga_kbdrate;
mach_init_IRQ = amiga_init_IRQ;
#ifndef CONFIG_APUS
mach_default_handler = &amiga_default_handler;
diff -Nru a/arch/ppc/config.in b/arch/ppc/config.in
--- a/arch/ppc/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/ppc/config.in Fri Jul 26 19:58:50 2002
@@ -575,7 +575,6 @@
mainmenu_option next_comment
comment 'IBM 40x options'
if [ "$CONFIG_STB03xxx" = "y" ]; then
- bool 'STB IR Keyboard' CONFIG_STB_KB
bool 'SICC Serial port' CONFIG_SERIAL_SICC
if [ "$CONFIG_SERIAL_SICC" = "y" -a "$CONFIG_UART0_TTYS1" = "y" ]; then
define_bool CONFIG_UART1_DFLT_CONSOLE y
@@ -624,3 +623,6 @@
bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
fi
endmenu
+
+source security/Config.in
+
diff -Nru a/arch/ppc/kernel/open_pic.c b/arch/ppc/kernel/open_pic.c
--- a/arch/ppc/kernel/open_pic.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/kernel/open_pic.c Fri Jul 26 19:58:51 2002
@@ -602,7 +602,7 @@
* -- Cort
*/
-void __init do_openpic_setup_cpu(void)
+void __devinit do_openpic_setup_cpu(void)
{
int i;
u32 msk = 1 << smp_hw_index[smp_processor_id()];
diff -Nru a/arch/ppc/kernel/ppc4xx_setup.c b/arch/ppc/kernel/ppc4xx_setup.c
--- a/arch/ppc/kernel/ppc4xx_setup.c Fri Jul 26 19:58:50 2002
+++ b/arch/ppc/kernel/ppc4xx_setup.c Fri Jul 26 19:58:50 2002
@@ -345,12 +345,6 @@
ppc_md.progress = ppc4xx_progress;
#endif
-#if defined(CONFIG_VT) && defined(CONFIG_PC_KEYBOARD)
-#if defined(CONFIG_REDWOOD_4) && defined(CONFIG_STB_KB)
- redwood_irkb_init();
-#endif
-#endif
-
/*
** m8xx_setup.c, prep_setup.c use
** defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
diff -Nru a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
--- a/arch/ppc/kernel/smp.c Fri Jul 26 19:58:52 2002
+++ b/arch/ppc/kernel/smp.c Fri Jul 26 19:58:52 2002
@@ -48,15 +48,17 @@
atomic_t ipi_recv;
atomic_t ipi_sent;
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
-unsigned int prof_multiplier[NR_CPUS];
-unsigned int prof_counter[NR_CPUS];
-unsigned long cache_decay_ticks;
-static int max_cpus __initdata = NR_CPUS;
-unsigned long cpu_online_map;
+unsigned int prof_multiplier[NR_CPUS] = { [1 ... NR_CPUS-1] = 1 };
+unsigned int prof_counter[NR_CPUS] = { [1 ... NR_CPUS-1] = 1 };
+unsigned long cache_decay_ticks = HZ/100;
+unsigned long cpu_online_map = 1UL;
+unsigned long cpu_possible_map = 1UL;
int smp_hw_index[NR_CPUS];
-static struct smp_ops_t *smp_ops;
struct thread_info *secondary_ti;
+/* SMP operations for this machine */
+static struct smp_ops_t *smp_ops;
+
/* all cpu mappings are 1-1 -- Cort */
volatile unsigned long cpu_callin_map[NR_CPUS];
@@ -70,10 +72,6 @@
static int __smp_call_function(void (*func) (void *info), void *info,
int wait, int target);
-#ifdef CONFIG_PPC_ISERIES
-extern void smp_iSeries_space_timers( unsigned nr );
-#endif
-
/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
*
* Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
@@ -291,6 +289,7 @@
atomic_inc(&call_data->finished);
}
+#if 0 /* Old boot code. */
void __init smp_boot_cpus(void)
{
int i, cpu_nr;
@@ -556,3 +555,156 @@
}
__setup("maxcpus=", maxcpus);
+#else /* New boot code */
+/* FIXME: Do this properly for all archs --RR */
+static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
+static unsigned int timebase_upper = 0, timebase_lower = 0;
+
+void __devinit
+smp_generic_give_timebase(void)
+{
+ spin_lock(&timebase_lock);
+ do {
+ timebase_upper = get_tbu();
+ timebase_lower = get_tbl();
+ } while (timebase_upper != get_tbu());
+ spin_unlock(&timebase_lock);
+
+ while (timebase_upper || timebase_lower)
+ rmb();
+}
+
+void __devinit
+smp_generic_take_timebase(void)
+{
+ int done = 0;
+
+ while (!done) {
+ spin_lock(&timebase_lock);
+ if (timebase_upper || timebase_lower) {
+ set_tb(timebase_upper, timebase_lower);
+ timebase_upper = 0;
+ timebase_lower = 0;
+ done = 1;
+ }
+ spin_unlock(&timebase_lock);
+ }
+}
+
+static void __devinit smp_store_cpu_info(int id)
+{
+ struct cpuinfo_PPC *c = &cpu_data[id];
+
+ /* assume bogomips are same for everything */
+ c->loops_per_jiffy = loops_per_jiffy;
+ c->pvr = mfspr(PVR);
+}
+
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
+ int num_cpus;
+
+ /* Fixup boot cpu */
+ smp_store_cpu_info(smp_processor_id());
+ cpu_callin_map[smp_processor_id()] = 1;
+
+ smp_ops = ppc_md.smp_ops;
+ if (smp_ops == NULL) {
+ printk("SMP not supported on this machine.\n");
+ return;
+ }
+
+ /* Probe platform for CPUs: always linear. */
+ num_cpus = smp_ops->probe();
+ cpu_possible_map = (1 << num_cpus)-1;
+
+ if (smp_ops->space_timers)
+ smp_ops->space_timers(num_cpus);
+}
+
+int __init setup_profiling_timer(unsigned int multiplier)
+{
+ return 0;
+}
+
+/* Processor coming up starts here */
+int __devinit start_secondary(void *unused)
+{
+ int cpu;
+
+ atomic_inc(&init_mm.mm_count);
+ current->active_mm = &init_mm;
+
+ cpu = smp_processor_id();
+ smp_store_cpu_info(cpu);
+ set_dec(tb_ticks_per_jiffy);
+ cpu_callin_map[cpu] = 1;
+
+ printk("CPU %i done callin...\n", cpu);
+ smp_ops->setup_cpu(cpu);
+ printk("CPU %i done setup...\n", cpu);
+ smp_ops->take_timebase();
+ printk("CPU %i done timebase take...\n", cpu);
+
+ return cpu_idle(NULL);
+}
+
+int __cpu_up(unsigned int cpu)
+{
+ struct pt_regs regs;
+ struct task_struct *p;
+ char buf[32];
+ int c;
+
+ /* create a process for the processor */
+ /* only regs.msr is actually used, and 0 is OK for it */
+ memset(®s, 0, sizeof(struct pt_regs));
+ p = do_fork(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0);
+ if (IS_ERR(p))
+ panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
+
+ init_idle(p, cpu);
+ unhash_process(p);
+
+ secondary_ti = p->thread_info;
+ p->thread_info->cpu = cpu;
+
+ /*
+ * There was a cache flush loop here to flush the cache
+ * to memory for the first 8MB of RAM. The cache flush
+ * has been pushed into the kick_cpu function for those
+ * platforms that need it.
+ */
+
+ /* wake up cpu */
+ smp_ops->kick_cpu(cpu);
+
+ /*
+ * wait to see if the cpu made a callin (is actually up).
+ * use this value that I found through experimentation.
+ * -- Cort
+ */
+ for (c = 1000; c && !cpu_callin_map[cpu]; c--)
+ udelay(100);
+
+ if (!cpu_callin_map[cpu]) {
+ sprintf(buf, "didn't find cpu %u", cpu);
+ if (ppc_md.progress) ppc_md.progress(buf, 0x360+cpu);
+ printk("Processor %u is stuck.\n", cpu);
+ return -ENOENT;
+ }
+
+ sprintf(buf, "found cpu %u", cpu);
+ if (ppc_md.progress) ppc_md.progress(buf, 0x350+cpu);
+ printk("Processor %d found.\n", cpu);
+
+ smp_ops->give_timebase();
+ set_bit(cpu, &cpu_online_map);
+ return 0;
+}
+
+void smp_cpus_done(unsigned int max_cpus)
+{
+ smp_ops->setup_cpu(0);
+}
+#endif
diff -Nru a/arch/ppc/platforms/apus_setup.c b/arch/ppc/platforms/apus_setup.c
--- a/arch/ppc/platforms/apus_setup.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/apus_setup.c Fri Jul 26 19:58:51 2002
@@ -34,7 +34,6 @@
#include
#include
#include
-#include
#include
unsigned long m68k_machtype;
@@ -42,16 +41,9 @@
extern void amiga_init_IRQ(void);
-extern int amiga_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode);
-extern char amiga_sysrq_xlate[128];
-
extern void apus_setup_pci_ptrs(void);
void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
-/* machine dependent keyboard functions */
-int (*mach_keyb_init) (void) __initdata = NULL;
-int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
-void (*mach_kbd_leds) (unsigned int) = NULL;
/* machine dependent irq functions */
void (*mach_init_IRQ) (void) __initdata = NULL;
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
@@ -562,32 +554,6 @@
APUS_WRITE(APUS_IPL_EMU, IPLEMU_DISABLEINT|ipl_emu);
}
-/****************************************************** keyboard */
-static int apus_kbd_setkeycode(unsigned int scancode, unsigned int keycode)
-{
- return -EOPNOTSUPP;
-}
-
-static int apus_kbd_getkeycode(unsigned int scancode)
-{
- return scancode > 127 ? -EINVAL : scancode;
-}
-
-static char apus_kbd_unexpected_up(unsigned char keycode)
-{
- return 0200;
-}
-
-static void apus_kbd_init_hw(void)
-{
-#ifdef CONFIG_APUS
- extern int amiga_keyb_init(void);
-
- amiga_keyb_init();
-#endif
-}
-
-
/****************************************************** debugging */
/* some serial hardware definitions */
@@ -851,9 +817,4 @@
ppc_md.find_end_of_memory = apus_find_end_of_memory;
ppc_md.setup_io_mappings = apus_map_io;
-
- /* These should not be used for the APUS yet, since it uses
- the M68K keyboard now. */
- ppc_md.kbd_translate = amiga_kbd_translate;
- ppc_md.kbd_unexpected_up = apus_kbd_unexpected_up;
}
diff -Nru a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
--- a/arch/ppc/platforms/chrp_setup.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/chrp_setup.c Fri Jul 26 19:58:51 2002
@@ -50,7 +50,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff -Nru a/arch/ppc/platforms/chrp_smp.c b/arch/ppc/platforms/chrp_smp.c
--- a/arch/ppc/platforms/chrp_smp.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/chrp_smp.c Fri Jul 26 19:58:51 2002
@@ -50,59 +50,61 @@
return smp_chrp_cpu_nr;
}
-static void __init
+static void __devinit
smp_chrp_kick_cpu(int nr)
{
*(unsigned long *)KERNELBASE = nr;
asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
}
-static void __init
+static void __devinit
smp_chrp_setup_cpu(int cpu_nr)
{
- static atomic_t ready = ATOMIC_INIT(1);
- static volatile int frozen = 0;
-
- /* FIXME: Hotplug cpu breaks all this --RR */
- if (cpu_nr == 0) {
- /* wait for all the others */
- while (atomic_read(&ready) < num_online_cpus())
- barrier();
- atomic_set(&ready, 1);
- /* freeze the timebase */
- call_rtas("freeze-time-base", 0, 1, NULL);
- mb();
- frozen = 1;
- /* XXX assumes this is not a 601 */
- set_tb(0, 0);
- last_jiffy_stamp(0) = 0;
- while (atomic_read(&ready) < num_online_cpus())
- barrier();
- /* thaw the timebase again */
- call_rtas("thaw-time-base", 0, 1, NULL);
- mb();
- frozen = 0;
- smp_tb_synchronized = 1;
- } else {
- atomic_inc(&ready);
- while (!frozen)
- barrier();
- set_tb(0, 0);
- last_jiffy_stamp(0) = 0;
- mb();
- atomic_inc(&ready);
- while (frozen)
- barrier();
- }
-
if (OpenPIC_Addr)
do_openpic_setup_cpu();
}
+static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
+static unsigned int timebase_upper = 0, timebase_lower = 0;
+
+void __devinit
+smp_chrp_give_timebase(void)
+{
+ spin_lock(&timebase_lock);
+ call_rtas("freeze-time-base", 0, 1, NULL);
+ timebase_upper = get_tbu();
+ timebase_lower = get_tbl();
+ spin_unlock(&timebase_lock);
+
+ while (timebase_upper || timebase_lower)
+ rmb();
+ call_rtas("thaw-time-base", 0, 1, NULL);
+}
+
+void __devinit
+smp_chrp_take_timebase(void)
+{
+ int done = 0;
+
+ while (!done) {
+ spin_lock(&timebase_lock);
+ if (timebase_upper || timebase_lower) {
+ set_tb(timebase_upper, timebase_lower);
+ timebase_upper = 0;
+ timebase_lower = 0;
+ done = 1;
+ }
+ spin_unlock(&timebase_lock);
+ }
+ printk("CPU %i taken timebase\n", smp_processor_id());
+}
+
/* CHRP with openpic */
struct smp_ops_t chrp_smp_ops __chrpdata = {
- smp_openpic_message_pass,
- smp_chrp_probe,
- smp_chrp_kick_cpu,
- smp_chrp_setup_cpu,
+ .message_pass = smp_openpic_message_pass,
+ .probe = smp_chrp_probe,
+ .kick_cpu = smp_chrp_kick_cpu,
+ .setup_cpu = smp_chrp_setup_cpu,
+ .give_timebase = smp_chrp_give_timebase,
+ .take_timebase = smp_chrp_take_timebase,
};
diff -Nru a/arch/ppc/platforms/gemini_setup.c b/arch/ppc/platforms/gemini_setup.c
--- a/arch/ppc/platforms/gemini_setup.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/gemini_setup.c Fri Jul 26 19:58:51 2002
@@ -528,6 +528,8 @@
smp_gemini_probe,
smp_gemini_kick_cpu,
smp_gemini_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
#endif /* CONFIG_SMP */
diff -Nru a/arch/ppc/platforms/iSeries_smp.c b/arch/ppc/platforms/iSeries_smp.c
--- a/arch/ppc/platforms/iSeries_smp.c Fri Jul 26 19:58:50 2002
+++ b/arch/ppc/platforms/iSeries_smp.c Fri Jul 26 19:58:50 2002
@@ -117,7 +117,7 @@
set_dec( xPaca[nr].default_decr );
}
-void smp_iSeries_space_timers( unsigned nr )
+static void smp_iSeries_space_timers(unsigned nr)
{
unsigned offset,i;
@@ -131,6 +131,9 @@
smp_iSeries_message_pass,
smp_iSeries_probe,
smp_iSeries_kick_cpu,
- smp_iSeries_setup_cpu
+ smp_iSeries_setup_cpu,
+ smp_iSeries_space_timers,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
diff -Nru a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c
--- a/arch/ppc/platforms/pmac_smp.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/pmac_smp.c Fri Jul 26 19:58:51 2002
@@ -612,6 +612,8 @@
smp_psurge_probe,
smp_psurge_kick_cpu,
smp_psurge_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
/* Core99 Macs (dual G4s) */
@@ -620,4 +622,6 @@
smp_core99_probe,
smp_core99_kick_cpu,
smp_core99_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
diff -Nru a/arch/ppc/platforms/pplus_setup.c b/arch/ppc/platforms/pplus_setup.c
--- a/arch/ppc/platforms/pplus_setup.c Fri Jul 26 19:58:52 2002
+++ b/arch/ppc/platforms/pplus_setup.c Fri Jul 26 19:58:52 2002
@@ -63,7 +63,6 @@
#include
#include
#include
-#include
#include
#include
@@ -310,6 +309,8 @@
smp_pplus_probe,
smp_pplus_kick_cpu,
smp_pplus_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
#endif /* CONFIG_SMP */
diff -Nru a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
--- a/arch/ppc/platforms/prep_setup.c Fri Jul 26 19:58:52 2002
+++ b/arch/ppc/platforms/prep_setup.c Fri Jul 26 19:58:52 2002
@@ -55,7 +55,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -757,6 +756,8 @@
smp_prep_probe,
smp_prep_kick_cpu,
smp_prep_setup_cpu,
+ .give_timebase = smp_generic_give_timebase,
+ .take_timebase = smp_generic_take_timebase,
};
#endif /* CONFIG_SMP */
diff -Nru a/arch/ppc/platforms/redwood.c b/arch/ppc/platforms/redwood.c
--- a/arch/ppc/platforms/redwood.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/redwood.c Fri Jul 26 19:58:51 2002
@@ -45,22 +45,3 @@
board_init(void)
{
}
-
-/* hack; blame me dan. -brad */
-#ifdef CONFIG_INPUT_KEYBDEV
-
-void
-handle_scancode(unsigned char scancode, int down)
-{
- printk("handle_scancode(scancode=0x%x, down=%d)\n", scancode, down);
-}
-
-static void
-kbd_bh(unsigned long dummy)
-{
-}
-
-DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
-void (*kbd_ledfunc) (unsigned int led);
-
-#endif
diff -Nru a/arch/ppc/platforms/sandpoint_setup.c b/arch/ppc/platforms/sandpoint_setup.c
--- a/arch/ppc/platforms/sandpoint_setup.c Fri Jul 26 19:58:52 2002
+++ b/arch/ppc/platforms/sandpoint_setup.c Fri Jul 26 19:58:52 2002
@@ -83,7 +83,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff -Nru a/arch/ppc/platforms/spruce.h b/arch/ppc/platforms/spruce.h
--- a/arch/ppc/platforms/spruce.h Fri Jul 26 19:58:50 2002
+++ b/arch/ppc/platforms/spruce.h Fri Jul 26 19:58:50 2002
@@ -58,16 +58,5 @@
#define SPRUCE_NVRAM_BASE_ADDR 0xff800000
#define SPRUCE_RTC_BASE_ADDR SPRUCE_NVRAM_BASE_ADDR
-#define KEYBOARD_IRQ 22
-#define AUX_IRQ 21
-
-unsigned char spruce_read_keyb_data(void);
-unsigned char spruce_read_keyb_status(void);
-
-#define kbd_read_input spruce_read_keyb_data
-#define kbd_read_status spruce_read_keyb_status
-#define kbd_write_output(val) *((unsigned char *)0xff810000) = (char)val
-#define kbd_write_command(val) *((unsigned char *)0xff810001) = (char)val
-
#endif /* __ASM_SPRUCE_H__ */
#endif /* __KERNEL__ */
diff -Nru a/arch/ppc/platforms/spruce_setup.c b/arch/ppc/platforms/spruce_setup.c
--- a/arch/ppc/platforms/spruce_setup.c Fri Jul 26 19:58:50 2002
+++ b/arch/ppc/platforms/spruce_setup.c Fri Jul 26 19:58:50 2002
@@ -46,7 +46,6 @@
#include
#include
-#include
#include
#include
#include
@@ -199,49 +198,6 @@
{
io_block_mapping(SPRUCE_PCI_IO_BASE, SPRUCE_PCI_PHY_IO_BASE,
0x08000000, _PAGE_IO);
-}
-
-unsigned char spruce_read_keyb_status(void)
-{
- unsigned long kbd_status;
-
- __raw_writel(0x00000088, 0xff500008);
- eieio();
-
- __raw_writel(0x03000000, 0xff50000c);
- eieio();
-
- asm volatile(" lis 7,0xff88 \n
- ori 7,7,0x8 \n
- lswi 6,7,0x8 \n
- mr %0,6 \n"
- : "=r" (kbd_status) :: "6", "7");
-
- __raw_writel(0x00000000, 0xff50000c);
- eieio();
-
- return (unsigned char)(kbd_status >> 24);
-}
-
-unsigned char spruce_read_keyb_data(void)
-{
- unsigned long kbd_data;
-
- __raw_writel(0x00000088, 0xff500008);
- eieio();
-
- __raw_writel(0x03000000, 0xff50000c);
- eieio();
-
- asm volatile(" lis 7,0xff88 \n
- lswi 6,7,0x8 \n
- mr %0,6 \n"
- : "=r" (kbd_data) :: "6", "7");
-
- __raw_writel(0x00000000, 0xff50000c);
- eieio();
-
- return (unsigned char)(kbd_data >> 24);
}
void __init
diff -Nru a/arch/ppc/platforms/walnut.c b/arch/ppc/platforms/walnut.c
--- a/arch/ppc/platforms/walnut.c Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/walnut.c Fri Jul 26 19:58:51 2002
@@ -45,6 +45,8 @@
#include
#endif
+#include "walnut.h"
+
#undef DEBUG
#ifdef DEBUG
@@ -82,9 +84,6 @@
void __init
board_setup_arch(void)
{
-#define WALNUT_PS2_BASE 0xF0100000
-#define WALNUT_FPGA_BASE 0xF0300000
-
void *fpga_brdc;
unsigned char fpga_brdc_data;
void *fpga_enable;
diff -Nru a/arch/ppc/platforms/walnut.h b/arch/ppc/platforms/walnut.h
--- a/arch/ppc/platforms/walnut.h Fri Jul 26 19:58:51 2002
+++ b/arch/ppc/platforms/walnut.h Fri Jul 26 19:58:51 2002
@@ -73,14 +73,6 @@
#define WALNUT_PS2_BASE 0xF0100000
#define WALNUT_FPGA_BASE 0xF0300000
-
-extern void *kb_cs;
-extern void *kb_data;
-#define kbd_read_input() readb(kb_data)
-#define kbd_read_status() readb(kb_cs)
-#define kbd_write_output(val) writeb(val, kb_data)
-#define kbd_write_command(val) writeb(val, kb_cs)
-
#define PPC4xx_MACHINE_NAME "IBM Walnut"
#endif /* !__ASSEMBLY__ */
diff -Nru a/arch/ppc64/config.in b/arch/ppc64/config.in
--- a/arch/ppc64/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/ppc64/config.in Fri Jul 26 19:58:50 2002
@@ -92,9 +92,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -226,4 +226,5 @@
fi
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/s390/config.in b/arch/s390/config.in
--- a/arch/s390/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/s390/config.in Fri Jul 26 19:58:51 2002
@@ -75,4 +75,5 @@
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/s390x/config.in b/arch/s390x/config.in
--- a/arch/s390x/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/s390x/config.in Fri Jul 26 19:58:50 2002
@@ -78,4 +78,5 @@
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/sh/config.in b/arch/sh/config.in
--- a/arch/sh/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/sh/config.in Fri Jul 26 19:58:51 2002
@@ -211,9 +211,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -369,4 +369,5 @@
fi
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/sparc/config.in b/arch/sparc/config.in
--- a/arch/sparc/config.in Fri Jul 26 19:58:50 2002
+++ b/arch/sparc/config.in Fri Jul 26 19:58:50 2002
@@ -104,9 +104,9 @@
if [ "$CONFIG_PCI" = "y" ]; then
mainmenu_option next_comment
- comment 'ATA/IDE/MFM/RLL support'
+ comment 'ATA/ATAPI/MFM/RLL support'
- tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+ tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -242,4 +242,5 @@
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/sparc64/config.in b/arch/sparc64/config.in
--- a/arch/sparc64/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/sparc64/config.in Fri Jul 26 19:58:51 2002
@@ -105,9 +105,9 @@
fi
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL device support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL device support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -293,4 +293,5 @@
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/arch/x86_64/config.in b/arch/x86_64/config.in
--- a/arch/x86_64/config.in Fri Jul 26 19:58:51 2002
+++ b/arch/x86_64/config.in Fri Jul 26 19:58:51 2002
@@ -126,9 +126,9 @@
source drivers/telephony/Config.in
mainmenu_option next_comment
-comment 'ATA/IDE/MFM/RLL support'
+comment 'ATA/ATAPI/MFM/RLL support'
-tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
+tristate 'ATA/ATAPI/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
@@ -229,4 +229,5 @@
fi
endmenu
+source security/Config.in
source lib/Config.in
diff -Nru a/drivers/acpi/ac.c b/drivers/acpi/ac.c
--- a/drivers/acpi/ac.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/ac.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_ac.c - ACPI AC Adapter Driver ($Revision: 26 $)
+ * acpi_ac.c - ACPI AC Adapter Driver ($Revision: 27 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -47,13 +47,13 @@
int acpi_ac_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_ac_driver = {
- name: ACPI_AC_DRIVER_NAME,
- class: ACPI_AC_CLASS,
- ids: ACPI_AC_HID,
- ops: {
- add: acpi_ac_add,
- remove: acpi_ac_remove,
- },
+ .name = ACPI_AC_DRIVER_NAME,
+ .class = ACPI_AC_CLASS,
+ .ids = ACPI_AC_HID,
+ .ops = {
+ .add = acpi_ac_add,
+ .remove = acpi_ac_remove,
+ },
};
struct acpi_ac {
diff -Nru a/drivers/acpi/battery.c b/drivers/acpi/battery.c
--- a/drivers/acpi/battery.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/battery.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_battery.c - ACPI Battery Driver ($Revision: 36 $)
+ * acpi_battery.c - ACPI Battery Driver ($Revision: 37 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -52,13 +52,13 @@
static int acpi_battery_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_battery_driver = {
- name: ACPI_BATTERY_DRIVER_NAME,
- class: ACPI_BATTERY_CLASS,
- ids: ACPI_BATTERY_HID,
- ops: {
- add: acpi_battery_add,
- remove: acpi_battery_remove,
- },
+ .name = ACPI_BATTERY_DRIVER_NAME,
+ .class = ACPI_BATTERY_CLASS,
+ .ids = ACPI_BATTERY_HID,
+ .ops = {
+ .add = acpi_battery_add,
+ .remove = acpi_battery_remove,
+ },
};
struct acpi_battery_status {
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/bus.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_bus.c - ACPI Bus Driver ($Revision: 79 $)
+ * acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
*
* Copyright (C) 2001, 2002 Paul Diefenbaugh
*
@@ -97,10 +97,10 @@
static int acpi_device_resume(struct device *dev, u32 stage);
static struct device_driver acpi_bus_driver = {
- probe: acpi_device_probe,
- remove: acpi_device_remove,
- suspend: acpi_device_suspend,
- resume: acpi_device_resume,
+ .probe = acpi_device_probe,
+ .remove = acpi_device_remove,
+ .suspend = acpi_device_suspend,
+ .resume = acpi_device_resume,
};
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/button.c Fri Jul 26 19:58:50 2002
@@ -1,5 +1,5 @@
/*
- * acpi_button.c - ACPI Button Driver ($Revision: 29 $)
+ * acpi_button.c - ACPI Button Driver ($Revision: 30 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -47,13 +47,13 @@
int acpi_button_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_button_driver = {
- name: ACPI_BUTTON_DRIVER_NAME,
- class: ACPI_BUTTON_CLASS,
- ids: "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
- ops: {
- add: acpi_button_add,
- remove: acpi_button_remove,
- },
+ .name = ACPI_BUTTON_DRIVER_NAME,
+ .class = ACPI_BUTTON_CLASS,
+ .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
+ .ops = {
+ .add = acpi_button_add,
+ .remove = acpi_button_remove,
+ },
};
struct acpi_button {
diff -Nru a/drivers/acpi/debugger/dbcmds.c b/drivers/acpi/debugger/dbcmds.c
--- a/drivers/acpi/debugger/dbcmds.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/debugger/dbcmds.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 84 $
+ * $Revision: 85 $
*
******************************************************************************/
@@ -31,6 +31,7 @@
#include "acevents.h"
#include "acdebug.h"
#include "acresrc.h"
+#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER
@@ -342,7 +343,7 @@
num_statements = ACPI_STRTOUL (statements, NULL, 0);
}
- acpi_db_display_op (NULL, op, num_statements);
+ acpi_dm_disassemble (NULL, op, num_statements);
}
diff -Nru a/drivers/acpi/debugger/dbfileio.c b/drivers/acpi/debugger/dbfileio.c
--- a/drivers/acpi/debugger/dbfileio.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/debugger/dbfileio.c Fri Jul 26 19:58:50 2002
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 64 $
+ * $Revision: 67 $
*
******************************************************************************/
@@ -30,7 +30,7 @@
#include "acnamesp.h"
#include "actables.h"
-#ifdef ENABLE_DEBUGGER
+#if (defined ENABLE_DEBUGGER || defined ACPI_DISASSEMBLER)
#define _COMPONENT ACPI_DEBUGGER
ACPI_MODULE_NAME ("dbfileio")
@@ -86,6 +86,7 @@
}
+#ifdef ENABLE_DEBUGGER
/*******************************************************************************
*
* FUNCTION: Acpi_db_close_debug_file
@@ -148,6 +149,7 @@
#endif
}
+#endif
#ifdef ACPI_APPLICATION
@@ -190,7 +192,7 @@
status = acpi_tb_validate_table_header (&table_header);
if ((ACPI_FAILURE (status)) ||
- (table_header.length > 524288)) /* 1/2 Mbyte should be enough */ {
+ (table_header.length > 0x800000)) /* 8 Mbyte should be enough */ {
acpi_os_printf ("Table header is invalid!\n");
return (AE_ERROR);
}
@@ -296,7 +298,7 @@
}
-#ifndef PARSER_ONLY
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
if (ACPI_FAILURE (status)) {
/* Uninstall table and free the buffer */
@@ -330,7 +332,7 @@
/* Get the entire file */
- acpi_os_printf ("Loading Acpi table from file %s\n", filename);
+ fprintf (stderr, "Loading Acpi table from file %s\n", filename);
status = acpi_db_load_table (fp, &acpi_gbl_db_table_ptr, &table_length);
fclose(fp);
@@ -383,8 +385,8 @@
return (status);
}
- acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
- acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
+ fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
+ acpi_gbl_db_table_ptr->signature);
acpi_gbl_acpi_hardware_present = FALSE;
diff -Nru a/drivers/acpi/debugger/dbxface.c b/drivers/acpi/debugger/dbxface.c
--- a/drivers/acpi/debugger/dbxface.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/debugger/dbxface.c Fri Jul 26 19:58:52 2002
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 59 $
+ * $Revision: 61 $
*
******************************************************************************/
@@ -27,6 +27,7 @@
#include "acpi.h"
#include "amlcode.h"
#include "acdebug.h"
+#include "acdisasm.h"
#ifdef ENABLE_DEBUGGER
@@ -164,7 +165,7 @@
/* Now we can display it */
- acpi_db_display_op (walk_state, display_op, ACPI_UINT32_MAX);
+ acpi_dm_disassemble (walk_state, display_op, ACPI_UINT32_MAX);
if ((op->common.aml_opcode == AML_IF_OP) ||
(op->common.aml_opcode == AML_WHILE_OP)) {
@@ -351,7 +352,6 @@
}
if (!acpi_gbl_db_opt_verbose) {
- acpi_gbl_db_disasm_indent = " ";
acpi_gbl_db_opt_disasm = TRUE;
acpi_gbl_db_opt_stats = FALSE;
}
diff -Nru a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
--- a/drivers/acpi/dispatcher/dsobject.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/dispatcher/dsobject.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 104 $
+ * $Revision: 105 $
*
*****************************************************************************/
@@ -35,6 +35,7 @@
ACPI_MODULE_NAME ("dsobject")
+#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_one_object
@@ -218,199 +219,6 @@
/*****************************************************************************
*
- * FUNCTION: Acpi_ds_init_object_from_op
- *
- * PARAMETERS: Walk_state - Current walk state
- * Op - Parser op used to init the internal object
- * Opcode - AML opcode associated with the object
- * Ret_obj_desc - Namespace object to be initialized
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize a namespace object from a parser Op and its
- * associated arguments. The namespace object is a more compact
- * representation of the Op and its arguments.
- *
- ****************************************************************************/
-
-acpi_status
-acpi_ds_init_object_from_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *op,
- u16 opcode,
- acpi_operand_object **ret_obj_desc)
-{
- const acpi_opcode_info *op_info;
- acpi_operand_object *obj_desc;
- acpi_status status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE ("Ds_init_object_from_op");
-
-
- obj_desc = *ret_obj_desc;
- op_info = acpi_ps_get_opcode_info (opcode);
- if (op_info->class == AML_CLASS_UNKNOWN) {
- /* Unknown opcode */
-
- return_ACPI_STATUS (AE_TYPE);
- }
-
- /* Perform per-object initialization */
-
- switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
- case ACPI_TYPE_BUFFER:
-
- /*
- * Defer evaluation of Buffer Term_arg operand
- */
- obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
- obj_desc->buffer.aml_start = op->named.data;
- obj_desc->buffer.aml_length = op->named.length;
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- /*
- * Defer evaluation of Package Term_arg operand
- */
- obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
- obj_desc->package.aml_start = op->named.data;
- obj_desc->package.aml_length = op->named.length;
- break;
-
-
- case ACPI_TYPE_INTEGER:
-
- switch (op_info->type) {
- case AML_TYPE_CONSTANT:
- /*
- * Resolve AML Constants here - AND ONLY HERE!
- * All constants are integers.
- * We mark the integer with a flag that indicates that it started life
- * as a constant -- so that stores to constants will perform as expected (noop).
- * (Zero_op is used as a placeholder for optional target operands.)
- */
- obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
-
- switch (opcode) {
- case AML_ZERO_OP:
-
- obj_desc->integer.value = 0;
- break;
-
- case AML_ONE_OP:
-
- obj_desc->integer.value = 1;
- break;
-
- case AML_ONES_OP:
-
- obj_desc->integer.value = ACPI_INTEGER_MAX;
-
- /* Truncate value if we are executing from a 32-bit ACPI table */
-
- acpi_ex_truncate_for32bit_table (obj_desc);
- break;
-
- case AML_REVISION_OP:
-
- obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
- break;
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
- status = AE_AML_OPERAND_TYPE;
- break;
- }
- break;
-
-
- case AML_TYPE_LITERAL:
-
- obj_desc->integer.value = op->common.value.integer;
- break;
-
-
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
- status = AE_AML_OPERAND_TYPE;
- break;
- }
- break;
-
-
- case ACPI_TYPE_STRING:
-
- obj_desc->string.pointer = op->common.value.string;
- obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
-
- /*
- * The string is contained in the ACPI table, don't ever try
- * to delete it
- */
- obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
- break;
-
-
- case ACPI_TYPE_METHOD:
- break;
-
-
- case INTERNAL_TYPE_REFERENCE:
-
- switch (op_info->type) {
- case AML_TYPE_LOCAL_VARIABLE:
-
- /* Split the opcode into a base opcode + offset */
-
- obj_desc->reference.opcode = AML_LOCAL_OP;
- obj_desc->reference.offset = opcode - AML_LOCAL_OP;
- acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
- walk_state, (acpi_namespace_node **) &obj_desc->reference.object);
- break;
-
-
- case AML_TYPE_METHOD_ARGUMENT:
-
- /* Split the opcode into a base opcode + offset */
-
- obj_desc->reference.opcode = AML_ARG_OP;
- obj_desc->reference.offset = opcode - AML_ARG_OP;
- break;
-
-
- default: /* Other literals, etc.. */
-
- if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
- /* Node was saved in Op */
-
- obj_desc->reference.node = op->common.node;
- }
-
- obj_desc->reference.opcode = opcode;
- break;
- }
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
- ACPI_GET_OBJECT_TYPE (obj_desc)));
-
- status = AE_AML_OPERAND_TYPE;
- break;
- }
-
- return_ACPI_STATUS (status);
-}
-
-
-/*****************************************************************************
- *
* FUNCTION: Acpi_ds_build_internal_object
*
* PARAMETERS: Walk_state - Current walk state
@@ -778,6 +586,204 @@
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
+ return_ACPI_STATUS (status);
+}
+
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
+
+/*****************************************************************************
+ *
+ * FUNCTION: Acpi_ds_init_object_from_op
+ *
+ * PARAMETERS: Walk_state - Current walk state
+ * Op - Parser op used to init the internal object
+ * Opcode - AML opcode associated with the object
+ * Ret_obj_desc - Namespace object to be initialized
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize a namespace object from a parser Op and its
+ * associated arguments. The namespace object is a more compact
+ * representation of the Op and its arguments.
+ *
+ ****************************************************************************/
+
+acpi_status
+acpi_ds_init_object_from_op (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op,
+ u16 opcode,
+ acpi_operand_object **ret_obj_desc)
+{
+ const acpi_opcode_info *op_info;
+ acpi_operand_object *obj_desc;
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE ("Ds_init_object_from_op");
+
+
+ obj_desc = *ret_obj_desc;
+ op_info = acpi_ps_get_opcode_info (opcode);
+ if (op_info->class == AML_CLASS_UNKNOWN) {
+ /* Unknown opcode */
+
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /* Perform per-object initialization */
+
+ switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * Defer evaluation of Buffer Term_arg operand
+ */
+ obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
+ obj_desc->buffer.aml_start = op->named.data;
+ obj_desc->buffer.aml_length = op->named.length;
+ break;
+
+
+ case ACPI_TYPE_PACKAGE:
+
+ /*
+ * Defer evaluation of Package Term_arg operand
+ */
+ obj_desc->package.node = (acpi_namespace_node *) walk_state->operands[0];
+ obj_desc->package.aml_start = op->named.data;
+ obj_desc->package.aml_length = op->named.length;
+ break;
+
+
+ case ACPI_TYPE_INTEGER:
+
+ switch (op_info->type) {
+ case AML_TYPE_CONSTANT:
+ /*
+ * Resolve AML Constants here - AND ONLY HERE!
+ * All constants are integers.
+ * We mark the integer with a flag that indicates that it started life
+ * as a constant -- so that stores to constants will perform as expected (noop).
+ * (Zero_op is used as a placeholder for optional target operands.)
+ */
+ obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
+
+ switch (opcode) {
+ case AML_ZERO_OP:
+
+ obj_desc->integer.value = 0;
+ break;
+
+ case AML_ONE_OP:
+
+ obj_desc->integer.value = 1;
+ break;
+
+ case AML_ONES_OP:
+
+ obj_desc->integer.value = ACPI_INTEGER_MAX;
+
+ /* Truncate value if we are executing from a 32-bit ACPI table */
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+ acpi_ex_truncate_for32bit_table (obj_desc);
+#endif
+ break;
+
+ case AML_REVISION_OP:
+
+ obj_desc->integer.value = ACPI_CA_SUPPORT_LEVEL;
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
+ status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ break;
+
+
+ case AML_TYPE_LITERAL:
+
+ obj_desc->integer.value = op->common.value.integer;
+ break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
+ status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ obj_desc->string.pointer = op->common.value.string;
+ obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
+
+ /*
+ * The string is contained in the ACPI table, don't ever try
+ * to delete it
+ */
+ obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+ break;
+
+
+ case INTERNAL_TYPE_REFERENCE:
+
+ switch (op_info->type) {
+ case AML_TYPE_LOCAL_VARIABLE:
+
+ /* Split the opcode into a base opcode + offset */
+
+ obj_desc->reference.opcode = AML_LOCAL_OP;
+ obj_desc->reference.offset = opcode - AML_LOCAL_OP;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
+ walk_state, (acpi_namespace_node **) &obj_desc->reference.object);
+#endif
+ break;
+
+
+ case AML_TYPE_METHOD_ARGUMENT:
+
+ /* Split the opcode into a base opcode + offset */
+
+ obj_desc->reference.opcode = AML_ARG_OP;
+ obj_desc->reference.offset = opcode - AML_ARG_OP;
+ break;
+
+ default: /* Other literals, etc.. */
+
+ if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
+ /* Node was saved in Op */
+
+ obj_desc->reference.node = op->common.node;
+ }
+
+ obj_desc->reference.opcode = opcode;
+ break;
+ }
+ break;
+
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
+ ACPI_GET_OBJECT_TYPE (obj_desc)));
+
+ status = AE_AML_OPERAND_TYPE;
+ break;
+ }
+
return_ACPI_STATUS (status);
}
diff -Nru a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
--- a/drivers/acpi/dispatcher/dsutils.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/dispatcher/dsutils.c Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 93 $
+ * $Revision: 94 $
*
******************************************************************************/
@@ -35,6 +35,7 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsutils")
+#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -237,6 +238,47 @@
/*******************************************************************************
*
+ * FUNCTION: Acpi_ds_resolve_operands
+ *
+ * PARAMETERS: Walk_state - Current walk state with operands on stack
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Resolve all operands to their values. Used to prepare
+ * arguments to a control method invocation (a call from one
+ * method to another.)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ds_resolve_operands (
+ acpi_walk_state *walk_state)
+{
+ u32 i;
+ acpi_status status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
+
+
+ /*
+ * Attempt to resolve each of the valid operands
+ * Method arguments are passed by value, not by reference
+ */
+ for (i = 0; i < walk_state->num_operands; i++) {
+ status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
+ if (ACPI_FAILURE (status)) {
+ break;
+ }
+ }
+
+ return_ACPI_STATUS (status);
+}
+#endif
+
+
+/*******************************************************************************
+ *
* FUNCTION: Acpi_ds_create_operand
*
* PARAMETERS: Walk_state
@@ -514,43 +556,4 @@
return_ACPI_STATUS (status);
}
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ds_resolve_operands
- *
- * PARAMETERS: Walk_state - Current walk state with operands on stack
- *
- * RETURN: Status
- *
- * DESCRIPTION: Resolve all operands to their values. Used to prepare
- * arguments to a control method invocation (a call from one
- * method to another.)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ds_resolve_operands (
- acpi_walk_state *walk_state)
-{
- u32 i;
- acpi_status status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_PTR ("Ds_resolve_operands", walk_state);
-
-
- /*
- * Attempt to resolve each of the valid operands
- * Method arguments are passed by value, not by reference
- */
- for (i = 0; i < walk_state->num_operands; i++) {
- status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
- if (ACPI_FAILURE (status)) {
- break;
- }
- }
-
- return_ACPI_STATUS (status);
-}
diff -Nru a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
--- a/drivers/acpi/dispatcher/dswload.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/dispatcher/dswload.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 67 $
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -70,9 +70,11 @@
break;
case 3:
+#ifndef ACPI_NO_METHOD_EXECUTION
walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_exec_begin_op;
walk_state->ascending_callback = acpi_ds_exec_end_op;
+#endif
break;
default:
@@ -169,6 +171,11 @@
op->named.name = node->name.integer;
+#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
+ op->named.path = (u8 *) path;
+#endif
+
+
/*
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
@@ -221,6 +228,7 @@
object_type = walk_state->op_info->object_type;
+#ifndef ACPI_NO_METHOD_EXECUTION
if (walk_state->op_info->flags & AML_FIELD) {
if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP ||
@@ -238,6 +246,7 @@
return (status);
}
}
+#endif
if (op->common.aml_opcode == AML_NAME_OP) {
/* For Name opcode, get the object type from the argument */
@@ -430,7 +439,9 @@
acpi_namespace_node *node;
acpi_parse_object *arg;
acpi_namespace_node *new_node;
+#ifndef ACPI_NO_METHOD_EXECUTION
u32 i;
+#endif
ACPI_FUNCTION_NAME ("Ds_load2_end_op");
@@ -478,6 +489,7 @@
}
}
+
/*
* Named operations are as follows:
*
@@ -515,6 +527,8 @@
arg = op->common.value.arg;
switch (walk_state->op_info->type) {
+#ifndef ACPI_NO_METHOD_EXECUTION
+
case AML_TYPE_CREATE_FIELD:
/*
@@ -604,7 +618,7 @@
}
break;
-
+#endif /* ACPI_NO_METHOD_EXECUTION */
case AML_TYPE_NAMED_COMPLEX:
@@ -629,6 +643,7 @@
break;
+#ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP:
/*
* The Op_region is not fully parsed at this time. Only valid argument is the Space_id.
@@ -656,6 +671,7 @@
status = acpi_ds_create_node (walk_state, node, op);
break;
+#endif /* ACPI_NO_METHOD_EXECUTION */
default:
diff -Nru a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
--- a/drivers/acpi/dispatcher/dswstate.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/dispatcher/dswstate.c Fri Jul 26 19:58:52 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 65 $
+ * $Revision: 67 $
*
*****************************************************************************/
@@ -837,7 +837,7 @@
/* Init the method args/local */
-#ifndef _ACPI_ASL_COMPILER
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
acpi_ds_method_data_init (walk_state);
#endif
@@ -858,7 +858,6 @@
}
-#ifndef _ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: Acpi_ds_init_aml_walk
@@ -943,7 +942,6 @@
status = acpi_ds_init_callbacks (walk_state, pass_number);
return_ACPI_STATUS (status);
}
-#endif
/*******************************************************************************
diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c
--- a/drivers/acpi/ec.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/ec.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 35 $)
+ * acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 38 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -62,15 +62,15 @@
static int acpi_ec_stop (struct acpi_device *device, int type);
static struct acpi_driver acpi_ec_driver = {
- name: ACPI_EC_DRIVER_NAME,
- class: ACPI_EC_CLASS,
- ids: ACPI_EC_HID,
- ops: {
- add: acpi_ec_add,
- remove: acpi_ec_remove,
- start: acpi_ec_start,
- stop: acpi_ec_stop,
- },
+ .name = ACPI_EC_DRIVER_NAME,
+ .class = ACPI_EC_CLASS,
+ .ids = ACPI_EC_HID,
+ .ops = {
+ .add = acpi_ec_add,
+ .remove = acpi_ec_remove,
+ .start = acpi_ec_start,
+ .stop = acpi_ec_stop,
+ },
};
struct acpi_ec {
@@ -134,7 +134,7 @@
acpi_ec_read (
struct acpi_ec *ec,
u8 address,
- u8 *data)
+ u32 *data)
{
acpi_status status = AE_OK;
int result = 0;
@@ -167,7 +167,7 @@
goto end;
- acpi_hw_low_level_read(8, (u32*) data, &ec->data_addr, 0);
+ acpi_hw_low_level_read(8, data, &ec->data_addr, 0);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
*data, address));
@@ -237,7 +237,7 @@
static int
acpi_ec_query (
struct acpi_ec *ec,
- u8 *data)
+ u32 *data)
{
int result = 0;
acpi_status status = AE_OK;
@@ -269,7 +269,7 @@
if (result)
goto end;
- acpi_hw_low_level_read(8, (u32*) data, &ec->data_addr, 0);
+ acpi_hw_low_level_read(8, data, &ec->data_addr, 0);
if (!*data)
result = -ENODATA;
@@ -328,7 +328,7 @@
{
acpi_status status = AE_OK;
struct acpi_ec *ec = (struct acpi_ec *) data;
- u8 value = 0;
+ u32 value = 0;
unsigned long flags = 0;
struct acpi_ec_query_data *query_data = NULL;
@@ -336,7 +336,7 @@
return;
spin_lock_irqsave(&ec->lock, flags);
- acpi_hw_low_level_read(8, (u32*) &value, &ec->command_addr, 0);
+ acpi_hw_low_level_read(8, &value, &ec->command_addr, 0);
spin_unlock_irqrestore(&ec->lock, flags);
/* TBD: Implement asynch events!
@@ -398,6 +398,7 @@
{
int result = 0;
struct acpi_ec *ec = NULL;
+ u32 temp = 0;
ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
@@ -408,7 +409,8 @@
switch (function) {
case ACPI_READ:
- result = acpi_ec_read(ec, (u8) address, (u8*) value);
+ result = acpi_ec_read(ec, (u8) address, &temp);
+ *value = (acpi_integer) temp;
break;
case ACPI_WRITE:
result = acpi_ec_write(ec, (u8) address, (u8) *value);
diff -Nru a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
--- a/drivers/acpi/executer/excreate.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/executer/excreate.c Fri Jul 26 19:58:52 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 92 $
+ * $Revision: 93 $
*
*****************************************************************************/
@@ -36,6 +36,7 @@
ACPI_MODULE_NAME ("excreate")
+#ifndef ACPI_NO_METHOD_EXECUTION
/*****************************************************************************
*
* FUNCTION: Acpi_ex_create_alias
@@ -490,6 +491,7 @@
return_ACPI_STATUS (status);
}
+#endif
/*****************************************************************************
*
diff -Nru a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
--- a/drivers/acpi/executer/exdump.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/executer/exdump.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 156 $
+ * $Revision: 157 $
*
*****************************************************************************/
@@ -575,14 +575,14 @@
{
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
{
- return;
+ return_VOID;
}
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND)
{
acpi_os_printf ("Ex_dump_object_descriptor: %p is not a valid ACPI object\n", obj_desc);
- return;
+ return_VOID;
}
/* Common Fields */
diff -Nru a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
--- a/drivers/acpi/executer/exoparg1.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/executer/exoparg1.c Fri Jul 26 19:58:52 2002
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 140 $
+ * $Revision: 141 $
*
*****************************************************************************/
@@ -804,16 +804,7 @@
switch (operand[0]->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD:
- /* Ensure that the Buffer arguments are evaluated */
-
temp_desc = operand[0]->reference.object;
-#if 0
-
- status = acpi_ds_get_buffer_arguments (temp_desc);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-#endif
/*
* Create a new object that contains one element of the
@@ -841,14 +832,6 @@
case ACPI_TYPE_PACKAGE:
-#if 0
- /* Ensure that the Package arguments are evaluated */
-
- status = acpi_ds_get_package_arguments (operand[0]->reference.object);
- if (ACPI_FAILURE (status)) {
- goto cleanup;
- }
-#endif
/*
* Return the referenced element of the package. We must add
* another reference to the referenced object, however.
@@ -883,6 +866,11 @@
case AML_REF_OF_OP:
return_desc = operand[0]->reference.object;
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) {
+
+ return_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) return_desc);
+ }
/* Add another reference to the object! */
diff -Nru a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
--- a/drivers/acpi/executer/exutils.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/executer/exutils.c Fri Jul 26 19:58:50 2002
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 100 $
+ * $Revision: 102 $
*
*****************************************************************************/
@@ -52,6 +52,34 @@
/*******************************************************************************
*
+ * FUNCTION: Acpi_ex_validate_object_type
+ *
+ * PARAMETERS: Type Object type to validate
+ *
+ * DESCRIPTION: Determine if a type is a valid ACPI object type
+ *
+ ******************************************************************************/
+
+u8
+acpi_ex_validate_object_type (
+ acpi_object_type type)
+{
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
+ (type > INTERNAL_TYPE_MAX)) {
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+#ifndef ACPI_NO_METHOD_EXECUTION
+
+/*******************************************************************************
+ *
* FUNCTION: Acpi_ex_enter_interpreter
*
* PARAMETERS: None
@@ -118,33 +146,6 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_ex_validate_object_type
- *
- * PARAMETERS: Type Object type to validate
- *
- * DESCRIPTION: Determine if a type is a valid ACPI object type
- *
- ******************************************************************************/
-
-u8
-acpi_ex_validate_object_type (
- acpi_object_type type)
-{
-
- ACPI_FUNCTION_ENTRY ();
-
-
- if ((type > ACPI_TYPE_MAX && type < INTERNAL_TYPE_BEGIN) ||
- (type > INTERNAL_TYPE_MAX)) {
- return (FALSE);
- }
-
- return (TRUE);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: Acpi_ex_truncate_for32bit_table
*
* PARAMETERS: Obj_desc - Object to be truncated
@@ -263,6 +264,8 @@
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n"));
}
}
+
+ return_VOID;
}
@@ -378,4 +381,4 @@
}
}
-
+#endif
diff -Nru a/drivers/acpi/fan.c b/drivers/acpi/fan.c
--- a/drivers/acpi/fan.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/fan.c Fri Jul 26 19:58:50 2002
@@ -1,5 +1,5 @@
/*
- * acpi_fan.c - ACPI Fan Driver ($Revision: 28 $)
+ * acpi_fan.c - ACPI Fan Driver ($Revision: 29 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -47,13 +47,13 @@
int acpi_fan_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_fan_driver = {
- name: ACPI_FAN_DRIVER_NAME,
- class: ACPI_FAN_CLASS,
- ids: ACPI_FAN_HID,
- ops: {
- add: acpi_fan_add,
- remove: acpi_fan_remove,
- },
+ .name = ACPI_FAN_DRIVER_NAME,
+ .class = ACPI_FAN_CLASS,
+ .ids = ACPI_FAN_HID,
+ .ops = {
+ .add = acpi_fan_add,
+ .remove = acpi_fan_remove,
+ },
};
struct acpi_fan {
diff -Nru a/drivers/acpi/include/acconfig.h b/drivers/acpi/include/acconfig.h
--- a/drivers/acpi/include/acconfig.h Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/include/acconfig.h Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 105 $
+ * $Revision: 107 $
*
*****************************************************************************/
@@ -54,7 +54,7 @@
/* Version string */
-#define ACPI_CA_VERSION 0x20020702
+#define ACPI_CA_VERSION 0x20020725
/* Version of ACPI supported */
@@ -151,6 +151,15 @@
/* Maximum Space_ids for Operation Regions */
#define ACPI_MAX_ADDRESS_SPACE 255
+
+/* Array sizes. Used for range checking also */
+
+#define NUM_ACCESS_TYPES 6
+#define NUM_UPDATE_RULES 3
+#define NUM_LOCK_RULES 2
+#define NUM_MATCH_OPS 6
+#define NUM_OPCODES 256
+#define NUM_FIELD_NAMES 2
/* RSDP checksums */
diff -Nru a/drivers/acpi/include/acdebug.h b/drivers/acpi/include/acdebug.h
--- a/drivers/acpi/include/acdebug.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/acdebug.h Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 62 $
+ * $Revision: 63 $
*
*****************************************************************************/
@@ -29,7 +29,6 @@
#define ACPI_DEBUG_BUFFER_SIZE 4196
-
typedef struct command_info
{
NATIVE_CHAR *name; /* Command Name */
@@ -186,47 +185,6 @@
/*
- * dbdisasm - AML disassembler
- */
-
-void
-acpi_db_display_op (
- acpi_walk_state *walk_state,
- 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_walk_state *walk_state,
- acpi_parse_object *op);
-
-void
-acpi_db_decode_internal_object (
- acpi_operand_object *obj_desc);
-
-void
-acpi_db_decode_node (
- acpi_namespace_node *node);
-
-u32
-acpi_db_block_type (
- acpi_parse_object *op);
-
-acpi_status
-acpi_ps_display_object_pathname (
- acpi_walk_state *walk_state,
- acpi_parse_object *op);
-
-
-/*
* dbdisply - debug display commands
*/
@@ -281,6 +239,10 @@
void *
acpi_db_get_pointer (
void *target);
+
+void
+acpi_db_decode_internal_object (
+ acpi_operand_object *obj_desc);
/*
diff -Nru a/drivers/acpi/include/acdisasm.h b/drivers/acpi/include/acdisasm.h
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/acpi/include/acdisasm.h Fri Jul 26 19:58:52 2002
@@ -0,0 +1,362 @@
+/******************************************************************************
+ *
+ * Name: acdisasm.h - AML disassembler
+ * $Revision: 2 $
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2002, 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 __ACDISASM_H__
+#define __ACDISASM_H__
+
+#include "amlresrc.h"
+
+
+#define BLOCK_NONE 0
+#define BLOCK_PAREN 1
+#define BLOCK_BRACE 2
+#define BLOCK_COMMA_LIST 4
+
+extern const char *acpi_gbl_io_decode[2];
+extern const char *acpi_gbl_word_decode[4];
+extern const char *acpi_gbl_consume_decode[2];
+extern const char *acpi_gbl_min_decode[2];
+extern const char *acpi_gbl_max_decode[2];
+extern const char *acpi_gbl_DECdecode[2];
+extern const char *acpi_gbl_RNGdecode[4];
+extern const char *acpi_gbl_MEMdecode[4];
+extern const char *acpi_gbl_RWdecode[2];
+extern const char *acpi_gbl_irq_decode[2];
+extern const char *acpi_gbl_HEdecode[2];
+extern const char *acpi_gbl_LLdecode[2];
+extern const char *acpi_gbl_SHRdecode[2];
+extern const char *acpi_gbl_TYPdecode[4];
+extern const char *acpi_gbl_BMdecode[2];
+extern const char *acpi_gbl_SIZdecode[4];
+extern const NATIVE_CHAR *acpi_gbl_lock_rule[NUM_LOCK_RULES];
+extern const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES];
+extern const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES];
+extern const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS];
+
+
+typedef struct acpi_op_walk_info
+{
+ u32 level;
+ u32 bit_offset;
+
+} ACPI_OP_WALK_INFO;
+
+typedef
+acpi_status (*ASL_WALK_CALLBACK) (
+ acpi_parse_object *op,
+ u32 level,
+ void *context);
+
+
+/*
+ * dmwalk
+ */
+
+void
+acpi_dm_walk_parse_tree (
+ acpi_parse_object *op,
+ ASL_WALK_CALLBACK descending_callback,
+ ASL_WALK_CALLBACK ascending_callback,
+ void *context);
+
+acpi_status
+acpi_dm_descending_op (
+ acpi_parse_object *op,
+ u32 level,
+ void *context);
+
+acpi_status
+acpi_dm_ascending_op (
+ acpi_parse_object *op,
+ u32 level,
+ void *context);
+
+
+/*
+ * dmopcode
+ */
+
+void
+acpi_dm_validate_name (
+ char *name,
+ acpi_parse_object *op);
+
+u32
+acpi_dm_dump_name (
+ char *name);
+
+void
+acpi_dm_string (
+ char *string);
+
+void
+acpi_dm_unicode (
+ acpi_parse_object *op);
+
+void
+acpi_dm_disassemble (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *origin,
+ u32 num_opcodes);
+
+void
+acpi_dm_namestring (
+ NATIVE_CHAR *name);
+
+void
+acpi_dm_display_path (
+ acpi_parse_object *op);
+
+void
+acpi_dm_disassemble_one_op (
+ acpi_walk_state *walk_state,
+ ACPI_OP_WALK_INFO *info,
+ acpi_parse_object *op);
+
+void
+acpi_dm_decode_internal_object (
+ acpi_operand_object *obj_desc);
+
+void
+acpi_dm_decode_node (
+ acpi_namespace_node *node);
+
+u32
+acpi_dm_block_type (
+ acpi_parse_object *op);
+
+u32
+acpi_dm_list_type (
+ acpi_parse_object *op);
+
+acpi_status
+acpi_ps_display_object_pathname (
+ acpi_walk_state *walk_state,
+ acpi_parse_object *op);
+
+void
+acpi_dm_method_flags (
+ acpi_parse_object *op);
+
+void
+acpi_dm_field_flags (
+ acpi_parse_object *op);
+
+void
+acpi_dm_address_space (
+ u8 space_id);
+
+void
+acpi_dm_region_flags (
+ acpi_parse_object *op);
+
+void
+acpi_dm_match_op (
+ acpi_parse_object *op);
+
+void
+acpi_dm_match_keyword (
+ acpi_parse_object *op);
+
+u8
+acpi_dm_comma_if_list_member (
+ acpi_parse_object *op);
+
+void
+acpi_dm_comma_if_field_member (
+ acpi_parse_object *op);
+
+
+/*
+ * dmbuffer
+ */
+
+void
+acpi_is_eisa_id (
+ acpi_parse_object *op);
+
+void
+acpi_dm_eisa_id (
+ u32 encoded_id);
+
+u8
+acpi_dm_is_unicode_buffer (
+ acpi_parse_object *op);
+
+u8
+acpi_dm_is_string_buffer (
+ acpi_parse_object *op);
+
+
+/*
+ * dmresrc
+ */
+
+void
+acpi_dm_disasm_byte_list (
+ u32 level,
+ u8 *byte_data,
+ u32 byte_count);
+
+void
+acpi_dm_byte_list (
+ ACPI_OP_WALK_INFO *info,
+ acpi_parse_object *op);
+
+void
+acpi_dm_resource_descriptor (
+ ACPI_OP_WALK_INFO *info,
+ u8 *byte_data,
+ u32 byte_count);
+
+u8
+acpi_dm_is_resource_descriptor (
+ acpi_parse_object *op);
+
+void
+acpi_dm_indent (
+ u32 level);
+
+void
+acpi_dm_bit_list (
+ u16 mask);
+
+
+/*
+ * dmresrcl
+ */
+
+void
+acpi_dm_io_flags (
+ u8 flags);
+
+void
+acpi_dm_memory_flags (
+ u8 flags,
+ u8 specific_flags);
+
+void
+acpi_dm_word_descriptor (
+ ASL_WORD_ADDRESS_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_dword_descriptor (
+ ASL_DWORD_ADDRESS_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_qword_descriptor (
+ ASL_QWORD_ADDRESS_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_memory24_descriptor (
+ ASL_MEMORY_24_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_memory32_descriptor (
+ ASL_MEMORY_32_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_fixed_mem32_descriptor (
+ ASL_FIXED_MEMORY_32_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_generic_register_descriptor (
+ ASL_GENERAL_REGISTER_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_interrupt_descriptor (
+ ASL_EXTENDED_XRUPT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_vendor_large_descriptor (
+ ASL_LARGE_VENDOR_DESC *resource,
+ u32 length,
+ u32 level);
+
+
+/*
+ * dmresrcs
+ */
+
+void
+acpi_dm_irq_descriptor (
+ ASL_IRQ_FORMAT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_dma_descriptor (
+ ASL_DMA_FORMAT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_io_descriptor (
+ ASL_IO_PORT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_fixed_io_descriptor (
+ ASL_FIXED_IO_PORT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_start_dependent_descriptor (
+ ASL_START_DEPENDENT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_end_dependent_descriptor (
+ ASL_START_DEPENDENT_DESC *resource,
+ u32 length,
+ u32 level);
+
+void
+acpi_dm_vendor_small_descriptor (
+ ASL_SMALL_VENDOR_DESC *resource,
+ u32 length,
+ u32 level);
+
+
+#endif /* __ACDISASM_H__ */
diff -Nru a/drivers/acpi/include/acglobal.h b/drivers/acpi/include/acglobal.h
--- a/drivers/acpi/include/acglobal.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/acglobal.h Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 126 $
+ * $Revision: 128 $
*
*****************************************************************************/
@@ -140,8 +140,9 @@
extern u8 acpi_gbl_shutdown;
extern u32 acpi_gbl_startup_flags;
extern const u8 acpi_gbl_decode_to8bit[8];
-extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
+extern const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES];
extern const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
+extern const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
/*****************************************************************************
@@ -237,6 +238,12 @@
ACPI_EXTERN u8 acpi_gbl_db_output_flags;
+#ifdef ACPI_DISASSEMBLER
+
+ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
+ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
+#endif
+
#ifdef ENABLE_DEBUGGER
@@ -247,9 +254,7 @@
ACPI_EXTERN NATIVE_CHAR *optarg;
ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
-ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
-ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
@@ -261,7 +266,6 @@
ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_buffer;
ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_filename;
-ACPI_EXTERN NATIVE_CHAR *acpi_gbl_db_disasm_indent;
ACPI_EXTERN u32 acpi_gbl_db_debug_level;
ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
ACPI_EXTERN acpi_table_header *acpi_gbl_db_table_ptr;
diff -Nru a/drivers/acpi/include/aclocal.h b/drivers/acpi/include/aclocal.h
--- a/drivers/acpi/include/aclocal.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/aclocal.h Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 168 $
+ * $Revision: 173 $
*
*****************************************************************************/
@@ -567,8 +567,8 @@
*/
typedef struct acpi_opcode_info
{
-#ifdef _OPCODE_NAMES
- NATIVE_CHAR *name; /* Opcode name (debug only) */
+#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG)
+ NATIVE_CHAR *name; /* Opcode name (disassembler/debug only) */
#endif
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
@@ -603,15 +603,23 @@
u32 aml_offset; /* offset of declaration in AML */\
union acpi_parse_obj *parent; /* parent op */\
union acpi_parse_obj *next; /* next op */\
- ACPI_DEBUG_ONLY_MEMBERS (\
+ ACPI_DISASM_ONLY_MEMBERS (\
+ u8 disasm_flags; /* Used during AML disassembly */\
+ u8 disasm_opcode; /* Subtype used for disassembly */\
NATIVE_CHAR aml_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 */\
+#define ACPI_DASM_BUFFER 0x00
+#define ACPI_DASM_RESOURCE 0x01
+#define ACPI_DASM_STRING 0x02
+#define ACPI_DASM_UNICODE 0x03
+#define ACPI_DASM_EISAID 0x04
+#define ACPI_DASM_MATCHOP 0x05
/*
- * generic operation (eg. If, While, Store)
+ * generic operation (for example: If, While, Store)
*/
typedef struct acpi_parseobj_common
{
@@ -626,6 +634,7 @@
typedef struct acpi_parseobj_named
{
ACPI_PARSE_COMMON
+ u8 *path;
u8 *data; /* AML body or bytelist data */
u32 length; /* AML length */
u32 name; /* 4-byte name or zero if no name */
@@ -653,15 +662,15 @@
u32 logical_byte_offset;
u32 end_line;
u32 end_logical_line;
- u16 parse_opcode;
u32 acpi_btype;
u32 aml_length;
u32 aml_subtree_length;
u32 final_aml_length;
u32 final_aml_offset;
+ u16 parse_opcode;
+ u16 compile_flags;
u8 aml_opcode_length;
u8 aml_pkg_len_bytes;
- u16 compile_flags;
u8 extra;
char parse_op_name[12];
@@ -704,6 +713,13 @@
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_CACHE 0x80
+
+/* Parse object Disasm_flags */
+
+#define ACPI_PARSEOP_IGNORE 0x01
+#define ACPI_PARSEOP_PARAMLIST 0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
+#define ACPI_PARSEOP_SPECIAL 0x10
/*****************************************************************************
diff -Nru a/drivers/acpi/include/acmacros.h b/drivers/acpi/include/acmacros.h
--- a/drivers/acpi/include/acmacros.h Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/include/acmacros.h Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 124 $
+ * $Revision: 126 $
*
*****************************************************************************/
@@ -287,12 +287,18 @@
/*
* Macros for the master AML opcode table
*/
-#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG)
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,Pargs,Iargs,flags,obj_type,class,type}
#else
#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {Pargs,Iargs,flags,obj_type,class,type}
#endif
+#ifdef ACPI_DISASSEMBLER
+#define ACPI_DISASM_ONLY_MEMBERS(a) a;
+#else
+#define ACPI_DISASM_ONLY_MEMBERS(a)
+#endif
+
#define ARG_TYPE_WIDTH 5
#define ARG_1(x) ((u32)(x))
#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
@@ -435,7 +441,6 @@
#define ACPI_DEBUG_DEFINE(a) a;
#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
-#define _OPCODE_NAMES
#define _VERBOSE_STRUCTURES
@@ -514,10 +519,6 @@
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
#define return_PTR(s) return(s)
-
-#ifdef ENABLE_DEBUGGER
-#define _OPCODE_NAMES
-#endif
#endif
diff -Nru a/drivers/acpi/include/acnamesp.h b/drivers/acpi/include/acnamesp.h
--- a/drivers/acpi/include/acnamesp.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/acnamesp.h Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 125 $
+ * $Revision: 126 $
*
*****************************************************************************/
@@ -43,7 +43,7 @@
/* 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_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
#define ACPI_SYS_BUS_NAME (u32) 0x5F53425F /* Sys bus name is "_SB_" */
#define ACPI_NS_ROOT_PATH "\\"
diff -Nru a/drivers/acpi/include/acpiosxf.h b/drivers/acpi/include/acpiosxf.h
--- a/drivers/acpi/include/acpiosxf.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/acpiosxf.h Fri Jul 26 19:58:50 2002
@@ -204,7 +204,6 @@
void *value,
u32 width);
-
acpi_status
acpi_os_write_port (
ACPI_IO_ADDRESS address,
@@ -222,7 +221,6 @@
void *value,
u32 width);
-
acpi_status
acpi_os_write_memory (
ACPI_PHYSICAL_ADDRESS address,
@@ -241,7 +239,6 @@
void *value,
u32 width);
-
acpi_status
acpi_os_write_pci_configuration (
acpi_pci_id *pci_id,
@@ -259,7 +256,6 @@
void *pointer,
u32 length);
-
u8
acpi_os_writable (
void *pointer,
@@ -287,6 +283,10 @@
acpi_os_vprintf (
const NATIVE_CHAR *format,
va_list args);
+
+void
+acpi_os_redirect_output (
+ void *destination);
/*
diff -Nru a/drivers/acpi/include/acutils.h b/drivers/acpi/include/acutils.h
--- a/drivers/acpi/include/acutils.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/acutils.h Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 140 $
+ * $Revision: 142 $
*
*****************************************************************************/
@@ -224,6 +224,9 @@
#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
+#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+#define ACPI_IS_ASCII(c) ((c) < 0x80)
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
diff -Nru a/drivers/acpi/include/amlcode.h b/drivers/acpi/include/amlcode.h
--- a/drivers/acpi/include/amlcode.h Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/include/amlcode.h Fri Jul 26 19:58:52 2002
@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 68 $
+ * $Revision: 69 $
*
*****************************************************************************/
@@ -472,15 +472,6 @@
#define METHOD_FLAGS_ARG_COUNT 0x07
#define METHOD_FLAGS_SERIALIZED 0x08
#define METHOD_FLAGS_SYNCH_LEVEL 0xF0
-
-
-/* Array sizes. Used for range checking also */
-
-#define NUM_ACCESS_TYPES 6
-#define NUM_UPDATE_RULES 3
-#define NUM_MATCH_OPS 7
-#define NUM_OPCODES 256
-#define NUM_FIELD_NAMES 2
#endif /* __AMLCODE_H__ */
diff -Nru a/drivers/acpi/include/amlresrc.h b/drivers/acpi/include/amlresrc.h
--- a/drivers/acpi/include/amlresrc.h Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/include/amlresrc.h Fri Jul 26 19:58:50 2002
@@ -1,8 +1,8 @@
/******************************************************************************
*
- * Module Name: aslresource.h - ASL resource descriptors
- * $Revision: 19 $
+ * Module Name: amlresrc.h - AML resource descriptors
+ * $Revision: 20 $
*
*****************************************************************************/
@@ -25,8 +25,8 @@
*/
-#ifndef __ASLRESOURCE_H
-#define __ASLRESOURCE_H
+#ifndef __AMLRESRC_H
+#define __AMLRESRC_H
#define ASL_RESNAME_ADDRESS "_ADR"
@@ -80,11 +80,13 @@
/*
- * Resource descriptors defined in the ACPI specification
+ * Resource descriptors defined in the ACPI specification.
+ *
+ * Alignment must be BYTE because these descriptors
+ * are used to overlay the AML byte stream.
*/
-
-
#pragma pack(1)
+
typedef struct asl_irq_format_desc
{
u8 descriptor_type;
@@ -94,7 +96,6 @@
} ASL_IRQ_FORMAT_DESC;
-#pragma pack(1)
typedef struct asl_irq_noflags_desc
{
u8 descriptor_type;
@@ -103,7 +104,6 @@
} ASL_IRQ_NOFLAGS_DESC;
-#pragma pack(1)
typedef struct asl_dma_format_desc
{
u8 descriptor_type;
@@ -113,7 +113,6 @@
} ASL_DMA_FORMAT_DESC;
-#pragma pack(1)
typedef struct asl_start_dependent_desc
{
u8 descriptor_type;
@@ -122,7 +121,6 @@
} ASL_START_DEPENDENT_DESC;
-#pragma pack(1)
typedef struct asl_start_dependent_noprio_desc
{
u8 descriptor_type;
@@ -130,7 +128,6 @@
} ASL_START_DEPENDENT_NOPRIO_DESC;
-#pragma pack(1)
typedef struct asl_end_dependent_desc
{
u8 descriptor_type;
@@ -138,7 +135,6 @@
} ASL_END_DEPENDENT_DESC;
-#pragma pack(1)
typedef struct asl_io_port_desc
{
u8 descriptor_type;
@@ -151,7 +147,6 @@
} ASL_IO_PORT_DESC;
-#pragma pack(1)
typedef struct asl_fixed_io_port_desc
{
u8 descriptor_type;
@@ -161,7 +156,6 @@
} ASL_FIXED_IO_PORT_DESC;
-#pragma pack(1)
typedef struct asl_small_vendor_desc
{
u8 descriptor_type;
@@ -170,7 +164,6 @@
} ASL_SMALL_VENDOR_DESC;
-#pragma pack(1)
typedef struct asl_end_tag_desc
{
u8 descriptor_type;
@@ -181,7 +174,6 @@
/* LARGE descriptors */
-#pragma pack(1)
typedef struct asl_memory_24_desc
{
u8 descriptor_type;
@@ -195,7 +187,6 @@
} ASL_MEMORY_24_DESC;
-#pragma pack(1)
typedef struct asl_large_vendor_desc
{
u8 descriptor_type;
@@ -205,7 +196,6 @@
} ASL_LARGE_VENDOR_DESC;
-#pragma pack(1)
typedef struct asl_memory_32_desc
{
u8 descriptor_type;
@@ -219,7 +209,6 @@
} ASL_MEMORY_32_DESC;
-#pragma pack(1)
typedef struct asl_fixed_memory_32_desc
{
u8 descriptor_type;
@@ -231,7 +220,6 @@
} ASL_FIXED_MEMORY_32_DESC;
-#pragma pack(1)
typedef struct asl_qword_address_desc
{
u8 descriptor_type;
@@ -249,7 +237,6 @@
} ASL_QWORD_ADDRESS_DESC;
-#pragma pack(1)
typedef struct asl_dword_address_desc
{
u8 descriptor_type;
@@ -267,7 +254,6 @@
} ASL_DWORD_ADDRESS_DESC;
-#pragma pack(1)
typedef struct asl_word_address_desc
{
u8 descriptor_type;
@@ -285,7 +271,6 @@
} ASL_WORD_ADDRESS_DESC;
-#pragma pack(1)
typedef struct asl_extended_xrupt_desc
{
u8 descriptor_type;
@@ -298,7 +283,6 @@
} ASL_EXTENDED_XRUPT_DESC;
-#pragma pack(1)
typedef struct asl_general_register_desc
{
u8 descriptor_type;
@@ -311,6 +295,9 @@
} ASL_GENERAL_REGISTER_DESC;
+/* restore default alignment */
+
+#pragma pack()
/* Union of all resource descriptors, sow we can allocate the worst case */
diff -Nru a/drivers/acpi/include/platform/acenv.h b/drivers/acpi/include/platform/acenv.h
--- a/drivers/acpi/include/platform/acenv.h Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/include/platform/acenv.h Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 95 $
+ * $Revision: 99 $
*
*****************************************************************************/
@@ -32,11 +32,13 @@
*/
#ifdef _ACPI_DUMP_APP
+#ifndef MSDOS
#define ACPI_DEBUG
+#endif
#define ACPI_APPLICATION
-#define ENABLE_DEBUGGER
+#define ACPI_DISASSEMBLER
+#define ACPI_NO_METHOD_EXECUTION
#define ACPI_USE_SYSTEM_CLIBRARY
-#define PARSER_ONLY
#endif
#ifdef _ACPI_EXEC_APP
@@ -45,13 +47,15 @@
#define ACPI_DEBUG
#define ACPI_APPLICATION
#define ENABLE_DEBUGGER
+#define ACPI_DISASSEMBLER
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
#ifdef _ACPI_ASL_COMPILER
#define ACPI_DEBUG
#define ACPI_APPLICATION
-/* #define ENABLE_DEBUGGER */
+#define ACPI_DISASSEMBLER
+#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_USE_SYSTEM_CLIBRARY
#endif
@@ -183,7 +187,6 @@
/*
* Use the standard C library headers.
* We want to keep these to a minimum.
- *
*/
#ifdef ACPI_USE_STANDARD_HEADERS
@@ -213,12 +216,16 @@
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
+
#define ACPI_TOUPPER toupper
#define ACPI_TOLOWER tolower
#define ACPI_IS_XDIGIT isxdigit
#define ACPI_IS_DIGIT isdigit
#define ACPI_IS_SPACE isspace
#define ACPI_IS_UPPER isupper
+#define ACPI_IS_PRINT isprint
+#define ACPI_IS_ALPHA isalpha
+#define ACPI_IS_ASCII isascii
/******************************************************************************
*
diff -Nru a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
--- a/drivers/acpi/namespace/nsdump.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/namespace/nsdump.c Fri Jul 26 19:58:52 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 136 $
+ * $Revision: 137 $
*
*****************************************************************************/
@@ -618,93 +618,6 @@
(void *) &info, NULL);
}
-
-#ifndef _ACPI_ASL_COMPILER
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ns_dump_one_device
- *
- * PARAMETERS: Handle - Node to be dumped
- * Level - Nesting level of the handle
- * Context - Passed into Walk_namespace
- *
- * DESCRIPTION: Dump a single Node that represents a device
- * This procedure is a User_function called by Acpi_ns_walk_namespace.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ns_dump_one_device (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value)
-{
- acpi_device_info info;
- acpi_status status;
- u32 i;
-
-
- ACPI_FUNCTION_NAME ("Ns_dump_one_device");
-
-
- status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
-
- status = acpi_get_object_info (obj_handle, &info);
- if (ACPI_SUCCESS (status)) {
- for (i = 0; i < level; i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
- }
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
- info.hardware_id,
- ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
- info.current_status));
- }
-
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ns_dump_root_devices
- *
- * PARAMETERS: None
- *
- * DESCRIPTION: Dump all objects of type "device"
- *
- ******************************************************************************/
-
-void
-acpi_ns_dump_root_devices (void)
-{
- acpi_handle sys_bus_handle;
- acpi_status status;
-
-
- ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
-
-
- /* Only dump the table if tracing is enabled */
-
- if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
- return;
- }
-
- status = acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
- if (ACPI_FAILURE (status)) {
- return;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
-
- status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
- ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
- acpi_ns_dump_one_device, NULL, NULL);
-}
-
-#endif
/*******************************************************************************
*
diff -Nru a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/acpi/namespace/nsdumpdv.c Fri Jul 26 19:58:52 2002
@@ -0,0 +1,124 @@
+/******************************************************************************
+ *
+ * Module Name: nsdump - table dumping routines for debug
+ * $Revision: 1 $
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2002, 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 "acnamesp.h"
+#include "acparser.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsdumpdv")
+
+
+#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_dump_one_device
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * Level - Nesting level of the handle
+ * Context - Passed into Walk_namespace
+ *
+ * DESCRIPTION: Dump a single Node that represents a device
+ * This procedure is a User_function called by Acpi_ns_walk_namespace.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_dump_one_device (
+ acpi_handle obj_handle,
+ u32 level,
+ void *context,
+ void **return_value)
+{
+ acpi_device_info info;
+ acpi_status status;
+ u32 i;
+
+
+ ACPI_FUNCTION_NAME ("Ns_dump_one_device");
+
+
+ status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
+
+ status = acpi_get_object_info (obj_handle, &info);
+ if (ACPI_SUCCESS (status)) {
+ for (i = 0; i < level; i++) {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
+ info.hardware_id,
+ ACPI_HIDWORD (info.address), ACPI_LODWORD (info.address),
+ info.current_status));
+ }
+
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_dump_root_devices
+ *
+ * PARAMETERS: None
+ *
+ * DESCRIPTION: Dump all objects of type "device"
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_dump_root_devices (void)
+{
+ acpi_handle sys_bus_handle;
+ acpi_status status;
+
+
+ ACPI_FUNCTION_NAME ("Ns_dump_root_devices");
+
+
+ /* Only dump the table if tracing is enabled */
+
+ if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
+ return;
+ }
+
+ status = acpi_get_handle (0, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
+ if (ACPI_FAILURE (status)) {
+ return;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
+
+ status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ acpi_ns_dump_one_device, NULL, NULL);
+}
+
+#endif
+
+
diff -Nru a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
--- a/drivers/acpi/namespace/nsload.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/namespace/nsload.c Fri Jul 26 19:58:52 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 56 $
+ * $Revision: 57 $
*
*****************************************************************************/
@@ -37,59 +37,7 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_load_namespace
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
- * (DSDT points to either the BIOS or a buffer.)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ns_load_namespace (
- void)
-{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("Acpi_load_name_space");
-
-
- /* There must be at least a DSDT installed */
-
- if (acpi_gbl_DSDT == NULL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /*
- * Load the namespace. The DSDT is required,
- * but the SSDT and PSDT tables are optional.
- */
- status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /* Ignore exceptions from these */
-
- (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
- (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "ACPI Namespace successfully loaded at root %p\n",
- acpi_gbl_root_node));
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ns_one_parse_pass
+ * FUNCTION: Ns_one_complete_parse
*
* PARAMETERS: Pass_number - 1 or 2
* Table_desc - The table to be parsed.
@@ -203,6 +151,7 @@
return_ACPI_STATUS (status);
}
+#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -421,6 +370,58 @@
/*******************************************************************************
*
+ * FUNCTION: Acpi_load_namespace
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the name space from what ever is pointed to by DSDT.
+ * (DSDT points to either the BIOS or a buffer.)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_load_namespace (
+ void)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_load_name_space");
+
+
+ /* There must be at least a DSDT installed */
+
+ if (acpi_gbl_DSDT == NULL) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+ return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ }
+
+ /*
+ * Load the namespace. The DSDT is required,
+ * but the SSDT and PSDT tables are optional.
+ */
+ status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /* Ignore exceptions from these */
+
+ (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
+ (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
+ "ACPI Namespace successfully loaded at root %p\n",
+ acpi_gbl_root_node));
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: Acpi_ns_delete_subtree
*
* PARAMETERS: Start_handle - Handle in namespace where search begins
@@ -550,4 +551,5 @@
return_ACPI_STATUS (status);
}
+#endif
diff -Nru a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/drivers/acpi/namespace/nsxfeval.c Fri Jul 26 19:58:52 2002
@@ -0,0 +1,719 @@
+/*******************************************************************************
+ *
+ * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
+ * ACPI Object evaluation interfaces
+ * $Revision: 1 $
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2002, 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 "acnamesp.h"
+
+
+#define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME ("nsxfeval")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_evaluate_object_typed
+ *
+ * PARAMETERS: Handle - Object handle (optional)
+ * *Pathname - Object pathname (optional)
+ * **External_params - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *Return_buffer - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * Return_type - Expected type of return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and evaluate the given object, passing the given
+ * parameters if necessary. One of "Handle" or "Pathname" must
+ * be valid (non-null)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_evaluate_object_typed (
+ acpi_handle handle,
+ acpi_string pathname,
+ acpi_object_list *external_params,
+ acpi_buffer *return_buffer,
+ acpi_object_type return_type)
+{
+ acpi_status status;
+ u8 must_free = FALSE;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_evaluate_object_typed");
+
+
+ /* Return buffer must be valid */
+
+ if (!return_buffer) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
+ must_free = TRUE;
+ }
+
+ /* Evaluate the object */
+
+ status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ /* Type ANY means "don't care" */
+
+ if (return_type == ACPI_TYPE_ANY) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (return_buffer->length == 0) {
+ /* Error because caller specifically asked for a return value */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "No return value\n"));
+
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
+
+ /* Examine the object type returned from Evaluate_object */
+
+ if (((acpi_object *) return_buffer->pointer)->type == return_type) {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Return object type does not match requested type */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Incorrect return type [%s] requested [%s]\n",
+ acpi_ut_get_type_name (((acpi_object *) return_buffer->pointer)->type),
+ acpi_ut_get_type_name (return_type)));
+
+ if (must_free) {
+ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
+
+ acpi_os_free (return_buffer->pointer);
+ return_buffer->pointer = NULL;
+ }
+
+ return_buffer->length = 0;
+ return_ACPI_STATUS (AE_TYPE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_evaluate_object
+ *
+ * PARAMETERS: Handle - Object handle (optional)
+ * *Pathname - Object pathname (optional)
+ * **External_params - List of parameters to pass to method,
+ * terminated by NULL. May be NULL
+ * if no parameters are being passed.
+ * *Return_buffer - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find and evaluate the given object, passing the given
+ * parameters if necessary. One of "Handle" or "Pathname" must
+ * be valid (non-null)
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_evaluate_object (
+ acpi_handle handle,
+ acpi_string pathname,
+ acpi_object_list *external_params,
+ acpi_buffer *return_buffer)
+{
+ acpi_status status;
+ acpi_operand_object **internal_params = NULL;
+ acpi_operand_object *internal_return_obj = NULL;
+ ACPI_SIZE buffer_space_needed;
+ u32 i;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_evaluate_object");
+
+
+ /*
+ * If there are parameters to be passed to the object
+ * (which must be a control method), the external objects
+ * must be converted to internal objects
+ */
+ if (external_params && external_params->count) {
+ /*
+ * Allocate a new parameter block for the internal objects
+ * Add 1 to count to allow for null terminated internal list
+ */
+ internal_params = ACPI_MEM_CALLOCATE (((ACPI_SIZE) external_params->count + 1) *
+ sizeof (void *));
+ if (!internal_params) {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /*
+ * Convert each external object in the list to an
+ * internal object
+ */
+ for (i = 0; i < external_params->count; i++) {
+ status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
+ &internal_params[i]);
+ if (ACPI_FAILURE (status)) {
+ acpi_ut_delete_internal_object_list (internal_params);
+ return_ACPI_STATUS (status);
+ }
+ }
+ internal_params[external_params->count] = NULL;
+ }
+
+ /*
+ * Three major cases:
+ * 1) Fully qualified pathname
+ * 2) No handle, not fully qualified pathname (error)
+ * 3) Valid handle
+ */
+ if ((pathname) &&
+ (acpi_ns_valid_root_prefix (pathname[0]))) {
+ /*
+ * The path is fully qualified, just evaluate by name
+ */
+ status = acpi_ns_evaluate_by_name (pathname, internal_params,
+ &internal_return_obj);
+ }
+ else if (!handle) {
+ /*
+ * A handle is optional iff a fully qualified pathname
+ * is specified. Since we've already handled fully
+ * qualified names above, this is an error
+ */
+ if (!pathname) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Both Handle and Pathname are NULL\n"));
+ }
+ else {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Handle is NULL and Pathname is relative\n"));
+ }
+
+ status = AE_BAD_PARAMETER;
+ }
+ else {
+ /*
+ * We get here if we have a handle -- and if we have a
+ * pathname it is relative. The handle will be validated
+ * in the lower procedures
+ */
+ if (!pathname) {
+ /*
+ * The null pathname case means the handle is for
+ * the actual object to be evaluated
+ */
+ status = acpi_ns_evaluate_by_handle (handle, internal_params,
+ &internal_return_obj);
+ }
+ else {
+ /*
+ * Both a Handle and a relative Pathname
+ */
+ status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
+ &internal_return_obj);
+ }
+ }
+
+
+ /*
+ * If we are expecting a return value, and all went well above,
+ * copy the return value to an external object.
+ */
+ if (return_buffer) {
+ if (!internal_return_obj) {
+ return_buffer->length = 0;
+ }
+ else {
+ if (ACPI_GET_DESCRIPTOR_TYPE (internal_return_obj) == ACPI_DESC_TYPE_NAMED) {
+ /*
+ * If we received a NS Node as a return object, this means that
+ * the object we are evaluating has nothing interesting to
+ * return (such as a mutex, etc.) We return an error because
+ * these types are essentially unsupported by this interface.
+ * We don't check up front because this makes it easier to add
+ * support for various types at a later date if necessary.
+ */
+ status = AE_TYPE;
+ internal_return_obj = NULL; /* No need to delete a NS Node */
+ return_buffer->length = 0;
+ }
+
+ if (ACPI_SUCCESS (status)) {
+ /*
+ * Find out how large a buffer is needed
+ * to contain the returned object
+ */
+ status = acpi_ut_get_object_size (internal_return_obj,
+ &buffer_space_needed);
+ if (ACPI_SUCCESS (status)) {
+ /* Validate/Allocate/Clear caller buffer */
+
+ status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
+ if (ACPI_FAILURE (status)) {
+ /*
+ * Caller's buffer is too small or a new one can't be allocated
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Needed buffer size %X, %s\n",
+ (u32) buffer_space_needed, acpi_format_exception (status)));
+ }
+ else {
+ /*
+ * We have enough space for the object, build it
+ */
+ status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
+ return_buffer);
+ }
+ }
+ }
+ }
+ }
+
+ /* Delete the return and parameter objects */
+
+ if (internal_return_obj) {
+ /*
+ * Delete the internal return object. (Or at least
+ * decrement the reference count by one)
+ */
+ acpi_ut_remove_reference (internal_return_obj);
+ }
+
+ /*
+ * Free the input parameter list (if we created one),
+ */
+ if (internal_params) {
+ /* Free the allocated parameter block */
+
+ acpi_ut_delete_internal_object_list (internal_params);
+ }
+
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_walk_namespace
+ *
+ * PARAMETERS: Type - acpi_object_type to search for
+ * Start_object - Handle in namespace where search begins
+ * Max_depth - Depth to which search is to reach
+ * User_function - Called when an object of "Type" is found
+ * Context - Passed to user function
+ * Return_value - Location where return value of
+ * User_function is put if terminated early
+ *
+ * RETURNS Return value from the User_function if terminated early.
+ * Otherwise, returns NULL.
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ * starting (and ending) at the object specified by Start_handle.
+ * The User_function is called whenever an object that matches
+ * the type parameter is found. If the user function returns
+ * a non-zero value, the search is terminated immediately and this
+ * value is returned to the caller.
+ *
+ * The point of this procedure is to provide a generic namespace
+ * walk routine that can be called from multiple places to
+ * provide multiple services; the User Function can be tailored
+ * to each task, whether it is a print function, a compare
+ * function, etc.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_walk_namespace (
+ acpi_object_type type,
+ acpi_handle start_object,
+ u32 max_depth,
+ acpi_walk_callback user_function,
+ void *context,
+ void **return_value)
+{
+ acpi_status status;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_walk_namespace");
+
+
+ /* Parameter validation */
+
+ if ((type > ACPI_TYPE_MAX) ||
+ (!max_depth) ||
+ (!user_function)) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Lock the namespace around the walk.
+ * The namespace will be unlocked/locked around each call
+ * to the user function - since this function
+ * must be allowed to make Acpi calls itself.
+ */
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK,
+ user_function, context, return_value);
+
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_ns_get_device_callback
+ *
+ * PARAMETERS: Callback from Acpi_get_device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes callbacks from Walk_namespace and filters out all non-
+ * present devices, or if they specified a HID, it filters based
+ * on that.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_get_device_callback (
+ acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context,
+ void **return_value)
+{
+ acpi_status status;
+ acpi_namespace_node *node;
+ u32 flags;
+ acpi_device_id hid;
+ acpi_device_id cid;
+ acpi_get_devices_info *info;
+
+
+ info = context;
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ if (!node) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * Run _STA to determine if device is present
+ */
+ status = acpi_ut_execute_STA (node, &flags);
+ if (ACPI_FAILURE (status)) {
+ return (AE_CTRL_DEPTH);
+ }
+
+ if (!(flags & 0x01)) {
+ /* Don't return at the device or children of the device if not there */
+ return (AE_CTRL_DEPTH);
+ }
+
+ /*
+ * Filter based on device HID & CID
+ */
+ if (info->hid != NULL) {
+ status = acpi_ut_execute_HID (node, &hid);
+ if (status == AE_NOT_FOUND) {
+ return (AE_OK);
+ }
+ else if (ACPI_FAILURE (status)) {
+ return (AE_CTRL_DEPTH);
+ }
+
+ if (ACPI_STRNCMP (hid.buffer, info->hid, sizeof (hid.buffer)) != 0) {
+ status = acpi_ut_execute_CID (node, &cid);
+ if (status == AE_NOT_FOUND) {
+ return (AE_OK);
+ }
+ else if (ACPI_FAILURE (status)) {
+ return (AE_CTRL_DEPTH);
+ }
+
+ /* TBD: Handle CID packages */
+
+ if (ACPI_STRNCMP (cid.buffer, info->hid, sizeof (cid.buffer)) != 0) {
+ return (AE_OK);
+ }
+ }
+ }
+
+ status = info->user_function (obj_handle, nesting_level, info->context, return_value);
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_get_devices
+ *
+ * PARAMETERS: HID - HID to search for. Can be NULL.
+ * User_function - Called when a matching object is found
+ * Context - Passed to user function
+ * Return_value - Location where return value of
+ * User_function is put if terminated early
+ *
+ * RETURNS Return value from the User_function if terminated early.
+ * Otherwise, returns NULL.
+ *
+ * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
+ * starting (and ending) at the object specified by Start_handle.
+ * The User_function is called whenever an object that matches
+ * the type parameter is found. If the user function returns
+ * a non-zero value, the search is terminated immediately and this
+ * value is returned to the caller.
+ *
+ * This is a wrapper for Walk_namespace, but the callback performs
+ * additional filtering. Please see Acpi_get_device_callback.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_get_devices (
+ NATIVE_CHAR *HID,
+ acpi_walk_callback user_function,
+ void *context,
+ void **return_value)
+{
+ acpi_status status;
+ acpi_get_devices_info info;
+
+
+ ACPI_FUNCTION_TRACE ("Acpi_get_devices");
+
+
+ /* Parameter validation */
+
+ if (!user_function) {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /*
+ * We're going to call their callback from OUR callback, so we need
+ * to know what it is, and their context parameter.
+ */
+ info.context = context;
+ info.user_function = user_function;
+ info.hid = HID;
+
+ /*
+ * Lock the namespace around the walk.
+ * The namespace will be unlocked/locked around each call
+ * to the user function - since this function
+ * must be allowed to make Acpi calls itself.
+ */
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return_ACPI_STATUS (status);
+ }
+
+ status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
+ ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_UNLOCK,
+ acpi_ns_get_device_callback, &info,
+ return_value);
+
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_attach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_attach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void *data)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler ||
+ !data) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_attach_data (node, handler, data);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_detach_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_detach_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_detach_data (node, handler);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: Acpi_get_data
+ *
+ * PARAMETERS:
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION:
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_get_data (
+ acpi_handle obj_handle,
+ ACPI_OBJECT_HANDLER handler,
+ void **data)
+{
+ acpi_namespace_node *node;
+ acpi_status status;
+
+
+ /* Parameter validation */
+
+ if (!obj_handle ||
+ !handler ||
+ !data) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (status)) {
+ return (status);
+ }
+
+ /* Convert and validate the handle */
+
+ node = acpi_ns_map_handle_to_node (obj_handle);
+ if (!node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
+
+ status = acpi_ns_get_attached_data (node, handler, data);
+
+unlock_and_exit:
+ (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ return (status);
+}
+
+
diff -Nru a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c
--- a/drivers/acpi/namespace/nsxfobj.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/namespace/nsxfobj.c Fri Jul 26 19:58:50 2002
@@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 112 $
+ * $Revision: 113 $
*
******************************************************************************/
@@ -32,384 +32,6 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsxfobj")
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_evaluate_object_typed
- *
- * PARAMETERS: Handle - Object handle (optional)
- * *Pathname - Object pathname (optional)
- * **External_params - List of parameters to pass to method,
- * terminated by NULL. May be NULL
- * if no parameters are being passed.
- * *Return_buffer - Where to put method's return value (if
- * any). If NULL, no value is returned.
- * Return_type - Expected type of return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find and evaluate the given object, passing the given
- * parameters if necessary. One of "Handle" or "Pathname" must
- * be valid (non-null)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_evaluate_object_typed (
- acpi_handle handle,
- acpi_string pathname,
- acpi_object_list *external_params,
- acpi_buffer *return_buffer,
- acpi_object_type return_type)
-{
- acpi_status status;
- u8 must_free = FALSE;
-
-
- ACPI_FUNCTION_TRACE ("Acpi_evaluate_object_typed");
-
-
- /* Return buffer must be valid */
-
- if (!return_buffer) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
- must_free = TRUE;
- }
-
- /* Evaluate the object */
-
- status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- /* Type ANY means "don't care" */
-
- if (return_type == ACPI_TYPE_ANY) {
- return_ACPI_STATUS (AE_OK);
- }
-
- if (return_buffer->length == 0) {
- /* Error because caller specifically asked for a return value */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No return value\n"));
-
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
-
- /* Examine the object type returned from Evaluate_object */
-
- if (((acpi_object *) return_buffer->pointer)->type == return_type) {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Return object type does not match requested type */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Incorrect return type [%s] requested [%s]\n",
- acpi_ut_get_type_name (((acpi_object *) return_buffer->pointer)->type),
- acpi_ut_get_type_name (return_type)));
-
- if (must_free) {
- /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
-
- acpi_os_free (return_buffer->pointer);
- return_buffer->pointer = NULL;
- }
-
- return_buffer->length = 0;
- return_ACPI_STATUS (AE_TYPE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_evaluate_object
- *
- * PARAMETERS: Handle - Object handle (optional)
- * *Pathname - Object pathname (optional)
- * **External_params - List of parameters to pass to method,
- * terminated by NULL. May be NULL
- * if no parameters are being passed.
- * *Return_buffer - Where to put method's return value (if
- * any). If NULL, no value is returned.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find and evaluate the given object, passing the given
- * parameters if necessary. One of "Handle" or "Pathname" must
- * be valid (non-null)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_evaluate_object (
- acpi_handle handle,
- acpi_string pathname,
- acpi_object_list *external_params,
- acpi_buffer *return_buffer)
-{
- acpi_status status;
- acpi_operand_object **internal_params = NULL;
- acpi_operand_object *internal_return_obj = NULL;
- ACPI_SIZE buffer_space_needed;
- u32 i;
-
-
- ACPI_FUNCTION_TRACE ("Acpi_evaluate_object");
-
-
- /*
- * If there are parameters to be passed to the object
- * (which must be a control method), the external objects
- * must be converted to internal objects
- */
- if (external_params && external_params->count) {
- /*
- * Allocate a new parameter block for the internal objects
- * Add 1 to count to allow for null terminated internal list
- */
- internal_params = ACPI_MEM_CALLOCATE (((ACPI_SIZE) external_params->count + 1) *
- sizeof (void *));
- if (!internal_params) {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Convert each external object in the list to an
- * internal object
- */
- for (i = 0; i < external_params->count; i++) {
- status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
- &internal_params[i]);
- if (ACPI_FAILURE (status)) {
- acpi_ut_delete_internal_object_list (internal_params);
- return_ACPI_STATUS (status);
- }
- }
- internal_params[external_params->count] = NULL;
- }
-
- /*
- * Three major cases:
- * 1) Fully qualified pathname
- * 2) No handle, not fully qualified pathname (error)
- * 3) Valid handle
- */
- if ((pathname) &&
- (acpi_ns_valid_root_prefix (pathname[0]))) {
- /*
- * The path is fully qualified, just evaluate by name
- */
- status = acpi_ns_evaluate_by_name (pathname, internal_params,
- &internal_return_obj);
- }
- else if (!handle) {
- /*
- * A handle is optional iff a fully qualified pathname
- * is specified. Since we've already handled fully
- * qualified names above, this is an error
- */
- if (!pathname) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Both Handle and Pathname are NULL\n"));
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Handle is NULL and Pathname is relative\n"));
- }
-
- status = AE_BAD_PARAMETER;
- }
- else {
- /*
- * We get here if we have a handle -- and if we have a
- * pathname it is relative. The handle will be validated
- * in the lower procedures
- */
- if (!pathname) {
- /*
- * The null pathname case means the handle is for
- * the actual object to be evaluated
- */
- status = acpi_ns_evaluate_by_handle (handle, internal_params,
- &internal_return_obj);
- }
- else {
- /*
- * Both a Handle and a relative Pathname
- */
- status = acpi_ns_evaluate_relative (handle, pathname, internal_params,
- &internal_return_obj);
- }
- }
-
-
- /*
- * If we are expecting a return value, and all went well above,
- * copy the return value to an external object.
- */
- if (return_buffer) {
- if (!internal_return_obj) {
- return_buffer->length = 0;
- }
- else {
- if (ACPI_GET_DESCRIPTOR_TYPE (internal_return_obj) == ACPI_DESC_TYPE_NAMED) {
- /*
- * If we received a NS Node as a return object, this means that
- * the object we are evaluating has nothing interesting to
- * return (such as a mutex, etc.) We return an error because
- * these types are essentially unsupported by this interface.
- * We don't check up front because this makes it easier to add
- * support for various types at a later date if necessary.
- */
- status = AE_TYPE;
- internal_return_obj = NULL; /* No need to delete a NS Node */
- return_buffer->length = 0;
- }
-
- if (ACPI_SUCCESS (status)) {
- /*
- * Find out how large a buffer is needed
- * to contain the returned object
- */
- status = acpi_ut_get_object_size (internal_return_obj,
- &buffer_space_needed);
- if (ACPI_SUCCESS (status)) {
- /* Validate/Allocate/Clear caller buffer */
-
- status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed);
- if (ACPI_FAILURE (status)) {
- /*
- * Caller's buffer is too small or a new one can't be allocated
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed buffer size %X, %s\n",
- (u32) buffer_space_needed, acpi_format_exception (status)));
- }
- else {
- /*
- * We have enough space for the object, build it
- */
- status = acpi_ut_copy_iobject_to_eobject (internal_return_obj,
- return_buffer);
- }
- }
- }
- }
- }
-
- /* Delete the return and parameter objects */
-
- if (internal_return_obj) {
- /*
- * Delete the internal return object. (Or at least
- * decrement the reference count by one)
- */
- acpi_ut_remove_reference (internal_return_obj);
- }
-
- /*
- * Free the input parameter list (if we created one),
- */
- if (internal_params) {
- /* Free the allocated parameter block */
-
- acpi_ut_delete_internal_object_list (internal_params);
- }
-
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_get_next_object (
- acpi_object_type type,
- acpi_handle parent,
- acpi_handle child,
- acpi_handle *ret_handle)
-{
- acpi_status status;
- 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);
- }
-
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- /* If null handle, use the parent */
-
- if (!child) {
- /* Start search at the beginning of the specified scope */
-
- parent_node = acpi_ns_map_handle_to_node (parent);
- if (!parent_node) {
- status = AE_BAD_PARAMETER;
- goto unlock_and_exit;
- }
- }
- else {
- /* Non-null handle, ignore the parent */
- /* Convert and validate the handle */
-
- child_node = acpi_ns_map_handle_to_node (child);
- if (!child_node) {
- status = AE_BAD_PARAMETER;
- goto unlock_and_exit;
- }
- }
-
- /* Internal function does the real work */
-
- node = acpi_ns_get_next_node (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 (node);
- }
-
-
-unlock_and_exit:
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return (status);
-}
-
-
/*******************************************************************************
*
* FUNCTION: Acpi_get_type
@@ -535,271 +157,38 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_walk_namespace
- *
- * PARAMETERS: Type - acpi_object_type to search for
- * Start_object - Handle in namespace where search begins
- * Max_depth - Depth to which search is to reach
- * User_function - Called when an object of "Type" is found
- * Context - Passed to user function
- * Return_value - Location where return value of
- * User_function is put if terminated early
- *
- * RETURNS Return value from the User_function if terminated early.
- * Otherwise, returns NULL.
- *
- * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
- * starting (and ending) at the object specified by Start_handle.
- * The User_function is called whenever an object that matches
- * the type parameter is found. If the user function returns
- * a non-zero value, the search is terminated immediately and this
- * value is returned to the caller.
- *
- * The point of this procedure is to provide a generic namespace
- * walk routine that can be called from multiple places to
- * provide multiple services; the User Function can be tailored
- * to each task, whether it is a print function, a compare
- * function, etc.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_walk_namespace (
- acpi_object_type type,
- acpi_handle start_object,
- u32 max_depth,
- acpi_walk_callback user_function,
- void *context,
- void **return_value)
-{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("Acpi_walk_namespace");
-
-
- /* Parameter validation */
-
- if ((type > ACPI_TYPE_MAX) ||
- (!max_depth) ||
- (!user_function)) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Lock the namespace around the walk.
- * The namespace will be unlocked/locked around each call
- * to the user function - since this function
- * must be allowed to make Acpi calls itself.
- */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK,
- user_function, context, return_value);
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ns_get_device_callback
+ * FUNCTION: Acpi_get_next_object
*
- * PARAMETERS: Callback from Acpi_get_device
+ * 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: Takes callbacks from Walk_namespace and filters out all non-
- * present devices, or if they specified a HID, it filters based
- * on that.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ns_get_device_callback (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- acpi_status status;
- acpi_namespace_node *node;
- u32 flags;
- acpi_device_id hid;
- acpi_device_id cid;
- acpi_get_devices_info *info;
-
-
- info = context;
-
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- node = acpi_ns_map_handle_to_node (obj_handle);
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- if (!node) {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Run _STA to determine if device is present
- */
- status = acpi_ut_execute_STA (node, &flags);
- if (ACPI_FAILURE (status)) {
- return (AE_CTRL_DEPTH);
- }
-
- if (!(flags & 0x01)) {
- /* Don't return at the device or children of the device if not there */
- return (AE_CTRL_DEPTH);
- }
-
- /*
- * Filter based on device HID & CID
- */
- if (info->hid != NULL) {
- status = acpi_ut_execute_HID (node, &hid);
- if (status == AE_NOT_FOUND) {
- return (AE_OK);
- }
- else if (ACPI_FAILURE (status)) {
- return (AE_CTRL_DEPTH);
- }
-
- if (ACPI_STRNCMP (hid.buffer, info->hid, sizeof (hid.buffer)) != 0) {
- status = acpi_ut_execute_CID (node, &cid);
- if (status == AE_NOT_FOUND) {
- return (AE_OK);
- }
- else if (ACPI_FAILURE (status)) {
- return (AE_CTRL_DEPTH);
- }
-
- /* TBD: Handle CID packages */
-
- if (ACPI_STRNCMP (cid.buffer, info->hid, sizeof (cid.buffer)) != 0) {
- return (AE_OK);
- }
- }
- }
-
- status = info->user_function (obj_handle, nesting_level, info->context, return_value);
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_get_devices
- *
- * PARAMETERS: HID - HID to search for. Can be NULL.
- * User_function - Called when a matching object is found
- * Context - Passed to user function
- * Return_value - Location where return value of
- * User_function is put if terminated early
- *
- * RETURNS Return value from the User_function if terminated early.
- * Otherwise, returns NULL.
- *
- * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
- * starting (and ending) at the object specified by Start_handle.
- * The User_function is called whenever an object that matches
- * the type parameter is found. If the user function returns
- * a non-zero value, the search is terminated immediately and this
- * value is returned to the caller.
- *
- * This is a wrapper for Walk_namespace, but the callback performs
- * additional filtering. Please see Acpi_get_device_callback.
+ * 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_status
-acpi_get_devices (
- NATIVE_CHAR *HID,
- acpi_walk_callback user_function,
- void *context,
- void **return_value)
+acpi_get_next_object (
+ acpi_object_type type,
+ acpi_handle parent,
+ acpi_handle child,
+ acpi_handle *ret_handle)
{
acpi_status status;
- acpi_get_devices_info info;
-
-
- ACPI_FUNCTION_TRACE ("Acpi_get_devices");
-
-
- /* Parameter validation */
-
- if (!user_function) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * We're going to call their callback from OUR callback, so we need
- * to know what it is, and their context parameter.
- */
- info.context = context;
- info.user_function = user_function;
- info.hid = HID;
-
- /*
- * Lock the namespace around the walk.
- * The namespace will be unlocked/locked around each call
- * to the user function - since this function
- * must be allowed to make Acpi calls itself.
- */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
- }
-
- status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK,
- acpi_ns_get_device_callback, &info,
- return_value);
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_attach_data
- *
- * PARAMETERS:
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-acpi_status
-acpi_attach_data (
- acpi_handle obj_handle,
- ACPI_OBJECT_HANDLER handler,
- void *data)
-{
acpi_namespace_node *node;
- acpi_status status;
+ acpi_namespace_node *parent_node = NULL;
+ acpi_namespace_node *child_node = NULL;
/* Parameter validation */
- if (!obj_handle ||
- !handler ||
- !data) {
+ if (type > ACPI_TYPE_MAX) {
return (AE_BAD_PARAMETER);
}
@@ -808,117 +197,43 @@
return (status);
}
- /* Convert and validate the handle */
-
- node = acpi_ns_map_handle_to_node (obj_handle);
- if (!node) {
- status = AE_BAD_PARAMETER;
- goto unlock_and_exit;
- }
-
- status = acpi_ns_attach_data (node, handler, data);
-
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_detach_data
- *
- * PARAMETERS:
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-acpi_status
-acpi_detach_data (
- acpi_handle obj_handle,
- ACPI_OBJECT_HANDLER handler)
-{
- acpi_namespace_node *node;
- acpi_status status;
-
+ /* If null handle, use the parent */
- /* Parameter validation */
+ if (!child) {
+ /* Start search at the beginning of the specified scope */
- if (!obj_handle ||
- !handler) {
- return (AE_BAD_PARAMETER);
+ parent_node = acpi_ns_map_handle_to_node (parent);
+ if (!parent_node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
}
+ else {
+ /* Non-null handle, ignore the parent */
+ /* Convert and validate the handle */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return (status);
+ child_node = acpi_ns_map_handle_to_node (child);
+ if (!child_node) {
+ status = AE_BAD_PARAMETER;
+ goto unlock_and_exit;
+ }
}
- /* Convert and validate the handle */
+ /* Internal function does the real work */
- node = acpi_ns_map_handle_to_node (obj_handle);
+ node = acpi_ns_get_next_node (type, parent_node, child_node);
if (!node) {
- status = AE_BAD_PARAMETER;
+ status = AE_NOT_FOUND;
goto unlock_and_exit;
}
- status = acpi_ns_detach_data (node, handler);
-
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_get_data
- *
- * PARAMETERS:
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-acpi_status
-acpi_get_data (
- acpi_handle obj_handle,
- ACPI_OBJECT_HANDLER handler,
- void **data)
-{
- acpi_namespace_node *node;
- acpi_status status;
-
-
- /* Parameter validation */
-
- if (!obj_handle ||
- !handler ||
- !data) {
- return (AE_BAD_PARAMETER);
- }
-
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- /* Convert and validate the handle */
-
- node = acpi_ns_map_handle_to_node (obj_handle);
- if (!node) {
- status = AE_BAD_PARAMETER;
- goto unlock_and_exit;
+ if (ret_handle) {
+ *ret_handle = acpi_ns_convert_entry_to_handle (node);
}
- status = acpi_ns_get_attached_data (node, handler, data);
unlock_and_exit:
+
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status);
}
diff -Nru a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
--- a/drivers/acpi/parser/psargs.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/parser/psargs.c Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 61 $
+ * $Revision: 62 $
*
*****************************************************************************/
@@ -332,7 +332,7 @@
NATIVE_CHAR *path;
acpi_parse_object *name_op;
acpi_status status;
- acpi_namespace_node *method_node = NULL;
+ acpi_operand_object *method_desc;
acpi_namespace_node *node;
acpi_generic_state scope_info;
@@ -369,30 +369,36 @@
&node);
if (ACPI_SUCCESS (status)) {
if (node->type == ACPI_TYPE_METHOD) {
- method_node = node;
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n",
- method_node, path));
+ method_desc = acpi_ns_get_attached_object (node);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Desc %p Path=%p\n",
+ node, method_desc, path));
name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
- if (name_op) {
- /* Change arg into a METHOD CALL and attach name to it */
+ if (!name_op) {
+ return_VOID;
+ }
- acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
+ /* Change arg into a METHOD CALL and attach name to it */
- name_op->common.value.name = path;
+ acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
- /* Point METHODCALL/NAME to the METHOD Node */
+ name_op->common.value.name = path;
- name_op->common.node = method_node;
- acpi_ps_append_arg (arg, name_op);
+ /* Point METHODCALL/NAME to the METHOD Node */
- if (!acpi_ns_get_attached_object (method_node)) {
- return_VOID;
- }
+ name_op->common.node = node;
+ acpi_ps_append_arg (arg, name_op);
- *arg_count = (acpi_ns_get_attached_object (method_node))->method.param_count;
+ if (!method_desc) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p has no attached object\n",
+ node));
+ return_VOID;
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Control Method - %p Args %X\n",
+ node, method_desc->method.param_count));
+
+ *arg_count = method_desc->method.param_count;
return_VOID;
}
diff -Nru a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
--- a/drivers/acpi/parser/psopcode.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/parser/psopcode.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 70 $
+ * $Revision: 71 $
*
*****************************************************************************/
@@ -734,7 +734,7 @@
acpi_ps_get_opcode_name (
u16 opcode)
{
-#ifdef ACPI_DEBUG
+#ifdef ACPI_DISASSEMBLER
const acpi_opcode_info *op;
diff -Nru a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
--- a/drivers/acpi/parser/psparse.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/parser/psparse.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 128 $
+ * $Revision: 129 $
*
*****************************************************************************/
@@ -473,7 +473,7 @@
parser_state = &walk_state->parser_state;
walk_state->arg_types = 0;
-#ifndef PARSER_ONLY
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
/* We are restarting a preempted control method */
diff -Nru a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
--- a/drivers/acpi/parser/psutils.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/parser/psutils.c Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 52 $
+ * $Revision: 54 $
*
*****************************************************************************/
@@ -88,7 +88,7 @@
op->common.data_type = ACPI_DESC_TYPE_PARSER;
op->common.aml_opcode = opcode;
- ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
+ ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
(acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name)));
}
@@ -186,7 +186,7 @@
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
}
- if (op->common.flags == ACPI_PARSEOP_GENERIC) {
+ if (op->common.flags & ACPI_PARSEOP_GENERIC) {
acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
}
else {
diff -Nru a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
--- a/drivers/acpi/pci_irq.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/pci_irq.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 10 $)
+ * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 11 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/pci_link.c Fri Jul 26 19:58:50 2002
@@ -1,5 +1,5 @@
/*
- * pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 33 $)
+ * pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -54,13 +54,13 @@
static int acpi_pci_link_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_pci_link_driver = {
- name: ACPI_PCI_LINK_DRIVER_NAME,
- class: ACPI_PCI_LINK_CLASS,
- ids: ACPI_PCI_LINK_HID,
- ops: {
- add: acpi_pci_link_add,
- remove: acpi_pci_link_remove,
- },
+ .name = ACPI_PCI_LINK_DRIVER_NAME,
+ .class = ACPI_PCI_LINK_CLASS,
+ .ids = ACPI_PCI_LINK_HID,
+ .ops = {
+ .add = acpi_pci_link_add,
+ .remove = acpi_pci_link_remove,
+ },
};
struct acpi_pci_link_irq {
diff -Nru a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
--- a/drivers/acpi/pci_root.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/pci_root.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 39 $)
+ * pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 40 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -47,13 +47,13 @@
static int acpi_pci_root_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_pci_root_driver = {
- name: ACPI_PCI_ROOT_DRIVER_NAME,
- class: ACPI_PCI_ROOT_CLASS,
- ids: ACPI_PCI_ROOT_HID,
- ops: {
- add: acpi_pci_root_add,
- remove: acpi_pci_root_remove,
- },
+ .name = ACPI_PCI_ROOT_DRIVER_NAME,
+ .class = ACPI_PCI_ROOT_CLASS,
+ .ids = ACPI_PCI_ROOT_HID,
+ .ops = {
+ .add = acpi_pci_root_add,
+ .remove = acpi_pci_root_remove,
+ },
};
struct acpi_pci_root {
diff -Nru a/drivers/acpi/power.c b/drivers/acpi/power.c
--- a/drivers/acpi/power.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/power.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_power.c - ACPI Bus Power Management ($Revision: 38 $)
+ * acpi_power.c - ACPI Bus Power Management ($Revision: 39 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -43,13 +43,13 @@
int acpi_power_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_power_driver = {
- name: ACPI_POWER_DRIVER_NAME,
- class: ACPI_POWER_CLASS,
- ids: ACPI_POWER_HID,
- ops: {
- add: acpi_power_add,
- remove: acpi_power_remove,
- },
+ .name = ACPI_POWER_DRIVER_NAME,
+ .class = ACPI_POWER_CLASS,
+ .ids = ACPI_POWER_HID,
+ .ops = {
+ .add = acpi_power_add,
+ .remove = acpi_power_remove,
+ },
};
struct acpi_power_resource
diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c
--- a/drivers/acpi/processor.c Fri Jul 26 19:58:52 2002
+++ b/drivers/acpi/processor.c Fri Jul 26 19:58:52 2002
@@ -1,5 +1,5 @@
/*
- * acpi_processor.c - ACPI Processor Driver ($Revision: 69 $)
+ * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -78,13 +78,13 @@
static int acpi_processor_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_processor_driver = {
- name: ACPI_PROCESSOR_DRIVER_NAME,
- class: ACPI_PROCESSOR_CLASS,
- ids: ACPI_PROCESSOR_HID,
- ops: {
- add: acpi_processor_add,
- remove: acpi_processor_remove,
- },
+ .name = ACPI_PROCESSOR_DRIVER_NAME,
+ .class = ACPI_PROCESSOR_CLASS,
+ .ids = ACPI_PROCESSOR_HID,
+ .ops = {
+ .add = acpi_processor_add,
+ .remove = acpi_processor_remove,
+ },
};
/* Power Management */
diff -Nru a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
--- a/drivers/acpi/resources/rsio.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/resources/rsio.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 21 $
+ * $Revision: 22 $
*
******************************************************************************/
@@ -399,7 +399,7 @@
buffer += 1;
temp8 = *buffer;
- /* Decode the IRQ bits */
+ /* Decode the DMA channel bits */
for (i = 0, index = 0; index < 8; index++) {
if ((temp8 >> index) & 0x01) {
@@ -407,19 +407,16 @@
i++;
}
}
- if (i == 0) {
- /* Zero channels is invalid! */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero DMA channels in resource list\n"));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
- output_struct->data.dma.number_of_channels = i;
+ /* Zero DMA channels is valid */
-
- /*
- * Calculate the structure size based upon the number of interrupts
- */
- struct_size += ((ACPI_SIZE) output_struct->data.dma.number_of_channels - 1) * 4;
+ output_struct->data.dma.number_of_channels = i;
+ if (i > 0) {
+ /*
+ * Calculate the structure size based upon the number of interrupts
+ */
+ struct_size += ((ACPI_SIZE) i - 1) * 4;
+ }
/*
* Point to Byte 2
diff -Nru a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
--- a/drivers/acpi/resources/rsirq.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/resources/rsirq.c Fri Jul 26 19:58:51 2002
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 29 $
+ * $Revision: 30 $
*
******************************************************************************/
@@ -96,18 +96,15 @@
}
}
- if (i == 0) {
- /* Zero interrupts is invalid! */
+ /* Zero interrupts is valid */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero interrupt levels in resource list\n"));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
output_struct->data.irq.number_of_interrupts = i;
-
- /*
- * Calculate the structure size based upon the number of interrupts
- */
- struct_size += ((ACPI_SIZE) output_struct->data.irq.number_of_interrupts - 1) * 4;
+ if (i > 0) {
+ /*
+ * Calculate the structure size based upon the number of interrupts
+ */
+ struct_size += ((ACPI_SIZE) i - 1) * 4;
+ }
/*
* Point to Byte 3 if it is used
diff -Nru a/drivers/acpi/system.c b/drivers/acpi/system.c
--- a/drivers/acpi/system.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/system.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_system.c - ACPI System Driver ($Revision: 60 $)
+ * acpi_system.c - ACPI System Driver ($Revision: 63 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -63,13 +63,13 @@
static int acpi_system_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_system_driver = {
- name: ACPI_SYSTEM_DRIVER_NAME,
- class: ACPI_SYSTEM_CLASS,
- ids: ACPI_SYSTEM_HID,
- ops: {
- add: acpi_system_add,
- remove: acpi_system_remove
- },
+ .name = ACPI_SYSTEM_DRIVER_NAME,
+ .class = ACPI_SYSTEM_CLASS,
+ .ids = ACPI_SYSTEM_HID,
+ .ops = {
+ .add = acpi_system_add,
+ .remove = acpi_system_remove
+ },
};
struct acpi_system
@@ -383,10 +383,10 @@
static struct file_operations acpi_system_event_ops = {
- open: acpi_system_open_event,
- read: acpi_system_read_event,
- release: acpi_system_close_event,
- poll: acpi_system_poll_event,
+ .open = acpi_system_open_event,
+ .read = acpi_system_read_event,
+ .release = acpi_system_close_event,
+ .poll = acpi_system_poll_event,
};
static int
@@ -479,7 +479,7 @@
static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*);
static struct file_operations acpi_system_dsdt_ops = {
- read: acpi_system_read_dsdt,
+ .read = acpi_system_read_dsdt,
};
static ssize_t
@@ -522,7 +522,7 @@
static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*);
static struct file_operations acpi_system_fadt_ops = {
- read: acpi_system_read_fadt,
+ .read = acpi_system_read_fadt,
};
static ssize_t
@@ -1165,15 +1165,15 @@
/* Simple wrapper calling power down function. */
static void acpi_sysrq_power_off(int key, struct pt_regs *pt_regs,
- struct tty_struct *tty)
+ struct tty_struct *tty)
{
acpi_power_off();
}
struct sysrq_key_op sysrq_acpi_poweroff_op = {
- handler: &acpi_sysrq_power_off,
- help_msg: "Off",
- action_msg: "Power Off\n"
+ .handler = &acpi_sysrq_power_off,
+ .help_msg = "Off",
+ .action_msg = "Power Off\n"
};
#endif /* CONFIG_MAGIC_SYSRQ */
diff -Nru a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
--- a/drivers/acpi/tables/tbrsdt.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/tables/tbrsdt.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbrsdt - ACPI RSDT table utilities
- * $Revision: 1 $
+ * $Revision: 2 $
*
*****************************************************************************/
@@ -270,12 +270,6 @@
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
-
- /*
- * Valid RSDT signature, verify the checksum. If it fails, just
- * print a warning and ignore it.
- */
- status = acpi_tb_verify_table_checksum (table_info.pointer);
/* Get the number of tables defined in the RSDT or XSDT */
diff -Nru a/drivers/acpi/tables.c b/drivers/acpi/tables.c
--- a/drivers/acpi/tables.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/tables.c Fri Jul 26 19:58:51 2002
@@ -330,6 +330,11 @@
return -ENODEV;
}
+ if (acpi_table_compute_checksum(header, header->length)) {
+ printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
+ return -ENODEV;
+ }
+
sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
if (sdt.count > ACPI_MAX_TABLES) {
printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
@@ -367,6 +372,11 @@
if (strncmp(header->signature, "RSDT", 4)) {
printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
+ return -ENODEV;
+ }
+
+ if (acpi_table_compute_checksum(header, header->length)) {
+ printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
return -ENODEV;
}
diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
--- a/drivers/acpi/thermal.c Fri Jul 26 19:58:51 2002
+++ b/drivers/acpi/thermal.c Fri Jul 26 19:58:51 2002
@@ -1,5 +1,5 @@
/*
- * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 40 $)
+ * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $)
*
* Copyright (C) 2001, 2002 Andy Grover
* Copyright (C) 2001, 2002 Paul Diefenbaugh
@@ -65,13 +65,13 @@
static int acpi_thermal_remove (struct acpi_device *device, int type);
static struct acpi_driver acpi_thermal_driver = {
- name: ACPI_THERMAL_DRIVER_NAME,
- class: ACPI_THERMAL_CLASS,
- ids: ACPI_THERMAL_HID,
- ops: {
- add: acpi_thermal_add,
- remove: acpi_thermal_remove,
- },
+ .name = ACPI_THERMAL_DRIVER_NAME,
+ .class = ACPI_THERMAL_CLASS,
+ .ids = ACPI_THERMAL_HID,
+ .ops = {
+ .add = acpi_thermal_add,
+ .remove = acpi_thermal_remove,
+ },
};
struct acpi_thermal_state {
diff -Nru a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
--- a/drivers/acpi/utilities/utglobal.c Fri Jul 26 19:58:50 2002
+++ b/drivers/acpi/utilities/utglobal.c Fri Jul 26 19:58:50 2002
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 164 $
+ * $Revision: 165 $
*
*****************************************************************************/
@@ -27,6 +27,7 @@
#include "acpi.h"
#include "acnamesp.h"
+#include "amlcode.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
@@ -357,15 +358,15 @@
/* Region type decoding */
-static const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
+const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
{
"System_memory",
"System_iO",
- "PCIConfig",
+ "PCI_Config",
"Embedded_control",
"SMBus",
"CMOS",
- "PCIBar_target",
+ "PCIBARTarget",
"Data_table",
};
@@ -554,55 +555,6 @@
return (acpi_gbl_mutex_names[mutex_id]);
}
-
-/* Various strings for future use */
-
-#if 0
-#include "amlcode.h"
-
-/* Data used in keeping track of fields */
-
-static const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] =
-{
- "skip",
- "?access?"
-}; /* FE = Field Element */
-
-
-static const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] =
-{
- "Error",
- "MTR",
- "MEQ",
- "MLE",
- "MLT",
- "MGE",
- "MGT"
-};
-
-
-/* Access type decoding */
-
-static const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] =
-{
- "Any_acc",
- "Byte_acc",
- "Word_acc",
- "DWord_acc",
- "QWord_acc",
- "Buffer_acc",
-};
-
-
-/* Update rule decoding */
-
-static const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] =
-{
- "Preserve",
- "Write_as_ones",
- "Write_as_zeros"
-};
-#endif /* Future use */
#endif
diff -Nru a/drivers/base/fs.c b/drivers/base/fs.c
--- a/drivers/base/fs.c Fri Jul 26 19:58:51 2002
+++ b/drivers/base/fs.c Fri Jul 26 19:58:51 2002
@@ -106,13 +106,17 @@
static int create_symlink(struct driver_dir_entry * parent, char * name, char * path)
{
struct driver_file_entry * entry;
+ int error;
entry = kmalloc(sizeof(struct driver_file_entry),GFP_KERNEL);
if (!entry)
return -ENOMEM;
entry->name = name;
entry->mode = S_IRUGO;
- return driverfs_create_symlink(parent,entry,path);
+ error = driverfs_create_symlink(parent,entry,path);
+ if (error)
+ kfree(entry);
+ return error;
}
int device_bus_link(struct device * dev)
diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
--- a/drivers/block/DAC960.c Fri Jul 26 19:58:52 2002
+++ b/drivers/block/DAC960.c Fri Jul 26 19:58:52 2002
@@ -2884,7 +2884,7 @@
Command->BufferHeader = Request->bio;
Command->RequestBuffer = Request->buffer;
blkdev_dequeue_request(Request);
- blkdev_release_request(Request);
+ blk_put_request(Request);
DAC960_QueueReadWriteCommand(Command);
return true;
}
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c Fri Jul 26 19:58:51 2002
+++ b/drivers/block/genhd.c Fri Jul 26 19:58:51 2002
@@ -177,16 +177,12 @@
extern int blk_dev_init(void);
extern int soc_probe(void);
extern int atmdev_init(void);
-extern int i2o_init(void);
extern int cpqarray_init(void);
int __init device_init(void)
{
rwlock_init(&gendisk_lock);
blk_dev_init();
-#ifdef CONFIG_I2O
- i2o_init();
-#endif
#ifdef CONFIG_FC4_SOC
/* This has to be done before scsi_dev_init */
soc_probe();
diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c Fri Jul 26 19:58:50 2002
+++ b/drivers/block/ll_rw_blk.c Fri Jul 26 19:58:50 2002
@@ -1233,9 +1233,47 @@
return rq;
}
-void blk_put_request(struct request *rq)
+/**
+ * blk_insert_request - insert a special request in to a request queue
+ * @q: request queue where request should be inserted
+ * @rq: request to be inserted
+ * @at_head: insert request at head or tail of queue
+ * @data: private data
+ *
+ * Description:
+ * Many block devices need to execute commands asynchronously, so they don't
+ * block the whole kernel from preemption during request execution. This is
+ * accomplished normally by inserting aritficial requests tagged as
+ * REQ_SPECIAL in to the corresponding request queue, and letting them be
+ * scheduled for actual execution by the request queue.
+ *
+ * We have the option of inserting the head or the tail of the queue.
+ * Typically we use the tail for new ioctls and so forth. We use the head
+ * of the queue for things like a QUEUE_FULL message from a device, or a
+ * host that is unable to accept a particular command.
+ */
+void blk_insert_request(request_queue_t *q, struct request *rq,
+ int at_head, void *data)
{
- blkdev_release_request(rq);
+ unsigned long flags;
+
+ /*
+ * tell I/O scheduler that this isn't a regular read/write (ie it
+ * must not attempt merges on this) and that it acts as a soft
+ * barrier
+ */
+ rq->flags &= REQ_QUEUED;
+ rq->flags |= REQ_SPECIAL | REQ_BARRIER;
+
+ rq->special = data;
+
+ spin_lock_irqsave(q->queue_lock, flags);
+ /* If command is tagged, release the tag */
+ if(blk_rq_tagged(rq))
+ blk_queue_end_tag(q, rq);
+ _elv_add_request(q, rq, !at_head, 0);
+ q->request_fn(q);
+ spin_unlock_irqrestore(q->queue_lock, flags);
}
/* RO fail safe mechanism */
@@ -1307,7 +1345,7 @@
/*
* Must be called with queue lock held and interrupts disabled
*/
-void blkdev_release_request(struct request *req)
+void blk_put_request(struct request *req)
{
struct request_list *rl = req->rl;
request_queue_t *q = req->q;
@@ -1370,7 +1408,7 @@
req->nr_sectors = req->hard_nr_sectors += next->hard_nr_sectors;
- blkdev_release_request(next);
+ blk_put_request(next);
}
}
@@ -1568,7 +1606,7 @@
add_request(q, req, insert_here);
out:
if (freereq)
- blkdev_release_request(freereq);
+ blk_put_request(freereq);
spin_unlock_irq(q->queue_lock);
return 0;
@@ -2003,7 +2041,7 @@
if (req->waiting)
complete(req->waiting);
- blkdev_release_request(req);
+ blk_put_request(req);
}
#define MB(kb) ((kb) << 10)
@@ -2064,7 +2102,6 @@
EXPORT_SYMBOL(blk_queue_make_request);
EXPORT_SYMBOL(blk_queue_bounce_limit);
EXPORT_SYMBOL(generic_make_request);
-EXPORT_SYMBOL(blkdev_release_request);
EXPORT_SYMBOL(generic_unplug_device);
EXPORT_SYMBOL(blk_plug_device);
EXPORT_SYMBOL(blk_remove_plug);
@@ -2088,6 +2125,7 @@
EXPORT_SYMBOL(blk_get_request);
EXPORT_SYMBOL(__blk_get_request);
EXPORT_SYMBOL(blk_put_request);
+EXPORT_SYMBOL(blk_insert_request);
EXPORT_SYMBOL(blk_queue_prep_rq);
diff -Nru a/drivers/block/paride/ppc6lnx.c b/drivers/block/paride/ppc6lnx.c
--- a/drivers/block/paride/ppc6lnx.c Fri Jul 26 19:58:50 2002
+++ b/drivers/block/paride/ppc6lnx.c Fri Jul 26 19:58:50 2002
@@ -724,4 +724,3 @@
//***************************************************************************
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/block/umem.c b/drivers/block/umem.c
--- a/drivers/block/umem.c Fri Jul 26 19:58:52 2002
+++ b/drivers/block/umem.c Fri Jul 26 19:58:52 2002
@@ -819,7 +819,7 @@
static int mm_revalidate(kdev_t i_rdev)
{
int card_number = DEVICE_NR(i_rdev);
- kdev_t device = mk_mdev(MAJOR_NR, card_number << MM_SHIFT);
+ kdev_t device = mk_kdev(MAJOR_NR, card_number << MM_SHIFT);
int res = dev_lock_part(device);
if (res < 0)
return res;
@@ -862,7 +862,7 @@
size = cards[card_number].mm_size * (1024 / MM_HARDSECT);
geo.heads = 64;
geo.sectors = 32;
- geo.start = get_start_sect(inode->i_bdev);
+ geo.start = get_start_sect(i->i_bdev);
geo.cylinders = size / (geo.heads * geo.sectors);
if (copy_to_user((void *) arg, &geo, sizeof(geo)))
diff -Nru a/drivers/char/epca.h b/drivers/char/epca.h
--- a/drivers/char/epca.h Fri Jul 26 19:58:51 2002
+++ b/drivers/char/epca.h Fri Jul 26 19:58:51 2002
@@ -121,7 +121,7 @@
int close_delay;
int count;
int blocked_open;
- int event;
+ ulong event;
int asyncflags;
uint dev;
long session;
diff -Nru a/drivers/char/serial_21285.c b/drivers/char/serial_21285.c
--- a/drivers/char/serial_21285.c Fri Jul 26 19:58:51 2002
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,497 +0,0 @@
-/*
- * linux/drivers/char/serial_21285.c
- *
- * Driver for the serial port on the 21285 StrongArm-110 core logic chip.
- *
- * Based on drivers/char/serial.c
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#define BAUD_BASE (mem_fclk_21285/64)
-
-#define SERIAL_21285_NAME "ttyFB"
-#define SERIAL_21285_MAJOR 204
-#define SERIAL_21285_MINOR 4
-
-#define SERIAL_21285_AUXNAME "cuafb"
-#define SERIAL_21285_AUXMAJOR 205
-#define SERIAL_21285_AUXMINOR 4
-
-static struct tty_driver rs285_driver, callout_driver;
-static int rs285_refcount;
-static struct tty_struct *rs285_table[1];
-
-static struct termios *rs285_termios[1];
-static struct termios *rs285_termios_locked[1];
-
-static char wbuf[1000], *putp = wbuf, *getp = wbuf, x_char;
-static struct tty_struct *rs285_tty;
-static int rs285_use_count;
-
-static int rs285_write_room(struct tty_struct *tty)
-{
- return putp >= getp ? (sizeof(wbuf) - (long) putp + (long) getp) : ((long) getp - (long) putp - 1);
-}
-
-static void rs285_rx_int(int irq, void *dev_id, struct pt_regs *regs)
-{
- if (!rs285_tty) {
- disable_irq(IRQ_CONRX);
- return;
- }
- while (!(*CSR_UARTFLG & 0x10)) {
- int ch, flag;
- ch = *CSR_UARTDR;
- flag = *CSR_RXSTAT;
- if (flag & 4)
- tty_insert_flip_char(rs285_tty, 0, TTY_OVERRUN);
- if (flag & 2)
- flag = TTY_PARITY;
- else if (flag & 1)
- flag = TTY_FRAME;
- tty_insert_flip_char(rs285_tty, ch, flag);
- }
- tty_flip_buffer_push(rs285_tty);
-}
-
-static void rs285_send_xchar(struct tty_struct *tty, char ch)
-{
- x_char = ch;
- enable_irq(IRQ_CONTX);
-}
-
-static void rs285_throttle(struct tty_struct *tty)
-{
- if (I_IXOFF(tty))
- rs285_send_xchar(tty, STOP_CHAR(tty));
-}
-
-static void rs285_unthrottle(struct tty_struct *tty)
-{
- if (I_IXOFF(tty)) {
- if (x_char)
- x_char = 0;
- else
- rs285_send_xchar(tty, START_CHAR(tty));
- }
-}
-
-static void rs285_tx_int(int irq, void *dev_id, struct pt_regs *regs)
-{
- while (!(*CSR_UARTFLG & 0x20)) {
- if (x_char) {
- *CSR_UARTDR = x_char;
- x_char = 0;
- continue;
- }
- if (putp == getp) {
- disable_irq(IRQ_CONTX);
- break;
- }
- *CSR_UARTDR = *getp;
- if (++getp >= wbuf + sizeof(wbuf))
- getp = wbuf;
- }
- if (rs285_tty)
- wake_up_interruptible(&rs285_tty->write_wait);
-}
-
-static inline int rs285_xmit(int ch)
-{
- if (putp + 1 == getp || (putp + 1 == wbuf + sizeof(wbuf) && getp == wbuf))
- return 0;
- *putp = ch;
- if (++putp >= wbuf + sizeof(wbuf))
- putp = wbuf;
- enable_irq(IRQ_CONTX);
- return 1;
-}
-
-static int rs285_write(struct tty_struct *tty, int from_user,
- const u_char * buf, int count)
-{
- int i;
-
- if (from_user && verify_area(VERIFY_READ, buf, count))
- return -EINVAL;
-
- for (i = 0; i < count; i++) {
- char ch;
- if (from_user)
- __get_user(ch, buf + i);
- else
- ch = buf[i];
- if (!rs285_xmit(ch))
- break;
- }
- return i;
-}
-
-static void rs285_put_char(struct tty_struct *tty, u_char ch)
-{
- rs285_xmit(ch);
-}
-
-static int rs285_chars_in_buffer(struct tty_struct *tty)
-{
- return sizeof(wbuf) - rs285_write_room(tty);
-}
-
-static void rs285_flush_buffer(struct tty_struct *tty)
-{
- disable_irq(IRQ_CONTX);
- putp = getp = wbuf;
- if (x_char)
- enable_irq(IRQ_CONTX);
-}
-
-static inline void rs285_set_cflag(int cflag)
-{
- int h_lcr, baud, quot;
-
- switch (cflag & CSIZE) {
- case CS5:
- h_lcr = 0x10;
- break;
- case CS6:
- h_lcr = 0x30;
- break;
- case CS7:
- h_lcr = 0x50;
- break;
- default: /* CS8 */
- h_lcr = 0x70;
- break;
-
- }
- if (cflag & CSTOPB)
- h_lcr |= 0x08;
- if (cflag & PARENB)
- h_lcr |= 0x02;
- if (!(cflag & PARODD))
- h_lcr |= 0x04;
-
- switch (cflag & CBAUD) {
- case B200: baud = 200; break;
- case B300: baud = 300; break;
- case B1200: baud = 1200; break;
- case B1800: baud = 1800; break;
- case B2400: baud = 2400; break;
- case B4800: baud = 4800; break;
- default:
- case B9600: baud = 9600; break;
- case B19200: baud = 19200; break;
- case B38400: baud = 38400; break;
- case B57600: baud = 57600; break;
- case B115200: baud = 115200; break;
- }
-
- /*
- * The documented expression for selecting the divisor is:
- * BAUD_BASE / baud - 1
- * However, typically BAUD_BASE is not divisible by baud, so
- * we want to select the divisor that gives us the minimum
- * error. Therefore, we want:
- * int(BAUD_BASE / baud - 0.5) ->
- * int(BAUD_BASE / baud - (baud >> 1) / baud) ->
- * int((BAUD_BASE - (baud >> 1)) / baud)
- */
- quot = (BAUD_BASE - (baud >> 1)) / baud;
-
- *CSR_UARTCON = 0;
- *CSR_L_UBRLCR = quot & 0xff;
- *CSR_M_UBRLCR = (quot >> 8) & 0x0f;
- *CSR_H_UBRLCR = h_lcr;
- *CSR_UARTCON = 1;
-}
-
-static void rs285_set_termios(struct tty_struct *tty, struct termios *old)
-{
- if (old && tty->termios->c_cflag == old->c_cflag)
- return;
- rs285_set_cflag(tty->termios->c_cflag);
-}
-
-
-static void rs285_stop(struct tty_struct *tty)
-{
- disable_irq(IRQ_CONTX);
-}
-
-static void rs285_start(struct tty_struct *tty)
-{
- enable_irq(IRQ_CONTX);
-}
-
-static void rs285_wait_until_sent(struct tty_struct *tty, int timeout)
-{
- int orig_jiffies = jiffies;
- while (*CSR_UARTFLG & 8) {
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
- if (signal_pending(current))
- break;
- if (timeout && time_after(jiffies, orig_jiffies + timeout))
- break;
- }
- current->state = TASK_RUNNING;
-}
-
-static int rs285_open(struct tty_struct *tty, struct file *filp)
-{
- int line;
-
- MOD_INC_USE_COUNT;
- line = minor(tty->device) - tty->driver.minor_start;
- if (line) {
- MOD_DEC_USE_COUNT;
- return -ENODEV;
- }
-
- tty->driver_data = NULL;
- if (!rs285_tty)
- rs285_tty = tty;
-
- enable_irq(IRQ_CONRX);
- rs285_use_count++;
- return 0;
-}
-
-static void rs285_close(struct tty_struct *tty, struct file *filp)
-{
- if (!--rs285_use_count) {
- rs285_wait_until_sent(tty, 0);
- disable_irq(IRQ_CONRX);
- disable_irq(IRQ_CONTX);
- rs285_tty = NULL;
- }
- MOD_DEC_USE_COUNT;
-}
-
-static int __init rs285_init(void)
-{
- int baud = B9600;
-
- if (machine_is_personal_server())
- baud = B57600;
-
- rs285_driver.magic = TTY_DRIVER_MAGIC;
- rs285_driver.driver_name = "serial_21285";
- rs285_driver.name = SERIAL_21285_NAME;
- rs285_driver.major = SERIAL_21285_MAJOR;
- rs285_driver.minor_start = SERIAL_21285_MINOR;
- rs285_driver.num = 1;
- rs285_driver.type = TTY_DRIVER_TYPE_SERIAL;
- rs285_driver.subtype = SERIAL_TYPE_NORMAL;
- rs285_driver.init_termios = tty_std_termios;
- rs285_driver.init_termios.c_cflag = baud | CS8 | CREAD | HUPCL | CLOCAL;
- rs285_driver.flags = TTY_DRIVER_REAL_RAW;
- rs285_driver.refcount = &rs285_refcount;
- rs285_driver.table = rs285_table;
- rs285_driver.termios = rs285_termios;
- rs285_driver.termios_locked = rs285_termios_locked;
-
- rs285_driver.open = rs285_open;
- rs285_driver.close = rs285_close;
- rs285_driver.write = rs285_write;
- rs285_driver.put_char = rs285_put_char;
- rs285_driver.write_room = rs285_write_room;
- rs285_driver.chars_in_buffer = rs285_chars_in_buffer;
- rs285_driver.flush_buffer = rs285_flush_buffer;
- rs285_driver.throttle = rs285_throttle;
- rs285_driver.unthrottle = rs285_unthrottle;
- rs285_driver.send_xchar = rs285_send_xchar;
- rs285_driver.set_termios = rs285_set_termios;
- rs285_driver.stop = rs285_stop;
- rs285_driver.start = rs285_start;
- rs285_driver.wait_until_sent = rs285_wait_until_sent;
-
- callout_driver = rs285_driver;
- callout_driver.name = SERIAL_21285_AUXNAME;
- callout_driver.major = SERIAL_21285_AUXMAJOR;
- callout_driver.subtype = SERIAL_TYPE_CALLOUT;
-
- if (request_irq(IRQ_CONRX, rs285_rx_int, 0, "rs285", NULL))
- panic("Couldn't get rx irq for rs285");
-
- if (request_irq(IRQ_CONTX, rs285_tx_int, 0, "rs285", NULL))
- panic("Couldn't get tx irq for rs285");
-
- if (tty_register_driver(&rs285_driver))
- printk(KERN_ERR "Couldn't register 21285 serial driver\n");
- if (tty_register_driver(&callout_driver))
- printk(KERN_ERR "Couldn't register 21285 callout driver\n");
-
- return 0;
-}
-
-static void __exit rs285_fini(void)
-{
- unsigned long flags;
- int ret;
-
- save_flags(flags);
- cli();
- ret = tty_unregister_driver(&callout_driver);
- if (ret)
- printk(KERN_ERR "Unable to unregister 21285 callout driver "
- "(%d)\n", ret);
- ret = tty_unregister_driver(&rs285_driver);
- if (ret)
- printk(KERN_ERR "Unable to unregister 21285 driver (%d)\n",
- ret);
- free_irq(IRQ_CONTX, NULL);
- free_irq(IRQ_CONRX, NULL);
- restore_flags(flags);
-}
-
-module_init(rs285_init);
-module_exit(rs285_fini);
-
-#ifdef CONFIG_SERIAL_21285_CONSOLE
-/************** console driver *****************/
-
-static void rs285_console_write(struct console *co, const char *s, u_int count)
-{
- int i;
-
- disable_irq(IRQ_CONTX);
- for (i = 0; i < count; i++) {
- while (*CSR_UARTFLG & 0x20);
- *CSR_UARTDR = s[i];
- if (s[i] == '\n') {
- while (*CSR_UARTFLG & 0x20);
- *CSR_UARTDR = '\r';
- }
- }
- enable_irq(IRQ_CONTX);
-}
-
-static kdev_t rs285_console_device(struct console *c)
-{
- return mk_kdev(SERIAL_21285_MAJOR, SERIAL_21285_MINOR);
-}
-
-static int __init rs285_console_setup(struct console *co, char *options)
-{
- int baud = 9600;
- int bits = 8;
- int parity = 'n';
- int cflag = CREAD | HUPCL | CLOCAL;
-
- if (machine_is_personal_server())
- baud = 57600;
-
- if (options) {
- char *s = options;
- baud = simple_strtoul(options, 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;
- case 9600:
- cflag |= B9600;
- break;
- case 19200:
- cflag |= B19200;
- break;
- case 38400:
- cflag |= B38400;
- break;
- case 57600:
- cflag |= B57600;
- break;
- case 115200:
- cflag |= B115200;
- break;
- default:
- cflag |= B9600;
- break;
- }
- switch (bits) {
- case 7:
- cflag |= CS7;
- break;
- default:
- cflag |= CS8;
- break;
- }
- switch (parity) {
- case 'o':
- case 'O':
- cflag |= PARODD;
- break;
- case 'e':
- case 'E':
- cflag |= PARENB;
- break;
- }
- co->cflag = cflag;
- rs285_set_cflag(cflag);
- rs285_console_write(NULL, "\e[2J\e[Hboot ", 12);
- if (options)
- rs285_console_write(NULL, options, strlen(options));
- else
- rs285_console_write(NULL, "no options", 10);
- rs285_console_write(NULL, "\n", 1);
-
- return 0;
-}
-
-static struct console rs285_cons =
-{
- name: SERIAL_21285_NAME,
- write: rs285_console_write,
- device: rs285_console_device,
- setup: rs285_console_setup,
- flags: CON_PRINTBUFFER,
- index: -1,
-};
-
-void __init rs285_console_init(void)
-{
- register_console(&rs285_cons);
-}
-
-#endif /* CONFIG_SERIAL_21285_CONSOLE */
-
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/serial_amba.c b/drivers/char/serial_amba.c
--- a/drivers/char/serial_amba.c Fri Jul 26 19:58:50 2002
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,2014 +0,0 @@
-/*
- * 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 must be locked 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);
-}
-
-static kdev_t ambauart_console_device(struct console *c)
-{
- return mk_kdev(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,
- setup: ambauart_console_setup,
- flags: CON_PRINTBUFFER,
- index: -1,
-};
-
-void __init ambauart_console_init(void)
-{
- register_console(&ambauart_cons);
-}
-
-#endif /* CONFIG_SERIAL_AMBA_CONSOLE */
-
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/specialix_io8.h b/drivers/char/specialix_io8.h
--- a/drivers/char/specialix_io8.h Fri Jul 26 19:58:50 2002
+++ b/drivers/char/specialix_io8.h Fri Jul 26 19:58:50 2002
@@ -110,7 +110,7 @@
struct tty_struct * tty;
int count;
int blocked_open;
- int event;
+ ulong event;
int timeout;
int close_delay;
long session;
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c Fri Jul 26 19:58:51 2002
+++ b/drivers/char/tty_io.c Fri Jul 26 19:58:51 2002
@@ -545,6 +545,7 @@
#endif
do_tty_hangup((void *) tty);
}
+EXPORT_SYMBOL(tty_vhangup);
int tty_hung_up_p(struct file * filp)
{
@@ -1458,6 +1459,10 @@
if (!waitqueue_active(&tty->read_wait))
tty->minimum_to_wake = 1;
if (filp->f_owner.pid == 0) {
+ retval = security_ops->file_set_fowner(filp);
+ if (retval)
+ return retval;
+
filp->f_owner.pid = (-tty->pgrp) ? : current->pid;
filp->f_owner.uid = current->uid;
filp->f_owner.euid = current->euid;
diff -Nru a/drivers/ide/Config.help b/drivers/ide/Config.help
--- a/drivers/ide/Config.help Fri Jul 26 19:58:52 2002
+++ b/drivers/ide/Config.help Fri Jul 26 19:58:52 2002
@@ -84,6 +84,16 @@
Support for outboard IDE disks, tape drives, and CD-ROM drives
connected through a PCMCIA card.
+CONFIG_ATAPI
+ If you wish to enable basic support for devices attached to the system
+ through the ATA interface, and which are using using the ATAPI protocol
+ (CD-ROM, CD-RW, DVD, DVD-RW, LS120, ZIP, ...), say Y.
+
+ If you want to compile the driver as a module ( = code which can be
+ inserted in and removed from the running kernel whenever you want),
+ say M here and read . The module
+ will be called atapi.o.
+
CONFIG_BLK_DEV_IDECD
If you have a CD-ROM drive using the ATAPI protocol, say Y. ATAPI is
a newer protocol used by IDE CD-ROM and TAPE drives, similar to the
diff -Nru a/drivers/ide/Config.in b/drivers/ide/Config.in
--- a/drivers/ide/Config.in Fri Jul 26 19:58:52 2002
+++ b/drivers/ide/Config.in Fri Jul 26 19:58:52 2002
@@ -1,40 +1,37 @@
#
-# IDE ATA ATAPI Block device driver configuration
+# ATA/ATAPI block device driver configuration
#
-# Andre Hedrick
-#
-mainmenu_option next_comment
-comment 'ATA and ATAPI Block devices'
-
-dep_tristate 'Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support' CONFIG_BLK_DEV_IDE $CONFIG_IDE
-comment 'Please see Documentation/ide.txt for help/info on IDE drives'
+dep_tristate 'Enhanced ATA/ATAPI device (disk,cdrom,...) support' CONFIG_BLK_DEV_IDE $CONFIG_IDE
if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' Use old disk-only driver on primary interface' CONFIG_BLK_DEV_HD_IDE $CONFIG_X86
define_bool CONFIG_BLK_DEV_HD $CONFIG_BLK_DEV_HD_IDE
- dep_tristate ' Include IDE/ATA-2 DISK support' CONFIG_BLK_DEV_IDEDISK $CONFIG_BLK_DEV_IDE
- dep_mbool ' Use multi-mode by default' CONFIG_IDEDISK_MULTI_MODE $CONFIG_BLK_DEV_IDEDISK
- dep_mbool ' Auto-Geometry Resizing support' CONFIG_IDEDISK_STROKE $CONFIG_BLK_DEV_IDEDISK
- dep_tristate ' PCMCIA IDE support' CONFIG_BLK_DEV_IDECS $CONFIG_BLK_DEV_IDE $CONFIG_PCMCIA
- dep_tristate ' Include IDE/ATAPI CDROM support' CONFIG_BLK_DEV_IDECD $CONFIG_BLK_DEV_IDE
- dep_tristate ' Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
- dep_tristate ' Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
- dep_tristate ' SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE $CONFIG_SCSI
+ dep_tristate ' ATA disk support' CONFIG_BLK_DEV_IDEDISK $CONFIG_BLK_DEV_IDE
+ dep_bool ' Use multi-mode by default' CONFIG_IDEDISK_MULTI_MODE $CONFIG_BLK_DEV_IDEDISK
+ dep_bool ' Auto-Geometry Resizing support' CONFIG_IDEDISK_STROKE $CONFIG_BLK_DEV_IDEDISK
+
+ dep_tristate ' ATAPI device support (CD-ROM, floppy)' CONFIG_ATAPI $CONFIG_BLK_DEV_IDE
+ dep_tristate ' CD-ROM support' CONFIG_BLK_DEV_IDECD $CONFIG_ATAPI $CONFIG_BLK_DEV_IDE
+ dep_tristate ' Tape support' CONFIG_BLK_DEV_IDETAPE $CONFIG_ATAPI $CONFIG_BLK_DEV_IDE
+ dep_tristate ' Floppy support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_ATAPI $CONFIG_BLK_DEV_IDE
+ dep_tristate ' SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_ATAPI $CONFIG_BLK_DEV_IDE $CONFIG_SCSI
+
+ dep_tristate ' PCMCIA/CardBus support' CONFIG_BLK_DEV_IDECS $CONFIG_BLK_DEV_IDE $CONFIG_PCMCIA
- comment 'ATA host chip set support'
- dep_bool ' CMD640 chip set bugfix/support' CONFIG_BLK_DEV_CMD640 $CONFIG_X86
+ comment 'ATA host controller support'
+ dep_bool ' RZ1000 bugfix/support' CONFIG_BLK_DEV_RZ1000 $CONFIG_X86
+ dep_bool ' CMD640 bugfix/support' CONFIG_BLK_DEV_CMD640 $CONFIG_X86
dep_bool ' CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED $CONFIG_BLK_DEV_CMD640
dep_bool ' ISA-PNP support' CONFIG_BLK_DEV_ISAPNP $CONFIG_ISAPNP
- if [ "$CONFIG_PCI" = "y" ]; then
- dep_bool ' RZ1000 chip set bugfix/support' CONFIG_BLK_DEV_RZ1000 $CONFIG_X86
- comment ' PCI host chip set support'
- dep_bool ' Boot off-board chip sets first support' CONFIG_BLK_DEV_OFFBOARD $CONFIG_PCI
- dep_bool ' Sharing PCI ATA interrupts support' CONFIG_IDEPCI_SHARE_IRQ $CONFIG_PCI
+ if [ "$CONFIG_PCI" != "n" ]; then
+ comment ' PCI host controller support'
+ dep_bool ' Boot off-board controllers first' CONFIG_BLK_DEV_OFFBOARD $CONFIG_PCI
+ dep_bool ' Sharing PCI ATA interrupts' CONFIG_IDEPCI_SHARE_IRQ $CONFIG_PCI
dep_bool ' Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_PCI
dep_bool ' Use PCI DMA by default when available' CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Enable DMA only for disks ' CONFIG_IDEDMA_ONLYDISK $CONFIG_IDEDMA_PCI_AUTO
define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_bool ' ATA tagged command queueing (DANGEROUS)' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
+ dep_bool ' Tagged command queueing (DANGEROUS)' CONFIG_BLK_DEV_IDE_TCQ $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL
dep_bool ' TCQ on by default' CONFIG_BLK_DEV_IDE_TCQ_DEFAULT $CONFIG_BLK_DEV_IDE_TCQ
if [ "$CONFIG_BLK_DEV_IDE_TCQ" != "n" ]; then
int ' Default queue depth' CONFIG_BLK_DEV_IDE_TCQ_DEPTH 32
@@ -110,7 +107,7 @@
fi
# assume no ISA -> also no VLB
- dep_bool ' Other ISA/VLB IDE chipset support' CONFIG_IDE_CHIPSETS $CONFIG_ISA
+ dep_bool ' ISA/VLB IDE chipset support' CONFIG_IDE_CHIPSETS $CONFIG_ISA
if [ "$CONFIG_IDE_CHIPSETS" = "y" ]; then
comment 'Note: most of these also require special kernel boot parameters'
bool ' ALI M14xx support' CONFIG_BLK_DEV_ALI14XX
@@ -122,15 +119,13 @@
dep_tristate ' QDI QD65xx support' CONFIG_BLK_DEV_QD65XX $CONFIG_BLK_DEV_IDE
bool ' UMC-8672 support' CONFIG_BLK_DEV_UMC8672
fi
- if [ "$CONFIG_BLK_DEV_IDEDMA_PCI" = "y" -o \
- "$CONFIG_BLK_DEV_IDEDMA_PMAC" = "y" -o \
- "$CONFIG_BLK_DEV_IDEDMA_ICS" = "y" ]; then
+ if [ "$CONFIG_BLK_DEV_IDEDMA_PCI" != "n" -o \
+ "$CONFIG_BLK_DEV_IDEDMA_PMAC" != "n" -o \
+ "$CONFIG_BLK_DEV_IDEDMA_ICS" != "n" ]; then
bool ' IGNORE word93 Validation BITS' CONFIG_IDEDMA_IVB
fi
-
- define_bool CONFIG_ATAPI y
else
- bool 'Old hard disk (MFM/RLL/IDE) driver' CONFIG_BLK_DEV_HD_ONLY
+ bool 'Old disk only (MFM/RLL/IDE) driver' CONFIG_BLK_DEV_HD_ONLY
define_bool CONFIG_BLK_DEV_HD $CONFIG_BLK_DEV_HD_ONLY
fi
@@ -142,8 +137,6 @@
define_bool CONFIG_IDEDMA_AUTO n
fi
-dep_tristate 'Support for IDE Raid controllers (EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL
-dep_tristate ' Support Promise software RAID (Fasttrak(tm)) (EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID_PDC $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
-dep_tristate ' Highpoint 370 software RAID (EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID_HPT $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
-
-endmenu
+dep_tristate 'Support for software RAID controllers (EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL
+dep_tristate ' Support Promise (Fasttrak(tm)) (EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID_PDC $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
+dep_tristate ' Highpoint 370 EXPERIMENTAL)' CONFIG_BLK_DEV_ATARAID_HPT $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
diff -Nru a/drivers/ide/Makefile b/drivers/ide/Makefile
--- a/drivers/ide/Makefile Fri Jul 26 19:58:52 2002
+++ b/drivers/ide/Makefile Fri Jul 26 19:58:52 2002
@@ -15,7 +15,7 @@
obj-$(CONFIG_BLK_DEV_IDE) += ide-mod.o
obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o
obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o
-# obj-$(CONFIG_ATAPI) += atapi.o
+obj-$(CONFIG_ATAPI) += atapi.o
obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o
obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o
obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o
@@ -69,6 +69,6 @@
obj-$(CONFIG_BLK_DEV_ATARAID_HPT) += hptraid.o
ide-mod-objs := device.o ide-taskfile.o main.o ide.o probe.o \
- ioctl.o atapi.o ata-timing.o $(ide-obj-y)
+ ioctl.o ata-timing.o $(ide-obj-y)
include $(TOPDIR)/Rules.make
diff -Nru a/drivers/ide/aec62xx.c b/drivers/ide/aec62xx.c
--- a/drivers/ide/aec62xx.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/aec62xx.c Fri Jul 26 19:58:51 2002
@@ -42,10 +42,11 @@
#include
#include
#include
+#include
#include
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
#define AEC_DRIVE_TIMING 0x40
@@ -167,7 +168,7 @@
return;
}
- aec_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5));
+ aec_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5));
}
#ifdef CONFIG_BLK_DEV_IDEDMA
diff -Nru a/drivers/ide/ali14xx.c b/drivers/ide/ali14xx.c
--- a/drivers/ide/ali14xx.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/ali14xx.c Fri Jul 26 19:58:51 2002
@@ -37,12 +37,13 @@
#include
#include
-#include
#include
+#include
+#include
#include
-#include "ata-timing.h"
+#include "timing.h"
/* port addresses for auto-detection */
#define ALI_NUM_PORTS 4
diff -Nru a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c
--- a/drivers/ide/alim15x3.c Fri Jul 26 19:58:52 2002
+++ b/drivers/ide/alim15x3.c Fri Jul 26 19:58:52 2002
@@ -26,30 +26,30 @@
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
-static byte m5229_revision;
-static byte chip_is_1543c_e;
+static u8 m5229_revision;
+static int chip_is_1543c_e;
static struct pci_dev *isa_dev;
-static void ali15x3_tune_drive(struct ata_device *drive, byte pio)
+static void ali15x3_tune_drive(struct ata_device *drive, u8 pio)
{
struct ata_timing *t;
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
int s_time, a_time, c_time;
- byte s_clc, a_clc, r_clc;
+ u8 s_clc, a_clc, r_clc;
unsigned long flags;
int port = hwif->unit ? 0x5c : 0x58;
int portFIFO = hwif->unit ? 0x55 : 0x54;
- byte cd_dma_fifo = 0;
+ u8 cd_dma_fifo = 0;
if (pio == 255)
pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
else
- pio = XFER_PIO_0 + min_t(byte, pio, 4);
+ pio = XFER_PIO_0 + min_t(u8, pio, 4);
t = ata_timing_data(pio);
@@ -100,15 +100,15 @@
local_irq_restore(flags);
}
-static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
+static int ali15x3_tune_chipset(struct ata_device *drive, u8 speed)
{
struct pci_dev *dev = drive->channel->pci_dev;
- byte unit = (drive->select.b.unit & 0x01);
- byte tmpbyte = 0x00;
- int m5229_udma = drive->channel->unit ? 0x57 : 0x56;
+ u8 unit = (drive->select.b.unit & 0x01);
+ u8 tmpbyte = 0x00;
+ int m5229_udma = drive->channel->unit ? 0x57 : 0x56;
if (speed < XFER_UDMA_0) {
- byte ultra_enable = (unit) ? 0x7f : 0xf7;
+ u8 ultra_enable = unit ? 0x7f : 0xf7;
/*
* clear "ultra enable" bit
*/
@@ -135,7 +135,7 @@
pci_write_config_byte(dev, 0x4b, tmpbyte);
}
}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
return ide_config_drive_speed(drive, speed);
}
@@ -212,10 +212,10 @@
{
struct pci_dev *dev = hwif->pci_dev;
unsigned int ata66 = 0;
- byte cable_80_pin[2] = { 0, 0 };
+ u8 cable_80_pin[2] = { 0, 0 };
unsigned long flags;
- byte tmpbyte;
+ u8 tmpbyte;
local_irq_save(flags);
@@ -305,8 +305,8 @@
static void __init ali15x3_init_channel(struct ata_channel *hwif)
{
#ifndef CONFIG_SPARC64
- byte ideic, inmir;
- byte irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
+ u8 ideic, inmir;
+ u8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
1, 11, 0, 12, 0, 14, 0, 15 };
hwif->irq = hwif->unit ? 15 : 14;
diff -Nru a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c
--- a/drivers/ide/amd74xx.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/amd74xx.c Fri Jul 26 19:58:51 2002
@@ -42,11 +42,12 @@
#include
#include
#include
+#include
#include
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
#define AMD_IDE_ENABLE (0x00 + amd_config->base)
@@ -171,7 +172,7 @@
return;
}
- amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5));
+ amd_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5));
}
#ifdef CONFIG_BLK_DEV_IDEDMA
diff -Nru a/drivers/ide/ata-timing.c b/drivers/ide/ata-timing.c
--- a/drivers/ide/ata-timing.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/ata-timing.c Fri Jul 26 19:58:51 2002
@@ -23,7 +23,10 @@
*/
#include
-#include "ata-timing.h"
+#include
+#include
+
+#include "timing.h"
/*
* PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). These were taken
diff -Nru a/drivers/ide/ata-timing.h b/drivers/ide/ata-timing.h
--- a/drivers/ide/ata-timing.h Fri Jul 26 19:58:52 2002
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,95 +0,0 @@
-#ifndef _ATA_TIMING_H
-#define _ATA_TIMING_H
-
-/*
- * $Id: ata-timing.h,v 2.0 2002/03/12 13:02:22 vojtech Exp $
- *
- * Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
- * Copyright (C) 1999-2001 Vojtech Pavlik
- */
-
-/*
- * 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
-
-#define XFER_PIO_5 0x0d
-#define XFER_UDMA_SLOW 0x4f
-
-struct ata_timing {
- short mode;
- short setup; /* t1 */
- short act8b; /* t2 for 8-bit io */
- short rec8b; /* t2i for 8-bit io */
- short cyc8b; /* t0 for 8-bit io */
- short active; /* t2 or tD */
- short recover; /* t2i or tK */
- short cycle; /* t0 */
- short udma; /* t2CYCTYP/2 */
-};
-
-extern struct ata_timing ata_timing[];
-
-#define IDE_TIMING_SETUP 0x01
-#define IDE_TIMING_ACT8B 0x02
-#define IDE_TIMING_REC8B 0x04
-#define IDE_TIMING_CYC8B 0x08
-#define IDE_TIMING_8BIT 0x0e
-#define IDE_TIMING_ACTIVE 0x10
-#define IDE_TIMING_RECOVER 0x20
-#define IDE_TIMING_CYCLE 0x40
-#define IDE_TIMING_UDMA 0x80
-#define IDE_TIMING_ALL 0xff
-
-#define FIT(v,x,y) max_t(int,min_t(int,v,y),x)
-#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
-#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
-
-/* see hpt366.c for details */
-#define XFER_UDMA_66_3 0x100
-#define XFER_UDMA_66_4 0x200
-
-#define XFER_MODE 0xff0
-#define XFER_UDMA_133 0x800
-#define XFER_UDMA_100 0x400
-#define XFER_UDMA_66 0x300
-#define XFER_UDMA 0x040
-#define XFER_MWDMA 0x020
-#define XFER_SWDMA 0x010
-#define XFER_EPIO 0x001
-#define XFER_PIO 0x000
-
-#define XFER_UDMA_ALL 0xf40
-#define XFER_UDMA_80W 0xf00
-
-/* External interface to host chips channel timing setup.
- *
- * It's a bit elaborate due to the legacy we have to bear.
- */
-
-extern short ata_timing_mode(struct ata_device *drive, int map);
-extern void ata_timing_quantize(struct ata_timing *t, struct ata_timing *q,
- int T, int UT);
-extern void ata_timing_merge(struct ata_timing *a, struct ata_timing *b,
- struct ata_timing *m, unsigned int what);
-void ata_timing_merge_8bit(struct ata_timing *t);
-extern struct ata_timing* ata_timing_data(short speed);
-extern int ata_timing_compute(struct ata_device *drive,
- short speed, struct ata_timing *t, int T, int UT);
-extern u8 ata_best_pio_mode(struct ata_device *drive);
-
-#endif
diff -Nru a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c
--- a/drivers/ide/cmd640.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/cmd640.c Fri Jul 26 19:58:51 2002
@@ -106,13 +106,13 @@
#include
#include
#include
+#include
#include
#include
-#include
#include
-#include "ata-timing.h"
+#include "timing.h"
/*
* This flag is set in ide.c by the parameter: ide0=cmd640_vlb
@@ -200,7 +200,7 @@
* Interface to access cmd640x registers
*/
static unsigned int cmd640_key;
-static void (*put_cmd640_reg)(unsigned short reg, byte val);
+static void (*put_cmd640_reg)(unsigned short reg, u8 val);
static u8 (*get_cmd640_reg)(unsigned short reg);
/*
@@ -214,17 +214,19 @@
* Therefore, we must use direct IO instead.
*/
+/* This is broken, but no more so than the old code.. */
+static spinlock_t cmd640_lock = SPIN_LOCK_UNLOCKED;
+
/* PCI method 1 access */
-static void put_cmd640_reg_pci1 (unsigned short reg, byte val)
+static void put_cmd640_reg_pci1 (unsigned short reg, u8 val)
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outl_p((reg & 0xfc) | cmd640_key, 0xcf8);
outb_p(val, (reg & 3) | 0xcfc);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
}
static u8 get_cmd640_reg_pci1 (unsigned short reg)
@@ -232,11 +234,10 @@
u8 b;
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outl_p((reg & 0xfc) | cmd640_key, 0xcf8);
b = inb_p((reg & 3) | 0xcfc);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
return b;
}
@@ -246,12 +247,11 @@
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outb_p(0x10, 0xcf8);
outb_p(val, cmd640_key + reg);
outb_p(0, 0xcf8);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
}
static u8 get_cmd640_reg_pci2 (unsigned short reg)
@@ -259,12 +259,11 @@
u8 b;
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outb_p(0x10, 0xcf8);
b = inb_p(cmd640_key + reg);
outb_p(0, 0xcf8);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
return b;
}
@@ -274,11 +273,10 @@
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outb_p(reg, cmd640_key);
outb_p(val, cmd640_key + 4);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
}
static u8 get_cmd640_reg_vlb (unsigned short reg)
@@ -286,11 +284,10 @@
u8 b;
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outb_p(reg, cmd640_key);
b = inb_p(cmd640_key + 4);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
return b;
}
@@ -367,8 +364,7 @@
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */
udelay(100);
@@ -376,11 +372,11 @@
outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */
udelay(100);
if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
return 0; /* nothing responded */
}
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
return 1; /* success */
}
@@ -461,8 +457,7 @@
u8 b;
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&cmd640_lock, flags);
b = get_cmd640_reg(reg);
if (mode) { /* want prefetch on? */
# if CMD640_PREFETCH_MASKS
@@ -478,7 +473,7 @@
b |= prefetch_masks[index]; /* disable prefetch */
}
put_cmd640_reg(reg, b);
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
}
/*
@@ -579,8 +574,7 @@
/*
* Now that everything is ready, program the new timings
*/
- save_flags (flags);
- cli();
+ spin_lock(&cmd640_lock, flags);
/*
* Program the address_setup clocks into ARTTIM reg,
* and then the active/recovery counts into the DRWTIM reg
@@ -589,7 +583,7 @@
setup_count |= get_cmd640_reg(arttim_regs[index]) & 0x3f;
put_cmd640_reg(arttim_regs[index], setup_count);
put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count));
- restore_flags(flags);
+ spin_unlock_irqrestore(&cmd640_lock, flags);
}
/*
@@ -647,7 +641,7 @@
/*
* Drive PIO mode selection:
*/
-static void cmd640_tune_drive(struct ata_device *drive, byte mode_wanted)
+static void cmd640_tune_drive(struct ata_device *drive, u8 mode_wanted)
{
u8 b;
struct ata_timing *t;
diff -Nru a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
--- a/drivers/ide/cmd64x.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/cmd64x.c Fri Jul 26 19:58:51 2002
@@ -18,13 +18,13 @@
#include
#include
#include
-#include
#include
+#include
#include
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
#define CMD_DEBUG 0
@@ -81,8 +81,8 @@
* Registers and masks for easy access by drive index:
*/
#if 0
-static byte prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23};
-static byte prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2, ARTTIM23_DIS_RA3};
+static u8 prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23};
+static u8 prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2, ARTTIM23_DIS_RA3};
#endif
/*
@@ -93,15 +93,15 @@
{
unsigned long flags;
struct ata_device *drives = drive->channel->drives;
- byte temp_b;
- static const byte setup_counts[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
- static const byte recovery_counts[] =
+ u8 temp_b;
+ static const u8 setup_counts[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
+ static const u8 recovery_counts[] =
{15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0};
- static const byte arttim_regs[2][2] = {
+ static const u8 arttim_regs[2][2] = {
{ ARTTIM0, ARTTIM1 },
{ ARTTIM23, ARTTIM23 }
};
- static const byte drwtim_regs[2][2] = {
+ static const u8 drwtim_regs[2][2] = {
{ DRWTIM0, DRWTIM1 },
{ DRWTIM2, DRWTIM3 }
};
@@ -142,11 +142,11 @@
*/
(void) pci_read_config_byte(drive->channel->pci_dev, arttim_regs[channel][slave], &temp_b);
(void) pci_write_config_byte(drive->channel->pci_dev, arttim_regs[channel][slave],
- ((byte) setup_count) | (temp_b & 0x3f));
+ ((u8) setup_count) | (temp_b & 0x3f));
(void) pci_write_config_byte(drive->channel->pci_dev, drwtim_regs[channel][slave],
- (byte) ((active_count << 4) | recovery_count));
- cmdprintk ("Write %x to %x\n", ((byte) setup_count) | (temp_b & 0x3f), arttim_regs[channel][slave]);
- cmdprintk ("Write %x to %x\n", (byte) ((active_count << 4) | recovery_count), drwtim_regs[channel][slave]);
+ (u8) ((active_count << 4) | recovery_count));
+ cmdprintk ("Write %x to %x\n", ((u8) setup_count) | (temp_b & 0x3f), arttim_regs[channel][slave]);
+ cmdprintk ("Write %x to %x\n", (u8) ((active_count << 4) | recovery_count), drwtim_regs[channel][slave]);
local_irq_restore(flags);
}
@@ -405,7 +405,7 @@
return ide_config_drive_speed(drive, speed);
}
-static int cmd680_tune_chipset(struct ata_device *drive, byte speed)
+static int cmd680_tune_chipset(struct ata_device *drive, u8 speed)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
@@ -520,9 +520,9 @@
dma_stat = inb(dma_base+2); /* get DMA status */
outb(dma_stat|6, dma_base+2); /* clear the INTR & ERROR bits */
if (jack_slap) {
- byte dma_intr = 0;
- byte dma_mask = (ch->unit) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
- byte dma_reg = (ch->unit) ? ARTTIM2 : CFR;
+ u8 dma_intr = 0;
+ u8 dma_mask = (ch->unit) ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
+ u8 dma_reg = (ch->unit) ? ARTTIM2 : CFR;
(void) pci_read_config_byte(dev, dma_reg, &dma_intr);
/*
* DAMN BMIDE is not connected to PCI space!
diff -Nru a/drivers/ide/cs5530.c b/drivers/ide/cs5530.c
--- a/drivers/ide/cs5530.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/cs5530.c Fri Jul 26 19:58:51 2002
@@ -20,22 +20,22 @@
#include
#include
#include
-#include
#include
#include
#include
+#include
#include
#include
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
/*
* Set a new transfer mode at the drive
*/
-int cs5530_set_xfer_mode(struct ata_device *drive, byte mode)
+int cs5530_set_xfer_mode(struct ata_device *drive, u8 mode)
{
int error = 0;
@@ -67,7 +67,7 @@
* The ide_init_cs5530() routine guarantees that all drives
* will have valid default PIO timings set up before we get here.
*/
-static void cs5530_tuneproc(struct ata_device *drive, byte pio) /* pio=255 means "autotune" */
+static void cs5530_tuneproc(struct ata_device *drive, u8 pio)
{
struct ata_channel *hwif = drive->channel;
unsigned int format, basereg = CS5530_BASEREG(hwif);
@@ -75,7 +75,7 @@
if (pio == 255)
pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
else
- pio = XFER_PIO_0 + min_t(byte, pio, 4);
+ pio = XFER_PIO_0 + min_t(u8, pio, 4);
if (!cs5530_set_xfer_mode(drive, pio)) {
format = (inl(basereg+4) >> 31) & 1;
@@ -206,7 +206,7 @@
unsigned short pcicmd = 0;
unsigned long flags;
- pci_for_each_dev (dev) {
+ pci_for_each_dev(dev) {
if (dev->vendor == PCI_VENDOR_ID_CYRIX) {
switch (dev->device) {
case PCI_DEVICE_ID_CYRIX_PCI_MASTER:
@@ -256,7 +256,7 @@
*/
pci_write_config_byte(master_0, 0x40, 0x1e);
- /*
+ /*
* Set max PCI burst size (16-bytes seems to work best):
* 16bytes: set bit-1 at 0x41 (reg value of 0x16)
* all others: clear bit-1 at 0x41, and do:
diff -Nru a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c
--- a/drivers/ide/cy82c693.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/cy82c693.c Fri Jul 26 19:58:51 2002
@@ -47,11 +47,12 @@
#include
#include
#include
+#include
#include
#include
-#include "ata-timing.h"
+#include "timing.h"
#include "pcihost.h"
/* the current version */
@@ -141,7 +142,7 @@
* for mode 3 and 4 drives 8 and 16-bit timings are the same
*
*/
-/* FIXME: use generic ata-timings library --bkz */
+/* FIXME: use generic timings library --bkz */
static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
{
struct ata_timing *t;
@@ -186,8 +187,8 @@
*/
static void cy82c693_dma_enable(struct ata_device *drive, int mode, int single)
{
- byte index;
- byte data;
+ u8 index;
+ u8 data;
if (mode>2) /* make sure we set a valid mode */
mode = 2;
@@ -206,7 +207,7 @@
printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", drive->name, drive->channel->unit, drive->select.b.unit, (data&0x3), ((data>>2)&1));
#endif
- data = (byte)mode|(byte)(single<<2);
+ data = (u8) mode | (u8) (single << 2);
OUT_BYTE(index, CY82_INDEX_PORT);
OUT_BYTE(data, CY82_DATA_PORT);
@@ -271,7 +272,7 @@
/*
* tune ide drive - set PIO mode
*/
-static void cy82c693_tune_drive(struct ata_device *drive, byte pio)
+static void cy82c693_tune_drive(struct ata_device *drive, u8 pio)
{
struct ata_channel *hwif = drive->channel;
struct pci_dev *dev = hwif->pci_dev;
diff -Nru a/drivers/ide/dtc2278.c b/drivers/ide/dtc2278.c
--- a/drivers/ide/dtc2278.c Fri Jul 26 19:58:51 2002
+++ b/drivers/ide/dtc2278.c Fri Jul 26 19:58:51 2002
@@ -9,13 +9,13 @@
#include
#include
#include
+#include
#include
#include
-#include
#include
-#include "ata-timing.h"
+#include "timing.h"
/*
* Changing this #undef to #define may solve start up problems in some systems.
@@ -66,7 +66,7 @@
}
}
-static void tune_dtc2278(struct ata_device *drive, byte pio)
+static void tune_dtc2278(struct ata_device *drive, u8 pio)
{
unsigned long flags;
diff -Nru a/drivers/ide/hpt34x.c b/drivers/ide/hpt34x.c
--- a/drivers/ide/hpt34x.c Fri Jul 26 19:58:50 2002
+++ b/drivers/ide/hpt34x.c Fri Jul 26 19:58:50 2002
@@ -21,16 +21,16 @@
#include
#include
#include
-#include
#include
#include
#include
+#include