]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
15 years agoPCI PM: Split PCI Express port suspend-resume
Rafael J. Wysocki [Sat, 27 Dec 2008 15:28:58 +0000 (16:28 +0100)]
PCI PM: Split PCI Express port suspend-resume

Suspend-resume of PCI Express ports has recently been moved into
_suspend_late() and _resume_early() callbacks, but some functions
executed from there should not be called with interrupts disabled,
eg. pci_enable_device().  For this reason, split the suspend-resume
of PCI Express ports into parts to be executed with interrupts
disabled and with interrupts enabled.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI PM: Fix pci_update_current_state
Rafael J. Wysocki [Sat, 27 Dec 2008 15:30:52 +0000 (16:30 +0100)]
PCI PM: Fix pci_update_current_state

Currently, PCI devices without the PM capability that are power
manageable by the platform (eg. ACPI) are not handled correctly
by pci_set_power_state(), because their current_state field is not
updated to reflect the new power state of the device.  Fix this by
making pci_update_current_state() accept additional argument
representing the power state of the device as set by the platform.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: set device wakeup capable flag if platform support is present
Jesse Barnes [Wed, 17 Dec 2008 20:10:05 +0000 (12:10 -0800)]
PCI: set device wakeup capable flag if platform support is present

When PCI devices are initialized, we check whether they support PCI PM
caps and set the device can_wakeup flag if so.  However, some devices
may have platform provided wakeup events rather than PCI PME signals, so
we need to set can_wakeup in that case too.  Doing so should allow
wakeups from many more devices, especially on cost constrained systems.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Joseph Chan <JosephChan@via.com.tw>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: factor pci_bus_add_child() from pci_bus_add_devices()
Yu Zhao [Fri, 21 Nov 2008 18:42:35 +0000 (02:42 +0800)]
PCI: factor pci_bus_add_child() from pci_bus_add_devices()

This patch splits a new function, pci_bus_add_child(), from
pci_bus_add_devices(). The new function can be used to register PCI
buses to the device core.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: cleanup pci_bus_add_devices()
Yu Zhao [Fri, 21 Nov 2008 18:41:45 +0000 (02:41 +0800)]
PCI: cleanup pci_bus_add_devices()

Cleanup pci_bus_add_devices() by negating the conditional and
continuing, rather than having a single conditional take up the whole
body.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: add a new function to map BAR offsets
Yu Zhao [Fri, 21 Nov 2008 18:41:27 +0000 (02:41 +0800)]
PCI: add a new function to map BAR offsets

Add a function to map a given resource number to a corresponding
register so drivers can get the offset and type of device specific BARs.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: allow pci_alloc_child_bus() to handle a NULL bridge
Yu Zhao [Fri, 21 Nov 2008 18:41:07 +0000 (02:41 +0800)]
PCI: allow pci_alloc_child_bus() to handle a NULL bridge

Allow pci_alloc_child_bus() to allocate buses without bridge devices.
Some SR-IOV devices can occupy more than one bus number, but there is no
explicit bridges because that have internal routing mechanism.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: export __pci_read_base()
Yu Zhao [Fri, 21 Nov 2008 18:40:40 +0000 (02:40 +0800)]
PCI: export __pci_read_base()

Export __pci_read_base() so it can be used by whole PCI subsystem.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: remove unnecessary condition check in pci_restore_bars()
Yu Zhao [Fri, 21 Nov 2008 18:40:00 +0000 (02:40 +0800)]
PCI: remove unnecessary condition check in pci_restore_bars()

Remove the unnecessary number of resources condition checks because
the pci_update_resource() will check availability of the resources.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: define PCI resource names in an 'enum'
Yu Zhao [Fri, 21 Nov 2008 18:39:32 +0000 (02:39 +0800)]
PCI: define PCI resource names in an 'enum'

This patch moves all definitions of the PCI resource names to an 'enum',
and also replaces some hard-coded resource variables with symbol
names. This change eases introduction of device specific resources.

Reviewed-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: remove unnecessary arg of pci_update_resource()
Yu Zhao [Fri, 21 Nov 2008 18:38:52 +0000 (02:38 +0800)]
PCI: remove unnecessary arg of pci_update_resource()

This cleanup removes unnecessary argument 'struct resource *res' in
pci_update_resource(), so it takes same arguments as other companion
functions (pci_assign_resource(), etc.).

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: enhance pci_ari_enabled()
Yu Zhao [Fri, 21 Nov 2008 18:38:21 +0000 (02:38 +0800)]
PCI: enhance pci_ari_enabled()

Change parameter of pci_ari_enabled() from 'pci_dev' to 'pci_bus'.

ARI forwarding on the bridge mostly concerns the subordinate devices
rather than the bridge itself. So this change will make the function
easier to use.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI quirks: piix3: warn softer about enabling passive release
Adam Jackson [Mon, 1 Dec 2008 22:30:29 +0000 (14:30 -0800)]
PCI quirks: piix3: warn softer about enabling passive release

All the other quirks are dev_info() not dev_err(), this one isn't special.
This makes 'quiet' boot in qemu really quiet.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Make settable sysfs attributes more consistent
Trent Piepho [Mon, 1 Dec 2008 01:10:12 +0000 (17:10 -0800)]
PCI: Make settable sysfs attributes more consistent

PCI devices have three settable boolean attributes, enable,
broken_parity_status, and msi_bus.

The store functions for these would silently interpret "0x01" as false,
"1llogical" as true, and "true" would be (silently!) ignored and do
nothing.

This is inconsistent with typical sysfs handling of settable attributes,
and just plain doesn't make much sense.

So, use strict_strtoul(), which was created for this purpose.  The store
functions will treat a value of 0 as false, non-zero as true, and return
-EINVAL for a parse failure.

Additionally, is_enabled_store() and msi_bus_store() return -EPERM if
CAP_SYS_ADMIN is lacking, rather than silently doing nothing.  This is more
typical behavior for sysfs attributes that need a capability.

And msi_bus_store() will only print the "forced subordinate bus ..."
warning if the MSI flag was actually forced to a different value.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: uninline pci_ioremap_bar()
Andrew Morton [Mon, 1 Dec 2008 22:30:30 +0000 (14:30 -0800)]
PCI: uninline pci_ioremap_bar()

It's too large to be inlined.

Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: fix incorrect error return in pci_enable_wake
Alan Stern [Tue, 16 Dec 2008 19:06:58 +0000 (14:06 -0500)]
PCI: fix incorrect error return in pci_enable_wake

This patch (as1186) fixes a minor mistake in pci_enable_wake().  When
the routine is asked to disable remote wakeup, it should not return an
error merely because the device is not allowed to do wakeups!

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: parisc: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:22 +0000 (16:12 -0700)]
PCI: parisc: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Acked-by: Kyle McMartin <kyle@infradead.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: mips: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:17 +0000 (16:12 -0700)]
PCI: mips: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: x86: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:37 +0000 (16:12 -0700)]
PCI: x86: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: alpha: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:07 +0000 (16:12 -0700)]
PCI: alpha: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: powerpc: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:27 +0000 (16:12 -0700)]
PCI: powerpc: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: sh: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:32 +0000 (16:12 -0700)]
PCI: sh: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: arm: use generic pci_swizzle_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:12:12 +0000 (16:12 -0700)]
PCI: arm: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: add pci_swizzle_interrupt_pin()
Bjorn Helgaas [Thu, 11 Dec 2008 18:24:23 +0000 (11:24 -0700)]
PCI: add pci_swizzle_interrupt_pin()

This patch adds pci_swizzle_interrupt_pin(), which implements the
INTx swizzling algorithm specified in Table 9-1 of the "PCI-to-PCI
Bridge Architecture Specification," revision 1.2.

There are many architecture-specific implementations of this
swizzle that can be replaced by this common one.

Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agox86/PCI: minor logic simplications
Bjorn Helgaas [Tue, 9 Dec 2008 23:11:57 +0000 (16:11 -0700)]
x86/PCI: minor logic simplications

Test "pin" immediately to simplify the subsequent code.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agox86/PCI: use config space encoding for interrupt pins
Bjorn Helgaas [Tue, 9 Dec 2008 23:11:51 +0000 (16:11 -0700)]
x86/PCI: use config space encoding for interrupt pins

Keep "pin" encoded as it is in the "Interrupt Pin" value in PCI config
space, i.e., 0=device doesn't use interrupts, 1=INTA, ..., 4=INTD.

This makes the bridge INTx swizzle match other architectures.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: use config space encoding in pci_get_interrupt_pin()
Bjorn Helgaas [Tue, 9 Dec 2008 23:11:46 +0000 (16:11 -0700)]
PCI: use config space encoding in pci_get_interrupt_pin()

This patch makes pci_get_interrupt_pin() return values encoded
the same way as the "Interrupt Pin" value in PCI config space,
i.e., 1=INTA, ..., 4=INTD.

pirq_bios_set() is the only in-tree caller of pci_get_interrupt_pin()
and pci_get_interrupt_pin() is not exported.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI hotplug: cpqphp: use config space PCI interrupt pin encoding
Bjorn Helgaas [Tue, 9 Dec 2008 23:11:41 +0000 (16:11 -0700)]
PCI hotplug: cpqphp: use config space PCI interrupt pin encoding

This patch changes cpqphp to use interrupt pin values just as they
come from PCI config space, i.e., 1=INTA, ..., 4=INTD.

pcibios_set_irq_routing() takes pin arguments in the range 0=INTA, ...,
3=INTD, so we'll adjust the pin just before calling it.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: avoid early PCI mmconfig init if pci=noearly is given in cmdline
Jacob Pan [Mon, 8 Dec 2008 17:44:16 +0000 (09:44 -0800)]
PCI: avoid early PCI mmconfig init if pci=noearly is given in cmdline

Early type 1 accesses can cause problems on some platforms, and
pci=noearly is supposed to prevent them from occurring.  However, early
mcfg probing code uses type 1 and  isn't protected by a check for
noearly.  This patch fixes that problem.

Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: pcie port driver: remove extra printks
Bjorn Helgaas [Wed, 10 Dec 2008 20:00:21 +0000 (13:00 -0700)]
PCI: pcie port driver: remove extra printks

These printks don't contain enough information to be useful.  I think it
would be more useful to have a message when a service driver binds to a
root port.  That could contain the service type, the interrupt mode and
IRQ, etc.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agox86/PCI: make PCI bus locality messages more meaningful
Bjorn Helgaas [Wed, 10 Dec 2008 20:12:00 +0000 (13:12 -0700)]
x86/PCI: make PCI bus locality messages more meaningful

Change PCI bus locality messages so they have a bit more context
and look like the rest of PCI, e.g.,

    - bus 01 -> node 0
    - bus 04 -> node 0
    + pci 0000:01: bus on NUMA node 0
    + pci 0000:04: bus on NUMA node 0

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: make PCI bus resource messages more meaningful
Bjorn Helgaas [Wed, 10 Dec 2008 20:02:18 +0000 (13:02 -0700)]
PCI: make PCI bus resource messages more meaningful

Change PCI bus resource messages so they have a bit more context
and look like the rest of PCI, e.g.,

    - bus: 00 index 0 io port: [0x00-0xffff]
    - bus: 00 index 1 mmio: [0x000000-0xffffffff]
    + pci 0000:00: bus resource 0 io : [0x00-0xffff]
    + pci 0000:00: bus resource 1 mem: [0x000000-0xffffffff]

This also changes them from KERN_INFO to KERN_DEBUG.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI hotplug: acpiphp whitespace cleanup
Alex Chiang [Thu, 11 Dec 2008 18:17:55 +0000 (11:17 -0700)]
PCI hotplug: acpiphp whitespace cleanup

Clean up whitespace.

Setting 'let c_space_errors=1' in .vimrc shows all sorts of
ugliness. ;)

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Don't carp about BAR allocation failures in quiet boot
Ingo Molnar [Fri, 12 Dec 2008 05:49:40 +0000 (06:49 +0100)]
PCI: Don't carp about BAR allocation failures in quiet boot

These are easy to trigger (more or less harmlessly) with multiple video
cards, since the ROM BAR will typically not be given any space by the
BIOS bridge setup.  No reason to punish quiet boot for this.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI hotplug: aerdrv: fix a typo in error message
Hidetoshi Seto [Fri, 5 Dec 2008 05:05:23 +0000 (14:05 +0900)]
PCI hotplug: aerdrv: fix a typo in error message

"TLP" is an acronym for "Transaction Layer Packet."

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: handle PCI state saving with interrupts disabled
Rafael J. Wysocki [Sun, 7 Dec 2008 21:02:58 +0000 (22:02 +0100)]
PCI: handle PCI state saving with interrupts disabled

Since interrupts will soon be disabled at PCI resume time, we need to
pre-allocate memory to save/restore PCI config space (or use GFP_ATOMIC,
but this is safer).

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: extend on the ICH motherboard IO decode quirk list
Linus Torvalds [Sat, 6 Dec 2008 18:10:10 +0000 (10:10 -0800)]
PCI: extend on the ICH motherboard IO decode quirk list

This adds more LPC controller IO range decode quirks for the Intel ICH
family of chipsets. They differ a bit between the older ICH6 chipset and
the more modern layout of the ICH7-ICH10 chipsets.

This patch just prints out the IO decode information found by the quirks,
but eventually we may want to add them to the resource tree, in order to
know to avoid allocating things over them.

That's especially true if it turns out that any firmware ends up putting
the magic motherboard resources in an address range that we use for
dynamic allocations (ie above PCIBIOS_MIN_IO, which is 0x1000 on x86).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Greg KH <greg@kroah.com>
Cc: Frans Pop <elendil@planet.nl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Suspend and resume PCI Express ports with interrupts disabled
Rafael J. Wysocki [Sat, 6 Dec 2008 14:07:59 +0000 (15:07 +0100)]
PCI: Suspend and resume PCI Express ports with interrupts disabled

I don't see why the suspend and resume of PCI Express ports should be
handled with interrupts enabled and it may even lead to problems in
some situations.  For this reason, move the suspending and resuming
of PCI Express ports into ->suspend_late() and ->resume_early()
callbacks executed with interrupts disabled.

This patch addresses the regression from 2.6.26 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12121 .

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: pci-stub module to reserve pci device
Chris Wright [Wed, 26 Nov 2008 05:17:13 +0000 (21:17 -0800)]
PCI: pci-stub module to reserve pci device

When doing device assignment with KVM there's currently nothing to
protect the device from having a driver in the host as well as the guest.
This trivial module just binds the pci device on the host to a stub
driver so that a real host driver can't bind to the device.  It has no
pci id table, it supports only dynamic ids.

 # echo "8086 10f5" > /sys/bus/pci/drivers/pci-stub/new_id
 # echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind
 # echo -n 0000:00:19.0 > /sys/bus/pci/drivers/pci-stub/bind
 # ls -l /sys/bus/pci/devices/0000:00:19.0/driver
 lrwxrwxrwx 1 root root 0 2008-11-25 19:10 /sys/bus/pci/devices/0000:00:19.0/driver -> ../../../bus/pci/drivers/pci-stub

Cc: "Kay, Allen M" <allen.m.kay@intel.com>
Cc: "Nakajima, Jun" <jun.nakajima@intel.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: allow pci driver to support only dynids
Chris Wright [Wed, 26 Nov 2008 03:36:10 +0000 (19:36 -0800)]
PCI: allow pci driver to support only dynids

commit b41d6cf38e27 (PCI: Check dynids driver_data value for validity)
requires all drivers to include an id table to try and match
driver_data.  Before validating driver_data check driver has an id
table.

Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Milton Miller <miltonm@bga.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI/ACPI: acpiphp: Identify more removable slots
Matthew Garrett [Tue, 25 Nov 2008 21:48:14 +0000 (21:48 +0000)]
PCI/ACPI:  acpiphp: Identify more removable slots

According to section 6.3.6 of the ACPI spec, the presence of an _RMV
method that evaluates to 1 is sufficient to indicate that a slot is
removable without needing an eject method. This patch refactors the
ejectable slot detection code a little in order to flag these slots as
ejectable and register them. Acpihp then binds to the expresscard slot
on my HP test machine.

Acked-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agopci-acpi: Cleanup _OSC evaluation code
Taku Izumi [Thu, 20 Nov 2008 06:22:39 +0000 (15:22 +0900)]
pci-acpi: Cleanup _OSC evaluation code

Cleanup _OSC evaluation code.  Some whitespace changes and a few other
minor cleanups.

Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Tested-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI/ACPI: Remove unnecessary _OSC evaluation for control request
Taku Izumi [Thu, 20 Nov 2008 06:22:37 +0000 (15:22 +0900)]
PCI/ACPI: Remove unnecessary _OSC evaluation for control request

If a control had already been granted, we don't need to re-evaluate
_OSC for it because firmware may not reject control of any feature it
has previously granted control to.

Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Tested-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: revert additional _OSC evaluation
Taku Izumi [Thu, 20 Nov 2008 06:22:32 +0000 (15:22 +0900)]
PCI: revert additional _OSC evaluation

Reverts adf411b819adc9fa96e9b3e638c7480d5e71d270.

The commit adf411b819adc9fa96e9b3e638c7480d5e71d270 was based on the
improper assumption that queried result was not updated when _OSC
support field was changed. But, in fact, queried result is updated
whenever _OSC support field was changed through __acpi_query_osc().
As a result, the commit adf411b819adc9fa96e9b3e638c7480d5e71d270 only
introduced unnecessary additional _OSC evaluation...

Tested-by: Andrew Patterson <andrew.patterson@hp.com>
Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agodrivers/pci/hotplug: Add missing pci_dev_get
Julia Lawall [Sun, 23 Nov 2008 08:08:28 +0000 (09:08 +0100)]
drivers/pci/hotplug: Add missing pci_dev_get

pci_get_slot does a pci_dev_get, so pci_dev_put needs to be called in an
error case.

An alterative would be to move the test_and_set_bit before the call to
pci_get_slot.

The problem was fixed using the following semantic patch.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
local idexpression *n;
statement S1,S2;
expression E,E1;
expression *ptr != NULL;
type T,T1;
@@

(
if (!(n = pci_get_slot(...))) S1
|
n = pci_get_slot(...)
)
<... when != pci_dev_put(n)
    when != if (...) { <+... pci_dev_put(n) ...+> }
    when != true !n  || ...
    when != n = (T)E
    when != E = n
if (!n || ...) S2
...>
(
  return \(0\|<+...n...+>\|ptr\);
|
+ pci_dev_put(n);
return ...;
|
pci_dev_put(n);
|
n = (T1)E1
|
E1 = n
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoresource: allow MMIO exclusivity for device drivers
Arjan van de Ven [Thu, 23 Oct 2008 02:55:31 +0000 (19:55 -0700)]
resource: allow MMIO exclusivity for device drivers

Device drivers that use pci_request_regions() (and similar APIs) have a
reasonable expectation that they are the only ones accessing their device.
As part of the e1000e hunt, we were afraid that some userland (X or some
bootsplash stuff) was mapping the MMIO region that the driver thought it
had exclusively via /dev/mem or via various sysfs resource mappings.

This patch adds the option for device drivers to cause their reserved
regions to the "banned from /dev/mem use" list, so now both kernel memory
and device-exclusive MMIO regions are banned.
NOTE: This is only active when CONFIG_STRICT_DEVMEM is set.

In addition to the config option, a kernel parameter iomem=relaxed is
provided for the cases where developers want to diagnose, in the field,
drivers issues from userspace.

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: remove obsolete _OSC capability support functions
Andrew Patterson [Mon, 10 Nov 2008 22:31:10 +0000 (15:31 -0700)]
ACPI/PCI: remove obsolete _OSC capability support functions

The acpi_query_osc, __pci_osc_support_set, pci_osc_support_set, and
pcie_osc_support_set functions have been obsoleted in favor of setting
these capabilities during root bridge discovery with
pci_acpi_osc_support.  There are no longer any callers of these
functions, so remove them.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: PCI MSI _OSC support capabilities called when root bridge added
Andrew Patterson [Mon, 10 Nov 2008 22:31:05 +0000 (15:31 -0700)]
ACPI/PCI: PCI MSI _OSC support capabilities called when root bridge added

The _OSC capability OSC_MSI_SUPPORT is set when the root bridge is added
with pci_acpi_osc_support(), so we no longer need to do it in the PCI
MSI driver.  Also adds the function pci_msi_enabled, which returns true
if pci=nomsi is not on the kernel command-line.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: PCIe AER _OSC support capabilities called when root bridge added
Andrew Patterson [Mon, 10 Nov 2008 22:31:00 +0000 (15:31 -0700)]
ACPI/PCI: PCIe AER _OSC support capabilities called when root bridge added

The _OSC capability OSC_EXT_PCI_CONFIG_SUPPORT is set when the root
bridge is added with pci_acpi_osc_support(), so we no longer need to do
it in the PCIe AER driver.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: PCIe ASPM _OSC support capabilities called when root bridge added
Andrew Patterson [Mon, 10 Nov 2008 22:30:55 +0000 (15:30 -0700)]
ACPI/PCI: PCIe ASPM _OSC support capabilities called when root bridge added

The _OSC capabilities OSC_ACTIVE_STATE_PWR_SUPPORT and
OSC_CLOCK_PWR_CAPABILITY_SUPPORT are set when the root bridge is added
with pci_acpi_osc_support(), so we no longer need to do it in the ASPM
driver.  Also add the function pcie_aspm_enabled, which returns true if
pcie_aspm=off is not on the kernel command-line.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: PCI extended config _OSC support called when root bridge added
Andrew Patterson [Mon, 10 Nov 2008 22:30:50 +0000 (15:30 -0700)]
ACPI/PCI: PCI extended config _OSC support called when root bridge added

The _OSC capability OSC_EXT_PCI_CONFIG_SUPPORT is set when the root
bridge is added with pci_acpi_osc_support() if we can access PCI
extended config space.

This adds the function pci_ext_cfg_avail which returns true if we can
access PCI extended config space (offset greater than 0xff). It
currently only returns false if arch=x86 and raw_pci_ext_ops is not set
(which might happen if pci=nommcfg is set on the kernel command-line).

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: call _OSC support during root bridge discovery
Andrew Patterson [Mon, 10 Nov 2008 22:30:45 +0000 (15:30 -0700)]
ACPI/PCI: call _OSC support during root bridge discovery

Add pci_acpi_osc_support() and call it when a PCI bridge is added.  This
allows us to avoid having every individual PCI root bridge driver call
_OSC support for every root bridge in their probe functions, a
significant savings in boot time.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoACPI/PCI: include missing acpi.h file in pci-acpi.h.
Andrew Patterson [Mon, 10 Nov 2008 22:30:40 +0000 (15:30 -0700)]
ACPI/PCI: include missing acpi.h file in pci-acpi.h.

The pci-acpi.h file will not compile without including linux/acpi.h.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Add legacy_io/mem to all busses
Benjamin Herrenschmidt [Wed, 12 Nov 2008 03:38:53 +0000 (14:38 +1100)]
PCI: Add legacy_io/mem to all busses

Currently, only PHBs get the legacy_* files, which makes it tricky for
userland to get access to the legacy space.  This commit exposes them in
every bus, since even child buses may forward legacy cycles if
configured properly.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Extend pci_reset_function() to support PCI Advanced Features
Sheng Yang [Tue, 11 Nov 2008 09:17:48 +0000 (17:17 +0800)]
PCI: Extend pci_reset_function() to support PCI Advanced Features

Some PCI devices implement PCI Advanced Features, which means they
support Function Level Reset(FLR).  Implement support for that in
pci_reset_function.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: add PCI Advanced Feature Capability defines
Sheng Yang [Tue, 11 Nov 2008 09:17:46 +0000 (17:17 +0800)]
PCI: add PCI Advanced Feature Capability defines

PCI Advanced Features Capability is introduced by "Conventional PCI
Advanced Caps ECN" (can be downloaded in pcisig.com).  Add defines for
the various AF capabilities, including function level reset (FLR).

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: Refactor pci_reset_function()
Sheng Yang [Tue, 11 Nov 2008 09:17:47 +0000 (17:17 +0800)]
PCI: Refactor pci_reset_function()

Separate out function level reset so that pci_reset_function can be more
easily extended.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: struct device - replace bus_id with dev_name(), dev_set_name()
Kay Sievers [Thu, 30 Oct 2008 01:17:49 +0000 (02:17 +0100)]
PCI: struct device - replace bus_id with dev_name(), dev_set_name()

This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: fixup whitespace in quirks.c
Jesse Barnes [Tue, 28 Oct 2008 00:50:21 +0000 (17:50 -0700)]
PCI: fixup whitespace in quirks.c

Had a space before tab in do_fixups, prototype wasn't wrapped properly either.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI hotplug: pciehp: remove unnecessary wait after turning power off
Kenji Kaneshige [Fri, 24 Oct 2008 05:26:35 +0000 (14:26 +0900)]
PCI hotplug: pciehp: remove unnecessary wait after turning power off

The pciehp driver waits for 1000 msec after turning power off to make
sure the power has been completely removed. But this 1000 msec wait is
not needed if a slot doesn't implement power control because software
cannot control the power. Power will be automatically removed at adapter
removal time on such a slot

Tested-by: "Phil Endecott" <phil_pibbu_endecott@chezphil.org>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agoPCI: check mmap range of /proc/bus/pci files too
Jesse Barnes [Fri, 24 Oct 2008 17:32:33 +0000 (10:32 -0700)]
PCI: check mmap range of /proc/bus/pci files too

/proc/bus/pci allows you to mmap resource ranges too, so we should probably be
checking to make sure the mapping is somewhat valid.  Uses the same code as the recent sysfs mmap range checking patch from Linus.

Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
15 years agowimax/i2400m: add CREDITS and MAINTAINERS entries
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:58:00 +0000 (16:58 -0800)]
wimax/i2400m: add CREDITS and MAINTAINERS entries

