Commit 7d9f8b15 authored by James Bottomley's avatar James Bottomley

Merge mulgrave.(none):/home/jejb/BK/linux-2.5

into mulgrave.(none):/home/jejb/BK/scsi-for-linus-2.5
parents 4046ce17 43756209
......@@ -38,6 +38,8 @@ ARCH := $(SUBARCH)
KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
UTS_MACHINE := $(ARCH)
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
......@@ -106,11 +108,20 @@ endif
MAKEFLAGS += --no-print-directory
# For maximum performance (+ possibly random breakage, uncomment
# the following)
#MAKEFLAGS += -rR
# If the user wants quiet mode, echo short versions of the commands
# only
ifneq ($(KBUILD_VERBOSE),1)
ifeq ($(KBUILD_VERBOSE),1)
quiet =
Q =
else
quiet=quiet_
Q = @
endif
# If the user is running make -s (silent mode), suppress echoing of
......@@ -120,7 +131,7 @@ ifneq ($(findstring s,$(MAKEFLAGS)),)
quiet=silent_
endif
export quiet KBUILD_VERBOSE
export quiet Q KBUILD_VERBOSE
# Paths to obj / src tree
......@@ -142,7 +153,6 @@ NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
MAKEFILES = .config
GENKSYMS = /sbin/genksyms
DEPMOD = /sbin/depmod
KALLSYMS = /sbin/kallsyms
......@@ -161,7 +171,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE GENKSYMS PERL UTS_MACHINE
export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
......@@ -187,7 +197,7 @@ scripts/docproc scripts/fixdep scripts/split-include : scripts ;
.PHONY: scripts
scripts:
+@$(call descend,scripts,)
+@$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts
# Objects we will link into vmlinux / subdirs we need to visit
# ---------------------------------------------------------------------------
......@@ -306,7 +316,7 @@ define rule_vmlinux__
echo ' Generating build number'
. scripts/mkversion > .tmp_version
mv -f .tmp_version .version
+$(call descend,init,)
$(Q)$(MAKE) -f scripts/Makefile.build obj=init
)
$(call cmd,vmlinux__)
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
......@@ -365,7 +375,7 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
.PHONY: $(SUBDIRS)
$(SUBDIRS): .hdepend prepare
+@$(call descend,$@,)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$@
# Things we need done before we descend to build or make
# module versions are listed in "prepare"
......@@ -388,17 +398,17 @@ targets += arch/$(ARCH)/vmlinux.lds.s
# ---------------------------------------------------------------------------
%.s: %.c scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
%.i: %.c scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
%.o: %.c scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
%.lst: %.c scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
%.s: %.S scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
%.o: %.S scripts FORCE
+@$(call descend,$(@D),$@)
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
# FIXME: The asm symlink changes when $(ARCH) changes. That's
# hard to detect, but I suppose "make mrproper" is a good idea
......@@ -472,9 +482,11 @@ ifdef CONFIG_MODVERSIONS
# Update modversions.h, but only if it would change.
include/linux/modversions.h: FORCE
.PHONY: __rm_tmp_export-objs
__rm_tmp_export-objs:
@rm -rf .tmp_export-objs
@$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS))
include/linux/modversions.h: $(patsubst %,_modver_%,$(SUBDIRS))
@echo -n ' Generating $@'
@( echo "#ifndef _LINUX_MODVERSIONS_H";\
echo "#define _LINUX_MODVERSIONS_H"; \
......@@ -487,8 +499,9 @@ include/linux/modversions.h: FORCE
) > $@.tmp; \
$(update-if-changed)
$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE
+@$(call descend,$(patsubst _sfdep_%,%,$@),fastdep)
.PHONY: $(patsubst %, _modver_%, $(SUBDIRS))
$(patsubst %, _modver_%, $(SUBDIRS)): __rm_tmp_export-objs
$(Q)$(MAKE) -f scripts/Makefile.modver obj=$(patsubst _modver_%,%,$@)
else # !CONFIG_MODVERSIONS
......@@ -540,8 +553,7 @@ _modinst_post:
.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS)) :
+@$(call descend,$(patsubst _modinst_%,%,$@),modules_install)
$(Q)$(MAKE) -f scripts/Makefile.modinst obj=$(patsubst _modinst_%,%,$@)
else # CONFIG_MODULES
# Modules not configured
......@@ -638,11 +650,11 @@ ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
make_with_config
xconfig:
+@$(call descend,scripts,scripts/kconfig.tk)
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts scripts/kconfig.tk
wish -f scripts/kconfig.tk
menuconfig:
+@$(call descend,scripts,lxdialog)
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts lxdialog
$(CONFIG_SHELL) $(src)/scripts/Menuconfig arch/$(ARCH)/config.in
config:
......@@ -698,7 +710,7 @@ MRPROPER_DIRS += \
clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts
$(addprefix _clean_,$(clean-dirs)):
$(MAKE) MAKEFILES= -rR -f scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
......@@ -798,7 +810,7 @@ help:
# Documentation targets
# ---------------------------------------------------------------------------
sgmldocs psdocs pdfdocs htmldocs: scripts
+@$(call descend,Documentation/DocBook,$@)
$(Q)$(MAKE) -f Documentation/DocBook/Makefile $@
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
......@@ -833,12 +845,10 @@ endif # ifdef include-config
# FIXME Should go into a make.lib or something
# ===========================================================================
echo_target = $@
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(echo_target)
quiet_cmd_as_s_S = CPP $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
# read all saved command lines
......@@ -885,13 +895,9 @@ define update-if-changed
mv -f $@.tmp $@; \
fi
endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
ifeq ($(KBUILD_VERBOSE),1)
descend = echo '$(MAKE) -f $(1)/Makefile $(2)';
endif
descend += $(MAKE) -f $(1)/Makefile obj=$(1) $(2)
descend = $(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
FORCE:
ifndef no-rules.make
#
# This file contains rules which are shared between multiple Makefiles.
#
# Some standard vars
comma := ,
empty :=
space := $(empty) $(empty)
# Some bug traps
# ---------------------------------------------------------------------------
ifdef O_TARGET
$(error kbuild: $(obj)/Makefile - Usage of O_TARGET := $(O_TARGET) is obsolete in 2.5. Please fix!)
endif
ifdef L_TARGET
ifneq ($(L_TARGET),lib.a)
$(warning kbuild: $(obj)/Makefile - L_TARGET := $(L_TARGET) target shall be renamed to lib.a. Please fix!)
endif
endif
ifdef list-multi
$(warning kbuild: $(obj)/Makefile - list-multi := $(list-multi) is obsolete in 2.5. Please fix!)
endif
# Some paths for the Makefiles to use
# ---------------------------------------------------------------------------
# FIXME. For now, we leave it possible to use make -C or make -f
# to do work in subdirs.
ifndef obj
obj = .
CFLAGS := $(patsubst -I%,-I$(TOPDIR)/%,$(patsubst -I$(TOPDIR)/%,-I%,$(CFLAGS)))
AFLAGS := $(patsubst -I%,-I$(TOPDIR)/%,$(patsubst -I$(TOPDIR)/%,-I%,$(AFLAGS)))
endif
# For use in the quiet output
echo_target = $@
# Usage:
#
# $(obj)/target.o : target.o in the build dir
# $(src)/target.c : target.c in the source dir
# $(objtree)/include/linux/version.h : Some file relative to the build
# dir root
# $(srctree)/include/linux/module.h : Some file relative to the source
# dir root
#
# $(obj) and $(src) can only be used in the section after
# include $(TOPDIR)/Rules.make, i.e for generated files and the like.
# Intentionally.
#
# We don't support separate source / object yet, so these are just
# placeholders for now
src := $(obj)
# Figure out what we need to build from the various variables
# ===========================================================================
# When an object is listed to be built compiled-in and modular,
# only build the compiled-in version
obj-m := $(filter-out $(obj-y),$(obj-m))
# Handle objects in subdirs
# ---------------------------------------------------------------------------
# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o
# and add the directory to the list of dirs to descend into: $(subdir-y)
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
# and add the directory to the list of dirs to descend into: $(subdir-m)
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
subdir-m += $(__subdir-m)
__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n)))
subdir-n += $(__subdir-n)
__subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
subdir- += $(__subdir-)
obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
obj-m := $(filter-out %/, $(obj-m))
# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m))
subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# export.o is never a composite object, since $(export-objs) has a
# fixed meaning (== objects which EXPORT_SYMBOL())
__obj-y = $(filter-out export.o,$(obj-y))
__obj-m = $(filter-out export.o,$(obj-m))
# if $(foo-objs) exists, foo.o is a composite object
multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $($(m:.o=-objs)), $(m))))
multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(m:.o=-objs)), $(m))))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)))
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)))
# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live
# in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
# Only build module versions for files which are selected to be built
export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m))
host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m)))
host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs))
# Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
clean-files := $(addprefix $(obj)/,$(clean-files))
host-progs := $(addprefix $(obj)/,$(host-progs))
host-progs-single := $(addprefix $(obj)/,$(host-progs-single))
host-progs-multi := $(addprefix $(obj)/,$(host-progs-multi))
host-progs-multi-objs := $(addprefix $(obj)/,$(host-progs-multi-objs))
# The temporary file to save gcc -MD generated dependencies must not
# contain a comma
depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
# We're called for one of four purposes:
# o subdirclean: Delete intermidiate files in the current directory
# o fastdep: build module version files (.ver) for $(export-objs) in
# the current directory
# o modules_install: install the modules in the current directory
# o build: When no target is given, first_rule is the default and
# will build the built-in and modular objects in this dir
# (or a subset thereof, depending on $(KBUILD_MODULES),$(KBUILD_BUILTIN)
# When targets are given directly (like foo.o), we just build these
# targets (That happens when someone does make some/dir/foo.[ois])
ifeq ($(MAKECMDGOALS),subdirclean)
__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files))
subdirclean: $(subdir-ymn)
ifneq ($(strip $(__clean-files) $(clean-rule)),)
rm -f $(__clean-files)
$(clean-rule)
else
@:
endif
else
ifeq ($(MAKECMDGOALS),fastdep)
# ===========================================================================
# Module versions
# ===========================================================================
ifeq ($(strip $(export-objs)),)
# If we don't export any symbols in this dir, just descend
# ---------------------------------------------------------------------------
fastdep: $(subdir-ym)
@:
else
# This sets version suffixes on exported symbols
# ---------------------------------------------------------------------------
MODVERDIR := include/linux/modules
#
# Added the SMP separator to stop module accidents between uniprocessor
# and SMP Intel boxes - AC - from bits by Michael Chastain
#
ifdef CONFIG_SMP
genksyms_smp_prefix := -p smp_
else
genksyms_smp_prefix :=
endif
# Don't include modversions.h, we're just about to generate it here.
CFLAGS_MODULE := $(filter-out -include linux/modversions.h,$(CFLAGS_MODULE))
$(addprefix $(MODVERDIR)/,$(real-objs-y:.o=.ver)): modkern_cflags := $(CFLAGS_KERNEL)
$(addprefix $(MODVERDIR)/,$(real-objs-m:.o=.ver)): modkern_cflags := $(CFLAGS_MODULE)
$(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)): export_flags := -D__GENKSYMS__
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
# Our objects only depend on modversions.h, not on the individual .ver
# files (fix-dep filters them), so touch modversions.h if any of the .ver
# files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$*.ver
cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
# Okay, let's explain what's happening in rule_make_cc_ver_c:
# o echo the command
# o execute the command
# o If the $(CPP) fails, we won't notice because it's output is piped
# to $(GENKSYMS) which does not fail. We recognize this case by
# looking if the generated $(depfile) exists, though.
# o If the .ver file changed, touch modversions.h, which is our maker
# of any changed .ver files.
# o Move command line and deps into their normal .*.cmd place.
define rule_cc_ver_c
$(if $($(quiet)cmd_cc_ver_c),echo ' $($(quiet)cmd_cc_ver_c)';) \
$(cmd_cc_ver_c); \
if [ ! -r $(depfile) ]; then exit 1; fi; \
scripts/fixdep $(depfile) $@ '$(cmd_cc_ver_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch include/linux/modversions.h; \
fi; \
mv -f $@.tmp $@
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef
$(MODVERDIR)/%.ver: %.c FORCE
@$(call if_changed_rule,cc_ver_c)
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
fastdep: $(targets) $(subdir-ym)
@mkdir -p $(dir $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver)))
@touch $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver))
endif # export-objs
else # ! fastdep
ifeq ($(MAKECMDGOALS),modules_install)
# ==========================================================================
# Installing modules
# ==========================================================================
quiet_cmd_modules_install = INSTALL $(obj-m)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \
cp $(obj-m) $(MODLIB)/kernel/$(obj)
.PHONY: modules_install
modules_install: $(subdir-ym)
ifneq ($(obj-m),)
$(call cmd,modules_install)
else
@:
endif
else # ! modules_install
# ==========================================================================
# Building
# ==========================================================================
# If a Makefile does not define a L_TARGET, link an object called "built-in.o"
ifdef L_TARGET
L_TARGET := $(obj)/$(L_TARGET)
else
O_TARGET := $(obj)/built-in.o
endif
first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
$(if $(KBUILD_MODULES),$(obj-m)) \
$(subdir-ym)
@:
# Compile C sources (.c)
# ---------------------------------------------------------------------------
# Default is built-in, unless we know otherwise
modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE)
$(export-objs) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.i) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.lst): export_flags := $(EXPORT_FLAGS)
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
quiet_cmd_cc_s_c = CC $(echo_target)
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
%.s: %.c FORCE
$(call if_changed_dep,cc_s_c)
quiet_cmd_cc_i_c = CPP $(echo_target)
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE
$(call if_changed_dep,cc_i_c)
quiet_cmd_cc_o_c = CC $(echo_target)
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
%.o: %.c FORCE
$(call if_changed_dep,cc_o_c)
quiet_cmd_cc_lst_c = MKLST $(echo_target)
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && sh scripts/makelst $*.o System.map $(OBJDUMP) > $@
%.lst: %.c FORCE
$(call if_changed_dep,cc_lst_c)
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(echo_target)
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
%.s: %.S FORCE
$(call if_changed_dep,as_s_S)
quiet_cmd_as_o_S = AS $(echo_target)
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
%.o: %.S FORCE
$(call if_changed_dep,as_o_S)
targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS)
# Build the compiled-in targets
# ---------------------------------------------------------------------------
# To build objects in subdirs, we need to descend into the directories
$(sort $(subdir-obj-y)): $(subdir-ym) ;
#
# Rule to compile a set of .o files into one .o file
#
ifdef O_TARGET
quiet_cmd_link_o_target = LD $(echo_target)
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE
$(call if_changed,link_o_target)
targets += $(O_TARGET)
endif # O_TARGET
#
# Rule to compile a set of .o files into one .a file
#
ifdef L_TARGET
quiet_cmd_link_l_target = AR $(echo_target)
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) FORCE
$(call if_changed,link_l_target)
targets += $(L_TARGET)
endif
#
# Rule to link composite objects
#
quiet_cmd_link_multi = LD $(echo_target)
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs)))),$^)
# We would rather have a list of rules like
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,link_multi)
$(multi-used-m) : %.o: $(multi-objs-m) FORCE
$(call if_changed,link_multi)
targets += $(multi-used-y) $(multi-used-m)
# Compile programs on the host
# ===========================================================================
quiet_cmd_host_cc__c = HOSTCC $(echo_target)
cmd_host_cc__c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $<
$(host-progs-single): %: %.c FORCE
$(call if_changed_dep,host_cc__c)
quiet_cmd_host_cc_o_c = HOSTCC $(echo_target)
cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
$(host-progs-multi-objs): %.o: %.c FORCE
$(call if_changed_dep,host_cc_o_c)
quiet_cmd_host_cc__o = HOSTLD $(echo_target)
cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(subst $(obj)/,,$@)-objs)) \
$(HOST_LOADLIBES)
$(host-progs-multi): %: $(host-progs-multi-objs) FORCE
$(call if_changed,host_cc__o)
targets += $(host-progs-single) $(host-progs-multi-objs) $(host-progs-multi)
endif # ! subdirclean
endif # ! modules_install
endif # ! fastdep
# Shipped files
# ===========================================================================
quiet_cmd_shipped = SHIPPED $(echo_target)
cmd_shipped = cat $< > $@
%:: %_shipped
$(call cmd,shipped)
# Commands useful for building a boot image
# ===========================================================================
#
# Use as following:
#
# target: source(s) FORCE
# $(if_changed,ld/objcopy/gzip)
#
# and add target to EXTRA_TARGETS so that we know we have to
# read in the saved command line
# Linking
# ---------------------------------------------------------------------------
quiet_cmd_ld = LD $(echo_target)
cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \
$(filter-out FORCE,$^) -o $@
# Objcopy
# ---------------------------------------------------------------------------
quiet_cmd_objcopy = OBJCOPY $(echo_target)
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
# Gzip
# ---------------------------------------------------------------------------
quiet_cmd_gzip = GZIP $(echo_target)
cmd_gzip = gzip -f -9 < $< > $@
# ===========================================================================
# Generic stuff
# ===========================================================================
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ymn)
$(subdir-ymn):
+@$(call descend,$@,$(MAKECMDGOALS))
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
.PHONY: FORCE
FORCE:
#
# This sets version suffixes on exported symbols
# Separate the object into "normal" objects and "exporting" objects
# Exporting objects are: all objects that define symbol tables
#
# ---------------------------------------------------------------------------
# Check if command line has changed
# Usage:
# normally one uses rules like
#
# %.o: %.c
# <command line>
#
# However, these only rebuild the target when the source has changed,
# but not when e.g. the command or the flags on the command line changed.
#
# This extension allows to do the following:
#
# command = <command line>
#
# %.o: %.c dummy
# $(call if_changed,command)
#
# which will make sure to rebuild the target when either its prerequisites
# change or the command line changes
#
# The magic works as follows:
# The addition of dummy to the dependencies causes the rule for rebuilding
# to be always executed. However, the if_changed function will generate
# an empty command when
# o none of the prequesites changed (i.e $? is empty)
# o the command line did not change (we compare the old command line,
# which is saved in .<target>.o, to the current command line using
# the two filter-out commands)
# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)
endif
# function to only execute the passed command if necessary
if_changed = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
echo 'cmd_$@ := $(cmd_$(1))' > $(@D)/.$(@F).cmd)
# execute the command and also postprocess generated .d dependencies
# file
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
if_changed_rule = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
mkdir -p $(dir $@); \
$(rule_$(1)))
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# do_cmd is a shorthand used to support both compressed, verbose
# and silent output in a single line.
# Compared to cmd described avobe, do_cmd does no rely on any variables
# previously assigned a value.
#
# Usage $(call do_cmd,CMD $@,cmd_to_execute bla bla)
# Example:
# $(call do_cmd,CP $@,cp -b $< $@)
# make -s => nothing will be printed
# make KBUILD_VERBOSE=1 => cp -b path/to/src.file path/to/dest.file
# make KBUILD_VERBOSE=0 => CP path/to/dest.file
define do_cmd
@$(if $(filter quiet_,$(quiet)), echo ' $(1)' &&,
$(if $(filter silent_,$(quiet)),,
echo "$(2)" &&)) \
$(2)
endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
ifeq ($(KBUILD_VERBOSE),1)
descend = echo '$(MAKE) -f $(1)/Makefile $(2)';
endif
descend += $(MAKE) -f $(1)/Makefile obj=$(1) $(2)
endif
......@@ -88,6 +88,6 @@ install: vmlinux
+@$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install)
archclean:
$(MAKE) -rR -f scripts/Makefile.clean obj=arch/i386/boot
@$(MAKE) -f scripts/Makefile.clean obj=arch/i386/boot
archmrproper:
......@@ -46,7 +46,7 @@ $(obj)/bzImage: IMAGE_OFFSET := 0x100000
$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
$(obj)/bzImage: BUILDFLAGS := -b
quiet_cmd_image = BUILD $(echo_target)
quiet_cmd_image = BUILD $@
cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(ROOT_DEV) > $@
......
......@@ -46,7 +46,7 @@ $(obj)/bzImage: IMAGE_OFFSET := 0x100000
$(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
$(obj)/bzImage: BUILDFLAGS := -b
quiet_cmd_image = BUILD $(echo_target)
quiet_cmd_image = BUILD $@
cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
$(obj)/vmlinux.bin $(ROOT_DEV) > $@
......
......@@ -72,6 +72,11 @@ CONFIG_ACPI_PROCESSOR
ACPI C2 and C3 processor states to save power, on systems that
support it.
CONFIG_ACPI_PROCESSOR_PERF
This driver adds support for CPU frequency scaling, if this is supported
by the hardware and the BIOS. If you are compiling for a mobile system,
say Y.
CONFIG_ACPI_THERMAL
This driver adds support for ACPI thermal zones. Most mobile and
some desktop systems support ACPI thermal zones. It is HIGHLY
......
......@@ -21,6 +21,12 @@ if [ "$CONFIG_X86" = "y" ]; then
tristate ' Button' CONFIG_ACPI_BUTTON
tristate ' Fan' CONFIG_ACPI_FAN
tristate ' Processor' CONFIG_ACPI_PROCESSOR
if [ "$CONFIG_ACPI_PROCESSOR" != "n" ]; then
bool ' Processor Performance States' CONFIG_ACPI_PROCESSOR_PERF
if [ "$CONFIG_CPU_FREQ" != "y" ]; then
define_bool CONFIG_CPU_FREQ $CONFIG_ACPI_PROCESSOR_PERF
fi
fi
dep_tristate ' Thermal Zone' CONFIG_ACPI_THERMAL $CONFIG_ACPI_PROCESSOR
if [ "$CONFIG_NUMA" = "y" ]; then
dep_bool ' NUMA support' CONFIG_ACPI_NUMA $CONFIG_NUMA
......
......@@ -86,6 +86,7 @@ EXPORT_SYMBOL(acpi_get_register);
EXPORT_SYMBOL(acpi_set_register);
EXPORT_SYMBOL(acpi_enter_sleep_state);
EXPORT_SYMBOL(acpi_get_system_info);
EXPORT_SYMBOL(acpi_get_devices);
/* ACPI OS Services Layer (acpi_osl.c) */
......@@ -100,6 +101,8 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);
EXPORT_SYMBOL(acpi_os_delete_semaphore);
EXPORT_SYMBOL(acpi_os_wait_semaphore);
EXPORT_SYMBOL(acpi_os_read_pci_configuration);
/* ACPI Utilities (acpi_utils.c) */
EXPORT_SYMBOL(acpi_extract_package);
......@@ -126,3 +129,15 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
EXPORT_SYMBOL(acpi_bus_unregister_driver);
#endif /*CONFIG_ACPI_BUS*/
/* ACPI PCI Driver (pci_irq.c) */
#ifdef CONFIG_ACPI_PCI
#include <linux/pci.h>
extern int acpi_pci_irq_enable(struct pci_dev *dev);
EXPORT_SYMBOL(acpi_pci_irq_enable);
extern int acpi_pci_irq_lookup (int segment, int bus, int device, int pin);
EXPORT_SYMBOL(acpi_pci_irq_lookup);
#endif /*CONFIG_ACPI_PCI */
......@@ -78,9 +78,7 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata =
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
/* IBM 600E - _ADR should return 7, but it returns 1 */
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
{"VIA694", "AWRDACPI", 0, ACPI_DSDT, all_versions, "Bogus table", 1},
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
{"COMPAQ", "DSDT", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
{""}
};
......
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 68 $
* $Revision: 69 $
*
*****************************************************************************/
......@@ -103,7 +103,7 @@ acpi_ds_create_buffer_field (
* Enter the Name_string into the namespace
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
......@@ -343,7 +343,7 @@ acpi_ds_create_field (
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_REGION_FIELD;
info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
......@@ -384,17 +384,17 @@ acpi_ds_init_field_objects (
switch (walk_state->opcode) {
case AML_FIELD_OP:
arg = acpi_ps_get_arg (op, 2);
type = INTERNAL_TYPE_REGION_FIELD;
type = ACPI_TYPE_LOCAL_REGION_FIELD;
break;
case AML_BANK_FIELD_OP:
arg = acpi_ps_get_arg (op, 4);
type = INTERNAL_TYPE_BANK_FIELD;
type = ACPI_TYPE_LOCAL_BANK_FIELD;
break;
case AML_INDEX_FIELD_OP:
arg = acpi_ps_get_arg (op, 3);
type = INTERNAL_TYPE_INDEX_FIELD;
type = ACPI_TYPE_LOCAL_INDEX_FIELD;
break;
default:
......@@ -477,11 +477,11 @@ acpi_ds_create_bank_field (
}
}
/* Second arg is the Bank Register (must already exist) */
/* Second arg is the Bank Register (Field) (must already exist) */
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
......@@ -500,7 +500,7 @@ acpi_ds_create_bank_field (
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_BANK_FIELD;
info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
......@@ -552,7 +552,7 @@ acpi_ds_create_index_field (
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
......@@ -566,7 +566,7 @@ acpi_ds_create_index_field (
/* Each remaining arg is a Named Field */
info.field_type = INTERNAL_TYPE_INDEX_FIELD;
info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 63 $
* $Revision: 64 $
*
******************************************************************************/
......@@ -603,7 +603,7 @@ acpi_ds_store_object_to_local (
* If we have a valid reference object that came from Ref_of(), do the
* indirect store
*/
if ((current_obj_desc->common.type == INTERNAL_TYPE_REFERENCE) &&
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an Obj_ref(Node), storing in node %p\n",
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 108 $
* $Revision: 110 $
*
*****************************************************************************/
......@@ -707,7 +707,7 @@ acpi_ds_init_object_from_op (
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->common.value.string;
obj_desc->string.length = ACPI_STRLEN (op->common.value.string);
obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string);
/*
* The string is contained in the ACPI table, don't ever try
......@@ -721,7 +721,7 @@ acpi_ds_init_object_from_op (
break;
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
switch (op_info->type) {
case AML_TYPE_LOCAL_VARIABLE:
......
......@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 82 $
* $Revision: 83 $
*
*****************************************************************************/
......@@ -1021,7 +1021,7 @@ acpi_ds_exec_end_control_op (
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == INTERNAL_TYPE_REFERENCE) &&
(ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
if (ACPI_FAILURE (status)) {
......
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 95 $
* $Revision: 96 $
*
******************************************************************************/
......@@ -431,7 +431,7 @@ acpi_ds_create_operand (
/* Get the object type of the argument */
op_info = acpi_ps_get_opcode_info (opcode);
if (op_info->object_type == INTERNAL_TYPE_INVALID) {
if (op_info->object_type == ACPI_TYPE_INVALID) {
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 75 $
* $Revision: 78 $
*
*****************************************************************************/
......@@ -151,49 +151,27 @@ acpi_ds_load1_begin_op (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p [%s] ", walk_state, op, acpi_ut_get_type_name (object_type)));
/*
* Setup the search flags.
*
* Since we are entering a name into the namespace, we do not want to
* enable the search-to-root upsearch.
*
* There are only two conditions where it is acceptable that the name
* already exists:
* 1) the Scope() operator can reopen a scoping object that was
* previously defined (Scope, Method, Device, etc.)
* 2) Whenever we are parsing a deferred opcode (Op_region, Buffer,
* Buffer_field, or Package), the name of the object is already
* in the namespace.
*/
flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
flags |= ACPI_NS_ERROR_IF_FOUND;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n"));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n"));
}
switch (walk_state->opcode) {
case AML_SCOPE_OP:
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
* The target name of the Scope() operator must exist at this point so
* that we can actually open the scope to enter new names underneath it.
* Allow search-to-root for single namesegs.
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (path, status);
return (status);
}
/*
* For the scope op, we must check to make sure that the target is
* Check to make sure that the target is
* one of the opcodes that actually opens a scope
*/
if (walk_state->opcode == AML_SCOPE_OP) {
switch (node->type) {
case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
......@@ -232,8 +210,53 @@ acpi_ds_load1_begin_op (
return (AE_AML_OPERAND_TYPE);
}
break;
default:
/*
* For all other named opcodes, we will enter the name into the namespace.
*
* Setup the search flags.
* Since we are entering a name into the namespace, we do not want to
* enable the search-to-root upsearch.
*
* There are only two conditions where it is acceptable that the name
* already exists:
* 1) the Scope() operator can reopen a scoping object that was
* previously defined (Scope, Method, Device, etc.)
* 2) Whenever we are parsing a deferred opcode (Op_region, Buffer,
* Buffer_field, or Package), the name of the object is already
* in the namespace.
*/
flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
flags |= ACPI_NS_ERROR_IF_FOUND;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n"));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n"));
}
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (path, status);
return (status);
}
break;
}
/* Common exit */
if (!op) {
/* Create a new op */
......@@ -419,59 +442,43 @@ acpi_ds_load2_begin_op (
"State=%p Op=%p Type=%X\n", walk_state, op, object_type));
if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP ||
walk_state->opcode == AML_INDEX_FIELD_OP) {
switch (walk_state->opcode) {
case AML_FIELD_OP:
case AML_BANK_FIELD_OP:
case AML_INDEX_FIELD_OP:
node = NULL;
status = AE_OK;
}
else if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
break;
case AML_INT_NAMEPATH_OP:
/*
* The Name_path is an object reference to an existing object. Don't enter the
* name into the namespace, but look it up for use later
*/
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
}
else {
/* All other opcodes */
if (op && op->common.node) {
/* This op/node was previously entered into the namespace */
node = op->common.node;
if (acpi_ns_opens_scope (object_type)) {
status = acpi_ds_scope_stack_push (node, object_type, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
break;
}
return_ACPI_STATUS (AE_OK);
}
case AML_SCOPE_OP:
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
* The Path is an object reference to an existing object. Don't enter the
* name into the namespace, but look it up for use later
*/
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
}
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (buffer_ptr, status);
return_ACPI_STATUS (status);
}
/*
* For the scope op, we must check to make sure that the target is
* We must check to make sure that the target is
* one of the opcodes that actually opens a scope
*/
if (walk_state->opcode == AML_SCOPE_OP) {
switch (node->type) {
case ACPI_TYPE_ANY: /* Scope nodes are untyped (ANY) */
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
......@@ -508,8 +515,43 @@ acpi_ds_load2_begin_op (
return (AE_AML_OPERAND_TYPE);
}
break;
default:
/* All other opcodes */
if (op && op->common.node) {
/* This op/node was previously entered into the namespace */
node = op->common.node;
if (acpi_ns_opens_scope (object_type)) {
status = acpi_ds_scope_stack_push (node, object_type, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
}
return_ACPI_STATUS (AE_OK);
}
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
*/
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node));
break;
}
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (buffer_ptr, status);
return_ACPI_STATUS (status);
}
if (!op) {
/* Create a new op */
......
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 53 $
* $Revision: 56 $
*
*****************************************************************************/
......@@ -25,7 +25,6 @@
#include "acpi.h"
#include "acinterp.h"
#include "acdispat.h"
......@@ -88,6 +87,7 @@ acpi_ds_scope_stack_push (
acpi_walk_state *walk_state)
{
acpi_generic_state *scope_info;
acpi_generic_state *old_scope_info;
ACPI_FUNCTION_TRACE ("Ds_scope_stack_push");
......@@ -102,7 +102,7 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */
if (!acpi_ex_validate_object_type (type)) {
if (!acpi_ut_valid_object_type (type)) {
ACPI_REPORT_WARNING (("Ds_scope_stack_push: type code out of range\n"));
}
......@@ -120,6 +120,28 @@ acpi_ds_scope_stack_push (
scope_info->scope.node = node;
scope_info->common.value = (u16) type;
walk_state->scope_depth++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"[%.2d] Pushed scope ", (u32) walk_state->scope_depth));
old_scope_info = walk_state->scope_info;
if (old_scope_info) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[%4.4s] (%10s)",
old_scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (old_scope_info->common.value)));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (%10s)", "ROOT"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
", New scope -> [%4.4s] (%s)\n",
scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (scope_info->common.value)));
/* Push new scope object onto stack */
acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
......@@ -150,6 +172,7 @@ acpi_ds_scope_stack_pop (
acpi_walk_state *walk_state)
{
acpi_generic_state *scope_info;
acpi_generic_state *new_scope_info;
ACPI_FUNCTION_TRACE ("Ds_scope_stack_pop");
......@@ -163,8 +186,25 @@ acpi_ds_scope_stack_pop (
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
}
walk_state->scope_depth--;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value)));
"[%.2d] Popped scope [%4.4s] (%10s), New scope -> ",
(u32) walk_state->scope_depth,
scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (scope_info->common.value)));
new_scope_info = walk_state->scope_info;
if (new_scope_info) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[%4.4s] (%s)\n",
new_scope_info->scope.node->name.ascii,
acpi_ut_get_type_name (new_scope_info->common.value)));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (ROOT)\n"));
}
acpi_ut_delete_generic_state (scope_info);
......
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 68 $
* $Revision: 69 $
*
*****************************************************************************/
......@@ -174,7 +174,7 @@ acpi_ds_result_pop (
acpi_operand_object **object,
acpi_walk_state *walk_state)
{
u32 index;
NATIVE_UINT index;
acpi_generic_state *state;
......@@ -205,7 +205,7 @@ acpi_ds_result_pop (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
index -1, walk_state, state->results.num_results));
(u32) index -1, walk_state, state->results.num_results));
return (AE_OK);
}
......
......@@ -80,6 +80,7 @@ static struct acpi_driver acpi_ec_driver = {
struct acpi_ec {
acpi_handle handle;
unsigned long uid;
unsigned long gpe_bit;
acpi_generic_address status_addr;
acpi_generic_address command_addr;
......@@ -90,9 +91,6 @@ struct acpi_ec {
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
static struct acpi_ec *ec_ecdt;
/* compare this against UIDs in properly enumerated ECs to determine if we
have a dupe */
static unsigned long ecdt_uid = 0xFFFFFFFF;
/* --------------------------------------------------------------------------
Transaction Management
......@@ -297,35 +295,48 @@ struct acpi_ec_query_data {
u8 data;
};
static void
acpi_ec_gpe_query (
void *data)
void *ec_cxt)
{
struct acpi_ec_query_data *query_data = NULL;
struct acpi_ec *ec = (struct acpi_ec *) ec_cxt;
u32 value = 0;
unsigned long flags = 0;
static char object_name[5] = {'_','Q','0','0','\0'};
const char hex[] = {'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'};
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
if (!data)
return;
if (!ec_cxt)
goto end;
query_data = (struct acpi_ec_query_data *) data;
spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_read(8, &value, &ec->command_addr, 0);
spin_unlock_irqrestore(&ec->lock, flags);
object_name[2] = hex[((query_data->data >> 4) & 0x0F)];
object_name[3] = hex[(query_data->data & 0x0F)];
/* TBD: Implement asynch events!
* NOTE: All we care about are EC-SCI's. Other EC events are
* handled via polling (yuck!). This is because some systems
* treat EC-SCIs as level (versus EDGE!) triggered, preventing
* a purely interrupt-driven approach (grumble, grumble).
*/
if (!(value & ACPI_EC_FLAG_SCI))
goto end;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
if (acpi_ec_query(ec, &value))
goto end;
acpi_evaluate_object(query_data->handle, object_name, NULL, NULL);
object_name[2] = hex[((value >> 4) & 0x0F)];
object_name[3] = hex[(value & 0x0F)];
kfree(query_data);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
return;
}
acpi_evaluate_object(ec->handle, object_name, NULL, NULL);
end:
acpi_enable_event(ec->gpe_bit, ACPI_EVENT_GPE, 0);
}
static void
acpi_ec_gpe_handler (
......@@ -333,44 +344,16 @@ acpi_ec_gpe_handler (
{
acpi_status status = AE_OK;
struct acpi_ec *ec = (struct acpi_ec *) data;
u32 value = 0;
unsigned long flags = 0;
struct acpi_ec_query_data *query_data = NULL;
if (!ec)
return;
spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_read(8, &value, &ec->command_addr, 0);
spin_unlock_irqrestore(&ec->lock, flags);
/* TBD: Implement asynch events!
* NOTE: All we care about are EC-SCI's. Other EC events are
* handled via polling (yuck!). This is because some systems
* treat EC-SCIs as level (versus EDGE!) triggered, preventing
* a purely interrupt-driven approach (grumble, grumble).
*/
if (!(value & ACPI_EC_FLAG_SCI))
return;
if (acpi_ec_query(ec, &value))
return;
query_data = kmalloc(sizeof(struct acpi_ec_query_data), GFP_ATOMIC);
if (!query_data)
return;
query_data->handle = ec->handle;
query_data->data = value;
acpi_disable_event(ec->gpe_bit, ACPI_EVENT_GPE, 0);
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
acpi_ec_gpe_query, query_data);
if (ACPI_FAILURE(status))
kfree(query_data);
return;
acpi_ec_gpe_query, ec);
}
/* --------------------------------------------------------------------------
Address Space Management
-------------------------------------------------------------------------- */
......@@ -559,6 +542,7 @@ acpi_ec_add (
memset(ec, 0, sizeof(struct acpi_ec));
ec->handle = device->handle;
ec->uid = -1;
ec->lock = SPIN_LOCK_UNLOCKED;
sprintf(acpi_device_name(device), "%s", ACPI_EC_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_EC_CLASS);
......@@ -567,10 +551,10 @@ acpi_ec_add (
/* Use the global lock for all EC transactions? */
acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock);
/* If our UID matches ecdt_uid, we already found this EC via the
ECDT. Abort. */
/* If our UID matches the UID for the ECDT-enumerated EC,
we already found this EC, so abort. */
acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid);
if (ecdt_uid == uid) {
if (ec_ecdt && ec_ecdt->uid == uid) {
result = -ENODEV;
goto end;
}
......@@ -758,7 +742,12 @@ acpi_ec_ecdt_probe (void)
ec_ecdt->lock = SPIN_LOCK_UNLOCKED;
/* use the GL just to be safe */
ec_ecdt->global_lock = TRUE;
ecdt_uid = ecdt_ptr->uid;
ec_ecdt->uid = ecdt_ptr->uid;
status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
if (ACPI_FAILURE(status)) {
goto error;
}
/*
* Install GPE handler
......@@ -783,7 +772,9 @@ acpi_ec_ecdt_probe (void)
return 0;
error:
printk(KERN_ERR PREFIX "Could not use ECDT\n");
kfree(ec_ecdt);
ec_ecdt = NULL;
return -ENODEV;
}
......@@ -835,3 +826,4 @@ acpi_ec_exit (void)
return_VOID;
}
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 92 $
* $Revision: 95 $
*
*****************************************************************************/
......@@ -343,40 +343,58 @@ acpi_ev_gpe_initialize (void)
acpi_gbl_gpe_block_info[0].block_base_number = 0;
acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base;
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("Zero GPEs are defined in the FADT\n"));
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* Determine the maximum GPE number for this machine */
/*
* Determine the maximum GPE number for this machine.
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other
*/
if (acpi_gbl_gpe_block_info[0].register_count) {
/* GPE block 0 exists */
acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
}
if (acpi_gbl_gpe_block_info[1].register_count) {
/* Check for GPE0/GPE1 overlap */
/* GPE block 1 exists */
if (acpi_gbl_gpe_number_max >= acpi_gbl_FADT->gpe1_base) {
ACPI_REPORT_ERROR (("GPE0 block overlaps the GPE1 block\n"));
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((acpi_gbl_gpe_block_info[0].register_count) &&
(acpi_gbl_gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
ACPI_REPORT_ERROR ((
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d)\n",
acpi_gbl_gpe_number_max, acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->gpe1_base + (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1)));
return_ACPI_STATUS (AE_BAD_VALUE);
}
/* GPE0 and GPE1 do not have to be contiguous in the GPE number space */
acpi_gbl_gpe_number_max = acpi_gbl_FADT->gpe1_base + (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number space,
* But, GPE0 always starts at zero.
*/
acpi_gbl_gpe_number_max = acpi_gbl_FADT->gpe1_base +
(ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
}
/* Check for Max GPE number out-of-range */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", acpi_gbl_gpe_number_max));
ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
acpi_gbl_gpe_number_max));
return_ACPI_STATUS (AE_BAD_VALUE);
}
/*
* Allocate the GPE number-to-index translation table
*/
/* Allocate the GPE number-to-index translation table */
acpi_gbl_gpe_number_to_index = ACPI_MEM_CALLOCATE (
sizeof (ACPI_GPE_INDEX_INFO) *
((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
......@@ -391,9 +409,8 @@ acpi_ev_gpe_initialize (void)
ACPI_MEMSET (acpi_gbl_gpe_number_to_index, (int) ACPI_GPE_INVALID,
sizeof (ACPI_GPE_INDEX_INFO) * ((ACPI_SIZE) acpi_gbl_gpe_number_max + 1));
/*
* Allocate the GPE register information block
*/
/* Allocate the GPE register information block */
acpi_gbl_gpe_register_info = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) acpi_gbl_gpe_register_count *
sizeof (ACPI_GPE_REGISTER_INFO));
......@@ -465,7 +482,6 @@ acpi_ev_gpe_initialize (void)
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
status = acpi_hw_low_level_write (8, 0x00, &gpe_register_info->enable_address, 0);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -479,17 +495,19 @@ acpi_ev_gpe_initialize (void)
gpe_register++;
}
if (i) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
(s32) gpe_block, acpi_gbl_gpe_block_info[0].register_count,
ACPI_HIDWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address)),
ACPI_LODWORD (ACPI_GET_ADDRESS (acpi_gbl_gpe_block_info[gpe_block].block_address->address))));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d Range GPE #%2.2X to GPE #%2.2X\n",
ACPI_REPORT_INFO (("GPE Block%d defined as GPE%d to GPE%d\n",
(s32) gpe_block,
acpi_gbl_gpe_block_info[gpe_block].block_base_number,
acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * 8) -1)));
}
}
return_ACPI_STATUS (AE_OK);
......@@ -794,7 +812,7 @@ acpi_ev_asynch_execute_gpe_method (
*/
status = acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("%s while evaluated GPE%X method\n",
ACPI_REPORT_ERROR (("%s while evaluating GPE%X method\n",
acpi_format_exception (status), gpe_number));
}
}
......@@ -846,7 +864,7 @@ acpi_ev_gpe_dispatch (
gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
if (gpe_number_index == ACPI_GPE_INVALID) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid event, GPE[%X].\n", gpe_number));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GPE[%X] is not a valid event\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
......
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 130 $
* $Revision: 131 $
*
*****************************************************************************/
......@@ -294,7 +294,7 @@ acpi_install_notify_handler (
/* Install the handler */
notify_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_NOTIFY);
notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY);
if (!notify_obj) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
......
......@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
* $Revision: 50 $
* $Revision: 51 $
*
*****************************************************************************/
......@@ -220,7 +220,7 @@ acpi_install_address_space_handler (
* So, we just allocate the object for the handler and link it
* into the list.
*/
handler_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_ADDRESS_HANDLER);
handler_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!handler_obj) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
......
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 67 $
* $Revision: 69 $
*
*****************************************************************************/
......@@ -67,7 +67,7 @@ acpi_ex_add_table (
/* Create an object to be the table handle */
obj_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -77,7 +77,6 @@ acpi_ex_add_table (
table_info.pointer = table;
table_info.length = (ACPI_SIZE) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED;
table_info.base_pointer = table;
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
......@@ -316,9 +315,9 @@ acpi_ex_load_op (
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc)));
......@@ -417,7 +416,7 @@ acpi_ex_unload_table (
*/
if ((!ddb_handle) ||
(ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE (ddb_handle) != INTERNAL_TYPE_REFERENCE)) {
(ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
......
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 39 $
* $Revision: 41 $
*
*****************************************************************************/
......@@ -510,7 +510,7 @@ acpi_ex_convert_to_string (
new_buf [index-1] = 0;
ret_desc->buffer.pointer = new_buf;
ret_desc->string.length = ACPI_STRLEN ((char *) new_buf);
ret_desc->string.length = (u32) ACPI_STRLEN ((char *) new_buf);
/* Return the new buffer descriptor */
......@@ -587,7 +587,7 @@ acpi_ex_convert_to_target_type (
case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
switch (destination_type) {
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
/*
* Named field can always handle conversions
*/
......@@ -612,8 +612,8 @@ acpi_ex_convert_to_target_type (
switch (destination_type) {
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
......
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 94 $
* $Revision: 97 $
*
*****************************************************************************/
......@@ -55,7 +55,7 @@ acpi_ex_create_alias (
{
acpi_namespace_node *target_node;
acpi_namespace_node *alias_node;
acpi_status status;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Ex_create_alias");
......@@ -66,7 +66,7 @@ acpi_ex_create_alias (
alias_node = (acpi_namespace_node *) walk_state->operands[0];
target_node = (acpi_namespace_node *) walk_state->operands[1];
if (target_node->type == INTERNAL_TYPE_ALIAS) {
if (target_node->type == ACPI_TYPE_LOCAL_ALIAS) {
/*
* Dereference an existing alias so that we don't create a chain
* of aliases. With this code, we guarantee that an alias is
......@@ -95,8 +95,8 @@ acpi_ex_create_alias (
* NS node, not the object itself. This is because for these
* types, the object can change dynamically via a Store.
*/
alias_node->type = INTERNAL_TYPE_ALIAS;
alias_node->object = (acpi_operand_object *) target_node;
alias_node->type = ACPI_TYPE_LOCAL_ALIAS;
alias_node->object = ACPI_CAST_PTR (acpi_operand_object, target_node);
break;
default:
......@@ -117,7 +117,7 @@ acpi_ex_create_alias (
/* Since both operands are Nodes, we don't need to delete them */
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS (status);
}
......@@ -221,8 +221,9 @@ acpi_ex_create_mutex (
/* Init object and attach to NS node */
obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
obj_desc->mutex.node = (acpi_namespace_node *) walk_state->operands[0];
status = acpi_ns_attach_object ((acpi_namespace_node *) walk_state->operands[0],
status = acpi_ns_attach_object (obj_desc->mutex.node,
obj_desc, ACPI_TYPE_MUTEX);
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 160 $
* $Revision: 162 $
*
*****************************************************************************/
......@@ -58,7 +58,6 @@ acpi_ex_dump_operand (
{
u8 *buf = NULL;
u32 length;
u32 i;
acpi_operand_object **element;
u16 element_index;
......@@ -97,7 +96,7 @@ acpi_ex_dump_operand (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
switch (obj_desc->reference.opcode) {
case AML_DEBUG_OP:
......@@ -217,22 +216,6 @@ acpi_ex_dump_operand (
break;
case INTERNAL_TYPE_IF:
acpi_os_printf ("If [Integer] %8.8X%8.8X\n",
ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
case INTERNAL_TYPE_WHILE:
acpi_os_printf ("While [Integer] %8.8X%8.8X\n",
ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
case ACPI_TYPE_PACKAGE:
acpi_os_printf ("Package count %X @ %p\n",
......@@ -279,24 +262,20 @@ acpi_ex_dump_operand (
case ACPI_TYPE_STRING:
acpi_os_printf ("String length %X @ %p \"",
acpi_os_printf ("String length %X @ %p ",
obj_desc->string.length, obj_desc->string.pointer);
for (i = 0; i < obj_desc->string.length; i++) {
acpi_os_printf ("%c",
obj_desc->string.pointer[i]);
}
acpi_os_printf ("\"\n");
acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf ("\n");
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf ("Bank_field\n");
break;
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf (
"Region_field: Bits=%X Acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
......@@ -308,7 +287,7 @@ acpi_ex_dump_operand (
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf ("Index_field\n");
break;
......@@ -321,16 +300,13 @@ acpi_ex_dump_operand (
obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj)
{
if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
}
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER)
{
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) {
acpi_os_printf ("*not a Buffer* \n");
}
else
{
else {
ACPI_DUMP_STACK_ENTRY (obj_desc->buffer_field.buffer_obj);
}
......@@ -423,13 +399,11 @@ acpi_ex_dump_operands (
ACPI_FUNCTION_NAME ("Ex_dump_operands");
if (!ident)
{
if (!ident) {
ident = "?";
}
if (!note)
{
if (!note) {
note = "?";
}
......@@ -437,15 +411,13 @@ acpi_ex_dump_operands (
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
ident, num_levels));
if (num_levels == 0)
{
if (num_levels == 0) {
num_levels = 1;
}
/* Dump the operand stack starting at the top */
for (i = 0; num_levels > 0; i--, num_levels--)
{
for (i = 0; num_levels > 0; i--, num_levels--) {
obj_desc = &operands[i];
acpi_ex_dump_operand (*obj_desc);
}
......@@ -529,10 +501,8 @@ acpi_ex_dump_node (
ACPI_FUNCTION_ENTRY ();
if (!flags)
{
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
{
if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return;
}
}
......@@ -571,24 +541,20 @@ acpi_ex_dump_object_descriptor (
ACPI_FUNCTION_TRACE ("Ex_dump_object_descriptor");
if (!flags)
{
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer)))
{
if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return_VOID;
}
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED)
{
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
acpi_ex_dump_node ((acpi_namespace_node *) obj_desc, flags);
acpi_os_printf ("\nAttached Object (%p):\n", ((acpi_namespace_node *) obj_desc)->object);
acpi_ex_dump_object_descriptor (((acpi_namespace_node *) obj_desc)->object, flags);
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND)
{
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_VOID;
}
......@@ -601,8 +567,7 @@ acpi_ex_dump_object_descriptor (
/* Object-specific Fields */
switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_INTEGER:
acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value",
......@@ -614,7 +579,10 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_STRING:
acpi_ex_out_integer ("Length", obj_desc->string.length);
acpi_ex_out_pointer ("Pointer", obj_desc->string.pointer);
acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer);
acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf ("\n");
break;
......@@ -633,14 +601,11 @@ acpi_ex_dump_object_descriptor (
/* Dump the package contents */
if (obj_desc->package.count > 0)
{
if (obj_desc->package.count > 0) {
acpi_os_printf ("\nPackage Contents:\n");
for (i = 0; i < obj_desc->package.count; i++)
{
for (i = 0; i < obj_desc->package.count; i++) {
acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
if (obj_desc->package.elements[i])
{
if (obj_desc->package.elements[i]) {
acpi_os_printf (" %s", acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
}
acpi_os_printf ("\n");
......@@ -723,9 +688,9 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_ex_out_integer ("Field_flags", obj_desc->common_field.field_flags);
acpi_ex_out_integer ("Access_byte_width", obj_desc->common_field.access_byte_width);
......@@ -737,23 +702,22 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("End_buf_valid_bits", obj_desc->common_field.end_buffer_valid_bits);
acpi_ex_out_pointer ("Parent_node", obj_desc->common_field.node);
switch (ACPI_GET_OBJECT_TYPE (obj_desc))
{
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD:
acpi_ex_out_pointer ("Buffer_obj", obj_desc->buffer_field.buffer_obj);
break;
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_ex_out_pointer ("Region_obj", obj_desc->field.region_obj);
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_ex_out_integer ("Value", obj_desc->bank_field.value);
acpi_ex_out_pointer ("Region_obj", obj_desc->bank_field.region_obj);
acpi_ex_out_pointer ("Bank_obj", obj_desc->bank_field.bank_obj);
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_ex_out_integer ("Value", obj_desc->index_field.value);
acpi_ex_out_pointer ("Index", obj_desc->index_field.index_obj);
acpi_ex_out_pointer ("Data", obj_desc->index_field.data_obj);
......@@ -766,7 +730,7 @@ acpi_ex_dump_object_descriptor (
break;
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_ex_out_integer ("Target_type", obj_desc->reference.target_type);
acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name);
......@@ -777,7 +741,7 @@ acpi_ex_dump_object_descriptor (
break;
case INTERNAL_TYPE_ADDRESS_HANDLER:
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
acpi_ex_out_integer ("Space_id", obj_desc->addr_handler.space_id);
acpi_ex_out_pointer ("Next", obj_desc->addr_handler.next);
......@@ -787,24 +751,16 @@ acpi_ex_dump_object_descriptor (
break;
case INTERNAL_TYPE_NOTIFY:
case ACPI_TYPE_LOCAL_NOTIFY:
acpi_ex_out_pointer ("Node", obj_desc->notify_handler.node);
acpi_ex_out_pointer ("Context", obj_desc->notify_handler.context);
break;
case INTERNAL_TYPE_ALIAS:
case INTERNAL_TYPE_FIELD_DEFN:
case INTERNAL_TYPE_BANK_FIELD_DEFN:
case INTERNAL_TYPE_INDEX_FIELD_DEFN:
case INTERNAL_TYPE_IF:
case INTERNAL_TYPE_ELSE:
case INTERNAL_TYPE_WHILE:
case INTERNAL_TYPE_SCOPE:
case INTERNAL_TYPE_DEF_ANY:
case INTERNAL_TYPE_EXTRA:
case INTERNAL_TYPE_DATA:
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_EXTRA:
case ACPI_TYPE_LOCAL_DATA:
default:
acpi_os_printf ("Ex_dump_object_descriptor: Display not implemented for object type %s\n",
......
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 88 $
* $Revision: 89 $
*
*****************************************************************************/
......@@ -338,7 +338,7 @@ acpi_ex_field_datum_io (
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
/* Ensure that the Bank_value is not beyond the capacity of the register */
......@@ -366,7 +366,7 @@ acpi_ex_field_datum_io (
/*lint -fallthrough */
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
/*
* For simple Region_fields, we just directly access the owning
* Operation Region.
......@@ -381,7 +381,7 @@ acpi_ex_field_datum_io (
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Ensure that the Index_value is not beyond the capacity of the register */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 109 $
* $Revision: 110 $
*
*****************************************************************************/
......@@ -67,7 +67,7 @@ acpi_ex_get_object_reference (
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_OPERAND:
if (ACPI_GET_OBJECT_TYPE (obj_desc) != INTERNAL_TYPE_REFERENCE) {
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
......@@ -111,7 +111,7 @@ acpi_ex_get_object_reference (
/* Create a new reference object */
reference_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
if (!reference_obj) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 13 $
* $Revision: 16 $
*
*****************************************************************************/
......@@ -132,22 +132,35 @@ acpi_ex_acquire_mutex (
ACPI_FUNCTION_TRACE_PTR ("Ex_acquire_mutex", obj_desc);
if (!obj_desc) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Sanity check -- we must have a valid thread ID */
if (!walk_state->thread) {
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
obj_desc->mutex.node->name.ascii));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* Current Sync must be less than or equal to the sync level of the
* mutex. This mechanism provides some deadlock prevention
*/
if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect Sync_level\n",
obj_desc->mutex.node->name.ascii));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
/*
* Support for multiple acquires by the owning thread
*/
if (obj_desc->mutex.owner_thread == walk_state->thread) {
if ((obj_desc->mutex.owner_thread) &&
(obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id)) {
/*
* The mutex is already owned by this thread,
* just increment the acquisition depth
......@@ -210,12 +223,27 @@ acpi_ex_release_mutex (
/* The mutex must have been previously acquired in order to release it */
if (!obj_desc->mutex.owner_thread) {
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
obj_desc->mutex.node->name.ascii));
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
/* Sanity check -- we must have a valid thread ID */
if (!walk_state->thread) {
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
obj_desc->mutex.node->name.ascii));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/* The Mutex is owned, but this thread must be the owner */
if (obj_desc->mutex.owner_thread != walk_state->thread) {
if (obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) {
ACPI_REPORT_ERROR ((
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
walk_state->thread->thread_id,
obj_desc->mutex.node->name.ascii,
obj_desc->mutex.owner_thread->thread_id));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
......@@ -224,6 +252,8 @@ acpi_ex_release_mutex (
* equal to the current sync level
*/
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect Sync_level\n",
obj_desc->mutex.node->name.ascii));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 91 $
* $Revision: 92 $
*
*****************************************************************************/
......@@ -247,9 +247,9 @@ acpi_ex_get_name_string (
ACPI_FUNCTION_TRACE_PTR ("Ex_get_name_string", aml_address);
if (INTERNAL_TYPE_REGION_FIELD == data_type ||
INTERNAL_TYPE_BANK_FIELD == data_type ||
INTERNAL_TYPE_INDEX_FIELD == data_type) {
if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
/* Disallow prefixes for types associated with Field_unit names */
name_string = acpi_ex_allocate_name_string (0, 1);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 143 $
* $Revision: 144 $
*
*****************************************************************************/
......@@ -642,7 +642,7 @@ acpi_ex_opcode_1A_0T_1R (
if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {
switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* This is a Deref_of (Local_x | Arg_x)
*
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 111 $
* $Revision: 113 $
*
*****************************************************************************/
......@@ -379,7 +379,7 @@ acpi_ex_opcode_2A_1T_1R (
/* Set the string length */
return_desc->string.length = length;
return_desc->string.length = (u32) length;
break;
......@@ -393,7 +393,7 @@ acpi_ex_opcode_2A_1T_1R (
/* Create the internal return object */
return_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 119 $
* $Revision: 120 $
*
*****************************************************************************/
......@@ -313,7 +313,7 @@ acpi_ex_prep_field_value (
/* Parameter validation */
if (info->field_type != INTERNAL_TYPE_INDEX_FIELD) {
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
if (!info->region_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Region_node\n"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
......@@ -349,7 +349,7 @@ acpi_ex_prep_field_value (
/* Initialize areas of the object that are specific to the field type */
switch (info->field_type) {
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
......@@ -364,7 +364,7 @@ acpi_ex_prep_field_value (
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
obj_desc->bank_field.value = info->bank_value;
obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node);
......@@ -385,7 +385,7 @@ acpi_ex_prep_field_value (
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node);
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 59 $
* $Revision: 60 $
*
*****************************************************************************/
......@@ -88,7 +88,7 @@ acpi_ex_resolve_node_to_value (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type));
if (entry_type == INTERNAL_TYPE_ALIAS) {
if (entry_type == ACPI_TYPE_LOCAL_ALIAS) {
/* There is always exactly one level of indirection */
node = (acpi_namespace_node *) node->object;
......@@ -185,9 +185,9 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Node=%p Source_desc=%p Type=%X\n",
node, source_desc, entry_type));
......@@ -223,7 +223,7 @@ acpi_ex_resolve_node_to_value (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
/* No named references are allowed here */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 116 $
* $Revision: 117 $
*
*****************************************************************************/
......@@ -132,7 +132,7 @@ acpi_ex_resolve_object_to_value (
/* This is an acpi_operand_object */
switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
opcode = stack_desc->reference.opcode;
......@@ -262,9 +262,9 @@ acpi_ex_resolve_object_to_value (
* These cases may never happen here, but just in case..
*/
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Field_read Source_desc=%p Type=%X\n",
stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
......@@ -309,7 +309,7 @@ acpi_ex_resolve_multiple (
acpi_object_type type;
ACPI_FUNCTION_TRACE ("Ex_get_object_type");
ACPI_FUNCTION_TRACE ("Acpi_ex_resolve_multiple");
/*
......@@ -318,7 +318,7 @@ acpi_ex_resolve_multiple (
* of the Object_type and Size_of operators). This means traversing
* the list of possibly many nested references.
*/
while (ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_REFERENCE) {
while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
switch (obj_desc->reference.opcode) {
case AML_REF_OF_OP:
......@@ -427,13 +427,20 @@ acpi_ex_resolve_multiple (
/* Convert internal types to external types */
switch (type) {
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
type = ACPI_TYPE_FIELD_UNIT;
break;
case ACPI_TYPE_LOCAL_SCOPE:
/* Per ACPI Specification, Scope is untyped */
type = ACPI_TYPE_ANY;
break;
default:
/* No change to Type required */
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 58 $
* $Revision: 59 $
*
*****************************************************************************/
......@@ -64,7 +64,7 @@ acpi_ex_check_object_type (
return (AE_OK);
}
if (type_needed == INTERNAL_TYPE_REFERENCE) {
if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
/*
* Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
* objects and thus allow them to be targets. (As per the ACPI
......@@ -183,14 +183,14 @@ acpi_ex_resolve_operands (
/* Check for bad acpi_object_type */
if (!acpi_ex_validate_object_type (object_type)) {
if (!acpi_ut_valid_object_type (object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
object_type));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (object_type == (u8) INTERNAL_TYPE_REFERENCE) {
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
/*
* Decode the Reference
*/
......@@ -267,13 +267,13 @@ acpi_ex_resolve_operands (
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/* Need an operand of type INTERNAL_TYPE_REFERENCE */
/* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ {
goto next_operand;
}
status = acpi_ex_check_object_type (INTERNAL_TYPE_REFERENCE,
status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE,
object_type, obj_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
......@@ -300,7 +300,7 @@ acpi_ex_resolve_operands (
* -- All others must be resolved below.
*/
if ((opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE (*stack_ptr) == INTERNAL_TYPE_REFERENCE) &&
(ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) &&
((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
goto next_operand;
}
......@@ -353,13 +353,6 @@ acpi_ex_resolve_operands (
type_needed = ACPI_TYPE_REGION;
break;
case ARGI_IF: /* If */
/* Need an operand of type INTERNAL_TYPE_IF */
type_needed = INTERNAL_TYPE_IF;
break;
case ARGI_PACKAGE: /* Package */
/* Need an operand of type ACPI_TYPE_PACKAGE */
......@@ -502,7 +495,7 @@ acpi_ex_resolve_operands (
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
/* Valid operand */
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 172 $
* $Revision: 173 $
*
*****************************************************************************/
......@@ -92,7 +92,7 @@ acpi_ex_store (
/* Destination object must be a Reference or a Constant object */
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
break;
case ACPI_TYPE_INTEGER:
......@@ -428,9 +428,9 @@ acpi_ex_store_object_to_node (
*/
switch (target_type) {
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* For fields, copy the source data to the target field.
......
......@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 51 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -67,9 +67,9 @@ acpi_ex_resolve_object (
*/
switch (target_type) {
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* These cases all require only Integers or values that
* can be converted to Integers (Strings or Buffers)
......@@ -84,7 +84,7 @@ acpi_ex_resolve_object (
* are all essentially the same. This case handles the
* "interchangeable" types Integer, String, and Buffer.
*/
if (ACPI_GET_OBJECT_TYPE (source_desc) == INTERNAL_TYPE_REFERENCE) {
if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
/* Resolve a reference object first */
status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
......@@ -111,7 +111,7 @@ acpi_ex_resolve_object (
break;
case INTERNAL_TYPE_ALIAS:
case ACPI_TYPE_LOCAL_ALIAS:
/*
* Aliases are resolved by Acpi_ex_prep_operands
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 45 $
* $Revision: 46 $
*
*****************************************************************************/
......@@ -144,7 +144,7 @@ acpi_ex_store_string_to_string (
* String will fit in existing buffer.
* Clear old string and copy in the new one
*/
ACPI_MEMSET (target_desc->string.pointer, 0, target_desc->string.length + 1);
ACPI_MEMSET (target_desc->string.pointer, 0, (ACPI_SIZE) target_desc->string.length + 1);
ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
}
else {
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 103 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -50,32 +50,6 @@
ACPI_MODULE_NAME ("exutils")
/*******************************************************************************
*
* 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
/*******************************************************************************
......@@ -336,7 +310,7 @@ acpi_ex_eisa_id_to_string (
eisa_id = acpi_ut_dword_byte_swap (numeric_id);
out_string[0] = (char) ('@' + ((eisa_id >> 26) & 0x1f));
out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f));
out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f));
out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f));
out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
* $Revision: 46 $
* $Revision: 47 $
*
*****************************************************************************/
......@@ -309,6 +309,11 @@ acpi_enter_sleep_state (
} while (!in_value);
status = acpi_set_register (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
return_ACPI_STATUS (AE_OK);
}
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 112 $
* $Revision: 114 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021002
#define ACPI_CA_VERSION 0x20021022
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
* $Revision: 3 $
* $Revision: 4 $
*
*****************************************************************************/
......@@ -107,10 +107,6 @@ u32
acpi_dm_dump_name (
char *name);
void
acpi_dm_string (
char *string);
void
acpi_dm_unicode (
acpi_parse_object *op);
......
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 131 $
* $Revision: 132 $
*
*****************************************************************************/
......@@ -152,7 +152,7 @@ extern const NATIVE_CHAR *acpi_gbl_region_types[ACPI_NUM_PREDEFINE
*
****************************************************************************/
#define NUM_NS_TYPES INTERNAL_TYPE_INVALID+1
#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
#define NUM_PREDEFINED_NAMES 10
......@@ -279,8 +279,8 @@ ACPI_EXTERN acpi_namespace_node *acpi_gbl_db_scope_node;
/*
* Statistic globals
*/
ACPI_EXTERN u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
ACPI_EXTERN u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1];
ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1];
ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
ACPI_EXTERN u32 acpi_gbl_num_nodes;
......
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 139 $
* $Revision: 140 $
*
*****************************************************************************/
......@@ -612,10 +612,6 @@ void
acpi_ex_truncate_for32bit_table (
acpi_operand_object *obj_desc);
u8
acpi_ex_validate_object_type (
acpi_object_type type);
u8
acpi_ex_acquire_global_lock (
u32 rule);
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 176 $
* $Revision: 178 $
*
*****************************************************************************/
......@@ -212,7 +212,6 @@ typedef struct acpi_table_desc
struct acpi_table_desc *next;
struct acpi_table_desc *installed_desc;
acpi_table_header *pointer;
void *base_pointer;
u8 *aml_start;
u64 physical_address;
u32 aml_length;
......@@ -655,6 +654,7 @@ typedef struct acpi_parseobj_asl
char *filename;
char *external_name;
char *namepath;
char name_seg[4];
u32 extra_value;
u32 column;
u32 line_number;
......
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
* $Revision: 127 $
* $Revision: 129 $
*
*****************************************************************************/
......@@ -178,6 +178,10 @@ void
acpi_ns_delete_children (
acpi_namespace_node *parent);
int
acpi_ns_compare_names (
char *name1,
char *name2);
/*
* Namespace modification - nsmodify
......@@ -281,17 +285,13 @@ acpi_ns_get_object_value (
/*
* Parent/Child/Peer utility functions - nsfamily
* Parent/Child/Peer utility functions
*/
acpi_name
acpi_ns_find_parent_name (
acpi_namespace_node *node_to_search);
u8
acpi_ns_exist_downstream_sibling (
acpi_namespace_node *this_node);
/*
* Name and Scope manipulation - nsnames
......@@ -397,8 +397,8 @@ acpi_ns_search_node (
void
acpi_ns_install_node (
acpi_walk_state *walk_state,
acpi_namespace_node *parent_node, /* Parent */
acpi_namespace_node *node, /* New Child*/
acpi_namespace_node *parent_node,
acpi_namespace_node *node,
acpi_object_type type);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of acpi_operand_object (Internal object only)
* $Revision: 113 $
* $Revision: 114 $
*
*****************************************************************************/
......@@ -199,6 +199,7 @@ typedef struct acpi_object_mutex
void *semaphore;
union acpi_operand_obj *prev; /* Link for list of acquired mutexes */
union acpi_operand_obj *next; /* Link for list of acquired mutexes */
acpi_namespace_node *node; /* containing object */
} ACPI_OBJECT_MUTEX;
......
/******************************************************************************
*
* Name: acstruct.h - Internal structs
* $Revision: 19 $
* $Revision: 20 $
*
*****************************************************************************/
......@@ -59,6 +59,8 @@ typedef struct acpi_walk_state
u8 return_used;
u8 walk_type;
u16 opcode; /* Current AML opcode */
u8 scope_depth;
u8 reserved1;
u32 arg_count; /* push for fixed or var args */
u32 aml_offset;
u32 arg_types;
......
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 239 $
* $Revision: 240 $
*
*****************************************************************************/
......@@ -42,7 +42,7 @@
/*
* Data types - Fixed across all compilation models
* Data types - Fixed across all compilation models (16/32/64)
*
* BOOLEAN Logical Boolean.
* INT8 8-bit (1 byte) signed value
......@@ -91,6 +91,7 @@ typedef UINT64 ACPI_SIZE;
#elif ACPI_MACHINE_WIDTH == 16
/*
* 16-bit type definitions
*/
......@@ -133,6 +134,7 @@ typedef UINT16 ACPI_SIZE;
#elif ACPI_MACHINE_WIDTH == 32
/*
* 32-bit type definitions (default)
*/
......@@ -168,7 +170,6 @@ typedef UINT32 ACPI_SIZE;
/*
* Miscellaneous common types
*/
typedef UINT32 UINT32_BIT;
typedef NATIVE_UINT ACPI_PTRDIFF;
typedef char NATIVE_CHAR;
......@@ -226,7 +227,6 @@ typedef struct acpi_pointer
/*
* Useful defines
*/
#ifdef FALSE
#undef FALSE
#endif
......@@ -245,7 +245,6 @@ typedef struct acpi_pointer
/*
* Local datatypes
*/
typedef u32 acpi_status; /* All ACPI Exceptions */
typedef u32 acpi_name; /* 4-byte ACPI name */
typedef char* acpi_string; /* Null terminated ASCII string */
......@@ -314,7 +313,6 @@ typedef u64 acpi_integer;
/*
* Constants with special meanings
*/
#define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
......@@ -386,7 +384,6 @@ typedef u64 acpi_integer;
/*
* Table types. These values are passed to the table related APIs
*/
typedef u32 acpi_table_type;
#define ACPI_TABLE_RSDP (acpi_table_type) 0
......@@ -401,15 +398,14 @@ typedef u32 acpi_table_type;
/*
* Types associated with names. The first group of
* values correspond to the definition of the ACPI
* Object_type operator (See the ACPI Spec). Therefore,
* Types associated with ACPI names and objects. The first group of
* values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
* of the ACPI Object_type() operator (See the ACPI Spec). Therefore,
* only add to the first group if the spec changes.
*
* Types must be kept in sync with the Acpi_ns_properties
* and Acpi_ns_type_names arrays
* Types must be kept in sync with the global Acpi_ns_properties
* and Acpi_ns_type_names arrays.
*/
typedef u32 acpi_object_type;
#define ACPI_TYPE_ANY 0x00
......@@ -430,52 +426,45 @@ typedef u32 acpi_object_type;
#define ACPI_TYPE_DDB_HANDLE 0x0F
#define ACPI_TYPE_DEBUG_OBJECT 0x10
#define ACPI_TYPE_MAX 0x10
#define ACPI_TYPE_EXTERNAL_MAX 0x10
/*
* This section contains object types that do not relate to the ACPI Object_type operator.
* They are used for various internal purposes only. If new predefined ACPI_TYPEs are
* added (via the ACPI specification), these internal types must move upwards.
* Also, values exceeding the largest official ACPI Object_type must not overlap with
* defined AML opcodes.
* These are object types that do not map directly to the ACPI
* Object_type() operator. They are used for various internal purposes only.
* If new predefined ACPI_TYPEs are added (via the ACPI specification), these
* internal types must move upwards. (There is code that depends on these
* values being contiguous with the external types above.)
*/
#define INTERNAL_TYPE_BEGIN 0x11
#define INTERNAL_TYPE_REGION_FIELD 0x11
#define INTERNAL_TYPE_BANK_FIELD 0x12
#define INTERNAL_TYPE_INDEX_FIELD 0x13
#define INTERNAL_TYPE_REFERENCE 0x14 /* Arg#, Local#, Name, Debug; used only in descriptors */
#define INTERNAL_TYPE_ALIAS 0x15
#define INTERNAL_TYPE_NOTIFY 0x16
#define INTERNAL_TYPE_ADDRESS_HANDLER 0x17
#define INTERNAL_TYPE_RESOURCE 0x18
#define INTERNAL_TYPE_RESOURCE_FIELD 0x19
#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, Ref_of, Index */
#define ACPI_TYPE_LOCAL_ALIAS 0x15
#define ACPI_TYPE_LOCAL_NOTIFY 0x16
#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17
#define ACPI_TYPE_LOCAL_RESOURCE 0x18
#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x19
#define ACPI_TYPE_LOCAL_SCOPE 0x1A /* 1 Name, multiple Object_list Nodes */
#define ACPI_TYPE_NS_NODE_MAX 0x1A /* Last typecode used within a NS Node */
#define INTERNAL_TYPE_NODE_MAX 0x19
/* These are pseudo-types because there are never any namespace nodes with these types */
/*
* These are special object types that never appear in
* a Namespace node, only in an acpi_operand_object
*/
#define ACPI_TYPE_LOCAL_EXTRA 0x1B
#define ACPI_TYPE_LOCAL_DATA 0x1C
#define INTERNAL_TYPE_FIELD_DEFN 0x1A /* Name, Byte_const, multiple Field_element */
#define INTERNAL_TYPE_BANK_FIELD_DEFN 0x1B /* 2 Name,DWord_const,Byte_const,multi Field_element */
#define INTERNAL_TYPE_INDEX_FIELD_DEFN 0x1C /* 2 Name, Byte_const, multiple Field_element */
#define INTERNAL_TYPE_IF 0x1D
#define INTERNAL_TYPE_ELSE 0x1E
#define INTERNAL_TYPE_WHILE 0x1F
#define INTERNAL_TYPE_SCOPE 0x20 /* Name, multiple Node */
#define INTERNAL_TYPE_DEF_ANY 0x21 /* type is Any, suppress search of enclosing scopes */
#define INTERNAL_TYPE_EXTRA 0x22
#define INTERNAL_TYPE_DATA 0x23
#define ACPI_TYPE_LOCAL_MAX 0x1C
#define INTERNAL_TYPE_MAX 0x23
/* All types above here are invalid */
#define INTERNAL_TYPE_INVALID 0x24
#define ACPI_TYPE_INVALID 0x1D
#define ACPI_TYPE_NOT_FOUND 0xFF
/*
* Bitmapped ACPI types
* Used internally only
* Bitmapped ACPI types. Used internally only
*/
#define ACPI_BTYPE_ANY 0x00000000
#define ACPI_BTYPE_INTEGER 0x00000001
......@@ -515,7 +504,6 @@ typedef u32 acpi_object_type;
/*
* Acpi_event Types: Fixed & General Purpose
*/
typedef u32 acpi_event_type;
#define ACPI_EVENT_FIXED 0
......@@ -524,7 +512,6 @@ typedef u32 acpi_event_type;
/*
* Fixed events
*/
#define ACPI_EVENT_PMTIMER 0
#define ACPI_EVENT_GLOBAL 1
#define ACPI_EVENT_POWER_BUTTON 2
......@@ -543,9 +530,7 @@ typedef u32 acpi_event_type;
/*
* GPEs
*/
#define ACPI_EVENT_WAKE_ENABLE 0x1
#define ACPI_EVENT_WAKE_DISABLE 0x1
......@@ -626,10 +611,10 @@ typedef u8 ACPI_ADR_SPACE_TYPE;
#define ACPI_BITREG_MAX 0x13
#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
/*
* External ACPI object definition
*/
typedef union acpi_obj
{
acpi_object_type type; /* See definition of Acpi_ns_type for values */
......@@ -688,7 +673,6 @@ typedef union acpi_obj
/*
* List of objects, used as a parameter list for control method evaluation
*/
typedef struct acpi_obj_list
{
u32 count;
......@@ -700,7 +684,6 @@ typedef struct acpi_obj_list
/*
* Miscellaneous common Data Structures used by the interfaces
*/
#define ACPI_NO_BUFFER 0
#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1)
#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2)
......@@ -716,7 +699,6 @@ typedef struct
/*
* Name_type for Acpi_get_name
*/
#define ACPI_FULL_PATHNAME 0
#define ACPI_SINGLE_NAME 1
#define ACPI_NAME_TYPE_MAX 1
......@@ -725,7 +707,6 @@ typedef struct
/*
* Structure and flags for Acpi_get_system_info
*/
#define ACPI_SYS_MODE_UNKNOWN 0x0000
#define ACPI_SYS_MODE_ACPI 0x0001
#define ACPI_SYS_MODE_LEGACY 0x0002
......@@ -745,7 +726,6 @@ typedef struct acpi_table_info
/*
* System info returned by Acpi_get_system_info()
*/
typedef struct _acpi_sys_info
{
u32 acpi_ca_version;
......@@ -764,7 +744,6 @@ typedef struct _acpi_sys_info
/*
* Various handlers and callback procedures
*/
typedef
u32 (*acpi_event_handler) (
void *context);
......
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 146 $
* $Revision: 147 $
*
*****************************************************************************/
......@@ -637,6 +637,11 @@ acpi_ut_delete_object_cache (
* utmisc
*/
void
acpi_ut_print_string (
char *string,
u8 max_length);
acpi_status
acpi_ut_divide (
acpi_integer *in_dividend,
......
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
* $Revision: 161 $
* $Revision: 165 $
*
******************************************************************************/
......@@ -142,7 +142,7 @@ acpi_ns_root_initialize (void)
/*
* Build an object around the static string
*/
obj_desc->string.length = ACPI_STRLEN (init_val->val);
obj_desc->string.length = (u32) ACPI_STRLEN (init_val->val);
obj_desc->string.pointer = init_val->val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
......@@ -150,6 +150,7 @@ acpi_ns_root_initialize (void)
case ACPI_TYPE_MUTEX:
obj_desc->mutex.node = new_node;
obj_desc->mutex.sync_level =
(u16) ACPI_STRTOUL (init_val->val, NULL, 10);
......@@ -246,6 +247,7 @@ acpi_ns_lookup (
acpi_namespace_node *current_node = NULL;
acpi_namespace_node *this_node = NULL;
u32 num_segments;
u32 num_carats;
acpi_name simple_name;
acpi_object_type type_to_check_for;
acpi_object_type this_search_type;
......@@ -299,26 +301,9 @@ acpi_ns_lookup (
}
}
/*
* This check is explicitly split to relax the Type_to_check_for
* conditions for Bank_field_defn. Originally, both Bank_field_defn and
* Def_field_defn caused Type_to_check_for to be set to ACPI_TYPE_REGION,
* but the Bank_field_defn may also check for a Field definition as well
* as an Operation_region.
*/
if (INTERNAL_TYPE_FIELD_DEFN == type) {
/* Def_field_defn defines fields in a Region */
type_to_check_for = ACPI_TYPE_REGION;
}
else if (INTERNAL_TYPE_BANK_FIELD_DEFN == type) {
/* Bank_field_defn defines data fields in a Field Object */
/* Save type TBD: may be no longer necessary */
type_to_check_for = ACPI_TYPE_ANY;
}
else {
type_to_check_for = type;
}
/*
* Begin examination of the actual pathname
......@@ -364,14 +349,15 @@ acpi_ns_lookup (
/* Pathname is relative to current scope, start there */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching relative to prefix scope [%p]\n",
prefix_node));
"Searching relative to prefix scope [%4.4s] (%p)\n",
prefix_node->name.ascii, prefix_node));
/*
* Handle multiple Parent Prefixes (carat) by just getting
* the parent node for each prefix instance.
*/
this_node = prefix_node;
num_carats = 0;
while (*path == (u8) AML_PARENT_PREFIX) {
/* Name is fully qualified, no search rules apply */
......@@ -384,6 +370,7 @@ acpi_ns_lookup (
/* Backup to the parent node */
num_carats++;
this_node = acpi_ns_get_parent_node (this_node);
if (!this_node) {
/* Current scope has no parent scope */
......@@ -396,7 +383,8 @@ acpi_ns_lookup (
if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Path is absolute with one or more carats\n"));
"Search scope is [%4.4s], path has %d carat(s)\n",
this_node->name.ascii, num_carats));
}
}
......@@ -420,6 +408,7 @@ acpi_ns_lookup (
* have the correct target node and there are no name segments.
*/
num_segments = 0;
type = this_node->type;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Prefix-only Pathname (Zero name segments), Flags=%X\n", flags));
......@@ -525,6 +514,7 @@ acpi_ns_lookup (
current_node));
}
*return_node = this_node;
return_ACPI_STATUS (status);
}
......@@ -535,27 +525,24 @@ acpi_ns_lookup (
* 2) And we are looking for a specific type
* (Not checking for TYPE_ANY)
* 3) Which is not an alias
* 4) Which is not a local type (TYPE_DEF_ANY)
* 5) Which is not a local type (TYPE_SCOPE)
* 6) Which is not a local type (TYPE_INDEX_FIELD_DEFN)
* 7) And the type of target object is known (not TYPE_ANY)
* 8) And target object does not match what we are looking for
* 4) Which is not a local type (TYPE_SCOPE)
* 5) And the type of target object is known (not TYPE_ANY)
* 6) And target object does not match what we are looking for
*
* Then we have a type mismatch. Just warn and ignore it.
*/
if ((num_segments == 0) &&
(type_to_check_for != ACPI_TYPE_ANY) &&
(type_to_check_for != INTERNAL_TYPE_ALIAS) &&
(type_to_check_for != INTERNAL_TYPE_DEF_ANY) &&
(type_to_check_for != INTERNAL_TYPE_SCOPE) &&
(type_to_check_for != INTERNAL_TYPE_INDEX_FIELD_DEFN) &&
(type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
(type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
(this_node->type != ACPI_TYPE_ANY) &&
(this_node->type != type_to_check_for)) {
/* Complain about a type mismatch */
ACPI_REPORT_WARNING (
("Ns_lookup: %4.4s, type %X, checking for type %X\n",
(char *) &simple_name, this_node->type, type_to_check_for));
("Ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
(char *) &simple_name, acpi_ut_get_type_name (this_node->type),
acpi_ut_get_type_name (type_to_check_for)));
}
/*
......@@ -581,15 +568,11 @@ acpi_ns_lookup (
* If entry is a type which opens a scope, push the new scope on the
* scope stack.
*/
if (acpi_ns_opens_scope (type_to_check_for)) {
if (acpi_ns_opens_scope (type)) {
status = acpi_ds_scope_stack_push (this_node, type, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Setting current scope to [%4.4s] (%p)\n",
this_node->name.ascii, this_node));
}
}
......
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 74 $
* $Revision: 75 $
*
******************************************************************************/
......@@ -125,6 +125,55 @@ acpi_ns_delete_node (
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_compare_names
*
* PARAMETERS: Name1 - First name to compare
* Name2 - Second name to compare
*
* RETURN: value from strncmp
*
* DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
* underscore are forced to be alphabetically first.
*
******************************************************************************/
int
acpi_ns_compare_names (
char *name1,
char *name2)
{
char reversed_name1[ACPI_NAME_SIZE];
char reversed_name2[ACPI_NAME_SIZE];
u32 i;
u32 j;
/*
* Replace all instances of "underscore" with a value that is smaller so
* that all names that are prefixed with underscore(s) are alphabetically
* first.
*
* Reverse the name bytewise so we can just do a 32-bit compare instead
* of a strncmp.
*/
for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
reversed_name1[j] = name1[i];
if (name1[i] == '_') {
reversed_name1[j] = '*';
}
reversed_name2[j] = name2[i];
if (name2[i] == '_') {
reversed_name2[j] = '*';
}
}
return (*(s32 *) reversed_name1 - *(s32 *) reversed_name2);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ns_install_node
......@@ -139,8 +188,10 @@ acpi_ns_delete_node (
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
* Note: Current namespace lookup is linear search, so the nodes
* are not linked in any particular order.
* Note: Current namespace lookup is linear search. However, the
* nodes are linked in alphabetical order to 1) put all reserved
* names (start with underscore) first, and to 2) make a readable
* namespace dump.
*
******************************************************************************/
......@@ -153,6 +204,7 @@ acpi_ns_install_node (
{
u16 owner_id = TABLE_ID_DSDT;
acpi_namespace_node *child_node;
acpi_namespace_node *previous_child_node;
ACPI_FUNCTION_TRACE ("Ns_install_node");
......@@ -172,66 +224,68 @@ acpi_ns_install_node (
child_node = parent_node->child;
if (!child_node) {
parent_node->child = node;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
}
else {
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
/*
* Walk the list whilst searching for the the correct
* alphabetic placement.
*/
previous_child_node = NULL;
while (acpi_ns_compare_names (child_node->name.ascii, node->name.ascii) < 0) {
if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* Last peer; Clear end-of-list flag */
child_node->peer = node;
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
/* Clear end-of-list flag */
/* This node is the new peer to the child node */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
}
child_node->peer = node;
/* Init the new entry */
/* This node is the new end-of-list */
node->owner_id = owner_id;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
break;
}
/* Get next peer */
/*
* If adding a name with unknown type, or having to
* add the region in order to define fields in it, we
* have a forward reference.
*/
if ((ACPI_TYPE_ANY == type) ||
(INTERNAL_TYPE_FIELD_DEFN == type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
/*
* We don't want to abort here, however!
* We will fill in the actual type when the
* real definition is found later.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] is a forward reference\n",
node->name.ascii));
previous_child_node = child_node;
child_node = child_node->peer;
}
/* Did the node get inserted at the end-of-list? */
if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
/*
* The Def_field_defn and Bank_field_defn cases are actually
* looking up the Region in which the field will be defined
* Loop above terminated without reaching the end-of-list.
* Insert the new node at the current location
*/
if ((INTERNAL_TYPE_FIELD_DEFN == type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
type = ACPI_TYPE_REGION;
if (previous_child_node) {
/* Insert node alphabetically */
node->peer = child_node;
previous_child_node->peer = node;
}
else {
/* Insert node alphabetically at start of list */
/*
* Scope, Def_any, and Index_field_defn are bogus "types" which do
* not actually have anything to do with the type of the name
* being looked up. Save any other value of Type as the type of
* the entry.
*/
if ((type != INTERNAL_TYPE_SCOPE) &&
(type != INTERNAL_TYPE_DEF_ANY) &&
(type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) {
node->type = (u8) type;
node->peer = child_node;
parent_node->child = node;
}
}
}
/* Init the new entry */
node->owner_id = owner_id;
node->type = (u8) type;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n",
node->name.ascii, parent_node, node));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s (%s) added to %4.4s (%s) %p at %p\n",
node->name.ascii, acpi_ut_get_type_name (node->type),
parent_node->name.ascii, acpi_ut_get_type_name (parent_node->type), parent_node, node));
/*
* Increment the reference count(s) of all parents up to
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 141 $
* $Revision: 145 $
*
*****************************************************************************/
......@@ -150,22 +150,14 @@ acpi_ns_dump_one_object (
acpi_object_type obj_type;
acpi_object_type type;
u32 bytes_to_dump;
u32 downstream_sibling_mask = 0;
u32 level_tmp;
u32 which_bit;
u32 i;
u32 dbg_level;
u32 i;
ACPI_FUNCTION_NAME ("Ns_dump_one_object");
this_node = acpi_ns_map_handle_to_node (obj_handle);
level_tmp = level;
type = this_node->type;
which_bit = 1;
/* Is output enabled? */
if (!(acpi_dbg_level & info->debug_level)) {
return (AE_OK);
......@@ -176,6 +168,9 @@ acpi_ns_dump_one_object (
return (AE_OK);
}
this_node = acpi_ns_map_handle_to_node (obj_handle);
type = this_node->type;
/* Check if the owner matches */
if ((info->owner_id != ACPI_UINT32_MAX) &&
......@@ -185,45 +180,12 @@ acpi_ns_dump_one_object (
/* Indent the object according to the level */
while (level_tmp--) {
/* Print appropriate characters to form tree structure */
acpi_os_printf ("%2d%*s", level - 1, level * 2, " ");
if (level_tmp) {
if (downstream_sibling_mask & which_bit) {
acpi_os_printf ("|");
}
else {
acpi_os_printf (" ");
}
/* Check the node type and name */
which_bit <<= 1;
}
else {
if (acpi_ns_exist_downstream_sibling (this_node + 1)) {
downstream_sibling_mask |= ((u32) 1 << (level - 1));
acpi_os_printf ("+");
}
else {
downstream_sibling_mask &= ACPI_UINT32_MAX ^ ((u32) 1 << (level - 1));
acpi_os_printf ("+");
}
if (this_node->child == NULL) {
acpi_os_printf ("-");
}
else if (acpi_ns_exist_downstream_sibling (this_node->child)) {
acpi_os_printf ("+");
}
else {
acpi_os_printf ("-");
}
}
}
/* Check the integrity of our data */
if (type > INTERNAL_TYPE_MAX) {
type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
if (type > ACPI_TYPE_LOCAL_MAX) {
ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
}
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
......@@ -233,7 +195,7 @@ acpi_ns_dump_one_object (
/*
* Now we can print out the pertinent information
*/
acpi_os_printf (" %4.4s %-12s %p",
acpi_os_printf ("%4.4s %-12s %p ",
this_node->name.ascii, acpi_ut_get_type_name (type), this_node);
dbg_level = acpi_dbg_level;
......@@ -254,7 +216,7 @@ acpi_ns_dump_one_object (
switch (type) {
case ACPI_TYPE_PROCESSOR:
acpi_os_printf (" ID %X Len %.4X Addr %p\n",
acpi_os_printf ("ID %X Len %.4X Addr %p\n",
obj_desc->processor.proc_id,
obj_desc->processor.length,
(char *) obj_desc->processor.address);
......@@ -263,13 +225,13 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_DEVICE:
acpi_os_printf (" Notification object: %p", obj_desc);
acpi_os_printf ("Notify object: %p", obj_desc);
break;
case ACPI_TYPE_METHOD:
acpi_os_printf (" Args %X Len %.4X Aml %p\n",
acpi_os_printf ("Args %X Len %.4X Aml %p\n",
(u32) obj_desc->method.param_count,
obj_desc->method.aml_length,
obj_desc->method.aml_start);
......@@ -278,7 +240,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_INTEGER:
acpi_os_printf (" = %8.8X%8.8X\n",
acpi_os_printf ("= %8.8X%8.8X\n",
ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break;
......@@ -287,11 +249,11 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_PACKAGE:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Elements %.2X\n",
acpi_os_printf ("Elements %.2X\n",
obj_desc->package.count);
}
else {
acpi_os_printf (" [Length not yet evaluated]\n");
acpi_os_printf ("[Length not yet evaluated]\n");
}
break;
......@@ -299,7 +261,7 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_BUFFER:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Len %.2X",
acpi_os_printf ("Len %.2X",
obj_desc->buffer.length);
/* Dump some of the buffer */
......@@ -313,28 +275,22 @@ acpi_ns_dump_one_object (
acpi_os_printf ("\n");
}
else {
acpi_os_printf (" [Length not yet evaluated]\n");
acpi_os_printf ("[Length not yet evaluated]\n");
}
break;
case ACPI_TYPE_STRING:
acpi_os_printf (" Len %.2X", obj_desc->string.length);
if (obj_desc->string.length > 0) {
acpi_os_printf (" = \"%.32s\"", obj_desc->string.pointer);
if (obj_desc->string.length > 32) {
acpi_os_printf ("...");
}
}
acpi_os_printf ("Len %.2X ", obj_desc->string.length);
acpi_ut_print_string (obj_desc->string.pointer, 32);
acpi_os_printf ("\n");
break;
case ACPI_TYPE_REGION:
acpi_os_printf (" [%s]", acpi_ut_get_region_name (obj_desc->region.space_id));
acpi_os_printf ("[%s]", acpi_ut_get_region_name (obj_desc->region.space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
ACPI_HIDWORD (obj_desc->region.address),
......@@ -347,9 +303,9 @@ acpi_ns_dump_one_object (
break;
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf (" [%s]\n",
acpi_os_printf ("[%s]\n",
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
break;
......@@ -358,43 +314,43 @@ acpi_ns_dump_one_object (
if (obj_desc->buffer_field.buffer_obj &&
obj_desc->buffer_field.buffer_obj->buffer.node) {
acpi_os_printf (" Buf [%4.4s]",
acpi_os_printf ("Buf [%4.4s]",
obj_desc->buffer_field.buffer_obj->buffer.node->name.ascii);
}
break;
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf (" Rgn [%4.4s]",
acpi_os_printf ("Rgn [%4.4s]",
obj_desc->common_field.region_obj->region.node->name.ascii);
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf (" Rgn [%4.4s] Bnk [%4.4s]",
acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
obj_desc->common_field.region_obj->region.node->name.ascii,
obj_desc->bank_field.bank_obj->common_field.node->name.ascii);
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf (" Idx [%4.4s] Dat [%4.4s]",
acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
obj_desc->index_field.index_obj->common_field.node->name.ascii,
obj_desc->index_field.data_obj->common_field.node->name.ascii);
break;
case INTERNAL_TYPE_ALIAS:
case ACPI_TYPE_LOCAL_ALIAS:
acpi_os_printf (" Target %4.4s (%p)\n", ((acpi_namespace_node *) obj_desc)->name.ascii, obj_desc);
acpi_os_printf ("Target %4.4s (%p)\n", ((acpi_namespace_node *) obj_desc)->name.ascii, obj_desc);
break;
default:
acpi_os_printf (" Object %p\n", obj_desc);
acpi_os_printf ("Object %p\n", obj_desc);
break;
}
......@@ -402,9 +358,10 @@ acpi_ns_dump_one_object (
switch (type) {
case ACPI_TYPE_BUFFER_FIELD:
case INTERNAL_TYPE_REGION_FIELD:
case INTERNAL_TYPE_BANK_FIELD:
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf (" Off %.2X Len %.2X Acc %.2hd\n",
(obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset,
......@@ -420,9 +377,7 @@ acpi_ns_dump_one_object (
case ACPI_DISPLAY_OBJECTS:
acpi_os_printf ("%p O:%p",
this_node, obj_desc);
acpi_os_printf ("O:%p", obj_desc);
if (!obj_desc) {
/* No attached object, we are done */
......@@ -490,7 +445,7 @@ acpi_ns_dump_one_object (
/* Dump attached objects */
while (obj_desc) {
obj_type = INTERNAL_TYPE_INVALID;
obj_type = ACPI_TYPE_INVALID;
acpi_os_printf (" Attached Object %p: ", obj_desc);
/* Decode the type of attached object and dump the contents */
......@@ -507,7 +462,7 @@ acpi_ns_dump_one_object (
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
if (obj_type > INTERNAL_TYPE_MAX) {
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", obj_type);
bytes_to_dump = 32;
}
......@@ -558,15 +513,15 @@ acpi_ns_dump_one_object (
obj_desc = (void *) obj_desc->method.aml_start;
break;
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
obj_desc = (void *) obj_desc->field.region_obj;
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
obj_desc = (void *) obj_desc->bank_field.region_obj;
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
obj_desc = (void *) obj_desc->index_field.index_obj;
break;
......@@ -574,7 +529,7 @@ acpi_ns_dump_one_object (
goto cleanup;
}
obj_type = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
}
cleanup:
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 83 $
* $Revision: 84 $
*
******************************************************************************/
......@@ -127,15 +127,10 @@ acpi_ns_attach_object (
else {
obj_desc = (acpi_operand_object *) object;
/* If a valid type (non-ANY) was given, just use it */
/* Use the given type */
if (ACPI_TYPE_ANY != type) {
object_type = type;
}
else {
object_type = INTERNAL_TYPE_DEF_ANY;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
obj_desc, node, node->name.ascii));
......@@ -201,7 +196,7 @@ acpi_ns_detach_object (
obj_desc = node->object;
if (!obj_desc ||
(ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA)) {
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
return_VOID;
}
......@@ -211,7 +206,7 @@ acpi_ns_detach_object (
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object;
if (node->object &&
(ACPI_GET_OBJECT_TYPE (node->object) != INTERNAL_TYPE_DATA)) {
(ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) {
node->object = node->object->common.next_object;
}
}
......@@ -256,7 +251,7 @@ acpi_ns_get_attached_object (
if (!node->object ||
((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
(ACPI_GET_OBJECT_TYPE (node->object) == INTERNAL_TYPE_DATA)) {
(ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
return_PTR (NULL);
}
......@@ -283,9 +278,9 @@ acpi_ns_get_secondary_object (
if ((!obj_desc) ||
(ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) ||
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
(!obj_desc->common.next_object) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == INTERNAL_TYPE_DATA)) {
(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
return_PTR (NULL);
}
......@@ -320,7 +315,7 @@ acpi_ns_attach_data (
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) {
return (AE_ALREADY_EXISTS);
}
......@@ -332,7 +327,7 @@ acpi_ns_attach_data (
/* Create an internal object for the data */
data_desc = acpi_ut_create_internal_object (INTERNAL_TYPE_DATA);
data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
if (!data_desc) {
return (AE_NO_MEMORY);
}
......@@ -378,7 +373,7 @@ acpi_ns_detach_data (
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) {
if (prev_obj_desc) {
prev_obj_desc->common.next_object = obj_desc->common.next_object;
......@@ -422,7 +417,7 @@ acpi_ns_get_attached_data (
obj_desc = node->object;
while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == INTERNAL_TYPE_DATA) &&
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) {
*data = obj_desc->data.pointer;
return (AE_OK);
......
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
* $Revision: 89 $
* $Revision: 92 $
*
******************************************************************************/
......@@ -37,14 +37,15 @@
* FUNCTION: Acpi_ns_search_node
*
* PARAMETERS: *Target_name - Ascii ACPI name to search for
* *Node - Starting table where search will begin
* *Node - Starting node where search will begin
* Type - Object type to match
* **Return_node - Where the matched Named obj is returned
*
* RETURN: Status
*
* DESCRIPTION: Search a single namespace table. Performs a simple search,
* does not add entries or search parents.
* DESCRIPTION: Search a single level of the namespace. Performs a
* simple search of the specified level, and does not add
* entries or search parents.
*
*
* Named object lists are built (and subsequently dumped) in the
......@@ -77,7 +78,7 @@ acpi_ns_search_node (
scope_name = acpi_ns_get_external_pathname (node);
if (scope_name) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %s)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (%s)\n",
scope_name, node, (char *) &target_name, acpi_ut_get_type_name (type)));
ACPI_MEM_FREE (scope_name);
......@@ -86,8 +87,8 @@ acpi_ns_search_node (
#endif
/*
* Search for name in this table, which is to say that we must search
* for the name among the children of this object
* Search for name at this namespace level, which is to say that we
* must search for the name among the children of this object
*/
next_node = node->child;
while (next_node) {
......@@ -95,30 +96,8 @@ acpi_ns_search_node (
if (next_node->name.integer == target_name) {
/*
* Found matching entry. Capture the type if appropriate, before
* returning the entry.
*
* The Def_field_defn and Bank_field_defn cases are actually looking up
* the Region in which the field will be defined
*/
if ((INTERNAL_TYPE_FIELD_DEFN == type) ||
(INTERNAL_TYPE_BANK_FIELD_DEFN == type)) {
type = ACPI_TYPE_REGION;
}
/*
* Scope, Def_any, and Index_field_defn are bogus "types" which do not
* actually have anything to do with the type of the name being
* looked up. For any other value of Type, if the type stored in
* the entry is Any (i.e. unknown), save the actual type.
* Found matching entry.
*/
if (type != INTERNAL_TYPE_SCOPE &&
type != INTERNAL_TYPE_DEF_ANY &&
type != INTERNAL_TYPE_INDEX_FIELD_DEFN &&
next_node->type == ACPI_TYPE_ANY) {
next_node->type = (u8) type;
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name %4.4s Type [%s] found at %p\n",
(char *) &target_name, acpi_ut_get_type_name (next_node->type), next_node));
......@@ -142,7 +121,7 @@ acpi_ns_search_node (
next_node = next_node->peer;
}
/* Searched entire table, not found */
/* Searched entire namespace level, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s Type [%s] not found at %p\n",
(char *) &target_name, acpi_ut_get_type_name (type), next_node));
......@@ -156,14 +135,14 @@ acpi_ns_search_node (
* FUNCTION: Acpi_ns_search_parent_tree
*
* PARAMETERS: *Target_name - Ascii ACPI name to search for
* *Node - Starting table where search will begin
* *Node - Starting node where search will begin
* Type - Object type to match
* **Return_node - Where the matched Named Obj is returned
*
* RETURN: Status
*
* DESCRIPTION: Called when a name has not been found in the current namespace
* table. Before adding it or giving up, ACPI scope rules require
* level. Before adding it or giving up, ACPI scope rules require
* searching enclosing scopes in cases identified by Acpi_ns_local().
*
* "A name is located by finding the matching name in the current
......@@ -193,22 +172,19 @@ acpi_ns_search_parent_tree (
parent_node = acpi_ns_get_parent_node (node);
/*
* If there is no parent (at the root) or type is "local", we won't be
* searching the parent tree.
* If there is no parent (i.e., we are at the root) or
* type is "local", we won't be searching the parent tree.
*/
if ((acpi_ns_local (type)) ||
(!parent_node)) {
if (!parent_node) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
(char *) &target_name));
return_ACPI_STATUS (AE_NOT_FOUND);
}
if (acpi_ns_local (type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
(char *) &target_name, acpi_ut_get_type_name (type)));
}
return_ACPI_STATUS (AE_NOT_FOUND);
}
......@@ -251,8 +227,8 @@ acpi_ns_search_parent_tree (
*
* PARAMETERS: Target_name - Ascii ACPI name to search for (4 chars)
* Walk_state - Current state of the walk
* *Node - Starting table where search will begin
* Interpreter_mode - Add names only in MODE_Load_pass_x.
* *Node - Starting node where search will begin
* Interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x.
* Otherwise,search only.
* Type - Object type to match
* Flags - Flags describing the search restrictions
......@@ -260,12 +236,12 @@ acpi_ns_search_parent_tree (
*
* RETURN: Status
*
* DESCRIPTION: Search for a name segment in a single name table,
* DESCRIPTION: Search for a name segment in a single namespace level,
* optionally adding it if it is not found. If the passed
* Type is not Any and the type previously stored in the
* entry was Any (i.e. unknown), update the stored type.
*
* In IMODE_EXECUTE, search only.
* In ACPI_IMODE_EXECUTE, search only.
* In other modes, search and add if not found.
*
******************************************************************************/
......@@ -300,14 +276,12 @@ acpi_ns_search_and_enter (
/* Name must consist of printable characters */
if (!acpi_ut_valid_acpi_name (target_name)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "*** Bad character in name: %08x *** \n",
ACPI_REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name: %X\n",
target_name));
ACPI_REPORT_ERROR (("Ns_search_and_enter: Bad character in ACPI Name\n"));
return_ACPI_STATUS (AE_BAD_CHARACTER);
}
/* Try to find the name in the table specified by the caller */
/* Try to find the name in the namespace level specified by the caller */
*return_node = ACPI_ENTRY_NOT_FOUND;
status = acpi_ns_search_node (target_name, node, type, return_node);
......@@ -340,7 +314,7 @@ acpi_ns_search_and_enter (
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
(flags & ACPI_NS_SEARCH_PARENT)) {
/*
* Not found in table - search parent tree according
* Not found at this level - search parent tree according
* to ACPI specification
*/
status = acpi_ns_search_parent_tree (target_name, node,
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 113 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -747,7 +747,7 @@ u32
acpi_ns_opens_scope (
acpi_object_type type)
{
ACPI_FUNCTION_TRACE_U32 ("Ns_opens_scope", type);
ACPI_FUNCTION_TRACE_STR ("Ns_opens_scope", acpi_ut_get_type_name (type));
if (!acpi_ut_valid_object_type (type)) {
......@@ -885,43 +885,6 @@ acpi_ns_find_parent_name (
}
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: Acpi_ns_exist_downstream_sibling
*
* PARAMETERS: *Node - pointer to first Node to examine
*
* RETURN: TRUE if sibling is found, FALSE otherwise
*
* DESCRIPTION: Searches remainder of scope being processed to determine
* whether there is a downstream sibling to the current
* object. This function is used to determine what type of
* line drawing character to use when displaying namespace
* trees.
*
******************************************************************************/
u8
acpi_ns_exist_downstream_sibling (
acpi_namespace_node *node)
{
if (!node) {
return (FALSE);
}
if (node->name.integer) {
return (TRUE);
}
return (FALSE);
}
#endif /* ACPI_DEBUG_OUTPUT */
/*******************************************************************************
*
* FUNCTION: Acpi_ns_get_parent_node
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
* $Revision: 2 $
* $Revision: 3 $
*
******************************************************************************/
......@@ -373,7 +373,7 @@ acpi_walk_namespace (
/* Parameter validation */
if ((type > ACPI_TYPE_MAX) ||
if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
(!max_depth) ||
(!user_function)) {
return_ACPI_STATUS (AE_BAD_PARAMETER);
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
* $Revision: 113 $
* $Revision: 114 $
*
******************************************************************************/
......@@ -188,7 +188,7 @@ acpi_get_next_object (
/* Parameter validation */
if (type > ACPI_TYPE_MAX) {
if (type > ACPI_TYPE_EXTERNAL_MAX) {
return (AE_BAD_PARAMETER);
}
......
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 72 $
* $Revision: 73 $
*
*****************************************************************************/
......@@ -455,31 +455,31 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
......@@ -542,23 +542,23 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, INTERNAL_TYPE_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, INTERNAL_TYPE_INDEX_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, INTERNAL_TYPE_BANK_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* Internal opcodes that map to invalid AML opcodes */
/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
/* 64 */ ACPI_OP ("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
......@@ -566,7 +566,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 6A */ ACPI_OP ("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, INTERNAL_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
......@@ -588,7 +588,7 @@ const acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE)
/*! [End] no source code translation !*/
};
......
......@@ -229,7 +229,7 @@ acpi_pci_irq_add_prt (
PCI Interrupt Routing Support
-------------------------------------------------------------------------- */
static int
int
acpi_pci_irq_lookup (
int segment,
int bus,
......@@ -285,8 +285,9 @@ acpi_pci_irq_derive (
* Attempt to derive an IRQ for this device from a parent bridge's
* PCI interrupt routing entry (a.k.a. the "bridge swizzle").
*/
while (!irq && (bridge = bridge->bus->self)) {
while (!irq && bridge->bus->self) {
pin = (pin + PCI_SLOT(bridge->devfn)) % 4;
bridge = bridge->bus->self;
irq = acpi_pci_irq_lookup(0, bridge->bus->number, PCI_SLOT(bridge->devfn), pin);
}
......
......@@ -217,7 +217,7 @@ acpi_power_on (
static int
acpi_power_off (
acpi_power_off_device (
acpi_handle handle)
{
int result = 0;
......@@ -225,7 +225,7 @@ acpi_power_off (
struct acpi_device *device = NULL;
struct acpi_power_resource *resource = NULL;
ACPI_FUNCTION_TRACE("acpi_power_off");
ACPI_FUNCTION_TRACE("acpi_power_off_device");
result = acpi_power_get_context(handle, &resource);
if (result)
......@@ -358,7 +358,7 @@ acpi_power_transition (
* Then we dereference all power resources used in the current list.
*/
for (i=0; i<cl->count; i++) {
result = acpi_power_off(cl->handles[i]);
result = acpi_power_off_device(cl->handles[i]);
if (result)
goto end;
}
......
......@@ -43,6 +43,10 @@
#include "acpi_bus.h"
#include "acpi_drivers.h"
#ifdef CONFIG_ACPI_PROCESSOR_PERF
#include <linux/cpufreq.h>
#endif
#define ACPI_PROCESSOR_COMPONENT 0x01000000
#define ACPI_PROCESSOR_CLASS "processor"
#define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver"
......@@ -224,6 +228,11 @@ static struct acpi_processor *processors[NR_CPUS];
static struct acpi_processor_errata errata;
static void (*pm_idle_save)(void) = NULL;
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static unsigned int cpufreq_usage_count = 0;
static struct cpufreq_driver *acpi_cpufreq_driver;
#endif
/* --------------------------------------------------------------------------
Errata Handling
......@@ -830,7 +839,7 @@ acpi_processor_get_power_info (
/* --------------------------------------------------------------------------
Performance Management
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static int
acpi_processor_get_platform_limit (
struct acpi_processor* pr)
......@@ -1037,6 +1046,7 @@ acpi_processor_set_performance (
u16 port = 0;
u8 value = 0;
int i = 0;
struct cpufreq_freqs cpufreq_freqs;
ACPI_FUNCTION_TRACE("acpi_processor_set_performance");
......@@ -1068,6 +1078,14 @@ acpi_processor_set_performance (
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Transitioning from P%d to P%d\n",
pr->performance.state, state));
/* cpufreq frequency struct */
cpufreq_freqs.cpu = pr->id;
cpufreq_freqs.old = pr->performance.states[pr->performance.state].core_frequency;
cpufreq_freqs.new = pr->performance.states[state].core_frequency;
/* notify cpufreq */
cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
/*
* First we write the target state's 'control' value to the
* control_register.
......@@ -1101,7 +1119,15 @@ acpi_processor_set_performance (
udelay(10);
}
/* notify cpufreq */
cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
if (value != pr->performance.states[state].status) {
unsigned int tmp = cpufreq_freqs.new;
cpufreq_freqs.new = cpufreq_freqs.old;
cpufreq_freqs.old = tmp;
cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Transition failed\n"));
return_VALUE(-ENODEV);
}
......@@ -1155,6 +1181,23 @@ acpi_processor_get_performance_info (
return_VALUE(0);
}
#else
static int
acpi_processor_get_performance_info (
struct acpi_processor *pr)
{
ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info_dummy");
if (!pr)
return_VALUE(-EINVAL);
pr->flags.performance = 0;
return_VALUE(0);
}
#endif
/* --------------------------------------------------------------------------
......@@ -1400,17 +1443,24 @@ acpi_processor_apply_limit (
if (!pr->flags.limit)
return_VALUE(-ENODEV);
#ifdef CONFIG_ACPI_PROCESSOR_PERF
if (pr->flags.performance) {
px = pr->performance.platform_limit;
if (pr->limit.user.px > px)
px = pr->limit.user.px;
if (pr->limit.thermal.px > px)
px = pr->limit.thermal.px;
result = acpi_processor_set_performance(pr, px);
{
struct cpufreq_policy policy;
policy.cpu = pr->id;
cpufreq_get_policy(&policy, pr->id);
policy.max = pr->performance.states[px].core_frequency * 1000;
result = cpufreq_set_policy(&policy);
}
if (result)
goto end;
}
#endif
if (pr->flags.throttling) {
if (pr->limit.user.tx > tx)
......@@ -1481,9 +1531,6 @@ acpi_processor_set_thermal_limit (
px = pr->limit.thermal.px;
tx = pr->limit.thermal.tx;
px = pr->limit.thermal.px;
tx = pr->limit.thermal.tx;
switch (type) {
case ACPI_PROCESSOR_LIMIT_NONE:
......@@ -1562,6 +1609,271 @@ acpi_processor_get_limit_info (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
cpufreq interface
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static void
acpi_cpufreq_setpolicy (
struct cpufreq_policy *policy)
{
unsigned int cpu = 0;
unsigned int i = 0;
struct acpi_processor *pr = NULL;
unsigned int next_state = 0;
unsigned int result = 0;
ACPI_FUNCTION_TRACE("acpi_cpufreq_setpolicy");
if (!policy)
return_VOID;
/* get a present, initialized CPU */
if (policy->cpu == CPUFREQ_ALL_CPUS)
{
for (i=0; i<NR_CPUS; i++) {
if (processors[i] != NULL) {
cpu = i;
pr = processors[cpu];
break;
}
}
}
else
{
cpu = policy->cpu;
pr = processors[cpu];
if (!pr)
return_VOID;
}
/* select appropriate P-State */
if (policy->policy == CPUFREQ_POLICY_POWERSAVE)
{
for (i=(pr->performance.state_count - 1); i>= pr->limit.state.px; i--)
{
unsigned int state_freq = pr->performance.states[i].core_frequency * 1000;
if ((policy->min <= state_freq) &&
(policy->max >= state_freq))
{
next_state = i;
break;
}
}
} else {
for (i=pr->limit.state.px; i < pr->performance.state_count; i++)
{
unsigned int state_freq = pr->performance.states[i].core_frequency * 1000;
if ((policy->min <= state_freq) &&
(policy->max >= state_freq))
{
next_state = i;
break;
}
}
}
/* set one or all CPUs to the new state */
if (policy->cpu == CPUFREQ_ALL_CPUS) {
for (i=0; i<NR_CPUS; i++)
{
pr = processors[cpu];
if (!pr || !cpu_online(cpu))
continue;
result = acpi_processor_set_performance (pr, next_state);
}
} else {
result = acpi_processor_set_performance (pr, next_state);
}
return_VOID;
}
static void
acpi_cpufreq_verify (
struct cpufreq_policy *policy)
{
unsigned int cpu = 0;
unsigned int i = 0;
struct acpi_processor *pr = NULL;
unsigned int number_states = 0;
unsigned int next_larger_state = 0;
ACPI_FUNCTION_TRACE("acpi_cpufreq_verify");
if (!policy)
return_VOID;
/* get a present, initialized CPU */
if (policy->cpu == CPUFREQ_ALL_CPUS)
{
for (i=0; i<NR_CPUS; i++) {
if (processors[i] != NULL) {
cpu = i;
pr = processors[cpu];
break;
}
}
}
else
{
cpu = policy->cpu;
pr = processors[cpu];
if (!pr)
return_VOID;
}
/* first check if min and max are within valid limits */
cpufreq_verify_within_limits(
policy,
pr->performance.states[pr->performance.state_count - 1].core_frequency * 1000,
pr->performance.states[pr->limit.state.px].core_frequency * 1000);
/* now check if at least one value is within this limit */
for (i=pr->limit.state.px; i < pr->performance.state_count; i++)
{
unsigned int state_freq = pr->performance.states[i].core_frequency * 1000;
if ((policy->min <= state_freq) &&
(policy->max >= state_freq))
number_states++;
if (state_freq > policy->max)
next_larger_state = i;
}
if (number_states)
return_VOID;
/* round up now */
policy->max = pr->performance.states[next_larger_state].core_frequency * 1000;
return_VOID;
}
static int
acpi_cpufreq_init (
struct acpi_processor *pr)
{
int result = 0;
int i = 0;
int current_state = 0;
struct cpufreq_driver *driver;
ACPI_FUNCTION_TRACE("acpi_cpufreq_init");
if (cpufreq_usage_count) {
if (pr->flags.performance == 1)
cpufreq_usage_count++;
return_VALUE(0);
}
/* test if it works */
current_state = pr->performance.state;
if (current_state == pr->limit.state.px) {
result = acpi_processor_set_performance(pr, (pr->performance.state_count - 1));
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
pr->flags.performance = 0;
return_VALUE(-ENODEV);
}
}
result = acpi_processor_set_performance(pr, pr->limit.state.px);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
pr->flags.performance = 0;
return_VALUE(-ENODEV);
}
if (current_state != 0) {
result = acpi_processor_set_performance(pr, current_state);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
pr->flags.performance = 0;
return_VALUE(-ENODEV);
}
}
/* initialization of main "cpufreq" code*/
driver = kmalloc(sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!driver)
return_VALUE(-ENOMEM);
driver->policy = (struct cpufreq_policy *) (driver + 1);
#ifdef CONFIG_CPU_FREQ_24_API
driver->cpu_min_freq = pr->performance.states[pr->performance.state_count - 1].core_frequency * 1000;
for (i=0;i<NR_CPUS;i++)
driver->cpu_cur_freq[0] = pr->performance.states[current_state].core_frequency * 1000;
#endif
driver->verify = &acpi_cpufreq_verify;
driver->setpolicy = &acpi_cpufreq_setpolicy;
for (i=0;i<NR_CPUS;i++) {
driver->policy[i].cpu = pr->id;
driver->policy[i].min = pr->performance.states[pr->performance.state_count - 1].core_frequency * 1000;
driver->policy[i].max = pr->performance.states[pr->limit.state.px].core_frequency * 1000;
driver->policy[i].max_cpu_freq = pr->performance.states[0].core_frequency * 1000;
driver->policy[i].policy = ( pr->performance.states[current_state].core_frequency * 1000 == driver->policy[i].max) ?
CPUFREQ_POLICY_PERFORMANCE : CPUFREQ_POLICY_POWERSAVE;
}
acpi_cpufreq_driver = driver;
result = cpufreq_register(driver);
if (result) {
kfree(driver);
acpi_cpufreq_driver = NULL;
return_VALUE(result);
}
cpufreq_usage_count++;
return_VALUE(0);
}
static int
acpi_cpufreq_exit (
struct acpi_processor *pr)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_cpufreq_exit");
if (!pr)
return_VALUE(-EINVAL);
if (pr->flags.performance)
cpufreq_usage_count--;
if (!cpufreq_usage_count) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Removing cpufreq driver\n"));
result = cpufreq_unregister();
}
return_VALUE(result);
}
#else
static int
acpi_cpufreq_init (
struct acpi_processor *pr)
{
ACPI_FUNCTION_TRACE("acpi_cpufreq_init_dummy");
return_VALUE(0);
}
static int
acpi_cpufreq_exit (
struct acpi_processor *pr)
{
ACPI_FUNCTION_TRACE("acpi_cpufreq_exit_dummy");
return_VALUE(0);
}
#endif
/* --------------------------------------------------------------------------
FS Interface (/proc)
......@@ -1688,7 +2000,7 @@ acpi_processor_read_power (
return_VALUE(len);
}
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static int
acpi_processor_read_performance (
char *page,
......@@ -1739,7 +2051,6 @@ acpi_processor_read_performance (
return_VALUE(len);
}
static int
acpi_processor_write_performance (
struct file *file,
......@@ -1750,6 +2061,8 @@ acpi_processor_write_performance (
int result = 0;
struct acpi_processor *pr = (struct acpi_processor *) data;
char state_string[12] = {'\0'};
unsigned int new_state = 0;
struct cpufreq_policy policy;
ACPI_FUNCTION_TRACE("acpi_processor_write_performance");
......@@ -1760,14 +2073,20 @@ acpi_processor_write_performance (
return_VALUE(-EFAULT);
state_string[count] = '\0';
new_state = simple_strtoul(state_string, NULL, 0);
result = acpi_processor_set_performance(pr,
simple_strtoul(state_string, NULL, 0));
cpufreq_get_policy(&policy, pr->id);
policy.cpu = pr->id;
policy.max = pr->performance.states[new_state].core_frequency * 1000;
result = cpufreq_set_policy(&policy);
if (result)
return_VALUE(result);
return_VALUE(count);
}
#endif
static int
......@@ -2005,6 +2324,7 @@ acpi_processor_add_fs (
entry->data = acpi_driver_data(device);
}
#ifdef CONFIG_ACPI_PROCESSOR_PERF
/* 'performance' [R/W] */
entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
......@@ -2017,6 +2337,7 @@ acpi_processor_add_fs (
entry->write_proc = acpi_processor_write_performance;
entry->data = acpi_driver_data(device);
}
#endif
/* 'throttling' [R/W] */
entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
......@@ -2139,6 +2460,7 @@ acpi_processor_get_info (
acpi_processor_get_power_info(pr);
acpi_processor_get_performance_info(pr);
acpi_cpufreq_init(pr);
acpi_processor_get_throttling_info(pr);
acpi_processor_get_limit_info(pr);
......@@ -2166,9 +2488,15 @@ acpi_processor_notify (
switch (event) {
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
#ifdef CONFIG_ACPI_PROCESSOR_PERF
result = acpi_processor_get_platform_limit(pr);
if (!result)
acpi_processor_apply_limit(pr);
#else
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Please use kernel with Processor Performance States support included!\n"));
result = 0;
#endif
acpi_bus_generate_event(device, event,
pr->performance.platform_limit);
......@@ -2288,6 +2616,7 @@ acpi_processor_remove (
return_VALUE(-ENODEV);
}
acpi_cpufreq_exit(pr);
acpi_processor_remove_fs(device);
processors[pr->id] = NULL;
......
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
* $Revision: 43 $
* $Revision: 44 $
*
******************************************************************************/
......@@ -771,7 +771,7 @@ acpi_rs_get_pci_routing_table_length (
for (table_index = 0; table_index < 4 && !name_found; table_index++) {
if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
((INTERNAL_TYPE_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
name_found = TRUE;
}
......
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 58 $
* $Revision: 61 $
*
******************************************************************************/
......@@ -66,7 +66,8 @@ acpi_rs_create_resource_list (
ACPI_FUNCTION_TRACE ("Rs_create_resource_list");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_buffer = %p\n", byte_stream_buffer));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Byte_stream_buffer = %p\n",
byte_stream_buffer));
/*
* Params already validated, so we don't re-validate here
......@@ -135,13 +136,13 @@ acpi_rs_create_pci_routing_table (
acpi_buffer *output_buffer)
{
u8 *buffer;
acpi_operand_object **top_object_list = NULL;
acpi_operand_object **sub_object_list = NULL;
acpi_operand_object *package_element = NULL;
acpi_operand_object **top_object_list;
acpi_operand_object **sub_object_list;
acpi_operand_object *obj_desc;
ACPI_SIZE buffer_size_needed = 0;
u32 number_of_elements = 0;
u32 index = 0;
acpi_pci_routing_table *user_prt = NULL;
u32 number_of_elements;
u32 index;
acpi_pci_routing_table *user_prt;
acpi_namespace_node *node;
acpi_status status;
acpi_buffer path_buffer;
......@@ -161,7 +162,8 @@ acpi_rs_create_pci_routing_table (
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n", (u32) buffer_size_needed));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer_size_needed = %X\n",
(u32) buffer_size_needed));
/* Validate/Allocate/Clear caller buffer */
......@@ -171,7 +173,8 @@ acpi_rs_create_pci_routing_table (
}
/*
* Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an
* Loop through the ACPI_INTERNAL_OBJECTS - Each object
* should be a package that in turn contains an
* acpi_integer Address, a u8 Pin, a Name and a u8 Source_index.
*/
top_object_list = package_object->package.elements;
......@@ -194,81 +197,98 @@ acpi_rs_create_pci_routing_table (
* The minus four is to subtract the size of the u8 Source[4] member
* because it is added below.
*/
user_prt->length = (sizeof (acpi_pci_routing_table) -4);
user_prt->length = (sizeof (acpi_pci_routing_table) - 4);
/*
* Dereference the sub-package
* Each element of the top-level package must also be a package
*/
package_element = *top_object_list;
if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X]) Need sub-package, found %s\n",
index, acpi_ut_get_object_type_name (*top_object_list)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Each sub-package must be of length 4 */
if ((*top_object_list)->package.count != 4) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X]) Need package of length 4, found length %d\n",
index, (*top_object_list)->package.count));
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
}
/*
* Dereference the sub-package.
* The Sub_object_list will now point to an array of the four IRQ
* elements: Address, Pin, Source and Source_index
* elements: [Address, Pin, Source, Source_index]
*/
sub_object_list = package_element->package.elements;
sub_object_list = (*top_object_list)->package.elements;
/*
* 1) First subobject: Dereference the Address
* 1) First subobject: Dereference the PRT.Address
*/
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->address = (*sub_object_list)->integer.value;
obj_desc = sub_object_list[0];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->address = obj_desc->integer.value;
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_object_type_name (*sub_object_list)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Address) Need Integer, found %s\n",
index, acpi_ut_get_object_type_name (obj_desc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* 2) Second subobject: Dereference the Pin
* 2) Second subobject: Dereference the PRT.Pin
*/
sub_object_list++;
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->pin = (u32) (*sub_object_list)->integer.value;
obj_desc = sub_object_list[1];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->pin = (u32) obj_desc->integer.value;
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_object_type_name (*sub_object_list)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Pin) Need Integer, found %s\n",
index, acpi_ut_get_object_type_name (obj_desc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* 3) Third subobject: Dereference the Source Name
* 3) Third subobject: Dereference the PRT.Source_name
*/
sub_object_list++;
switch (ACPI_GET_OBJECT_TYPE (*sub_object_list)) {
case INTERNAL_TYPE_REFERENCE:
if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
(*sub_object_list)->reference.opcode));
obj_desc = sub_object_list[2];
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE:
if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Source) Need name, found reference op %X\n",
index, obj_desc->reference.opcode));
return_ACPI_STATUS (AE_BAD_DATA);
}
node = (*sub_object_list)->reference.node;
node = obj_desc->reference.node;
/* Use *remaining* length of the buffer as max for pathname */
path_buffer.length = output_buffer->length -
(u32) ((u8 *) user_prt->source - (u8 *) output_buffer->pointer);
(u32) ((u8 *) user_prt->source -
(u8 *) output_buffer->pointer);
path_buffer.pointer = user_prt->source;
status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
user_prt->length += ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */
user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */
break;
case ACPI_TYPE_STRING:
ACPI_STRCPY (user_prt->source,
(*sub_object_list)->string.pointer);
ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
/* Add to the Length field the length of the string */
user_prt->length += (*sub_object_list)->string.length;
user_prt->length += obj_desc->string.length;
break;
......@@ -285,8 +305,9 @@ acpi_rs_create_pci_routing_table (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_object_type_name (*sub_object_list)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
index, acpi_ut_get_object_type_name (obj_desc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
......@@ -295,20 +316,20 @@ acpi_rs_create_pci_routing_table (
user_prt->length = ACPI_ROUND_UP_TO_64_bITS (user_prt->length);
/*
* 4) Fourth subobject: Dereference the Source Index
* 4) Fourth subobject: Dereference the PRT.Source_index
*/
sub_object_list++;
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_INTEGER) {
user_prt->source_index = (u32) (*sub_object_list)->integer.value;
obj_desc = sub_object_list[3];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->source_index = (u32) obj_desc->integer.value;
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
acpi_ut_get_object_type_name (*sub_object_list)));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Source_index) Need Integer, found %s\n",
index, acpi_ut_get_object_type_name (obj_desc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/* Point to the next acpi_operand_object */
/* Point to the next acpi_operand_object in the top level package */
top_object_list++;
}
......@@ -349,7 +370,8 @@ acpi_rs_create_byte_stream (
ACPI_FUNCTION_TRACE ("Rs_create_byte_stream");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Linked_list_buffer = %p\n", linked_list_buffer));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Linked_list_buffer = %p\n",
linked_list_buffer));
/*
* Params already validated, so we don't re-validate here
......
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
* $Revision: 43 $
* $Revision: 44 $
*
*****************************************************************************/
......@@ -137,7 +137,6 @@ acpi_tb_convert_to_xsdt (
/* Point the table descriptor to the new table */
table_info->pointer = (acpi_table_header *) new_table;
table_info->base_pointer = (acpi_table_header *) new_table;
table_info->length = table_size;
table_info->allocation = ACPI_MEM_ALLOCATED;
......@@ -385,7 +384,6 @@ acpi_tb_convert_table_fadt (void)
/* Install the new table */
table_desc->pointer = (acpi_table_header *) acpi_gbl_FADT;
table_desc->base_pointer = acpi_gbl_FADT;
table_desc->allocation = ACPI_MEM_ALLOCATED;
table_desc->length = sizeof (fadt_descriptor_rev2);
......
/******************************************************************************
*
* Module Name: tbget - ACPI Table get* routines
* $Revision: 80 $
* $Revision: 81 $
*
*****************************************************************************/
......@@ -386,7 +386,6 @@ acpi_tb_get_this_table (
table_info->pointer = full_table;
table_info->length = (ACPI_SIZE) header->length;
table_info->allocation = allocation;
table_info->base_pointer = full_table;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
......
/******************************************************************************
*
* Module Name: tbgetall - Get all required ACPI tables
* $Revision: 2 $
* $Revision: 3 $
*
*****************************************************************************/
......@@ -218,7 +218,13 @@ acpi_tb_get_required_tables (
* Get the tables needed by this subsystem (FADT and any SSDTs).
* NOTE: All other tables are completely ignored at this time.
*/
acpi_tb_get_primary_table (&address, &table_info);
status = acpi_tb_get_primary_table (&address, &table_info);
if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) {
ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n",
acpi_format_exception (status),
ACPI_HIDWORD (address.pointer.value),
ACPI_LODWORD (address.pointer.value)));
}
}
/* We must have a FADT to continue */
......
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
* $Revision: 63 $
* $Revision: 64 $
*
*****************************************************************************/
......@@ -286,7 +286,6 @@ acpi_tb_init_table_descriptor (
table_desc->type = table_info->type;
table_desc->pointer = table_info->pointer;
table_desc->base_pointer = table_info->base_pointer;
table_desc->length = table_info->length;
table_desc->allocation = table_info->allocation;
table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
......@@ -480,12 +479,12 @@ acpi_tb_delete_single_table (
case ACPI_MEM_ALLOCATED:
ACPI_MEM_FREE (table_desc->base_pointer);
ACPI_MEM_FREE (table_desc->pointer);
break;
case ACPI_MEM_MAPPED:
acpi_os_unmap_memory (table_desc->base_pointer, table_desc->length);
acpi_os_unmap_memory (table_desc->pointer, table_desc->length);
break;
default:
......
/******************************************************************************
*
* Module Name: tbrsdt - ACPI RSDT table utilities
* $Revision: 3 $
* $Revision: 4 $
*
*****************************************************************************/
......@@ -108,7 +108,6 @@ acpi_tb_verify_rsdp (
table_info.pointer = ACPI_CAST_PTR (acpi_table_header, rsdp);
table_info.length = sizeof (RSDP_DESCRIPTOR);
table_info.allocation = ACPI_MEM_MAPPED;
table_info.base_pointer = rsdp;
/* Save the table pointers and allocation info */
......
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 104 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -113,7 +113,7 @@ acpi_ut_copy_isimple_to_esimple (
break;
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
/*
* This is an object reference. Attempt to dereference it.
......
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
* $Revision: 91 $
* $Revision: 92 $
*
******************************************************************************/
......@@ -417,7 +417,7 @@ acpi_ut_update_object_reference (
break;
case INTERNAL_TYPE_ADDRESS_HANDLER:
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
/* Must walk list of address handlers */
......@@ -462,7 +462,7 @@ acpi_ut_update_object_reference (
break;
case INTERNAL_TYPE_REGION_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
status = acpi_ut_create_update_state_and_push (
object->field.region_obj, action, &state_list);
......@@ -472,7 +472,7 @@ acpi_ut_update_object_reference (
break;
case INTERNAL_TYPE_BANK_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
status = acpi_ut_create_update_state_and_push (
object->bank_field.bank_obj, action, &state_list);
......@@ -488,7 +488,7 @@ acpi_ut_update_object_reference (
break;
case INTERNAL_TYPE_INDEX_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
status = acpi_ut_create_update_state_and_push (
object->index_field.index_obj, action, &state_list);
......@@ -505,7 +505,7 @@ acpi_ut_update_object_reference (
case ACPI_TYPE_REGION:
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
default:
/* No subobjects */
......
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 171 $
* $Revision: 172 $
*
*****************************************************************************/
......@@ -176,11 +176,11 @@ const NATIVE_CHAR *acpi_gbl_db_sleep_states[ACPI_NUM_SLEEP_STATES] = {
*/
const acpi_predefined_names acpi_gbl_pre_defined_names[] =
{ {"_GPE", INTERNAL_TYPE_SCOPE, NULL},
{"_PR_", INTERNAL_TYPE_SCOPE, NULL},
{ {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
{"_SB_", ACPI_TYPE_DEVICE, NULL},
{"_SI_", INTERNAL_TYPE_SCOPE, NULL},
{"_TZ_", INTERNAL_TYPE_SCOPE, NULL},
{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
{"_TZ_", ACPI_TYPE_LOCAL_SCOPE, NULL},
{"_REV", ACPI_TYPE_INTEGER, "2"},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
{"_GL_", ACPI_TYPE_MUTEX, "0"},
......@@ -225,17 +225,10 @@ const u8 acpi_gbl_ns_properties[] =
ACPI_NS_NORMAL, /* 23 Address Handler */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */
ACPI_NS_NORMAL, /* 26 Def_field_defn */
ACPI_NS_NORMAL, /* 27 Bank_field_defn */
ACPI_NS_NORMAL, /* 28 Index_field_defn */
ACPI_NS_NORMAL, /* 29 If */
ACPI_NS_NORMAL, /* 30 Else */
ACPI_NS_NORMAL, /* 31 While */
ACPI_NS_NEWSCOPE, /* 32 Scope */
ACPI_NS_LOCAL, /* 33 Def_any */
ACPI_NS_NORMAL, /* 34 Extra */
ACPI_NS_NORMAL, /* 35 Data */
ACPI_NS_NORMAL /* 36 Invalid */
ACPI_NS_NEWSCOPE, /* 26 Scope */
ACPI_NS_NORMAL, /* 27 Extra */
ACPI_NS_NORMAL, /* 28 Data */
ACPI_NS_NORMAL /* 29 Invalid */
};
......@@ -481,17 +474,10 @@ static const NATIVE_CHAR *acpi_gbl_ns_type_names[] = /* printable names of AC
/* 23 */ "Addr_handler",
/* 24 */ "Resource_desc",
/* 25 */ "Resource_fld",
/* 26 */ "Region_fld_dfn",
/* 27 */ "Bank_fld_dfn",
/* 28 */ "Index_fld_dfn",
/* 29 */ "If",
/* 30 */ "Else",
/* 31 */ "While",
/* 32 */ "Scope",
/* 33 */ "Def_any",
/* 34 */ "Extra",
/* 35 */ "Data",
/* 36 */ "Invalid"
/* 26 */ "Scope",
/* 27 */ "Extra",
/* 28 */ "Data",
/* 39 */ "Invalid"
};
......@@ -500,7 +486,7 @@ acpi_ut_get_type_name (
acpi_object_type type)
{
if (type > INTERNAL_TYPE_INVALID)
if (type > ACPI_TYPE_INVALID)
{
return ((NATIVE_CHAR *) acpi_gbl_bad_type);
}
......@@ -563,7 +549,7 @@ acpi_ut_get_mutex_name (
*
* FUNCTION: Acpi_ut_valid_object_type
*
* PARAMETERS: None.
* PARAMETERS: Type - Object type to be validated
*
* RETURN: TRUE if valid object type
*
......@@ -576,14 +562,12 @@ acpi_ut_valid_object_type (
acpi_object_type type)
{
if (type > ACPI_TYPE_MAX)
{
if ((type < INTERNAL_TYPE_BEGIN) ||
(type > INTERNAL_TYPE_MAX))
if (type > ACPI_TYPE_LOCAL_MAX)
{
/* Note: Assumes all TYPEs are contiguous (external/local) */
return (FALSE);
}
}
return (TRUE);
}
......@@ -767,7 +751,7 @@ acpi_ut_init_globals (
acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY;
acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
acpi_gbl_root_node_struct.child = NULL;
acpi_gbl_root_node_struct.peer = NULL;
acpi_gbl_root_node_struct.object = NULL;
......
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
* $Revision: 84 $
* $Revision: 85 $
*
******************************************************************************/
......@@ -32,6 +32,98 @@
ACPI_MODULE_NAME ("utmisc")
/*******************************************************************************
*
* FUNCTION: Acpi_ut_print_string
*
* PARAMETERS: String - Null terminated ASCII string
*
* RETURN: None
*
* DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
* sequences.
*
******************************************************************************/
void
acpi_ut_print_string (
char *string,
u8 max_length)
{
u32 i;
if (!string) {
acpi_os_printf ("<\"NULL STRING PTR\">");
return;
}
acpi_os_printf ("\"");
for (i = 0; string[i] && (i < max_length); i++) {
/* Escape sequences */
switch (string[i]) {
case 0x07:
acpi_os_printf ("\\a"); /* BELL */
break;
case 0x08:
acpi_os_printf ("\\b"); /* BACKSPACE */
break;
case 0x0C:
acpi_os_printf ("\\f"); /* FORMFEED */
break;
case 0x0A:
acpi_os_printf ("\\n"); /* LINEFEED */
break;
case 0x0D:
acpi_os_printf ("\\r"); /* CARRIAGE RETURN*/
break;
case 0x09:
acpi_os_printf ("\\t"); /* HORIZONTAL TAB */
break;
case 0x0B:
acpi_os_printf ("\\v"); /* VERTICAL TAB */
break;
case '\'': /* Single Quote */
case '\"': /* Double Quote */
case '\\': /* Backslash */
acpi_os_printf ("\\%c", (int) string[i]);
break;
default:
/* Check for printable character or hex escape */
if (ACPI_IS_PRINT (string[i]))
{
/* This is a normal character */
acpi_os_printf ("%c", (int) string[i]);
}
else
{
/* All others will be Hex escapes */
acpi_os_printf ("\\x%2.2X", (s32) string[i]);
}
break;
}
}
acpi_os_printf ("\"");
if (i == max_length && string[i]) {
acpi_os_printf ("...");
}
}
/*******************************************************************************
*
* FUNCTION: Acpi_ut_dword_byte_swap
......
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
* $Revision: 76 $
* $Revision: 77 $
*
*****************************************************************************/
......@@ -87,7 +87,7 @@ acpi_ut_create_internal_object_dbg (
return_PTR (NULL);
}
second_object->common.type = INTERNAL_TYPE_EXTRA;
second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
second_object->common.reference_count = 1;
/* Link the second object to the first */
......@@ -352,7 +352,7 @@ acpi_ut_get_simple_object_size (
break;
case INTERNAL_TYPE_REFERENCE:
case ACPI_TYPE_LOCAL_REFERENCE:
switch (internal_object->reference.opcode) {
case AML_INT_NAMEPATH_OP:
......
......@@ -110,7 +110,7 @@ clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c
include $(TOPDIR)/Rules.make
$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE)
$(call do_cmd,CONMK $(echo_target),$(objtree)/scripts/conmakehash $< > $@)
$(call do_cmd,CONMK $@,$(objtree)/scripts/conmakehash $< > $@)
$(obj)/defkeymap.o: $(obj)/defkeymap.c
......
......@@ -15,7 +15,3 @@ obj-$(CONFIG_ISDN_DRV_ACT2000) += act2000/
obj-$(CONFIG_ISDN_DRV_EICON) += eicon/
obj-$(CONFIG_HYSDN) += hysdn/
obj-$(CONFIG_ISDN_DRV_TPAM) += tpam/
# The global Rules.make.
include $(TOPDIR)/Rules.make
......@@ -7,5 +7,3 @@ obj-$(CONFIG_ISDN_DRV_ACT2000) += act2000.o
# Multipart objects.
act2000-objs := module.o capi.o act2000_isa.o
include $(TOPDIR)/Rules.make
......@@ -18,7 +18,3 @@ obj-$(CONFIG_ISDN_CAPI_CAPIFS) += capifs.o
kernelcapi-y := kcapi.o capiutil.o capilib.o
kernelcapi-$(CONFIG_PROC_FS) += kcapi_proc.o
kernelcapi-objs := $(kernelcapi-y)
# The global Rules.make.
include $(TOPDIR)/Rules.make
......@@ -7,10 +7,3 @@ obj-$(CONFIG_ISDN_DIVERSION) += dss1_divert.o
# Multipart objects.
dss1_divert-objs := isdn_divert.o divert_procfs.o divert_init.o
include $(TOPDIR)/Rules.make
......@@ -23,5 +23,3 @@ eicon-objs-$(CONFIG_ISDN_DRV_EICON_PCI) += common.o idi.o bri.o pri.o log.o \
linsys.o linio.o
eicon-objs += $(eicon-objs-y)
include $(TOPDIR)/Rules.make
......@@ -4,7 +4,3 @@
obj-$(CONFIG_CAPI_AVM) += avm/
obj-$(CONFIG_CAPI_EICON) += eicon/
# The global Rules.make.
include $(TOPDIR)/Rules.make
......@@ -13,7 +13,3 @@ obj-$(CONFIG_ISDN_DRV_AVMB1_AVM_CS) += avm_cs.o
obj-$(CONFIG_ISDN_DRV_AVMB1_T1ISA) += t1isa.o b1.o
obj-$(CONFIG_ISDN_DRV_AVMB1_T1PCI) += t1pci.o b1.o b1dma.o
obj-$(CONFIG_ISDN_DRV_AVMB1_C4) += c4.o b1.o
# The global Rules.make.
include $(TOPDIR)/Rules.make
......@@ -26,6 +26,3 @@ obj-$(CONFIG_ISDN_DIVAS) += divadidd.o divas.o
obj-$(CONFIG_ISDN_DIVAS_MAINT) += diva_mnt.o
obj-$(CONFIG_ISDN_DIVAS_USERIDI) += diva_idi.o
obj-$(CONFIG_ISDN_DIVAS_DIVACAPI) += divacapi.o
include $(TOPDIR)/Rules.make
......@@ -65,5 +65,3 @@ hisax-objs += $(hisax-objs-y)
CERT := $(shell cd $(src); md5sum -c md5sums.asc > /dev/null 2> /dev/null ;echo $$?)
CFLAGS_cert.o := -DCERTIFICATION=$(CERT)
include $(TOPDIR)/Rules.make
......@@ -14,5 +14,3 @@ hysdn-objs := hysdn_procconf.o hysdn_proclog.o boardergo.o hysdn_boot.o \
hysdn-objs-$(CONFIG_HYSDN_CAPI) += hycapi.o
hysdn-objs += $(hysdn-objs-y)
include $(TOPDIR)/Rules.make
......@@ -25,5 +25,3 @@ isdn-objs-$(CONFIG_ISDN_AUDIO) += isdn_audio.o
isdn-objs-$(CONFIG_ISDN_TTY_FAX) += isdn_ttyfax.o
isdn-objs += $(isdn-objs-y)
include $(TOPDIR)/Rules.make
......@@ -3,5 +3,3 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DRV_ICN) += icn.o
include $(TOPDIR)/Rules.make
......@@ -5,6 +5,3 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_DRV_LOOP) += isdnloop.o
include $(TOPDIR)/Rules.make
......@@ -7,5 +7,3 @@ obj-$(CONFIG_ISDN_DRV_PCBIT) += pcbit.o
# Multipart objects.
pcbit-objs := module.o edss1.o drv.o layer2.o capi.o callbacks.o
include $(TOPDIR)/Rules.make
......@@ -8,5 +8,3 @@ obj-$(CONFIG_ISDN_DRV_SC) += sc.o
sc-objs := shmem.o init.o debug.o packet.o command.o event.o \
ioctl.o interrupt.o message.o timer.o
include $(TOPDIR)/Rules.make
......@@ -8,5 +8,3 @@ obj-$(CONFIG_ISDN_DRV_TPAM) += tpam.o
tpam-objs := tpam_main.o tpam_nco.o tpam_memory.o tpam_commands.o \
tpam_queues.o tpam_hdlc.o tpam_crcpc.o
include $(TOPDIR)/Rules.make
......@@ -24,8 +24,7 @@ endif
clean-files := aic7xxx_seq.h aic7xxx_reg.h
# Command to be executed upon make clean
# Note: Assignment without ':' to force late evaluation of $(src)
clean-rule = @$(MAKE) -C $(src)/aicasm clean
clean-rule := $(MAKE) -C $(src)/aicasm clean
include $(TOPDIR)/Rules.make
......@@ -39,7 +38,7 @@ ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg \
$(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I. -r $(obj)/aic7xxx_reg.h \
$(obj)/aicasm/aicasm -I$(obj) -r $(obj)/aic7xxx_reg.h \
-o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq
$(obj)/aic7xxx_reg.h: $(obj)/aix7xxx_seq.h
......
......@@ -595,6 +595,10 @@ mpage_writepages(struct address_space *mapping,
test_clear_page_dirty(page)) {
if (writepage) {
ret = (*writepage)(page);
if (ret == -EAGAIN) {
__set_page_dirty_nobuffers(page);
ret = 0;
}
} else {
bio = mpage_writepage(bio, page, get_block,
&last_block_in_bio, &ret);
......@@ -605,10 +609,6 @@ mpage_writepages(struct address_space *mapping,
pagevec_deactivate_inactive(&pvec);
page = NULL;
}
if (ret == -EAGAIN && page) {
__set_page_dirty_nobuffers(page);
ret = 0;
}
if (ret || (--(wbc->nr_to_write) <= 0))
done = 1;
if (wbc->nonblocking && bdi_write_congested(bdi)) {
......
......@@ -99,11 +99,7 @@ static ssize_t read_kcore(struct file *file, char *buf, size_t count, loff_t *pp
}
#else /* CONFIG_KCORE_AOUT */
#if VMALLOC_START < PAGE_OFFSET
#define KCORE_BASE VMALLOC_START
#else
#define KCORE_BASE PAGE_OFFSET
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
......
......@@ -84,6 +84,7 @@ enum sparc_cpu {
membar("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad");
#define rmb() membar("#LoadLoad")
#define wmb() membar("#StoreStore")
#define read_barrier_depends() do { } while(0)
#define set_mb(__var, __value) \
do { __var = __value; membar("#StoreLoad | #StoreStore"); } while(0)
#define set_wmb(__var, __value) \
......@@ -93,10 +94,12 @@ enum sparc_cpu {
#define smp_mb() mb()
#define smp_rmb() rmb()
#define smp_wmb() wmb()
#define smp_read_barrier_depends() read_barrier_depends()
#else
#define smp_mb() __asm__ __volatile__("":::"memory");
#define smp_rmb() __asm__ __volatile__("":::"memory");
#define smp_wmb() __asm__ __volatile__("":::"memory");
#define smp_read_barrier_depends() do { } while(0)
#endif
#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
......
......@@ -90,7 +90,7 @@ struct acpi_table_header {
typedef struct {
u8 type;
u8 length;
} acpi_table_entry_header __attribute__ ((packed));
} __attribute__ ((packed)) acpi_table_entry_header;
/* Root System Description Table (RSDT) */
......@@ -143,7 +143,7 @@ typedef struct {
u16 polarity:2;
u16 trigger:2;
u16 reserved:12;
} acpi_interrupt_flags __attribute__ ((packed));
} __attribute__ ((packed)) acpi_interrupt_flags;
struct acpi_table_lapic {
acpi_table_entry_header header;
......@@ -330,7 +330,7 @@ struct acpi_table_ecdt {
acpi_generic_address ec_data;
u32 uid;
u8 gpe_bit;
char *ec_id;
char ec_id[0];
} __attribute__ ((packed));
/* Table Handlers */
......
......@@ -11,13 +11,13 @@ include $(TOPDIR)/Rules.make
# dependencies on generated files need to be listed explicitly
$(obj)/version.o: $(obj)/../include/linux/compile.h
$(obj)/version.o: include/linux/compile.h
# compile.h changes depending on hostname, generation number, etc,
# so we regenerate it always.
# mkcompile_h will make sure to only update the
# actual file if its content has changed.
$(obj)/../include/linux/compile.h: FORCE
@echo -n ' Generating $(echo_target)'
@sh $(srctree)/scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
include/linux/compile.h: FORCE
@echo -n ' Generating $@'
@sh $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
......@@ -192,7 +192,8 @@ static void rcu_process_callbacks(unsigned long unused)
void rcu_check_callbacks(int cpu, int user)
{
if (user ||
(idle_cpu(cpu) && !in_softirq() && hardirq_count() <= 1))
(idle_cpu(cpu) && !in_softirq() &&
hardirq_count() <= (1 << HARDIRQ_SHIFT)))
RCU_qsctr(cpu)++;
tasklet_schedule(&RCU_tasklet(cpu));
}
......
......@@ -8,7 +8,6 @@ obj-$(CONFIG_ATALK) += appletalk.o
appletalk-y := aarp.o ddp.o atalk_proc.o
appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o
appletalk-objs := $(appletalk-y)
include $(TOPDIR)/Rules.make
......@@ -11,7 +11,6 @@ ax25-y := ax25_addr.o ax25_dev.o ax25_iface.o ax25_in.o ax25_ip.o ax25_out.o \
ax25_subr.o ax25_timer.o ax25_uid.o af_ax25.o
ax25-$(CONFIG_AX25_DAMA_SLAVE) += ax25_ds_in.o ax25_ds_subr.o ax25_ds_timer.o
ax25-$(CONFIG_SYSCTL) += sysctl_net_ax25.o
ax25-objs := $(ax25-y)
include $(TOPDIR)/Rules.make
......@@ -6,6 +6,5 @@ obj-$(CONFIG_BT_RFCOMM) += rfcomm.o
rfcomm-y := core.o sock.o crc.o
rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o
rfcomm-objs := $(rfcomm-y)
include $(TOPDIR)/Rules.make
......@@ -5,7 +5,6 @@ decnet-y := af_decnet.o dn_nsp_in.o dn_nsp_out.o dn_route.o dn_dev.o dn_neigh.o
decnet-$(CONFIG_DECNET_ROUTER) += dn_fib.o dn_rules.o dn_table.o
decnet-$(CONFIG_DECNET_FW) += dn_fw.o
decnet-y += sysctl_net_decnet.o
decnet-objs := $(decnet-y)
include $(TOPDIR)/Rules.make
......@@ -6,6 +6,5 @@ obj-$(CONFIG_IPX) += ipx.o
ipx-y := af_ipx.o ipx_proc.o
ipx-$(CONFIG_SYSCTL) += sysctl_net_ipx.o
ipx-objs := $(ipx-y)
include $(TOPDIR)/Rules.make
......@@ -15,6 +15,5 @@ irda-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \
discovery.o parameters.o irsyms.o
irda-$(CONFIG_PROC_FS) += irproc.o
irda-$(CONFIG_SYSCTL) += irsysctl.o
irda-objs := $(irda-y)
include $(TOPDIR)/Rules.make
......@@ -18,7 +18,6 @@ llc-y := llc_if.o llc_c_ev.o llc_c_ac.o llc_mac.o llc_sap.o llc_s_st.o \
llc_main.o llc_s_ac.o llc_conn.o llc_c_st.o llc_stat.o llc_actn.o \
llc_s_ev.o llc_evnt.o llc_pdu.o llc_proc.o
llc-$(CONFIG_LLC_UI) += af_llc.o
llc-objs := $(llc-y)
# Objects that export symbols.
export-objs := llc_if.o
......
......@@ -7,7 +7,6 @@ obj-$(CONFIG_NETROM) += netrom.o
netrom-y := af_netrom.o nr_dev.o nr_in.o nr_loopback.o \
nr_out.o nr_route.o nr_subr.o nr_timer.o
netrom-$(CONFIG_SYSCTL) += sysctl_net_netrom.o
netrom-objs := $(netrom-y)
include $(TOPDIR)/Rules.make
......@@ -7,7 +7,6 @@ obj-$(CONFIG_ROSE) += rose.o
rose-y := af_rose.o rose_dev.o rose_in.o rose_link.o rose_loopback.o \
rose_out.o rose_route.o rose_subr.o rose_timer.o
rose-$(CONFIG_SYSCTL) += sysctl_net_rose.o
rose-objs := $(rose-y)
include $(TOPDIR)/Rules.make
......@@ -23,6 +23,4 @@ sctp-$(CONFIG_SYSCTL) += sysctl.o
sctp-$(subst m,y,$(CONFIG_IPV6)) += ipv6.o
sctp-objs := $(sctp-y)
include $(TOPDIR)/Rules.make
......@@ -13,6 +13,5 @@ sunrpc-y := clnt.o xprt.o sched.o \
sunrpc_syms.o cache.o
sunrpc-$(CONFIG_PROC_FS) += stats.o
sunrpc-$(CONFIG_SYSCTL) += sysctl.o
sunrpc-objs := $(sunrpc-y)
include $(TOPDIR)/Rules.make
......@@ -6,7 +6,6 @@ obj-$(CONFIG_UNIX) += unix.o
unix-y := af_unix.o garbage.o
unix-$(CONFIG_SYSCTL) += sysctl_net_unix.o
unix-objs := $(unix-y)
include $(TOPDIR)/Rules.make
......@@ -8,7 +8,6 @@ x25-y := af_x25.o x25_dev.o x25_facilities.o x25_in.o \
x25_link.o x25_out.o x25_route.o x25_subr.o \
x25_timer.o x25_proc.o
x25-$(CONFIG_SYSCTL) += sysctl_net_x25.o
x25-objs := $(x25-y)
include $(TOPDIR)/Rules.make
# ==========================================================================
# Building
# ==========================================================================
src := $(obj)
.PHONY: __build
__build:
include .config
include $(obj)/Makefile
include scripts/Makefile.lib
ifdef O_TARGET
$(error kbuild: $(obj)/Makefile - Usage of O_TARGET := $(O_TARGET) is obsolete in 2.5. Please fix!)
endif
ifdef L_TARGET
ifneq ($(L_TARGET),lib.a)
$(warning kbuild: $(obj)/Makefile - L_TARGET := $(L_TARGET) target shall be renamed to lib.a. Please fix!)
endif
endif
ifdef list-multi
$(warning kbuild: $(obj)/Makefile - list-multi := $(list-multi) is obsolete in 2.5. Please fix!)
endif
ifndef obj
$(warning kbuild: Makefile.build is included improperly)
endif
# ===========================================================================
# If a Makefile does not define a L_TARGET, link an object called "built-in.o"
ifdef L_TARGET
L_TARGET := $(obj)/$(L_TARGET)
else
O_TARGET := $(obj)/built-in.o
endif
__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
$(if $(KBUILD_MODULES),$(obj-m)) \
$(subdir-ym)
@:
# Compile C sources (.c)
# ---------------------------------------------------------------------------
# Default is built-in, unless we know otherwise
modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE)
$(export-objs) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.i) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.lst): export_flags := $(EXPORT_FLAGS)
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
quiet_cmd_cc_s_c = CC $@
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
%.s: %.c FORCE
$(call if_changed_dep,cc_s_c)
quiet_cmd_cc_i_c = CPP $@
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE
$(call if_changed_dep,cc_i_c)
quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
%.o: %.c FORCE
$(call if_changed_dep,cc_o_c)
quiet_cmd_cc_lst_c = MKLST $@
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && sh scripts/makelst $*.o System.map $(OBJDUMP) > $@
%.lst: %.c FORCE
$(call if_changed_dep,cc_lst_c)
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
%.s: %.S FORCE
$(call if_changed_dep,as_s_S)
quiet_cmd_as_o_S = AS $@
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
%.o: %.S FORCE
$(call if_changed_dep,as_o_S)
targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS)
# Build the compiled-in targets
# ---------------------------------------------------------------------------
# To build objects in subdirs, we need to descend into the directories
$(sort $(subdir-obj-y)): $(subdir-ym) ;
#
# Rule to compile a set of .o files into one .o file
#
ifdef O_TARGET
quiet_cmd_link_o_target = LD $@
# If the list of objects to link is empty, just create an empty O_TARGET
cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE
$(call if_changed,link_o_target)
targets += $(O_TARGET)
endif # O_TARGET
#
# Rule to compile a set of .o files into one .a file
#
ifdef L_TARGET
quiet_cmd_link_l_target = AR $@
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) FORCE
$(call if_changed,link_l_target)
targets += $(L_TARGET)
endif
#
# Rule to link composite objects
#
quiet_cmd_link_multi = LD $@
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
# We would rather have a list of rules like
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,link_multi)
$(multi-used-m) : %.o: $(multi-objs-m) FORCE
$(call if_changed,link_multi)
targets += $(multi-used-y) $(multi-used-m)
# Compile programs on the host
# ===========================================================================
quiet_cmd_host_cc__c = HOSTCC $@
cmd_host_cc__c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $<
$(host-progs-single): %: %.c FORCE
$(call if_changed_dep,host_cc__c)
quiet_cmd_host_cc_o_c = HOSTCC $@
cmd_host_cc_o_c = $(HOSTCC) -Wp,-MD,$(depfile) \
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) -c -o $@ $<
$(host-progs-multi-objs): %.o: %.c FORCE
$(call if_changed_dep,host_cc_o_c)
quiet_cmd_host_cc__o = HOSTLD $@
cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(subst $(obj)/,,$@)-objs)) \
$(HOST_LOADLIBES)
$(host-progs-multi): %: $(host-progs-multi-objs) FORCE
$(call if_changed,host_cc__o)
targets += $(host-progs-single) $(host-progs-multi-objs) $(host-progs-multi)
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) -f scripts/Makefile.build obj=$@
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
.PHONY: FORCE
FORCE:
# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)
endif
# ==========================================================================
# Cleaning up
# ==========================================================================
src := $(obj)
no-rules.make := 1
.PHONY: __clean
__clean:
include $(obj)/Makefile
# Figure out what we need to build from the various variables
# ==========================================================================
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
......@@ -17,26 +21,43 @@ subdir-n += $(__subdir-n)
__subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
subdir- += $(__subdir-)
# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m))
subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
clean-files := $(addprefix $(obj)/,$(clean-files))
host-progs := $(addprefix $(obj)/,$(host-progs))
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
# ==========================================================================
__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files))
quiet_cmd_clean = CLEAN $(obj)
cmd_clean = rm -f $(__clean-files); $(clean-rule)
__clean: $(subdir-ymn)
ifneq ($(strip $(__clean-files) $(clean-rule)),)
rm -f $(__clean-files)
$(clean-rule)
+$(call cmd,clean)
else
@:
endif
.PHONY: $(subdir-ymn)
# ===========================================================================
# Generic stuff
# ===========================================================================
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ymn)
$(subdir-ymn):
$(MAKE) -rR -f scripts/Makefile.clean obj=$@
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# ===========================================================================
# kbuild: Generic definitions
# ===========================================================================
# Standard vars
comma := ,
# Figure out what we need to build from the various variables
# ===========================================================================
# When an object is listed to be built compiled-in and modular,
# only build the compiled-in version
obj-m := $(filter-out $(obj-y),$(obj-m))
# Handle objects in subdirs
# ---------------------------------------------------------------------------
# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o
# and add the directory to the list of dirs to descend into: $(subdir-y)
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
# and add the directory to the list of dirs to descend into: $(subdir-m)
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
subdir-m += $(__subdir-m)
obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
obj-m := $(filter-out %/, $(obj-m))
# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m))
# export.o is never a composite object, since $(export-objs) has a
# fixed meaning (== objects which EXPORT_SYMBOL())
__obj-y = $(filter-out export.o,$(obj-y))
__obj-m = $(filter-out export.o,$(obj-m))
# if $(foo-objs) exists, foo.o is a composite object
multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live
# in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
# Only build module versions for files which are selected to be built
export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m))
host-progs-single := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
host-progs-multi := $(foreach m,$(host-progs),$(if $($(m)-objs),$(m)))
host-progs-multi-objs := $(foreach m,$(host-progs-multi),$($(m)-objs))
# Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
export-objs := $(addprefix $(obj)/,$(export-objs))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
host-progs := $(addprefix $(obj)/,$(host-progs))
host-progs-single := $(addprefix $(obj)/,$(host-progs-single))
host-progs-multi := $(addprefix $(obj)/,$(host-progs-multi))
host-progs-multi-objs := $(addprefix $(obj)/,$(host-progs-multi-objs))
# The temporary file to save gcc -MD generated dependencies must not
# contain a comma
depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
# Shipped files
# ===========================================================================
quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@
%:: %_shipped
$(call cmd,shipped)
# Commands useful for building a boot image
# ===========================================================================
#
# Use as following:
#
# target: source(s) FORCE
# $(if_changed,ld/objcopy/gzip)
#
# and add target to EXTRA_TARGETS so that we know we have to
# read in the saved command line
# Linking
# ---------------------------------------------------------------------------
quiet_cmd_ld = LD $@
cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \
$(filter-out FORCE,$^) -o $@
# Objcopy
# ---------------------------------------------------------------------------
quiet_cmd_objcopy = OBJCOPY $@
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
# Gzip
# ---------------------------------------------------------------------------
quiet_cmd_gzip = GZIP $@
cmd_gzip = gzip -f -9 < $< > $@
# ===========================================================================
# Generic stuff
# ===========================================================================
# function to only execute the passed command if necessary
if_changed = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
echo 'cmd_$@ := $(cmd_$(1))' > $(@D)/.$(@F).cmd)
# execute the command and also postprocess generated .d dependencies
# file
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
scripts/fixdep $(depfile) $@ '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
if_changed_rule = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
mkdir -p $(dir $@); \
$(rule_$(1)))
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# do_cmd is a shorthand used to support both compressed, verbose
# and silent output in a single line.
# Compared to cmd described avobe, do_cmd does no rely on any variables
# previously assigned a value.
#
# Usage $(call do_cmd,CMD $@,cmd_to_execute bla bla)
# Example:
# $(call do_cmd,CP $@,cp -b $< $@)
# make -s => nothing will be printed
# make KBUILD_VERBOSE=1 => cp -b path/to/src.file path/to/dest.file
# make KBUILD_VERBOSE=0 => CP path/to/dest.file
define do_cmd
@$(if $(filter quiet_,$(quiet)), echo ' $(1)' &&,
$(if $(filter silent_,$(quiet)),,
echo "$(2)" &&)) \
$(2)
endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
descend = $(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
# ==========================================================================
# Installing modules
# ==========================================================================
src := $(obj)
.PHONY: modules_install
modules_install:
include .config
include $(obj)/Makefile
include scripts/Makefile.lib
# ==========================================================================
quiet_cmd_modules_install = INSTALL $(obj-m)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \
cp $(obj-m) $(MODLIB)/kernel/$(obj)
modules_install: $(subdir-ym)
ifneq ($(obj-m),)
$(call cmd,modules_install)
else
@:
endif
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$@
# ===========================================================================
# Module versions
# ===========================================================================
src := $(obj)
.PHONY: modver
modver:
include .config
include $(obj)/Makefile
include scripts/Makefile.lib
# ===========================================================================
ifeq ($(strip $(export-objs)),)
# If we don't export any symbols in this dir, just descend
# ---------------------------------------------------------------------------
modver: $(subdir-ym)
@:
else
# This sets version suffixes on exported symbols
# ---------------------------------------------------------------------------
MODVERDIR := include/linux/modules
#
# Added the SMP separator to stop module accidents between uniprocessor
# and SMP Intel boxes - AC - from bits by Michael Chastain
#
ifdef CONFIG_SMP
genksyms_smp_prefix := -p smp_
else
genksyms_smp_prefix :=
endif
# Don't include modversions.h, we're just about to generate it here.
CFLAGS_MODULE := $(filter-out -include include/linux/modversions.h,$(CFLAGS_MODULE))
$(addprefix $(MODVERDIR)/,$(real-objs-y:.o=.ver)): modkern_cflags := $(CFLAGS_KERNEL)
$(addprefix $(MODVERDIR)/,$(real-objs-m:.o=.ver)): modkern_cflags := $(CFLAGS_MODULE)
$(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)): export_flags := -D__GENKSYMS__
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
# Our objects only depend on modversions.h, not on the individual .ver
# files (fix-dep filters them), so touch modversions.h if any of the .ver
# files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$*.ver
cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
# Okay, let's explain what's happening in rule_make_cc_ver_c:
# o echo the command
# o execute the command
# o If the $(CPP) fails, we won't notice because it's output is piped
# to $(GENKSYMS) which does not fail. We recognize this case by
# looking if the generated $(depfile) exists, though.
# o If the .ver file changed, touch modversions.h, which is our marker
# of any changed .ver files.
# o Move command line and deps into their normal .*.cmd place.
define rule_cc_ver_c
$(if $($(quiet)cmd_cc_ver_c),echo ' $($(quiet)cmd_cc_ver_c)';) \
$(cmd_cc_ver_c); \
if [ ! -r $(depfile) ]; then exit 1; fi; \
scripts/fixdep $(depfile) $@ '$(cmd_cc_ver_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch include/linux/modversions.h; \
fi; \
mv -f $@.tmp $@
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
$(MODVERDIR)/%.ver: %.c FORCE
@$(call if_changed_rule,cc_ver_c)
modver: $(targets) $(subdir-ym)
@mkdir -p $(dir $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver)))
@touch $(addprefix .tmp_export-objs/modules/,$(export-objs:.o=.ver))
endif # export-objs
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) -f scripts/Makefile.modver obj=$@
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
.PHONY: FORCE
FORCE:
# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
# exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment