A patch in -mm kernel correct the parsing of "address resources" of pnpacpi.
Before we assumed it was memory only, but it could be also IO.
But this change show an hidden bug : some resources could be producer type
that are not handled by pnp layer. So we should ignore the producer
resources.
This patch fixes bug 6292 (http://bugzilla.kernel.org/show_bug.cgi?id=6292).
Some devices like PNP0A03 have 0xd00-0xffff and 0x0-0xcf7 as IO producer
resources.
Before correcting "address resources" parsing, it was seen as memory and was
harmless, because nobody tried to reserve this memory range as it should be
IO.
With the correction it become IO resources, and make failed all others device
that want to register IO in this range and use pnp layer (like a ISA sound
card).
The solution is to ignore producer resources
Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Uwe Bugla <uwe.bugla@gmx.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: "Brown, Len" <len.brown@intel.com>
Acked-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Some resource_size_t values are fed to printk() without handling the fact
that they can have different size depending on your .config.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
swsusp is unable to suspend my machine (DTK FortisPro TOP-5A notebook) with
kernel 2.6.17.5 because it's unable to suspend PNP device 00:16 (mouse).
The problem is in PNP BIOS. pnp_bus_suspend() calls pnp_stop_dev() for the
device if the device can be disabled according to pnp_can_disable(). The
problem is that pnpbios_disable_resources() returns -EPERM if the device is
not dynamic (!pnpbios_is_dynamic()) but insert_device() happily sets
PNP_DISABLE capability/flag even if the device is not dynamic. So we try
to disable non-dynamic devices which will fail. This patch prevents
insert_device() from setting PNP_DISABLE if the device is not dynamic and
fixes suspend on my system.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ACPI supplies a "shareable" indication, but PNPACPI ignores it. If a PNP
device uses a shared interrupt, request_irq() fails because the PNP driver
can't tell whether to supply SA_SHIRQ.
This patch allows PNP drivers to test
(pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE)
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Matthieu Castet <castet.matthieu@free.fr>
Cc: Li Shaohua <shaohua.li@intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Suppress the "setup_irq: irq handler mismatch" coming out of pnp_check_irq():
failures are expected here.
Cc: <stable@kernel.org>
Cc: Santiago Garcia Mantinan <manty@manty.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Based on a patch series originally from Vivek Goyal <vgoyal@in.ibm.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
We can leak `clink' if drv->probe == 0.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The wording of two messages in drivers/pnp/manager.c is incorrect. Fix that.
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Tidy up whitespace. No functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Factor out the duplicated switch from pnpacpi_count_resources() and
pnpacpi_type_resources(). Remove the unnecessary re-initialization of
resource->type and length from all the encode functions (id and length are
originally set in the pnpacpi_build_resource_template() ->
pnpacpi_type_resources() path).
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Fix resource_type handling for QWORD, DWORD, and WORD Address Space
Descriptors. Previously we ignored the resource_type, so I/O ports and bus
number ranges were incorrectly parsed as memory ranges.
Sample PCI root bridge resources from HP rx2600 before this patch:
# cat /sys/bus/pnp/devices/00:02/resources
state = active
mem 0x0-0x1f
mem 0x0-0x3af
mem 0x3e0-0x1fff
mem 0x80000000-0x8fffffff
With this patch:
# cat /sys/bus/pnp/devices/00:02/resources
state = active
io 0x0-0x3af
io 0x3e0-0x1fff
mem 0x80000000-0x8fffffff
mem 0x80004000000-0x80103fffffe
Changes:
0x0-0x1f PCI bus number range was incorrectly reported as memory, now
not reported at all
0x0-0x3af I/O port range was incorrectly reported as memory
0x3e0-0x1fff I/O port range was incorrectly reported as memory
0x80004000000-0x80103fffffe memory range wasn't reported at all because
we only support PNP_MAX_MEM (4) memory resources
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Remove the assumption that pnp_register_driver() returns the number of devices
claimed. Returning the count is unreliable because devices may be hot-plugged
in the future.
This changes the convention to "zero for success, or a negative error value,"
which matches pci_register_driver(), acpi_bus_register_driver(), and
platform_driver_register().
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jens Axboe <axboe@suse.de>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Cc: Greg KH <greg@kroah.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Spotted by the Coverity checker as bug #666
akpm; there are several other `return 1;'s in there which aren't freeing
`dev'. (A fix which converts this function to single-exit would be
preferred..)
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Without the attached, the kernel complains about my BIOS' PNP tables. It
was ACKed before, but never merged:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110237794007900&w=2
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This is Adam's pnp probing fix. It's been reported to fix hangs on several
people's machines. I don't know if it's official or final, and Adam isn't
contactable at present. But I'm not aware of the patch causing any
regressions.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Rather than tweaking acpi_walk_resource() again not return end tags,
modify the pnpacpi code to ignore them.
The pnpacpi resource type switch statements now include all known
types in the order that they're defined -- so it is easy to see
what is not implemented. The code will squawk only if it sees
a truly undefined type.
Signed-off-by: Len Brown <len.brown@intel.com>
Clean the blacklist. Battery, Button, Fan have no _CRS
and can be removed. PCI root is in pnpbios and is harmless.
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: "Li, Shaohua" <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Ignore devices that don't have a _CRS method.
They are useless for the PNP layer as they don't provide any resources.
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
PNPACPI complained about and ignored devices with ADDRESS16, ADDRESS32, or
ADDRESS64 descriptors in _PRS. HP firmware uses them for built-in serial
ports, so this patch adds support for parsing these descriptors from _PRS.
Note that this does not add the corresponding support for encoding them in
preparation for _SRS, because I don't have any machine that supports _SRS
on these descriptors, so I couldn't test that support. Attempts to encode
them will cause a warning and an -EINVAL return.
http://sourceforge.net/mailarchive/forum.php?thread_id=8250154&forum_id=6102
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
PnP BIOS data, code, and 32-bit entry segments all have fixed limits as well;
set them in the GDT rather than adding more code. It would be nice to add
these fixups to the boot GDT rather than setting the GDT for each CPU; perhaps
I can wiggle this in later, but getting it in before the subsys init looks
tricky.
Also, make some progress on deprecating the ugly Q_SET_SEL macros.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The one remaining caller of set_limit, the PnP BIOS code, calls into the PnP
BIOS, passing kernel parameters in and out. These parameteres may be passed
from arbitrary kernel virtual memory, so they deserve strict protection to
stop a bad BIOS from smashing beyond the object size.
Unfortunately, the use of set_limit was badly botching this by setting the
limit in terms of pages, when it really should have byte granularity.
When doing this, I discovered my BIOS had the buggy code during the "get
system device node" call:
mov ax, es:[bx]
Which is harmless, but has a trivial workaround.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Move PnP BIOS segment definitions into segment.h; the segments are reserved
here, so they might as well be defined here as well.
Note I didn't do this for APM BIOS, as Macintosh and other systems use those
values to emulate APM in some scary way I don't want to understand.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Acked-by: "Seth, Rohit" <rohit.seth@intel.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Make GDT page aligned and page padded to support running inside of a
hypervisor. This prevents false sharing of the GDT page with other hot
data, which is not allowed in Xen, and causes performance problems in
VMware.
Rather than go back to the old method of statically allocating the GDT
(which wastes unneded space for non-present CPUs), the GDT for APs is
allocated dynamically.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
These days we use udev to manage all kernel events. /proc/sys/kernel/hotplug
will usually be disabled by an init-script. pnpnbios is not integrated with
the driver core and should stay away from the now disabled /sbin/hotplug.
Set the helper to /sbin/phpbios, even when there is probably no current
user of this faciliy. If it's needed, it should definitely get proper driver
core integration instead of forking binaries from the kernel.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Also use the PnP functions to start/stop the devices during the suspend so
that drivers will not have to duplicate this code.
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Implemented support for the EM64T and other x86_64
processors. This essentially entails recognizing
that these processors support non-aligned memory
transfers. Previously, all 64-bit processors were assumed
to lack hardware support for non-aligned transfers.
Completed conversion of the Resource Manager to nearly
full table-driven operation. Specifically, the resource
conversion code (convert AML to internal format and the
reverse) and the debug code to dump internal resource
descriptors are fully table-driven, reducing code and data
size and improving maintainability.
The OSL interfaces for Acquire and Release Lock now use a
64-bit flag word on 64-bit processors instead of a fixed
32-bit word. (Alexey Starikovskiy)
Implemented support within the resource conversion code
for the Type-Specific byte within the various ACPI 3.0
*WordSpace macros.
Fixed some issues within the resource conversion code for
the type-specific flags for both Memory and I/O address
resource descriptors. For Memory, implemented support
for the MTP and TTP flags. For I/O, split the TRS and TTP
flags into two separate fields.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- core.c: pnp_remove_device
- #if 0 the following unneeded EXPORT_SYMBOL's:
- card.c: pnp_add_card
- card.c: pnp_remove_card
- card.c: pnp_add_card_device
- card.c: pnp_remove_card_device
- card.c: pnp_add_card_id
- core.c: pnp_register_protocol
- core.c: pnp_unregister_protocol
- core.c: pnp_add_device
- core.c: pnp_remove_device
- pnpacpi/core.c: pnpacpi_protocol
- driver.c: pnp_add_id
- isapnp/core.c: isapnp_read_byte
- manager.c: pnp_auto_config_dev
- resource.c: pnp_register_dependent_option
- resource.c: pnp_register_independent_option
- resource.c: pnp_register_irq_resource
- resource.c: pnp_register_dma_resource
- resource.c: pnp_register_port_resource
- resource.c: pnp_register_mem_resource
Note that this patch #if 0's exactly one functions and removes no
functions. Most it does is the #if 0 of EXPORT_SYMBOL's, so if any modular
code will use any of them, re-adding will be trivial.
Modular ISAPnP might be interesting in some cases, but this is more legacy
code. If someone would work on it to sort all the issues out (starting
with the point that most users of __ISAPNP__ will have to be fixed)
re-enabling the required EXPORT_SYMBOL's won't be hard for him.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
I recently picked up my older work to remove unnecessary #includes of
sched.h, starting from a patch by Dave Jones to not include sched.h
from module.h. This reduces the number of indirect includes of sched.h
by ~300. Another ~400 pointless direct includes can be removed after
this disentangling (patch to follow later).
However, quite a few indirect includes need to be fixed up for this.
In order to feed the patches through -mm with as little disturbance as
possible, I've split out the fixes I accumulated up to now (complete for
i386 and x86_64, more archs to follow later) and post them before the real
patch. This way this large part of the patch is kept simple with only
adding #includes, and all hunks are independent of each other. So if any
hunk rejects or gets in the way of other patches, just drop it. My scripts
will pick it up again in the next round.
Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Seems pointless to require .c files to test CONFIG_PNP_DEBUG and
conditionally define DEBUG before including <linux/pnp.h>. Just test
CONFIG_PNP_DEBUG directly in pnp.h.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ISAPNP, PNPBIOS, and PNPACPI all had their own kmalloc wrappers that
reimplemented kcalloc(). Remove the wrappers and just use kcalloc()
directly.
Note that this also removes the PNPBIOS error message when the kmalloc
fails.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Move pcibios_penalize_isa_irq() to pnpacpi_parse_allocated_irqresource().
Previously we passed the GSI, not the IRQ, and we did it even if parsing
the IRQ resource failed.
Parse IRQ descriptors that contain multiple interrupts. This violates the
spec (in _CRS, only one interrupt per descriptor is allowed), but some
firmware, e.g., HP rx7620 and rx8620 descriptions of HPET, has this bug.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
The error path in pnp_request_card_device() is broken (one variable is
left initialized and the semaphore is not unlocked).
This fixes it (and has been tested).
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>