This patch adds entries for the original developers of the i2400m
drivers and up-to-date maintainer entries.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: export linux/wimax.h and linux/wimax/i2400m.h with headers_install
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:59 +0000 (16:57 -0800)]
wimax: export linux/wimax.h and linux/wimax/i2400m.h with headers_install

These two files are what user space can use to establish communication
with the WiMAX kernel API and to speak the Intel 2400m Wireless WiMAX
connection's control protocol.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: Makefile and Kconfig
Inaky Perez-Gonzalez [Wed, 24 Dec 2008 00:18:48 +0000 (16:18 -0800)]
i2400m: Makefile and Kconfig

Integrate the i2400m driver into the kernel's build and Kconfig.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/SDIO: TX and RX path backends
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:57 +0000 (16:57 -0800)]
i2400m/SDIO: TX and RX path backends

Implements the backend so that the generic driver can TX/RX to/from
the SDIO device.

For RX, when data is ready the SDIO IRQ is fired and that will
allocate an skb, put all the data there and then pass it to the
generic driver RX code for processing and delivery.

TX, when kicked by the generic driver, will schedule work on a
driver-specific workqueue that pulls data from the TX FIFO and sends
it to the device until it drains it.

Thread contexts are needed as SDIO functions are blocking.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/SDIO: firmware upload backend
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:56 +0000 (16:57 -0800)]
i2400m/SDIO: firmware upload backend

This implements the backends for the generic driver (i2400m) to be
able to load firmware to the SDIO device.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/SDIO: probe/disconnect, dev init/shutdown and reset backends
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:55 +0000 (16:57 -0800)]
i2400m/SDIO: probe/disconnect, dev init/shutdown and reset backends

Implements probe/disconnect for the SDIO device, as well as main
backends for the generic driver to control the SDIO device
(bus_dev_start(), bus_dev_stop() and bus_reset()).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/SDIO: header for the SDIO subdriver
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:54 +0000 (16:57 -0800)]
i2400m/SDIO: header for the SDIO subdriver

This contains the common function declaration and constants for the
SDIO driver for the 2400m Wireless WiMAX Connection and it's debug
level settings.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/USB: TX and RX path backends
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:53 +0000 (16:57 -0800)]
i2400m/USB: TX and RX path backends

Implements the backend so that the generic driver can TX/RX to/from
the USB device.

TX is implemented with a kthread sitting in a never-ending loop that
when kicked by the generic driver's TX code will pull data from the TX
FIFO and send it to the device until it drains it. Then it goes back
sleep, waiting for another kick.

RX is implemented in a similar fashion, but reads are kicked in by the
device notifying in the interrupt endpoint that data is ready. Device
reset notifications are also sent via the notification endpoint.

We need a thread contexts to run USB autopm functions (blocking) and
to process the received data (can get to be heavy in processing
time).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/USB: firmware upload backend
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:52 +0000 (16:57 -0800)]
i2400m/USB: firmware upload backend

This implements the backends for the generic driver (i2400m) to be
able to load firmware to the USB device.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/USB: probe/disconnect, dev init/shutdown and reset backends
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:51 +0000 (16:57 -0800)]
i2400m/USB: probe/disconnect, dev init/shutdown and reset backends

Implements probe/disconnect for the USB device, as well as main
backends for the generic driver to control the USB device
(bus_dev_start(), bus_dev_stop() and bus_reset()).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m/USB: header for the USB bus driver
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:50 +0000 (16:57 -0800)]
i2400m/USB: header for the USB bus driver

This contains the common function declaration and constants for the
USB driver for the 2400m Wireless WiMAX Connection, as well as it's
debug level settings.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: debugfs controls
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:49 +0000 (16:57 -0800)]
i2400m: debugfs controls

Expose knobs to control the device (induce reset, power saving,
querying tx or rx stats, internal debug information and debug level
manipulation).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: various functions for device management
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:48 +0000 (16:57 -0800)]
i2400m: various functions for device management

