diff options
| author | Vojtech Pavlik <vojtech@suse.cz> | 2004-08-03 20:33:42 +0200 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@suse.cz> | 2004-08-03 20:33:42 +0200 |
| commit | 85103e8d3755fe9ccde2c12ff39fe7208b93b763 (patch) | |
| tree | 310d544c76918e03a2ae6731463d250bf7a21aef | |
| parent | a25defbba3140a442764bde87eff05817d36741c (diff) | |
| parent | 7588ab9742b3ae0ecebcb32fca1374deda97e73f (diff) | |
Merge suse.cz:/data/bk/linus into suse.cz:/data/bk/input
177 files changed, 3043 insertions, 1587 deletions
diff --git a/Documentation/MSI-HOWTO.txt b/Documentation/MSI-HOWTO.txt index 18526692de49..d5032eb480aa 100644 --- a/Documentation/MSI-HOWTO.txt +++ b/Documentation/MSI-HOWTO.txt @@ -3,13 +3,14 @@ 10/03/2003 Revised Feb 12, 2004 by Martine Silbermann email: Martine.Silbermann@hp.com + Revised Jun 25, 2004 by Tom L Nguyen 1. About this guide -This guide describes the basics of Message Signaled Interrupts(MSI), the -advantages of using MSI over traditional interrupt mechanisms, and how -to enable your driver to use MSI or MSI-X. Also included is a Frequently -Asked Questions. +This guide describes the basics of Message Signaled Interrupts (MSI), +the advantages of using MSI over traditional interrupt mechanisms, +and how to enable your driver to use MSI or MSI-X. Also included is +a Frequently Asked Questions. 2. Copyright 2003 Intel Corporation @@ -35,7 +36,7 @@ An MSI capable device function indicates MSI support by implementing the MSI/MSI-X capability structure in its PCI capability list. The device function may implement both the MSI capability structure and the MSI-X capability structure; however, the bus driver should not -enable both, but instead enable only the MSI-X capability structure. +enable both. The MSI capability structure contains Message Control register, Message Address register and Message Data register. These registers @@ -86,35 +87,62 @@ support. As a result, the PCI Express technology requires MSI support for better interrupt performance. Using MSI enables the device functions to support two or more -vectors, which can be configure to target different CPU's to +vectors, which can be configured to target different CPU's to increase scalability. 5. Configuring a driver to use MSI/MSI-X By default, the kernel will not enable MSI/MSI-X on all devices that -support this capability. The CONFIG_PCI_USE_VECTOR kernel option +support this capability. The CONFIG_PCI_MSI kernel option must be selected to enable MSI/MSI-X support. -5.1 Including MSI support into the kernel +5.1 Including MSI/MSI-X support into the kernel -To allow MSI-Capable device drivers to selectively enable MSI (using -pci_enable_msi as described below), the VECTOR based scheme needs to -be enabled by setting CONFIG_PCI_USE_VECTOR. +To allow MSI/MSI-X capable device drivers to selectively enable +MSI/MSI-X (using pci_enable_msi()/pci_enable_msix() as described +below), the VECTOR based scheme needs to be enabled by setting +CONFIG_PCI_MSI during kernel config. Since the target of the inbound message is the local APIC, providing -CONFIG_PCI_USE_VECTOR is dependent on whether CONFIG_X86_LOCAL_APIC -is enabled or not. +CONFIG_X86_LOCAL_APIC must be enabled as well as CONFIG_PCI_MSI. -int pci_enable_msi(struct pci_dev *) +5.2 Configuring for MSI support + +Due to the non-contiguous fashion in vector assignment of the +existing Linux kernel, this version does not support multiple +messages regardless of a device function is capable of supporting +more than one vector. To enable MSI on a device function's MSI +capability structure requires a device driver to call the function +pci_enable_msi() explicitly. + +5.2.1 API pci_enable_msi + +int pci_enable_msi(struct pci_dev *dev) With this new API, any existing device driver, which like to have -MSI enabled on its device function, must call this explicitly. A -successful call will initialize the MSI/MSI-X capability structure -with ONE vector, regardless of whether the device function is +MSI enabled on its device function, must call this API to enable MSI +A successful call will initialize the MSI capability structure +with ONE vector, regardless of whether a device function is capable of supporting multiple messages. This vector replaces the pre-assigned dev->irq with a new MSI vector. To avoid the conflict of new assigned vector with existing pre-assigned vector requires -the device driver to call this API before calling request_irq(...). +a device driver to call this API before calling request_irq(). + +5.2.2 API pci_disable_msi + +void pci_disable_msi(struct pci_dev *dev) + +This API should always be used to undo the effect of pci_enable_msi() +when a device driver is unloading. This API restores dev->irq with +the pre-assigned IOAPIC vector and switches a device's interrupt +mode to PCI pin-irq assertion/INTx emulation mode. + +Note that a device driver should always call free_irq() on MSI vector +it has done request_irq() on before calling this API. Failure to do +so results a BUG_ON() and a device will be left with MSI enabled and +leaks its vector. + +5.2.3 MSI mode vs. legacy mode diagram The below diagram shows the events, which switches the interrupt mode on the MSI-capable device function between MSI mode and @@ -124,121 +152,274 @@ PIN-IRQ assertion mode. | | <=============== | | | MSI MODE | | PIN-IRQ ASSERTION MODE | | | ===============> | | - ------------ free_irq ------------------------ + ------------ pci_disable_msi ------------------------ -5.2 Configuring for MSI support -Due to the non-contiguous fashion in vector assignment of the -existing Linux kernel, this version does not support multiple -messages regardless of the device function is capable of supporting -more than one vector. The bus driver initializes only entry 0 of -this capability if pci_enable_msi(...) is called successfully by -the device driver. +Figure 1.0 MSI Mode vs. Legacy Mode + +In Figure 1.0, a device operates by default in legacy mode. Legacy +in this context means PCI pin-irq assertion or PCI-Express INTx +emulation. A successful MSI request (using pci_enable_msi()) switches +a device's interrupt mode to MSI mode. A pre-assigned IOAPIC vector +stored in dev->irq will be saved by the PCI subsystem and a new +assigned MSI vector will replace dev->irq. + +To return back to its default mode, a device driver should always call +pci_disable_msi() to undo the effect of pci_enable_msi(). Note that a +device driver should always call free_irq() on MSI vector it has done +request_irq() on before calling pci_disable_msi(). Failure to do so +results a BUG_ON() and a device will be left with MSI enabled and +leaks its vector. Otherwise, the PCI subsystem restores a device's +dev->irq with a pre-assigned IOAPIC vector and marks released +MSI vector as unused. + +Once being marked as unused, there is no guarantee that the PCI +subsystem will reserve this MSI vector for a device. Depending on +the availability of current PCI vector resources and the number of +MSI/MSI-X requests from other drivers, this MSI may be re-assigned. + +For the case where the PCI subsystem re-assigned this MSI vector +another driver, a request to switching back to MSI mode may result +in being assigned a different MSI vector or a failure if no more +vectors are available. 5.3 Configuring for MSI-X support -Both the MSI capability structure and the MSI-X capability structure -share the same above semantics; however, due to the ability of the -system software to configure each vector of the MSI-X capability -structure with an independent message address and message data, the -non-contiguous fashion in vector assignment of the existing Linux -kernel has no impact on supporting multiple messages on an MSI-X -capable device functions. By default, as mentioned above, ONE vector -should be always allocated to the MSI-X capability structure at -entry 0. The bus driver does not initialize other entries of the -MSI-X table. - -Note that the PCI subsystem should have full control of a MSI-X -table that resides in Memory Space. The software device driver -should not access this table. - -To request for additional vectors, the device software driver should -call function msi_alloc_vectors(). It is recommended that the -software driver should call this function once during the +Due to the ability of the system software to configure each vector of +the MSI-X capability structure with an independent message address +and message data, the non-contiguous fashion in vector assignment of +the existing Linux kernel has no impact on supporting multiple +messages on an MSI-X capable device functions. To enable MSI-X on +a device function's MSI-X capability structure requires its device +driver to call the function pci_enable_msix() explicitly. + +The function pci_enable_msix(), once invoked, enables either +all or nothing, depending on the current availability of PCI vector +resources. If the PCI vector resources are available for the number +of vectors requested by a device driver, this function will configure +the MSI-X table of the MSI-X capability structure of a device with +requested messages. To emphasize this reason, for example, a device +may be capable for supporting the maximum of 32 vectors while its +software driver usually may request 4 vectors. It is recommended +that the device driver should call this function once during the initialization phase of the device driver. -The function msi_alloc_vectors(), once invoked, enables either -all or nothing, depending on the current availability of vector -resources. If no vector resources are available, the device function -still works with ONE vector. If the vector resources are available -for the number of vectors requested by the driver, this function -will reconfigure the MSI-X capability structure of the device with -additional messages, starting from entry 1. To emphasize this -reason, for example, the device may be capable for supporting the -maximum of 32 vectors while its software driver usually may request -4 vectors. - -For each vector, after this successful call, the device driver is -responsible to call other functions like request_irq(), enable_irq(), -etc. to enable this vector with its corresponding interrupt service -handler. It is the device driver's choice to have all vectors shared -the same interrupt service handler or each vector with a unique -interrupt service handler. - -In addition to the function msi_alloc_vectors(), another function -msi_free_vectors() is provided to allow the software driver to -release a number of vectors back to the vector resources. Once -invoked, the PCI subsystem disables (masks) each vector released. -These vectors are no longer valid for the hardware device and its -software driver to use. Like free_irq, it recommends that the -device driver should also call msi_free_vectors to release all -additional vectors previously requested. - -int msi_alloc_vectors(struct pci_dev *dev, int *vector, int nvec) - -This API enables the software driver to request the PCI subsystem -for additional messages. Depending on the number of vectors -available, the PCI subsystem enables either all or nothing. +Unlike the function pci_enable_msi(), the function pci_enable_msix() +does not replace the pre-assigned IOAPIC dev->irq with a new MSI +vector because the PCI subsystem writes the 1:1 vector-to-entry mapping +into the field vector of each element contained in a second argument. +Note that the pre-assigned IO-APIC dev->irq is valid only if the device +operates in PIN-IRQ assertion mode. In MSI-X mode, any attempt of +using dev->irq by the device driver to request for interrupt service +may result unpredictabe behavior. + +For each MSI-X vector granted, a device driver is responsible to call +other functions like request_irq(), enable_irq(), etc. to enable +this vector with its corresponding interrupt service handler. It is +a device driver's choice to assign all vectors with the same +interrupt service handler or each vector with a unique interrupt +service handler. + +5.3.1 Handling MMIO address space of MSI-X Table + +The PCI 3.0 specification has implementation notes that MMIO address +space for a device's MSI-X structure should be isolated so that the +software system can set different page for controlling accesses to +the MSI-X structure. The implementation of MSI patch requires the PCI +subsystem, not a device driver, to maintain full control of the MSI-X +table/MSI-X PBA and MMIO address space of the MSI-X table/MSI-X PBA. +A device driver is prohibited from requesting the MMIO address space +of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem will fail +enabling MSI-X on its hardware device when it calls the function +pci_enable_msix(). + +5.3.2 Handling MSI-X allocation + +Determining the number of MSI-X vectors allocated to a function is +dependent on the number of MSI capable devices and MSI-X capable +devices populated in the system. The policy of allocating MSI-X +vectors to a function is defined as the following: + +#of MSI-X vectors allocated to a function = (x - y)/z where + +x = The number of available PCI vector resources by the time + the device driver calls pci_enable_msix(). The PCI vector + resources is the sum of the number of unassigned vectors + (new) and the number of released vectors when any MSI/MSI-X + device driver switches its hardware device back to a legacy + mode or is hot-removed. The number of unassigned vectors + may exclude some vectors reserved, as defined in parameter + NR_HP_RESERVED_VECTORS, for the case where the system is + capable of supporting hot-add/hot-remove operations. Users + may change the value defined in NR_HR_RESERVED_VECTORS to + meet their specific needs. + +y = The number of MSI capable devices populated in the system. + This policy ensures that each MSI capable device has its + vector reserved to avoid the case where some MSI-X capable + drivers may attempt to claim all available vector resources. + +z = The number of MSI-X capable devices pupulated in the system. + This policy ensures that maximum (x - y) is distributed + evenly among MSI-X capable devices. + +Note that the PCI subsystem scans y and z during a bus enumeration. +When the PCI subsystem completes configuring MSI/MSI-X capability +structure of a device as requested by its device driver, y/z is +decremented accordingly. + +5.3.3 Handling MSI-X shortages + +For the case where fewer MSI-X vectors are allocated to a function +than requested, the function pci_enable_msix() will return the +maximum number of MSI-X vectors available to the caller. A device +driver may re-send its request with fewer or equal vectors indicated +in a return. For example, if a device driver requests 5 vectors, but +the number of available vectors is 3 vectors, a value of 3 will be a +return as a result of pci_enable_msix() call. A function could be +designed for its driver to use only 3 MSI-X table entries as +different combinations as ABC--, A-B-C, A--CB, etc. Note that this +patch does not support multiple entries with the same vector. Such +attempt by a device driver to use 5 MSI-X table entries with 3 vectors +as ABBCC, AABCC, BCCBA, etc will result as a failure by the function +pci_enable_msix(). Below are the reasons why supporting multiple +entries with the same vector is an undesirable solution. + + - The PCI subsystem can not determine which entry, which + generated the message, to mask/unmask MSI while handling + software driver ISR. Attempting to walk through all MSI-X + table entries (2048 max) to mask/unmask any match vector + is an undesirable solution. + + - Walk through all MSI-X table entries (2048 max) to handle + SMP affinity of any match vector is an undesirable solution. + +5.3.4 API pci_enable_msix + +int pci_enable_msix(struct pci_dev *dev, u32 *entries, int nvec) + +This API enables a device driver to request the PCI subsystem +for enabling MSI-X messages on its hardware device. Depending on +the availability of PCI vectors resources, the PCI subsystem enables +either all or nothing. Argument dev points to the device (pci_dev) structure. -Argument vector is a pointer of integer type. The number of -elements is indicated in argument nvec. + +Argument entries is a pointer of unsigned integer type. The number of +elements is indicated in argument nvec. The content of each element +will be mapped to the following struct defined in /driver/pci/msi.h. + +struct msix_entry { + u16 vector; /* kernel uses to write alloc vector */ + u16 entry; /* driver uses to specify entry */ +}; + +A device driver is responsible for initializing the field entry of +each element with unique entry supported by MSI-X table. Otherwise, +-EINVAL will be returned as a result. A successful return of zero +indicates the PCI subsystem completes initializing each of requested +entries of the MSI-X table with message address and message data. +Last but not least, the PCI subsystem will write the 1:1 +vector-to-entry mapping into the field vector of each element. A +device driver is responsible of keeping track of allocated MSI-X +vectors in its internal data structure. + Argument nvec is an integer indicating the number of messages requested. -A return of zero indicates that the number of allocated vector is -successfully allocated. Otherwise, indicate resources not -available. -int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec) +A return of zero indicates that the number of MSI-X vectors is +successfully allocated. A return of greater than zero indicates +MSI-X vector shortage. Or a return of less than zero indicates +a failure. This failure may be a result of duplicate entries +specified in second argument, or a result of no available vector, +or a result of failing to initialize MSI-X table entries. -This API enables the software driver to inform the PCI subsystem -that it is willing to release a number of vectors back to the -MSI resource pool. Once invoked, the PCI subsystem disables each -MSI-X entry associated with each vector stored in the argument 2. -These vectors are no longer valid for the hardware device and -its software driver to use. +5.3.5 API pci_disable_msix -Argument dev points to the device (pci_dev) structure. -Argument vector is a pointer of integer type. The number of -elements is indicated in argument nvec. -Argument nvec is an integer indicating the number of messages -released. -A return of zero indicates that the number of allocated vectors -is successfully released. Otherwise, indicates a failure. +void pci_disable_msix(struct pci_dev *dev) -5.4 Hardware requirements for MSI support -MSI support requires support from both system hardware and +This API should always be used to undo the effect of pci_enable_msix() +when a device driver is unloading. Note that a device driver should +always call free_irq() on all MSI-X vectors it has done request_irq() +on before calling this API. Failure to do so results a BUG_ON() and +a device will be left with MSI-X enabled and leaks its vectors. + +5.3.6 MSI-X mode vs. legacy mode diagram + +The below diagram shows the events, which switches the interrupt +mode on the MSI-X capable device function between MSI-X mode and +PIN-IRQ assertion mode (legacy). + + ------------ pci_enable_msix(,,n) ------------------------ + | | <=============== | | + | MSI-X MODE | | PIN-IRQ ASSERTION MODE | + | | ===============> | | + ------------ pci_disable_msix ------------------------ + +Figure 2.0 MSI-X Mode vs. Legacy Mode + +In Figure 2.0, a device operates by default in legacy mode. A +successful MSI-X request (using pci_enable_msix()) switches a +device's interrupt mode to MSI-X mode. A pre-assigned IOAPIC vector +stored in dev->irq will be saved by the PCI subsystem; however, +unlike MSI mode, the PCI subsystem will not replace dev->irq with +assigned MSI-X vector because the PCI subsystem already writes the 1:1 +vector-to-entry mapping into the field vector of each element +specified in second argument. + +To return back to its default mode, a device driver should always call +pci_disable_msix() to undo the effect of pci_enable_msix(). Note that +a device driver should always call free_irq() on all MSI-X vectors it +has done request_irq() on before calling pci_disable_msix(). Failure +to do so results a BUG_ON() and a device will be left with MSI-X +enabled and leaks its vectors. Otherwise, the PCI subsystem switches a +device function's interrupt mode from MSI-X mode to legacy mode and +marks all allocated MSI-X vectors as unused. + +Once being marked as unused, there is no guarantee that the PCI +subsystem will reserve these MSI-X vectors for a device. Depending on +the availability of current PCI vector resources and the number of +MSI/MSI-X requests from other drivers, these MSI-X vectors may be +re-assigned. + +For the case where the PCI subsystem re-assigned these MSI-X vectors +to other driver, a request to switching back to MSI-X mode may result +being assigned with another set of MSI-X vectors or a failure if no +more vectors are available. + +5.4 Handling function implementng both MSI and MSI-X capabilities + +For the case where a function implements both MSI and MSI-X +capabilities, the PCI subsystem enables a device to run either in MSI +mode or MSI-X mode but not both. A device driver determines whether it +wants MSI or MSI-X enabled on its hardware device. Once a device +driver requests for MSI, for example, it is prohibited to request for +MSI-X; in other words, a device driver is not permitted to ping-pong +between MSI mod MSI-X mode during a run-time. + +5.5 Hardware requirements for MSI/MSI-X support +MSI/MSI-X support requires support from both system hardware and individual hardware device functions. -5.4.1 System hardware support +5.5.1 System hardware support Since the target of MSI address is the local APIC CPU, enabling -MSI support in Linux kernel is dependent on whether existing +MSI/MSI-X support in Linux kernel is dependent on whether existing system hardware supports local APIC. Users should verify their system whether it runs when CONFIG_X86_LOCAL_APIC=y. In SMP environment, CONFIG_X86_LOCAL_APIC is automatically set; however, in UP environment, users must manually set CONFIG_X86_LOCAL_APIC. Once CONFIG_X86_LOCAL_APIC=y, setting -CONFIG_PCI_USE_VECTOR enables the VECTOR based scheme and +CONFIG_PCI_MSI enables the VECTOR based scheme and the option for MSI-capable device drivers to selectively enable -MSI (using pci_enable_msi as described below). +MSI/MSI-X. -Note that CONFIG_X86_IO_APIC setting is irrelevant because MSI -vector is allocated new during runtime and MSI support does not -depend on BIOS support. This key independency enables MSI support -on future IOxAPIC free platform. +Note that CONFIG_X86_IO_APIC setting is irrelevant because MSI/MSI-X +vector is allocated new during runtime and MSI/MSI-X support does not +depend on BIOS support. This key independency enables MSI/MSI-X +support on future IOxAPIC free platform. -5.4.2 Device hardware support +5.5.2 Device hardware support The hardware device function supports MSI by indicating the MSI/MSI-X capability structure on its PCI capability list. By default, this capability structure will not be initialized by @@ -249,17 +430,19 @@ which may result in system hang. The software driver of specific MSI-capable hardware is responsible for whether calling pci_enable_msi or not. A return of zero indicates the kernel successfully initializes the MSI/MSI-X capability structure of the -device funtion. The device function is now running on MSI mode. +device funtion. The device function is now running on MSI/MSI-X mode. -5.5 How to tell whether MSI is enabled on device function +5.6 How to tell whether MSI/MSI-X is enabled on device function -At the driver level, a return of zero from pci_enable_msi(...) -indicates to the device driver that its device function is -initialized successfully and ready to run in MSI mode. +At the driver level, a return of zero from the function call of +pci_enable_msi()/pci_enable_msix() indicates to a device driver that +its device function is initialized successfully and ready to run in +MSI/MSI-X mode. At the user level, users can use command 'cat /proc/interrupts' -to display the vector allocated for the device and its interrupt -mode, as shown below. +to display the vector allocated for a device and its interrupt +MSI/MSI-X mode ("PCI MSI"/"PCI MSIX"). Below shows below MSI mode is +enabled on a SCSI Adaptec 39320D Ultra320. CPU0 CPU1 0: 324639 0 IO-APIC-edge timer diff --git a/Documentation/arm/Booting b/Documentation/arm/Booting index c9feb2d5c797..a851d039ad01 100644 --- a/Documentation/arm/Booting +++ b/Documentation/arm/Booting @@ -50,7 +50,7 @@ As an alternative, the boot loader can pass the relevant 'console=' option to the kernel via the tagged lists specifying the port, and serial format options as described in - linux/Documentation/kernel-parameters.txt. + Documentation/kernel-parameters.txt. 3. Detect the machine type diff --git a/Documentation/cdrom/aztcd b/Documentation/cdrom/aztcd index cdf46687d2f8..6bf0290ef7ce 100644 --- a/Documentation/cdrom/aztcd +++ b/Documentation/cdrom/aztcd @@ -1,5 +1,5 @@ $Id: README.aztcd,v 2.60 1997/11/29 09:51:25 root Exp root $ - Readme-File /usr/src/Documentation/cdrom/aztcd + Readme-File Documentation/cdrom/aztcd for AZTECH CD-ROM CDA268-01A, ORCHID CD-3110, OKANO/WEARNES CDD110, CONRAD TXC, CyCDROM CR520, CR540 @@ -524,7 +524,7 @@ should try restoring from a backup copy first)! A reworked and improved version called 'cdtester.c', which has yet more features for testing CDROM-drives can be found in -/usr/src/linux/Documentation/cdrom/sbpcd, written by E.Moenkeberg. +Documentation/cdrom/sbpcd, written by E.Moenkeberg. Werner Zimmermann Fachhochschule fuer Technik Esslingen diff --git a/Documentation/computone.txt b/Documentation/computone.txt index fb186e04f14a..ea2b5d3e3df9 100644 --- a/Documentation/computone.txt +++ b/Documentation/computone.txt @@ -302,7 +302,7 @@ shar archive to make it easier to extract the script from the documentation. To create the ip2mkdev shell script change to a convenient directory (/tmp works just fine) and run the following command: - unshar /usr/src/linux/Documentation/computone.txt + unshar Documentation/computone.txt (This file) You should now have a file ip2mkdev in your current working directory with diff --git a/Documentation/digiepca.txt b/Documentation/digiepca.txt index 00845726313c..01c4adc59fc0 100644 --- a/Documentation/digiepca.txt +++ b/Documentation/digiepca.txt @@ -60,7 +60,7 @@ Samples: Supporting Tools: ----------------- Supporting tools include digiDload, digiConfig, buildPCI, and ditty. See -/usr/src/linux/Documentation/README.epca.dir/user.doc for more details. Note, +drivers/char/README.epca for more details. Note, this driver REQUIRES that digiDload be executed prior to it being used. Failure to do this will result in an ENODEV error. diff --git a/Documentation/dvb/firmware.txt b/Documentation/dvb/firmware.txt index 0991c0c1f933..37d880794c56 100644 --- a/Documentation/dvb/firmware.txt +++ b/Documentation/dvb/firmware.txt @@ -2,7 +2,7 @@ Some DVB cards and many newer frontends require proprietary, binary-only firmware. The DVB drivers will be converted to use the request_firmware() -hotplug interface (see linux/Documentation/firmware_class/). +hotplug interface (see Documentation/firmware_class/). (CONFIG_FW_LOADER) The firmware can be loaded automatically via the hotplug manager diff --git a/Documentation/dvb/ttusb-dec.txt b/Documentation/dvb/ttusb-dec.txt index b8e24995ce04..4a547fba77b7 100644 --- a/Documentation/dvb/ttusb-dec.txt +++ b/Documentation/dvb/ttusb-dec.txt @@ -57,7 +57,7 @@ mv STB_PC_S.bin build-2.4/dvb-ttusb-dec-3000s.fw Hotplug Firmware Loading for 2.6 kernels ---------------------------------------- For 2.6 kernels the firmware is loaded at the point that the driver module is -loaded. See linux/Documentation/dvb/firmware.txt for more information. +loaded. See Documentation/dvb/firmware.txt for more information. mv STB_PC_T.bin /usr/lib/hotplug/firmware/dvb-ttusb-dec-2000t.fw mv STB_PC_X.bin /usr/lib/hotplug/firmware/dvb-ttusb-dec-2540t.fw diff --git a/Documentation/filesystems/udf.txt b/Documentation/filesystems/udf.txt index a0bb3b230bf8..e5213bc301f7 100644 --- a/Documentation/filesystems/udf.txt +++ b/Documentation/filesystems/udf.txt @@ -1,5 +1,5 @@ * -* ./Documentation/filesystems/udf.txt +* Documentation/filesystems/udf.txt * UDF Filesystem version 0.9.8.1 diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt index 5ead20c6c744..b7554bd47703 100644 --- a/Documentation/filesystems/vfat.txt +++ b/Documentation/filesystems/vfat.txt @@ -19,18 +19,23 @@ fmask=### -- The permission mask for files. codepage=### -- Sets the codepage number for converting to shortname characters on FAT filesystem. - By default, FAT_DEFAULT_CODEPAGE setting is used. + + NOTE: If this option was not specified, the file name + may not be read/written rightly, also filesystem is + mounted as read-only. iocharset=name -- Character set to use for converting between the encoding is used for user visible filename and 16 bit Unicode characters. Long filenames are stored on disk in Unicode format, but Unix for the most part doesn't know how to deal with Unicode. - By default, FAT_DEFAULT_IOCHARSET setting is used. - There is also an option of doing UTF8 translations with the utf8 option. + NOTE: If this option was not specified, the file name + may not be read/written rightly, also filesystem is + mounted as read-only. + NOTE: "iocharset=utf8" is not recommended. If unsure, you should consider the following option instead. diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt index 6b4ddf9c32fc..afa6d1299d53 100644 --- a/Documentation/i386/boot.txt +++ b/Documentation/i386/boot.txt @@ -334,7 +334,7 @@ They should normally not be deleted from the kernel command line even though not all of them are actually meaningful to the kernel. Boot loader authors who need additional command line options for the boot loader itself should get them registered in -linux/Documentation/kernel-parameters.txt to make sure they will not +Documentation/kernel-parameters.txt to make sure they will not conflict with actual kernel options now or in the future. vga=<mode> diff --git a/Documentation/locks.txt b/Documentation/locks.txt index d2a797e0b181..ce1be79edfb8 100644 --- a/Documentation/locks.txt +++ b/Documentation/locks.txt @@ -19,7 +19,7 @@ forever. This should not cause problems for anybody, since everybody using a 2.1.x kernel should have updated their C library to a suitable version -anyway (see the file "linux/Documentation/Changes".) +anyway (see the file "Documentation/Changes".) 1.2 Allow Mixed Locks Again --------------------------- diff --git a/Documentation/networking/Configurable b/Documentation/networking/Configurable index a941ca30f665..69c0dd466ead 100644 --- a/Documentation/networking/Configurable +++ b/Documentation/networking/Configurable @@ -7,7 +7,7 @@ you should be aware they do exist and can be changed. The current list of parameters can be found in the files: linux/net/TUNABLE - linux/Documentation/networking/ip-sysctl.txt + Documentation/networking/ip-sysctl.txt Some of these are accessible via the sysctl interface, and many more are scheduled to be added in this way. For example, some parameters related diff --git a/Documentation/networking/comx.txt b/Documentation/networking/comx.txt index 85ce5e5865f1..d1526eba2645 100644 --- a/Documentation/networking/comx.txt +++ b/Documentation/networking/comx.txt @@ -148,7 +148,7 @@ THE SLICECOM DRIVER The SliceCOM board doesn't require firmware. You can have 4 of these cards in one machine. The driver doesn't (yet) support shared interrupts, so you will need a separate IRQ line for every board. -Read linux/Documentation/networking/slicecom.txt for help on configuring +Read Documentation/networking/slicecom.txt for help on configuring this adapter. THE HDLC/PPP LINE PROTOCOL DRIVER diff --git a/Documentation/nmi_watchdog.txt b/Documentation/nmi_watchdog.txt index c1ba4e6f1ac8..6cad46e8ac2d 100644 --- a/Documentation/nmi_watchdog.txt +++ b/Documentation/nmi_watchdog.txt @@ -58,6 +58,9 @@ NOTE: starting with 2.4.2-ac18 the NMI-oopser is disabled by default, you have to enable it with a boot time parameter. Prior to 2.4.2-ac18 the NMI-oopser is enabled unconditionally on x86 SMP boxes. +On x86-64 the NMI oopser is on by default. On 64bit Intel CPUs +it uses IO-APIC by default and on AMD it uses local APIC. + [ feel free to send bug reports, suggestions and patches to Ingo Molnar <mingo@redhat.com> or the Linux SMP mailing list at <linux-smp@vger.kernel.org> ] diff --git a/Documentation/s390/3270.txt b/Documentation/s390/3270.txt index 38615b07fbb7..0a044e647d2d 100644 --- a/Documentation/s390/3270.txt +++ b/Documentation/s390/3270.txt @@ -117,7 +117,7 @@ Here are the installation steps in detail: Then notify /sbin/init that /etc/inittab has changed, by issuing the telinit command with the q operand: - cd /usr/src/linux/Documentation/s390 + cd Documentation/s390 sh config3270.sh sh /tmp/mkdev3270 telinit q diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt index c3407f6693a2..463dfc72f088 100644 --- a/Documentation/scsi/scsi_mid_low_api.txt +++ b/Documentation/scsi/scsi_mid_low_api.txt @@ -40,7 +40,7 @@ This version of the document roughly matches linux kernel version 2.6.0-test4. Documentation ============= There is a SCSI documentation directory within the kernel source tree, -typically /usr/src/linux/Documentation/scsi . Most documents are in plain +typically Documentation/scsi . Most documents are in plain (i.e. ASCII) text. This file is named scsi_mid_low_api.txt and can be found in that directory. A more recent copy of this document may be found at http://www.torque.net/scsi/scsi_mid_low_api.txt.gz . diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 934a49a595fb..e384c9f5f5ee 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl @@ -3641,7 +3641,7 @@ struct _snd_pcm_runtime { <para> More precise information can be found in - <filename>alsa-kernel/Documentation/sound/alsa/ControlNames.txt</filename>. + <filename>Documentation/sound/alsa/ControlNames.txt</filename>. </para> </section> </section> diff --git a/Documentation/sound/oss/INSTALL.awe b/Documentation/sound/oss/INSTALL.awe index 3bf7861acb19..310f42ca1e83 100644 --- a/Documentation/sound/oss/INSTALL.awe +++ b/Documentation/sound/oss/INSTALL.awe @@ -114,7 +114,7 @@ See INSTALL.RH for more details. # insmod awe_wave (Be sure to load awe_wave after sb!) - See /usr/src/linux/Documentation/sound/oss/AWE32 for + See Documentation/sound/oss/AWE32 for more details. 9. (only for obsolete systems) If you don't have /dev/sequencer diff --git a/Documentation/sound/oss/Introduction b/Documentation/sound/oss/Introduction index caffe54e7aa0..15d4fb975ac0 100644 --- a/Documentation/sound/oss/Introduction +++ b/Documentation/sound/oss/Introduction @@ -24,7 +24,7 @@ History: ======== 0.1.0 11/20/1998 First version, draft 1.0.0 11/1998 Alan Cox changes, incorporation in 2.2.0 - as /usr/src/linux/Documentation/sound/oss/Introduction + as Documentation/sound/oss/Introduction 1.1.0 6/30/1999 Second version, added notes on making the drivers, added info on multiple sound cards of similar types,] added more diagnostics info, added info about esd. @@ -439,7 +439,7 @@ For More Information (RTFM): 4) OSS's WWW site at http://www.opensound.com. -5) All the files in linux/Documentation/sound. +5) All the files in Documentation/sound. 6) The comments and code in linux/drivers/sound. diff --git a/Documentation/sound/oss/PAS16 b/Documentation/sound/oss/PAS16 index 3a6375139009..951b3dce51b4 100644 --- a/Documentation/sound/oss/PAS16 +++ b/Documentation/sound/oss/PAS16 @@ -9,7 +9,7 @@ and others whose names I could not find. This documentation is relevant for the PAS16 driver (pas2_card.c and friends) under kernel version 2.3.99 and later. If you are unfamiliar with configuring sound under Linux, please read the -Sound-HOWTO, linux/Documentation/sound/oss/Introduction and other +Sound-HOWTO, Documentation/sound/oss/Introduction and other relevant docs first. The following information is relevant information from README.OSS @@ -60,7 +60,7 @@ With PAS16 you can use two audio device files at the same time. /dev/dsp (and The new stuff for 2.3.99 and later ============================================================================ -The following configuration options from linux/Documentation/Configure.help +The following configuration options from Documentation/Configure.help are relevant to configuring the PAS16: Sound card support diff --git a/Documentation/sysctl/README b/Documentation/sysctl/README index 5afb48b68120..8c3306e01d52 100644 --- a/Documentation/sysctl/README +++ b/Documentation/sysctl/README @@ -60,11 +60,11 @@ debug/ <empty> dev/ device specific information (eg dev/cdrom/info) fs/ specific filesystems filehandle, inode, dentry and quota tuning - binfmt_misc <linux/Documentation/binfmt_misc.txt> + binfmt_misc <Documentation/binfmt_misc.txt> kernel/ global kernel info / tuning miscellaneous stuff net/ networking stuff, for documentation look in: - <linux/Documentation/networking/> + <Documentation/networking/> proc/ <empty> sunrpc/ SUN Remote Procedure Call (NFS) vm/ memory management tuning diff --git a/Documentation/usb/URB.txt b/Documentation/usb/URB.txt index 6c508f192f99..d59b95cc6f1b 100644 --- a/Documentation/usb/URB.txt +++ b/Documentation/usb/URB.txt @@ -4,7 +4,7 @@ Again: 2002-Jul-06 NOTE: The USB subsystem now has a substantial section in "The Linux Kernel API" - guide (in linux/Documentation/DocBook), generated from the current source + guide (in Documentation/DocBook), generated from the current source code. This particular documentation file isn't particularly current or complete; don't rely on it except for a quick overview. diff --git a/Documentation/usb/usb-help.txt b/Documentation/usb/usb-help.txt index 98ade189e61b..b7c324973695 100644 --- a/Documentation/usb/usb-help.txt +++ b/Documentation/usb/usb-help.txt @@ -2,7 +2,7 @@ usb-help.txt 2000-July-12 For USB help other than the readme files that are located in -linux/Documentation/usb/*, see the following: +Documentation/usb/*, see the following: Linux-USB project: http://www.linux-usb.org mirrors at http://www.suse.cz/development/linux-usb/ diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran index db46ba263087..01425c21986b 100644 --- a/Documentation/video4linux/Zoran +++ b/Documentation/video4linux/Zoran @@ -308,7 +308,7 @@ details (structs/ioctls). Information - video4linux: http://roadrunner.swansea.linux.org.uk/v4lapi.shtml -/usr/src/linux/Documentation/video4linux/API.html +Documentation/video4linux/API.html /usr/include/linux/videodev.h Information - video4linux/mjpeg extensions: diff --git a/MAINTAINERS b/MAINTAINERS index 842b27639841..ddd2500496e8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -632,7 +632,7 @@ S: Maintained DEFXX FDDI NETWORK DRIVER P: Maciej W. Rozycki -M: macro@ds2.pg.gda.pl +M: macro@linux-mips.org S: Maintained DELL LAPTOP SMM DRIVER @@ -1283,6 +1283,13 @@ W: http://www.penguinppc.org/ L: linuxppc-embedded@lists.linuxppc.org S: Maintained +LINUX FOR POWERPC EMBEDDED PPC8XX AND BOOT CODE +P: Tom Rini +M: trini@kernel.crashing.org +W: http://www.penguinppc.org/ +L: linuxppc-embedded@lists.linuxppc.org +S: Maintained + LINUX FOR POWERPC EMBEDDED PPC85XX P: Kumar Gala M: kumar.gala@freescale.com @@ -35,7 +35,7 @@ DOCUMENTATION: - There are various README files in the Documentation/ subdirectory: these typically contain kernel-specific installation notes for some - drivers for example. See ./Documentation/00-INDEX for a list of what + drivers for example. See Documentation/00-INDEX for a list of what is contained in each file. Please read the Changes file, as it contains information about the problems, which may result by upgrading your kernel. @@ -98,7 +98,7 @@ SOFTWARE REQUIREMENTS Compiling and running the 2.6.xx kernels requires up-to-date versions of various software packages. Consult - ./Documentation/Changes for the minimum version numbers required + Documentation/Changes for the minimum version numbers required and how to get updates for these packages. Beware that using excessively old versions of these packages can cause indirect errors that are very difficult to track down, so don't assume that @@ -168,7 +168,7 @@ COMPILING the kernel: gcc 2.91.66 (egcs-1.1.2), and gcc 2.7.2.3 are known to miscompile some parts of the kernel, and are *no longer supported*. Also remember to upgrade your binutils package (for as/ld/nm and company) - if necessary. For more information, refer to ./Documentation/Changes. + if necessary. For more information, refer to Documentation/Changes. Please note that you can still run a.out user programs with this kernel. diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index e98b02c273b3..5c98fc83e238 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c @@ -5,7 +5,7 @@ * Copyright (C) 2001-2002 Jan-Benedict Glaw <jbglaw@lug-owl.de> * * This driver is at all a modified version of Erik Mouw's - * ./linux/Documentation/DocBook/procfs_example.c, so: thank + * Documentation/DocBook/procfs_example.c, so: thank * you, Erik! He can be reached via email at * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1e03065a3f4f..db5ad1f64c6d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -370,7 +370,7 @@ config CPU_FREQ_INTEGRATOR help This enables the CPUfreq driver for ARM Integrator CPUs. - For details, take a look at linux/Documentation/cpu-freq. + For details, take a look at <file:Documentation/cpu-freq>. If in doubt, say Y. diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index f2525368b495..a40687e7c290 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -73,7 +73,7 @@ static struct irq_pin_list { } irq_2_pin[PIN_MAP_SIZE]; int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define vector_to_irq(vector) \ (platform_legacy_irq(vector) ? vector : vector_irq[vector]) #else @@ -1114,7 +1114,7 @@ static inline int IO_APIC_irq_trigger(int irq) /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI int assign_irq_vector(int irq) #else int __init assign_irq_vector(int irq) @@ -1868,7 +1868,7 @@ static void end_level_ioapic_irq (unsigned int irq) } } -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static unsigned int startup_edge_ioapic_vector(unsigned int vector) { int irq = vector_to_irq(vector); diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 4103f593823c..6aa9e5fcfd76 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c @@ -817,7 +817,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) if ( dev2->irq && dev2->irq != irq && \ (!(pci_probe & PCI_USE_PIRQ_MASK) || \ ((1 << dev2->irq) & mask)) ) { -#ifndef CONFIG_PCI_USE_VECTOR +#ifndef CONFIG_PCI_MSI printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", pci_name(dev2), dev2->irq, irq); #endif @@ -1034,7 +1034,7 @@ int pirq_enable_irq(struct pci_dev *dev) } dev = temp_dev; if (irq >= 0) { -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI if (!platform_legacy_irq(irq)) irq = IO_APIC_VECTOR(irq); #endif diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 74361e207f98..032168b86a49 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig @@ -191,7 +191,7 @@ config CPU_FREQ fly. This is a nice method to save battery power on notebooks, because the lower the clock speed, the less power the CPU consumes. - For more information, take a look at linux/Documentation/cpu-freq or + For more information, take a look at <file:Documentation/cpu-freq> or at <http://www.brodo.de/cpufreq/> If in doubt, say N. @@ -650,7 +650,7 @@ config 8272 config CPM2 bool - depends on 8260 + depends on 8260 || MPC8560 default y help The CPM2 (Communications Processor Module) is a coprocessor on diff --git a/arch/ppc/kernel/head_e500.S b/arch/ppc/kernel/head_e500.S index 8f0c590f1453..ceb51d3436fa 100644 --- a/arch/ppc/kernel/head_e500.S +++ b/arch/ppc/kernel/head_e500.S @@ -1177,6 +1177,8 @@ _GLOBAL(giveup_spe) evmwumiaa evr6, evr6, evr6 /* evr6 <- ACC = 0 * 0 + ACC */ li r4,THREAD_ACC evstddx evr6, r4, r3 /* save off accumulator */ + mfspr r6,SPRN_SPEFSCR + stw r6,THREAD_SPEFSCR(r3) /* save spefscr register value */ beq 1f lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5) lis r3,MSR_SPE@h diff --git a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c index 6bb1fcc04c2c..2ac2e4b55225 100644 --- a/arch/ppc/kernel/irq.c +++ b/arch/ppc/kernel/irq.c @@ -171,7 +171,12 @@ setup_irq(unsigned int irq, struct irqaction * new) if (!shared) { desc->depth = 0; desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING); - unmask_irq(irq); + if (desc->handler) { + if (desc->handler->startup) + desc->handler->startup(irq); + else if (desc->handler->enable) + desc->handler->enable(irq); + } } spin_unlock_irqrestore(&desc->lock,flags); diff --git a/arch/ppc/platforms/85xx/Kconfig b/arch/ppc/platforms/85xx/Kconfig index 36cc0622c096..e4666df37710 100644 --- a/arch/ppc/platforms/85xx/Kconfig +++ b/arch/ppc/platforms/85xx/Kconfig @@ -17,10 +17,20 @@ choice default MPC8540_ADS config MPC8540_ADS - bool "MPC8540ADS" + bool "Freescale MPC8540 ADS" help This option enables support for the MPC 8540 ADS evaluation board. +config MPC8555_CDS + bool "Freescale MPC8555 CDS" + help + This option enablese support for the MPC8555 CDS evaluation board. + +config MPC8560_ADS + bool "Freescale MPC8560 ADS" + help + This option enables support for the MPC 8560 ADS evaluation board. + config SBC8560 bool "WindRiver PowerQUICC III SBC8560" help @@ -37,9 +47,19 @@ config MPC8540 depends on MPC8540_ADS default y +config MPC8555 + bool + depends on MPC8555_CDS + default y + config MPC8560 bool - depends on SBC8560 + depends on SBC8560 || MPC8560_ADS + default y + +config 85xx_PCI2 + bool "Supprt for 2nd PCI host controller" + depends on MPC8555_CDS default y config FSL_OCP @@ -49,7 +69,7 @@ config FSL_OCP config PPC_GEN550 bool - depends on MPC8540 || SBC8560 + depends on MPC8540 || SBC8560 || MPC8555 default y endmenu diff --git a/arch/ppc/platforms/85xx/Makefile b/arch/ppc/platforms/85xx/Makefile index e88c515a3736..673b970f16d3 100644 --- a/arch/ppc/platforms/85xx/Makefile +++ b/arch/ppc/platforms/85xx/Makefile @@ -3,7 +3,10 @@ # obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads_common.o mpc8540_ads.o +obj-$(CONFIG_MPC8555_CDS) += mpc85xx_cds_common.o +obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o obj-$(CONFIG_MPC8540) += mpc8540.o +obj-$(CONFIG_MPC8555) += mpc8555.o obj-$(CONFIG_MPC8560) += mpc8560.o diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c index aada593a6c54..aada7e4561b5 100644 --- a/arch/ppc/platforms/85xx/mpc8540_ads.c +++ b/arch/ppc/platforms/85xx/mpc8540_ads.c @@ -30,6 +30,7 @@ #include <linux/serial.h> #include <linux/tty.h> /* for linux/serial_core.h */ #include <linux/serial_core.h> +#include <linux/initrd.h> #include <linux/module.h> #include <asm/system.h> diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.h b/arch/ppc/platforms/85xx/mpc8540_ads.h index 9056361f7bbe..0d602fc1fd3e 100644 --- a/arch/ppc/platforms/85xx/mpc8540_ads.h +++ b/arch/ppc/platforms/85xx/mpc8540_ads.h @@ -18,7 +18,6 @@ #define __MACH_MPC8540ADS_H__ #include <linux/config.h> -#include <linux/serial.h> #include <linux/initrd.h> #include <syslib/ppc85xx_setup.h> #include <platforms/85xx/mpc85xx_ads_common.h> diff --git a/arch/ppc/platforms/85xx/mpc8555.c b/arch/ppc/platforms/85xx/mpc8555.c new file mode 100644 index 000000000000..94275848027f --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc8555.c @@ -0,0 +1,88 @@ +/* + * arch/ppc/platform/85xx/mpc8555.c + * + * MPC8555 I/O descriptions + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include <linux/init.h> +#include <linux/module.h> +#include <asm/mpc85xx.h> +#include <asm/ocp.h> + +/* These should be defined in platform code */ +extern struct ocp_gfar_data mpc85xx_tsec1_def; +extern struct ocp_gfar_data mpc85xx_tsec2_def; +extern struct ocp_mpc_i2c_data mpc85xx_i2c1_def; + +/* We use offsets for paddr since we do not know at compile time + * what CCSRBAR is, platform code should fix this up in + * setup_arch + * + * Only the first IRQ is given even if a device has + * multiple lines associated with ita + */ +struct ocp_def core_ocp[] = { + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_IIC, + .index = 0, + .paddr = MPC85xx_IIC1_OFFSET, + .irq = MPC85xx_IRQ_IIC1, + .pm = OCP_CPM_NA, + .additions = &mpc85xx_i2c1_def, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_16550, + .index = 0, + .paddr = MPC85xx_UART0_OFFSET, + .irq = MPC85xx_IRQ_DUART, + .pm = OCP_CPM_NA, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_16550, + .index = 1, + .paddr = MPC85xx_UART1_OFFSET, + .irq = MPC85xx_IRQ_DUART, + .pm = OCP_CPM_NA, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_GFAR, + .index = 0, + .paddr = MPC85xx_ENET1_OFFSET, + .irq = MPC85xx_IRQ_TSEC1_TX, + .pm = OCP_CPM_NA, + .additions = &mpc85xx_tsec1_def, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_GFAR, + .index = 1, + .paddr = MPC85xx_ENET2_OFFSET, + .irq = MPC85xx_IRQ_TSEC2_TX, + .pm = OCP_CPM_NA, + .additions = &mpc85xx_tsec2_def, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_DMA, + .index = 0, + .paddr = MPC85xx_DMA_OFFSET, + .irq = MPC85xx_IRQ_DMA0, + .pm = OCP_CPM_NA, + }, + { .vendor = OCP_VENDOR_FREESCALE, + .function = OCP_FUNC_PERFMON, + .index = 0, + .paddr = MPC85xx_PERFMON_OFFSET, + .irq = MPC85xx_IRQ_PERFMON, + .pm = OCP_CPM_NA, + }, + { .vendor = OCP_VENDOR_INVALID + } +}; diff --git a/arch/ppc/platforms/85xx/mpc8555_cds.h b/arch/ppc/platforms/85xx/mpc8555_cds.h new file mode 100644 index 000000000000..566e0e1aa9da --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc8555_cds.h @@ -0,0 +1,26 @@ +/* + * arch/ppc/platforms/mpc8555_cds.h + * + * MPC8555CDS board definitions + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __MACH_MPC8555CDS_H__ +#define __MACH_MPC8555CDS_H__ + +#include <linux/config.h> +#include <linux/serial.h> +#include <platforms/85xx/mpc85xx_cds_common.h> + +#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET) + +#endif /* __MACH_MPC8555CDS_H__ */ diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c new file mode 100644 index 000000000000..0cb2c34588cd --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc8560_ads.c @@ -0,0 +1,241 @@ +/* + * arch/ppc/platforms/85xx/mpc8560_ads.c + * + * MPC8560ADS board specific routines + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include <linux/config.h> +#include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/errno.h> +#include <linux/reboot.h> +#include <linux/pci.h> +#include <linux/kdev_t.h> +#include <linux/major.h> +#include <linux/console.h> +#include <linux/delay.h> +#include <linux/irq.h> +#include <linux/seq_file.h> +#include <linux/root_dev.h> +#include <linux/serial.h> +#include <linux/tty.h> /* for linux/serial_core.h */ +#include <linux/serial_core.h> +#include <linux/initrd.h> +#include <linux/module.h> + +#include <asm/system.h> +#include <asm/pgtable.h> +#include <asm/page.h> +#include <asm/atomic.h> +#include <asm/time.h> +#include <asm/io.h> +#include <asm/machdep.h> +#include <asm/prom.h> +#include <asm/open_pic.h> +#include <asm/bootinfo.h> +#include <asm/pci-bridge.h> +#include <asm/mpc85xx.h> +#include <asm/irq.h> +#include <asm/immap_85xx.h> +#include <asm/kgdb.h> +#include <asm/ocp.h> +#include <asm/cpm2.h> +#include <mm/mmu_decl.h> + +#include <syslib/cpm2_pic.h> +#include <syslib/ppc85xx_common.h> +#include <syslib/ppc85xx_setup.h> + +extern void cpm2_reset(void); + +struct ocp_gfar_data mpc85xx_tsec1_def = { + .interruptTransmit = MPC85xx_IRQ_TSEC1_TX, + .interruptError = MPC85xx_IRQ_TSEC1_ERROR, + .interruptReceive = MPC85xx_IRQ_TSEC1_RX, + .interruptPHY = MPC85xx_IRQ_EXT5, + .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR + | GFAR_HAS_RMON | GFAR_HAS_COALESCE + | GFAR_HAS_PHY_INTR), + .phyid = 0, + .phyregidx = 0, +}; + +struct ocp_gfar_data mpc85xx_tsec2_def = { + .interruptTransmit = MPC85xx_IRQ_TSEC2_TX, + .interruptError = MPC85xx_IRQ_TSEC2_ERROR, + .interruptReceive = MPC85xx_IRQ_TSEC2_RX, + .interruptPHY = MPC85xx_IRQ_EXT5, + .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR + | GFAR_HAS_RMON | GFAR_HAS_COALESCE + | GFAR_HAS_PHY_INTR), + .phyid = 1, + .phyregidx = 0, +}; + +struct ocp_fs_i2c_data mpc85xx_i2c1_def = { + .flags = FS_I2C_SEPARATE_DFSRR, +}; + +/* ************************************************************************ + * + * Setup the architecture + * + */ + +static void __init +mpc8560ads_setup_arch(void) +{ + struct ocp_def *def; + struct ocp_gfar_data *einfo; + bd_t *binfo = (bd_t *) __res; + unsigned int freq; + + cpm2_reset(); + + /* get the core frequency */ + freq = binfo->bi_intfreq; + + if (ppc_md.progress) + ppc_md.progress("mpc8560ads_setup_arch()", 0); + + /* Set loops_per_jiffy to a half-way reasonable value, + for use until calibrate_delay gets called. */ + loops_per_jiffy = freq / HZ; + +#ifdef CONFIG_PCI + /* setup PCI host bridges */ + mpc85xx_setup_hose(); +#endif + + def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 0); + if (def) { + einfo = (struct ocp_gfar_data *) def->additions; + memcpy(einfo->mac_addr, binfo->bi_enetaddr, 6); + } + + def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 1); + if (def) { + einfo = (struct ocp_gfar_data *) def->additions; + memcpy(einfo->mac_addr, binfo->bi_enet1addr, 6); + } + +#ifdef CONFIG_BLK_DEV_INITRD + if (initrd_start) + ROOT_DEV = Root_RAM0; + else +#endif +#ifdef CONFIG_ROOT_NFS + ROOT_DEV = Root_NFS; +#else + ROOT_DEV = Root_HDA1; +#endif + + ocp_for_each_device(mpc85xx_update_paddr_ocp, &(binfo->bi_immr_base)); +} + +static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs) +{ + while ((irq = cpm2_get_irq(regs)) >= 0) { + ppc_irq_dispatch_handler(regs, irq); + } + return IRQ_HANDLED; +} + +static void __init +mpc8560_ads_init_IRQ(void) +{ + int i; + volatile cpm2_map_t *immap = cpm2_immr; + + /* Setup OpenPIC */ + mpc85xx_ads_init_IRQ(); + + /* disable all CPM interupts */ + immap->im_intctl.ic_simrh = 0x0; + immap->im_intctl.ic_simrl = 0x0; + + for (i = CPM_IRQ_OFFSET; i < (NR_CPM_INTS + CPM_IRQ_OFFSET); i++) + irq_desc[i].handler = &cpm2_pic; + + /* Initialize the default interrupt mapping priorities, + * in case the boot rom changed something on us. + */ + immap->im_intctl.ic_sicr = 0; + immap->im_intctl.ic_scprrh = 0x05309770; + immap->im_intctl.ic_scprrl = 0x05309770; + + request_irq(MPC85xx_IRQ_CPM, cpm2_cascade, SA_INTERRUPT, "cpm2_cascade", NULL); + + return; +} + + + +/* ************************************************************************ */ +void __init +platform_init(unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, unsigned long r7) +{ + /* parse_bootinfo must always be called first */ + parse_bootinfo(find_bootinfo()); + + /* + * If we were passed in a board information, copy it into the + * residual data area. + */ + if (r3) { + memcpy((void *) __res, (void *) (r3 + KERNELBASE), + sizeof (bd_t)); + + } +#if defined(CONFIG_BLK_DEV_INITRD) + /* + * If the init RAM disk has been configured in, and there's a valid + * starting address for it, set it up. + */ + if (r4) { + initrd_start = r4 + KERNELBASE; + initrd_end = r5 + KERNELBASE; + } +#endif /* CONFIG_BLK_DEV_INITRD */ + + /* Copy the kernel command line arguments to a safe place. */ + + if (r6) { + *(char *) (r7 + KERNELBASE) = 0; + strcpy(cmd_line, (char *) (r6 + KERNELBASE)); + } + + /* setup the PowerPC module struct */ + ppc_md.setup_arch = mpc8560ads_setup_arch; + ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo; + + ppc_md.init_IRQ = mpc8560_ads_init_IRQ; + ppc_md.get_irq = openpic_get_irq; + + ppc_md.restart = mpc85xx_restart; + ppc_md.power_off = mpc85xx_power_off; + ppc_md.halt = mpc85xx_halt; + + ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory; + + ppc_md.time_init = NULL; + ppc_md.set_rtc_time = NULL; + ppc_md.get_rtc_time = NULL; + ppc_md.calibrate_decr = mpc85xx_calibrate_decr; + + if (ppc_md.progress) + ppc_md.progress("mpc8560ads_init(): exit", 0); + + return; +} diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.h b/arch/ppc/platforms/85xx/mpc8560_ads.h new file mode 100644 index 000000000000..7df885d73e9d --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc8560_ads.h @@ -0,0 +1,27 @@ +/* + * arch/ppc/platforms/mpc8560_ads.h + * + * MPC8540ADS board definitions + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __MACH_MPC8560ADS_H +#define __MACH_MPC8560ADS_H + +#include <linux/config.h> +#include <syslib/ppc85xx_setup.h> +#include <platforms/85xx/mpc85xx_ads_common.h> + +#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET) +#define PHY_INTERRUPT MPC85xx_IRQ_EXT7 + +#endif /* __MACH_MPC8560ADS_H */ diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c new file mode 100644 index 000000000000..c7e53e39c680 --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c @@ -0,0 +1,473 @@ +/* + * arch/ppc/platform/85xx/mpc85xx_cds_common.c + * + * MPC85xx CDS board specific routines + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor, Inc + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include <linux/config.h> +#include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/errno.h> +#include <linux/reboot.h> +#include <linux/pci.h> +#include <linux/kdev_t.h> +#include <linux/major.h> +#include <linux/console.h> +#include <linux/delay.h> +#include <linux/irq.h> +#include <linux/seq_file.h> +#include <linux/serial.h> +#include <linux/module.h> +#include <linux/root_dev.h> +#include <linux/initrd.h> +#include <linux/tty.h> +#include <linux/serial_core.h> + +#include <asm/system.h> +#include <asm/pgtable.h> +#include <asm/page.h> +#include <asm/atomic.h> +#include <asm/time.h> +#include <asm/io.h> +#include <asm/machdep.h> +#include <asm/prom.h> +#include <asm/open_pic.h> +#include <asm/bootinfo.h> +#include <asm/pci-bridge.h> +#include <asm/mpc85xx.h> +#include <asm/irq.h> +#include <asm/immap_85xx.h> +#include <asm/immap_cpm2.h> +#include <asm/ocp.h> +#include <asm/kgdb.h> + +#include <mm/mmu_decl.h> +#include <syslib/cpm2_pic.h> +#include <syslib/ppc85xx_common.h> +#include <syslib/ppc85xx_setup.h> + + +#ifndef CONFIG_PCI +unsigned long isa_io_base = 0; +unsigned long isa_mem_base = 0; +#endif + +extern unsigned long total_memory; /* in mm/init */ + +unsigned char __res[sizeof (bd_t)]; + +static int cds_pci_slot = 2; +static volatile u8 * cadmus; + +/* Internal interrupts are all Level Sensitive, and Positive Polarity */ + +static u_char mpc85xx_cds_openpic_initsenses[] __initdata = { + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 0: L2 Cache */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 1: ECM */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 2: DDR DRAM */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 3: LBIU */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 4: DMA 0 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 5: DMA 1 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 6: DMA 2 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 7: DMA 3 */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 8: PCI/PCI-X */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 9: RIO Inbound Port Write Error */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 10: RIO Doorbell Inbound */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 11: RIO Outbound Message */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 12: RIO Inbound Message */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 13: TSEC 0 Transmit */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 14: TSEC 0 Receive */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 15: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 16: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 17: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 18: TSEC 0 Receive/Transmit Error */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 19: TSEC 1 Transmit */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 20: TSEC 1 Receive */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 21: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 22: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 23: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 24: TSEC 1 Receive/Transmit Error */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 25: Fast Ethernet */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 26: DUART */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 27: I2C */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 28: Performance Monitor */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 29: Unused */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 30: CPM */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Internal 31: Unused */ +#if defined(CONFIG_PCI) + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 0: PCI1 slot */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 1: PCI1 slot */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI1 slot */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI1 slot */ +#else + 0x0, /* External 0: */ + 0x0, /* External 1: */ + 0x0, /* External 2: */ + 0x0, /* External 3: */ +#endif + 0x0, /* External 4: */ + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */ + 0x0, /* External 6: */ + 0x0, /* External 7: */ + 0x0, /* External 8: */ + 0x0, /* External 9: */ + 0x0, /* External 10: */ +#if defined(CONFIG_85xx_PCI2) && defined(CONFIG_PCI) + (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 11: PCI2 slot 0 */ +#else + 0x0, /* External 11: */ +#endif +}; + +struct ocp_gfar_data mpc85xx_tsec1_def = { + .interruptTransmit = MPC85xx_IRQ_TSEC1_TX, + .interruptError = MPC85xx_IRQ_TSEC1_ERROR, + .interruptReceive = MPC85xx_IRQ_TSEC1_RX, + .interruptPHY = MPC85xx_IRQ_EXT5, + .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR | + GFAR_HAS_PHY_INTR), + .phyid = 0, + .phyregidx = 0, +}; + +struct ocp_gfar_data mpc85xx_tsec2_def = { + .interruptTransmit = MPC85xx_IRQ_TSEC2_TX, + .interruptError = MPC85xx_IRQ_TSEC2_ERROR, + .interruptReceive = MPC85xx_IRQ_TSEC2_RX, + .interruptPHY = MPC85xx_IRQ_EXT5, + .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR | + GFAR_HAS_PHY_INTR), + .phyid = 1, + .phyregidx = 0, +}; + +struct ocp_fs_i2c_data mpc85xx_i2c1_def = { + .flags = FS_I2C_SEPARATE_DFSRR, +}; + +/* ************************************************************************ */ +int +mpc85xx_cds_show_cpuinfo(struct seq_file *m) +{ + uint pvid, svid, phid1; + uint memsize = total_memory; + bd_t *binfo = (bd_t *) __res; + unsigned int freq; + + /* get the core frequency */ + freq = binfo->bi_intfreq; + + pvid = mfspr(PVR); + svid = mfspr(SVR); + + seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); + seq_printf(m, "Machine\t\t: CDS (%x)\n", cadmus[CM_VER]); + seq_printf(m, "bus freq\t: %u.%.6u MHz\n", freq / 1000000, + freq % 1000000); + seq_printf(m, "PVR\t\t: 0x%x\n", pvid); + seq_printf(m, "SVR\t\t: 0x%x\n", svid); + + /* Display cpu Pll setting */ + phid1 = mfspr(HID1); + seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); + + /* Display the amount of memory */ + seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024)); + + return 0; +} + +#ifdef CONFIG_CPM2 +static void cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs) +{ + while((irq = cpm2_get_irq(regs)) >= 0) + { + ppc_irq_dispatch_handler(regs,irq); + } +} +#endif /* CONFIG_CPM2 */ + +void __init +mpc85xx_cds_init_IRQ(void) +{ + bd_t *binfo = (bd_t *) __res; +#ifdef CONFIG_CPM2 + volatile cpm2_map_t *immap = cpm2_immr; + int i; +#endif + + /* Determine the Physical Address of the OpenPIC regs */ + phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET; + OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE); + OpenPIC_InitSenses = mpc85xx_cds_openpic_initsenses; + OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses); + + /* Skip reserved space and internal sources */ + openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200); + /* Map PIC IRQs 0-11 */ + openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000); + + /* we let openpic interrupts starting from an offset, to + * leave space for cascading interrupts underneath. + */ + openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET); + +#ifdef CONFIG_CPM2 + /* disable all CPM interupts */ + immap->im_intctl.ic_simrh = 0x0; + immap->im_intctl.ic_simrl = 0x0; + + for (i = CPM_IRQ_OFFSET; i < (NR_CPM_INTS + CPM_IRQ_OFFSET); i++) + irq_desc[i].handler = &cpm2_pic; + + /* Initialize the default interrupt mapping priorities, + * in case the boot rom changed something on us. + */ + immap->im_intctl.ic_sicr = 0; + immap->im_intctl.ic_scprrh = 0x05309770; + immap->im_intctl.ic_scprrl = 0x05309770; + + request_irq(MPC85xx_IRQ_CPM, cpm2_cascade, SA_INTERRUPT, "cpm2_cascade", NULL); +#endif + + return; +} + +#ifdef CONFIG_PCI +/* + * interrupt routing + */ +int +mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) +{ + struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); + + if (!hose->index) + { + /* Handle PCI1 interrupts */ + char pci_irq_table[][4] = + /* + * PCI IDSEL/INTPIN->INTLINE + * A B C D + */ + + /* Note IRQ assignment for slots is based on which slot the elysium is + * in -- in this setup elysium is in slot #2 (this PIRQA as first + * interrupt on slot */ + { + { 0, 1, 2, 3 }, /* 16 - PMC */ + { 3, 0, 0, 0 }, /* 17 P2P (Tsi320) */ + { 0, 1, 2, 3 }, /* 18 - Slot 1 */ + { 1, 2, 3, 0 }, /* 19 - Slot 2 */ + { 2, 3, 0, 1 }, /* 20 - Slot 3 */ + { 3, 0, 1, 2 }, /* 21 - Slot 4 */ + }; + + const long min_idsel = 16, max_idsel = 21, irqs_per_slot = 4; + int i, j; + + for (i = 0; i < 6; i++) + for (j = 0; j < 4; j++) + pci_irq_table[i][j] = + ((pci_irq_table[i][j] + 5 - + cds_pci_slot) & 0x3) + PIRQ0A; + + return PCI_IRQ_TABLE_LOOKUP; + } else { + /* Handle PCI2 interrupts (if we have one) */ + char pci_irq_table[][4] = + { + /* + * We only have one slot and one interrupt + * going to PIRQA - PIRQD */ + { PIRQ1A, PIRQ1A, PIRQ1A, PIRQ1A }, /* 21 - slot 0 */ + }; + + const long min_idsel = 21, max_idsel = 21, irqs_per_slot = 4; + + return PCI_IRQ_TABLE_LOOKUP; + } +} + +#define ARCADIA_HOST_BRIDGE_IDSEL 17 +#define ARCADIA_2ND_BRIDGE_IDSEL 3 + +int +mpc85xx_exclude_device(u_char bus, u_char devfn) +{ + if (bus == 0 && PCI_SLOT(devfn) == 0) + return PCIBIOS_DEVICE_NOT_FOUND; +#if CONFIG_85xx_PCI2 + /* With the current code we know PCI2 will be bus 2, however this may + * not be guarnteed */ + if (bus == 2 && PCI_SLOT(devfn) == 0) + return PCIBIOS_DEVICE_NOT_FOUND; +#endif + /* We explicitly do not go past the Tundra 320 Bridge */ + if (bus == 1) + return PCIBIOS_DEVICE_NOT_FOUND; + if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL)) + return PCIBIOS_DEVICE_NOT_FOUND; + else + return PCIBIOS_SUCCESSFUL; +} +#endif /* CONFIG_PCI */ + +/* ************************************************************************ + * + * Setup the architecture + * + */ +static void __init +mpc85xx_cds_setup_arch(void) +{ + struct ocp_def *def; + struct ocp_gfar_data *einfo; + bd_t *binfo = (bd_t *) __res; + unsigned int freq; + + /* get the core frequency */ + freq = binfo->bi_intfreq; + + printk("mpc85xx_cds_setup_arch\n"); + +#ifdef CONFIG_CPM2 + cpm2_reset(); +#endif + + cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE); + cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1; + printk("CDS Version = %x in PCI slot %d\n", cadmus[CM_VER], cds_pci_slot); + + /* Set loops_per_jiffy to a half-way reasonable value, + for use until calibrate_delay gets called. */ + loops_per_jiffy = freq / HZ; + +#ifdef CONFIG_PCI + /* setup PCI host bridges */ + mpc85xx_setup_hose(); +#endif + +#ifdef CONFIG_DUMMY_CONSOLE + conswitchp = &dummy_con; +#endif + +#ifdef CONFIG_SERIAL_8250 + mpc85xx_early_serial_map(); +#endif + +#ifdef CONFIG_SERIAL_TEXT_DEBUG + /* Invalidate the entry we stole earlier the serial ports + * should be properly mapped */ + invalidate_tlbcam_entry(NUM_TLBCAMS - 1); +#endif + + def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 0); + if (def) { + einfo = (struct ocp_gfar_data *) def->additions; + memcpy(einfo->mac_addr, binfo->bi_enetaddr, 6); + } + + def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 1); + if (def) { + einfo = (struct ocp_gfar_data *) def->additions; + memcpy(einfo->mac_addr, binfo->bi_enet1addr, 6); + } + +#ifdef CONFIG_BLK_DEV_INITRD + if (initrd_start) + ROOT_DEV = Root_RAM0; + else +#endif +#ifdef CONFIG_ROOT_NFS + ROOT_DEV = Root_NFS; +#else + ROOT_DEV = Root_HDA1; +#endif + + ocp_for_each_device(mpc85xx_update_paddr_ocp, &(binfo->bi_immr_base)); +} + +/* ************************************************************************ */ +void __init +platform_init(unsigned long r3, unsigned long r4, unsigned long r5, + unsigned long r6, unsigned long r7) +{ + /* parse_bootinfo must always be called first */ + parse_bootinfo(find_bootinfo()); + + /* + * If we were passed in a board information, copy it into the + * residual data area. + */ + if (r3) { + memcpy((void *) __res, (void *) (r3 + KERNELBASE), + sizeof (bd_t)); + + } +#ifdef CONFIG_SERIAL_TEXT_DEBUG + { + bd_t *binfo = (bd_t *) __res; + + /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */ + settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base, + binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); + + } +#endif + +#if defined(CONFIG_BLK_DEV_INITRD) + /* + * If the init RAM disk has been configured in, and there's a valid + * starting address for it, set it up. + */ + if (r4) { + initrd_start = r4 + KERNELBASE; + initrd_end = r5 + KERNELBASE; + } +#endif /* CONFIG_BLK_DEV_INITRD */ + + /* Copy the kernel command line arguments to a safe place. */ + + if (r6) { + *(char *) (r7 + KERNELBASE) = 0; + strcpy(cmd_line, (char *) (r6 + KERNELBASE)); + } + + /* setup the PowerPC module struct */ + ppc_md.setup_arch = mpc85xx_cds_setup_arch; + ppc_md.show_cpuinfo = mpc85xx_cds_show_cpuinfo; + + ppc_md.init_IRQ = mpc85xx_cds_init_IRQ; + ppc_md.get_irq = openpic_get_irq; + + ppc_md.restart = mpc85xx_restart; + ppc_md.power_off = mpc85xx_power_off; + ppc_md.halt = mpc85xx_halt; + + ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory; + + ppc_md.time_init = NULL; + ppc_md.set_rtc_time = NULL; + ppc_md.get_rtc_time = NULL; + ppc_md.calibrate_decr = mpc85xx_calibrate_decr; + +#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG) + ppc_md.progress = gen550_progress; +#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */ + + if (ppc_md.progress) + ppc_md.progress("mpc85xx_cds_init(): exit", 0); + + return; +} diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h new file mode 100644 index 000000000000..a7290ed833d0 --- /dev/null +++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h @@ -0,0 +1,78 @@ +/* + * arch/ppc/platforms/85xx/mpc85xx_cds_common.h + * + * MPC85xx CDS board definitions + * + * Maintainer: Kumar Gala <kumar.gala@freescale.com> + * + * Copyright 2004 Freescale Semiconductor, Inc + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __MACH_MPC85XX_CDS_H__ +#define __MACH_MPC85XX_CDS_H__ + +#include <linux/config.h> +#include <linux/serial.h> +#include <asm/ppcboot.h> +#include <linux/initrd.h> +#include <syslib/ppc85xx_setup.h> + +#define BOARD_CCSRBAR ((uint)0xe0000000) +#define CCSRBAR_SIZE ((uint)1024*1024) + +/* CADMUS info */ +#define CADMUS_BASE (0xf8004000) +#define CADMUS_SIZE (256) +#define CM_VER (0) +#define CM_CSR (1) +#define CM_RST (2) + +/* PCI config */ +#define PCI1_CFG_ADDR_OFFSET (0x8000) +#define PCI1_CFG_DATA_OFFSET (0x8004) + +#define PCI2_CFG_ADDR_OFFSET (0x9000) +#define PCI2_CFG_DATA_OFFSET (0x9004) + +/* PCI interrupt controller */ +#define PIRQ0A MPC85xx_IRQ_EXT0 +#define PIRQ0B MPC85xx_IRQ_EXT1 +#define PIRQ0C MPC85xx_IRQ_EXT2 +#define PIRQ0D MPC85xx_IRQ_EXT3 +#define PIRQ1A MPC85xx_IRQ_EXT11 + +/* PCI 1 memory map */ +#define MPC85XX_PCI1_LOWER_IO 0x00000000 +#define MPC85XX_PCI1_UPPER_IO 0x00ffffff + +#define MPC85XX_PCI1_LOWER_MEM 0x80000000 +#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff + +#define MPC85XX_PCI1_IO_BASE 0xe2000000 +#define MPC85XX_PCI1_MEM_OFFSET 0x00000000 + +#define MPC85XX_PCI1_IO_SIZE 0x01000000 + +/* PCI 2 memory map */ +#define MPC85XX_PCI2_LOWER_IO 0x01000000 +#define MPC85XX_PCI2_UPPER_IO 0x01ffffff + +#define MPC85XX_PCI2_LOWER_MEM 0xa0000000 +#define MPC85XX_PCI2_UPPER_MEM 0xbfffffff + +#define MPC85XX_PCI2_IO_BASE 0xe3000000 +#define MPC85XX_PCI2_MEM_OFFSET 0x00000000 + +#define MPC85XX_PCI2_IO_SIZE 0x01000000 + +#define SERIAL_PORT_DFNS \ + STD_UART_OP(0) \ + STD_UART_OP(1) + +#endif /* __MACH_MPC85XX_CDS_H__ */ diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c index 1320eb94d0c9..a4a91aa6afce 100644 --- a/arch/ppc/platforms/85xx/sbc8560.c +++ b/arch/ppc/platforms/85xx/sbc8560.c @@ -30,6 +30,7 @@ #include <linux/serial.h> #include <linux/tty.h> /* for linux/serial_core.h */ #include <linux/serial_core.h> +#include <linux/initrd.h> #include <linux/module.h> #include <asm/system.h> diff --git a/arch/ppc/platforms/85xx/sbc8560.h b/arch/ppc/platforms/85xx/sbc8560.h index 6475d3079a82..5e1b00c77da5 100644 --- a/arch/ppc/platforms/85xx/sbc8560.h +++ b/arch/ppc/platforms/85xx/sbc8560.h @@ -16,8 +16,9 @@ #define __MACH_SBC8560_H__ #include <linux/config.h> -#include <linux/serial.h> #include <platforms/85xx/sbc85xx.h> + +#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET) #ifdef CONFIG_SERIAL_MANY_PORTS #define RS_TABLE_SIZE 64 diff --git a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c index 5566d7bc9685..bebba87931ee 100644 --- a/arch/ppc/platforms/pmac_pic.c +++ b/arch/ppc/platforms/pmac_pic.c @@ -144,6 +144,22 @@ static void __pmac pmac_set_irq_mask(unsigned int irq_nr, int nokicklost) spin_unlock_irqrestore(&pmac_pic_lock, flags); } +/* When an irq gets requested for the first client, if it's an + * edge interrupt, we clear any previous one on the controller + */ +static unsigned int __pmac pmac_startup_irq(unsigned int irq_nr) +{ + unsigned long bit = 1UL << (irq_nr & 0x1f); + int i = irq_nr >> 5; + + if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0) + out_le32(&pmac_irq_hw[i]->ack, bit); + set_bit(irq_nr, ppc_cached_irq_mask); + pmac_set_irq_mask(irq_nr, 0); + + return 0; +} + static void __pmac pmac_mask_irq(unsigned int irq_nr) { clear_bit(irq_nr, ppc_cached_irq_mask); @@ -168,25 +184,21 @@ static void __pmac pmac_end_irq(unsigned int irq_nr) struct hw_interrupt_type pmac_pic = { - " PMAC-PIC ", - NULL, - NULL, - pmac_unmask_irq, - pmac_mask_irq, - pmac_mask_and_ack_irq, - pmac_end_irq, - NULL + .typename = " PMAC-PIC ", + .startup = pmac_startup_irq, + .enable = pmac_unmask_irq, + .disable = pmac_mask_irq, + .ack = pmac_mask_and_ack_irq, + .end = pmac_end_irq, }; struct hw_interrupt_type gatwick_pic = { - " GATWICK ", - NULL, - NULL, - pmac_unmask_irq, - pmac_mask_irq, - pmac_mask_and_ack_irq, - pmac_end_irq, - NULL + .typename = " GATWICK ", + .startup = pmac_startup_irq, + .enable = pmac_unmask_irq, + .disable = pmac_mask_irq, + .ack = pmac_mask_and_ack_irq, + .end = pmac_end_irq, }; static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs) diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 0cbfb1e69c01..0939624fb66e 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile @@ -69,10 +69,10 @@ obj-$(CONFIG_SANDPOINT) += i8259.o pci_auto.o todc_time.o obj-$(CONFIG_SBC82xx) += todc_time.o obj-$(CONFIG_SPRUCE) += cpc700_pic.o indirect_pci.o pci_auto.o \ todc_time.o -obj-$(CONFIG_8260) += m8260_setup.o cpm2_pic.o +obj-$(CONFIG_8260) += m8260_setup.o obj-$(CONFIG_PCI_8260) += m8260_pci.o indirect_pci.o obj-$(CONFIG_8260_PCI9) += m8260_pci_erratum9.o -obj-$(CONFIG_CPM2) += cpm2_common.o +obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o ifeq ($(CONFIG_PPC_GEN550),y) obj-$(CONFIG_KGDB) += gen550_kgdb.o gen550_dbg.o obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c index 731d6d0b9408..6ceea97f4132 100644 --- a/arch/ppc/syslib/ppc85xx_setup.c +++ b/arch/ppc/syslib/ppc85xx_setup.c @@ -169,17 +169,20 @@ mpc85xx_setup_pci1(struct pci_controller *hose) pci->piwar2 = 0; pci->piwar3 = 0; - /* Setup 512M Phys:PCI 1:1 outbound mem window @ 0x80000000 */ + /* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI1_LOWER_MEM */ pci->potar1 = (MPC85XX_PCI1_LOWER_MEM >> 12) & 0x000fffff; pci->potear1 = 0x00000000; pci->powbar1 = (MPC85XX_PCI1_LOWER_MEM >> 12) & 0x000fffff; - pci->powar1 = 0x8004401c; /* Enable, Mem R/W, 512M */ + /* Enable, Mem R/W */ + pci->powar1 = 0x80044000 | + (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1); - /* Setup 16M outboud IO windows @ 0xe2000000 */ + /* Setup outboud IO windows @ MPC85XX_PCI1_IO_BASE */ pci->potar2 = 0x00000000; pci->potear2 = 0x00000000; pci->powbar2 = (MPC85XX_PCI1_IO_BASE >> 12) & 0x000fffff; - pci->powar2 = 0x80088017; /* Enable, IO R/W, 16M */ + /* Enable, IO R/W */ + pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1); /* Setup 2G inbound Memory Window @ 0 */ pci->pitar1 = 0x00000000; @@ -192,7 +195,7 @@ mpc85xx_setup_pci1(struct pci_controller *hose) extern int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin); extern int mpc85xx_exclude_device(u_char bus, u_char devfn); -#if CONFIG_85xx_PCI2 +#ifdef CONFIG_85xx_PCI2 static void __init mpc85xx_setup_pci2(struct pci_controller *hose) { @@ -203,10 +206,10 @@ mpc85xx_setup_pci2(struct pci_controller *hose) pci = ioremap(binfo->bi_immr_base + MPC85xx_PCI2_OFFSET, MPC85xx_PCI2_SIZE); - early_read_config_word(hose, 0, 0, PCI_COMMAND, &temps); + early_read_config_word(hose, hose->bus_offset, 0, PCI_COMMAND, &temps); temps |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; - early_write_config_word(hose, 0, 0, PCI_COMMAND, temps); - early_write_config_byte(hose, 0, 0, PCI_LATENCY_TIMER, 0x80); + early_write_config_word(hose, hose->bus_offset, 0, PCI_COMMAND, temps); + early_write_config_byte(hose, hose->bus_offset, 0, PCI_LATENCY_TIMER, 0x80); /* Disable all windows (except powar0 since its ignored) */ pci->powar1 = 0; @@ -217,17 +220,20 @@ mpc85xx_setup_pci2(struct pci_controller *hose) pci->piwar2 = 0; pci->piwar3 = 0; - /* Setup 512M Phys:PCI 1:1 outbound mem window @ 0xa0000000 */ + /* Setup Phys:PCI 1:1 outbound mem window @ MPC85XX_PCI2_LOWER_MEM */ pci->potar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff; pci->potear1 = 0x00000000; pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff; - pci->powar1 = 0x8004401c; /* Enable, Mem R/W, 512M */ + /* Enable, Mem R/W */ + pci->powar1 = 0x80044000 | + (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1); - /* Setup 16M outboud IO windows @ 0xe3000000 */ + /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */ pci->potar2 = 0x00000000; pci->potear2 = 0x00000000; pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff; - pci->powar2 = 0x80088017; /* Enable, IO R/W, 16M */ + /* Enable, IO R/W */ + pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1); /* Setup 2G inbound Memory Window @ 0 */ pci->pitar1 = 0x00000000; diff --git a/arch/ppc/syslib/ppc85xx_setup.h b/arch/ppc/syslib/ppc85xx_setup.h index fd76e9172b6b..678325989994 100644 --- a/arch/ppc/syslib/ppc85xx_setup.h +++ b/arch/ppc/syslib/ppc85xx_setup.h @@ -18,7 +18,6 @@ #define __PPC_SYSLIB_PPC85XX_SETUP_H #include <linux/config.h> -#include <linux/serial.h> #include <linux/init.h> #include <asm/ppcboot.h> diff --git a/arch/ppc64/boot/div64.S b/arch/ppc64/boot/div64.S index f3224d2d6659..38f7e466d7d6 100644 --- a/arch/ppc64/boot/div64.S +++ b/arch/ppc64/boot/div64.S @@ -14,7 +14,6 @@ * 2 of the License, or (at your option) any later version. */ #include <asm/ppc_asm.h> -#include <asm/processor.h> .globl __div64_32 __div64_32: diff --git a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c index a3b589969cd6..f19f76379544 100644 --- a/arch/ppc64/kernel/asm-offsets.c +++ b/arch/ppc64/kernel/asm-offsets.c @@ -86,10 +86,17 @@ int main(void) DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr)); DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real)); DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr)); - DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_next_rr)); + DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr)); DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1)); DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); DEFINE(PACAPROCENABLED, offsetof(struct paca_struct, proc_enabled)); + DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); + DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr)); + DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); + DEFINE(PACASLBR3, offsetof(struct paca_struct, slb_r3)); +#ifdef CONFIG_HUGETLB_PAGE + DEFINE(PACAHTLBSEGS, offsetof(struct paca_struct, context.htlb_segs)); +#endif /* CONFIG_HUGETLB_PAGE */ DEFINE(PACADEFAULTDECR, offsetof(struct paca_struct, default_decr)); DEFINE(PACAPROFENABLED, offsetof(struct paca_struct, prof_enabled)); DEFINE(PACAPROFLEN, offsetof(struct paca_struct, prof_len)); diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S index f00918b02bce..aefc7e6f0033 100644 --- a/arch/ppc64/kernel/head.S +++ b/arch/ppc64/kernel/head.S @@ -200,6 +200,7 @@ exception_marker: #define EX_R13 32 #define EX_SRR0 40 #define EX_DAR 48 +#define EX_LR 48 /* SLB miss saves LR, but not DAR */ #define EX_DSISR 56 #define EX_CCR 60 @@ -433,18 +434,52 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) .globl DataAccessSLB_Pseries DataAccessSLB_Pseries: mtspr SPRG1,r13 - mtspr SPRG2,r12 - mfspr r13,DAR - mfcr r12 - srdi r13,r13,60 - cmpdi r13,0xc - beq .do_slb_bolted_Pseries - mtcrf 0x80,r12 - mfspr r12,SPRG2 - EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, DataAccessSLB_common) + mfspr r13,SPRG3 /* get paca address into r13 */ + std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ + std r10,PACA_EXSLB+EX_R10(r13) + std r11,PACA_EXSLB+EX_R11(r13) + std r12,PACA_EXSLB+EX_R12(r13) + std r3,PACASLBR3(r13) + mfspr r9,SPRG1 + std r9,PACA_EXSLB+EX_R13(r13) + mfcr r9 + clrrdi r12,r13,32 /* get high part of &label */ + mfmsr r10 + mfspr r11,SRR0 /* save SRR0 */ + ori r12,r12,(.do_slb_miss)@l + ori r10,r10,MSR_IR|MSR_DR /* DON'T set RI for SLB miss */ + mtspr SRR0,r12 + mfspr r12,SRR1 /* and SRR1 */ + mtspr SRR1,r10 + mfspr r3,DAR + rfid STD_EXCEPTION_PSERIES(0x400, InstructionAccess) - STD_EXCEPTION_PSERIES(0x480, InstructionAccessSLB) + + . = 0x480 + .globl InstructionAccessSLB_Pseries +InstructionAccessSLB_Pseries: + mtspr SPRG1,r13 + mfspr r13,SPRG3 /* get paca address into r13 */ + std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ + std r10,PACA_EXSLB+EX_R10(r13) + std r11,PACA_EXSLB+EX_R11(r13) + std r12,PACA_EXSLB+EX_R12(r13) + std r3,PACASLBR3(r13) + mfspr r9,SPRG1 + std r9,PACA_EXSLB+EX_R13(r13) + mfcr r9 + clrrdi r12,r13,32 /* get high part of &label */ + mfmsr r10 + mfspr r11,SRR0 /* save SRR0 */ + ori r12,r12,(.do_slb_miss)@l + ori r10,r10,MSR_IR|MSR_DR /* DON'T set RI for SLB miss */ + mtspr SRR0,r12 + mfspr r12,SRR1 /* and SRR1 */ + mtspr SRR1,r10 + mr r3,r11 /* SRR0 is faulting address */ + rfid + STD_EXCEPTION_PSERIES(0x500, HardwareInterrupt) STD_EXCEPTION_PSERIES(0x600, Alignment) STD_EXCEPTION_PSERIES(0x700, ProgramCheck) @@ -494,11 +529,6 @@ _GLOBAL(do_stab_bolted_Pseries) mfspr r12,SPRG2 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) -_GLOBAL(do_slb_bolted_Pseries) - mtcrf 0x80,r12 - mfspr r12,SPRG2 - EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_slb_bolted) - /* Space for the naca. Architected to be located at real address * NACA_PHYS_ADDR. Various tools rely on this location being fixed. @@ -587,27 +617,25 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) .globl DataAccessSLB_Iseries DataAccessSLB_Iseries: mtspr SPRG1,r13 /* save r13 */ - mtspr SPRG2,r12 - mfspr r13,DAR - mfcr r12 - srdi r13,r13,60 - cmpdi r13,0xc - beq .do_slb_bolted_Iseries - mtcrf 0x80,r12 - mfspr r12,SPRG2 - EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN) - EXCEPTION_PROLOG_ISERIES_2 - b DataAccessSLB_common - -.do_slb_bolted_Iseries: - mtcrf 0x80,r12 - mfspr r12,SPRG2 EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) - EXCEPTION_PROLOG_ISERIES_2 - b .do_slb_bolted + std r3,PACASLBR3(r13) + ld r11,PACALPPACA+LPPACASRR0(r13) + ld r12,PACALPPACA+LPPACASRR1(r13) + mfspr r3,DAR + b .do_slb_miss STD_EXCEPTION_ISERIES(0x400, InstructionAccess, PACA_EXGEN) - STD_EXCEPTION_ISERIES(0x480, InstructionAccessSLB, PACA_EXGEN) + + .globl InstructionAccessSLB_Iseries +InstructionAccessSLB_Iseries: + mtspr SPRG1,r13 /* save r13 */ + EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB) + std r3,PACASLBR3(r13) + ld r11,PACALPPACA+LPPACASRR0(r13) + ld r12,PACALPPACA+LPPACASRR1(r13) + mr r3,r11 + b .do_slb_miss + MASKABLE_EXCEPTION_ISERIES(0x500, HardwareInterrupt) STD_EXCEPTION_ISERIES(0x600, Alignment, PACA_EXGEN) STD_EXCEPTION_ISERIES(0x700, ProgramCheck, PACA_EXGEN) @@ -865,21 +893,6 @@ DataAccess_common: b .do_hash_page /* Try to handle as hpte fault */ .align 7 - .globl DataAccessSLB_common -DataAccessSLB_common: - mfspr r10,DAR - std r10,PACA_EXGEN+EX_DAR(r13) - EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN) - ld r3,PACA_EXGEN+EX_DAR(r13) - std r3,_DAR(r1) - bl .slb_allocate - cmpdi r3,0 /* Check return code */ - beq fast_exception_return /* Return if we succeeded */ - li r5,0 - std r5,_DSISR(r1) - b .handle_page_fault - - .align 7 .globl InstructionAccess_common InstructionAccess_common: EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) @@ -889,21 +902,6 @@ InstructionAccess_common: b .do_hash_page /* Try to handle as hpte fault */ .align 7 - .globl InstructionAccessSLB_common -InstructionAccessSLB_common: - EXCEPTION_PROLOG_COMMON(0x480, PACA_EXGEN) - ld r3,_NIP(r1) /* SRR0 = NIA */ - bl .slb_allocate - or. r3,r3,r3 /* Check return code */ - beq+ fast_exception_return /* Return if we succeeded */ - - ld r4,_NIP(r1) - li r5,0 - std r4,_DAR(r1) - std r5,_DSISR(r1) - b .handle_page_fault - - .align 7 .globl HardwareInterrupt_common .globl HardwareInterrupt_entry HardwareInterrupt_common: @@ -1152,130 +1150,37 @@ _GLOBAL(do_stab_bolted) /* * r13 points to the PACA, r9 contains the saved CR, * r11 and r12 contain the saved SRR0 and SRR1. + * r3 has the faulting address * r9 - r13 are saved in paca->exslb. + * r3 is saved in paca->slb_r3 * We assume we aren't going to take any exceptions during this procedure. */ -/* XXX note fix masking in get_kernel_vsid to match */ -_GLOBAL(do_slb_bolted) +_GLOBAL(do_slb_miss) + mflr r10 + stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ + std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ - /* - * We take the next entry, round robin. Previously we tried - * to find a free slot first but that took too long. Unfortunately - * we dont have any LRU information to help us choose a slot. - */ - - /* r13 = paca */ -1: ld r10,PACASTABRR(r13) - addi r9,r10,1 - cmpdi r9,SLB_NUM_ENTRIES - blt+ 2f - li r9,2 /* dont touch slot 0 or 1 */ -2: std r9,PACASTABRR(r13) - - /* r13 = paca, r10 = entry */ - - /* - * Never cast out the segment for our kernel stack. Since we - * dont invalidate the ERAT we could have a valid translation - * for the kernel stack during the first part of exception exit - * which gets invalidated due to a tlbie from another cpu at a - * non recoverable point (after setting srr0/1) - Anton - */ - slbmfee r9,r10 - srdi r9,r9,27 - /* - * Use paca->ksave as the value of the kernel stack pointer, - * because this is valid at all times. - * The >> 27 (rather than >> 28) is so that the LSB is the - * valid bit - this way we check valid and ESID in one compare. - * In order to completely close the tiny race in the context - * switch (between updating r1 and updating paca->ksave), - * we check against both r1 and paca->ksave. - */ - srdi r11,r1,27 - ori r11,r11,1 - cmpd r11,r9 - beq- 1b - ld r11,PACAKSAVE(r13) - srdi r11,r11,27 - ori r11,r11,1 - cmpd r11,r9 - beq- 1b - - /* r13 = paca, r10 = entry */ - - /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ - mfspr r9,DAR - rldicl r11,r9,36,51 - sldi r11,r11,15 - srdi r9,r9,60 - or r11,r11,r9 - - /* VSID_RANDOMIZER */ - li r9,9 - sldi r9,r9,32 - oris r9,r9,58231 - ori r9,r9,39831 - - /* vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK */ - mulld r11,r11,r9 - clrldi r11,r11,28 - - /* r13 = paca, r10 = entry, r11 = vsid */ - - /* Put together slb word1 */ - sldi r11,r11,12 - -BEGIN_FTR_SECTION - /* set kp and c bits */ - ori r11,r11,0x480 -END_FTR_SECTION_IFCLR(CPU_FTR_16M_PAGE) -BEGIN_FTR_SECTION - /* set kp, l and c bits */ - ori r11,r11,0x580 -END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) - - /* r13 = paca, r10 = entry, r11 = slb word1 */ - - /* Put together slb word0 */ - mfspr r9,DAR - clrrdi r9,r9,28 /* get the new esid */ - oris r9,r9,0x800 /* set valid bit */ - rldimi r9,r10,0,52 /* insert entry */ - - /* r13 = paca, r9 = slb word0, r11 = slb word1 */ - - /* - * No need for an isync before or after this slbmte. The exception - * we enter with and the rfid we exit with are context synchronizing . - */ - slbmte r11,r9 + bl .slb_allocate /* handle it */ /* All done -- return from exception. */ + + ld r10,PACA_EXSLB+EX_LR(r13) + ld r3,PACASLBR3(r13) lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */ + mtlr r10 + andi. r10,r12,MSR_RI /* check for unrecoverable exception */ beq- unrecov_slb - /* - * Until everyone updates binutils hardwire the POWER4 optimised - * single field mtcrf - */ -#if 0 - .machine push - .machine "power4" +.machine push +.machine "power4" mtcrf 0x80,r9 - .machine pop -#else - .long 0x7d380120 -#endif - - mfmsr r10 - clrrdi r10,r10,2 - mtmsrd r10,1 + mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ +.machine pop mtspr SRR0,r11 mtspr SRR1,r12 diff --git a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c index 73d5b7ea50e4..a04037bba220 100644 --- a/arch/ppc64/kernel/pSeries_pci.c +++ b/arch/ppc64/kernel/pSeries_pci.c @@ -284,10 +284,10 @@ static void __init pci_process_bridge_OF_ranges(struct pci_controller *hose, isa_dn = of_find_node_by_type(NULL, "isa"); if (isa_dn) { isa_io_base = pci_io_base; - of_node_put(isa_dn); pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys, hose->io_base_virt); + of_node_put(isa_dn); /* Allow all IO */ io_page_mask = -1; } diff --git a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c index 8537d7708a48..0e4228316345 100644 --- a/arch/ppc64/kernel/pacaData.c +++ b/arch/ppc64/kernel/pacaData.c @@ -57,7 +57,6 @@ char emergency_stack[PAGE_SIZE * NR_CPUS] __attribute__((aligned(128))); .stab_addr = (asrv), /* Virt pointer to segment table */ \ .emergency_sp = &emergency_stack[((number)+1) * PAGE_SIZE], \ .cpu_start = (start), /* Processor start */ \ - .stab_next_rr = 1, \ .lppaca = { \ .xDesc = 0xd397d781, /* "LpPa" */ \ .xSize = sizeof(struct ItLpPaca), \ diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c index 1a4175811510..bdf5e3a476dc 100644 --- a/arch/ppc64/kernel/prom.c +++ b/arch/ppc64/kernel/prom.c @@ -1412,11 +1412,11 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end unsigned long needed, unsigned long align) { void *ret; - unsigned long offset = reloc_offset(); *mem_start = ALIGN(*mem_start, align); if (*mem_start + needed > *mem_end) { #ifdef CONFIG_BLK_DEV_INITRD + unsigned long offset = reloc_offset(); /* FIXME: Apple OF doesn't map unclaimed mem. If this * ever happened on G5, we'd need to fix. */ unsigned long initrd_len; diff --git a/arch/ppc64/kernel/ras.c b/arch/ppc64/kernel/ras.c index 4a4744269cac..595ae6ec24b5 100644 --- a/arch/ppc64/kernel/ras.c +++ b/arch/ppc64/kernel/ras.c @@ -52,8 +52,8 @@ #include <asm/rtas.h> #include <asm/ppcdebug.h> -static unsigned char log_buf[RTAS_ERROR_LOG_MAX]; -static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; +static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; +static spinlock_t ras_log_buf_lock = SPIN_LOCK_UNLOCKED; static int ras_get_sensor_state_token; static int ras_check_exception_token; @@ -155,23 +155,23 @@ ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs) else critical = 0; - spin_lock(&log_lock); + spin_lock(&ras_log_buf_lock); status = rtas_call(ras_check_exception_token, 6, 1, NULL, RAS_VECTOR_OFFSET, virt_irq_to_real(irq_offset_down(irq)), RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, - critical, __pa(&log_buf), RTAS_ERROR_LOG_MAX); + critical, __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX); udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n", - *((unsigned long *)&log_buf), status, state); + *((unsigned long *)&ras_log_buf), status, state); printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n", - *((unsigned long *)&log_buf), status, state); + *((unsigned long *)&ras_log_buf), status, state); /* format and print the extended information */ - log_error(log_buf, ERR_TYPE_RTAS_LOG, 0); + log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0); - spin_unlock(&log_lock); + spin_unlock(&ras_log_buf_lock); return IRQ_HANDLED; } @@ -190,15 +190,15 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) int status = 0xdeadbeef; int fatal; - spin_lock(&log_lock); + spin_lock(&ras_log_buf_lock); status = rtas_call(ras_check_exception_token, 6, 1, NULL, RAS_VECTOR_OFFSET, virt_irq_to_real(irq_offset_down(irq)), RTAS_INTERNAL_ERROR, 1 /*Time Critical */, - __pa(&log_buf), RTAS_ERROR_LOG_MAX); + __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX); - rtas_elog = (struct rtas_error_log *)log_buf; + rtas_elog = (struct rtas_error_log *)ras_log_buf; if ((status == 0) && (rtas_elog->severity >= SEVERITY_ERROR_SYNC)) fatal = 1; @@ -206,13 +206,13 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) fatal = 0; /* format and print the extended information */ - log_error(log_buf, ERR_TYPE_RTAS_LOG, fatal); + log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal); if (fatal) { udbg_printf("Fatal HW Error <0x%lx 0x%x>\n", - *((unsigned long *)&log_buf), status); + *((unsigned long *)&ras_log_buf), status); printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n", - *((unsigned long *)&log_buf), status); + *((unsigned long *)&ras_log_buf), status); #ifndef DEBUG /* Don't actually power off when debugging so we can test @@ -223,12 +223,12 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) #endif } else { udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n", - *((unsigned long *)&log_buf), status); + *((unsigned long *)&ras_log_buf), status); printk(KERN_WARNING "Warning: Recoverable hardware error <0x%lx 0x%x>\n", - *((unsigned long *)&log_buf), status); + *((unsigned long *)&ras_log_buf), status); } - spin_unlock(&log_lock); + spin_unlock(&ras_log_buf_lock); return IRQ_HANDLED; } diff --git a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c index e5b853d9040d..438d258dcea3 100644 --- a/arch/ppc64/kernel/rtas.c +++ b/arch/ppc64/kernel/rtas.c @@ -500,7 +500,7 @@ void rtas_stop_self(void) BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE); - printk("%u %u Ready to die...\n", + printk("cpu %u (hwid %u) Ready to die...\n", smp_processor_id(), hard_smp_processor_id()); enter_rtas(__pa(rtas_args)); diff --git a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c index f76fffc754d8..7538cea27aed 100644 --- a/arch/ppc64/kernel/rtasd.c +++ b/arch/ppc64/kernel/rtasd.c @@ -33,7 +33,7 @@ #define DEBUG(A...) #endif -static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t rtasd_log_lock = SPIN_LOCK_UNLOCKED; DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait); @@ -152,7 +152,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) if (buf == NULL) return; - spin_lock_irqsave(&log_lock, s); + spin_lock_irqsave(&rtasd_log_lock, s); /* get length and increase count */ switch (err_type & ERR_TYPE_MASK) { @@ -163,7 +163,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) break; case ERR_TYPE_KERNEL_PANIC: default: - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); return; } @@ -174,7 +174,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) /* Check to see if we need to or have stopped logging */ if (fatal || no_more_logging) { no_more_logging = 1; - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); return; } @@ -199,12 +199,12 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) else rtas_log_start += 1; - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); wake_up_interruptible(&rtas_log_wait); break; case ERR_TYPE_KERNEL_PANIC: default: - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); return; } @@ -247,24 +247,24 @@ static ssize_t rtas_log_read(struct file * file, char * buf, return -ENOMEM; - spin_lock_irqsave(&log_lock, s); + spin_lock_irqsave(&rtasd_log_lock, s); /* if it's 0, then we know we got the last one (the one in NVRAM) */ if (rtas_log_size == 0 && !no_more_logging) nvram_clear_error_log(); - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); error = wait_event_interruptible(rtas_log_wait, rtas_log_size); if (error) goto out; - spin_lock_irqsave(&log_lock, s); + spin_lock_irqsave(&rtasd_log_lock, s); offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK); memcpy(tmp, &rtas_log_buf[offset], count); rtas_log_start += 1; rtas_log_size -= 1; - spin_unlock_irqrestore(&log_lock, s); + spin_unlock_irqrestore(&rtasd_log_lock, s); error = copy_to_user(buf, tmp, count) ? -EFAULT : count; out: diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c index f12b476c0c96..1f3003408930 100644 --- a/arch/ppc64/kernel/smp.c +++ b/arch/ppc64/kernel/smp.c @@ -389,8 +389,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) /* Fixup atomic count: it exited inside IRQ handler. */ paca[lcpu].__current->thread_info->preempt_count = 0; - /* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */ - paca[lcpu].stab_next_rr = 0; /* At boot this is done in prom.c. */ paca[lcpu].hw_cpu_id = pcpu; @@ -935,7 +933,11 @@ int __devinit __cpu_up(unsigned int cpu) if (smp_ops->give_timebase) smp_ops->give_timebase(); - cpu_set(cpu, cpu_online_map); + + /* Wait until cpu puts itself in the online map */ + while (!cpu_online(cpu)) + cpu_relax(); + return 0; } @@ -971,6 +973,10 @@ int __devinit start_secondary(void *unused) #endif #endif + spin_lock(&call_lock); + cpu_set(cpu, cpu_online_map); + spin_unlock(&call_lock); + local_irq_enable(); return cpu_idle(NULL); diff --git a/arch/ppc64/kernel/stab.c b/arch/ppc64/kernel/stab.c index 0c0dc272a7f8..3eea165b2433 100644 --- a/arch/ppc64/kernel/stab.c +++ b/arch/ppc64/kernel/stab.c @@ -20,26 +20,10 @@ #include <asm/naca.h> #include <asm/cputable.h> -static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid); -static void make_slbe(unsigned long esid, unsigned long vsid, int large, - int kernel_segment); +static int make_ste(unsigned long stab, unsigned long esid, + unsigned long vsid); -static inline void slb_add_bolted(void) -{ -#ifndef CONFIG_PPC_ISERIES - unsigned long esid = GET_ESID(VMALLOCBASE); - unsigned long vsid = get_kernel_vsid(VMALLOCBASE); - - WARN_ON(!irqs_disabled()); - - /* - * Bolt in the first vmalloc segment. Since modules end - * up there it gets hit very heavily. - */ - get_paca()->stab_next_rr = 1; - make_slbe(esid, vsid, 0, 1); -#endif -} +void slb_initialize(void); /* * Build an entry for the base kernel segment and put it into @@ -48,32 +32,13 @@ static inline void slb_add_bolted(void) */ void stab_initialize(unsigned long stab) { - unsigned long esid, vsid; - int seg0_largepages = 0; - - esid = GET_ESID(KERNELBASE); - vsid = get_kernel_vsid(esid << SID_SHIFT); - - if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) - seg0_largepages = 1; + unsigned long vsid = get_kernel_vsid(KERNELBASE); if (cur_cpu_spec->cpu_features & CPU_FTR_SLB) { - /* Invalidate the entire SLB & all the ERATS */ -#ifdef CONFIG_PPC_ISERIES - asm volatile("isync; slbia; isync":::"memory"); -#else - asm volatile("isync":::"memory"); - asm volatile("slbmte %0,%0"::"r" (0) : "memory"); - asm volatile("isync; slbia; isync":::"memory"); - get_paca()->stab_next_rr = 0; - make_slbe(esid, vsid, seg0_largepages, 1); - asm volatile("isync":::"memory"); -#endif - - slb_add_bolted(); + slb_initialize(); } else { asm volatile("isync; slbia; isync":::"memory"); - make_ste(stab, esid, vsid); + make_ste(stab, GET_ESID(KERNELBASE), vsid); /* Order update */ asm volatile("sync":::"memory"); @@ -129,7 +94,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid) * Could not find empty entry, pick one with a round robin selection. * Search all entries in the two groups. */ - castout_entry = get_paca()->stab_next_rr; + castout_entry = get_paca()->stab_rr; for (i = 0; i < 16; i++) { if (castout_entry < 8) { global_entry = (esid & 0x1f) << 3; @@ -148,7 +113,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid) castout_entry = (castout_entry + 1) & 0xf; } - get_paca()->stab_next_rr = (castout_entry + 1) & 0xf; + get_paca()->stab_rr = (castout_entry + 1) & 0xf; /* Modify the old entry to the new value. */ @@ -314,229 +279,3 @@ void flush_stab(struct task_struct *tsk, struct mm_struct *mm) preload_stab(tsk, mm); } - -/* - * SLB stuff - */ - -/* - * Create a segment buffer entry for the given esid/vsid pair. - * - * NOTE: A context syncronising instruction is required before and after - * this, in the common case we use exception entry and rfid. - */ -static void make_slbe(unsigned long esid, unsigned long vsid, int large, - int kernel_segment) -{ - unsigned long entry, castout_entry; - union { - unsigned long word0; - slb_dword0 data; - } esid_data; - union { - unsigned long word0; - slb_dword1 data; - } vsid_data; - struct paca_struct *lpaca = get_paca(); - - /* - * We take the next entry, round robin. Previously we tried - * to find a free slot first but that took too long. Unfortunately - * we dont have any LRU information to help us choose a slot. - */ - - /* - * Never cast out the segment for our kernel stack. Since we - * dont invalidate the ERAT we could have a valid translation - * for the kernel stack during the first part of exception exit - * which gets invalidated due to a tlbie from another cpu at a - * non recoverable point (after setting srr0/1) - Anton - * - * paca Ksave is always valid (even when on the interrupt stack) - * so we use that. - */ - castout_entry = lpaca->stab_next_rr; - do { - entry = castout_entry; - castout_entry++; - /* - * We bolt in the first kernel segment and the first - * vmalloc segment. - */ - if (castout_entry >= SLB_NUM_ENTRIES) - castout_entry = 2; - asm volatile("slbmfee %0,%1" : "=r" (esid_data) : "r" (entry)); - } while (esid_data.data.v && - esid_data.data.esid == GET_ESID(lpaca->kstack)); - - lpaca->stab_next_rr = castout_entry; - - /* slbie not needed as the previous mapping is still valid. */ - - /* - * Write the new SLB entry. - */ - vsid_data.word0 = 0; - vsid_data.data.vsid = vsid; - vsid_data.data.kp = 1; - if (large) - vsid_data.data.l = 1; - if (kernel_segment) - vsid_data.data.c = 1; - else - vsid_data.data.ks = 1; - - esid_data.word0 = 0; - esid_data.data.esid = esid; - esid_data.data.v = 1; - esid_data.data.index = entry; - - /* - * No need for an isync before or after this slbmte. The exception - * we enter with and the rfid we exit with are context synchronizing. - */ - asm volatile("slbmte %0,%1" : : "r" (vsid_data), "r" (esid_data)); -} - -static inline void __slb_allocate(unsigned long esid, unsigned long vsid, - mm_context_t context) -{ - int large = 0; - int region_id = REGION_ID(esid << SID_SHIFT); - unsigned long offset; - - if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) { - if (region_id == KERNEL_REGION_ID) - large = 1; - else if (region_id == USER_REGION_ID) - large = in_hugepage_area(context, esid << SID_SHIFT); - } - - make_slbe(esid, vsid, large, region_id != USER_REGION_ID); - - if (region_id != USER_REGION_ID) - return; - - offset = __get_cpu_var(stab_cache_ptr); - if (offset < NR_STAB_CACHE_ENTRIES) - __get_cpu_var(stab_cache[offset++]) = esid; - else - offset = NR_STAB_CACHE_ENTRIES+1; - __get_cpu_var(stab_cache_ptr) = offset; -} - -/* - * Allocate a segment table entry for the given ea. - */ -int slb_allocate(unsigned long ea) -{ - unsigned long vsid, esid; - mm_context_t context; - - /* Check for invalid effective addresses. */ - if (unlikely(!IS_VALID_EA(ea))) - return 1; - - /* Kernel or user address? */ - if (REGION_ID(ea) >= KERNEL_REGION_ID) { - context = KERNEL_CONTEXT(ea); - vsid = get_kernel_vsid(ea); - } else { - if (unlikely(!current->mm)) - return 1; - - context = current->mm->context; - vsid = get_vsid(context.id, ea); - } - - esid = GET_ESID(ea); -#ifndef CONFIG_PPC_ISERIES - BUG_ON((esid << SID_SHIFT) == VMALLOCBASE); -#endif - __slb_allocate(esid, vsid, context); - - return 0; -} - -/* - * preload some userspace segments into the SLB. - */ -static void preload_slb(struct task_struct *tsk, struct mm_struct *mm) -{ - unsigned long pc = KSTK_EIP(tsk); - unsigned long stack = KSTK_ESP(tsk); - unsigned long unmapped_base; - unsigned long pc_esid = GET_ESID(pc); - unsigned long stack_esid = GET_ESID(stack); - unsigned long unmapped_base_esid; - unsigned long vsid; - - if (test_tsk_thread_flag(tsk, TIF_32BIT)) - unmapped_base = TASK_UNMAPPED_BASE_USER32; - else - unmapped_base = TASK_UNMAPPED_BASE_USER64; - - unmapped_base_esid = GET_ESID(unmapped_base); - - if (!IS_VALID_EA(pc) || (REGION_ID(pc) >= KERNEL_REGION_ID)) - return; - vsid = get_vsid(mm->context.id, pc); - __slb_allocate(pc_esid, vsid, mm->context); - - if (pc_esid == stack_esid) - return; - - if (!IS_VALID_EA(stack) || (REGION_ID(stack) >= KERNEL_REGION_ID)) - return; - vsid = get_vsid(mm->context.id, stack); - __slb_allocate(stack_esid, vsid, mm->context); - - if (pc_esid == unmapped_base_esid || stack_esid == unmapped_base_esid) - return; - - if (!IS_VALID_EA(unmapped_base) || - (REGION_ID(unmapped_base) >= KERNEL_REGION_ID)) - return; - vsid = get_vsid(mm->context.id, unmapped_base); - __slb_allocate(unmapped_base_esid, vsid, mm->context); -} - -/* Flush all user entries from the segment table of the current processor. */ -void flush_slb(struct task_struct *tsk, struct mm_struct *mm) -{ - unsigned long offset = __get_cpu_var(stab_cache_ptr); - union { - unsigned long word0; - slb_dword0 data; - } esid_data; - - if (offset <= NR_STAB_CACHE_ENTRIES) { - int i; - asm volatile("isync" : : : "memory"); - for (i = 0; i < offset; i++) { - esid_data.word0 = 0; - esid_data.data.esid = __get_cpu_var(stab_cache[i]); - BUG_ON(esid_data.data.esid == GET_ESID(VMALLOCBASE)); - asm volatile("slbie %0" : : "r" (esid_data)); - } - asm volatile("isync" : : : "memory"); - } else { - asm volatile("isync; slbia; isync" : : : "memory"); - slb_add_bolted(); - } - - /* Workaround POWER5 < DD2.1 issue */ - if (offset == 1 || offset > NR_STAB_CACHE_ENTRIES) { - /* - * flush segment in EEH region, we dont normally access - * addresses in this region. - */ - esid_data.word0 = 0; - esid_data.data.esid = EEH_REGION_ID; - asm volatile("slbie %0" : : "r" (esid_data)); - } - - __get_cpu_var(stab_cache_ptr) = 0; - - preload_slb(tsk, mm); -} diff --git a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c index 4ee39cd2c44a..a881d25f1f13 100644 --- a/arch/ppc64/kernel/xics.c +++ b/arch/ppc64/kernel/xics.c @@ -657,9 +657,7 @@ void xics_migrate_irqs_away(void) int set_indicator = rtas_token("set-indicator"); const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */ int status = 0; - unsigned int irq, cpu = smp_processor_id(); - int xics_status[2]; - unsigned long flags; + unsigned int irq, virq, cpu = smp_processor_id(); BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE); @@ -676,12 +674,20 @@ void xics_migrate_irqs_away(void) ops->cppr_info(cpu, DEFAULT_PRIORITY); iosync(); - printk(KERN_WARNING "HOTPLUG: Migrating IRQs away\n"); - for_each_irq(irq) { - irq_desc_t *desc = get_irq_desc(irq); + for_each_irq(virq) { + irq_desc_t *desc; + int xics_status[2]; + unsigned long flags; + + /* We cant set affinity on ISA interrupts */ + if (virq < irq_offset_value()) + continue; + + desc = get_irq_desc(virq); + irq = virt_irq_to_real(irq_offset_down(virq)); /* We need to get IPIs still. */ - if (irq_offset_down(irq) == XICS_IPI) + if (irq == XICS_IPI || irq == NO_IRQ) continue; /* We only need to migrate enabled IRQS */ @@ -696,7 +702,7 @@ void xics_migrate_irqs_away(void) if (status) { printk(KERN_ERR "migrate_irqs_away: irq=%d " "ibm,get-xive returns %d\n", - irq, status); + virq, status); goto unlock; } @@ -709,21 +715,20 @@ void xics_migrate_irqs_away(void) goto unlock; printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n", - irq, cpu); + virq, cpu); /* Reset affinity to all cpus */ xics_status[0] = default_distrib_server; - status = rtas_call(ibm_set_xive, 3, 1, NULL, - irq, xics_status[0], xics_status[1]); + status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, + xics_status[0], xics_status[1]); if (status) printk(KERN_ERR "migrate_irqs_away irq=%d " "ibm,set-xive returns %d\n", - irq, status); + virq, status); unlock: spin_unlock_irqrestore(&desc->lock, flags); } - } #endif diff --git a/arch/ppc64/mm/Makefile b/arch/ppc64/mm/Makefile index c8cdcf1e1d0b..0306babff21b 100644 --- a/arch/ppc64/mm/Makefile +++ b/arch/ppc64/mm/Makefile @@ -4,6 +4,6 @@ EXTRA_CFLAGS += -mno-minimal-toc -obj-y := fault.o init.o imalloc.o hash_utils.o hash_low.o tlb.o +obj-y := fault.o init.o imalloc.o hash_utils.o hash_low.o tlb.o slb_low.o slb.o obj-$(CONFIG_DISCONTIGMEM) += numa.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o diff --git a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c index 71c159841de5..b78e7f4ee0a7 100644 --- a/arch/ppc64/mm/fault.c +++ b/arch/ppc64/mm/fault.c @@ -93,13 +93,15 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long is_write = error_code & 0x02000000; unsigned long trap = TRAP(regs); - if (trap == 0x300 || trap == 0x380) { + BUG_ON((trap == 0x380) || (trap == 0x480)); + + if (trap == 0x300) { if (debugger_fault_handler(regs)) return 0; } /* On a kernel SLB miss we can only check for a valid exception entry */ - if (!user_mode(regs) && (trap == 0x380 || address >= TASK_SIZE)) + if (!user_mode(regs) && (address >= TASK_SIZE)) return SIGSEGV; if (error_code & 0x00400000) { diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c index 9c4829600c45..99d923868a6e 100644 --- a/arch/ppc64/mm/init.c +++ b/arch/ppc64/mm/init.c @@ -655,7 +655,7 @@ void __init mem_init(void) totalram_pages += free_all_bootmem(); - for (addr = KERNELBASE; addr <= (unsigned long)__va(lmb_end_of_DRAM()); + for (addr = KERNELBASE; addr < (unsigned long)__va(lmb_end_of_DRAM()); addr += PAGE_SIZE) { if (!PageReserved(virt_to_page(addr))) continue; diff --git a/arch/ppc64/mm/slb.c b/arch/ppc64/mm/slb.c new file mode 100644 index 000000000000..bc61258040a2 --- /dev/null +++ b/arch/ppc64/mm/slb.c @@ -0,0 +1,136 @@ +/* + * PowerPC64 SLB support. + * + * Copyright (C) 2004 David Gibson <dwg@au.ibm.com>, IBM + * Based on earlier code writteh by: + * Dave Engebretsen and Mike Corrigan {engebret|mikejc}@us.ibm.com + * Copyright (c) 2001 Dave Engebretsen + * Copyright (C) 2002 Anton Blanchard <anton@au.ibm.com>, IBM + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include <linux/config.h> +#include <asm/pgtable.h> +#include <asm/mmu.h> +#include <asm/mmu_context.h> +#include <asm/paca.h> +#include <asm/naca.h> +#include <asm/cputable.h> + +extern void slb_allocate(unsigned long ea); + +static inline void create_slbe(unsigned long ea, unsigned long vsid, + unsigned long flags, unsigned long entry) +{ + ea = (ea & ESID_MASK) | SLB_ESID_V | entry; + vsid = (vsid << SLB_VSID_SHIFT) | flags; + asm volatile("slbmte %0,%1" : + : "r" (vsid), "r" (ea) + : "memory" ); +} + +static void slb_add_bolted(void) +{ +#ifndef CONFIG_PPC_ISERIES + WARN_ON(!irqs_disabled()); + + /* If you change this make sure you change SLB_NUM_BOLTED + * appropriately too */ + + /* Slot 1 - first VMALLOC segment + * Since modules end up there it gets hit very heavily. + */ + create_slbe(VMALLOCBASE, get_kernel_vsid(VMALLOCBASE), + SLB_VSID_KERNEL, 1); + + asm volatile("isync":::"memory"); +#endif +} + +/* Flush all user entries from the segment table of the current processor. */ +void switch_slb(struct task_struct *tsk, struct mm_struct *mm) +{ + unsigned long offset = get_paca()->slb_cache_ptr; + unsigned long esid_data; + unsigned long pc = KSTK_EIP(tsk); + unsigned long stack = KSTK_ESP(tsk); + unsigned long unmapped_base; + + if (offset <= SLB_CACHE_ENTRIES) { + int i; + asm volatile("isync" : : : "memory"); + for (i = 0; i < offset; i++) { + esid_data = (unsigned long)get_paca()->slb_cache[i] + << SID_SHIFT; + asm volatile("slbie %0" : : "r" (esid_data)); + } + asm volatile("isync" : : : "memory"); + } else { + asm volatile("isync; slbia; isync" : : : "memory"); + slb_add_bolted(); + } + + /* Workaround POWER5 < DD2.1 issue */ + if (offset == 1 || offset > SLB_CACHE_ENTRIES) { + /* flush segment in EEH region, we shouldn't ever + * access addresses in this region. */ + asm volatile("slbie %0" : : "r"(EEHREGIONBASE)); + } + + get_paca()->slb_cache_ptr = 0; + get_paca()->context = mm->context; + + /* + * preload some userspace segments into the SLB. + */ + if (test_tsk_thread_flag(tsk, TIF_32BIT)) + unmapped_base = TASK_UNMAPPED_BASE_USER32; + else + unmapped_base = TASK_UNMAPPED_BASE_USER64; + + if (pc >= KERNELBASE) + return; + slb_allocate(pc); + + if (GET_ESID(pc) == GET_ESID(stack)) + return; + + if (stack >= KERNELBASE) + return; + slb_allocate(stack); + + if ((GET_ESID(pc) == GET_ESID(unmapped_base)) + || (GET_ESID(stack) == GET_ESID(unmapped_base))) + return; + + if (unmapped_base >= KERNELBASE) + return; + slb_allocate(unmapped_base); +} + +void slb_initialize(void) +{ +#ifdef CONFIG_PPC_ISERIES + asm volatile("isync; slbia; isync":::"memory"); +#else + unsigned long flags = SLB_VSID_KERNEL; + + /* Invalidate the entire SLB (even slot 0) & all the ERATS */ + if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) + flags |= SLB_VSID_L; + + asm volatile("isync":::"memory"); + asm volatile("slbmte %0,%0"::"r" (0) : "memory"); + asm volatile("isync; slbia; isync":::"memory"); + create_slbe(KERNELBASE, get_kernel_vsid(KERNELBASE), + flags, 0); + +#endif + slb_add_bolted(); + get_paca()->stab_rr = SLB_NUM_BOLTED; +} diff --git a/arch/ppc64/mm/slb_low.S b/arch/ppc64/mm/slb_low.S new file mode 100644 index 000000000000..367cb7dec858 --- /dev/null +++ b/arch/ppc64/mm/slb_low.S @@ -0,0 +1,168 @@ +/* + * arch/ppc64/mm/slb_low.S + * + * Low-level SLB routines + * + * Copyright (C) 2004 David Gibson <dwg@au.ibm.com>, IBM + * + * Based on earlier C version: + * Dave Engebretsen and Mike Corrigan {engebret|mikejc}@us.ibm.com + * Copyright (c) 2001 Dave Engebretsen + * Copyright (C) 2002 Anton Blanchard <anton@au.ibm.com>, IBM + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include <linux/config.h> +#include <asm/processor.h> +#include <asm/page.h> +#include <asm/mmu.h> +#include <asm/ppc_asm.h> +#include <asm/offsets.h> +#include <asm/cputable.h> + +/* void slb_allocate(unsigned long ea); + * + * Create an SLB entry for the given EA (user or kernel). + * r3 = faulting address, r13 = PACA + * r9, r10, r11 are clobbered by this function + * No other registers are examined or changed. + */ +_GLOBAL(slb_allocate) + /* + * First find a slot, round robin. Previously we tried to find + * a free slot first but that took too long. Unfortunately we + * dont have any LRU information to help us choose a slot. + */ + srdi r9,r1,27 + ori r9,r9,1 /* mangle SP for later compare */ + + ld r10,PACASTABRR(r13) +3: + addi r10,r10,1 + /* use a cpu feature mask if we ever change our slb size */ + cmpldi r10,SLB_NUM_ENTRIES + + blt+ 4f + li r10,SLB_NUM_BOLTED +4: + slbmfee r11,r10 + /* Don't throw out the segment for our kernel stack. Since we + * dont invalidate the ERAT we could have a valid translation + * for the kernel stack during the first part of exception + * exit which gets invalidated due to a tlbie from another cpu + * at a non recoverable point (after setting srr0/1) - Anton + * + * The >> 27 (rather than >> 28) is so that the LSB is the + * valid bit - this way we check valid and ESID in one compare. + */ + srdi r11,r11,27 + cmpd r11,r9 + beq- 3b + + std r10,PACASTABRR(r13) + + /* r3 = faulting address, r10 = entry */ + + srdi r9,r3,60 /* get region */ + srdi r3,r3,28 /* get esid */ + cmpldi cr7,r9,0xc /* cmp KERNELBASE for later use */ + + /* r9 = region, r3 = esid, cr7 = <>KERNELBASE */ + + rldicr. r11,r3,32,16 + bne- 8f /* invalid ea bits set */ + addi r11,r9,-1 + cmpldi r11,0xb + blt- 8f /* invalid region */ + + /* r9 = region, r3 = esid, r10 = entry, cr7 = <>KERNELBASE */ + + blt cr7,0f /* user or kernel? */ + + /* kernel address */ + li r11,SLB_VSID_KERNEL +BEGIN_FTR_SECTION + bne cr7,9f + li r11,(SLB_VSID_KERNEL|SLB_VSID_L) +END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) + b 9f + +0: /* user address */ + li r11,SLB_VSID_USER +#ifdef CONFIG_HUGETLB_PAGE +BEGIN_FTR_SECTION + /* check against the hugepage ranges */ + cmpldi r3,(TASK_HPAGE_END>>SID_SHIFT) + bge 6f /* >= TASK_HPAGE_END */ + cmpldi r3,(TASK_HPAGE_BASE>>SID_SHIFT) + bge 5f /* TASK_HPAGE_BASE..TASK_HPAGE_END */ + cmpldi r3,16 + bge 6f /* 4GB..TASK_HPAGE_BASE */ + + lhz r9,PACAHTLBSEGS(r13) + srd r9,r9,r3 + andi. r9,r9,1 + beq 6f + +5: /* this is a hugepage user address */ + li r11,(SLB_VSID_USER|SLB_VSID_L) +END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE) +#endif /* CONFIG_HUGETLB_PAGE */ + +6: ld r9,PACACONTEXTID(r13) + +9: /* r9 = "context", r3 = esid, r11 = flags, r10 = entry */ + + rldimi r9,r3,15,0 /* r9= VSID ordinal */ + +7: rldimi r10,r3,28,0 /* r10= ESID<<28 | entry */ + oris r10,r10,SLB_ESID_V@h /* r10 |= SLB_ESID_V */ + + /* r9 = ordinal, r3 = esid, r11 = flags, r10 = esid_data */ + + li r3,VSID_RANDOMIZER@higher + sldi r3,r3,32 + oris r3,r3,VSID_RANDOMIZER@h + ori r3,r3,VSID_RANDOMIZER@l + + mulld r9,r3,r9 /* r9 = ordinal * VSID_RANDOMIZER */ + clrldi r9,r9,28 /* r9 &= VSID_MASK */ + sldi r9,r9,SLB_VSID_SHIFT /* r9 <<= SLB_VSID_SHIFT */ + or r9,r9,r11 /* r9 |= flags */ + + /* r9 = vsid_data, r10 = esid_data, cr7 = <>KERNELBASE */ + + /* + * No need for an isync before or after this slbmte. The exception + * we enter with and the rfid we exit with are context synchronizing. + */ + slbmte r9,r10 + + bgelr cr7 /* we're done for kernel addresses */ + + /* Update the slb cache */ + lhz r3,PACASLBCACHEPTR(r13) /* offset = paca->slb_cache_ptr */ + cmpldi r3,SLB_CACHE_ENTRIES + bge 1f + + /* still room in the slb cache */ + sldi r11,r3,1 /* r11 = offset * sizeof(u16) */ + rldicl r10,r10,36,28 /* get low 16 bits of the ESID */ + add r11,r11,r13 /* r11 = (u16 *)paca + offset */ + sth r10,PACASLBCACHE(r11) /* paca->slb_cache[offset] = esid */ + addi r3,r3,1 /* offset++ */ + b 2f +1: /* offset >= SLB_CACHE_ENTRIES */ + li r3,SLB_CACHE_ENTRIES+1 +2: + sth r3,PACASLBCACHEPTR(r13) /* paca->slb_cache_ptr = offset */ + blr + +8: /* invalid EA */ + li r9,0 /* 0 VSID ordinal -> BAD_VSID */ + li r11,SLB_VSID_USER /* flags don't much matter */ + b 7b diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 58b48d275595..604428879bdc 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -139,7 +139,7 @@ config CPU_FREQ fly. Currently there are only sparc64 drivers for UltraSPARC-III and UltraSPARC-IIe processors. - For details, take a look at linux/Documentation/cpu-freq. + For details, take a look at <file:Documentation/cpu-freq>. If in doubt, say N. @@ -159,7 +159,7 @@ config US3_FREQ help This adds the CPUFreq driver for UltraSPARC-III processors. - For details, take a look at linux/Documentation/cpu-freq. + For details, take a look at <file:Documentation/cpu-freq>. If in doubt, say N. @@ -169,7 +169,7 @@ config US2E_FREQ help This adds the CPUFreq driver for UltraSPARC-IIe processors. - For details, take a look at linux/Documentation/cpu-freq. + For details, take a look at <file:Documentation/cpu-freq>. If in doubt, say N. diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c index 0425e55b8b4e..c52b859c9217 100644 --- a/arch/x86_64/kernel/i8259.c +++ b/arch/x86_64/kernel/i8259.c @@ -75,7 +75,7 @@ BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7) BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI BUILD_14_IRQS(0xe) #endif @@ -110,7 +110,7 @@ void (*interrupt[NR_IRQS])(void) = { IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), IRQLIST_16(0xc), IRQLIST_16(0xd) -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI , IRQLIST_14(0xe) #endif diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 64b18c250b87..6cb45b7eb857 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c @@ -68,7 +68,7 @@ static struct irq_pin_list { } irq_2_pin[PIN_MAP_SIZE]; int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1}; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define vector_to_irq(vector) \ (platform_legacy_irq(vector) ? vector : vector_irq[vector]) #else @@ -656,7 +656,7 @@ static inline int IO_APIC_irq_trigger(int irq) /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 }; -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI int assign_irq_vector(int irq) #else int __init assign_irq_vector(int irq) @@ -1406,7 +1406,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) spin_unlock_irqrestore(&ioapic_lock, flags); } -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static unsigned int startup_edge_ioapic_vector(unsigned int vector) { int irq = vector_to_irq(vector); diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index afb9d4391a7a..c44f27f24847 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -33,6 +33,13 @@ config BLK_DEV_SWIM_IOP Say Y here to support the SWIM (Super Woz Integrated Machine) IOP floppy controller on the Macintosh IIfx and Quadra 900/950. +config MAC_FLOPPY + tristate "Support for PowerMac floppy" + depends on PPC_PMAC && !PPC_PMAC64 + help + If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) + floppy controller, say Y here. Most commonly found in PowerMacs. + config BLK_DEV_PS2 tristate "PS/2 ESDI hard disk support" depends on MCA && MCA_LEGACY diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 7e37bdb44d0a..5bf390d1b5ff 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4190,7 +4190,7 @@ static int __init floppy_setup(char *str) printk("\n"); } else DPRINT("botched floppy option\n"); - DPRINT("Read linux/Documentation/floppy.txt\n"); + DPRINT("Read Documentation/floppy.txt\n"); return 0; } diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index beef207dced6..afaed937f24b 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -1823,50 +1823,43 @@ EXPORT_SYMBOL(blk_insert_request); struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf, unsigned int len) { - struct request *rq = NULL; - char *buf = NULL; + unsigned long uaddr; + struct request *rq; struct bio *bio; - int ret; + + if (len > (q->max_sectors << 9)) + return ERR_PTR(-EINVAL); + if ((!len && ubuf) || (len && !ubuf)) + return ERR_PTR(-EINVAL); rq = blk_get_request(q, rw, __GFP_WAIT); if (!rq) return ERR_PTR(-ENOMEM); - bio = bio_map_user(q, NULL, (unsigned long) ubuf, len, rw == READ); - if (!bio) { - int bytes = (len + 511) & ~511; - - buf = kmalloc(bytes, q->bounce_gfp | GFP_USER); - if (!buf) { - ret = -ENOMEM; - goto fault; - } - - if (rw == WRITE) { - if (copy_from_user(buf, ubuf, len)) { - ret = -EFAULT; - goto fault; - } - } else - memset(buf, 0, len); - } + /* + * if alignment requirement is satisfied, map in user pages for + * direct dma. else, set up kernel bounce buffers + */ + uaddr = (unsigned long) ubuf; + if (!(uaddr & queue_dma_alignment(q)) && !(len & queue_dma_alignment(q))) + bio = bio_map_user(q, NULL, uaddr, len, rw == READ); + else + bio = bio_copy_user(q, uaddr, len, rw == READ); - rq->bio = rq->biotail = bio; - if (rq->bio) + if (!IS_ERR(bio)) { + rq->bio = rq->biotail = bio; blk_rq_bio_prep(q, rq, bio); - rq->buffer = rq->data = buf; - rq->data_len = len; - return rq; -fault: - if (buf) - kfree(buf); - if (bio) - bio_unmap_user(bio, 1); - if (rq) - blk_put_request(rq); + rq->buffer = rq->data = NULL; + rq->data_len = len; + return rq; + } - return ERR_PTR(ret); + /* + * bio is the err-ptr + */ + blk_put_request(rq); + return (struct request *) bio; } EXPORT_SYMBOL(blk_rq_map_user); @@ -1880,18 +1873,15 @@ EXPORT_SYMBOL(blk_rq_map_user); * Description: * Unmap a request previously mapped by blk_rq_map_user(). */ -int blk_rq_unmap_user(struct request *rq, void __user *ubuf, struct bio *bio, - unsigned int ulen) +int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen) { - const int read = rq_data_dir(rq) == READ; int ret = 0; - if (bio) - bio_unmap_user(bio, read); - if (rq->buffer) { - if (read && copy_to_user(ubuf, rq->buffer, ulen)) - ret = -EFAULT; - kfree(rq->buffer); + if (bio) { + if (bio_flagged(bio, BIO_USER_MAPPED)) + bio_unmap_user(bio); + else + ret = bio_uncopy_user(bio); } blk_put_request(rq); diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index bc3a419966fa..f57dd9d77f23 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c @@ -211,7 +211,7 @@ static int sg_io(request_queue_t *q, struct gendisk *bd_disk, hdr->sb_len_wr = len; } - if (blk_rq_unmap_user(rq, hdr->dxferp, bio, hdr->dxfer_len)) + if (blk_rq_unmap_user(rq, bio, hdr->dxfer_len)) return -EFAULT; /* may not have succeeded, but output values written to control diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index 97ab1b33fb65..b6a14c80e237 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -129,7 +129,7 @@ Werner Zimmermann, August 8, 1995 V1.70 Multisession support now is completed, but there is still not enough testing done. If you can test it, please contact me. For - details please read /usr/src/linux/Documentation/cdrom/aztcd + details please read Documentation/cdrom/aztcd Werner Zimmermann, August 19, 1995 V1.80 Modification to suit the new kernel boot procedure introduced with kernel 1.3.33. Will definitely not work with older kernels. diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 5a08b536444c..bfdc4d24a2c7 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -1921,6 +1921,8 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, struct packet_command cgc; int nr, ret; + cdi->last_sense = 0; + memset(&cgc, 0, sizeof(cgc)); /* @@ -1972,6 +1974,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, if (!q) return -ENXIO; + cdi->last_sense = 0; + while (nframes) { nr = nframes; if (cdi->cdda_method == CDDA_BPC_SINGLE) @@ -2011,7 +2015,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, cdi->last_sense = s->sense_key; } - if (blk_rq_unmap_user(rq, ubuf, bio, len)) + if (blk_rq_unmap_user(rq, bio, len)) ret = -EFAULT; if (ret) @@ -2019,6 +2023,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, nframes -= nr; lba += nr; + ubuf += len; } return ret; diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index 62e2d11b3829..caaeb724a342 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -964,7 +964,7 @@ static int update_toc(void) #endif /* MULTISESSION */ if (disk_info.multi) printk(KERN_WARNING "optcd: Multisession support experimental, " - "see linux/Documentation/cdrom/optcd\n"); + "see Documentation/cdrom/optcd\n"); DEBUG((DEBUG_TOC, "exiting update_toc")); diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index cd33f63b97cd..a2475c6bb183 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -5715,7 +5715,7 @@ int __init sbpcd_init(void) if (port_index>0) { - msg(DBG_INF, "You should read linux/Documentation/cdrom/sbpcd\n"); + msg(DBG_INF, "You should read Documentation/cdrom/sbpcd\n"); msg(DBG_INF, "and then configure sbpcd.h for your hardware.\n"); } check_datarate(); diff --git a/drivers/cdrom/sbpcd.h b/drivers/cdrom/sbpcd.h index 16a0208a2598..2f2225f13c6f 100644 --- a/drivers/cdrom/sbpcd.h +++ b/drivers/cdrom/sbpcd.h @@ -5,7 +5,7 @@ /* * Attention! This file contains user-serviceable parts! * I recommend to make use of it... - * If you feel helpless, look into linux/Documentation/cdrom/sbpcd + * If you feel helpless, look into Documentation/cdrom/sbpcd * (good idea anyway, at least before mailing me). * * The definitions for the first controller can get overridden by diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 60c50c2eb1af..37e067351075 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -976,14 +976,18 @@ config HPET_RTC_IRQ is assumed the platform called hpet_alloc with the RTC IRQ values for the HPET timers. -config HPET_NOMMAP - bool "HPET - Control mmap capability." - default n +config HPET_MMAP + bool "Allow mmap of HPET" + default y depends on HPET help - If you say Y here, then the mmap interface for the HPET driver returns ENOSYS. - Some hardware implementations might not want all the memory in the page the - HPET control registers reside to be exposed. + If you say Y here, user applications will be able to mmap + the HPET registers. + + In some hardware implementations, the page containing HPET + registers may also contain other things that shouldn't be + exposed to the user. If this applies to your hardware, + say N here. config MAX_RAW_DEVS int "Maximum number of RAW devices to support (1-8192)" diff --git a/drivers/char/README.scc b/drivers/char/README.scc index 8837d8a5dd08..90fa4b8aed10 100644 --- a/drivers/char/README.scc +++ b/drivers/char/README.scc @@ -2,4 +2,4 @@ The z8530drv is now a network device driver, you can find it in ../net/scc.c A subset of the documentation is in - ../../Documentation/networking/z8530drv.txt + Documentation/networking/z8530drv.txt diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 36d9d2876b16..5e8c472446ef 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -1,8 +1,14 @@ /* * Intel & MS High Precision Event Timer Implementation. - * Contributors: + * + * Copyright (C) 2003 Intel Corporation * Venki Pallipadi - * Bob Picco + * (c) Copyright 2004 Hewlett-Packard Development Company, L.P. + * Bob Picco <robert.picco@hp.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include <linux/config.h> @@ -250,9 +256,7 @@ static unsigned int hpet_poll(struct file *file, poll_table * wait) static int hpet_mmap(struct file *file, struct vm_area_struct *vma) { -#ifdef CONFIG_HPET_NOMMAP - return -ENOSYS; -#else +#ifdef CONFIG_HPET_MMAP struct hpet_dev *devp; unsigned long addr; @@ -276,6 +280,8 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma) } return 0; +#else + return -ENOSYS; #endif } @@ -901,14 +907,10 @@ static acpi_status __init hpet_resources(struct acpi_resource *res, void *data) hdp->hd_nirqs = irqp->number_of_interrupts; for (i = 0; i < hdp->hd_nirqs; i++) -#ifdef CONFIG_IA64 hdp->hd_irq[i] = acpi_register_gsi(irqp->interrupts[i], irqp->edge_level, irqp->active_high_low); -#else - hdp->hd_irq[i] = irqp->interrupts[i]; -#endif } } diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index de456d01ccea..0d3763dc6a50 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -72,7 +72,7 @@ /* * There is a bunch of documentation about the card, jumpers, config * settings, restrictions, cables, device names and numbers in - * ../../Documentation/specialix.txt + * Documentation/specialix.txt */ #include <linux/config.h> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 7e8c89f29c30..f8414d0a4aae 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1959,13 +1959,17 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) * sg request */ if (rq->bio) { - if (rq->data_len & 3) { - printk("%s: block pc not aligned, len=%d\n", drive->name, rq->data_len); - cdrom_end_request(drive, 0); - return ide_stopped; - } - info->dma = drive->using_dma; + int mask = drive->queue->dma_alignment; + unsigned long addr = (unsigned long) page_address(bio_page(rq->bio)); + info->cmd = rq_data_dir(rq); + info->dma = drive->using_dma; + + /* + * check if dma is safe + */ + if ((rq->data_len & mask) || (addr & mask)) + info->dma = 0; } /* Start sending the command to the drive. */ @@ -3133,7 +3137,7 @@ int ide_cdrom_setup (ide_drive_t *drive) int nslots; blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); - blk_queue_dma_alignment(drive->queue, 3); + blk_queue_dma_alignment(drive->queue, 31); drive->queue->unplug_delay = (1 * HZ) / 1000; if (!drive->queue->unplug_delay) drive->queue->unplug_delay = 1; diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 0282df040470..ecf6830b3b51 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c @@ -1322,7 +1322,7 @@ static unsigned int dv1394_poll(struct file *file, struct poll_table_struct *wai static int dv1394_fasync(int fd, struct file *file, int on) { /* I just copied this code verbatim from Alan Cox's mouse driver example - (linux/Documentation/DocBook/) */ + (Documentation/DocBook/) */ struct video_card *video = file_to_video_card(file); diff --git a/drivers/isdn/hardware/eicon/platform.h b/drivers/isdn/hardware/eicon/platform.h index c38f8718d8c5..31299feb7660 100644 --- a/drivers/isdn/hardware/eicon/platform.h +++ b/drivers/isdn/hardware/eicon/platform.h @@ -1,4 +1,4 @@ -/* $Id: platform.h,v 1.37 2004/03/20 17:44:29 armin Exp $ +/* $Id: platform.h,v 1.37.4.1 2004/07/28 14:47:21 armin Exp $ * * platform.h * @@ -214,10 +214,7 @@ void diva_os_free_message_buffer(diva_os_message_buffer_s *dmb); */ static __inline__ void diva_os_sleep(dword mSec) { - unsigned long timeout = HZ * mSec / 1000 + 1; - - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(timeout); + msleep(mSec); } static __inline__ void diva_os_wait(dword mSec) { diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c index 6b2623af1239..04065ab2610f 100644 --- a/drivers/isdn/hisax/callc.c +++ b/drivers/isdn/hisax/callc.c @@ -7,7 +7,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * based on the teles driver from Jan den Ouden * diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index b920679e8eb2..26bb71d96b38 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c @@ -8,7 +8,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * based on the teles driver from Jan den Ouden * diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 843ed75f82c2..2b54e7d6fb98 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c @@ -9,7 +9,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Eicon Technology for documents and information * diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c index 8b6da9ea4cb4..b336781296a5 100644 --- a/drivers/isdn/hisax/elsa.c +++ b/drivers/isdn/hisax/elsa.c @@ -9,7 +9,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Elsa GmbH for documents and information * diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index c058ccbc51f1..20042fda89a5 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c @@ -11,7 +11,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * */ diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c index 270df3bd551b..20b949952952 100644 --- a/drivers/isdn/hisax/isac.c +++ b/drivers/isdn/hisax/isac.c @@ -9,7 +9,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * */ diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c index 35536661b027..4d08d27f1499 100644 --- a/drivers/isdn/hisax/isdnl1.c +++ b/drivers/isdn/hisax/isdnl1.c @@ -10,7 +10,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Jan den Ouden * Fritz Elfert diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index da87f1ee6238..d311b5fbf895 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c @@ -8,7 +8,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Jan den Ouden * Fritz Elfert diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c index 5145948dc4a6..f571b5d18e91 100644 --- a/drivers/isdn/hisax/isdnl3.c +++ b/drivers/isdn/hisax/isdnl3.c @@ -8,7 +8,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Jan den Ouden * Fritz Elfert diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c index 23547749478e..d6c1c8f8329d 100644 --- a/drivers/isdn/hisax/l3_1tr6.c +++ b/drivers/isdn/hisax/l3_1tr6.c @@ -9,7 +9,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * */ diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c index 092634c03a14..ec92308c1efc 100644 --- a/drivers/isdn/hisax/l3dss1.c +++ b/drivers/isdn/hisax/l3dss1.c @@ -12,7 +12,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Jan den Ouden * Fritz Elfert diff --git a/drivers/isdn/hisax/tei.c b/drivers/isdn/hisax/tei.c index 6056ac1d7673..082726db3985 100644 --- a/drivers/isdn/hisax/tei.c +++ b/drivers/isdn/hisax/tei.c @@ -8,7 +8,7 @@ * of the GNU General Public License, incorporated herein by reference. * * For changes and modifications please read - * ../../../Documentation/isdn/HiSax.cert + * Documentation/isdn/HiSax.cert * * Thanks to Jan den Ouden * Fritz Elfert diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c index ee2071b061cd..da1d2fb9fc8d 100644 --- a/drivers/isdn/i4l/isdn_x25iface.c +++ b/drivers/isdn/i4l/isdn_x25iface.c @@ -8,7 +8,7 @@ * stuff needed to support the Linux X.25 PLP code on top of devices that * can provide a lab_b service using the concap_proto mechanism. * This module supports a network interface wich provides lapb_sematics - * -- as defined in ../../Documentation/networking/x25-iface.txt -- to + * -- as defined in Documentation/networking/x25-iface.txt -- to * the upper layer and assumes that the lower layer provides a reliable * data link service by means of the concap_device_ops callbacks. * @@ -270,7 +270,7 @@ int isdn_x25iface_disconn_ind(struct concap_proto *cprot) } /* process a frame handed over to us from linux network layer. First byte - semantics as defined in ../../Documentation/networking/x25-iface.txt + semantics as defined in Documentation/networking/x25-iface.txt */ int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb) { diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 80b5a8200c72..f87ed85539d5 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig @@ -118,13 +118,6 @@ config PMAC_BACKLIGHT events; also, the PowerBook button device will be enabled so you can change the screen brightness. -config MAC_FLOPPY - bool "Support for PowerMac floppy" - depends on PPC_PMAC && !PPC_PMAC64 - help - If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) - floppy controller, say Y here. Most commonly found in PowerMacs. - config MAC_SERIAL tristate "Support for PowerMac serial ports (OBSOLETE DRIVER)" depends on PPC_PMAC && BROKEN @@ -191,7 +184,7 @@ config THERM_PM72 G5 machines. config ANSLCD - bool "Support for ANS LCD display" + tristate "Support for ANS LCD display" depends on ADB_CUDA && PPC_PMAC endmenu diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c index c4b82b5a88dc..0e130f598a79 100644 --- a/drivers/macintosh/ans-lcd.c +++ b/drivers/macintosh/ans-lcd.c @@ -136,7 +136,7 @@ const char anslcd_logo[] = "********************" /* Line #1 */ "* Welcome to *" /* Line #2 */ "********************"; /* Line #4 */ -int __init +static int __init anslcd_init(void) { int a; @@ -173,5 +173,12 @@ anslcd_init(void) return 0; } -__initcall(anslcd_init); +static void __exit +anslcd_exit(void) +{ + misc_deregister(&anslcd_dev); + iounmap(anslcd_ptr); +} +module_init(anslcd_init); +module_exit(anslcd_exit); diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 67af530004aa..aa0719775e47 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -435,6 +435,7 @@ int __pmac check_media_bay(struct device_node *which_bay, int what) #endif /* CONFIG_BLK_DEV_IDE */ return -ENODEV; } +EXPORT_SYMBOL(check_media_bay); int __pmac check_media_bay_by_base(unsigned long base, int what) { diff --git a/drivers/media/dvb/frontends/alps_tdlb7.c b/drivers/media/dvb/frontends/alps_tdlb7.c index 64d95f2f88c9..cf165f2d5767 100644 --- a/drivers/media/dvb/frontends/alps_tdlb7.c +++ b/drivers/media/dvb/frontends/alps_tdlb7.c @@ -28,8 +28,6 @@ */ - -#define __KERNEL_SYSCALLS__ #include <linux/module.h> #include <linux/init.h> #include <linux/vmalloc.h> @@ -151,13 +149,13 @@ static int sp8870_read_firmware_file (const char *fn, char **fp) loff_t filesize; char *dp; - fd = open(fn, 0, 0); + fd = sys_open(fn, 0, 0); if (fd == -1) { printk("%s: unable to open '%s'.\n", __FUNCTION__, fn); return -EIO; } - filesize = lseek(fd, 0L, 2); + filesize = sys_lseek(fd, 0L, 2); if (filesize <= 0 || filesize < SP8870_FIRMWARE_OFFSET + SP8870_FIRMWARE_SIZE) { printk("%s: firmware filesize to small '%s'\n", __FUNCTION__, fn); sys_close(fd); @@ -171,8 +169,8 @@ static int sp8870_read_firmware_file (const char *fn, char **fp) return -EIO; } - lseek(fd, SP8870_FIRMWARE_OFFSET, 0); - if (read(fd, dp, SP8870_FIRMWARE_SIZE) != SP8870_FIRMWARE_SIZE) { + sys_lseek(fd, SP8870_FIRMWARE_OFFSET, 0); + if (sys_read(fd, dp, SP8870_FIRMWARE_SIZE) != SP8870_FIRMWARE_SIZE) { printk("%s: failed to read '%s'.\n",__FUNCTION__, fn); vfree(dp); sys_close(fd); diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index 3b3a73bb00d7..53ebf4a69b07 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c @@ -12,7 +12,6 @@ next 0x4000 loaded. This may change in future versions. */ -#define __KERNEL_SYSCALLS__ #include <linux/kernel.h> #include <linux/vmalloc.h> #include <linux/module.h> @@ -211,13 +210,13 @@ int sp887x_initial_setup (struct dvb_frontend *fe) // Load the firmware set_fs(get_ds()); - fd = open(sp887x_firmware, 0, 0); + fd = sys_open(sp887x_firmware, 0, 0); if (fd < 0) { printk(KERN_WARNING "%s: Unable to open firmware %s\n", __FUNCTION__, sp887x_firmware); return -EIO; } - filesize = lseek(fd, 0L, 2); + filesize = sys_lseek(fd, 0L, 2); if (filesize <= 0) { printk(KERN_WARNING "%s: Firmware %s is empty\n", __FUNCTION__, sp887x_firmware); @@ -239,8 +238,8 @@ int sp887x_initial_setup (struct dvb_frontend *fe) // read it! // read the first 16384 bytes from the file // ignore the first 10 bytes - lseek(fd, 10, 0); - if (read(fd, firmware, fw_size) != fw_size) { + sys_lseek(fd, 10, 0); + if (sys_read(fd, firmware, fw_size) != fw_size) { printk(KERN_WARNING "%s: Failed to read firmware\n", __FUNCTION__); vfree(firmware); sys_close(fd); diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 76a6027dbdb6..28dc299a8cd5 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c @@ -32,7 +32,6 @@ */ -#define __KERNEL_SYSCALLS__ #include <linux/kernel.h> #include <linux/vmalloc.h> #include <linux/module.h> @@ -40,7 +39,6 @@ #include <linux/string.h> #include <linux/slab.h> #include <linux/fs.h> -#include <linux/unistd.h> #include <linux/fcntl.h> #include <linux/errno.h> #include <linux/syscalls.h> @@ -399,13 +397,13 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda // Load the firmware set_fs(get_ds()); - fd = open(tda1004x_firmware, 0, 0); + fd = sys_open(tda1004x_firmware, 0, 0); if (fd < 0) { printk("%s: Unable to open firmware %s\n", __FUNCTION__, tda1004x_firmware); return -EIO; } - filesize = lseek(fd, 0L, 2); + filesize = sys_lseek(fd, 0L, 2); if (filesize <= 0) { printk("%s: Firmware %s is empty\n", __FUNCTION__, tda1004x_firmware); @@ -436,8 +434,8 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda } // read it! - lseek(fd, fw_offset, 0); - if (read(fd, firmware, fw_size) != fw_size) { + sys_lseek(fd, fw_offset, 0); + if (sys_read(fd, firmware, fw_size) != fw_size) { printk("%s: Failed to read firmware\n", __FUNCTION__); vfree(firmware); sys_close(fd); diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index f7fc3b9c0a5c..2049556d1764 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -7,7 +7,7 @@ * ------------------ * * You can find a subset of the documentation in - * linux/Documentation/networking/z8530drv.txt. + * Documentation/networking/z8530drv.txt. */ /* diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 44d21edef3c4..6454331093e6 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -212,7 +212,7 @@ MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)"); /* Define this to enable Link beat monitoring */ #undef MONITOR -/* Turn on debugging. See linux/Documentation/networking/tlan.txt for details */ +/* Turn on debugging. See Documentation/networking/tlan.txt for details */ static int debug; static int bbuf; diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index dd5066037904..3ee31021f1b0 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -18,8 +18,6 @@ * */ -#define __KERNEL_SYSCALLS__ - #include <linux/version.h> #include <linux/module.h> #include <linux/types.h> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 03681b915a56..929012e60815 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -1,22 +1,15 @@ # # PCI configuration # -config PCI_USE_VECTOR - bool "Vector-based interrupt indexing (MSI)" +config PCI_MSI + bool "Message Signaled Interrupts (MSI and MSI-X)" depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 default n help - This replaces the current existing IRQ-based index interrupt scheme - with the vector-base index scheme. The advantages of vector base - over IRQ base are listed below: - 1) Support MSI implementation. - 2) Support future IOxAPIC hotplug - - Note that this allows the device drivers to enable MSI, Message - Signaled Interrupt, on all MSI capable device functions detected. - Message Signal Interrupt enables an MSI-capable hardware device to - send an inbound Memory Write on its PCI bus instead of asserting - IRQ signal on device IRQ pin. + This allows device drivers to enable MSI (Message Signaled + Interrupts). Message Signaled Interrupts enable a device to + generate an interrupt using an inbound Memory Write on its + PCI bus instead of asserting a device IRQ pin. If you don't know what to do here, say N. diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 260b12b34779..377c7238c4cc 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_PPC32) += setup-irq.o obj-$(CONFIG_PPC64) += setup-bus.o obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o obj-$(CONFIG_X86_VISWS) += setup-irq.o -obj-$(CONFIG_PCI_USE_VECTOR) += msi.o +obj-$(CONFIG_PCI_MSI) += msi.o # Cardbus & CompactPCI use setup-bus obj-$(CONFIG_HOTPLUG) += setup-bus.o diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 35c73b9769e0..d4c89d73e16d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -64,15 +64,13 @@ static void msi_set_mask_bit(unsigned int vector, int flag) case PCI_CAP_ID_MSI: { int pos; - unsigned int mask_bits; + u32 mask_bits; pos = entry->mask_base; - entry->dev->bus->ops->read(entry->dev->bus, entry->dev->devfn, - pos, 4, &mask_bits); + pci_read_config_dword(entry->dev, pos, &mask_bits); mask_bits &= ~(1); mask_bits |= flag; - entry->dev->bus->ops->write(entry->dev->bus, entry->dev->devfn, - pos, 4, mask_bits); + pci_write_config_dword(entry->dev, pos, mask_bits); break; } case PCI_CAP_ID_MSIX: @@ -105,15 +103,13 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask) if (!(pos = pci_find_capability(entry->dev, PCI_CAP_ID_MSI))) return; - entry->dev->bus->ops->read(entry->dev->bus, entry->dev->devfn, - msi_lower_address_reg(pos), 4, + pci_read_config_dword(entry->dev, msi_lower_address_reg(pos), &address.lo_address.value); address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK; address.lo_address.value |= (cpu_mask_to_apicid(cpu_mask) << MSI_TARGET_CPU_SHIFT); entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask); - entry->dev->bus->ops->write(entry->dev->bus, entry->dev->devfn, - msi_lower_address_reg(pos), 4, + pci_write_config_dword(entry->dev, msi_lower_address_reg(pos), address.lo_address.value); break; } @@ -158,13 +154,25 @@ static void unmask_MSI_irq(unsigned int vector) static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector) { + struct msi_desc *entry; + unsigned long flags; + + spin_lock_irqsave(&msi_lock, flags); + entry = msi_desc[vector]; + if (!entry || !entry->dev) { + spin_unlock_irqrestore(&msi_lock, flags); + return 0; + } + entry->msi_attrib.state = 1; /* Mark it active */ + spin_unlock_irqrestore(&msi_lock, flags); + return 0; /* never anything pending */ } -static void pci_disable_msi(unsigned int vector); +static void release_msi(unsigned int vector); static void shutdown_msi_irq(unsigned int vector) { - pci_disable_msi(vector); + release_msi(vector); } #define shutdown_msi_irq_wo_maskbit shutdown_msi_irq @@ -179,6 +187,18 @@ static void end_msi_irq_wo_maskbit(unsigned int vector) static unsigned int startup_msi_irq_w_maskbit(unsigned int vector) { + struct msi_desc *entry; + unsigned long flags; + + spin_lock_irqsave(&msi_lock, flags); + entry = msi_desc[vector]; + if (!entry || !entry->dev) { + spin_unlock_irqrestore(&msi_lock, flags); + return 0; + } + entry->msi_attrib.state = 1; /* Mark it active */ + spin_unlock_irqrestore(&msi_lock, flags); + unmask_MSI_irq(vector); return 0; /* never anything pending */ } @@ -200,7 +220,7 @@ static void end_msi_irq_w_maskbit(unsigned int vector) * which implement the MSI-X Capability Structure. */ static struct hw_interrupt_type msix_irq_type = { - .typename = "PCI MSI-X", + .typename = "PCI-MSI-X", .startup = startup_msi_irq_w_maskbit, .shutdown = shutdown_msi_irq_w_maskbit, .enable = enable_msi_irq_w_maskbit, @@ -216,7 +236,7 @@ static struct hw_interrupt_type msix_irq_type = { * Mask-and-Pending Bits. */ static struct hw_interrupt_type msi_irq_w_maskbit_type = { - .typename = "PCI MSI", + .typename = "PCI-MSI", .startup = startup_msi_irq_w_maskbit, .shutdown = shutdown_msi_irq_w_maskbit, .enable = enable_msi_irq_w_maskbit, @@ -232,7 +252,7 @@ static struct hw_interrupt_type msi_irq_w_maskbit_type = { * Mask-and-Pending Bits. */ static struct hw_interrupt_type msi_irq_wo_maskbit_type = { - .typename = "PCI MSI", + .typename = "PCI-MSI", .startup = startup_msi_irq_wo_maskbit, .shutdown = shutdown_msi_irq_wo_maskbit, .enable = enable_msi_irq_wo_maskbit, @@ -265,6 +285,7 @@ static void msi_address_init(struct msg_address *msi_address) msi_address->lo_address.value |= (MSI_TARGET_CPU << MSI_TARGET_CPU_SHIFT); } +static int msi_free_vector(struct pci_dev* dev, int vector, int reassign); static int assign_msi_vector(void) { static int new_vector_avail = 1; @@ -278,6 +299,8 @@ static int assign_msi_vector(void) spin_lock_irqsave(&msi_lock, flags); if (!new_vector_avail) { + int free_vector = 0; + /* * vector_irq[] = -1 indicates that this specific vector is: * - assigned for MSI (since MSI have no associated IRQ) or @@ -294,13 +317,34 @@ static int assign_msi_vector(void) for (vector = FIRST_DEVICE_VECTOR; vector < NR_IRQS; vector++) { if (vector_irq[vector] != 0) continue; - vector_irq[vector] = -1; - nr_released_vectors--; + free_vector = vector; + if (!msi_desc[vector]) + break; + else + continue; + } + if (!free_vector) { spin_unlock_irqrestore(&msi_lock, flags); - return vector; + return -EBUSY; } + vector_irq[free_vector] = -1; + nr_released_vectors--; spin_unlock_irqrestore(&msi_lock, flags); - return -EBUSY; + if (msi_desc[free_vector] != NULL) { + struct pci_dev *dev; + int tail; + + /* free all linked vectors before re-assign */ + do { + spin_lock_irqsave(&msi_lock, flags); + dev = msi_desc[free_vector]->dev; + tail = msi_desc[free_vector]->link.tail; + spin_unlock_irqrestore(&msi_lock, flags); + msi_free_vector(dev, tail, 1); + } while (free_vector != tail); + } + + return free_vector; } vector = assign_irq_vector(AUTO_ASSIGN); last_alloc_vector = vector; @@ -333,6 +377,15 @@ static int msi_init(void) printk(KERN_INFO "WARNING: MSI INIT FAILURE\n"); return status; } + last_alloc_vector = assign_irq_vector(AUTO_ASSIGN); + if (last_alloc_vector < 0) { + pci_msi_enable = 0; + printk(KERN_INFO "WARNING: ALL VECTORS ARE BUSY\n"); + status = -EBUSY; + return status; + } + vector_irq[last_alloc_vector] = 0; + nr_released_vectors++; printk(KERN_INFO "MSI INIT SUCCESS\n"); return status; @@ -383,55 +436,49 @@ static void irq_handler_init(int cap_id, int pos, int mask) static void enable_msi_mode(struct pci_dev *dev, int pos, int type) { - u32 control; + u16 control; - dev->bus->ops->read(dev->bus, dev->devfn, - msi_control_reg(pos), 2, &control); + pci_read_config_word(dev, msi_control_reg(pos), &control); if (type == PCI_CAP_ID_MSI) { /* Set enabled bits to single MSI & enable MSI_enable bit */ msi_enable(control, 1); - dev->bus->ops->write(dev->bus, dev->devfn, - msi_control_reg(pos), 2, control); + pci_write_config_word(dev, msi_control_reg(pos), control); } else { msix_enable(control); - dev->bus->ops->write(dev->bus, dev->devfn, - msi_control_reg(pos), 2, control); + pci_write_config_word(dev, msi_control_reg(pos), control); } if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { /* PCI Express Endpoint device detected */ - u32 cmd; - dev->bus->ops->read(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd); + u16 cmd; + pci_read_config_word(dev, PCI_COMMAND, &cmd); cmd |= PCI_COMMAND_INTX_DISABLE; - dev->bus->ops->write(dev->bus, dev->devfn, PCI_COMMAND, 2, cmd); + pci_write_config_word(dev, PCI_COMMAND, cmd); } } static void disable_msi_mode(struct pci_dev *dev, int pos, int type) { - u32 control; + u16 control; - dev->bus->ops->read(dev->bus, dev->devfn, - msi_control_reg(pos), 2, &control); + pci_read_config_word(dev, msi_control_reg(pos), &control); if (type == PCI_CAP_ID_MSI) { /* Set enabled bits to single MSI & enable MSI_enable bit */ msi_disable(control); - dev->bus->ops->write(dev->bus, dev->devfn, - msi_control_reg(pos), 2, control); + pci_write_config_word(dev, msi_control_reg(pos), control); } else { msix_disable(control); - dev->bus->ops->write(dev->bus, dev->devfn, - msi_control_reg(pos), 2, control); + pci_write_config_word(dev, msi_control_reg(pos), control); } if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { /* PCI Express Endpoint device detected */ - u32 cmd; - dev->bus->ops->read(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd); + u16 cmd; + pci_read_config_word(dev, PCI_COMMAND, &cmd); cmd &= ~PCI_COMMAND_INTX_DISABLE; - dev->bus->ops->write(dev->bus, dev->devfn, PCI_COMMAND, 2, cmd); + pci_write_config_word(dev, PCI_COMMAND, cmd); } } -static int msi_lookup_vector(struct pci_dev *dev) +static int msi_lookup_vector(struct pci_dev *dev, int type) { int vector; unsigned long flags; @@ -439,11 +486,11 @@ static int msi_lookup_vector(struct pci_dev *dev) spin_lock_irqsave(&msi_lock, flags); for (vector = FIRST_DEVICE_VECTOR; vector < NR_IRQS; vector++) { if (!msi_desc[vector] || msi_desc[vector]->dev != dev || - msi_desc[vector]->msi_attrib.entry_nr || + msi_desc[vector]->msi_attrib.type != type || msi_desc[vector]->msi_attrib.default_vector != dev->irq) - continue; /* not entry 0, skip */ + continue; spin_unlock_irqrestore(&msi_lock, flags); - /* This pre-assigned entry-0 MSI vector for this device + /* This pre-assigned MSI vector for this device already exits. Override dev->irq with this vector */ dev->irq = vector; return 0; @@ -458,10 +505,9 @@ void pci_scan_msi_device(struct pci_dev *dev) if (!dev) return; - if (pci_find_capability(dev, PCI_CAP_ID_MSIX) > 0) { - nr_reserved_vectors++; + if (pci_find_capability(dev, PCI_CAP_ID_MSIX) > 0) nr_msix_devices++; - } else if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0) + else if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0) nr_reserved_vectors++; } @@ -480,22 +526,10 @@ static int msi_capability_init(struct pci_dev *dev) struct msg_address address; struct msg_data data; int pos, vector; - u32 control; + u16 control; pos = pci_find_capability(dev, PCI_CAP_ID_MSI); - if (!pos) - return -EINVAL; - - dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), - 2, &control); - if (control & PCI_MSI_FLAGS_ENABLE) - return 0; - - if (!msi_lookup_vector(dev)) { - /* Lookup Sucess */ - enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); - return 0; - } + pci_read_config_word(dev, msi_control_reg(pos), &control); /* MSI Entry Initialization */ if (!(entry = alloc_msi_entry())) return -ENOMEM; @@ -504,11 +538,14 @@ static int msi_capability_init(struct pci_dev *dev) kmem_cache_free(msi_cachep, entry); return -EBUSY; } + entry->link.head = vector; + entry->link.tail = vector; entry->msi_attrib.type = PCI_CAP_ID_MSI; + entry->msi_attrib.state = 0; /* Mark it not active */ entry->msi_attrib.entry_nr = 0; entry->msi_attrib.maskbit = is_mask_bit_support(control); - entry->msi_attrib.default_vector = dev->irq; - dev->irq = vector; /* save default pre-assigned ioapic vector */ + entry->msi_attrib.default_vector = dev->irq; /* Save IOAPIC IRQ */ + dev->irq = vector; entry->dev = dev; if (is_mask_bit_support(control)) { entry->mask_base = msi_mask_bits_reg(pos, @@ -521,27 +558,27 @@ static int msi_capability_init(struct pci_dev *dev) msi_data_init(&data, vector); entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >> MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK); - dev->bus->ops->write(dev->bus, dev->devfn, msi_lower_address_reg(pos), - 4, address.lo_address.value); + pci_write_config_dword(dev, msi_lower_address_reg(pos), + address.lo_address.value); if (is_64bit_address(control)) { - dev->bus->ops->write(dev->bus, dev->devfn, - msi_upper_address_reg(pos), 4, address.hi_address); - dev->bus->ops->write(dev->bus, dev->devfn, - msi_data_reg(pos, 1), 2, *((u32*)&data)); + pci_write_config_dword(dev, + msi_upper_address_reg(pos), address.hi_address); + pci_write_config_word(dev, + msi_data_reg(pos, 1), *((u32*)&data)); } else - dev->bus->ops->write(dev->bus, dev->devfn, - msi_data_reg(pos, 0), 2, *((u32*)&data)); + pci_write_config_word(dev, + msi_data_reg(pos, 0), *((u32*)&data)); if (entry->msi_attrib.maskbit) { unsigned int maskbits, temp; /* All MSIs are unmasked by default, Mask them all */ - dev->bus->ops->read(dev->bus, dev->devfn, - msi_mask_bits_reg(pos, is_64bit_address(control)), 4, + pci_read_config_dword(dev, + msi_mask_bits_reg(pos, is_64bit_address(control)), &maskbits); temp = (1 << multi_msi_capable(control)); temp = ((temp - 1) & ~temp); maskbits |= temp; - dev->bus->ops->write(dev->bus, dev->devfn, - msi_mask_bits_reg(pos, is_64bit_address(control)), 4, + pci_write_config_dword(dev, + msi_mask_bits_reg(pos, is_64bit_address(control)), maskbits); } attach_msi_entry(entry, vector); @@ -556,238 +593,219 @@ static int msi_capability_init(struct pci_dev *dev) * @dev: pointer to the pci_dev data structure of MSI-X device function * * Setup the MSI-X capability structure of device funtion with a - * single MSI-X vector. A return of zero indicates the successful setup - * of an entry zero with the new MSI-X vector or non-zero for otherwise. - * To request for additional MSI-X vectors, the device drivers are - * required to utilize the following supported APIs: - * 1) msi_alloc_vectors(...) for requesting one or more MSI-X vectors - * 2) msi_free_vectors(...) for releasing one or more MSI-X vectors - * back to PCI subsystem before calling free_irq(...) + * single MSI-X vector. A return of zero indicates the successful setup of + * requested MSI-X entries with allocated vectors or non-zero for otherwise. **/ -static int msix_capability_init(struct pci_dev *dev) +static int msix_capability_init(struct pci_dev *dev, + struct msix_entry *entries, int nvec) { - struct msi_desc *entry; + struct msi_desc *head = NULL, *tail = NULL, *entry = NULL; struct msg_address address; struct msg_data data; - int vector = 0, pos, dev_msi_cap, i; + int vector, pos, i, j, nr_entries, temp = 0; u32 phys_addr, table_offset; - u32 control; + u16 control; u8 bir; void *base; pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); - if (!pos) - return -EINVAL; - /* Request & Map MSI-X table region */ - dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), 2, - &control); - if (control & PCI_MSIX_FLAGS_ENABLE) - return 0; - - if (!msi_lookup_vector(dev)) { - /* Lookup Sucess */ - enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); - return 0; - } - - dev_msi_cap = multi_msix_capable(control); - dev->bus->ops->read(dev->bus, dev->devfn, - msix_table_offset_reg(pos), 4, &table_offset); + pci_read_config_word(dev, msi_control_reg(pos), &control); + nr_entries = multi_msix_capable(control); + pci_read_config_dword(dev, msix_table_offset_reg(pos), + &table_offset); bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); phys_addr = pci_resource_start (dev, bir); phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK); if (!request_mem_region(phys_addr, - dev_msi_cap * PCI_MSIX_ENTRY_SIZE, - "MSI-X iomap Failure")) + nr_entries * PCI_MSIX_ENTRY_SIZE, + "MSI-X vector table")) return -ENOMEM; - base = ioremap_nocache(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE); - if (base == NULL) - goto free_region; - /* MSI Entry Initialization */ - entry = alloc_msi_entry(); - if (!entry) - goto free_iomap; - if ((vector = get_msi_vector(dev)) < 0) - goto free_entry; + base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); + if (base == NULL) { + release_mem_region(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); + return -ENOMEM; + } + /* MSI-X Table Initialization */ + for (i = 0; i < nvec; i++) { + entry = alloc_msi_entry(); + if (!entry) + break; + if ((vector = get_msi_vector(dev)) < 0) + break; - entry->msi_attrib.type = PCI_CAP_ID_MSIX; - entry->msi_attrib.entry_nr = 0; - entry->msi_attrib.maskbit = 1; - entry->msi_attrib.default_vector = dev->irq; - dev->irq = vector; /* save default pre-assigned ioapic vector */ - entry->dev = dev; - entry->mask_base = (unsigned long)base; - /* Replace with MSI handler */ - irq_handler_init(PCI_CAP_ID_MSIX, vector, 1); - /* Configure MSI-X capability structure */ - msi_address_init(&address); - msi_data_init(&data, vector); - entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >> - MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK); - writel(address.lo_address.value, base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); - writel(address.hi_address, base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); - writel(*(u32*)&data, base + PCI_MSIX_ENTRY_DATA_OFFSET); - /* Initialize all entries from 1 up to 0 */ - for (i = 1; i < dev_msi_cap; i++) { - writel(0, base + i * PCI_MSIX_ENTRY_SIZE + + j = entries[i].entry; + entries[i].vector = vector; + entry->msi_attrib.type = PCI_CAP_ID_MSIX; + entry->msi_attrib.state = 0; /* Mark it not active */ + entry->msi_attrib.entry_nr = j; + entry->msi_attrib.maskbit = 1; + entry->msi_attrib.default_vector = dev->irq; + entry->dev = dev; + entry->mask_base = (unsigned long)base; + if (!head) { + entry->link.head = vector; + entry->link.tail = vector; + head = entry; + } else { + entry->link.head = temp; + entry->link.tail = tail->link.tail; + tail->link.tail = vector; + head->link.head = vector; + } + temp = vector; + tail = entry; + /* Replace with MSI-X handler */ + irq_handler_init(PCI_CAP_ID_MSIX, vector, 1); + /* Configure MSI-X capability structure */ + msi_address_init(&address); + msi_data_init(&data, vector); + entry->msi_attrib.current_cpu = + ((address.lo_address.u.dest_id >> + MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK); + writel(address.lo_address.value, + base + j * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); - writel(0, base + i * PCI_MSIX_ENTRY_SIZE + + writel(address.hi_address, + base + j * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); - writel(0, base + i * PCI_MSIX_ENTRY_SIZE + + writel(*(u32*)&data, + base + j * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_DATA_OFFSET); + attach_msi_entry(entry, vector); } - attach_msi_entry(entry, vector); - /* Set MSI enabled bits */ + if (i != nvec) { + i--; + for (; i >= 0; i--) { + vector = (entries + i)->vector; + msi_free_vector(dev, vector, 0); + (entries + i)->vector = 0; + } + return -EBUSY; + } + /* Set MSI-X enabled bits */ enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); return 0; - -free_entry: - kmem_cache_free(msi_cachep, entry); -free_iomap: - iounmap(base); -free_region: - release_mem_region(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE); - - return ((vector < 0) ? -EBUSY : -ENOMEM); } /** - * pci_enable_msi - configure device's MSI(X) capability structure - * @dev: pointer to the pci_dev data structure of MSI(X) device function + * pci_enable_msi - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function * - * Setup the MSI/MSI-X capability structure of device function with - * a single MSI(X) vector upon its software driver call to request for - * MSI(X) mode enabled on its hardware device function. A return of zero - * indicates the successful setup of an entry zero with the new MSI(X) + * Setup the MSI capability structure of device function with + * a single MSI vector upon its software driver call to request for + * MSI mode enabled on its hardware device function. A return of zero + * indicates the successful setup of an entry zero with the new MSI * vector or non-zero for otherwise. **/ int pci_enable_msi(struct pci_dev* dev) { - int status = -EINVAL; + int pos, temp = dev->irq, status = -EINVAL; + u16 control; if (!pci_msi_enable || !dev) return status; - if (msi_init() < 0) - return -ENOMEM; + if ((status = msi_init()) < 0) + return status; - if ((status = msix_capability_init(dev)) == -EINVAL) - status = msi_capability_init(dev); - if (!status) - nr_reserved_vectors--; + if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSI))) + return -EINVAL; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (control & PCI_MSI_FLAGS_ENABLE) + return 0; /* Already in MSI mode */ + + if (!msi_lookup_vector(dev, PCI_CAP_ID_MSI)) { + /* Lookup Sucess */ + unsigned long flags; + + spin_lock_irqsave(&msi_lock, flags); + if (!vector_irq[dev->irq]) { + msi_desc[dev->irq]->msi_attrib.state = 0; + vector_irq[dev->irq] = -1; + nr_released_vectors--; + spin_unlock_irqrestore(&msi_lock, flags); + enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + return 0; + } + spin_unlock_irqrestore(&msi_lock, flags); + dev->irq = temp; + } + /* Check whether driver already requested for MSI-X vectors */ + if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 && + !msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) { + printk(KERN_INFO "Can't enable MSI. Device already had MSI-X vectors assigned\n"); + dev->irq = temp; + return -EINVAL; + } + status = msi_capability_init(dev); + if (!status) { + if (!pos) + nr_reserved_vectors--; /* Only MSI capable */ + else if (nr_msix_devices > 0) + nr_msix_devices--; /* Both MSI and MSI-X capable, + but choose enabling MSI */ + } return status; } -static int msi_free_vector(struct pci_dev* dev, int vector); -static void pci_disable_msi(unsigned int vector) +void pci_disable_msi(struct pci_dev* dev) { - int head, tail, type, default_vector; struct msi_desc *entry; - struct pci_dev *dev; + int pos, default_vector; + u16 control; unsigned long flags; + if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSI))) + return; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSI_FLAGS_ENABLE)) + return; + spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[vector]; - if (!entry || !entry->dev) { + entry = msi_desc[dev->irq]; + if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { spin_unlock_irqrestore(&msi_lock, flags); return; } - dev = entry->dev; - type = entry->msi_attrib.type; - head = entry->link.head; - tail = entry->link.tail; - default_vector = entry->msi_attrib.default_vector; - spin_unlock_irqrestore(&msi_lock, flags); - - disable_msi_mode(dev, pci_find_capability(dev, type), type); - /* Restore dev->irq to its default pin-assertion vector */ - dev->irq = default_vector; - if (type == PCI_CAP_ID_MSIX && head != tail) { - /* Bad driver, which do not call msi_free_vectors before exit. - We must do a cleanup here */ - while (1) { - spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[vector]; - head = entry->link.head; - tail = entry->link.tail; - spin_unlock_irqrestore(&msi_lock, flags); - if (tail == head) - break; - if (msi_free_vector(dev, entry->link.tail)) - break; - } + if (entry->msi_attrib.state) { + spin_unlock_irqrestore(&msi_lock, flags); + printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on vector->%d\n", + dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), + dev->irq); + BUG_ON(entry->msi_attrib.state > 0); + } else { + vector_irq[dev->irq] = 0; /* free it */ + nr_released_vectors++; + default_vector = entry->msi_attrib.default_vector; + spin_unlock_irqrestore(&msi_lock, flags); + /* Restore dev->irq to its default pin-assertion vector */ + dev->irq = default_vector; + disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), + PCI_CAP_ID_MSI); } } -static int msi_alloc_vector(struct pci_dev* dev, int head) +static void release_msi(unsigned int vector) { struct msi_desc *entry; - struct msg_address address; - struct msg_data data; - int i, offset, pos, dev_msi_cap, vector; - u32 low_address, control; - unsigned long base = 0L; unsigned long flags; spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[dev->irq]; - if (!entry) { - spin_unlock_irqrestore(&msi_lock, flags); - return -EINVAL; - } - base = entry->mask_base; + entry = msi_desc[vector]; + if (entry && entry->dev) + entry->msi_attrib.state = 0; /* Mark it not active */ spin_unlock_irqrestore(&msi_lock, flags); - - pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); - dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), - 2, &control); - dev_msi_cap = multi_msix_capable(control); - for (i = 1; i < dev_msi_cap; i++) { - if (!(low_address = readl(base + i * PCI_MSIX_ENTRY_SIZE))) - break; - } - if (i >= dev_msi_cap) - return -EINVAL; - - /* MSI Entry Initialization */ - if (!(entry = alloc_msi_entry())) - return -ENOMEM; - - if ((vector = get_new_vector()) < 0) { - kmem_cache_free(msi_cachep, entry); - return vector; - } - entry->msi_attrib.type = PCI_CAP_ID_MSIX; - entry->msi_attrib.entry_nr = i; - entry->msi_attrib.maskbit = 1; - entry->dev = dev; - entry->link.head = head; - entry->mask_base = base; - irq_handler_init(PCI_CAP_ID_MSIX, vector, 1); - /* Configure MSI-X capability structure */ - msi_address_init(&address); - msi_data_init(&data, vector); - entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >> - MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK); - offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; - writel(address.lo_address.value, base + offset + - PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); - writel(address.hi_address, base + offset + - PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); - writel(*(u32*)&data, base + offset + PCI_MSIX_ENTRY_DATA_OFFSET); - writel(1, base + offset + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); - attach_msi_entry(entry, vector); - - return vector; } -static int msi_free_vector(struct pci_dev* dev, int vector) +static int msi_free_vector(struct pci_dev* dev, int vector, int reassign) { struct msi_desc *entry; - int entry_nr, type; + int head, entry_nr, type; unsigned long base = 0L; unsigned long flags; @@ -799,66 +817,177 @@ static int msi_free_vector(struct pci_dev* dev, int vector) } type = entry->msi_attrib.type; entry_nr = entry->msi_attrib.entry_nr; + head = entry->link.head; base = entry->mask_base; - if (entry->link.tail != entry->link.head) { - msi_desc[entry->link.head]->link.tail = entry->link.tail; - if (entry->link.tail) - msi_desc[entry->link.tail]->link.head = entry->link.head; - } + msi_desc[entry->link.head]->link.tail = entry->link.tail; + msi_desc[entry->link.tail]->link.head = entry->link.head; entry->dev = NULL; - vector_irq[vector] = 0; - nr_released_vectors++; + if (!reassign) { + vector_irq[vector] = 0; + nr_released_vectors++; + } msi_desc[vector] = NULL; spin_unlock_irqrestore(&msi_lock, flags); kmem_cache_free(msi_cachep, entry); + if (type == PCI_CAP_ID_MSIX) { - int offset; + if (!reassign) + writel(1, base + + entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); + + if (head == vector) { + /* + * Detect last MSI-X vector to be released. + * Release the MSI-X memory-mapped table. + */ + int pos, nr_entries; + u32 phys_addr, table_offset; + u16 control; + u8 bir; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + pci_read_config_word(dev, msi_control_reg(pos), + &control); + nr_entries = multi_msix_capable(control); + pci_read_config_dword(dev, msix_table_offset_reg(pos), + &table_offset); + bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); + phys_addr = pci_resource_start (dev, bir); + phys_addr += (u32)(table_offset & + ~PCI_MSIX_FLAGS_BIRMASK); + iounmap((void*)base); + release_mem_region(phys_addr, + nr_entries * PCI_MSIX_ENTRY_SIZE); + } + } - offset = entry_nr * PCI_MSIX_ENTRY_SIZE; - writel(1, base + offset + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); - writel(0, base + offset + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + return 0; +} + +static int reroute_msix_table(int head, struct msix_entry *entries, int *nvec) +{ + int vector = head, tail = 0; + int i = 0, j = 0, nr_entries = 0; + unsigned long base = 0L; + unsigned long flags; + + spin_lock_irqsave(&msi_lock, flags); + while (head != tail) { + nr_entries++; + tail = msi_desc[vector]->link.tail; + if (entries[0].entry == msi_desc[vector]->msi_attrib.entry_nr) + j = vector; + vector = tail; } + if (*nvec > nr_entries) { + spin_unlock_irqrestore(&msi_lock, flags); + *nvec = nr_entries; + return -EINVAL; + } + vector = ((j > 0) ? j : head); + for (i = 0; i < *nvec; i++) { + j = msi_desc[vector]->msi_attrib.entry_nr; + msi_desc[vector]->msi_attrib.state = 0; /* Mark it not active */ + vector_irq[vector] = -1; /* Mark it busy */ + nr_released_vectors--; + entries[i].vector = vector; + if (j != (entries + i)->entry) { + base = msi_desc[vector]->mask_base; + msi_desc[vector]->msi_attrib.entry_nr = + (entries + i)->entry; + writel( readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET), base + + (entries + i)->entry * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + writel( readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET), base + + (entries + i)->entry * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + writel( (readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET) & 0xff00) | vector, + base + (entries+i)->entry*PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET); + } + vector = msi_desc[vector]->link.tail; + } + spin_unlock_irqrestore(&msi_lock, flags); return 0; } /** - * msi_alloc_vectors - allocate additional MSI-X vectors + * pci_enable_msix - configure device's MSI-X capability structure * @dev: pointer to the pci_dev data structure of MSI-X device function - * @vector: pointer to an array of new allocated MSI-X vectors + * @data: pointer to an array of MSI-X entries * @nvec: number of MSI-X vectors requested for allocation by device driver * - * Allocate additional MSI-X vectors requested by device driver. A - * return of zero indicates the successful setup of MSI-X capability - * structure with new allocated MSI-X vectors or non-zero for otherwise. + * Setup the MSI-X capability structure of device function with the number + * of requested vectors upon its software driver call to request for + * MSI-X mode enabled on its hardware device function. A return of zero + * indicates the successful configuration of MSI-X capability structure + * with new allocated MSI-X vectors. A return of < 0 indicates a failure. + * Or a return of > 0 indicates that driver request is exceeding the number + * of vectors available. Driver should use the returned value to re-send + * its request. **/ -int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec) +int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) { - struct msi_desc *entry; - int i, head, pos, vec, free_vectors, alloc_vectors; - int *vectors = (int *)vector; - u32 control; + int status, pos, nr_entries, free_vectors; + int i, j, temp; + u16 control; unsigned long flags; - if (!pci_msi_enable || !dev) + if (!pci_msi_enable || !dev || !entries) return -EINVAL; + if ((status = msi_init()) < 0) + return status; + if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX))) return -EINVAL; - dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), 2, &control); - if (nvec > multi_msix_capable(control)) + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (control & PCI_MSIX_FLAGS_ENABLE) + return -EINVAL; /* Already in MSI-X mode */ + + nr_entries = multi_msix_capable(control); + if (nvec > nr_entries) return -EINVAL; - spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[dev->irq]; - if (!entry || entry->dev != dev || /* legal call */ - entry->msi_attrib.type != PCI_CAP_ID_MSIX || /* must be MSI-X */ - entry->link.head != entry->link.tail) { /* already multi */ - spin_unlock_irqrestore(&msi_lock, flags); + /* Check for any invalid entries */ + for (i = 0; i < nvec; i++) { + if (entries[i].entry >= nr_entries) + return -EINVAL; /* invalid entry */ + for (j = i + 1; j < nvec; j++) { + if (entries[i].entry == entries[j].entry) + return -EINVAL; /* duplicate entry */ + } + } + temp = dev->irq; + if (!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) { + /* Lookup Sucess */ + nr_entries = nvec; + /* Reroute MSI-X table */ + if (reroute_msix_table(dev->irq, entries, &nr_entries)) { + /* #requested > #previous-assigned */ + dev->irq = temp; + return nr_entries; + } + dev->irq = temp; + enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); + return 0; + } + /* Check whether driver already requested for MSI vector */ + if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0 && + !msi_lookup_vector(dev, PCI_CAP_ID_MSI)) { + printk(KERN_INFO "Can't enable MSI-X. Device already had MSI vector assigned\n"); + dev->irq = temp; return -EINVAL; } + + spin_lock_irqsave(&msi_lock, flags); /* * msi_lock is provided to ensure that enough vectors resources are * available before granting. @@ -874,71 +1003,65 @@ int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec) free_vectors /= nr_msix_devices; spin_unlock_irqrestore(&msi_lock, flags); - if (nvec > free_vectors) - return -EBUSY; - - alloc_vectors = 0; - head = dev->irq; - for (i = 0; i < nvec; i++) { - if ((vec = msi_alloc_vector(dev, head)) < 0) - break; - *(vectors + i) = vec; - head = vec; - alloc_vectors++; - } - if (alloc_vectors != nvec) { - for (i = 0; i < alloc_vectors; i++) { - vec = *(vectors + i); - msi_free_vector(dev, vec); - } - spin_lock_irqsave(&msi_lock, flags); - msi_desc[dev->irq]->link.tail = msi_desc[dev->irq]->link.head; - spin_unlock_irqrestore(&msi_lock, flags); - return -EBUSY; + if (nvec > free_vectors) { + if (free_vectors > 0) + return free_vectors; + else + return -EBUSY; } - if (nr_msix_devices > 0) + + status = msix_capability_init(dev, entries, nvec); + if (!status && nr_msix_devices > 0) nr_msix_devices--; - return 0; + return status; } -/** - * msi_free_vectors - reclaim MSI-X vectors to unused state - * @dev: pointer to the pci_dev data structure of MSI-X device function - * @vector: pointer to an array of released MSI-X vectors - * @nvec: number of MSI-X vectors requested for release by device driver - * - * Reclaim MSI-X vectors released by device driver to unused state, - * which may be used later on. A return of zero indicates the - * success or non-zero for otherwise. Device driver should call this - * before calling function free_irq. - **/ -int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec) +void pci_disable_msix(struct pci_dev* dev) { - struct msi_desc *entry; - int i; - unsigned long flags; + int pos, temp; + u16 control; - if (!pci_msi_enable) - return -EINVAL; + if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX))) + return; - spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[dev->irq]; - if (!entry || entry->dev != dev || - entry->msi_attrib.type != PCI_CAP_ID_MSIX || - entry->link.head == entry->link.tail) { /* Nothing to free */ + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSIX_FLAGS_ENABLE)) + return; + + temp = dev->irq; + if (!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) { + int state, vector, head, tail = 0, warning = 0; + unsigned long flags; + + vector = head = dev->irq; + spin_lock_irqsave(&msi_lock, flags); + while (head != tail) { + state = msi_desc[vector]->msi_attrib.state; + if (state) + warning = 1; + else { + vector_irq[vector] = 0; /* free it */ + nr_released_vectors++; + } + tail = msi_desc[vector]->link.tail; + vector = tail; + } spin_unlock_irqrestore(&msi_lock, flags); - return -EINVAL; - } - spin_unlock_irqrestore(&msi_lock, flags); + if (warning) { + dev->irq = temp; + printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on all vectors\n", + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + BUG_ON(warning > 0); + } else { + dev->irq = temp; + disable_msi_mode(dev, + pci_find_capability(dev, PCI_CAP_ID_MSIX), + PCI_CAP_ID_MSIX); - for (i = 0; i < nvec; i++) { - if (*(vector + i) == dev->irq) - continue;/* Don't free entry 0 if mistaken by driver */ - msi_free_vector(dev, *(vector + i)); + } } - - return 0; } /** @@ -952,62 +1075,73 @@ int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec) **/ void msi_remove_pci_irq_vectors(struct pci_dev* dev) { - struct msi_desc *entry; - int type, temp; + int state, pos, temp; unsigned long flags; if (!pci_msi_enable || !dev) return; - if (!pci_find_capability(dev, PCI_CAP_ID_MSI)) { - if (!pci_find_capability(dev, PCI_CAP_ID_MSIX)) - return; - } - temp = dev->irq; - if (msi_lookup_vector(dev)) - return; - - spin_lock_irqsave(&msi_lock, flags); - entry = msi_desc[dev->irq]; - if (!entry || entry->dev != dev) { + temp = dev->irq; /* Save IOAPIC IRQ */ + if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSI)) > 0 && + !msi_lookup_vector(dev, PCI_CAP_ID_MSI)) { + spin_lock_irqsave(&msi_lock, flags); + state = msi_desc[dev->irq]->msi_attrib.state; spin_unlock_irqrestore(&msi_lock, flags); - return; + if (state) { + printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on vector->%d\n", + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn), dev->irq); + BUG_ON(state > 0); + } else /* Release MSI vector assigned to this device */ + msi_free_vector(dev, dev->irq, 0); + dev->irq = temp; /* Restore IOAPIC IRQ */ } - type = entry->msi_attrib.type; - spin_unlock_irqrestore(&msi_lock, flags); + if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 && + !msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) { + int vector, head, tail = 0, warning = 0; + unsigned long base = 0L; - msi_free_vector(dev, dev->irq); - if (type == PCI_CAP_ID_MSIX) { - int i, pos, dev_msi_cap; - u32 phys_addr, table_offset; - u32 control; - u8 bir; - - pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); - dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), 2, &control); - dev_msi_cap = multi_msix_capable(control); - dev->bus->ops->read(dev->bus, dev->devfn, - msix_table_offset_reg(pos), 4, &table_offset); - bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); - phys_addr = pci_resource_start (dev, bir); - phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK); - for (i = FIRST_DEVICE_VECTOR; i < NR_IRQS; i++) { + vector = head = dev->irq; + while (head != tail) { spin_lock_irqsave(&msi_lock, flags); - if (!msi_desc[i] || msi_desc[i]->dev != dev) { - spin_unlock_irqrestore(&msi_lock, flags); - continue; - } + state = msi_desc[vector]->msi_attrib.state; + tail = msi_desc[vector]->link.tail; + base = msi_desc[vector]->mask_base; spin_unlock_irqrestore(&msi_lock, flags); - msi_free_vector(dev, i); + if (state) + warning = 1; + else if (vector != head) /* Release MSI-X vector */ + msi_free_vector(dev, vector, 0); + vector = tail; + } + msi_free_vector(dev, vector, 0); + if (warning) { + /* Force to release the MSI-X memory-mapped table */ + u32 phys_addr, table_offset; + u16 control; + u8 bir; + + pci_read_config_word(dev, msi_control_reg(pos), + &control); + pci_read_config_dword(dev, msix_table_offset_reg(pos), + &table_offset); + bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); + phys_addr = pci_resource_start (dev, bir); + phys_addr += (u32)(table_offset & + ~PCI_MSIX_FLAGS_BIRMASK); + iounmap((void*)base); + release_mem_region(phys_addr, PCI_MSIX_ENTRY_SIZE * + multi_msix_capable(control)); + printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on all vectors\n", + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + BUG_ON(warning > 0); } - writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); - iounmap((void*)entry->mask_base); - release_mem_region(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE); + dev->irq = temp; /* Restore IOAPIC IRQ */ } - dev->irq = temp; - nr_reserved_vectors++; } EXPORT_SYMBOL(pci_enable_msi); -EXPORT_SYMBOL(msi_alloc_vectors); -EXPORT_SYMBOL(msi_free_vectors); +EXPORT_SYMBOL(pci_disable_msi); +EXPORT_SYMBOL(pci_enable_msix); +EXPORT_SYMBOL(pci_disable_msix); diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index 524504fdd4f0..3a7a52854393 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h @@ -140,7 +140,8 @@ struct msi_desc { struct { __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ __u8 maskbit : 1; /* mask-pending bit supported ? */ - __u8 reserved: 2; /* reserved */ + __u8 state : 1; /* {0: free, 1: busy} */ + __u8 reserved: 1; /* reserved */ __u8 entry_nr; /* specific enabled entry */ __u8 default_vector; /* default pre-assigned vector */ __u8 current_cpu; /* current destination cpu */ diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index ceeed4fb4f11..0efa9c6e730a 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -29,10 +29,6 @@ file under either the MPL or the GPL. ======================================================================*/ -/* - * Please see linux/Documentation/arm/SA1100/PCMCIA for more information - * on the low-level kernel interface. - */ #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index d9d363a9e2e1..d11f86948afe 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -1386,7 +1386,7 @@ static int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev "aha152x: unable to verify geometry for disk with >1GB.\n" " Using default translation. Please verify yourself.\n" " Perhaps you need to enable extended translation in the driver.\n" - " See /usr/src/linux/Documentation/scsi/aha152x.txt for details.\n"); + " See Documentation/scsi/aha152x.txt for details.\n"); } } else { info_array[0] = info[0]; diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 3b749ddd0c09..6529f0c55772 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -681,6 +681,7 @@ static int fdomain_get_irq( int base ) static int fdomain_isa_detect( int *irq, int *iobase ) { +#ifndef PCMCIA int i, j; int base = 0xdeadbeef; int flag = 0; @@ -786,6 +787,9 @@ static int fdomain_isa_detect( int *irq, int *iobase ) *iobase = base; return 1; /* success */ +#else + return 0; +#endif } /* PCI detection function: int fdomain_pci_bios_detect(int* irq, int* diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig index b7d208e60886..df52190f4d94 100644 --- a/drivers/scsi/pcmcia/Kconfig +++ b/drivers/scsi/pcmcia/Kconfig @@ -17,7 +17,7 @@ config PCMCIA_AHA152X config PCMCIA_FDOMAIN tristate "Future Domain PCMCIA support" - depends on m && ISA + depends on m help Say Y here if you intend to attach this type of PCMCIA SCSI host adapter to your computer. diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 239d5c0e580f..1b324b8002e9 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c @@ -1215,7 +1215,7 @@ static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, stru pdev = pACB->pdev; pci_read_config_word(pdev, PCI_STATUS, &pstat); printk ("DC390: Register dump: PCI Status: %04x\n", pstat); - printk ("DC390: In case of driver trouble read linux/Documentation/scsi/tmscsim.txt\n"); + printk ("DC390: In case of driver trouble read Documentation/scsi/tmscsim.txt\n"); } diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index 51a39a31417a..529a2de54fec 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c @@ -16,7 +16,7 @@ * Based on the Linux CPiA driver written by Peter Pregler, * Scott J. Bertin and Johannes Erdfelt. * - * Please see the file: linux/Documentation/usb/ov511.txt + * Please see the file: Documentation/usb/ov511.txt * and the website at: http://alpha.dyndns.org/ov511 * for more info. * diff --git a/drivers/usb/misc/tiglusb.c b/drivers/usb/misc/tiglusb.c index 471873b0c1e3..51717375a8c0 100644 --- a/drivers/usb/misc/tiglusb.c +++ b/drivers/usb/misc/tiglusb.c @@ -10,7 +10,7 @@ * * Based on dabusb.c, printer.c & scanner.c * - * Please see the file: linux/Documentation/usb/SilverLink.txt + * Please see the file: Documentation/usb/silverlink.txt * and the website at: http://lpg.ticalc.org/prj_usb/ * for more info. * diff --git a/fs/Kconfig b/fs/Kconfig index 82810094fdce..e6bdc081fec2 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -554,44 +554,6 @@ menu "DOS/FAT/NT Filesystems" config FAT_FS tristate select NLS - help - If you want to use one of the FAT-based file systems (the MS-DOS, - VFAT (Windows 95) and UMSDOS (used to run Linux on top of an - ordinary DOS partition) file systems), then you must say Y or M here - to include FAT support. You will then be able to mount partitions or - diskettes with FAT-based file systems and transparently access the - files on them, i.e. MSDOS files will look and behave just like all - other Unix files. - - This FAT support is not a file system in itself, it only provides - the foundation for the other file systems. You will have to say Y or - M to at least one of "MSDOS fs support" or "VFAT fs support" in - order to make use of it. - - Another way to read and write MSDOS floppies and hard drive - partitions from within Linux (but not transparently) is with the - mtools ("man mtools") program suite. You don't need to say Y here in - order to do that. - - If you need to move large files on floppies between a DOS and a - Linux box, say Y here, mount the floppy under Linux with an MSDOS - file system and use GNU tar's M option. GNU tar is a program - available for Unix and DOS ("man tar" or "info tar"). - - It is now also becoming possible to read and write compressed FAT - file systems; read <file:Documentation/filesystems/fat_cvf.txt> for - details. - - The FAT support will enlarge your kernel by about 37 KB. If unsure, - say Y. - - To compile this as a module, choose M here: the module will be called - fat. Note that if you compile the FAT support as a module, you - cannot compile any of the FAT-based file systems into the kernel - -- they will have to be modules as well. - The file system of your root partition (the one containing the - directory /) cannot be a module, so don't say M here if you intend - to use UMSDOS as your root file system. config MSDOS_FS tristate "MSDOS fs support" @@ -644,25 +606,6 @@ config VFAT_FS To compile this as a module, choose M here: the module will be called vfat. -config FAT_DEFAULT_CODEPAGE - int "Default codepage for FAT" - depends on MSDOS_FS || VFAT_FS - default 437 - help - This option should be set to the codepage of your FAT filesystems. - It can be overridden with the 'codepage' mount option. - -config FAT_DEFAULT_IOCHARSET - string "Default iocharset for FAT" - depends on VFAT_FS - default "iso8859-1" - help - Set this to the default I/O character set you'd like FAT to use. - It should probably match the character set that most of your - FAT filesystems use, and can be overridded with the 'iocharset' - mount option for FAT filesystems. Note that UTF8 is *not* a - supported charset for FAT filesystems. - config UMSDOS_FS #dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS # UMSDOS is temprory broken @@ -376,6 +376,115 @@ int bio_add_page(struct bio *bio, struct page *page, unsigned int len, len, offset); } +/** + * bio_uncopy_user - finish previously mapped bio + * @bio: bio being terminated + * + * Free pages allocated from bio_copy_user() and write back data + * to user space in case of a read. + */ +int bio_uncopy_user(struct bio *bio) +{ + struct bio_vec *bvec; + int i, ret = 0; + + if (bio_data_dir(bio) == READ) { + char *uaddr = bio->bi_private; + + __bio_for_each_segment(bvec, bio, i, 0) { + char *addr = page_address(bvec->bv_page); + + if (!ret && copy_to_user(uaddr, addr, bvec->bv_len)) + ret = -EFAULT; + + __free_page(bvec->bv_page); + uaddr += bvec->bv_len; + } + } + + bio_put(bio); + return ret; +} + +/** + * bio_copy_user - copy user data to bio + * @q: destination block queue + * @uaddr: start of user address + * @len: length in bytes + * @write_to_vm: bool indicating writing to pages or not + * + * Prepares and returns a bio for indirect user io, bouncing data + * to/from kernel pages as necessary. Must be paired with + * call bio_uncopy_user() on io completion. + */ +struct bio *bio_copy_user(request_queue_t *q, unsigned long uaddr, + unsigned int len, int write_to_vm) +{ + unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; + unsigned long start = uaddr >> PAGE_SHIFT; + struct bio_vec *bvec; + struct page *page; + struct bio *bio; + int i, ret; + + bio = bio_alloc(GFP_KERNEL, end - start); + if (!bio) + return ERR_PTR(-ENOMEM); + + ret = 0; + while (len) { + unsigned int bytes = PAGE_SIZE; + + if (bytes > len) + bytes = len; + + page = alloc_page(q->bounce_gfp | GFP_KERNEL); + if (!page) { + ret = -ENOMEM; + break; + } + + if (__bio_add_page(q, bio, page, bytes, 0) < bytes) { + ret = -EINVAL; + break; + } + + len -= bytes; + } + + /* + * success + */ + if (!ret) { + if (!write_to_vm) { + bio->bi_rw |= (1 << BIO_RW); + /* + * for a write, copy in data to kernel pages + */ + ret = -EFAULT; + bio_for_each_segment(bvec, bio, i) { + char *addr = page_address(bvec->bv_page); + + if (copy_from_user(addr, (char *) uaddr, bvec->bv_len)) + goto cleanup; + } + } + + bio->bi_private = (void *) uaddr; + return bio; + } + + /* + * cleanup + */ +cleanup: + bio_for_each_segment(bvec, bio, i) + __free_page(bvec->bv_page); + + bio_put(bio); + return ERR_PTR(ret); +} + static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, unsigned long uaddr, unsigned int len, int write_to_vm) @@ -392,12 +501,13 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, * size for now, in the future we can relax this restriction */ if ((uaddr & queue_dma_alignment(q)) || (len & queue_dma_alignment(q))) - return NULL; + return ERR_PTR(-EINVAL); bio = bio_alloc(GFP_KERNEL, nr_pages); if (!bio) - return NULL; + return ERR_PTR(-ENOMEM); + ret = -ENOMEM; pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); if (!pages) goto out; @@ -446,11 +556,12 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev, if (!write_to_vm) bio->bi_rw |= (1 << BIO_RW); + bio->bi_flags |= (1 << BIO_USER_MAPPED); return bio; out: kfree(pages); bio_put(bio); - return NULL; + return ERR_PTR(ret); } /** @@ -461,7 +572,7 @@ out: * @write_to_vm: bool indicating writing to pages or not * * Map the user space address into a bio suitable for io to a block - * device. + * device. Returns an error pointer in case of error. */ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev, unsigned long uaddr, unsigned int len, int write_to_vm) @@ -470,26 +581,29 @@ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev, bio = __bio_map_user(q, bdev, uaddr, len, write_to_vm); - if (bio) { - /* - * subtle -- if __bio_map_user() ended up bouncing a bio, - * it would normally disappear when its bi_end_io is run. - * however, we need it for the unmap, so grab an extra - * reference to it - */ - bio_get(bio); + if (IS_ERR(bio)) + return bio; - if (bio->bi_size < len) { - bio_endio(bio, bio->bi_size, 0); - bio_unmap_user(bio, 0); - return NULL; - } - } + /* + * subtle -- if __bio_map_user() ended up bouncing a bio, + * it would normally disappear when its bi_end_io is run. + * however, we need it for the unmap, so grab an extra + * reference to it + */ + bio_get(bio); - return bio; + if (bio->bi_size == len) + return bio; + + /* + * don't support partial mappings + */ + bio_endio(bio, bio->bi_size, 0); + bio_unmap_user(bio); + return ERR_PTR(-EINVAL); } -static void __bio_unmap_user(struct bio *bio, int write_to_vm) +static void __bio_unmap_user(struct bio *bio) { struct bio_vec *bvec; int i; @@ -510,7 +624,7 @@ static void __bio_unmap_user(struct bio *bio, int write_to_vm) * make sure we dirty pages we wrote to */ __bio_for_each_segment(bvec, bio, i, 0) { - if (write_to_vm) + if (bio_data_dir(bio) == READ) set_page_dirty_lock(bvec->bv_page); page_cache_release(bvec->bv_page); @@ -522,17 +636,15 @@ static void __bio_unmap_user(struct bio *bio, int write_to_vm) /** * bio_unmap_user - unmap a bio * @bio: the bio being unmapped - * @write_to_vm: bool indicating whether pages were written to * - * Unmap a bio previously mapped by bio_map_user(). The @write_to_vm - * must be the same as passed into bio_map_user(). Must be called with + * Unmap a bio previously mapped by bio_map_user(). Must be called with * a process context. * * bio_unmap_user() may sleep. */ -void bio_unmap_user(struct bio *bio, int write_to_vm) +void bio_unmap_user(struct bio *bio) { - __bio_unmap_user(bio, write_to_vm); + __bio_unmap_user(bio); bio_put(bio); } @@ -863,3 +975,5 @@ EXPORT_SYMBOL(bio_unmap_user); EXPORT_SYMBOL(bio_pair_release); EXPORT_SYMBOL(bio_split); EXPORT_SYMBOL(bio_split_pool); +EXPORT_SYMBOL(bio_copy_user); +EXPORT_SYMBOL(bio_uncopy_user); diff --git a/fs/fat/inode.c b/fs/fat/inode.c index c0fc6b7d6a98..b4ee8c93e67f 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -23,14 +23,6 @@ #include <linux/parser.h> #include <asm/unaligned.h> -#ifndef CONFIG_FAT_DEFAULT_IOCHARSET -/* if user don't select VFAT, this is undefined. */ -#define CONFIG_FAT_DEFAULT_IOCHARSET "" -#endif - -static int fat_default_codepage = CONFIG_FAT_DEFAULT_CODEPAGE; -static char fat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET; - /* * New FAT inode stuff. We do the following: * a) i_ino is constant and has nothing with on-disk location. @@ -174,15 +166,15 @@ void fat_put_super(struct super_block *sb) if (sbi->nls_disk) { unload_nls(sbi->nls_disk); sbi->nls_disk = NULL; - sbi->options.codepage = fat_default_codepage; + sbi->options.codepage = 0; } if (sbi->nls_io) { unload_nls(sbi->nls_io); sbi->nls_io = NULL; } - if (sbi->options.iocharset != fat_default_iocharset) { + if (sbi->options.iocharset) { kfree(sbi->options.iocharset); - sbi->options.iocharset = fat_default_iocharset; + sbi->options.iocharset = NULL; } sb->s_fs_info = NULL; @@ -201,11 +193,10 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt) seq_printf(m, ",gid=%u", opts->fs_gid); seq_printf(m, ",fmask=%04o", opts->fs_fmask); seq_printf(m, ",dmask=%04o", opts->fs_dmask); - if (sbi->nls_disk && opts->codepage != fat_default_codepage) + if (sbi->nls_disk && opts->codepage) seq_printf(m, ",codepage=%s", sbi->nls_disk->charset); if (isvfat) { - if (sbi->nls_io && - strcmp(opts->iocharset, fat_default_iocharset)) + if (sbi->nls_io && opts->iocharset) seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); switch (opts->shortname) { @@ -336,15 +327,14 @@ static int parse_options(char *options, int is_vfat, int *debug, char *p; substring_t args[MAX_OPT_ARGS]; int option; - char *iocharset; opts->isvfat = is_vfat; opts->fs_uid = current->uid; opts->fs_gid = current->gid; opts->fs_fmask = opts->fs_dmask = current->fs->umask; - opts->codepage = fat_default_codepage; - opts->iocharset = fat_default_iocharset; + opts->codepage = 0; + opts->iocharset = NULL; if (is_vfat) opts->shortname = VFAT_SFN_DISPLAY_LOWER|VFAT_SFN_CREATE_WIN95; else @@ -443,12 +433,11 @@ static int parse_options(char *options, int is_vfat, int *debug, /* vfat specific */ case Opt_charset: - if (opts->iocharset != fat_default_iocharset) + if (opts->iocharset) kfree(opts->iocharset); - iocharset = match_strdup(&args[0]); - if (!iocharset) + opts->iocharset = match_strdup(&args[0]); + if (opts->iocharset == NULL) return -ENOMEM; - opts->iocharset = iocharset; break; case Opt_shortname_lower: opts->shortname = VFAT_SFN_DISPLAY_LOWER @@ -497,15 +486,9 @@ static int parse_options(char *options, int is_vfat, int *debug, return -EINVAL; } } - /* UTF8 doesn't provide FAT semantics */ - if (!strcmp(opts->iocharset, "utf8")) { - printk(KERN_ERR "FAT: utf8 is not a recommended IO charset" - " for FAT filesystems, filesystem will be case sensitive!\n"); - } - if (opts->unicode_xlate) opts->utf8 = 0; - + return 0; } @@ -785,6 +768,66 @@ static struct export_operations fat_export_ops = { .get_parent = fat_get_parent, }; +static int fat_load_nls(struct super_block *sb) +{ + struct msdos_sb_info *sbi = MSDOS_SB(sb); + struct fat_mount_options *opts = &sbi->options; + char codepage[50], *iocharset; + int error = 0, not_specified = 0; + + if (opts->codepage) + snprintf(codepage, sizeof(codepage), "cp%d", opts->codepage); + else { + not_specified = 1; + strcpy(codepage, "default"); + } + sbi->nls_disk = load_nls(codepage); + if (sbi->nls_disk == NULL) { + printk(KERN_ERR "FAT: codepage %s not found\n", codepage); + error = -EINVAL; + goto out; + } + + if (opts->isvfat) { + if (opts->iocharset) + iocharset = opts->iocharset; + else { + not_specified = 1; + iocharset = "default"; + } + /* + * FIXME: utf8 is using iocharset for upper/lower conversion + * UTF8 doesn't provide FAT semantics + */ + if (!strcmp(iocharset, "utf8")) { + printk(KERN_WARNING + "FAT: utf8 is not a recommended IO charset" + " for FAT filesystem," + " filesystem will be case sensitive!\n"); + } + sbi->nls_io = load_nls(iocharset); + if (sbi->nls_io == NULL) { + printk(KERN_ERR "FAT: IO charset %s not found\n", + iocharset); + error = -EINVAL; + goto out; + } + } + + if (not_specified) { + unsigned long not_ro = !(sb->s_flags & MS_RDONLY); + if (not_ro) + sb->s_flags |= MS_RDONLY; + + printk(KERN_INFO "FAT: %s option didn't specified\n" + " File name can not access proper%s\n", + opts->isvfat ? "codepage or iocharset" : "codepage", + not_ro ? " (mounted as read-only)" : ""); + } +out: + return error; +} + /* * Read the super block of an MS-DOS FS. */ @@ -800,7 +843,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int debug, first; unsigned int media; long error; - char buf[50]; sbi = kmalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); if (!sbi) @@ -1015,23 +1057,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, goto out_invalid; } - error = -EINVAL; - sprintf(buf, "cp%d", sbi->options.codepage); - sbi->nls_disk = load_nls(buf); - if (!sbi->nls_disk) { - printk(KERN_ERR "FAT: codepage %s not found\n", buf); + error = fat_load_nls(sb); + if (error) goto out_fail; - } - - /* FIXME: utf8 is using iocharset for upper/lower conversion */ - if (sbi->options.isvfat) { - sbi->nls_io = load_nls(sbi->options.iocharset); - if (!sbi->nls_io) { - printk(KERN_ERR "FAT: IO charset %s not found\n", - sbi->options.iocharset); - goto out_fail; - } - } error = -ENOMEM; root_inode = new_inode(sb); @@ -1065,7 +1093,7 @@ out_fail: unload_nls(sbi->nls_io); if (sbi->nls_disk) unload_nls(sbi->nls_disk); - if (sbi->options.iocharset != fat_default_iocharset) + if (sbi->options.iocharset) kfree(sbi->options.iocharset); sb->s_fs_info = NULL; kfree(sbi); diff --git a/fs/locks.c b/fs/locks.c index fc25e6396876..0204acb9f0db 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -60,7 +60,7 @@ * * Initial implementation of mandatory locks. SunOS turned out to be * a rotten model, so I implemented the "obvious" semantics. - * See 'linux/Documentation/mandatory.txt' for details. + * See 'Documentation/mandatory.txt' for details. * Andy Walker (andy@lysaker.kvaerner.no), April 06, 1996. * * Don't allow mandatory locks on mmap()'ed files. Added simple functions to diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d3cf187b95ba..36f5abc65dcb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -456,7 +456,7 @@ nfs_fill_super(struct super_block *sb, struct nfs_mount_data *data, int silent) /* Create RPC client handles */ server->client = nfs_create_client(server, data); - if (server->client == NULL) + if (IS_ERR(server->client)) goto out_fail; /* RFC 2623, sec 2.3.2 */ if (authflavor != RPC_AUTH_UNIX) { @@ -1550,16 +1550,17 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, err = PTR_ERR(clnt); goto out_remove_list; } + + clnt->cl_intr = (server->flags & NFS4_MOUNT_INTR) ? 1 : 0; + clnt->cl_softrtry = (server->flags & NFS4_MOUNT_SOFT) ? 1 : 0; + server->client = clnt; + err = -ENOMEM; if (server->nfs4_state->cl_idmap == NULL) { printk(KERN_WARNING "NFS: failed to create idmapper.\n"); goto out_shutdown; } - clnt->cl_intr = (server->flags & NFS4_MOUNT_INTR) ? 1 : 0; - clnt->cl_softrtry = (server->flags & NFS4_MOUNT_SOFT) ? 1 : 0; - server->client = clnt; - if (clnt->cl_auth->au_flavor != authflavour) { if (rpcauth_create(authflavour, clnt) == NULL) { printk(KERN_WARNING "NFS: couldn't create credcache!\n"); diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h index 048ed44dbce7..84d875206dad 100644 --- a/include/asm-arm/cacheflush.h +++ b/include/asm-arm/cacheflush.h @@ -97,7 +97,7 @@ * Start addresses are inclusive and end addresses are exclusive; * start addresses should be rounded down, end addresses up. * - * See linux/Documentation/cachetlb.txt for more information. + * See Documentation/cachetlb.txt for more information. * Please note that the implementation of these, and the required * effects are cache-type (VIVT/VIPT/PIPT) specific. * diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 9d7b1be3ad0f..93aa555cfa05 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -263,7 +263,7 @@ out: * ioremap and friends. * * ioremap takes a PCI memory address, as specified in - * linux/Documentation/IO-mapping.txt. + * Documentation/IO-mapping.txt. */ extern void * __ioremap(unsigned long, size_t, unsigned long, unsigned long); extern void __iounmap(void *addr); diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h index dc58da851edd..ac311c56e202 100644 --- a/include/asm-arm/setup.h +++ b/include/asm-arm/setup.h @@ -8,7 +8,7 @@ * published by the Free Software Foundation. * * Structure passed to kernel to tell it about the - * hardware it's running on. See linux/Documentation/arm/Setup + * hardware it's running on. See Documentation/arm/Setup * for more info. */ #ifndef __ASMARM_SETUP_H diff --git a/include/asm-arm26/io.h b/include/asm-arm26/io.h index d9885d087b44..b1f1812822c7 100644 --- a/include/asm-arm26/io.h +++ b/include/asm-arm26/io.h @@ -386,7 +386,7 @@ extern void _memset_io(unsigned long, int, size_t); * ioremap and friends. * * ioremap takes a PCI memory address, as specified in - * linux/Documentation/IO-mapping.txt. + * Documentation/IO-mapping.txt. */ extern void * __ioremap(unsigned long, size_t, unsigned long, unsigned long); extern void __iounmap(void *addr); diff --git a/include/asm-arm26/setup.h b/include/asm-arm26/setup.h index 1e1002711665..387c3c6b2d6d 100644 --- a/include/asm-arm26/setup.h +++ b/include/asm-arm26/setup.h @@ -8,7 +8,7 @@ * published by the Free Software Foundation. * * Structure passed to kernel to tell it about the - * hardware it's running on. See linux/Documentation/arm/Setup + * hardware it's running on. See Documentation/arm/Setup * for more info. */ #ifndef __ASMARM_SETUP_H diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h index 37b969fe7f13..a387a7f98459 100644 --- a/include/asm-i386/io_apic.h +++ b/include/asm-i386/io_apic.h @@ -13,7 +13,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff --git a/include/asm-i386/mach-default/irq_vectors_limits.h b/include/asm-i386/mach-default/irq_vectors_limits.h index 78c30cbcede4..b330026e6f7f 100644 --- a/include/asm-i386/mach-default/irq_vectors_limits.h +++ b/include/asm-i386/mach-default/irq_vectors_limits.h @@ -1,7 +1,7 @@ #ifndef _ASM_IRQ_VECTORS_LIMITS_H #define _ASM_IRQ_VECTORS_LIMITS_H -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define NR_IRQS FIRST_SYSTEM_VECTOR #define NR_IRQ_VECTORS NR_IRQS #else diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 0df3f9b0a2ff..ef936b861404 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -425,15 +425,7 @@ __syscall_return(type,__res); \ * won't be any messing with the stack from main(), but we define * some others too. */ -static inline _syscall0(pid_t,setsid) -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) -static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) -static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) -static inline _syscall1(int,dup,int,fd) static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) -static inline _syscall3(int,open,const char *,file,int,flag,int,mode) -static inline _syscall1(int,close,int,fd) -static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount); asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index 12362026045f..54dddea8388f 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -153,6 +153,79 @@ static __inline__ int irq_canonicalize(int irq) return irq; } +#elif defined(CONFIG_CPM2) && defined(CONFIG_85xx) +/* Now include the board configuration specific associations. +*/ +#include <asm/mpc85xx.h> + +/* The MPC8560 openpic has 32 internal interrupts and 12 external + * interrupts. + * + * We are "flattening" the interrupt vectors of the cascaded CPM + * so that we can uniquely identify any interrupt source with a + * single integer. + */ +#define NR_CPM_INTS 64 +#define NR_EPIC_INTS 44 +#ifndef NR_8259_INTS +#define NR_8259_INTS 0 +#endif +#define NUM_8259_INTERRUPTS NR_8259_INTS + +#ifndef CPM_IRQ_OFFSET +#define CPM_IRQ_OFFSET 0 +#endif + +#define NR_IRQS (NR_EPIC_INTS + NR_CPM_INTS + NR_8259_INTS) + +/* These values must be zero-based and map 1:1 with the EPIC configuration. + * They are used throughout the 8560 I/O subsystem to generate + * interrupt masks, flags, and other control patterns. This is why the + * current kernel assumption of the 8259 as the base controller is such + * a pain in the butt. + */ + +#define SIU_INT_ERROR ((uint)0x00+CPM_IRQ_OFFSET) +#define SIU_INT_I2C ((uint)0x01+CPM_IRQ_OFFSET) +#define SIU_INT_SPI ((uint)0x02+CPM_IRQ_OFFSET) +#define SIU_INT_RISC ((uint)0x03+CPM_IRQ_OFFSET) +#define SIU_INT_SMC1 ((uint)0x04+CPM_IRQ_OFFSET) +#define SIU_INT_SMC2 ((uint)0x05+CPM_IRQ_OFFSET) +#define SIU_INT_TIMER1 ((uint)0x0c+CPM_IRQ_OFFSET) +#define SIU_INT_TIMER2 ((uint)0x0d+CPM_IRQ_OFFSET) +#define SIU_INT_TIMER3 ((uint)0x0e+CPM_IRQ_OFFSET) +#define SIU_INT_TIMER4 ((uint)0x0f+CPM_IRQ_OFFSET) +#define SIU_INT_FCC1 ((uint)0x20+CPM_IRQ_OFFSET) +#define SIU_INT_FCC2 ((uint)0x21+CPM_IRQ_OFFSET) +#define SIU_INT_FCC3 ((uint)0x22+CPM_IRQ_OFFSET) +#define SIU_INT_MCC1 ((uint)0x24+CPM_IRQ_OFFSET) +#define SIU_INT_MCC2 ((uint)0x25+CPM_IRQ_OFFSET) +#define SIU_INT_SCC1 ((uint)0x28+CPM_IRQ_OFFSET) +#define SIU_INT_SCC2 ((uint)0x29+CPM_IRQ_OFFSET) +#define SIU_INT_SCC3 ((uint)0x2a+CPM_IRQ_OFFSET) +#define SIU_INT_SCC4 ((uint)0x2b+CPM_IRQ_OFFSET) +#define SIU_INT_PC15 ((uint)0x30+CPM_IRQ_OFFSET) +#define SIU_INT_PC14 ((uint)0x31+CPM_IRQ_OFFSET) +#define SIU_INT_PC13 ((uint)0x32+CPM_IRQ_OFFSET) +#define SIU_INT_PC12 ((uint)0x33+CPM_IRQ_OFFSET) +#define SIU_INT_PC11 ((uint)0x34+CPM_IRQ_OFFSET) +#define SIU_INT_PC10 ((uint)0x35+CPM_IRQ_OFFSET) +#define SIU_INT_PC9 ((uint)0x36+CPM_IRQ_OFFSET) +#define SIU_INT_PC8 ((uint)0x37+CPM_IRQ_OFFSET) +#define SIU_INT_PC7 ((uint)0x38+CPM_IRQ_OFFSET) +#define SIU_INT_PC6 ((uint)0x39+CPM_IRQ_OFFSET) +#define SIU_INT_PC5 ((uint)0x3a+CPM_IRQ_OFFSET) +#define SIU_INT_PC4 ((uint)0x3b+CPM_IRQ_OFFSET) +#define SIU_INT_PC3 ((uint)0x3c+CPM_IRQ_OFFSET) +#define SIU_INT_PC2 ((uint)0x3d+CPM_IRQ_OFFSET) +#define SIU_INT_PC1 ((uint)0x3e+CPM_IRQ_OFFSET) +#define SIU_INT_PC0 ((uint)0x3f+CPM_IRQ_OFFSET) + +static __inline__ int irq_canonicalize(int irq) +{ + return irq; +} + #else /* CONFIG_40x + CONFIG_8xx */ /* * this is the # irq's for all ppc arch's (pmac/chrp/prep) diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h index aab7cb76aefa..d3be2353890e 100644 --- a/include/asm-ppc/mpc85xx.h +++ b/include/asm-ppc/mpc85xx.h @@ -25,13 +25,23 @@ #ifdef CONFIG_MPC8540_ADS #include <platforms/85xx/mpc8540_ads.h> #endif +#ifdef CONFIG_MPC8555_CDS +#include <platforms/85xx/mpc8555_cds.h> +#endif +#ifdef CONFIG_MPC8560_ADS +#include <platforms/85xx/mpc8560_ads.h> +#endif #ifdef CONFIG_SBC8560 #include <platforms/85xx/sbc8560.h> #endif #define _IO_BASE isa_io_base #define _ISA_MEM_BASE isa_mem_base +#ifdef CONFIG_PCI #define PCI_DRAM_OFFSET pci_dram_offset +#else +#define PCI_DRAM_OFFSET 0 +#endif /* * The "residual" board information structure the boot loader passes diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index 54a1466fe104..3b66f32b6cc8 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h @@ -37,12 +37,6 @@ typedef struct { mm_context_t ctx = { .id = REGION_ID(ea), KERNEL_LOW_HPAGES}; \ ctx; }) -/* - * Hardware Segment Lookaside Buffer Entry - * This structure has been padded out to two 64b doublewords (actual SLBE's are - * 94 bits). This padding facilites use by the segment management - * instructions. - */ typedef struct { unsigned long esid: 36; /* Effective segment ID */ unsigned long resv0:20; /* Reserved */ @@ -71,35 +65,6 @@ typedef struct _STE { } dw1; } STE; -typedef struct { - unsigned long esid: 36; /* Effective segment ID */ - unsigned long v: 1; /* Entry valid (v=1) or invalid */ - unsigned long null1:15; /* padding to a 64b boundary */ - unsigned long index:12; /* Index to select SLB entry. Used by slbmte */ -} slb_dword0; - -typedef struct { - unsigned long vsid: 52; /* Virtual segment ID */ - unsigned long ks: 1; /* Supervisor (privileged) state storage key */ - unsigned long kp: 1; /* Problem state storage key */ - unsigned long n: 1; /* No-execute if n=1 */ - unsigned long l: 1; /* Virt pages are large (l=1) or 4KB (l=0) */ - unsigned long c: 1; /* Class */ - unsigned long resv0: 7; /* Padding to a 64b boundary */ -} slb_dword1; - -typedef struct { - union { - unsigned long dword0; - slb_dword0 dw0; - } dw0; - - union { - unsigned long dword1; - slb_dword1 dw1; - } dw1; -} SLBE; - /* Hardware Page Table Entry */ #define HPTES_PER_GROUP 8 @@ -259,6 +224,30 @@ extern void htab_finish_init(void); #define STAB0_PHYS_ADDR (STAB0_PAGE<<PAGE_SHIFT) #define STAB0_VIRT_ADDR (KERNELBASE+STAB0_PHYS_ADDR) +#define SLB_NUM_BOLTED 2 +#define SLB_CACHE_ENTRIES 8 + +/* Bits in the SLB ESID word */ +#define SLB_ESID_V 0x0000000008000000 /* entry is valid */ + +/* Bits in the SLB VSID word */ +#define SLB_VSID_SHIFT 12 +#define SLB_VSID_KS 0x0000000000000800 +#define SLB_VSID_KP 0x0000000000000400 +#define SLB_VSID_N 0x0000000000000200 /* no-execute */ +#define SLB_VSID_L 0x0000000000000100 /* largepage (4M) */ +#define SLB_VSID_C 0x0000000000000080 /* class */ + +#define SLB_VSID_KERNEL (SLB_VSID_KP|SLB_VSID_C) +#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS) + +#define VSID_RANDOMIZER ASM_CONST(42470972311) +#define VSID_MASK 0xfffffffffUL +/* Because we never access addresses below KERNELBASE as kernel + * addresses, this VSID is never used for anything real, and will + * never have pages hashed into it */ +#define BAD_VSID ASM_CONST(0) + /* Block size masks */ #define BL_128K 0x000 #define BL_256K 0x001 diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h index 505ad13b358e..03561b5895d7 100644 --- a/include/asm-ppc64/mmu_context.h +++ b/include/asm-ppc64/mmu_context.h @@ -136,7 +136,7 @@ destroy_context(struct mm_struct *mm) } extern void flush_stab(struct task_struct *tsk, struct mm_struct *mm); -extern void flush_slb(struct task_struct *tsk, struct mm_struct *mm); +extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm); /* * switch_mm is the entry point called from the architecture independent @@ -161,7 +161,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, return; if (cur_cpu_spec->cpu_features & CPU_FTR_SLB) - flush_slb(tsk, next); + switch_slb(tsk, next); else flush_stab(tsk, next); } @@ -181,10 +181,6 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) local_irq_restore(flags); } -#define VSID_RANDOMIZER 42470972311UL -#define VSID_MASK 0xfffffffffUL - - /* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's */ static inline unsigned long diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index 0eab9114c225..851082cd25b9 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h @@ -78,20 +78,26 @@ struct paca_struct { u64 exmc[8]; /* used for machine checks */ u64 exslb[8]; /* used for SLB/segment table misses * on the linear mapping */ - u64 exdsi[8]; /* used for linear mapping hash table misses */ + u64 slb_r3; /* spot to save R3 on SLB miss */ + mm_context_t context; + u16 slb_cache[SLB_CACHE_ENTRIES]; + u16 slb_cache_ptr; /* * then miscellaneous read-write fields */ struct task_struct *__current; /* Pointer to current */ u64 kstack; /* Saved Kernel stack addr */ - u64 stab_next_rr; /* stab/slb round-robin counter */ + u64 stab_rr; /* stab/slb round-robin counter */ u64 next_jiffy_update_tb; /* TB value for next jiffy update */ u64 saved_r1; /* r1 save for RTAS calls */ u64 saved_msr; /* MSR saved here by enter_rtas */ u32 lpevent_count; /* lpevents processed */ u8 proc_enabled; /* irq soft-enable flag */ + /* not yet used */ + u64 exdsi[8]; /* used for linear mapping hash table misses */ + /* * iSeries structues which the hypervisor knows about - Not * sure if these particularly need to be cacheline aligned. diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index b144b14dc724..a30e2a97bee1 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h @@ -27,6 +27,7 @@ #define SID_SHIFT 28 #define SID_MASK 0xfffffffffUL +#define ESID_MASK 0xfffffffff0000000UL #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) #ifdef CONFIG_HUGETLB_PAGE @@ -37,8 +38,8 @@ #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) /* For 64-bit processes the hugepage range is 1T-1.5T */ -#define TASK_HPAGE_BASE (0x0000010000000000UL) -#define TASK_HPAGE_END (0x0000018000000000UL) +#define TASK_HPAGE_BASE ASM_CONST(0x0000010000000000) +#define TASK_HPAGE_END ASM_CONST(0x0000018000000000) #define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ - (1U << GET_ESID(addr))) & 0xffff) diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index 08ba3f2b89ba..acb6aff2ada9 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h @@ -47,7 +47,6 @@ struct pci_controller { * the PCI memory space in the CPU bus space */ unsigned long pci_mem_offset; - unsigned long pci_io_offset; struct pci_ops *ops; volatile unsigned int *cfg_addr; diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h index 5f31a27b0902..288296121af1 100644 --- a/include/asm-x86_64/io_apic.h +++ b/include/asm-x86_64/io_apic.h @@ -13,7 +13,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index 37c9fd65c97f..34bd00bfc64c 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h @@ -31,7 +31,7 @@ #define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */ -#ifdef CONFIG_PCI_USE_VECTOR +#ifdef CONFIG_PCI_MSI #define NR_IRQS FIRST_SYSTEM_VECTOR #define NR_IRQ_VECTORS NR_IRQS #else diff --git a/include/linux/acct.h b/include/linux/acct.h index 6c2bd56773f0..b46ce1ac1c6a 100644 --- a/include/linux/acct.h +++ b/include/linux/acct.h @@ -17,6 +17,7 @@ #include <linux/types.h> #include <asm/param.h> +#include <asm/byteorder.h> /* * comp_t is a 16-bit "floating" point number with a 3-bit base 8 @@ -104,7 +105,12 @@ struct acct_v3 #define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ #define ACORE 0x08 /* ... dumped core */ #define AXSIG 0x10 /* ... was killed by a signal */ -#define ABYTESEX 0x80 /* always set, allows to detect byteorder */ + +#ifdef __BIG_ENDIAN +#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ +#else +#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ +#endif #ifdef __KERNEL__ diff --git a/include/linux/bio.h b/include/linux/bio.h index 601531cf4976..b90e06c17644 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -120,6 +120,7 @@ struct bio { #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ #define BIO_CLONED 4 /* doesn't own data */ #define BIO_BOUNCED 5 /* bio is a bounce bio */ +#define BIO_USER_MAPPED 6 /* contains user pages */ #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) /* @@ -264,9 +265,11 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); -extern void bio_unmap_user(struct bio *, int); +extern void bio_unmap_user(struct bio *); extern void bio_set_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio); +extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); +extern int bio_uncopy_user(struct bio *); #ifdef CONFIG_HIGHMEM /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0ac26dad8931..7df0f31bfe7d 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -524,7 +524,7 @@ extern void __blk_stop_queue(request_queue_t *q); extern void blk_run_queue(request_queue_t *); extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); -extern int blk_rq_unmap_user(struct request *, void __user *, struct bio *, unsigned int); +extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *); static inline request_queue_t *bdev_get_queue(struct block_device *bdev) diff --git a/include/linux/pci.h b/include/linux/pci.h index abfb688bde5f..2ce5f957c072 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -831,16 +831,27 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass extern struct pci_dev *isa_bridge; #endif -#ifndef CONFIG_PCI_USE_VECTOR +struct msix_entry { + u16 vector; /* kernel uses to write allocated vector */ + u16 entry; /* driver uses to specify entry, OS writes */ +}; + +#ifndef CONFIG_PCI_MSI static inline void pci_scan_msi_device(struct pci_dev *dev) {} static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} +static inline void pci_disable_msi(struct pci_dev *dev) {} +static inline int pci_enable_msix(struct pci_dev* dev, + struct msix_entry *entries, int nvec) {return -1;} +static inline void pci_disable_msix(struct pci_dev *dev) {} static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} #else extern void pci_scan_msi_device(struct pci_dev *dev); extern int pci_enable_msi(struct pci_dev *dev); +extern void pci_disable_msi(struct pci_dev *dev); +extern int pci_enable_msix(struct pci_dev* dev, + struct msix_entry *entries, int nvec); +extern void pci_disable_msix(struct pci_dev *dev); extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); -extern int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec); -extern int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec); #endif #endif /* CONFIG_PCI */ diff --git a/include/linux/swap.h b/include/linux/swap.h index b9edc335a563..b081066b5f11 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -148,7 +148,7 @@ struct swap_list_t { #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) /* linux/mm/oom_kill.c */ -extern void out_of_memory(void); +extern void out_of_memory(int gfp_mask); /* linux/mm/memory.c */ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); diff --git a/include/linux/tcp.h b/include/linux/tcp.h index d95f58a553b0..9c42ac0b0322 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -420,6 +420,7 @@ struct tcp_opt { __u32 cnt; /* increase cwnd by 1 after this number of ACKs */ __u32 last_max_cwnd; /* last maximium snd_cwnd */ __u32 last_cwnd; /* the last snd_cwnd */ + __u32 last_stamp; /* time when updated last_cwnd */ } bictcp; }; diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 6a67ed3434a5..fc2b279cd148 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -178,8 +178,8 @@ static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr) * This will include the IEEE address token on links that support it. */ - word = addr->s6_addr[2] ^ addr->s6_addr32[3]; - word ^= (word>>16); + word = addr->s6_addr32[2] ^ addr->s6_addr32[3]; + word ^= (word >> 16); word ^= (word >> 8); return ((word ^ (word >> 4)) & 0x0f); diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 493b7237f68d..aaf74999a1f3 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -821,11 +821,9 @@ extern int xfrm4_rcv(struct sk_buff *skb); extern int xfrm4_output(struct sk_buff **pskb); extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); -extern int xfrm4_tunnel_check_size(struct sk_buff *skb); extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp); extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); -extern int xfrm6_tunnel_check_size(struct sk_buff *skb); extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 01bf5b5385df..c8985dd1d4b2 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -76,7 +76,7 @@ Major new features in SG 3.x driver (cf SG 2.x drivers) http://www.torque.net/sg/p/scsi-generic_long.txt A version of this document (potentially out of date) may also be found in the kernel source tree, probably at: - /usr/src/linux/Documentation/scsi/scsi-generic.txt . + Documentation/scsi/scsi-generic.txt . Utility and test programs are available at the sg web site. They are bundled as sg_utils (for the lk 2.2 series) and sg3_utils (for the diff --git a/kernel/acct.c b/kernel/acct.c index e55e7bba861e..daf23c4efab4 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -398,7 +398,7 @@ static void do_acct_process(long exitcode, struct file *file) */ memset((caddr_t)&ac, 0, sizeof(acct_t)); - ac.ac_version = ACCT_VERSION; + ac.ac_version = ACCT_VERSION | ACCT_BYTEORDER; strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm)); elapsed = jiffies_64_to_AHZ(get_jiffies_64() - current->start_time); @@ -441,8 +441,7 @@ static void do_acct_process(long exitcode, struct file *file) old_encode_dev(tty_devnum(current->signal->tty)) : 0; read_unlock(&tasklist_lock); - /* ABYTESEX is always set to allow byte order detection */ - ac.ac_flag = ABYTESEX; + ac.ac_flag = 0; if (current->flags & PF_FORKNOEXEC) ac.ac_flag |= AFORK; if (current->flags & PF_SUPERPRIV) diff --git a/kernel/module.c b/kernel/module.c index 858b34f4c33b..dfe295ecf2f1 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -51,9 +51,6 @@ /* If this is set, the section belongs in the init part of the module */ #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) -#define symbol_is(literal, string) \ - (strcmp(MODULE_SYMBOL_PREFIX literal, (string)) == 0) - /* Protects module list */ static spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED; diff --git a/kernel/sched.c b/kernel/sched.c index c279ba227145..3e8897919924 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1095,7 +1095,7 @@ unsigned long nr_uninterruptible(void) { unsigned long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += cpu_rq(i)->nr_uninterruptible; return sum; @@ -1105,7 +1105,7 @@ unsigned long long nr_context_switches(void) { unsigned long long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += cpu_rq(i)->nr_switches; return sum; @@ -1115,7 +1115,7 @@ unsigned long nr_iowait(void) { unsigned long i, sum = 0; - for_each_online_cpu(i) + for_each_cpu(i) sum += atomic_read(&cpu_rq(i)->nr_iowait); return sum; diff --git a/kernel/timer.c b/kernel/timer.c index 56b315bc53cf..4850abbeacdc 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -792,12 +792,12 @@ static inline void do_process_times(struct task_struct *p, psecs = (p->utime += user); psecs += (p->stime += system); - if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_cur) { + if (psecs / HZ >= p->rlim[RLIMIT_CPU].rlim_cur) { /* Send SIGXCPU every second.. */ if (!(psecs % HZ)) send_sig(SIGXCPU, p, 1); /* and SIGKILL when we go over max.. */ - if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_max) + if (psecs / HZ >= p->rlim[RLIMIT_CPU].rlim_max) send_sig(SIGKILL, p, 1); } } diff --git a/mm/oom_kill.c b/mm/oom_kill.c index a902e51315a7..9bcd259f0bc4 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -220,7 +220,7 @@ retry: /** * out_of_memory - is the system out of memory? */ -void out_of_memory(void) +void out_of_memory(int gfp_mask) { /* * oom_lock protects out_of_memory()'s static variables. @@ -271,6 +271,9 @@ void out_of_memory(void) */ lastkill = now; + printk("oom-killer: gfp_mask=0x%x\n", gfp_mask); + show_free_areas(); + /* oom_kill() sleeps */ spin_unlock(&oom_lock); oom_kill(); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ea75a79010fb..60522982ad3f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1370,7 +1370,7 @@ static void __init calculate_zone_totalpages(struct pglist_data *pgdat, for (i = 0; i < MAX_NR_ZONES; i++) realtotalpages -= zholes_size[i]; pgdat->node_present_pages = realtotalpages; - printk("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); + printk(KERN_DEBUG "On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); } @@ -1476,7 +1476,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat, pcp->batch = 1 * batch; INIT_LIST_HEAD(&pcp->list); } - printk(" %s zone: %lu pages, LIFO batch:%lu\n", + printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", zone_names[j], realsize, batch); INIT_LIST_HEAD(&zone->active_list); INIT_LIST_HEAD(&zone->inactive_list); diff --git a/mm/swap.c b/mm/swap.c index 75e93e20119d..7771d2803f62 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -7,7 +7,7 @@ /* * This file contains the default values for the opereation of the * Linux VM subsystem. Fine-tuning documentation can be found in - * linux/Documentation/sysctl/vm.txt. + * Documentation/sysctl/vm.txt. * Started 18.12.91 * Swap aging added 23.2.95, Stephen Tweedie. * Buffermem limits added 12.3.98, Rik van Riel. diff --git a/mm/vmscan.c b/mm/vmscan.c index 9aedd8e48c88..8e3b69342a8d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -949,7 +949,7 @@ int try_to_free_pages(struct zone **zones, blk_congestion_wait(WRITE, HZ/10); } if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) - out_of_memory(); + out_of_memory(gfp_mask); out: for (i = 0; zones[i] != 0; i++) zones[i]->prev_priority = zones[i]->temp_priority; diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 373c05d78d0f..940699997793 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -75,7 +75,7 @@ static __inline__ void fdb_delete(struct net_bridge_fdb_entry *f) { hlist_del_rcu(&f->hlist); if (!f->is_static) - list_del(&f->age_list); + list_del(&f->u.age_list); br_fdb_put(f); } @@ -130,9 +130,11 @@ void br_fdb_cleanup(unsigned long _data) delay = hold_time(br); list_for_each_safe(l, n, &br->age_list) { - struct net_bridge_fdb_entry *f - = list_entry(l, struct net_bridge_fdb_entry, age_list); - unsigned long expires = f->ageing_timer + delay; + struct net_bridge_fdb_entry *f; + unsigned long expires; + + f = list_entry(l, struct net_bridge_fdb_entry, u.age_list); + expires = f->ageing_timer + delay; if (time_before_eq(expires, jiffies)) { WARN_ON(f->is_static); @@ -220,7 +222,7 @@ struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, static void fdb_rcu_free(struct rcu_head *head) { struct net_bridge_fdb_entry *ent - = container_of(head, struct net_bridge_fdb_entry, rcu); + = container_of(head, struct net_bridge_fdb_entry, u.rcu); kmem_cache_free(br_fdb_cache, ent); } @@ -228,7 +230,7 @@ static void fdb_rcu_free(struct rcu_head *head) void br_fdb_put(struct net_bridge_fdb_entry *ent) { if (atomic_dec_and_test(&ent->use_count)) - call_rcu(&ent->rcu, fdb_rcu_free); + call_rcu(&ent->u.rcu, fdb_rcu_free); } /* @@ -314,7 +316,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, return 0; /* move to end of age list */ - list_del(&fdb->age_list); + list_del(&fdb->u.age_list); goto update; } } @@ -338,7 +340,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, fdb->is_static = is_local; fdb->ageing_timer = jiffies; if (!is_local) - list_add_tail(&fdb->age_list, &br->age_list); + list_add_tail(&fdb->u.age_list, &br->age_list); return 0; } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 6cd11410711c..d2b2fb27ffc5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -49,7 +49,7 @@ struct net_bridge_fdb_entry union { struct list_head age_list; struct rcu_head rcu; - }; + } u; atomic_t use_count; unsigned long ageing_timer; mac_addr addr; diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 2c4485939757..9784f0376980 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c @@ -1,6 +1,5 @@ #include <linux/config.h> #include <linux/module.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/ah.h> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 5dd38d2d4837..07a594b831d2 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -1,6 +1,5 @@ #include <linux/config.h> #include <linux/module.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/esp.h> diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 5604b253bc3e..7ce7469a3c04 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c @@ -18,7 +18,6 @@ #include <asm/scatterlist.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/icmp.h> diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index 23854e0ec26f..539ad18f8131 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c @@ -862,6 +862,77 @@ static unsigned char snmp_request_decode(struct asn1_ctx *ctx, return 1; } +/* + * Fast checksum update for possibly oddly-aligned UDP byte, from the + * code example in the draft. + */ +static void fast_csum(unsigned char *csum, + const unsigned char *optr, + const unsigned char *nptr, + int odd) +{ + long x, old, new; + + x = csum[0] * 256 + csum[1]; + + x =~ x & 0xFFFF; + + if (odd) old = optr[0] * 256; + else old = optr[0]; + + x -= old & 0xFFFF; + if (x <= 0) { + x--; + x &= 0xFFFF; + } + + if (odd) new = nptr[0] * 256; + else new = nptr[0]; + + x += new & 0xFFFF; + if (x & 0x10000) { + x++; + x &= 0xFFFF; + } + + x =~ x & 0xFFFF; + csum[0] = x / 256; + csum[1] = x & 0xFF; +} + +/* + * Mangle IP address. + * - begin points to the start of the snmp messgae + * - addr points to the start of the address + */ +static inline void mangle_address(unsigned char *begin, + unsigned char *addr, + const struct oct1_map *map, + u_int16_t *check) +{ + if (map->from == NOCT1(*addr)) { + u_int32_t old; + + if (debug) + memcpy(&old, (unsigned char *)addr, sizeof(old)); + + *addr = map->to; + + /* Update UDP checksum if being used */ + if (*check) { + unsigned char odd = !((addr - begin) % 2); + + fast_csum((unsigned char *)check, + &map->from, &map->to, odd); + + } + + if (debug) + printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to " + "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr)); + } +} + static unsigned char snmp_trap_decode(struct asn1_ctx *ctx, struct snmp_v1_trap *trap, const struct oct1_map *map, @@ -952,77 +1023,6 @@ static void hex_dump(unsigned char *buf, size_t len) printk("\n"); } -/* - * Fast checksum update for possibly oddly-aligned UDP byte, from the - * code example in the draft. - */ -static void fast_csum(unsigned char *csum, - const unsigned char *optr, - const unsigned char *nptr, - int odd) -{ - long x, old, new; - - x = csum[0] * 256 + csum[1]; - - x =~ x & 0xFFFF; - - if (odd) old = optr[0] * 256; - else old = optr[0]; - - x -= old & 0xFFFF; - if (x <= 0) { - x--; - x &= 0xFFFF; - } - - if (odd) new = nptr[0] * 256; - else new = nptr[0]; - - x += new & 0xFFFF; - if (x & 0x10000) { - x++; - x &= 0xFFFF; - } - - x =~ x & 0xFFFF; - csum[0] = x / 256; - csum[1] = x & 0xFF; -} - -/* - * Mangle IP address. - * - begin points to the start of the snmp messgae - * - addr points to the start of the address - */ -static inline void mangle_address(unsigned char *begin, - unsigned char *addr, - const struct oct1_map *map, - u_int16_t *check) -{ - if (map->from == NOCT1(*addr)) { - u_int32_t old; - - if (debug) - memcpy(&old, (unsigned char *)addr, sizeof(old)); - - *addr = map->to; - - /* Update UDP checksum if being used */ - if (*check) { - unsigned char odd = !((addr - begin) % 2); - - fast_csum((unsigned char *)check, - &map->from, &map->to, odd); - - } - - if (debug) - printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to " - "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr)); - } -} - /* * Parse and mangle SNMP message according to mapping. * (And this is the fucking 'basic' method). diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3e7b5b7dbd67..5e7f70f1c940 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -330,6 +330,15 @@ static void tcp_init_buffer_space(struct sock *sk) tp->snd_cwnd_stamp = tcp_time_stamp; } +static void init_bictcp(struct tcp_opt *tp) +{ + tp->bictcp.cnt = 0; + + tp->bictcp.last_max_cwnd = 0; + tp->bictcp.last_cwnd = 0; + tp->bictcp.last_stamp = 0; +} + /* 5. Recalculate window clamp after socket hit its memory bounds. */ static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp) { @@ -1233,6 +1242,8 @@ static void tcp_enter_frto_loss(struct sock *sk) tcp_set_ca_state(tp, TCP_CA_Loss); tp->high_seq = tp->frto_highmark; TCP_ECN_queue_cwr(tp); + + init_bictcp(tp); } void tcp_clear_retrans(struct tcp_opt *tp) @@ -2011,10 +2022,12 @@ static inline __u32 bictcp_cwnd(struct tcp_opt *tp) if (!sysctl_tcp_bic) return tp->snd_cwnd; - if (tp->bictcp.last_cwnd == tp->snd_cwnd) - return tp->bictcp.cnt; /* same cwnd, no update */ - + if (tp->bictcp.last_cwnd == tp->snd_cwnd && + (s32)(tcp_time_stamp - tp->bictcp.last_stamp) <= (HZ>>5)) + return tp->bictcp.cnt; + tp->bictcp.last_cwnd = tp->snd_cwnd; + tp->bictcp.last_stamp = tcp_time_stamp; /* start off normal */ if (tp->snd_cwnd <= sysctl_tcp_bic_low_window) @@ -4612,6 +4625,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, return 1; init_westwood(sk); + init_bictcp(tp); /* Now we have several options: In theory there is * nothing else in the frame. KA9Q has an option to @@ -4635,6 +4649,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, case TCP_SYN_SENT: init_westwood(sk); + init_bictcp(tp); queued = tcp_rcv_synsent_state_process(sk, skb, th, len); if (queued >= 0) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 68b52759f133..79c1884c2b8b 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -767,9 +767,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req, newtp->snd_cwnd = 2; newtp->snd_cwnd_cnt = 0; - newtp->bictcp.cnt = 0; - newtp->bictcp.last_max_cwnd = newtp->bictcp.last_cwnd = 0; - newtp->frto_counter = 0; newtp->frto_highmark = 0; diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index f65ec865a9a6..191cec718e95 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c @@ -13,6 +13,7 @@ #include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> +#include <net/icmp.h> /* Add encapsulation header. * @@ -67,6 +68,30 @@ static void xfrm4_encap(struct sk_buff *skb) memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); } +static int xfrm4_tunnel_check_size(struct sk_buff *skb) +{ + int mtu, ret = 0; + struct dst_entry *dst; + struct iphdr *iph = skb->nh.iph; + + if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE) + goto out; + + IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; + + if (!(iph->frag_off & htons(IP_DF))) + goto out; + + dst = skb->dst; + mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len; + if (skb->len > mtu) { + icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); + ret = -EMSGSIZE; + } +out: + return ret; +} + int xfrm4_output(struct sk_buff **pskb) { struct sk_buff *skb = *pskb; diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c index 0999f9e956bb..0d1a0b0c7901 100644 --- a/net/ipv4/xfrm4_tunnel.c +++ b/net/ipv4/xfrm4_tunnel.c @@ -6,32 +6,7 @@ #include <linux/skbuff.h> #include <net/xfrm.h> #include <net/ip.h> -#include <net/icmp.h> -#include <net/inet_ecn.h> - -int xfrm4_tunnel_check_size(struct sk_buff *skb) -{ - int mtu, ret = 0; - struct dst_entry *dst; - struct iphdr *iph = skb->nh.iph; - - if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE) - goto out; - - IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; - - if (!(iph->frag_off & htons(IP_DF))) - goto out; - - dst = skb->dst; - mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len; - if (skb->len > mtu) { - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); - ret = -EMSGSIZE; - } -out: - return ret; -} +#include <net/protocol.h> static int ipip_output(struct sk_buff **pskb) { diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index f7674431ff1b..eda2737e572b 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c @@ -26,7 +26,6 @@ #include <linux/config.h> #include <linux/module.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/ah.h> #include <linux/crypto.h> diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 2403f8bd6f73..497727195c98 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -26,7 +26,6 @@ #include <linux/config.h> #include <linux/module.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/esp.h> diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index a531614f39c7..04303769d36b 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c @@ -32,7 +32,6 @@ */ #include <linux/config.h> #include <linux/module.h> -#include <net/inet_ecn.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/ipcomp.h> diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 028c9dd96beb..712856f0f356 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c @@ -11,6 +11,7 @@ #include <linux/skbuff.h> #include <linux/spinlock.h> +#include <linux/icmpv6.h> #include <net/inet_ecn.h> #include <net/ipv6.h> #include <net/xfrm.h> @@ -68,6 +69,23 @@ static void xfrm6_encap(struct sk_buff *skb) ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); } +static int xfrm6_tunnel_check_size(struct sk_buff *skb) +{ + int mtu, ret = 0; + struct dst_entry *dst = skb->dst; + + mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr); + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + + if (skb->len > mtu) { + icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); + ret = -EMSGSIZE; + } + + return ret; +} + int xfrm6_output(struct sk_buff **pskb) { struct sk_buff *skb = *pskb; diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index d35c87ff83dd..5766a133411a 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -27,8 +27,8 @@ #include <linux/list.h> #include <net/ip.h> #include <net/xfrm.h> -#include <net/icmp.h> #include <net/ipv6.h> +#include <net/protocol.h> #include <linux/ipv6.h> #include <linux/icmpv6.h> @@ -343,25 +343,6 @@ void xfrm6_tunnel_free_spi(xfrm_address_t *saddr) EXPORT_SYMBOL(xfrm6_tunnel_free_spi); -int xfrm6_tunnel_check_size(struct sk_buff *skb) -{ - int mtu, ret = 0; - struct dst_entry *dst = skb->dst; - - mtu = dst_pmtu(dst) - sizeof(struct ipv6hdr); - if (mtu < IPV6_MIN_MTU) - mtu = IPV6_MIN_MTU; - - if (skb->len > mtu) { - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); - ret = -EMSGSIZE; - } - - return ret; -} - -EXPORT_SYMBOL(xfrm6_tunnel_check_size); - static int xfrm6_tunnel_output(struct sk_buff **pskb) { struct sk_buff *skb = *pskb; diff --git a/net/sched/Kconfig b/net/sched/Kconfig index 08b8ebddefd3..97a42d9eda9e 100644 --- a/net/sched/Kconfig +++ b/net/sched/Kconfig @@ -37,7 +37,7 @@ config NET_SCH_CLK_GETTIMEOFDAY config NET_SCH_CLK_CPU bool "CPU cycle counter" - depends on X86_TSC || X86_64 || SPARC64 || PPC64 || IA64 + depends on X86_TSC || X86_64 || ALPHA || SPARC64 || PPC64 || IA64 help Say Y here if you want to use the CPU's cycle counter as clock source. This is a cheap and high resolution clock source, but on some @@ -47,6 +47,7 @@ config NET_SCH_CLK_CPU The useable cycle counters are: x86/x86_64 - Timestamp Counter + alpha - Cycle Counter sparc64 - %ticks register ppc64 - Time base ia64 - Interval Time Counter @@ -212,7 +213,9 @@ config NET_SCH_NETEM testing applications or protocols. To compile this driver as a module, choose M here: the module - will be called sch_delay. + will be called sch_netem. + + If unsure, say N. config NET_SCH_INGRESS tristate "Ingress Qdisc" diff --git a/net/xfrm/xfrm_export.c b/net/xfrm/xfrm_export.c index e77179ccf742..f72754953d29 100644 --- a/net/xfrm/xfrm_export.c +++ b/net/xfrm/xfrm_export.c @@ -35,7 +35,6 @@ EXPORT_SYMBOL(xfrm_parse_spi); EXPORT_SYMBOL(xfrm4_rcv); EXPORT_SYMBOL(xfrm4_tunnel_register); EXPORT_SYMBOL(xfrm4_tunnel_deregister); -EXPORT_SYMBOL(xfrm4_tunnel_check_size); EXPORT_SYMBOL(xfrm_register_type); EXPORT_SYMBOL(xfrm_unregister_type); EXPORT_SYMBOL(xfrm_get_type); diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c index a234e9f3b56c..9544b3c1fb06 100644 --- a/scripts/lxdialog/menubox.c +++ b/scripts/lxdialog/menubox.c @@ -71,7 +71,7 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey strncpy(menu_item, item, menu_width); menu_item[menu_width] = 0; - j = first_alpha(menu_item, "YyNnMm"); + j = first_alpha(menu_item, "YyNnMmHh"); /* Clear 'residue' of last item */ wattrset (win, menubox_attr); @@ -279,17 +279,17 @@ dialog_menu (const char *title, const char *prompt, int height, int width, if (key < 256 && isalpha(key)) key = tolower(key); - if (strchr("ynm", key)) + if (strchr("ynmh", key)) i = max_choice; else { for (i = choice+1; i < max_choice; i++) { - j = first_alpha(items[(scroll+i)*2+1], "YyNnMm"); + j = first_alpha(items[(scroll+i)*2+1], "YyNnMmHh"); if (key == tolower(items[(scroll+i)*2+1][j])) break; } if (i == max_choice) for (i = 0; i < max_choice; i++) { - j = first_alpha(items[(scroll+i)*2+1], "YyNnMm"); + j = first_alpha(items[(scroll+i)*2+1], "YyNnMmHh"); if (key == tolower(items[(scroll+i)*2+1][j])) break; } diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c index 2c83d03c1dcd..40f3f2e2ed91 100644 --- a/sound/oss/via82cxxx_audio.c +++ b/sound/oss/via82cxxx_audio.c @@ -10,7 +10,7 @@ * NO WARRANTY * * For a list of known bugs (errata) and documentation, - * see via-audio.pdf in linux/Documentation/DocBook. + * see via-audio.pdf in Documentation/DocBook. * If this documentation does not exist, run "make pdfdocs". */ diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index e438ba506e78..ce519a9a9d2c 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c @@ -1,6 +1,6 @@ /* * Sound driver for Silicon Graphics 320 and 540 Visual Workstations' - * onboard audio. See notes in ../../Documentation/sound/oss/vwsnd . + * onboard audio. See notes in Documentation/sound/oss/vwsnd . * * Copyright 1999 Silicon Graphics, Inc. All rights reserved. * |