This is a collection of functions used to control the device (plus a
few helpers).

There are utilities for handling TLV buffers, hooks on the device's
reports to act on device changes of state [i2400m_report_hook()], on
acks to commands [i2400m_msg_ack_hook()], a helper for sending
commands to the device and blocking until a reply arrives
[i2400m_msg_to_dev()], a few high level commands for manipulating the
device state, powersaving mode and configuration plus the routines to
setup the device once communication is established with it
[i2400m_dev_initialize()].

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: RX and TX data/control paths
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:47 +0000 (16:57 -0800)]
i2400m: RX and TX data/control paths

Handling of TX/RX data to/from the i2400m device (IP packets, control
and diagnostics). On RX, this parses the received read transaction
from the device, breaks it in chunks and passes it to the
corresponding subsystems (network and control).

Transmission to the device is done through a software FIFO, as
data/control frames can be coalesced (while the device is reading the
previous tx transaction, others accumulate). A FIFO is used because at
the end it is resource-cheaper that scatter/gather over USB. As well,
most traffic is going to be download (vs upload).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: firmware loading and bootrom initialization
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:46 +0000 (16:57 -0800)]
i2400m: firmware loading and bootrom initialization

Implements the firmware loader (using the bus-specific driver's
backends for the actual upload). The most critical thing in here is
the piece that puts the device in boot-mode from any other
(undetermined) state, otherwise, it is just pushing the bytes from the
firmware file to the device.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: linkage to the networking stack
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:45 +0000 (16:57 -0800)]
i2400m: linkage to the networking stack

Implementation of the glue to the network stack so the WiMAX device
shows up as an Ethernet device.

Initially we shot for implementing a Pure IP device -- however, the
world seems to turn around Ethernet devices. Main issues were with the
ISC DHCP client and servers (as they don't understand types other than
Ethernet and Token Ring).

We proceeded to register with IANA the PureIP hw type, so that DHCP
requests could declare such. We also created patches to the main ISC
DHCP versions to support it. However, until all that permeates into
deployments, there is going to be a long time.

So we moved back to wrap Ethernet frames around the PureIP device. At
the time being this has overhead; we need to reallocate with space for
an Ethernet header. The reason is the device-to-host protocol
coalesces many network packets into a single message, so we can't
introduce Ethernet headers without overwriting valid data from other
packets.

Coming-soon versions of the firmware have this issue solved.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: Generic probe/disconnect, reset and message passing
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:44 +0000 (16:57 -0800)]
i2400m: Generic probe/disconnect, reset and message passing

Implements the generic probe and disconnect functions that will be
called by the USB and SDIO driver's probe/disconnect functions.

Implements the backends for the WiMAX stack's basic operations:
message passing, rfkill control and reset.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: host/device procotol and core driver definitions
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:43 +0000 (16:57 -0800)]
i2400m: host/device procotol and core driver definitions

The wimax/i2400m.h defines the structures and constants for the
host-device protocols:

 - boot / firmware upload protocol

 - general data transport protocol

 - control protocol

It is done in such a way that can also be used verbatim by user space.

drivers/net/wimax/i2400m.h defines all the APIs used by the core,
bus-generic driver (i2400m) and the bus specific drivers
(i2400m-BUSNAME). It also gives a roadmap to the driver
implementation.

debug-levels.h adds the core driver's debug settings.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoi2400m: documentation and instructions for usage
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:42 +0000 (16:57 -0800)]
i2400m: documentation and instructions for usage

The driver for the i2400m is a stacked driver. There is a core driver,
the bus-generic driver that has no knowledge or dependencies on how
the device is connected to the system; it only knows how to speak the
device protocol. Then there are the bus-specific drivers (for USB and
SDIO) that provide backends for the generic driver to communicate with
the device.

The bus generic driver connects to the network and WiMAX stacks on the
top side, and on the bottom to the bus-specific drivers.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: Makefile, Kconfig and docbook linkage for the stack
Inaky Perez-Gonzalez [Wed, 24 Dec 2008 00:18:24 +0000 (16:18 -0800)]
wimax: Makefile, Kconfig and docbook linkage for the stack

This patch provides Makefile and KConfig for the WiMAX stack,
integrating them into the networking stack's Makefile, Kconfig and
doc-book templates.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: debugfs controls
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:40 +0000 (16:57 -0800)]
wimax: debugfs controls

Expose knobs to control the stack's debug output.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: basic API: kernel/user messaging, rfkill and reset
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:38 +0000 (16:57 -0800)]
wimax: basic API: kernel/user messaging, rfkill and reset

Implements the three basic operations provided by the stack's control
interface to WiMAX devices:

- Messaging channel between user space and driver/device

  This implements a direct communication channel between user space
  and the driver/device, by which free form messages can be sent back
  and forth.

  This is intended for device-specific features, vendor quirks, etc.

- RF-kill framework integration

  Provide most of the RF-Kill integration for WiMAX drivers so that
  all device drivers have to do is after wimax_dev_add() is call
  wimax_report_rfkill_{hw,sw}() to update initial state and then every
  time it changes.

  Provides wimax_rfkill() for the kernel to call to set software
  RF-Kill status and/or query current hardware and software switch
  status.

  Exports wimax_rfkill() over generic netlink to user space.

- Reset a WiMAX device

  Provides wimax_reset() for the kernel to reset a wimax device as
  needed and exports it over generic netlink to user space.

This API is clearly limited, as it still provides no way to do the
basic scan, connect and disconnect in a hardware independent way.  The
WiMAX case is more complex than WiFi due to the way networks are
discovered and provisioned.

The next developments are to add the basic operations so they can be
offerent by different drivers. However, we'd like to get more vendors
to jump in and provide feedback of how the user/kernel API/abstraction
layer should be.

The user space code for the i2400m, as of now, uses the messaging
channel, but that will change as the API evolves.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agogenetlink: export genl_unregister_mc_group()
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:37 +0000 (16:57 -0800)]
genetlink: export genl_unregister_mc_group()

Add an EXPORT_SYMBOL() to genl_unregister_mc_group(), to allow
unregistering groups on the run. EXPORT_SYMBOL_GPL() is not used as
the rest of the functions exported by this module (eg:
genl_register_mc_group) are also not _GPL().

Cleanup is currently done when unregistering a family, but there is
no way to unregister a single multicast group due to that function not
being exported. Seems to be a mistake as it is documented as for
external consumption.

This is needed by the WiMAX stack to be able to cleanup unused mc
groups.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: generic device management (registration, deregistration, lookup)
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:36 +0000 (16:57 -0800)]
wimax: generic device management (registration, deregistration, lookup)

Implements the basic life cycles of a 'struct wimax_dev', some common
generic netlink functionality for marshalling calls to user space,
and the device state machine.

For looking up net devices based on their generic netlink family IDs,
use a low overhead method that optimizes for the case where most
systems have a single WiMAX device, or at most, a very low number of
WiMAX adaptors.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: debug macros and debug settings for the WiMAX stack
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:35 +0000 (16:57 -0800)]
wimax: debug macros and debug settings for the WiMAX stack

This file contains a simple debug framework that is used in the stack;
it allows the debug level to be controlled at compile-time (so the
debug code is optimized out) and at run-time (for what wasn't compiled
out).

This is eventually going to be moved to use dynamic_printk(). Just
need to find time to do it.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: internal API for the kernel space WiMAX stack
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:34 +0000 (16:57 -0800)]
wimax: internal API for the kernel space WiMAX stack

This file contains declarations and definitions used by the different
submodules of the stack.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: headers for kernel API and user space interaction
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:33 +0000 (16:57 -0800)]
wimax: headers for kernel API and user space interaction

Definitions for the user/kernel API protocol through generic
netlink. User space can copy it verbatim and use it.

Kernel API definition declares the main data types and calls for the
drivers to integrate into the WiMAX stack. Provides usage
documentation.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agowimax: documentation for the stack
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:32 +0000 (16:57 -0800)]
wimax: documentation for the stack

wimax documentation

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agodebugfs: add helpers for exporting a size_t simple value
Inaky Perez-Gonzalez [Sun, 21 Dec 2008 00:57:39 +0000 (16:57 -0800)]
debugfs: add helpers for exporting a size_t simple value

In the same spirit as debugfs_create_*(), introduce helpers for
exporting size_t values over debugfs.

The only trick done is that the format verifier is kept at %llu
instead of %zu; otherwise type warnings would pop up:

format ‘%zu’ expects type ‘size_t’, but argument 2 has type ‘long long unsigned int’

There is no real way to fix this one--however, we can consider %llu
and %zu to be compatible if we consider that we are using the same for
validating in debugfs_create_{x,u}{8,16,32}().

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: remove info() macro from usb.h
Greg Kroah-Hartman [Mon, 18 Aug 2008 20:21:04 +0000 (13:21 -0700)]
USB: remove info() macro from usb.h

USB should not be having it's own printk macros, so remove info() and
use the system-wide standard of dev_info() wherever possible.

No one in the tree is using the macro, so it can now be removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: remove warn() macro from usb.h
Greg Kroah-Hartman [Thu, 14 Aug 2008 16:37:34 +0000 (09:37 -0700)]
USB: remove warn() macro from usb.h

USB should not be having it's own printk macros, so remove warn() and
use the system-wide standard of dev_warn() wherever possible.  In the
few places that will not work out, use a basic printk().

Now that all in-tree users are gone, remove the macro.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: add siemens_mpi usb-serial "stub" driver
Greg Kroah-Hartman [Thu, 4 Dec 2008 06:30:04 +0000 (22:30 -0800)]
USB: add siemens_mpi usb-serial "stub" driver

This driver got rescued from a few years ago and was requested to be
added.  So I cleaned it up, ported it to the latest kernel version and
here it is.

Cc: Thomas Hergenhahn <thomas.hergenhahn@suse.de>
Cc: Emmanuele <iemmav@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: add new opticon serial driver
Greg Kroah-Hartman [Mon, 3 Nov 2008 21:27:03 +0000 (13:27 -0800)]
USB: add new opticon serial driver

This is for the serial mode of the Opticon barcode scanner.

Cc: Kees Stoop <kees.stoop@opticon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: emi26: fix oops on load
Marcin Slusarz [Sun, 4 Jan 2009 12:25:13 +0000 (13:25 +0100)]
USB: emi26: fix oops on load

Fix oops introduced by commit ae93a55bf948753de0bb8e43fa9c027f786abb05
(emi26: use request_firmware()):

usb 1-1: new full speed USB device using uhci_hcd and address 2
usb 1-1: configuration #1 chosen from 1 choice
emi26 - firmware loader 1-1:1.0: emi26_probe start
usb 1-1: firmware: requesting emi26/loader.fw
usb 1-1: firmware: requesting emi26/bitstream.fw
usb 1-1: firmware: requesting emi26/firmware.fw
usb 1-1: emi26_set_reset - 1
usb 1-1: emi26_set_reset - 0
BUG: unable to handle kernel NULL pointer dereference at 00000000
IP: [<f80dc487>] emi26_probe+0x2f7/0x620 [emi26]
*pde = 00000000
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/firmware/1-1/loading
Modules linked in: emi26(+) ipv6 cpufreq_ondemand coretemp arc4 ecb iwl3945 irtty_sir sir_dev nsc_ircc ehci_hcd uhci_hcd mac80211 irda usbcore snd_hda_intel thinkpad_acpi rfkill hwmon led_class e1000e snd_pcm cfg80211 snd_timer crc_ccitt snd snd_page_alloc aes_generic

Pid: 5082, comm: modprobe Not tainted (2.6.28 #2) 17023QG
EIP: 0060:[<f80dc487>] EFLAGS: 00010206 CPU: 0
EIP is at emi26_probe+0x2f7/0x620 [emi26]
EAX: 0000015c EBX: 00000000 ECX: c1ffd9c0 EDX: 00000000
ESI: 0000015c EDI: f6bb215c EBP: f6bb0400 ESP: f00ebcfc
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process modprobe (pid: 5082, ti=f00ea000 task=f5c7c700 task.ti=f00ea000)
Stack:
 0000015c 000000a5 f6a67cb8 f80dc7e0 c01c6262 fbef2986 f6bb2000 00008fe0
 0000015c f715f748 f715f740 f715f738 f715f748 f6a67c00 f80dd040 f80dcfc0
 f6bb0400 fbacb290 f6a67c94 fbae0160 c01c70bf 00000000 f6a67c1c 00000000
Call Trace:
 [<c01c6262>] sysfs_add_one+0x12/0x50
 [<fbacb290>] usb_probe_interface+0xa0/0x140 [usbcore]
 [<c01c70bf>] sysfs_create_link+0xf/0x20
 [<c02dead2>] driver_probe_device+0x82/0x180
 [<fbac9eeb>] usb_match_id+0x3b/0x50 [usbcore]
 [<c02dec4e>] __driver_attach+0x7e/0x80
 [<c02de27a>] bus_for_each_dev+0x3a/0x60
 [<c02de956>] driver_attach+0x16/0x20
 [<c02debd0>] __driver_attach+0x0/0x80
 [<c02de7b1>] bus_add_driver+0x1a1/0x220
 [<c02dee4d>] driver_register+0x4d/0x120
 [<c024e622>] idr_get_empty_slot+0xf2/0x290
 [<fbacab71>] usb_register_driver+0x81/0x100 [usbcore]
 [<f806c000>] emi26_init+0x0/0x14 [emi26]
 [<c0101126>] do_one_initcall+0x36/0x1b0
 [<c01c5e70>] sysfs_ilookup_test+0x0/0x10
 [<c0197a61>] ifind+0x31/0x90
 [<c01c6229>] __sysfs_add_one+0x59/0x80
 [<c01c64e4>] sysfs_addrm_finish+0x14/0x1c0
 [<c0175ca3>] __vunmap+0xa3/0xd0
 [<c014b854>] load_module+0x1544/0x1640
 [<c014b9d7>] sys_init_module+0x87/0x1b0
 [<c0187f41>] sys_read+0x41/0x70
 [<c01032a5>] sysenter_do_call+0x12/0x21
 [<c03d0000>] wait_for_common+0x40/0x110
Code: 66 c1 e8 08 66 09 d0 75 a5 31 d2 89 e8 e8 72 fc ff ff 85 c0 0f 88 9a 02 00 00 b8 fa 00 00 00 e8 30 46 05 c8 8b 74 24 28 8b 5e 04 <8b> 03 89 44 24 1c 0f c8 89 44 24 1c 0f b7 4b 04 c7 44 24 20 00
EIP: [<f80dc487>] emi26_probe+0x2f7/0x620 [emi26] SS:ESP 0068:f00ebcfc
---[ end trace 2eefa13825431230 ]---

After the last "package" of firmware data is sent to the device, we dereference
NULL pointer (on access to rec->addr). Fix it.

Reported--by: David Flatz <david@upcs.at>
Tested-by: David Flatz <david@upcs.at>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: stable <stable@kernel.org> [2.6.27, 2.6.28]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: Fix goku_udc usb speed handling
SangSu Park [Thu, 1 Jan 2009 16:11:14 +0000 (01:11 +0900)]
USB: Fix goku_udc usb speed handling

The usb gadget framework revealed weakness in the godu_udc
gadget driver register function. Instead of checking if
speed asked for was USB_LOW_SPEED upon usb_gadget_register()
to deny service, it checked only for USB_FULL_SPEED, thus
denying service to usb high speed capable gadgets.

Signed-off-by: SangSu Park <sangsu@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: fix minor nit in usbfs checking
Mark Lord [Fri, 2 Jan 2009 07:48:24 +0000 (02:48 -0500)]
USB: fix minor nit in usbfs checking

One minor nit did show up, though.  The patch below
seems to make more sense than the code does without it.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: re-enable interface after driver unbinds
Alan Stern [Wed, 31 Dec 2008 16:31:33 +0000 (11:31 -0500)]
USB: re-enable interface after driver unbinds

This patch (as1197) fixes an error introduced recently.  Since a
significant number of devices can't handle Set-Interface requests, we
no longer call usb_set_interface() when a driver unbinds from an
interface, provided the interface is already in altsetting 0.  However
the interface still does get disabled, and the call to
usb_set_interface() was the only thing re-enabling it.  Since the
interface doesn't get re-enabled, further attempts to use it fail.

So the patch adds a call to usb_enable_interface() when a driver
unbinds and the interface is in altsetting 0.  For this to work
right, the interface's endpoints have to be re-enabled but their
toggles have to be left alone.  Therefore an additional argument is
added to usb_enable_endpoint() and usb_enable_interface(), a flag
indicating whether or not the endpoint toggles should be reset.

This is a forward-ported version of a patch which fixes Bugzilla
#12301.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: David Roka <roka@dawid.hu>
Reported-by: Erik Ekman <erik@kryo.se>
Tested-by: Erik Ekman <erik@kryo.se>
Tested-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: cancel pending Set-Config requests if userspace gets there first
Alan Stern [Fri, 19 Dec 2008 15:27:56 +0000 (10:27 -0500)]
USB: cancel pending Set-Config requests if userspace gets there first

This patch (as1195) eliminates a potential problem identified by
Oliver Neukum.  When a driver queues an asynchronous Set-Config
request using usb_driver_set_configuration(), the request should be
cancelled if userspace changes the configuration first.  The patch
introduces a linked list of pending async Set-Config requests, and
uses it to invalidate the requests for a particular device whenever
that device's configuration is set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoUSB: automatically enable wakeup for PCI host controllers
Alan Stern [Wed, 17 Dec 2008 22:20:38 +0000 (17:20 -0500)]
USB: automatically enable wakeup for PCI host controllers

This patch (as1193b) enables wakeup during initialization for all PCI
host controllers, and it removes some code (and comments!) that are no
longer needed now that the PCI core automatically initializes wakeup
settings for all new devices.

The idea is that the bus should initialize wakeup, and the bus glue
or controller driver should enable it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>