···169169When: January 2007170170Why: Is replaced by pci_register_driver(pci_driver).171171Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de>172172+173173+---------------------------174174+175175+What: I2C interface of the it87 driver176176+When: January 2007177177+Why: The ISA interface is faster and should be always available. The I2C178178+ probing is also known to cause trouble in at least one case (see179179+ bug #5889.)180180+Who: Jean Delvare <khali@linux-fr.org>
+105
Documentation/hwmon/f71805f
···11+Kernel driver f71805f22+=====================33+44+Supported chips:55+ * Fintek F71805F/FG66+ Prefix: 'f71805f'77+ Addresses scanned: none, address read from Super I/O config space88+ Datasheet: Provided by Fintek on request99+1010+Author: Jean Delvare <khali@linux-fr.org>1111+1212+Thanks to Denis Kieft from Barracuda Networks for the donation of a1313+test system (custom Jetway K8M8MS motherboard, with CPU and RAM) and1414+for providing initial documentation.1515+1616+Thanks to Kris Chen from Fintek for answering technical questions and1717+providing additional documentation.1818+1919+Thanks to Chris Lin from Jetway for providing wiring schematics and2020+anwsering technical questions.2121+2222+2323+Description2424+-----------2525+2626+The Fintek F71805F/FG Super I/O chip includes complete hardware monitoring2727+capabilities. It can monitor up to 9 voltages (counting its own power2828+source), 3 fans and 3 temperature sensors.2929+3030+This chip also has fan controlling features, using either DC or PWM, in3131+three different modes (one manual, two automatic). The driver doesn't3232+support these features yet.3333+3434+The driver assumes that no more than one chip is present, which seems3535+reasonable.3636+3737+3838+Voltage Monitoring3939+------------------4040+4141+Voltages are sampled by an 8-bit ADC with a LSB of 8 mV. The supported4242+range is thus from 0 to 2.040 V. Voltage values outside of this range4343+need external resistors. An exception is in0, which is used to monitor4444+the chip's own power source (+3.3V), and is divided internally by a4545+factor 2.4646+4747+The two LSB of the voltage limit registers are not used (always 0), so4848+you can only set the limits in steps of 32 mV (before scaling).4949+5050+The wirings and resistor values suggested by Fintek are as follow:5151+5252+ pin expected5353+ name use R1 R2 divider raw val.5454+5555+in0 VCC VCC3.3V int. int. 2.00 1.65 V5656+in1 VIN1 VTT1.2V 10K - 1.00 1.20 V5757+in2 VIN2 VRAM 100K 100K 2.00 ~1.25 V (1)5858+in3 VIN3 VCHIPSET 47K 100K 1.47 2.24 V (2)5959+in4 VIN4 VCC5V 200K 47K 5.25 0.95 V6060+in5 VIN5 +12V 200K 20K 11.00 1.05 V6161+in6 VIN6 VCC1.5V 10K - 1.00 1.50 V6262+in7 VIN7 VCORE 10K - 1.00 ~1.40 V (1)6363+in8 VIN8 VSB5V 200K 47K 1.00 0.95 V6464+6565+(1) Depends on your hardware setup.6666+(2) Obviously not correct, swapping R1 and R2 would make more sense.6767+6868+These values can be used as hints at best, as motherboard manufacturers6969+are free to use a completely different setup. As a matter of fact, the7070+Jetway K8M8MS uses a significantly different setup. You will have to7171+find out documentation about your own motherboard, and edit sensors.conf7272+accordingly.7373+7474+Each voltage measured has associated low and high limits, each of which7575+triggers an alarm when crossed.7676+7777+7878+Fan Monitoring7979+--------------8080+8181+Fan rotation speeds are reported as 12-bit values from a gated clock8282+signal. Speeds down to 366 RPM can be measured. There is no theoretical8383+high limit, but values over 6000 RPM seem to cause problem. The effective8484+resolution is much lower than you would expect, the step between different8585+register values being 10 rather than 1.8686+8787+The chip assumes 2 pulse-per-revolution fans.8888+8989+An alarm is triggered if the rotation speed drops below a programmable9090+limit or is too low to be measured.9191+9292+9393+Temperature Monitoring9494+----------------------9595+9696+Temperatures are reported in degrees Celsius. Each temperature measured9797+has a high limit, those crossing triggers an alarm. There is an associated9898+hysteresis value, below which the temperature has to drop before the9999+alarm is cleared.100100+101101+All temperature channels are external, there is no embedded temperature102102+sensor. Each channel can be used for connecting either a thermal diode103103+or a thermistor. The driver reports the currently selected mode, but104104+doesn't allow changing it. In theory, the BIOS should have configured105105+everything properly.
+1-1
Documentation/hwmon/it87
···99 http://www.ite.com.tw/1010 * IT8712F1111 Prefix: 'it8712'1212- Addresses scanned: I2C 0x28 - 0x2f1212+ Addresses scanned: I2C 0x2d1313 from Super I/O config space (8 I/O ports)1414 Datasheet: Publicly available at the ITE website1515 http://www.ite.com.tw/
+17-1
Documentation/hwmon/sysfs-interface
···179179****************180180181181temp[1-3]_type Sensor type selection.182182- Integers 1, 2, 3 or thermistor Beta value (3435)182182+ Integers 1 to 4 or thermistor Beta value (typically 3435)183183 Read/Write.184184 1: PII/Celeron Diode185185 2: 3904 transistor186186 3: thermal diode187187+ 4: thermistor (default/unknown Beta)187188 Not all types are supported by all chips188189189190temp[1-4]_max Temperature max value.···261260 alarm registers; there is no standard for the position262261 of individual bits.263262 Bits are defined in kernel/include/sensors.h.263263+264264+alarms_in Alarm bitmask relative to in (voltage) channels265265+ Read only266266+ A '1' bit means an alarm, LSB corresponds to in0 and so on267267+ Prefered to 'alarms' for newer chips268268+269269+alarms_fan Alarm bitmask relative to fan channels270270+ Read only271271+ A '1' bit means an alarm, LSB corresponds to fan1 and so on272272+ Prefered to 'alarms' for newer chips273273+274274+alarms_temp Alarm bitmask relative to temp (temperature) channels275275+ Read only276276+ A '1' bit means an alarm, LSB corresponds to temp1 and so on277277+ Prefered to 'alarms' for newer chips264278265279beep_enable Beep/interrupt enable266280 0 to disable.
···77 Any combination of these host bridges:88 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 74699 and these south bridges:1010- 961, 962, 963(L) 1010+ 961, 962, 963(L)11111212Author: Mark M. Hoffman <mhoffman@lightlink.com>1313···29293030or perhaps this...31313232-00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 3232+00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645333300:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961343400:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 00163535
+8
Documentation/powerpc/booting-without-of.txt
···880880 - device_type : Should be "soc"881881 - ranges : Should be defined as specified in 1) to describe the882882 translation of SOC addresses for memory mapped SOC registers.883883+ - bus-frequency: Contains the bus frequency for the SOC node.884884+ Typically, the value of this field is filled in by the boot885885+ loader. 886886+883887884888 Recommended properties:885889···923919 device_type = "soc";924920 ranges = <00000000 e0000000 00100000>925921 reg = <e0000000 00003000>;922922+ bus-frequency = <0>;926923 }927924928925···1175117011761171 mdio@24520 {11771172 reg = <24520 20>;11731173+ device_type = "mdio"; 11741174+ compatible = "gianfar";1178117511791176 ethernet-phy@0 {11801177 ......···13241317 device_type = "soc";13251318 ranges = <00000000 e0000000 00100000>13261319 reg = <e0000000 00003000>;13201320+ bus-frequency = <0>;1327132113281322 mdio@24520 {13291323 reg = <24520 20>;
+17-6
Documentation/spi/butterfly
···1212directly to the Butterfly. Or (if you have the parts and skills) you1313can come up with something fancier, providing ciruit protection to the1414Butterfly and the printer port, or with a better power supply than two1515-signal pins from the printer port.1515+signal pins from the printer port. Or for that matter, you can use1616+similar cables to talk to many AVR boards, even a breadboard.1717+1818+This is more powerful than "ISP programming" cables since it lets kernel1919+SPI protocol drivers interact with the AVR, and could even let the AVR2020+issue interrupts to them. Later, your protocol driver should work2121+easily with a "real SPI controller", instead of this bitbanger.162217231824The first cable connections will hook Linux up to one SPI bus, with the1925AVR and a DataFlash chip; and to the AVR reset line. This is all you2026need to reflash the firmware, and the pins are the standard Atmel "ISP"2121-connector pins (used also on non-Butterfly AVR boards).2727+connector pins (used also on non-Butterfly AVR boards). On the parport2828+side this is like "sp12" programming cables.22292330 Signal Butterfly Parport (DB-25)2431 ------ --------- ---------------···4740 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT4841 GND = J400.GND = pin 24/GND49425050-The "USI" controller, using J405, can be used for a second SPI bus. That5151-would let you talk to the AVR over SPI, running firmware that makes it act5252-as an SPI slave, while letting either Linux or the AVR use the DataFlash.5353-There are plenty of spare parport pins to wire this one up, such as:4343+Or you could flash firmware making the AVR into an SPI slave (keeping the4444+DataFlash in reset) and tweak the spi_butterfly driver to make it bind to4545+the driver for your custom SPI-based protocol.4646+4747+The "USI" controller, using J405, can also be used for a second SPI bus.4848+That would let you talk to the AVR using custom SPI-with-USI firmware,4949+while letting either Linux or the AVR use the DataFlash. There are plenty5050+of spare parport pins to wire this one up, such as:54515552 Signal Butterfly Parport (DB-25)5653 ------ --------- ---------------
+295
Documentation/unshare.txt
···11+22+unshare system call:33+--------------------44+This document describes the new system call, unshare. The document55+provides an overview of the feature, why it is needed, how it can66+be used, its interface specification, design, implementation and77+how it can be tested.88+99+Change Log:1010+-----------1111+version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 20061212+1313+Contents:1414+---------1515+ 1) Overview1616+ 2) Benefits1717+ 3) Cost1818+ 4) Requirements1919+ 5) Functional Specification2020+ 6) High Level Design2121+ 7) Low Level Design2222+ 8) Test Specification2323+ 9) Future Work2424+2525+1) Overview2626+-----------2727+Most legacy operating system kernels support an abstraction of threads2828+as multiple execution contexts within a process. These kernels provide2929+special resources and mechanisms to maintain these "threads". The Linux3030+kernel, in a clever and simple manner, does not make distinction3131+between processes and "threads". The kernel allows processes to share3232+resources and thus they can achieve legacy "threads" behavior without3333+requiring additional data structures and mechanisms in the kernel. The3434+power of implementing threads in this manner comes not only from3535+its simplicity but also from allowing application programmers to work3636+outside the confinement of all-or-nothing shared resources of legacy3737+threads. On Linux, at the time of thread creation using the clone system3838+call, applications can selectively choose which resources to share3939+between threads.4040+4141+unshare system call adds a primitive to the Linux thread model that4242+allows threads to selectively 'unshare' any resources that were being4343+shared at the time of their creation. unshare was conceptualized by4444+Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part4545+of the discussion on POSIX threads on Linux. unshare augments the4646+usefulness of Linux threads for applications that would like to control4747+shared resources without creating a new process. unshare is a natural4848+addition to the set of available primitives on Linux that implement4949+the concept of process/thread as a virtual machine.5050+5151+2) Benefits5252+-----------5353+unshare would be useful to large application frameworks such as PAM5454+where creating a new process to control sharing/unsharing of process5555+resources is not possible. Since namespaces are shared by default5656+when creating a new process using fork or clone, unshare can benefit5757+even non-threaded applications if they have a need to disassociate5858+from default shared namespace. The following lists two use-cases5959+where unshare can be used.6060+6161+2.1 Per-security context namespaces6262+-----------------------------------6363+unshare can be used to implement polyinstantiated directories using6464+the kernel's per-process namespace mechanism. Polyinstantiated directories,6565+such as per-user and/or per-security context instance of /tmp, /var/tmp or6666+per-security context instance of a user's home directory, isolate user6767+processes when working with these directories. Using unshare, a PAM6868+module can easily setup a private namespace for a user at login.6969+Polyinstantiated directories are required for Common Criteria certification7070+with Labeled System Protection Profile, however, with the availability7171+of shared-tree feature in the Linux kernel, even regular Linux systems7272+can benefit from setting up private namespaces at login and7373+polyinstantiating /tmp, /var/tmp and other directories deemed7474+appropriate by system administrators.7575+7676+2.2 unsharing of virtual memory and/or open files7777+-------------------------------------------------7878+Consider a client/server application where the server is processing7979+client requests by creating processes that share resources such as8080+virtual memory and open files. Without unshare, the server has to8181+decide what needs to be shared at the time of creating the process8282+which services the request. unshare allows the server an ability to8383+disassociate parts of the context during the servicing of the8484+request. For large and complex middleware application frameworks, this8585+ability to unshare after the process was created can be very8686+useful.8787+8888+3) Cost8989+-------9090+In order to not duplicate code and to handle the fact that unshare9191+works on an active task (as opposed to clone/fork working on a newly9292+allocated inactive task) unshare had to make minor reorganizational9393+changes to copy_* functions utilized by clone/fork system call.9494+There is a cost associated with altering existing, well tested and9595+stable code to implement a new feature that may not get exercised9696+extensively in the beginning. However, with proper design and code9797+review of the changes and creation of an unshare test for the LTP9898+the benefits of this new feature can exceed its cost.9999+100100+4) Requirements101101+---------------102102+unshare reverses sharing that was done using clone(2) system call,103103+so unshare should have a similar interface as clone(2). That is,104104+since flags in clone(int flags, void *stack) specifies what should105105+be shared, similar flags in unshare(int flags) should specify106106+what should be unshared. Unfortunately, this may appear to invert107107+the meaning of the flags from the way they are used in clone(2).108108+However, there was no easy solution that was less confusing and that109109+allowed incremental context unsharing in future without an ABI change.110110+111111+unshare interface should accommodate possible future addition of112112+new context flags without requiring a rebuild of old applications.113113+If and when new context flags are added, unshare design should allow114114+incremental unsharing of those resources on an as needed basis.115115+116116+5) Functional Specification117117+---------------------------118118+NAME119119+ unshare - disassociate parts of the process execution context120120+121121+SYNOPSIS122122+ #include <sched.h>123123+124124+ int unshare(int flags);125125+126126+DESCRIPTION127127+ unshare allows a process to disassociate parts of its execution128128+ context that are currently being shared with other processes. Part129129+ of execution context, such as the namespace, is shared by default130130+ when a new process is created using fork(2), while other parts,131131+ such as the virtual memory, open file descriptors, etc, may be132132+ shared by explicit request to share them when creating a process133133+ using clone(2).134134+135135+ The main use of unshare is to allow a process to control its136136+ shared execution context without creating a new process.137137+138138+ The flags argument specifies one or bitwise-or'ed of several of139139+ the following constants.140140+141141+ CLONE_FS142142+ If CLONE_FS is set, file system information of the caller143143+ is disassociated from the shared file system information.144144+145145+ CLONE_FILES146146+ If CLONE_FILES is set, the file descriptor table of the147147+ caller is disassociated from the shared file descriptor148148+ table.149149+150150+ CLONE_NEWNS151151+ If CLONE_NEWNS is set, the namespace of the caller is152152+ disassociated from the shared namespace.153153+154154+ CLONE_VM155155+ If CLONE_VM is set, the virtual memory of the caller is156156+ disassociated from the shared virtual memory.157157+158158+RETURN VALUE159159+ On success, zero returned. On failure, -1 is returned and errno is160160+161161+ERRORS162162+ EPERM CLONE_NEWNS was specified by a non-root process (process163163+ without CAP_SYS_ADMIN).164164+165165+ ENOMEM Cannot allocate sufficient memory to copy parts of caller's166166+ context that need to be unshared.167167+168168+ EINVAL Invalid flag was specified as an argument.169169+170170+CONFORMING TO171171+ The unshare() call is Linux-specific and should not be used172172+ in programs intended to be portable.173173+174174+SEE ALSO175175+ clone(2), fork(2)176176+177177+6) High Level Design178178+--------------------179179+Depending on the flags argument, the unshare system call allocates180180+appropriate process context structures, populates it with values from181181+the current shared version, associates newly duplicated structures182182+with the current task structure and releases corresponding shared183183+versions. Helper functions of clone (copy_*) could not be used184184+directly by unshare because of the following two reasons.185185+ 1) clone operates on a newly allocated not-yet-active task186186+ structure, where as unshare operates on the current active187187+ task. Therefore unshare has to take appropriate task_lock()188188+ before associating newly duplicated context structures189189+ 2) unshare has to allocate and duplicate all context structures190190+ that are being unshared, before associating them with the191191+ current task and releasing older shared structures. Failure192192+ do so will create race conditions and/or oops when trying193193+ to backout due to an error. Consider the case of unsharing194194+ both virtual memory and namespace. After successfully unsharing195195+ vm, if the system call encounters an error while allocating196196+ new namespace structure, the error return code will have to197197+ reverse the unsharing of vm. As part of the reversal the198198+ system call will have to go back to older, shared, vm199199+ structure, which may not exist anymore.200200+201201+Therefore code from copy_* functions that allocated and duplicated202202+current context structure was moved into new dup_* functions. Now,203203+copy_* functions call dup_* functions to allocate and duplicate204204+appropriate context structures and then associate them with the205205+task structure that is being constructed. unshare system call on206206+the other hand performs the following:207207+ 1) Check flags to force missing, but implied, flags208208+ 2) For each context structure, call the corresponding unshare209209+ helper function to allocate and duplicate a new context210210+ structure, if the appropriate bit is set in the flags argument.211211+ 3) If there is no error in allocation and duplication and there212212+ are new context structures then lock the current task structure,213213+ associate new context structures with the current task structure,214214+ and release the lock on the current task structure.215215+ 4) Appropriately release older, shared, context structures.216216+217217+7) Low Level Design218218+-------------------219219+Implementation of unshare can be grouped in the following 4 different220220+items:221221+ a) Reorganization of existing copy_* functions222222+ b) unshare system call service function223223+ c) unshare helper functions for each different process context224224+ d) Registration of system call number for different architectures225225+226226+ 7.1) Reorganization of copy_* functions227227+ Each copy function such as copy_mm, copy_namespace, copy_files,228228+ etc, had roughly two components. The first component allocated229229+ and duplicated the appropriate structure and the second component230230+ linked it to the task structure passed in as an argument to the copy231231+ function. The first component was split into its own function.232232+ These dup_* functions allocated and duplicated the appropriate233233+ context structure. The reorganized copy_* functions invoked234234+ their corresponding dup_* functions and then linked the newly235235+ duplicated structures to the task structure with which the236236+ copy function was called.237237+238238+ 7.2) unshare system call service function239239+ * Check flags240240+ Force implied flags. If CLONE_THREAD is set force CLONE_VM.241241+ If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is242242+ set and signals are also being shared, force CLONE_THREAD. If243243+ CLONE_NEWNS is set, force CLONE_FS.244244+ * For each context flag, invoke the corresponding unshare_*245245+ helper routine with flags passed into the system call and a246246+ reference to pointer pointing the new unshared structure247247+ * If any new structures are created by unshare_* helper248248+ functions, take the task_lock() on the current task,249249+ modify appropriate context pointers, and release the250250+ task lock.251251+ * For all newly unshared structures, release the corresponding252252+ older, shared, structures.253253+254254+ 7.3) unshare_* helper functions255255+ For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND,256256+ and CLONE_THREAD, return -EINVAL since they are not implemented yet.257257+ For others, check the flag value to see if the unsharing is258258+ required for that structure. If it is, invoke the corresponding259259+ dup_* function to allocate and duplicate the structure and return260260+ a pointer to it.261261+262262+ 7.4) Appropriately modify architecture specific code to register the263263+ the new system call.264264+265265+8) Test Specification266266+---------------------267267+The test for unshare should test the following:268268+ 1) Valid flags: Test to check that clone flags for signal and269269+ signal handlers, for which unsharing is not implemented270270+ yet, return -EINVAL.271271+ 2) Missing/implied flags: Test to make sure that if unsharing272272+ namespace without specifying unsharing of filesystem, correctly273273+ unshares both namespace and filesystem information.274274+ 3) For each of the four (namespace, filesystem, files and vm)275275+ supported unsharing, verify that the system call correctly276276+ unshares the appropriate structure. Verify that unsharing277277+ them individually as well as in combination with each278278+ other works as expected.279279+ 4) Concurrent execution: Use shared memory segments and futex on280280+ an address in the shm segment to synchronize execution of281281+ about 10 threads. Have a couple of threads execute execve,282282+ a couple _exit and the rest unshare with different combination283283+ of flags. Verify that unsharing is performed as expected and284284+ that there are no oops or hangs.285285+286286+9) Future Work287287+--------------288288+The current implementation of unshare does not allow unsharing of289289+signals and signal handlers. Signals are complex to begin with and290290+to unshare signals and/or signal handlers of a currently running291291+process is even more complex. If in the future there is a specific292292+need to allow unsharing of signals and/or signal handlers, it can293293+be incrementally added to unshare without affecting legacy294294+applications using unshare.295295+
+6
MAINTAINERS
···931931L: ext3-users@redhat.com932932S: Maintained933933934934+F71805F HARDWARE MONITORING DRIVER935935+P: Jean Delvare936936+M: khali@linux-fr.org937937+L: lm-sensors@lm-sensors.org938938+S: Maintained939939+934940FARSYNC SYNCHRONOUS DRIVER935941P: Kevin Curtis936942M: kevin.curtis@farsite.co.uk
+4-21
arch/alpha/kernel/smp.c
···73737474EXPORT_SYMBOL(cpu_online_map);75757676-/* cpus reported in the hwrpb */7777-static unsigned long hwrpb_cpu_present_mask __initdata = 0;7878-7976int smp_num_probed; /* Internal processor count */8077int smp_num_cpus = 1; /* Number that came online. */8178···439442 if ((cpu->flags & 0x1cc) == 0x1cc) {440443 smp_num_probed++;441444 /* Assume here that "whami" == index */442442- hwrpb_cpu_present_mask |= (1UL << i);445445+ cpu_set(i, cpu_possible_map);443446 cpu->pal_revision = boot_cpu_palrev;444447 }445448···450453 }451454 } else {452455 smp_num_probed = 1;453453- hwrpb_cpu_present_mask = (1UL << boot_cpuid);456456+ cpu_set(boot_cpuid, cpu_possible_map);454457 }455458 cpu_present_mask = cpumask_of_cpu(boot_cpuid);456459457460 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",458458- smp_num_probed, hwrpb_cpu_present_mask);461461+ smp_num_probed, cpu_possible_map.bits[0]);459462}460463461464/*···464467void __init465468smp_prepare_cpus(unsigned int max_cpus)466469{467467- int cpu_count, i;468468-469470 /* Take care of some initial bookkeeping. */470471 memset(ipi_data, 0, sizeof(ipi_data));471472···481486482487 printk(KERN_INFO "SMP starting up secondaries.\n");483488484484- cpu_count = 1;485485- for (i = 0; (i < NR_CPUS) && (cpu_count < max_cpus); i++) {486486- if (i == boot_cpuid)487487- continue;488488-489489- if (((hwrpb_cpu_present_mask >> i) & 1) == 0)490490- continue;491491-492492- cpu_set(i, cpu_possible_map);493493- cpu_count++;494494- }495495-496496- smp_num_cpus = cpu_count;489489+ smp_num_cpus = smp_num_probed;497490}498491499492void __devinit
+41-8
arch/arm/Kconfig
···1010 default y1111 help1212 The ARM series is a line of low-power-consumption RISC chip designs1313- licensed by ARM ltd and targeted at embedded applications and1313+ licensed by ARM Ltd and targeted at embedded applications and1414 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer1515- manufactured, but legacy ARM-based PC hardware remains popular in1515+ manufactured, but legacy ARM-based PC hardware remains popular in1616 Europe. There is an ARM Linux project with a web page at1717 <http://www.arm.linux.org.uk/>.1818···6969config FIQ7070 bool71717272+config ARCH_MTD_XIP7373+ bool7474+7275source "init/Kconfig"73767477menu "System Type"···8481 bool "Cirrus-CL-PS7500FE"8582 select TIMER_ACORN8683 select ISA8484+ help8585+ Support for the Cirrus Logic PS7500FE system-on-a-chip.87868887config ARCH_CLPS711X8988 bool "CLPS711x/EP721x-based"8989+ help9090+ Support for Cirrus Logic 711x/721x based boards.90919192config ARCH_CO2859293 bool "Co-EBSA285"9394 select FOOTBRIDGE9495 select FOOTBRIDGE_ADDIN9696+ help9797+ Support for Intel's EBSA285 companion chip.95989699config ARCH_EBSA11097100 bool "EBSA-110"98101 select ISA99102 help100103 This is an evaluation board for the StrongARM processor available101101- from Digital. It has limited hardware on-board, including an onboard104104+ from Digital. It has limited hardware on-board, including an102105 Ethernet interface, two PCMCIA sockets, two serial ports and a103106 parallel port.104107105108config ARCH_FOOTBRIDGE106109 bool "FootBridge"107110 select FOOTBRIDGE111111+ help112112+ Support for systems based on the DC21285 companion chip113113+ ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.108114109115config ARCH_INTEGRATOR110116 bool "Integrator"111117 select ARM_AMBA112118 select ICST525119119+ help120120+ Support for ARM's Integrator platform.113121114122config ARCH_IOP3XX115123 bool "IOP3xx-based"116124 select PCI125125+ help126126+ Support for Intel's IOP3XX (XScale) family of processors.117127118128config ARCH_IXP4XX119129 bool "IXP4xx-based"120130 select DMABOUNCE121131 select PCI132132+ help133133+ Support for Intel's IXP4XX (XScale) family of processors.122134123135config ARCH_IXP2000124136 bool "IXP2400/2800-based"125137 select PCI138138+ help139139+ Support for Intel's IXP2400/2800 (XScale) family of processors.126140127141config ARCH_L7200128142 bool "LinkUp-L7200"···156136157137config ARCH_PXA158138 bool "PXA2xx-based"139139+ select ARCH_MTD_XIP140140+ help141141+ Support for Intel's PXA2XX processor line.159142160143config ARCH_RPC161144 bool "RiscPC"···175152 bool "SA1100-based"176153 select ISA177154 select ARCH_DISCONTIGMEM_ENABLE155155+ select ARCH_MTD_XIP156156+ help157157+ Support for StrongARM 11x0 based boards.178158179159config ARCH_S3C2410180160 bool "Samsung S3C2410"181161 help182162 Samsung S3C2410X CPU based systems, such as the Simtec Electronics183163 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or184184- the Samsung SMDK2410 development board (and derviatives).164164+ the Samsung SMDK2410 development board (and derivatives).185165186166config ARCH_SHARK187167 bool "Shark"188168 select ISA189169 select ISA_DMA190170 select PCI171171+ help172172+ Support for the StrongARM based Digital DNARD machine, also known173173+ as "Shark" (<http://www.shark-linux.de/shark.html>).191174192175config ARCH_LH7A40X193176 bool "Sharp LH7A40X"···205176206177config ARCH_OMAP207178 bool "TI OMAP"179179+ help180180+ Support for TI's OMAP platform (OMAP1 and OMAP2).208181209182config ARCH_VERSATILE210183 bool "Versatile"···225194226195config ARCH_IMX227196 bool "IMX"197197+ help198198+ Support for Motorola's i.MX family of processors (MX1, MXL).228199229200config ARCH_H720X230201 bool "Hynix-HMS720x-based"···243210config ARCH_AT91RM9200244211 bool "AT91RM9200"245212 help246246- Say Y here if you intend to run this kernel on an AT91RM9200-based247247- board.213213+ Say Y here if you intend to run this kernel on an Atmel214214+ AT91RM9200-based board.248215249216endchoice250217···450417 To use this you need GCC version 4.0.0 or later.451418452419config OABI_COMPAT453453- bool "Allow old ABI binaries to run with this kernel"454454- depends on AEABI420420+ bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)"421421+ depends on AEABI && EXPERIMENTAL455422 default y456423 help457424 This option preserves the old syscall interface along with the
+1-1
arch/arm/configs/enp2611_defconfig
···171171#172172CONFIG_ZBOOT_ROM_TEXT=0x0173173CONFIG_ZBOOT_ROM_BSS=0x0174174-CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware"174174+CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"175175# CONFIG_XIP_KERNEL is not set176176177177#
+1-1
arch/arm/configs/ixdp2400_defconfig
···172172#173173CONFIG_ZBOOT_ROM_TEXT=0x0174174CONFIG_ZBOOT_ROM_BSS=0x0175175-CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware"175175+CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"176176# CONFIG_XIP_KERNEL is not set177177178178#
+1-1
arch/arm/configs/ixdp2401_defconfig
···172172#173173CONFIG_ZBOOT_ROM_TEXT=0x0174174CONFIG_ZBOOT_ROM_BSS=0x0175175-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware"175175+CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"176176# CONFIG_XIP_KERNEL is not set177177178178#
+1-1
arch/arm/configs/ixdp2801_defconfig
···172172#173173CONFIG_ZBOOT_ROM_TEXT=0x0174174CONFIG_ZBOOT_ROM_BSS=0x0175175-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware ixdp2x01_clock=50000000"175175+CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0"176176# CONFIG_XIP_KERNEL is not set177177178178#
+38-13
arch/arm/configs/s3c2410_defconfig
···11#22# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.15-rc144-# Sun Nov 13 17:41:24 200533+# Linux kernel version: 2.6.16-rc244+# Mon Feb 6 11:17:23 200655#66CONFIG_ARM=y77CONFIG_MMU=y88-CONFIG_UID16=y98CONFIG_RWSEM_GENERIC_SPINLOCK=y109CONFIG_GENERIC_CALIBRATE_DELAY=y1110···2728# CONFIG_BSD_PROCESS_ACCT is not set2829CONFIG_SYSCTL=y2930# CONFIG_AUDIT is not set3030-# CONFIG_HOTPLUG is not set3131-CONFIG_KOBJECT_UEVENT=y3231# CONFIG_IKCONFIG is not set3332CONFIG_INITRAMFS_SOURCE=""3333+CONFIG_UID16=y3434+CONFIG_CC_OPTIMIZE_FOR_SIZE=y3435# CONFIG_EMBEDDED is not set3536CONFIG_KALLSYMS=y3637# CONFIG_KALLSYMS_ALL is not set3738# CONFIG_KALLSYMS_EXTRA_PASS is not set3939+CONFIG_HOTPLUG=y3840CONFIG_PRINTK=y3941CONFIG_BUG=y4242+CONFIG_ELF_CORE=y4043CONFIG_BASE_FULL=y4144CONFIG_FUTEX=y4245CONFIG_EPOLL=y4343-CONFIG_CC_OPTIMIZE_FOR_SIZE=y4446CONFIG_SHMEM=y4547CONFIG_CC_ALIGN_FUNCTIONS=04648CONFIG_CC_ALIGN_LABELS=04749CONFIG_CC_ALIGN_LOOPS=04850CONFIG_CC_ALIGN_JUMPS=05151+CONFIG_SLAB=y4952# CONFIG_TINY_SHMEM is not set5053CONFIG_BASE_SMALL=05454+# CONFIG_SLOB is not set5555+CONFIG_OBSOLETE_INTERMODULE=y51565257#5358# Loadable module support···105102# CONFIG_ARCH_IMX is not set106103# CONFIG_ARCH_H720X is not set107104# CONFIG_ARCH_AAEC2000 is not set105105+# CONFIG_ARCH_AT91RM9200 is not set108106109107#110108# S3C24XX Implementations···164160# Bus support165161#166162CONFIG_ISA=y167167-CONFIG_ISA_DMA_API=y168163169164#170165# PCCARD (PCMCIA/CardBus) support···175172#176173# CONFIG_PREEMPT is not set177174# CONFIG_NO_IDLE_HZ is not set175175+# CONFIG_AEABI is not set178176# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set179177CONFIG_SELECT_MEMORY_MODEL=y180178CONFIG_FLATMEM_MANUAL=y···218214# Power management options219215#220216CONFIG_PM=y217217+CONFIG_PM_LEGACY=y218218+# CONFIG_PM_DEBUG is not set221219CONFIG_APM=y222220223221#···265259# SCTP Configuration (EXPERIMENTAL)266260#267261# CONFIG_IP_SCTP is not set262262+263263+#264264+# TIPC Configuration (EXPERIMENTAL)265265+#266266+# CONFIG_TIPC is not set268267# CONFIG_ATM is not set269268# CONFIG_BRIDGE is not set270269# CONFIG_VLAN_8021Q is not set···287276# QoS and/or fair queueing288277#289278# CONFIG_NET_SCHED is not set290290-# CONFIG_NET_CLS_ROUTE is not set291279292280#293281# Network testing···308298CONFIG_PREVENT_FIRMWARE_BUILD=y309299# CONFIG_FW_LOADER is not set310300# CONFIG_DEBUG_DRIVER is not set301301+302302+#303303+# Connector - unified userspace <-> kernelspace linker304304+#305305+# CONFIG_CONNECTOR is not set311306312307#313308# Memory Technology Devices (MTD)···427412#428413# Block devices429414#430430-# CONFIG_BLK_DEV_XD is not set431431-# CONFIG_PARIDE is not set432415# CONFIG_BLK_DEV_COW_COMMON is not set433416CONFIG_BLK_DEV_LOOP=y434417# CONFIG_BLK_DEV_CRYPTOLOOP is not set···515502CONFIG_NET_ETHERNET=y516503CONFIG_MII=y517504# CONFIG_NET_VENDOR_3COM is not set518518-# CONFIG_LANCE is not set519505# CONFIG_NET_VENDOR_SMC is not set520506# CONFIG_SMC91X is not set521507CONFIG_DM9000=y···619607# CONFIG_ROCKETPORT is not set620608# CONFIG_CYCLADES is not set621609# CONFIG_DIGIEPCA is not set622622-# CONFIG_ESPSERIAL is not set623610# CONFIG_MOXA_INTELLIO is not set624611# CONFIG_MOXA_SMARTIO is not set625612# CONFIG_ISI is not set626613# CONFIG_SYNCLINKMP is not set614614+# CONFIG_SYNCLINK_GT is not set627615# CONFIG_N_HDLC is not set628616# CONFIG_RISCOM8 is not set629617# CONFIG_SPECIALIX is not set···637625CONFIG_SERIAL_8250=y638626CONFIG_SERIAL_8250_CONSOLE=y639627CONFIG_SERIAL_8250_NR_UARTS=8628628+CONFIG_SERIAL_8250_RUNTIME_UARTS=4640629CONFIG_SERIAL_8250_EXTENDED=y641630CONFIG_SERIAL_8250_MANY_PORTS=y642631CONFIG_SERIAL_8250_SHARE_IRQ=y···700687#701688# TPM devices702689#690690+# CONFIG_TCG_TPM is not set703691# CONFIG_TELCLOCK is not set704692705693#···743729# CONFIG_I2C_DEBUG_ALGO is not set744730# CONFIG_I2C_DEBUG_BUS is not set745731# CONFIG_I2C_DEBUG_CHIP is not set732732+733733+#734734+# SPI support735735+#736736+# CONFIG_SPI is not set737737+# CONFIG_SPI_MASTER is not set746738747739#748740# Hardware Monitoring support···883863# CONFIG_JFS_FS is not set884864# CONFIG_FS_POSIX_ACL is not set885865# CONFIG_XFS_FS is not set866866+# CONFIG_OCFS2_FS is not set886867# CONFIG_MINIX_FS is not set887868CONFIG_ROMFS_FS=y888869CONFIG_INOTIFY=y···918897# CONFIG_HUGETLB_PAGE is not set919898CONFIG_RAMFS=y920899# CONFIG_RELAYFS_FS is not set900900+# CONFIG_CONFIGFS_FS is not set921901922902#923903# Miscellaneous filesystems···987965# CONFIG_SGI_PARTITION is not set988966# CONFIG_ULTRIX_PARTITION is not set989967# CONFIG_SUN_PARTITION is not set968968+# CONFIG_KARMA_PARTITION is not set990969# CONFIG_EFI_PARTITION is not set991970992971#···10431020# Kernel hacking10441021#10451022# CONFIG_PRINTK_TIME is not set10461046-CONFIG_DEBUG_KERNEL=y10471023CONFIG_MAGIC_SYSRQ=y10241024+CONFIG_DEBUG_KERNEL=y10481025CONFIG_LOG_BUF_SHIFT=1610491026CONFIG_DETECT_SOFTLOCKUP=y10501027# CONFIG_SCHEDSTATS is not set10511028# CONFIG_DEBUG_SLAB is not set10291029+CONFIG_DEBUG_MUTEXES=y10521030# CONFIG_DEBUG_SPINLOCK is not set10531031# CONFIG_DEBUG_SPINLOCK_SLEEP is not set10541032# CONFIG_DEBUG_KOBJECT is not set···10581034# CONFIG_DEBUG_FS is not set10591035# CONFIG_DEBUG_VM is not set10601036CONFIG_FRAME_POINTER=y10371037+CONFIG_FORCED_INLINING=y10611038# CONFIG_RCU_TORTURE_TEST is not set10621039CONFIG_DEBUG_USER=y10631040# CONFIG_DEBUG_WAITQ is not set
···333333 @ from the exception stack334334335335#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)336336+#ifndef CONFIG_MMU337337+#warning "NPTL on non MMU needs fixing"338338+#else336339 @ make sure our user space atomic helper is aborted337340 cmp r2, #TASK_SIZE338341 bichs r3, r3, #PSR_Z_BIT342342+#endif339343#endif340344341345 @···709705 * The C flag is also set if *ptr was changed to allow for assembly710706 * optimization in the calling code.711707 *712712- * Note: this routine already includes memory barriers as needed.708708+ * Notes:709709+ *710710+ * - This routine already includes memory barriers as needed.711711+ *712712+ * - A failure might be transient, i.e. it is possible, although unlikely,713713+ * that "failure" be returned even if *ptr == oldval.713714 *714715 * For example, a user space atomic_add implementation could look like this:715716 *···765756 * exception happening just after the str instruction which would766757 * clear the Z flag although the exchange was done.767758 */759759+#ifdef CONFIG_MMU768760 teq ip, ip @ set Z flag769761 ldr ip, [r2] @ load current val770762 add r3, r2, #1 @ prepare store ptr771763 teqeq ip, r0 @ compare with oldval if still allowed772764 streq r1, [r3, #-1]! @ store newval if still allowed773765 subs r0, r2, r3 @ if r2 == r3 the str occured766766+#else767767+#warning "NPTL on non MMU needs fixing"768768+ mov r0, #-1769769+ adds r0, r0, #0770770+#endif774771 mov pc, lr775772776773#else
+71
arch/arm/kernel/sys_oabi-compat.c
···5959 * struct sembuf loses its padding with EABI. Since arrays of them are6060 * used they have to be copyed to remove the padding. Compatibility wrappers6161 * provided below.6262+ *6363+ * sys_bind:6464+ * sys_connect:6565+ * sys_sendmsg:6666+ * sys_sendto:6767+ *6868+ * struct sockaddr_un loses its padding with EABI. Since the size of the6969+ * structure is used as a validation test in unix_mkname(), we need to7070+ * change the length argument to 110 whenever it is 112. Compatibility7171+ * wrappers provided below.6272 */63736474#include <linux/syscalls.h>···7767#include <linux/fcntl.h>7868#include <linux/eventpoll.h>7969#include <linux/sem.h>7070+#include <linux/socket.h>8071#include <asm/ipc.h>8172#include <asm/uaccess.h>8273···348337 return sys_ipc(call, first, second, third, ptr, fifth);349338 }350339}340340+341341+asmlinkage long sys_oabi_bind(int fd, struct sockaddr __user *addr, int addrlen)342342+{343343+ sa_family_t sa_family;344344+ if (addrlen == 112 &&345345+ get_user(sa_family, &addr->sa_family) == 0 &&346346+ sa_family == AF_UNIX)347347+ addrlen = 110;348348+ return sys_bind(fd, addr, addrlen);349349+}350350+351351+asmlinkage long sys_oabi_connect(int fd, struct sockaddr __user *addr, int addrlen)352352+{353353+ sa_family_t sa_family;354354+ if (addrlen == 112 &&355355+ get_user(sa_family, &addr->sa_family) == 0 &&356356+ sa_family == AF_UNIX)357357+ addrlen = 110;358358+ return sys_connect(fd, addr, addrlen);359359+}360360+361361+asmlinkage long sys_oabi_sendto(int fd, void __user *buff,362362+ size_t len, unsigned flags,363363+ struct sockaddr __user *addr,364364+ int addrlen)365365+{366366+ sa_family_t sa_family;367367+ if (addrlen == 112 &&368368+ get_user(sa_family, &addr->sa_family) == 0 &&369369+ sa_family == AF_UNIX)370370+ addrlen = 110;371371+ return sys_sendto(fd, buff, len, flags, addr, addrlen);372372+}373373+374374+asmlinkage long sys_oabi_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)375375+{376376+ struct sockaddr __user *addr;377377+ int msg_namelen;378378+ sa_family_t sa_family;379379+ if (msg &&380380+ get_user(msg_namelen, &msg->msg_namelen) == 0 &&381381+ msg_namelen == 112 &&382382+ get_user(addr, &msg->msg_name) == 0 &&383383+ get_user(sa_family, &addr->sa_family) == 0 &&384384+ sa_family == AF_UNIX)385385+ {386386+ /*387387+ * HACK ALERT: there is a limit to how much backward bending388388+ * we should do for what is actually a transitional389389+ * compatibility layer. This already has known flaws with390390+ * a few ioctls that we don't intend to fix. Therefore391391+ * consider this blatent hack as another one... and take care392392+ * to run for cover. In most cases it will "just work fine".393393+ * If it doesn't, well, tough.394394+ */395395+ put_user(110, &msg->msg_namelen);396396+ }397397+ return sys_sendmsg(fd, msg, flags);398398+}399399+
+2
arch/arm/mach-clps711x/Kconfig
···24242525config ARCH_CLEP73122626 bool "CLEP7312"2727+ help2828+ Boards based on the Cirrus Logic 7212/7312 chips.27292830config ARCH_EDB72112931 bool "EDB7211"
···1313#include <linux/kernel.h>1414#include <linux/init.h>15151616+#include <asm/tlb.h>1617#include <asm/mach/map.h>1718#include <asm/io.h>1819#include <asm/arch/mux.h>···8483};8584#endif86858787-static int initialized = 0;8888-8989-static void __init _omap_map_io(void)8686+/*8787+ * Maps common IO regions for omap1. This should only get called from8888+ * board specific init.8989+ */9090+void __init omap1_map_common_io(void)9091{9191- initialized = 1;9292-9393- /* We have to initialize the IO space mapping before we can run9494- * cpu_is_omapxxx() macros. */9592 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));9393+9494+ /* Normally devicemaps_init() would flush caches and tlb after9595+ * mdesc->map_io(), but we must also do it here because of the CPU9696+ * revision check below.9797+ */9898+ local_flush_tlb_all();9999+ flush_cache_all();100100+101101+ /* We want to check CPU revision early for cpu_is_omapxxxx() macros.102102+ * IO space mapping must be initialized before we can do that.103103+ */96104 omap_check_revision();9710598106#ifdef CONFIG_ARCH_OMAP730···121111#endif122112123113 omap_sram_init();114114+}124115116116+/*117117+ * Common low-level hardware init for omap1. This should only get called from118118+ * board specific init.119119+ */120120+void __init omap1_init_common_hw()121121+{125122 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort126123 * on a Posted Write in the TIPB Bridge".127124 */···138121 /* Must init clocks early to assure that timer interrupt works139122 */140123 omap1_clk_init();141141-}142124143143-/*144144- * This should only get called from board specific init145145- */146146-void __init omap_map_common_io(void)147147-{148148- if (!initialized) {149149- _omap_map_io();150150- omap1_mux_init();151151- }125125+ omap1_mux_init();152126}153127
···4040#include <linux/mutex.h>41414242#include <asm/hardware.h>4343-#include <asm/atomic.h>4443#include <asm/irq.h>4544#include <asm/io.h>4645···5859void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable)5960{6061 unsigned long clkcon;6161- unsigned long flags;6262-6363- local_irq_save(flags);64626563 clkcon = __raw_readl(S3C2410_CLKCON);6666- clkcon &= ~clocks;67646865 if (enable)6966 clkcon |= clocks;6767+ else6868+ clkcon &= ~clocks;70697170 /* ensure none of the special function bits set */7271 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);73727473 __raw_writel(clkcon, S3C2410_CLKCON);7575-7676- local_irq_restore(flags);7774}78757976/* enable and disable calls for use with the clk struct */···133138134139int clk_enable(struct clk *clk)135140{136136- if (IS_ERR(clk))141141+ if (IS_ERR(clk) || clk == NULL)137142 return -EINVAL;138143139139- return (clk->enable)(clk, 1);144144+ clk_enable(clk->parent);145145+146146+ mutex_lock(&clocks_mutex);147147+148148+ if ((clk->usage++) == 0)149149+ (clk->enable)(clk, 1);150150+151151+ mutex_unlock(&clocks_mutex);152152+ return 0;140153}141154142155void clk_disable(struct clk *clk)143156{144144- if (!IS_ERR(clk))157157+ if (IS_ERR(clk) || clk == NULL)158158+ return;159159+160160+ mutex_lock(&clocks_mutex);161161+162162+ if ((--clk->usage) == 0)145163 (clk->enable)(clk, 0);164164+165165+ mutex_unlock(&clocks_mutex);166166+ clk_disable(clk->parent);146167}147168148169···372361 if (clk->enable == NULL)373362 clk->enable = clk_null_enable;374363364364+ /* if this is a standard clock, set the usage state */365365+366366+ if (clk->ctrlbit) {367367+ unsigned long clkcon = __raw_readl(S3C2410_CLKCON);368368+369369+ clk->usage = (clkcon & clk->ctrlbit) ? 1 : 0;370370+ }371371+375372 /* add to the list of available clocks */376373377374 mutex_lock(&clocks_mutex);···421402 * the LCD clock if it is not needed.422403 */423404405405+ mutex_lock(&clocks_mutex);406406+424407 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0);425408 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0);426409 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0);427410 s3c24xx_clk_enable(S3C2410_CLKCON_ADC, 0);428411 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0);429412 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0);413413+414414+ mutex_unlock(&clocks_mutex);430415431416 /* assume uart clocks are correctly setup */432417
+1
arch/arm/mach-s3c2410/clock.h
···1616 struct clk *parent;1717 const char *name;1818 int id;1919+ int usage;1920 unsigned long rate;2021 unsigned long ctrlbit;2122 int (*enable)(struct clk *, int enable);
···1717#include <linux/init.h>18181919#include <asm/mach/map.h>2020+#include <asm/tlb.h>2021#include <asm/io.h>2122#include <asm/cacheflush.h>2223···9594 printk(KERN_INFO "SRAM: Mapped pa 0x%08lx to va 0x%08lx size: 0x%lx\n",9695 omap_sram_io_desc[0].pfn, omap_sram_io_desc[0].virtual,9796 omap_sram_io_desc[0].length);9797+9898+ /*9999+ * Normally devicemaps_init() would flush caches and tlb after100100+ * mdesc->map_io(), but since we're called from map_io(), we101101+ * must do it here.102102+ */103103+ local_flush_tlb_all();104104+ flush_cache_all();9810599106 /*100107 * Looks like we need to preserve some bootloader code at the
···2525#include <asm/machvec.h>2626#include <asm/system.h>27272828-/*2929- * This is here so we can use the CMOS detection in ide-probe.c to3030- * determine what drives are present. In theory, we don't need this3131- * as the auto-detection could be done via ide-probe.c:do_probe() but3232- * in practice that would be much slower, which is painful when3333- * running in the simulator. Note that passing zeroes in DRIVE_INFO3434- * is sufficient (the IDE driver will autodetect the drive geometry).3535- */3636-char drive_info[4*16];3737-3828void __init3929dig_setup (char **cmdline_p)4030{
+4-12
arch/ia64/kernel/efi.c
···410410 efi_config_table_t *config_tables;411411 efi_char16_t *c16;412412 u64 efi_desc_size;413413- char *cp, *end, vendor[100] = "unknown";413413+ char *cp, vendor[100] = "unknown";414414 extern char saved_command_line[];415415 int i;416416417417 /* it's too early to be able to use the standard kernel command line support... */418418 for (cp = saved_command_line; *cp; ) {419419 if (memcmp(cp, "mem=", 4) == 0) {420420- cp += 4;421421- mem_limit = memparse(cp, &end);422422- if (end != cp)423423- break;424424- cp = end;420420+ mem_limit = memparse(cp + 4, &cp);425421 } else if (memcmp(cp, "max_addr=", 9) == 0) {426426- cp += 9;427427- max_addr = GRANULEROUNDDOWN(memparse(cp, &end));428428- if (end != cp)429429- break;430430- cp = end;422422+ max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));431423 } else {432424 while (*cp != ' ' && *cp)433425 ++cp;···450458 /* Show what we know for posterity */451459 c16 = __va(efi.systab->fw_vendor);452460 if (c16) {453453- for (i = 0;i < (int) sizeof(vendor) && *c16; ++i)461461+ for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)454462 vendor[i] = *c16++;455463 vendor[i] = '\0';456464 }
+1
arch/ia64/kernel/head.S
···352352 mov ar.rsc=0 // place RSE in enforced lazy mode353353 ;;354354 loadrs // clear the dirty partition355355+ mov IA64_KR(PER_CPU_DATA)=r0 // clear physical per-CPU base355356 ;;356357 mov ar.bspstore=r2 // establish the new RSE stack357358 ;;
+4
arch/ia64/kernel/setup.c
···7171EXPORT_SYMBOL(__per_cpu_offset);7272#endif73737474+extern void ia64_setup_printk_clock(void);7575+7476DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);7577DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);7678DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);···446444447445 /* process SAL system table: */448446 ia64_sal_init(efi.sal_systab);447447+448448+ ia64_setup_printk_clock();449449450450#ifdef CONFIG_SMP451451 cpu_physical_id(0) = hard_smp_processor_id();
+27
arch/ia64/kernel/time.c
···278278 }279279}280280EXPORT_SYMBOL(udelay);281281+282282+static unsigned long long ia64_itc_printk_clock(void)283283+{284284+ if (ia64_get_kr(IA64_KR_PER_CPU_DATA))285285+ return sched_clock();286286+ return 0;287287+}288288+289289+static unsigned long long ia64_default_printk_clock(void)290290+{291291+ return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) *292292+ (1000000000/HZ);293293+}294294+295295+unsigned long long (*ia64_printk_clock)(void) = &ia64_default_printk_clock;296296+297297+unsigned long long printk_clock(void)298298+{299299+ return ia64_printk_clock();300300+}301301+302302+void __init303303+ia64_setup_printk_clock(void)304304+{305305+ if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT))306306+ ia64_printk_clock = ia64_itc_printk_clock;307307+}
+3-2
arch/ia64/sn/kernel/mca.c
···33 * License. See the file "COPYING" in the main directory of this archive44 * for more details.55 *66- * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.66+ * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.77 */8899#include <linux/types.h>···137137138138static int __init sn_salinfo_init(void)139139{140140- salinfo_platform_oemdata = &sn_salinfo_platform_oemdata;140140+ if (ia64_platform_is("sn2"))141141+ salinfo_platform_oemdata = &sn_salinfo_platform_oemdata;141142 return 0;142143}143144
+27-27
arch/ia64/sn/kernel/setup.c
···6767extern void (*ia64_mark_idle) (int);6868extern void snidle(int);6969extern unsigned char acpi_kbd_controller_present;7070+extern unsigned long long (*ia64_printk_clock)(void);70717172unsigned long sn_rtc_cycles_per_second;7273EXPORT_SYMBOL(sn_rtc_cycles_per_second);···124123 .orig_video_isVGA = 1,125124 .orig_video_points = 16126125};127127-128128-/*129129- * This is here so we can use the CMOS detection in ide-probe.c to130130- * determine what drives are present. In theory, we don't need this131131- * as the auto-detection could be done via ide-probe.c:do_probe() but132132- * in practice that would be much slower, which is painful when133133- * running in the simulator. Note that passing zeroes in DRIVE_INFO134134- * is sufficient (the IDE driver will autodetect the drive geometry).135135- */136136-#ifdef CONFIG_IA64_GENERIC137137-extern char drive_info[4 * 16];138138-#else139139-char drive_info[4 * 16];140140-#endif141126142127/*143128 * This routine can only be used during init, since···359372 }360373}361374375375+static unsigned long sn2_rtc_initial;376376+377377+static unsigned long long ia64_sn2_printk_clock(void)378378+{379379+ unsigned long rtc_now = rtc_time();380380+381381+ return (rtc_now - sn2_rtc_initial) *382382+ (1000000000 / sn_rtc_cycles_per_second);383383+}384384+362385/**363386 * sn_setup - SN platform setup routine364387 * @cmdline_p: kernel command line···383386 u32 version = sn_sal_rev();384387 extern void sn_cpu_init(void);385388389389+ sn2_rtc_initial = rtc_time();386390 ia64_sn_plat_set_error_handling_features(); // obsolete387391 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV);388392 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES);···435437 */436438 build_cnode_tables();437439438438- /*439439- * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard440440- * support here so we don't have to listen to failed keyboard probe441441- * messages.442442- */443443- if (version <= 0x0209 && acpi_kbd_controller_present) {444444- printk(KERN_INFO "Disabling legacy keyboard support as prom "445445- "is too old and doesn't provide FADT\n");446446- acpi_kbd_controller_present = 0;447447- }448448-449449- printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);450450-451440 status =452441 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec,453442 &drift);···447462 sn_rtc_cycles_per_second = ticks_per_sec;448463449464 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;465465+466466+ ia64_printk_clock = ia64_sn2_printk_clock;467467+468468+ /*469469+ * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard470470+ * support here so we don't have to listen to failed keyboard probe471471+ * messages.472472+ */473473+ if (version <= 0x0209 && acpi_kbd_controller_present) {474474+ printk(KERN_INFO "Disabling legacy keyboard support as prom "475475+ "is too old and doesn't provide FADT\n");476476+ acpi_kbd_controller_present = 0;477477+ }478478+479479+ printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);450480451481 /*452482 * we set the default root device to /dev/hda
+4-1
arch/ia64/sn/kernel/sn2/sn_hwperf.c
···33 * License. See the file "COPYING" in the main directory of this archive44 * for more details.55 *66- * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved.66+ * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved.77 *88 * SGI Altix topology and hardware performance monitoring API.99 * Mark Goodwin <markgw@sgi.com>. ···972972static int __devinit sn_hwperf_misc_register_init(void)973973{974974 int e;975975+976976+ if (!ia64_platform_is("sn2"))977977+ return 0;975978976979 sn_hwperf_init();977980
···39394040asmlinkage void ret_from_fork(void);41414242+/*4343+ * The following aren't currently used.4444+ */4545+void (*pm_idle)(void);4646+EXPORT_SYMBOL(pm_idle);4747+4848+void (*pm_power_off)(void);4949+EXPORT_SYMBOL(pm_power_off);42504351/*4452 * The idle loop on an m68knommu..
···468468 if ( opcode == 1 ) { /* GETFSIND */ 469469 len = strlen_user((char *)arg1);470470 printk(KERN_DEBUG "len of arg1 = %d\n", len);471471-472472- fsname = (char *) kmalloc(len+1, GFP_KERNEL);471471+ if (len == 0)472472+ return 0;473473+ fsname = (char *) kmalloc(len, GFP_KERNEL);473474 if ( !fsname ) {474475 printk(KERN_DEBUG "failed to kmalloc fsname\n");475476 return 0;476477 }477478478478- if ( copy_from_user(fsname, (char *)arg1, len+1) ) {479479+ if ( copy_from_user(fsname, (char *)arg1, len) ) {479480 printk(KERN_DEBUG "failed to copy_from_user fsname\n");480481 kfree(fsname);481482 return 0;482483 }484484+485485+ /* String could be altered by userspace after strlen_user() */486486+ fsname[len] = '\0';483487484488 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname);485489 if ( !strcmp(fsname, "hfs") ) {
+1-1
arch/powerpc/kernel/fpu.S
···6666#else6767 ld r4,PACACURRENT(r13)6868 addi r5,r4,THREAD /* Get THREAD */6969- ld r4,THREAD_FPEXC_MODE(r5)6969+ lwz r4,THREAD_FPEXC_MODE(r5)7070 ori r12,r12,MSR_FP7171 or r12,r12,r47272 std r12,_MSR(r1)
+3-2
arch/powerpc/kernel/head_64.S
···749749750750 .globl decrementer_iSeries_masked751751decrementer_iSeries_masked:752752+ /* We may not have a valid TOC pointer in here. */752753 li r11,1753754 ld r12,PACALPPACAPTR(r13)754755 stb r11,LPPACADECRINT(r12)755755- LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)756756- lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12)756756+ LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy)757757+ lwz r12,0(r12)757758 mtspr SPRN_DEC,r12758759 /* fall through */759760
+6-3
arch/powerpc/kernel/iommu.c
···334334335335 spin_unlock_irqrestore(&(tbl->it_lock), flags);336336337337- /* Make sure updates are seen by hardware */338338- mb();339339-340337 DBG("mapped %d elements:\n", outcount);341338342339 /* For the sake of iommu_unmap_sg, we clear out the length in the···344347 outs->dma_address = DMA_ERROR_CODE;345348 outs->dma_length = 0;346349 }350350+351351+ /* Make sure updates are seen by hardware */352352+ mb();353353+347354 return outcount;348355349356 failure:···359358 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr)360359 >> PAGE_SHIFT;361360 __iommu_free(tbl, vaddr, npages);361361+ s->dma_address = DMA_ERROR_CODE;362362+ s->dma_length = 0;362363 }363364 }364365 spin_unlock_irqrestore(&(tbl->it_lock), flags);
+35-3
arch/powerpc/kernel/prom.c
···491491 size = 16;492492 finish_node(allnodes, &size, 1);493493 size -= 16;494494- end = start = (unsigned long) __va(lmb_alloc(size, 128));494494+495495+ if (0 == size)496496+ end = start = 0;497497+ else498498+ end = start = (unsigned long)__va(lmb_alloc(size, 128));499499+495500 finish_node(allnodes, &end, 0);496501 BUG_ON(end != start + size);497502···1403139814041399 read_lock(&devtree_lock);14051400 np = from ? from->allnext : allnodes;14061406- for (; np != 0; np = np->allnext)14071407- if (np->name != 0 && strcasecmp(np->name, name) == 014011401+ for (; np != NULL; np = np->allnext)14021402+ if (np->name != NULL && strcasecmp(np->name, name) == 014081403 && of_node_get(np))14091404 break;14101405 if (from)···1922191719231918 return 0;19241919}19201920+19211921+#ifdef CONFIG_KEXEC19221922+/* We may have allocated the flat device tree inside the crash kernel region19231923+ * in prom_init. If so we need to move it out into regular memory. */19241924+void kdump_move_device_tree(void)19251925+{19261926+ unsigned long start, end;19271927+ struct boot_param_header *new;19281928+19291929+ start = __pa((unsigned long)initial_boot_params);19301930+ end = start + initial_boot_params->totalsize;19311931+19321932+ if (end < crashk_res.start || start > crashk_res.end)19331933+ return;19341934+19351935+ new = (struct boot_param_header*)19361936+ __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));19371937+19381938+ memcpy(new, initial_boot_params, initial_boot_params->totalsize);19391939+19401940+ initial_boot_params = new;19411941+19421942+ DBG("Flat device tree blob moved to %p\n", initial_boot_params);19431943+19441944+ /* XXX should we unreserve the old DT? */19451945+}19461946+#endif /* CONFIG_KEXEC */
+4
arch/powerpc/kernel/prom_init.c
···20982098 */20992099 prom_init_stdout();2100210021012101+ /* Bail if this is a kdump kernel. */21022102+ if (PHYSICAL_START > 0)21032103+ prom_panic("Error: You can't boot a kdump kernel from OF!\n");21042104+21012105 /*21022106 * Check for an initrd21032107 */
+3-1
arch/powerpc/kernel/prom_parse.c
···465465 if (parent == NULL)466466 return NULL;467467 bus = of_match_bus(parent);468468- if (strcmp(bus->name, "pci"))468468+ if (strcmp(bus->name, "pci")) {469469+ of_node_put(parent);469470 return NULL;471471+ }470472 bus->count_cells(dev, &na, &ns);471473 of_node_put(parent);472474 if (!OF_CHECK_COUNTS(na, ns))
+6-6
arch/powerpc/kernel/rtas.c
···22222323#include <asm/prom.h>2424#include <asm/rtas.h>2525+#include <asm/hvcall.h>2526#include <asm/semaphore.h>2627#include <asm/machdep.h>2728#include <asm/page.h>···566565#ifdef CONFIG_PPC_PSERIES567566static void rtas_percpu_suspend_me(void *info)568567{568568+ int i;569569 long rc;570570 long flags;571571 struct rtas_suspend_me_data *data =···589587590588 if (rc == H_Continue) {591589 data->waiting = 0;592592- rtas_call(ibm_suspend_me_token, 0, 1,593593- data->args->args);590590+ data->args->args[data->args->nargs] =591591+ rtas_call(ibm_suspend_me_token, 0, 1, NULL);592592+ for_each_cpu(i)593593+ plpar_hcall_norets(H_PROD,i);594594 } else {595595 data->waiting = -EBUSY;596596 printk(KERN_ERR "Error on H_Join hypervisor call\n");597597 }598598599599out:600600- /* before we restore interrupts, make sure we don't601601- * generate a spurious soft lockup errors602602- */603603- touch_softlockup_watchdog();604600 local_irq_restore(flags);605601 return;606602}
+1-2
arch/powerpc/kernel/rtas_flash.c
···672672static void remove_flash_pde(struct proc_dir_entry *dp)673673{674674 if (dp) {675675- if (dp->data != NULL)676676- kfree(dp->data);675675+ kfree(dp->data);677676 dp->owner = NULL;678677 remove_proc_entry(dp->name, dp->parent);679678 }
+3
arch/powerpc/kernel/setup_64.c
···398398{399399 DBG(" -> setup_system()\n");400400401401+#ifdef CONFIG_KEXEC402402+ kdump_move_device_tree();403403+#endif401404 /*402405 * Unflatten the device-tree passed by prom_init or kexec403406 */
+7-11
arch/powerpc/kernel/signal_32.c
···142142 return 0;143143}144144145145-static inline compat_uptr_t to_user_ptr(void *kp)146146-{147147- return (compat_uptr_t)(u64)kp;148148-}149149-145145+#define to_user_ptr(p) ptr_to_compat(p)150146#define from_user_ptr(p) compat_ptr(p)151147152148static inline int save_general_regs(struct pt_regs *regs,···209213 return 0;210214}211215212212-#define to_user_ptr(p) (p)213213-#define from_user_ptr(p) (p)216216+#define to_user_ptr(p) ((unsigned long)(p))217217+#define from_user_ptr(p) ((void __user *)(p))214218215219static inline int save_general_regs(struct pt_regs *regs,216220 struct mcontext __user *frame)···522526523527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);524528 if (!ret && oact) {525525- ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler);529529+ ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);526530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);527531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);528532 }···671675int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,672676 int r6, int r7, int r8, struct pt_regs *regs)673677{674674- stack_32_t __user * newstack = (stack_32_t __user *)(long) __new;675675- stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old;678678+ stack_32_t __user * newstack = compat_ptr(__new);679679+ stack_32_t __user * oldstack = compat_ptr(__old);676680 stack_t uss, uoss;677681 int ret;678682 mm_segment_t old_fs;···704708 set_fs(old_fs);705709 /* Copy the stack information to the user output buffer */706710 if (!ret && oldstack &&707707- (put_user((long)uoss.ss_sp, &oldstack->ss_sp) ||711711+ (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||708712 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||709713 __put_user(uoss.ss_size, &oldstack->ss_size)))710714 return -EFAULT;
+2-2
arch/powerpc/kernel/signal_64.c
···6060 struct ucontext uc;6161 unsigned long _unused[2];6262 unsigned int tramp[TRAMP_SIZE];6363- struct siginfo *pinfo;6464- void *puc;6363+ struct siginfo __user *pinfo;6464+ void __user *puc;6565 struct siginfo info;6666 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */6767 char abigap[288];
+3
arch/powerpc/kernel/smp.c
···540540 if (smp_ops->take_timebase)541541 smp_ops->take_timebase();542542543543+ if (system_state > SYSTEM_BOOTING)544544+ per_cpu(last_jiffy, cpu) = get_tb();545545+543546 spin_lock(&call_lock);544547 cpu_set(cpu, cpu_online_map);545548 spin_unlock(&call_lock);
+4-4
arch/powerpc/kernel/time.c
···612612613613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */614614 node_found = 0;615615- if (cpu != 0) {615615+ if (cpu) {616616 fp = (unsigned int *)get_property(cpu, "timebase-frequency",617617 NULL);618618- if (fp != 0) {618618+ if (fp) {619619 node_found = 1;620620 ppc_tb_freq = *fp;621621 }···626626627627 ppc_proc_freq = DEFAULT_PROC_FREQ;628628 node_found = 0;629629- if (cpu != 0) {629629+ if (cpu) {630630 fp = (unsigned int *)get_property(cpu, "clock-frequency",631631 NULL);632632- if (fp != 0) {632632+ if (fp) {633633 node_found = 1;634634 ppc_proc_freq = *fp;635635 }
+1-1
arch/powerpc/kernel/udbg_16550.c
···144144}145145146146#ifdef CONFIG_PPC_MAPLE147147-void udbg_maple_real_putc(unsigned char c)147147+void udbg_maple_real_putc(char c)148148{149149 if (udbg_comport) {150150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
···435435{436436 clear_page(page);437437438438- if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))439439- return;440438 /*441439 * We shouldnt have to do this, but some versions of glibc442440 * require it (ld.so assumes zero filled pages are icache clean)443441 * - Anton444442 */445445-446446- /* avoid an atomic op if possible */447447- if (test_bit(PG_arch_1, &pg->flags))448448- clear_bit(PG_arch_1, &pg->flags);443443+ flush_dcache_page(pg);449444}450445EXPORT_SYMBOL(clear_user_page);451446···464469 return;465470#endif466471467467- if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))468468- return;469469-470470- /* avoid an atomic op if possible */471471- if (test_bit(PG_arch_1, &pg->flags))472472- clear_bit(PG_arch_1, &pg->flags);472472+ flush_dcache_page(pg);473473}474474475475void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
···55extern void chrp_nvram_init(void);66extern void chrp_get_rtc_time(struct rtc_time *);77extern int chrp_set_rtc_time(struct rtc_time *);88-extern void chrp_calibrate_decr(void);98extern long chrp_time_init(void);1091110extern void chrp_find_bridges(void);
+2
arch/powerpc/platforms/chrp/pci.c
···204204 struct device_node *root = find_path_device("/");205205 struct device_node *rtas;206206207207+ of_node_get(root);207208 rtas = of_find_node_by_name (root, "rtas");208209 if (rtas) {209210 hose->ops = &rtas_pci_ops;211211+ of_node_put(rtas);210212 } else {211213 printk ("RTAS supporting Pegasos OF not found, please upgrade"212214 " your firmware\n");
+1-1
arch/powerpc/platforms/chrp/setup.c
···506506 ppc_md.halt = rtas_halt;507507508508 ppc_md.time_init = chrp_time_init;509509- ppc_md.calibrate_decr = chrp_calibrate_decr;509509+ ppc_md.calibrate_decr = generic_calibrate_decr;510510511511 /* this may get overridden with rtas routines later... */512512 ppc_md.set_rtc_time = chrp_set_rtc_time;
-21
arch/powerpc/platforms/chrp/time.c
···167167 tm->tm_mon = mon;168168 tm->tm_year = year;169169}170170-171171-172172-void __init chrp_calibrate_decr(void)173173-{174174- struct device_node *cpu;175175- unsigned int freq, *fp;176176-177177- /*178178- * The cpu node should have a timebase-frequency property179179- * to tell us the rate at which the decrementer counts.180180- */181181- freq = 16666000; /* hardcoded default */182182- cpu = find_type_devices("cpu");183183- if (cpu != 0) {184184- fp = (unsigned int *)185185- get_property(cpu, "timebase-frequency", NULL);186186- if (fp != 0)187187- freq = *fp;188188- }189189- ppc_tb_freq = freq;190190-}
···333333 rc = eeh_reset_device(frozen_pdn, NULL);334334 if (rc)335335 goto hard_fail;336336- pci_walk_bus(frozen_bus, eeh_report_reset, 0);336336+ pci_walk_bus(frozen_bus, eeh_report_reset, NULL);337337 }338338339339 /* If all devices reported they can proceed, the re-enable PIO */···342342 rc = eeh_reset_device(frozen_pdn, NULL);343343 if (rc)344344 goto hard_fail;345345- pci_walk_bus(frozen_bus, eeh_report_reset, 0);345345+ pci_walk_bus(frozen_bus, eeh_report_reset, NULL);346346 }347347348348 /* Tell all device drivers that they can resume operations */349349- pci_walk_bus(frozen_bus, eeh_report_resume, 0);349349+ pci_walk_bus(frozen_bus, eeh_report_resume, NULL);350350351351 return;352352···367367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);368368369369 /* Notify all devices that they're about to go down. */370370- pci_walk_bus(frozen_bus, eeh_report_failure, 0);370370+ pci_walk_bus(frozen_bus, eeh_report_failure, NULL);371371372372 /* Shut down the device drivers for good. */373373 pcibios_remove_pci_devices(frozen_bus);
+1-1
arch/powerpc/platforms/pseries/setup.c
···585585static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)586586{587587 /* Don't risk a hypervisor call if we're crashing */588588- if (!crash_shutdown) {588588+ if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {589589 unsigned long vpa = __pa(get_lppaca());590590591591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
+1-1
arch/powerpc/sysdev/dart_iommu.c
···5959static u32 *dart_vbase;60606161/* Mapped base address for the dart */6262-static unsigned int *__iomem dart;6262+static unsigned int __iomem *dart;63636464/* Dummy val that entries are set to when unused */6565static unsigned int dart_emptyval;
+5-2
arch/ppc/kernel/head_8xx.S
···810810 mtspr SPRN_MD_TWC, r9811811 li r11, MI_BOOTINIT /* Create RPN for address 0 */812812 addis r11, r11, 0x0080 /* Add 8M */813813- mtspr SPRN_MD_RPN, r8813813+ mtspr SPRN_MD_RPN, r11814814+815815+ addi r10, r10, 0x0100816816+ mtspr SPRN_MD_CTR, r10814817815818 addis r8, r8, 0x0080 /* Add 8M */816819 mtspr SPRN_MD_EPN, r8817820 mtspr SPRN_MD_TWC, r9818821 addis r11, r11, 0x0080 /* Add 8M */819819- mtspr SPRN_MD_RPN, r8822822+ mtspr SPRN_MD_RPN, r11820823#endif821824822825 /* Since the cache is enabled according to the information we
···216216{217217 volatile __u8 *bp;218218 volatile __u16 *p;219219+ unsigned char *s = addr;219220220221 if (CHECK_AX88796L_PORT(port)) {221222 p = (volatile unsigned short *)port88796l(port, 0);222222- while (count--) *((unsigned char *) addr)++ = *p & 0xff;223223+ while (count--) *s++ = *p & 0xff;223224 } else if (PXSEG(port))224224- while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port;225225+ while (count--) *s++ = *(volatile unsigned char *)port;225226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {226227 bp = (__u8 *)PCI_IOMAP(port);227227- while (count--) *((volatile unsigned char *) addr)++ = *bp;228228+ while (count--) *s++ = *bp;228229 } else {229230 p = (volatile unsigned short *)port2adr(port);230230- while (count--) *((unsigned char *) addr)++ = *p & 0xff;231231+ while (count--) *s++ = *p & 0xff;231232 }232233}233234234235void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)235236{236237 volatile __u16 *p;238238+ __u16 *s = addr;237239238240 if (CHECK_AX88796L_PORT(port))239241 p = (volatile unsigned short *)port88796l(port, 1);···245243 p = (volatile unsigned short *)PCI_IOMAP(port);246244 else247245 p = (volatile unsigned short *)port2adr(port);248248- while (count--) *((__u16 *) addr)++ = *p;246246+ while (count--) *s++ = *p;249247}250248251249void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)···254252 maybebadio(insl, port);255253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {256254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);255255+ __u32 *s = addr;257256258258- while (count--) *((__u32 *) addr)++ = *p;257257+ while (count--) *s++ = *p;259258 } else260259 maybebadio(insl, port);261260}···265262{266263 volatile __u8 *bp;267264 volatile __u16 *p;265265+ const __u8 *s = addr;268266269267 if (CHECK_AX88796L_PORT(port)) {270268 p = (volatile unsigned short *)port88796l(port, 0);271271- while (count--) *p = *((unsigned char *) addr)++;269269+ while (count--) *p = *s++;272270 } else if (PXSEG(port))273273- while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++;271271+ while (count--) *(volatile unsigned char *)port = *s++;274272 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {275273 bp = (__u8 *)PCI_IOMAP(port);276276- while (count--) *bp = *((volatile unsigned char *) addr)++;274274+ while (count--) *bp = *s++;277275 } else {278276 p = (volatile unsigned short *)port2adr(port);279279- while (count--) *p = *((unsigned char *) addr)++;277277+ while (count--) *p = *s++;280278 }281279}282280283281void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)284282{285283 volatile __u16 *p;284284+ const __u16 *s = addr;286285287286 if (CHECK_AX88796L_PORT(port))288287 p = (volatile unsigned short *)port88796l(port, 1);···294289 p = (volatile unsigned short *)PCI_IOMAP(port);295290 else296291 p = (volatile unsigned short *)port2adr(port);297297- while (count--) *p = *((__u16 *) addr)++;292292+ while (count--) *p = *s++;298293}299294300295void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)···303298 maybebadio(outsl, port);304299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {305300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port);301301+ const __u32 *s = addr;306302307307- while (count--) *p = *((__u32 *) addr)++;303303+ while (count--) *p = *s++;308304 } else309305 maybebadio(outsl, port);310306}
-8
arch/sh64/kernel/sh_ksyms.c
···31313232extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);33333434-#if 03535-/* Not yet - there's no declaration of drive_info anywhere. */3636-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)3737-extern struct drive_info_struct drive_info;3838-EXPORT_SYMBOL(drive_info);3939-#endif4040-#endif4141-4234/* platform dependent support */4335EXPORT_SYMBOL(dump_fpu);4436EXPORT_SYMBOL(iounmap);
+1-1
arch/sparc/kernel/entry.S
···38383939#define curptr g640404141-#define NR_SYSCALLS 299 /* Each OS is different... */4141+#define NR_SYSCALLS 300 /* Each OS is different... */42424343/* These are just handy. */4444#define _SV save %sp, -STACKFRAME_SZ, %sp
+1-1
arch/sparc/kernel/process.c
···5454 * This is done via auxio, but could be used as a fallback5555 * handler when auxio is not present-- unused for now...5656 */5757-void (*pm_power_off)(void);5757+void (*pm_power_off)(void) = machine_power_off;58585959/*6060 * sysctl - toggle power-off restriction for serial console
···11#22# Automatically generated make config: don't edit33# Linux kernel version: 2.6.16-rc244-# Sat Feb 4 02:31:38 200644+# Tue Feb 7 17:47:18 200655#66CONFIG_SPARC=y77CONFIG_SPARC64=y···3030# General setup3131#3232CONFIG_LOCALVERSION=""3333-CONFIG_LOCALVERSION_AUTO=y3333+# CONFIG_LOCALVERSION_AUTO is not set3434CONFIG_SWAP=y3535CONFIG_SYSVIPC=y3636CONFIG_POSIX_MQUEUE=y···766766# CONFIG_SENSORS_ASB100 is not set767767# CONFIG_SENSORS_ATXP1 is not set768768# CONFIG_SENSORS_DS1621 is not set769769+# CONFIG_SENSORS_F71805F is not set769770# CONFIG_SENSORS_FSCHER is not set770771# CONFIG_SENSORS_FSCPOS is not set771772# CONFIG_SENSORS_GL518SM is not set
+1-1
arch/sparc64/kernel/entry.S
···25252626#define curptr g627272828-#define NR_SYSCALLS 299 /* Each OS is different... */2828+#define NR_SYSCALLS 300 /* Each OS is different... */29293030 .text3131 .align 32
···1414extern void save_registers(int pid, union uml_pt_regs *regs);1515extern void restore_registers(int pid, union uml_pt_regs *regs);1616extern void init_registers(int pid);1717-extern void get_safe_registers(unsigned long * regs);1717+extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs);1818extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer);19192020#endif
-569
arch/um/kernel/skas/process.c
···11-/* 22- * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com)33- * Licensed under the GPL44- */55-66-#include <stdlib.h>77-#include <string.h>88-#include <unistd.h>99-#include <errno.h>1010-#include <signal.h>1111-#include <setjmp.h>1212-#include <sched.h>1313-#include <sys/wait.h>1414-#include <sys/mman.h>1515-#include <sys/user.h>1616-#include <sys/time.h>1717-#include <asm/unistd.h>1818-#include <asm/types.h>1919-#include "user.h"2020-#include "ptrace_user.h"2121-#include "sysdep/ptrace.h"2222-#include "user_util.h"2323-#include "kern_util.h"2424-#include "skas.h"2525-#include "stub-data.h"2626-#include "mm_id.h"2727-#include "sysdep/sigcontext.h"2828-#include "sysdep/stub.h"2929-#include "os.h"3030-#include "proc_mm.h"3131-#include "skas_ptrace.h"3232-#include "chan_user.h"3333-#include "registers.h"3434-#include "mem.h"3535-#include "uml-config.h"3636-#include "process.h"3737-3838-int is_skas_winch(int pid, int fd, void *data)3939-{4040- if(pid != os_getpgrp())4141- return(0);4242-4343- register_winch_irq(-1, fd, -1, data);4444- return(1);4545-}4646-4747-void wait_stub_done(int pid, int sig, char * fname)4848-{4949- int n, status, err;5050-5151- do {5252- if ( sig != -1 ) {5353- err = ptrace(PTRACE_CONT, pid, 0, sig);5454- if(err)5555- panic("%s : continue failed, errno = %d\n",5656- fname, errno);5757- }5858- sig = 0;5959-6060- CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));6161- } while((n >= 0) && WIFSTOPPED(status) &&6262- ((WSTOPSIG(status) == SIGVTALRM) ||6363- /* running UML inside a detached screen can cause6464- * SIGWINCHes6565- */6666- (WSTOPSIG(status) == SIGWINCH)));6767-6868- if((n < 0) || !WIFSTOPPED(status) ||6969- (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){7070- unsigned long regs[HOST_FRAME_SIZE];7171- if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)7272- printk("Failed to get registers from stub, "7373- "errno = %d\n", errno);7474- else {7575- int i;7676-7777- printk("Stub registers -\n");7878- for(i = 0; i < HOST_FRAME_SIZE; i++)7979- printk("\t%d - %lx\n", i, regs[i]);8080- }8181- panic("%s : failed to wait for SIGUSR1/SIGTRAP, "8282- "pid = %d, n = %d, errno = %d, status = 0x%x\n",8383- fname, pid, n, errno, status);8484- }8585-}8686-8787-void get_skas_faultinfo(int pid, struct faultinfo * fi)8888-{8989- int err;9090-9191- if(ptrace_faultinfo){9292- err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);9393- if(err)9494- panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "9595- "errno = %d\n", errno);9696-9797- /* Special handling for i386, which has different structs */9898- if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo))9999- memset((char *)fi + sizeof(struct ptrace_faultinfo), 0,100100- sizeof(struct faultinfo) -101101- sizeof(struct ptrace_faultinfo));102102- }103103- else {104104- wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo");105105-106106- /* faultinfo is prepared by the stub-segv-handler at start of107107- * the stub stack page. We just have to copy it.108108- */109109- memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));110110- }111111-}112112-113113-static void handle_segv(int pid, union uml_pt_regs * regs)114114-{115115- get_skas_faultinfo(pid, ®s->skas.faultinfo);116116- segv(regs->skas.faultinfo, 0, 1, NULL);117117-}118118-119119-/*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/120120-static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu)121121-{122122- int err, status;123123-124124- /* Mark this as a syscall */125125- UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs);126126-127127- if (!local_using_sysemu)128128- {129129- err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid);130130- if(err < 0)131131- panic("handle_trap - nullifying syscall failed errno = %d\n",132132- errno);133133-134134- err = ptrace(PTRACE_SYSCALL, pid, 0, 0);135135- if(err < 0)136136- panic("handle_trap - continuing to end of syscall failed, "137137- "errno = %d\n", errno);138138-139139- CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));140140- if((err < 0) || !WIFSTOPPED(status) ||141141- (WSTOPSIG(status) != SIGTRAP + 0x80))142142- panic("handle_trap - failed to wait at end of syscall, "143143- "errno = %d, status = %d\n", errno, status);144144- }145145-146146- handle_syscall(regs);147147-}148148-149149-extern int __syscall_stub_start;150150-int stub_code_fd = -1;151151-__u64 stub_code_offset;152152-153153-static int userspace_tramp(void *stack)154154-{155155- void *addr;156156-157157- ptrace(PTRACE_TRACEME, 0, 0, 0);158158-159159- init_new_thread_signals(1);160160- enable_timer();161161-162162- if(!proc_mm){163163- /* This has a pte, but it can't be mapped in with the usual164164- * tlb_flush mechanism because this is part of that mechanism165165- */166166- addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(),167167- PROT_EXEC, MAP_FIXED | MAP_PRIVATE,168168- stub_code_fd, stub_code_offset);169169- if(addr == MAP_FAILED){170170- printk("mapping stub code failed, errno = %d\n",171171- errno);172172- exit(1);173173- }174174-175175- if(stack != NULL){176176- int fd;177177- __u64 offset;178178-179179- fd = phys_mapping(to_phys(stack), &offset);180180- addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(),181181- PROT_READ | PROT_WRITE,182182- MAP_FIXED | MAP_SHARED, fd, offset);183183- if(addr == MAP_FAILED){184184- printk("mapping stub stack failed, "185185- "errno = %d\n", errno);186186- exit(1);187187- }188188- }189189- }190190- if(!ptrace_faultinfo){191191- unsigned long v = UML_CONFIG_STUB_CODE +192192- (unsigned long) stub_segv_handler -193193- (unsigned long) &__syscall_stub_start;194194-195195- set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size());196196- set_handler(SIGSEGV, (void *) v, SA_ONSTACK,197197- SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,198198- SIGUSR1, -1);199199- }200200-201201- os_stop_process(os_getpid());202202- return(0);203203-}204204-205205-/* Each element set once, and only accessed by a single processor anyway */206206-#undef NR_CPUS207207-#define NR_CPUS 1208208-int userspace_pid[NR_CPUS];209209-210210-int start_userspace(unsigned long stub_stack)211211-{212212- void *stack;213213- unsigned long sp;214214- int pid, status, n, flags;215215-216216- if ( stub_code_fd == -1 )217217- stub_code_fd = phys_mapping(to_phys(&__syscall_stub_start),218218- &stub_code_offset);219219-220220- stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,221221- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);222222- if(stack == MAP_FAILED)223223- panic("start_userspace : mmap failed, errno = %d", errno);224224- sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);225225-226226- flags = CLONE_FILES | SIGCHLD;227227- if(proc_mm) flags |= CLONE_VM;228228- pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);229229- if(pid < 0)230230- panic("start_userspace : clone failed, errno = %d", errno);231231-232232- do {233233- CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));234234- if(n < 0)235235- panic("start_userspace : wait failed, errno = %d", 236236- errno);237237- } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM));238238-239239- if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))240240- panic("start_userspace : expected SIGSTOP, got status = %d",241241- status);242242-243243- if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0)244244- panic("start_userspace : PTRACE_SETOPTIONS failed, errno=%d\n",245245- errno);246246-247247- if(munmap(stack, PAGE_SIZE) < 0)248248- panic("start_userspace : munmap failed, errno = %d\n", errno);249249-250250- return(pid);251251-}252252-253253-void userspace(union uml_pt_regs *regs)254254-{255255- int err, status, op, pid = userspace_pid[0];256256- int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/257257-258258- while(1){259259- restore_registers(pid, regs);260260-261261- /* Now we set local_using_sysemu to be used for one loop */262262- local_using_sysemu = get_using_sysemu();263263-264264- op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));265265-266266- err = ptrace(op, pid, 0, 0);267267- if(err)268268- panic("userspace - could not resume userspace process, "269269- "pid=%d, ptrace operation = %d, errno = %d\n",270270- op, errno);271271-272272- CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));273273- if(err < 0)274274- panic("userspace - waitpid failed, errno = %d\n", 275275- errno);276276-277277- regs->skas.is_user = 1;278278- save_registers(pid, regs);279279- UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */280280-281281- if(WIFSTOPPED(status)){282282- switch(WSTOPSIG(status)){283283- case SIGSEGV:284284- if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo)285285- user_signal(SIGSEGV, regs, pid);286286- else handle_segv(pid, regs);287287- break;288288- case SIGTRAP + 0x80:289289- handle_trap(pid, regs, local_using_sysemu);290290- break;291291- case SIGTRAP:292292- relay_signal(SIGTRAP, regs);293293- break;294294- case SIGIO:295295- case SIGVTALRM:296296- case SIGILL:297297- case SIGBUS:298298- case SIGFPE:299299- case SIGWINCH:300300- user_signal(WSTOPSIG(status), regs, pid);301301- break;302302- default:303303- printk("userspace - child stopped with signal "304304- "%d\n", WSTOPSIG(status));305305- }306306- pid = userspace_pid[0];307307- interrupt_end();308308-309309- /* Avoid -ERESTARTSYS handling in host */310310- PT_SYSCALL_NR(regs->skas.regs) = -1;311311- }312312- }313313-}314314-#define INIT_JMP_NEW_THREAD 0315315-#define INIT_JMP_REMOVE_SIGSTACK 1316316-#define INIT_JMP_CALLBACK 2317317-#define INIT_JMP_HALT 3318318-#define INIT_JMP_REBOOT 4319319-320320-321321-int copy_context_skas0(unsigned long new_stack, int pid)322322-{323323- int err;324324- unsigned long regs[MAX_REG_NR];325325- unsigned long current_stack = current_stub_stack();326326- struct stub_data *data = (struct stub_data *) current_stack;327327- struct stub_data *child_data = (struct stub_data *) new_stack;328328- __u64 new_offset;329329- int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);330330-331331- /* prepare offset and fd of child's stack as argument for parent's332332- * and child's mmap2 calls333333- */334334- *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),335335- .fd = new_fd,336336- .timer = ((struct itimerval)337337- { { 0, 1000000 / hz() },338338- { 0, 1000000 / hz() }})});339339- get_safe_registers(regs);340340-341341- /* Set parent's instruction pointer to start of clone-stub */342342- regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +343343- (unsigned long) stub_clone_handler -344344- (unsigned long) &__syscall_stub_start;345345- regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -346346- sizeof(void *);347347- err = ptrace_setregs(pid, regs);348348- if(err < 0)349349- panic("copy_context_skas0 : PTRACE_SETREGS failed, "350350- "pid = %d, errno = %d\n", pid, errno);351351-352352- /* set a well known return code for detection of child write failure */353353- child_data->err = 12345678;354354-355355- /* Wait, until parent has finished its work: read child's pid from356356- * parent's stack, and check, if bad result.357357- */358358- wait_stub_done(pid, 0, "copy_context_skas0");359359-360360- pid = data->err;361361- if(pid < 0)362362- panic("copy_context_skas0 - stub-parent reports error %d\n",363363- pid);364364-365365- /* Wait, until child has finished too: read child's result from366366- * child's stack and check it.367367- */368368- wait_stub_done(pid, -1, "copy_context_skas0");369369- if (child_data->err != UML_CONFIG_STUB_DATA)370370- panic("copy_context_skas0 - stub-child reports error %d\n",371371- child_data->err);372372-373373- if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,374374- (void *)PTRACE_O_TRACESYSGOOD) < 0)375375- panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, "376376- "errno = %d\n", errno);377377-378378- return pid;379379-}380380-381381-/*382382- * This is used only, if stub pages are needed, while proc_mm is383383- * availabl. Opening /proc/mm creates a new mm_context, which lacks384384- * the stub-pages. Thus, we map them using /proc/mm-fd385385- */386386-void map_stub_pages(int fd, unsigned long code,387387- unsigned long data, unsigned long stack)388388-{389389- struct proc_mm_op mmop;390390- int n;391391-392392- mmop = ((struct proc_mm_op) { .op = MM_MMAP,393393- .u =394394- { .mmap =395395- { .addr = code,396396- .len = PAGE_SIZE,397397- .prot = PROT_EXEC,398398- .flags = MAP_FIXED | MAP_PRIVATE,399399- .fd = stub_code_fd,400400- .offset = stub_code_offset401401- } } });402402- n = os_write_file(fd, &mmop, sizeof(mmop));403403- if(n != sizeof(mmop))404404- panic("map_stub_pages : /proc/mm map for code failed, "405405- "err = %d\n", -n);406406-407407- if ( stack ) {408408- __u64 map_offset;409409- int map_fd = phys_mapping(to_phys((void *)stack), &map_offset);410410- mmop = ((struct proc_mm_op)411411- { .op = MM_MMAP,412412- .u =413413- { .mmap =414414- { .addr = data,415415- .len = PAGE_SIZE,416416- .prot = PROT_READ | PROT_WRITE,417417- .flags = MAP_FIXED | MAP_SHARED,418418- .fd = map_fd,419419- .offset = map_offset420420- } } });421421- n = os_write_file(fd, &mmop, sizeof(mmop));422422- if(n != sizeof(mmop))423423- panic("map_stub_pages : /proc/mm map for data failed, "424424- "err = %d\n", -n);425425- }426426-}427427-428428-void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,429429- void (*handler)(int))430430-{431431- unsigned long flags;432432- sigjmp_buf switch_buf, fork_buf;433433-434434- *switch_buf_ptr = &switch_buf;435435- *fork_buf_ptr = &fork_buf;436436-437437- /* Somewhat subtle - siglongjmp restores the signal mask before doing438438- * the longjmp. This means that when jumping from one stack to another439439- * when the target stack has interrupts enabled, an interrupt may occur440440- * on the source stack. This is bad when starting up a process because441441- * it's not supposed to get timer ticks until it has been scheduled.442442- * So, we disable interrupts around the sigsetjmp to ensure that443443- * they can't happen until we get back here where they are safe.444444- */445445- flags = get_signals();446446- block_signals();447447- if(sigsetjmp(fork_buf, 1) == 0)448448- new_thread_proc(stack, handler);449449-450450- remove_sigstack();451451-452452- set_signals(flags);453453-}454454-455455-void thread_wait(void *sw, void *fb)456456-{457457- sigjmp_buf buf, **switch_buf = sw, *fork_buf;458458-459459- *switch_buf = &buf;460460- fork_buf = fb;461461- if(sigsetjmp(buf, 1) == 0)462462- siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);463463-}464464-465465-void switch_threads(void *me, void *next)466466-{467467- sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;468468-469469- *me_ptr = &my_buf;470470- if(sigsetjmp(my_buf, 1) == 0)471471- siglongjmp(*next_buf, 1);472472-}473473-474474-static sigjmp_buf initial_jmpbuf;475475-476476-/* XXX Make these percpu */477477-static void (*cb_proc)(void *arg);478478-static void *cb_arg;479479-static sigjmp_buf *cb_back;480480-481481-int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)482482-{483483- sigjmp_buf **switch_buf = switch_buf_ptr;484484- int n;485485-486486- set_handler(SIGWINCH, (__sighandler_t) sig_handler,487487- SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,488488- SIGVTALRM, -1);489489-490490- *fork_buf_ptr = &initial_jmpbuf;491491- n = sigsetjmp(initial_jmpbuf, 1);492492- switch(n){493493- case INIT_JMP_NEW_THREAD:494494- new_thread_proc((void *) stack, new_thread_handler);495495- break;496496- case INIT_JMP_REMOVE_SIGSTACK:497497- remove_sigstack();498498- break;499499- case INIT_JMP_CALLBACK:500500- (*cb_proc)(cb_arg);501501- siglongjmp(*cb_back, 1);502502- break;503503- case INIT_JMP_HALT:504504- kmalloc_ok = 0;505505- return(0);506506- case INIT_JMP_REBOOT:507507- kmalloc_ok = 0;508508- return(1);509509- default:510510- panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);511511- }512512- siglongjmp(**switch_buf, 1);513513-}514514-515515-void initial_thread_cb_skas(void (*proc)(void *), void *arg)516516-{517517- sigjmp_buf here;518518-519519- cb_proc = proc;520520- cb_arg = arg;521521- cb_back = &here;522522-523523- block_signals();524524- if(sigsetjmp(here, 1) == 0)525525- siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK);526526- unblock_signals();527527-528528- cb_proc = NULL;529529- cb_arg = NULL;530530- cb_back = NULL;531531-}532532-533533-void halt_skas(void)534534-{535535- block_signals();536536- siglongjmp(initial_jmpbuf, INIT_JMP_HALT);537537-}538538-539539-void reboot_skas(void)540540-{541541- block_signals();542542- siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT);543543-}544544-545545-void switch_mm_skas(struct mm_id *mm_idp)546546-{547547- int err;548548-549549-#warning need cpu pid in switch_mm_skas550550- if(proc_mm){551551- err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,552552- mm_idp->u.mm_fd);553553- if(err)554554- panic("switch_mm_skas - PTRACE_SWITCH_MM failed, "555555- "errno = %d\n", errno);556556- }557557- else userspace_pid[0] = mm_idp->u.pid;558558-}559559-560560-/*561561- * Overrides for Emacs so that we follow Linus's tabbing style.562562- * Emacs will notice this stuff at the end of the file and automatically563563- * adjust the settings for this buffer only. This must remain at the end564564- * of the file.565565- * ---------------------------------------------------------------------------566566- * Local variables:567567- * c-file-style: "linux"568568- * End:569569- */
+18
arch/um/kernel/um_arch.c
···193193" root=/dev/ubd5\n\n"194194);195195196196+#ifndef CONFIG_MODE_TT197197+198198+static int __init no_skas_debug_setup(char *line, int *add)199199+{200200+ printf("'debug' is not necessary to gdb UML in skas mode - run \n");201201+ printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n");202202+ printf("doesn't work as expected\n");203203+204204+ return 0;205205+}206206+207207+__uml_setup("debug", no_skas_debug_setup,208208+"debug\n"209209+" this flag is not needed to run gdb on UML in skas mode\n\n"210210+);211211+212212+#endif213213+196214#ifdef CONFIG_SMP197215static int __init uml_ncpus_setup(char *line, int *add)198216{
···5959#include <asm/nmi.h>6060#include <asm/irq.h>6161#include <asm/hw_irq.h>6262+#include <asm/numa.h>62636364/* Number of siblings per CPU package */6465int smp_num_siblings = 1;···891890 if (boot_error) {892891 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */893892 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */893893+ clear_node_cpumask(cpu); /* was set by numa_add_cpu */894894 cpu_clear(cpu, cpu_present_map);895895 cpu_clear(cpu, cpu_possible_map);896896 x86_cpu_to_apicid[cpu] = BAD_APICID;···11891187 cpu_clear(cpu, cpu_callout_map);11901188 cpu_clear(cpu, cpu_callin_map);11911189 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */11901190+ clear_node_cpumask(cpu);11921191}1193119211941193int __cpu_disable(void)
+1-1
arch/x86_64/kernel/time.c
···748748 * Timer0 and Timer1 is used by platform.749749 */750750 hd.hd_phys_address = vxtime.hpet_address;751751- hd.hd_address = (void *)fix_to_virt(FIX_HPET_BASE);751751+ hd.hd_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE);752752 hd.hd_nirqs = ntimer;753753 hd.hd_flags = HPET_DATA_PLATFORM;754754 hpet_reserve_timer(&hd, 0);
···4949 return pci_mmcfg_virt[0].virt;50505151 /* Fall back to type 0 */5252- return 0;5252+ return NULL;5353}54545555static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
+38-32
block/elevator.c
···293293294294 rq->flags &= ~REQ_STARTED;295295296296- __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE, 0);296296+ elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);297297}298298299299static void elv_drain_elevator(request_queue_t *q)···310310 }311311}312312313313-void __elv_add_request(request_queue_t *q, struct request *rq, int where,314314- int plug)313313+void elv_insert(request_queue_t *q, struct request *rq, int where)315314{316315 struct list_head *pos;317316 unsigned ordseq;318318-319319- if (q->ordcolor)320320- rq->flags |= REQ_ORDERED_COLOR;321321-322322- if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {323323- /*324324- * toggle ordered color325325- */326326- if (blk_barrier_rq(rq))327327- q->ordcolor ^= 1;328328-329329- /*330330- * barriers implicitly indicate back insertion331331- */332332- if (where == ELEVATOR_INSERT_SORT)333333- where = ELEVATOR_INSERT_BACK;334334-335335- /*336336- * this request is scheduling boundary, update end_sector337337- */338338- if (blk_fs_request(rq)) {339339- q->end_sector = rq_end_sector(rq);340340- q->boundary_rq = rq;341341- }342342- } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)343343- where = ELEVATOR_INSERT_BACK;344344-345345- if (plug)346346- blk_plug_device(q);347317348318 rq->q = q;349319···393423 if (nrq >= q->unplug_thresh)394424 __generic_unplug_device(q);395425 }426426+}427427+428428+void __elv_add_request(request_queue_t *q, struct request *rq, int where,429429+ int plug)430430+{431431+ if (q->ordcolor)432432+ rq->flags |= REQ_ORDERED_COLOR;433433+434434+ if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {435435+ /*436436+ * toggle ordered color437437+ */438438+ if (blk_barrier_rq(rq))439439+ q->ordcolor ^= 1;440440+441441+ /*442442+ * barriers implicitly indicate back insertion443443+ */444444+ if (where == ELEVATOR_INSERT_SORT)445445+ where = ELEVATOR_INSERT_BACK;446446+447447+ /*448448+ * this request is scheduling boundary, update449449+ * end_sector450450+ */451451+ if (blk_fs_request(rq)) {452452+ q->end_sector = rq_end_sector(rq);453453+ q->boundary_rq = rq;454454+ }455455+ } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)456456+ where = ELEVATOR_INSERT_BACK;457457+458458+ if (plug)459459+ blk_plug_device(q);460460+461461+ elv_insert(q, rq, where);396462}397463398464void elv_add_request(request_queue_t *q, struct request *rq, int where,
···133133decl_subsys(bus, &ktype_bus, NULL);134134135135136136+#ifdef CONFIG_HOTPLUG137137+136138/* Manually detach a device from its associated driver. */137139static int driver_helper(struct device *dev, void *data)138140{···195193}196194static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);197195196196+#endif198197199198static struct device * next_device(struct klist_iter * i)200199{
+1-1
drivers/base/memory.c
···303303 */304304#ifdef CONFIG_ARCH_MEMORY_PROBE305305static ssize_t306306-memory_probe_store(struct class *class, const char __user *buf, size_t count)306306+memory_probe_store(struct class *class, const char *buf, size_t count)307307{308308 u64 phys_addr;309309 int ret;
+1-2
drivers/base/power/resume.c
···99 */10101111#include <linux/device.h>1212+#include "../base.h"1213#include "power.h"1313-1414-extern int sysdev_resume(void);151416151716/**
+1-1
drivers/base/power/shutdown.c
···1212#include <linux/device.h>1313#include <asm/semaphore.h>14141515+#include "../base.h"1516#include "power.h"16171718#define to_dev(node) container_of(node, struct device, kobj.entry)···2928 * they only get one called once when interrupts are disabled.3029 */31303232-extern int sysdev_shutdown(void);33313432/**3533 * device_shutdown - call ->shutdown() on each device to shutdown.
+1-2
drivers/base/power/suspend.c
···99 */10101111#include <linux/device.h>1212+#include "../base.h"1213#include "power.h"1313-1414-extern int sysdev_suspend(pm_message_t state);15141615/*1716 * The entries in the dpm_active list are in a depth first order, simply
···222222223223config SYNCLINK_GT224224 tristate "SyncLink GT/AC support"225225- depends on SERIAL_NONSTANDARD225225+ depends on SERIAL_NONSTANDARD && PCI226226 help227227 Support for SyncLink GT and SyncLink AC families of228228 synchronous and asynchronous serial adapters
+4-6
drivers/char/drm/drmP.h
···980980extern unsigned int drm_debug;981981extern unsigned int drm_cards_limit;982982extern drm_head_t **drm_heads;983983-extern struct drm_sysfs_class *drm_class;983983+extern struct class *drm_class;984984extern struct proc_dir_entry *drm_proc_root;985985986986 /* Proc support (drm_proc.h) */···10111011extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);1012101210131013 /* sysfs support (drm_sysfs.c) */10141014-struct drm_sysfs_class;10151015-extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner,10161016- char *name);10171017-extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);10181018-extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,10141014+extern struct class *drm_sysfs_create(struct module *owner, char *name);10151015+extern void drm_sysfs_destroy(struct class *cs);10161016+extern struct class_device *drm_sysfs_device_add(struct class *cs,10191017 drm_head_t *head);10201018extern void drm_sysfs_device_remove(struct class_device *class_dev);10211019
+1-1
drivers/char/drm/drm_stub.c
···5050module_param_named(debug, drm_debug, int, 0600);51515252drm_head_t **drm_heads;5353-struct drm_sysfs_class *drm_class;5353+struct class *drm_class;5454struct proc_dir_entry *drm_proc_root;55555656static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
+28-99
drivers/char/drm/drm_sysfs.c
···11+12/*23 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support34 * extra sysfs attribute from DRM. Normal drm_sysfs_class···2019#include "drm_core.h"2120#include "drmP.h"22212323-struct drm_sysfs_class {2424- struct class_device_attribute attr;2525- struct class class;2626-};2727-#define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class)2828-2929-struct simple_dev {3030- dev_t dev;3131- struct class_device class_dev;3232-};3333-#define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)3434-3535-static void release_simple_dev(struct class_device *class_dev)3636-{3737- struct simple_dev *s_dev = to_simple_dev(class_dev);3838- kfree(s_dev);3939-}4040-4141-static ssize_t show_dev(struct class_device *class_dev, char *buf)4242-{4343- struct simple_dev *s_dev = to_simple_dev(class_dev);4444- return print_dev_t(buf, s_dev->dev);4545-}4646-4747-static void drm_sysfs_class_release(struct class *class)4848-{4949- struct drm_sysfs_class *cs = to_drm_sysfs_class(class);5050- kfree(cs);5151-}5252-5322/* Display the version of drm_core. This doesn't work right in current design */5423static ssize_t version_show(struct class *dev, char *buf)5524{···4069 * Note, the pointer created here is to be destroyed when finished by making a4170 * call to drm_sysfs_destroy().4271 */4343-struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name)7272+struct class *drm_sysfs_create(struct module *owner, char *name)4473{4545- struct drm_sysfs_class *cs;4646- int retval;7474+ struct class *class;47754848- cs = kmalloc(sizeof(*cs), GFP_KERNEL);4949- if (!cs) {5050- retval = -ENOMEM;5151- goto error;5252- }5353- memset(cs, 0x00, sizeof(*cs));7676+ class = class_create(owner, name);7777+ if (!class)7878+ return class;54795555- cs->class.name = name;5656- cs->class.class_release = drm_sysfs_class_release;5757- cs->class.release = release_simple_dev;5858-5959- cs->attr.attr.name = "dev";6060- cs->attr.attr.mode = S_IRUGO;6161- cs->attr.attr.owner = owner;6262- cs->attr.show = show_dev;6363- cs->attr.store = NULL;6464-6565- retval = class_register(&cs->class);6666- if (retval)6767- goto error;6868- class_create_file(&cs->class, &class_attr_version);6969-7070- return cs;7171-7272- error:7373- kfree(cs);7474- return ERR_PTR(retval);8080+ class_create_file(class, &class_attr_version);8181+ return class;7582}76837784/**···59110 * Note, the pointer to be destroyed must have been created with a call to60111 * drm_sysfs_create().61112 */6262-void drm_sysfs_destroy(struct drm_sysfs_class *cs)113113+void drm_sysfs_destroy(struct class *class)63114{6464- if ((cs == NULL) || (IS_ERR(cs)))115115+ if ((class == NULL) || (IS_ERR(class)))65116 return;661176767- class_unregister(&cs->class);118118+ class_remove_file(class, &class_attr_version);119119+ class_destroy(class);68120}6912170122static ssize_t show_dri(struct class_device *class_device, char *buf)···8213283133/**84134 * drm_sysfs_device_add - adds a class device to sysfs for a character driver8585- * @cs: pointer to the struct drm_sysfs_class that this device should be registered to.135135+ * @cs: pointer to the struct class that this device should be registered to.86136 * @dev: the dev_t for the device to be added.87137 * @device: a pointer to a struct device that is assiociated with this class device.88138 * @fmt: string for the class device's name···91141 * class. A "dev" file will be created, showing the dev_t for the device. The92142 * pointer to the struct class_device will be returned from the call. Any further93143 * sysfs files that might be required can be created using this pointer.9494- * Note: the struct drm_sysfs_class passed to this function must have previously been144144+ * Note: the struct class passed to this function must have previously been95145 * created with a call to drm_sysfs_create().96146 */9797-struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,9898- drm_head_t *head)147147+struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)99148{100100- struct simple_dev *s_dev = NULL;101101- int i, retval;149149+ struct class_device *class_dev;150150+ int i;102151103103- if ((cs == NULL) || (IS_ERR(cs))) {104104- retval = -ENODEV;105105- goto error;106106- }152152+ class_dev = class_device_create(cs, NULL,153153+ MKDEV(DRM_MAJOR, head->minor),154154+ &(head->dev->pdev)->dev,155155+ "card%d", head->minor);156156+ if (!class_dev)157157+ return NULL;107158108108- s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL);109109- if (!s_dev) {110110- retval = -ENOMEM;111111- goto error;112112- }113113- memset(s_dev, 0x00, sizeof(*s_dev));114114-115115- s_dev->dev = MKDEV(DRM_MAJOR, head->minor);116116- s_dev->class_dev.dev = &(head->dev->pdev)->dev;117117- s_dev->class_dev.class = &cs->class;118118-119119- snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor);120120- retval = class_device_register(&s_dev->class_dev);121121- if (retval)122122- goto error;123123-124124- class_device_create_file(&s_dev->class_dev, &cs->attr);125125- class_set_devdata(&s_dev->class_dev, head);159159+ class_set_devdata(class_dev, head);126160127161 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)128128- class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]);129129- return &s_dev->class_dev;130130-131131-error:132132- kfree(s_dev);133133- return ERR_PTR(retval);162162+ class_device_create_file(class_dev, &class_device_attrs[i]);163163+ return class_dev;134164}135165136166/**···122192 */123193void drm_sysfs_device_remove(struct class_device *class_dev)124194{125125- struct simple_dev *s_dev = to_simple_dev(class_dev);126195 int i;127196128197 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)129129- class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]);130130- class_device_unregister(&s_dev->class_dev);198198+ class_device_remove_file(class_dev, &class_device_attrs[i]);199199+ class_device_unregister(class_dev);131200}
···113113 This driver can also be built as a module. If so, the module114114 will be called ds1621.115115116116+config SENSORS_F71805F117117+ tristate "Fintek F71805F/FG"118118+ depends on HWMON && EXPERIMENTAL119119+ help120120+ If you say yes here you get support for hardware monitoring121121+ features of the Fintek F71805F/FG chips.122122+123123+ This driver can also be built as a module. If so, the module124124+ will be called f71805f.125125+116126config SENSORS_FSCHER117127 tristate "FSC Hermes"118128 depends on HWMON && I2C && EXPERIMENTAL
···11+/*22+ * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated33+ * hardware monitoring features44+ * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>55+ *66+ * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates77+ * complete hardware monitoring features: voltage, fan and temperature88+ * sensors, and manual and automatic fan speed control.99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License as published by1212+ * the Free Software Foundation; either version 2 of the License, or1313+ * (at your option) any later version.1414+ *1515+ * This program is distributed in the hope that it will be useful,1616+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1818+ * GNU General Public License for more details.1919+ *2020+ * You should have received a copy of the GNU General Public License2121+ * along with this program; if not, write to the Free Software2222+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2323+ */2424+2525+#include <linux/module.h>2626+#include <linux/init.h>2727+#include <linux/slab.h>2828+#include <linux/jiffies.h>2929+#include <linux/platform_device.h>3030+#include <linux/hwmon.h>3131+#include <linux/hwmon-sysfs.h>3232+#include <linux/err.h>3333+#include <asm/io.h>3434+3535+static struct platform_device *pdev;3636+3737+#define DRVNAME "f71805f"3838+3939+/*4040+ * Super-I/O constants and functions4141+ */4242+4343+#define F71805F_LD_HWM 0x044444+4545+#define SIO_REG_LDSEL 0x07 /* Logical device select */4646+#define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */4747+#define SIO_REG_DEVREV 0x22 /* Device revision */4848+#define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */4949+#define SIO_REG_ENABLE 0x30 /* Logical device enable */5050+#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */5151+5252+#define SIO_FINTEK_ID 0x19345353+#define SIO_F71805F_ID 0x04065454+5555+static inline int5656+superio_inb(int base, int reg)5757+{5858+ outb(reg, base);5959+ return inb(base + 1);6060+}6161+6262+static int6363+superio_inw(int base, int reg)6464+{6565+ int val;6666+ outb(reg++, base);6767+ val = inb(base + 1) << 8;6868+ outb(reg, base);6969+ val |= inb(base + 1);7070+ return val;7171+}7272+7373+static inline void7474+superio_select(int base, int ld)7575+{7676+ outb(SIO_REG_LDSEL, base);7777+ outb(ld, base + 1);7878+}7979+8080+static inline void8181+superio_enter(int base)8282+{8383+ outb(0x87, base);8484+ outb(0x87, base);8585+}8686+8787+static inline void8888+superio_exit(int base)8989+{9090+ outb(0xaa, base);9191+}9292+9393+/*9494+ * ISA constants9595+ */9696+9797+#define REGION_LENGTH 29898+#define ADDR_REG_OFFSET 09999+#define DATA_REG_OFFSET 1100100+101101+static struct resource f71805f_resource __initdata = {102102+ .flags = IORESOURCE_IO,103103+};104104+105105+/*106106+ * Registers107107+ */108108+109109+/* in nr from 0 to 8 (8-bit values) */110110+#define F71805F_REG_IN(nr) (0x10 + (nr))111111+#define F71805F_REG_IN_HIGH(nr) (0x40 + 2 * (nr))112112+#define F71805F_REG_IN_LOW(nr) (0x41 + 2 * (nr))113113+/* fan nr from 0 to 2 (12-bit values, two registers) */114114+#define F71805F_REG_FAN(nr) (0x20 + 2 * (nr))115115+#define F71805F_REG_FAN_LOW(nr) (0x28 + 2 * (nr))116116+#define F71805F_REG_FAN_CTRL(nr) (0x60 + 16 * (nr))117117+/* temp nr from 0 to 2 (8-bit values) */118118+#define F71805F_REG_TEMP(nr) (0x1B + (nr))119119+#define F71805F_REG_TEMP_HIGH(nr) (0x54 + 2 * (nr))120120+#define F71805F_REG_TEMP_HYST(nr) (0x55 + 2 * (nr))121121+#define F71805F_REG_TEMP_MODE 0x01122122+123123+#define F71805F_REG_START 0x00124124+/* status nr from 0 to 2 */125125+#define F71805F_REG_STATUS(nr) (0x36 + (nr))126126+127127+/*128128+ * Data structures and manipulation thereof129129+ */130130+131131+struct f71805f_data {132132+ unsigned short addr;133133+ const char *name;134134+ struct semaphore lock;135135+ struct class_device *class_dev;136136+137137+ struct semaphore update_lock;138138+ char valid; /* !=0 if following fields are valid */139139+ unsigned long last_updated; /* In jiffies */140140+ unsigned long last_limits; /* In jiffies */141141+142142+ /* Register values */143143+ u8 in[9];144144+ u8 in_high[9];145145+ u8 in_low[9];146146+ u16 fan[3];147147+ u16 fan_low[3];148148+ u8 fan_enabled; /* Read once at init time */149149+ u8 temp[3];150150+ u8 temp_high[3];151151+ u8 temp_hyst[3];152152+ u8 temp_mode;153153+ u8 alarms[3];154154+};155155+156156+static inline long in_from_reg(u8 reg)157157+{158158+ return (reg * 8);159159+}160160+161161+/* The 2 least significant bits are not used */162162+static inline u8 in_to_reg(long val)163163+{164164+ if (val <= 0)165165+ return 0;166166+ if (val >= 2016)167167+ return 0xfc;168168+ return (((val + 16) / 32) << 2);169169+}170170+171171+/* in0 is downscaled by a factor 2 internally */172172+static inline long in0_from_reg(u8 reg)173173+{174174+ return (reg * 16);175175+}176176+177177+static inline u8 in0_to_reg(long val)178178+{179179+ if (val <= 0)180180+ return 0;181181+ if (val >= 4032)182182+ return 0xfc;183183+ return (((val + 32) / 64) << 2);184184+}185185+186186+/* The 4 most significant bits are not used */187187+static inline long fan_from_reg(u16 reg)188188+{189189+ reg &= 0xfff;190190+ if (!reg || reg == 0xfff)191191+ return 0;192192+ return (1500000 / reg);193193+}194194+195195+static inline u16 fan_to_reg(long rpm)196196+{197197+ /* If the low limit is set below what the chip can measure,198198+ store the largest possible 12-bit value in the registers,199199+ so that no alarm will ever trigger. */200200+ if (rpm < 367)201201+ return 0xfff;202202+ return (1500000 / rpm);203203+}204204+205205+static inline long temp_from_reg(u8 reg)206206+{207207+ return (reg * 1000);208208+}209209+210210+static inline u8 temp_to_reg(long val)211211+{212212+ if (val < 0)213213+ val = 0;214214+ else if (val > 1000 * 0xff)215215+ val = 0xff;216216+ return ((val + 500) / 1000);217217+}218218+219219+/*220220+ * Device I/O access221221+ */222222+223223+static u8 f71805f_read8(struct f71805f_data *data, u8 reg)224224+{225225+ u8 val;226226+227227+ down(&data->lock);228228+ outb(reg, data->addr + ADDR_REG_OFFSET);229229+ val = inb(data->addr + DATA_REG_OFFSET);230230+ up(&data->lock);231231+232232+ return val;233233+}234234+235235+static void f71805f_write8(struct f71805f_data *data, u8 reg, u8 val)236236+{237237+ down(&data->lock);238238+ outb(reg, data->addr + ADDR_REG_OFFSET);239239+ outb(val, data->addr + DATA_REG_OFFSET);240240+ up(&data->lock);241241+}242242+243243+/* It is important to read the MSB first, because doing so latches the244244+ value of the LSB, so we are sure both bytes belong to the same value. */245245+static u16 f71805f_read16(struct f71805f_data *data, u8 reg)246246+{247247+ u16 val;248248+249249+ down(&data->lock);250250+ outb(reg, data->addr + ADDR_REG_OFFSET);251251+ val = inb(data->addr + DATA_REG_OFFSET) << 8;252252+ outb(++reg, data->addr + ADDR_REG_OFFSET);253253+ val |= inb(data->addr + DATA_REG_OFFSET);254254+ up(&data->lock);255255+256256+ return val;257257+}258258+259259+static void f71805f_write16(struct f71805f_data *data, u8 reg, u16 val)260260+{261261+ down(&data->lock);262262+ outb(reg, data->addr + ADDR_REG_OFFSET);263263+ outb(val >> 8, data->addr + DATA_REG_OFFSET);264264+ outb(++reg, data->addr + ADDR_REG_OFFSET);265265+ outb(val & 0xff, data->addr + DATA_REG_OFFSET);266266+ up(&data->lock);267267+}268268+269269+static struct f71805f_data *f71805f_update_device(struct device *dev)270270+{271271+ struct f71805f_data *data = dev_get_drvdata(dev);272272+ int nr;273273+274274+ down(&data->update_lock);275275+276276+ /* Limit registers cache is refreshed after 60 seconds */277277+ if (time_after(jiffies, data->last_updated + 60 * HZ)278278+ || !data->valid) {279279+ for (nr = 0; nr < 9; nr++) {280280+ data->in_high[nr] = f71805f_read8(data,281281+ F71805F_REG_IN_HIGH(nr));282282+ data->in_low[nr] = f71805f_read8(data,283283+ F71805F_REG_IN_LOW(nr));284284+ }285285+ for (nr = 0; nr < 3; nr++) {286286+ if (data->fan_enabled & (1 << nr))287287+ data->fan_low[nr] = f71805f_read16(data,288288+ F71805F_REG_FAN_LOW(nr));289289+ }290290+ for (nr = 0; nr < 3; nr++) {291291+ data->temp_high[nr] = f71805f_read8(data,292292+ F71805F_REG_TEMP_HIGH(nr));293293+ data->temp_hyst[nr] = f71805f_read8(data,294294+ F71805F_REG_TEMP_HYST(nr));295295+ }296296+ data->temp_mode = f71805f_read8(data, F71805F_REG_TEMP_MODE);297297+298298+ data->last_limits = jiffies;299299+ }300300+301301+ /* Measurement registers cache is refreshed after 1 second */302302+ if (time_after(jiffies, data->last_updated + HZ)303303+ || !data->valid) {304304+ for (nr = 0; nr < 9; nr++) {305305+ data->in[nr] = f71805f_read8(data,306306+ F71805F_REG_IN(nr));307307+ }308308+ for (nr = 0; nr < 3; nr++) {309309+ if (data->fan_enabled & (1 << nr))310310+ data->fan[nr] = f71805f_read16(data,311311+ F71805F_REG_FAN(nr));312312+ }313313+ for (nr = 0; nr < 3; nr++) {314314+ data->temp[nr] = f71805f_read8(data,315315+ F71805F_REG_TEMP(nr));316316+ }317317+ for (nr = 0; nr < 3; nr++) {318318+ data->alarms[nr] = f71805f_read8(data,319319+ F71805F_REG_STATUS(nr));320320+ }321321+322322+ data->last_updated = jiffies;323323+ data->valid = 1;324324+ }325325+326326+ up(&data->update_lock);327327+328328+ return data;329329+}330330+331331+/*332332+ * Sysfs interface333333+ */334334+335335+static ssize_t show_in0(struct device *dev, struct device_attribute *devattr,336336+ char *buf)337337+{338338+ struct f71805f_data *data = f71805f_update_device(dev);339339+340340+ return sprintf(buf, "%ld\n", in0_from_reg(data->in[0]));341341+}342342+343343+static ssize_t show_in0_max(struct device *dev, struct device_attribute344344+ *devattr, char *buf)345345+{346346+ struct f71805f_data *data = f71805f_update_device(dev);347347+348348+ return sprintf(buf, "%ld\n", in0_from_reg(data->in_high[0]));349349+}350350+351351+static ssize_t show_in0_min(struct device *dev, struct device_attribute352352+ *devattr, char *buf)353353+{354354+ struct f71805f_data *data = f71805f_update_device(dev);355355+356356+ return sprintf(buf, "%ld\n", in0_from_reg(data->in_low[0]));357357+}358358+359359+static ssize_t set_in0_max(struct device *dev, struct device_attribute360360+ *devattr, const char *buf, size_t count)361361+{362362+ struct f71805f_data *data = dev_get_drvdata(dev);363363+ long val = simple_strtol(buf, NULL, 10);364364+365365+ down(&data->update_lock);366366+ data->in_high[0] = in0_to_reg(val);367367+ f71805f_write8(data, F71805F_REG_IN_HIGH(0), data->in_high[0]);368368+ up(&data->update_lock);369369+370370+ return count;371371+}372372+373373+static ssize_t set_in0_min(struct device *dev, struct device_attribute374374+ *devattr, const char *buf, size_t count)375375+{376376+ struct f71805f_data *data = dev_get_drvdata(dev);377377+ long val = simple_strtol(buf, NULL, 10);378378+379379+ down(&data->update_lock);380380+ data->in_low[0] = in0_to_reg(val);381381+ f71805f_write8(data, F71805F_REG_IN_LOW(0), data->in_low[0]);382382+ up(&data->update_lock);383383+384384+ return count;385385+}386386+387387+static DEVICE_ATTR(in0_input, S_IRUGO, show_in0, NULL);388388+static DEVICE_ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max);389389+static DEVICE_ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min);390390+391391+static ssize_t show_in(struct device *dev, struct device_attribute *devattr,392392+ char *buf)393393+{394394+ struct f71805f_data *data = f71805f_update_device(dev);395395+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);396396+ int nr = attr->index;397397+398398+ return sprintf(buf, "%ld\n", in_from_reg(data->in[nr]));399399+}400400+401401+static ssize_t show_in_max(struct device *dev, struct device_attribute402402+ *devattr, char *buf)403403+{404404+ struct f71805f_data *data = f71805f_update_device(dev);405405+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);406406+ int nr = attr->index;407407+408408+ return sprintf(buf, "%ld\n", in_from_reg(data->in_high[nr]));409409+}410410+411411+static ssize_t show_in_min(struct device *dev, struct device_attribute412412+ *devattr, char *buf)413413+{414414+ struct f71805f_data *data = f71805f_update_device(dev);415415+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);416416+ int nr = attr->index;417417+418418+ return sprintf(buf, "%ld\n", in_from_reg(data->in_low[nr]));419419+}420420+421421+static ssize_t set_in_max(struct device *dev, struct device_attribute422422+ *devattr, const char *buf, size_t count)423423+{424424+ struct f71805f_data *data = dev_get_drvdata(dev);425425+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);426426+ int nr = attr->index;427427+ long val = simple_strtol(buf, NULL, 10);428428+429429+ down(&data->update_lock);430430+ data->in_high[nr] = in_to_reg(val);431431+ f71805f_write8(data, F71805F_REG_IN_HIGH(nr), data->in_high[nr]);432432+ up(&data->update_lock);433433+434434+ return count;435435+}436436+437437+static ssize_t set_in_min(struct device *dev, struct device_attribute438438+ *devattr, const char *buf, size_t count)439439+{440440+ struct f71805f_data *data = dev_get_drvdata(dev);441441+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);442442+ int nr = attr->index;443443+ long val = simple_strtol(buf, NULL, 10);444444+445445+ down(&data->update_lock);446446+ data->in_low[nr] = in_to_reg(val);447447+ f71805f_write8(data, F71805F_REG_IN_LOW(nr), data->in_low[nr]);448448+ up(&data->update_lock);449449+450450+ return count;451451+}452452+453453+#define sysfs_in(offset) \454454+static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \455455+ show_in, NULL, offset); \456456+static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \457457+ show_in_max, set_in_max, offset); \458458+static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \459459+ show_in_min, set_in_min, offset)460460+461461+sysfs_in(1);462462+sysfs_in(2);463463+sysfs_in(3);464464+sysfs_in(4);465465+sysfs_in(5);466466+sysfs_in(6);467467+sysfs_in(7);468468+sysfs_in(8);469469+470470+static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,471471+ char *buf)472472+{473473+ struct f71805f_data *data = f71805f_update_device(dev);474474+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);475475+ int nr = attr->index;476476+477477+ return sprintf(buf, "%ld\n", fan_from_reg(data->fan[nr]));478478+}479479+480480+static ssize_t show_fan_min(struct device *dev, struct device_attribute481481+ *devattr, char *buf)482482+{483483+ struct f71805f_data *data = f71805f_update_device(dev);484484+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);485485+ int nr = attr->index;486486+487487+ return sprintf(buf, "%ld\n", fan_from_reg(data->fan_low[nr]));488488+}489489+490490+static ssize_t set_fan_min(struct device *dev, struct device_attribute491491+ *devattr, const char *buf, size_t count)492492+{493493+ struct f71805f_data *data = dev_get_drvdata(dev);494494+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);495495+ int nr = attr->index;496496+ long val = simple_strtol(buf, NULL, 10);497497+498498+ down(&data->update_lock);499499+ data->fan_low[nr] = fan_to_reg(val);500500+ f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);501501+ up(&data->update_lock);502502+503503+ return count;504504+}505505+506506+#define sysfs_fan(offset) \507507+static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \508508+ show_fan, NULL, offset - 1); \509509+static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \510510+ show_fan_min, set_fan_min, offset - 1)511511+512512+sysfs_fan(1);513513+sysfs_fan(2);514514+sysfs_fan(3);515515+516516+static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,517517+ char *buf)518518+{519519+ struct f71805f_data *data = f71805f_update_device(dev);520520+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);521521+ int nr = attr->index;522522+523523+ return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr]));524524+}525525+526526+static ssize_t show_temp_max(struct device *dev, struct device_attribute527527+ *devattr, char *buf)528528+{529529+ struct f71805f_data *data = f71805f_update_device(dev);530530+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);531531+ int nr = attr->index;532532+533533+ return sprintf(buf, "%ld\n", temp_from_reg(data->temp_high[nr]));534534+}535535+536536+static ssize_t show_temp_hyst(struct device *dev, struct device_attribute537537+ *devattr, char *buf)538538+{539539+ struct f71805f_data *data = f71805f_update_device(dev);540540+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);541541+ int nr = attr->index;542542+543543+ return sprintf(buf, "%ld\n", temp_from_reg(data->temp_hyst[nr]));544544+}545545+546546+static ssize_t show_temp_type(struct device *dev, struct device_attribute547547+ *devattr, char *buf)548548+{549549+ struct f71805f_data *data = f71805f_update_device(dev);550550+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);551551+ int nr = attr->index;552552+553553+ /* 3 is diode, 4 is thermistor */554554+ return sprintf(buf, "%u\n", (data->temp_mode & (1 << nr)) ? 3 : 4);555555+}556556+557557+static ssize_t set_temp_max(struct device *dev, struct device_attribute558558+ *devattr, const char *buf, size_t count)559559+{560560+ struct f71805f_data *data = dev_get_drvdata(dev);561561+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);562562+ int nr = attr->index;563563+ long val = simple_strtol(buf, NULL, 10);564564+565565+ down(&data->update_lock);566566+ data->temp_high[nr] = temp_to_reg(val);567567+ f71805f_write8(data, F71805F_REG_TEMP_HIGH(nr), data->temp_high[nr]);568568+ up(&data->update_lock);569569+570570+ return count;571571+}572572+573573+static ssize_t set_temp_hyst(struct device *dev, struct device_attribute574574+ *devattr, const char *buf, size_t count)575575+{576576+ struct f71805f_data *data = dev_get_drvdata(dev);577577+ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);578578+ int nr = attr->index;579579+ long val = simple_strtol(buf, NULL, 10);580580+581581+ down(&data->update_lock);582582+ data->temp_hyst[nr] = temp_to_reg(val);583583+ f71805f_write8(data, F71805F_REG_TEMP_HYST(nr), data->temp_hyst[nr]);584584+ up(&data->update_lock);585585+586586+ return count;587587+}588588+589589+#define sysfs_temp(offset) \590590+static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \591591+ show_temp, NULL, offset - 1); \592592+static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \593593+ show_temp_max, set_temp_max, offset - 1); \594594+static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \595595+ show_temp_hyst, set_temp_hyst, offset - 1); \596596+static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO, \597597+ show_temp_type, NULL, offset - 1)598598+599599+sysfs_temp(1);600600+sysfs_temp(2);601601+sysfs_temp(3);602602+603603+static ssize_t show_alarms_in(struct device *dev, struct device_attribute604604+ *devattr, char *buf)605605+{606606+ struct f71805f_data *data = f71805f_update_device(dev);607607+608608+ return sprintf(buf, "%d\n", data->alarms[0] |609609+ ((data->alarms[1] & 0x01) << 8));610610+}611611+612612+static ssize_t show_alarms_fan(struct device *dev, struct device_attribute613613+ *devattr, char *buf)614614+{615615+ struct f71805f_data *data = f71805f_update_device(dev);616616+617617+ return sprintf(buf, "%d\n", data->alarms[2] & 0x07);618618+}619619+620620+static ssize_t show_alarms_temp(struct device *dev, struct device_attribute621621+ *devattr, char *buf)622622+{623623+ struct f71805f_data *data = f71805f_update_device(dev);624624+625625+ return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07);626626+}627627+628628+static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL);629629+static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL);630630+static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL);631631+632632+static ssize_t show_name(struct device *dev, struct device_attribute633633+ *devattr, char *buf)634634+{635635+ struct f71805f_data *data = dev_get_drvdata(dev);636636+637637+ return sprintf(buf, "%s\n", data->name);638638+}639639+640640+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);641641+642642+/*643643+ * Device registration and initialization644644+ */645645+646646+static void __devinit f71805f_init_device(struct f71805f_data *data)647647+{648648+ u8 reg;649649+ int i;650650+651651+ reg = f71805f_read8(data, F71805F_REG_START);652652+ if ((reg & 0x41) != 0x01) {653653+ printk(KERN_DEBUG DRVNAME ": Starting monitoring "654654+ "operations\n");655655+ f71805f_write8(data, F71805F_REG_START, (reg | 0x01) & ~0x40);656656+ }657657+658658+ /* Fan monitoring can be disabled. If it is, we won't be polling659659+ the register values, and won't create the related sysfs files. */660660+ for (i = 0; i < 3; i++) {661661+ reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i));662662+ if (!(reg & 0x80))663663+ data->fan_enabled |= (1 << i);664664+ }665665+}666666+667667+static int __devinit f71805f_probe(struct platform_device *pdev)668668+{669669+ struct f71805f_data *data;670670+ struct resource *res;671671+ int err;672672+673673+ if (!(data = kzalloc(sizeof(struct f71805f_data), GFP_KERNEL))) {674674+ err = -ENOMEM;675675+ printk(KERN_ERR DRVNAME ": Out of memory\n");676676+ goto exit;677677+ }678678+679679+ res = platform_get_resource(pdev, IORESOURCE_IO, 0);680680+ data->addr = res->start;681681+ init_MUTEX(&data->lock);682682+ data->name = "f71805f";683683+ init_MUTEX(&data->update_lock);684684+685685+ platform_set_drvdata(pdev, data);686686+687687+ data->class_dev = hwmon_device_register(&pdev->dev);688688+ if (IS_ERR(data->class_dev)) {689689+ err = PTR_ERR(data->class_dev);690690+ dev_err(&pdev->dev, "Class registration failed (%d)\n", err);691691+ goto exit_free;692692+ }693693+694694+ /* Initialize the F71805F chip */695695+ f71805f_init_device(data);696696+697697+ /* Register sysfs interface files */698698+ device_create_file(&pdev->dev, &dev_attr_in0_input);699699+ device_create_file(&pdev->dev, &dev_attr_in0_max);700700+ device_create_file(&pdev->dev, &dev_attr_in0_min);701701+ device_create_file(&pdev->dev, &sensor_dev_attr_in1_input.dev_attr);702702+ device_create_file(&pdev->dev, &sensor_dev_attr_in2_input.dev_attr);703703+ device_create_file(&pdev->dev, &sensor_dev_attr_in3_input.dev_attr);704704+ device_create_file(&pdev->dev, &sensor_dev_attr_in4_input.dev_attr);705705+ device_create_file(&pdev->dev, &sensor_dev_attr_in5_input.dev_attr);706706+ device_create_file(&pdev->dev, &sensor_dev_attr_in6_input.dev_attr);707707+ device_create_file(&pdev->dev, &sensor_dev_attr_in7_input.dev_attr);708708+ device_create_file(&pdev->dev, &sensor_dev_attr_in8_input.dev_attr);709709+ device_create_file(&pdev->dev, &sensor_dev_attr_in1_max.dev_attr);710710+ device_create_file(&pdev->dev, &sensor_dev_attr_in2_max.dev_attr);711711+ device_create_file(&pdev->dev, &sensor_dev_attr_in3_max.dev_attr);712712+ device_create_file(&pdev->dev, &sensor_dev_attr_in4_max.dev_attr);713713+ device_create_file(&pdev->dev, &sensor_dev_attr_in5_max.dev_attr);714714+ device_create_file(&pdev->dev, &sensor_dev_attr_in6_max.dev_attr);715715+ device_create_file(&pdev->dev, &sensor_dev_attr_in7_max.dev_attr);716716+ device_create_file(&pdev->dev, &sensor_dev_attr_in8_max.dev_attr);717717+ device_create_file(&pdev->dev, &sensor_dev_attr_in1_min.dev_attr);718718+ device_create_file(&pdev->dev, &sensor_dev_attr_in2_min.dev_attr);719719+ device_create_file(&pdev->dev, &sensor_dev_attr_in3_min.dev_attr);720720+ device_create_file(&pdev->dev, &sensor_dev_attr_in4_min.dev_attr);721721+ device_create_file(&pdev->dev, &sensor_dev_attr_in5_min.dev_attr);722722+ device_create_file(&pdev->dev, &sensor_dev_attr_in6_min.dev_attr);723723+ device_create_file(&pdev->dev, &sensor_dev_attr_in7_min.dev_attr);724724+ device_create_file(&pdev->dev, &sensor_dev_attr_in8_min.dev_attr);725725+ if (data->fan_enabled & (1 << 0)) {726726+ device_create_file(&pdev->dev,727727+ &sensor_dev_attr_fan1_input.dev_attr);728728+ device_create_file(&pdev->dev,729729+ &sensor_dev_attr_fan1_min.dev_attr);730730+ }731731+ if (data->fan_enabled & (1 << 1)) {732732+ device_create_file(&pdev->dev,733733+ &sensor_dev_attr_fan2_input.dev_attr);734734+ device_create_file(&pdev->dev,735735+ &sensor_dev_attr_fan2_min.dev_attr);736736+ }737737+ if (data->fan_enabled & (1 << 2)) {738738+ device_create_file(&pdev->dev,739739+ &sensor_dev_attr_fan3_input.dev_attr);740740+ device_create_file(&pdev->dev,741741+ &sensor_dev_attr_fan3_min.dev_attr);742742+ }743743+ device_create_file(&pdev->dev,744744+ &sensor_dev_attr_temp1_input.dev_attr);745745+ device_create_file(&pdev->dev,746746+ &sensor_dev_attr_temp2_input.dev_attr);747747+ device_create_file(&pdev->dev,748748+ &sensor_dev_attr_temp3_input.dev_attr);749749+ device_create_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);750750+ device_create_file(&pdev->dev, &sensor_dev_attr_temp2_max.dev_attr);751751+ device_create_file(&pdev->dev, &sensor_dev_attr_temp3_max.dev_attr);752752+ device_create_file(&pdev->dev,753753+ &sensor_dev_attr_temp1_max_hyst.dev_attr);754754+ device_create_file(&pdev->dev,755755+ &sensor_dev_attr_temp2_max_hyst.dev_attr);756756+ device_create_file(&pdev->dev,757757+ &sensor_dev_attr_temp3_max_hyst.dev_attr);758758+ device_create_file(&pdev->dev, &sensor_dev_attr_temp1_type.dev_attr);759759+ device_create_file(&pdev->dev, &sensor_dev_attr_temp2_type.dev_attr);760760+ device_create_file(&pdev->dev, &sensor_dev_attr_temp3_type.dev_attr);761761+ device_create_file(&pdev->dev, &dev_attr_alarms_in);762762+ device_create_file(&pdev->dev, &dev_attr_alarms_fan);763763+ device_create_file(&pdev->dev, &dev_attr_alarms_temp);764764+ device_create_file(&pdev->dev, &dev_attr_name);765765+766766+ return 0;767767+768768+exit_free:769769+ kfree(data);770770+exit:771771+ return err;772772+}773773+774774+static int __devexit f71805f_remove(struct platform_device *pdev)775775+{776776+ struct f71805f_data *data = platform_get_drvdata(pdev);777777+778778+ platform_set_drvdata(pdev, NULL);779779+ hwmon_device_unregister(data->class_dev);780780+ kfree(data);781781+782782+ return 0;783783+}784784+785785+static struct platform_driver f71805f_driver = {786786+ .driver = {787787+ .owner = THIS_MODULE,788788+ .name = DRVNAME,789789+ },790790+ .probe = f71805f_probe,791791+ .remove = __devexit_p(f71805f_remove),792792+};793793+794794+static int __init f71805f_device_add(unsigned short address)795795+{796796+ int err;797797+798798+ pdev = platform_device_alloc(DRVNAME, address);799799+ if (!pdev) {800800+ err = -ENOMEM;801801+ printk(KERN_ERR DRVNAME ": Device allocation failed\n");802802+ goto exit;803803+ }804804+805805+ f71805f_resource.start = address;806806+ f71805f_resource.end = address + REGION_LENGTH - 1;807807+ f71805f_resource.name = pdev->name;808808+ err = platform_device_add_resources(pdev, &f71805f_resource, 1);809809+ if (err) {810810+ printk(KERN_ERR DRVNAME ": Device resource addition failed "811811+ "(%d)\n", err);812812+ goto exit_device_put;813813+ }814814+815815+ err = platform_device_add(pdev);816816+ if (err) {817817+ printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",818818+ err);819819+ goto exit_device_put;820820+ }821821+822822+ return 0;823823+824824+exit_device_put:825825+ platform_device_put(pdev);826826+exit:827827+ return err;828828+}829829+830830+static int __init f71805f_find(int sioaddr, unsigned short *address)831831+{832832+ int err = -ENODEV;833833+ u16 devid;834834+835835+ superio_enter(sioaddr);836836+837837+ devid = superio_inw(sioaddr, SIO_REG_MANID);838838+ if (devid != SIO_FINTEK_ID)839839+ goto exit;840840+841841+ devid = superio_inw(sioaddr, SIO_REG_DEVID);842842+ if (devid != SIO_F71805F_ID) {843843+ printk(KERN_INFO DRVNAME ": Unsupported Fintek device, "844844+ "skipping\n");845845+ goto exit;846846+ }847847+848848+ superio_select(sioaddr, F71805F_LD_HWM);849849+ if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {850850+ printk(KERN_WARNING DRVNAME ": Device not activated, "851851+ "skipping\n");852852+ goto exit;853853+ }854854+855855+ *address = superio_inw(sioaddr, SIO_REG_ADDR);856856+ if (*address == 0) {857857+ printk(KERN_WARNING DRVNAME ": Base address not set, "858858+ "skipping\n");859859+ goto exit;860860+ }861861+862862+ err = 0;863863+ printk(KERN_INFO DRVNAME ": Found F71805F chip at %#x, revision %u\n",864864+ *address, superio_inb(sioaddr, SIO_REG_DEVREV));865865+866866+exit:867867+ superio_exit(sioaddr);868868+ return err;869869+}870870+871871+static int __init f71805f_init(void)872872+{873873+ int err;874874+ unsigned short address;875875+876876+ if (f71805f_find(0x2e, &address)877877+ && f71805f_find(0x4e, &address))878878+ return -ENODEV;879879+880880+ err = platform_driver_register(&f71805f_driver);881881+ if (err)882882+ goto exit;883883+884884+ /* Sets global pdev as a side effect */885885+ err = f71805f_device_add(address);886886+ if (err)887887+ goto exit_driver;888888+889889+ return 0;890890+891891+exit_driver:892892+ platform_driver_unregister(&f71805f_driver);893893+exit:894894+ return err;895895+}896896+897897+static void __exit f71805f_exit(void)898898+{899899+ platform_device_unregister(pdev);900900+ platform_driver_unregister(&f71805f_driver);901901+}902902+903903+MODULE_AUTHOR("Jean Delvare <khali@linux-fr>");904904+MODULE_LICENSE("GPL");905905+MODULE_DESCRIPTION("F71805F hardware monitoring driver");906906+907907+module_init(f71805f_init);908908+module_exit(f71805f_exit);
+6-2
drivers/hwmon/it87.c
···454546464747/* Addresses to scan */4848-static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,4949- 0x2e, 0x2f, I2C_CLIENT_END };4848+static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };5049static unsigned short isa_address;51505251/* Insmod parameters */···828829 /* Tell the I2C layer a new client has arrived */829830 if ((err = i2c_attach_client(new_client)))830831 goto ERROR2;832832+833833+ if (!is_isa)834834+ dev_info(&new_client->dev, "The I2C interface to IT87xxF "835835+ "hardware monitoring chips is deprecated. Please "836836+ "report if you still rely on it.\n");831837832838 /* Check PWM configuration */833839 enable_pwm_interface = it87_check_pwm(new_client);
+4-4
drivers/hwmon/lm77.c
···87878888/* In the temperature registers, the low 3 bits are not part of the8989 temperature values; they are the status bits. */9090-static inline u16 LM77_TEMP_TO_REG(int temp)9090+static inline s16 LM77_TEMP_TO_REG(int temp)9191{9292 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX);9393- return (u16)((ntemp / 500) * 8);9393+ return (ntemp / 500) * 8;9494}95959696-static inline int LM77_TEMP_FROM_REG(u16 reg)9696+static inline int LM77_TEMP_FROM_REG(s16 reg)9797{9898- return ((int)reg / 8) * 500;9898+ return (reg / 8) * 500;9999}100100101101/* sysfs stuff */
+14-17
drivers/hwmon/w83792d.c
···303303static int w83792d_attach_adapter(struct i2c_adapter *adapter);304304static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind);305305static int w83792d_detach_client(struct i2c_client *client);306306-307307-static int w83792d_read_value(struct i2c_client *client, u8 register);308308-static int w83792d_write_value(struct i2c_client *client, u8 register,309309- u8 value);310306static struct w83792d_data *w83792d_update_device(struct device *dev);311307312308#ifdef DEBUG···323327{324328 /* in7 and in8 do not have low bits, but the formula still works */325329 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03));330330+}331331+332332+/* The SMBus locks itself. The Winbond W83792D chip has a bank register,333333+ but the driver only accesses registers in bank 0, so we don't have334334+ to switch banks and lock access between switches. */335335+static inline int w83792d_read_value(struct i2c_client *client, u8 reg)336336+{337337+ return i2c_smbus_read_byte_data(client, reg);338338+}339339+340340+static inline int341341+w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)342342+{343343+ return i2c_smbus_write_byte_data(client, reg, value);326344}327345328346/* following are the sysfs callback functions */···13941384 kfree(client);1395138513961386 return 0;13971397-}13981398-13991399-/* The SMBus locks itself. The Winbond W83792D chip has a bank register,14001400- but the driver only accesses registers in bank 0, so we don't have14011401- to switch banks and lock access between switches. */14021402-static int w83792d_read_value(struct i2c_client *client, u8 reg)14031403-{14041404- return i2c_smbus_read_byte_data(client, reg);14051405-}14061406-14071407-static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)14081408-{14091409- return i2c_smbus_write_byte_data(client, reg, value);14101387}1411138814121389static void
+1-1
drivers/i2c/algos/i2c-algo-sibyte.c
···202202#ifdef MODULE203203MODULE_AUTHOR("Kip Walker, Broadcom Corp.");204204MODULE_DESCRIPTION("SiByte I2C-Bus algorithm");205205-MODULE_PARM(bit_scan, "i");205205+module_param(bit_scan, int, 0);206206MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");207207MODULE_LICENSE("GPL");208208
···3232 ICH6 266A3333 ICH7 27DA3434 ESB2 269B3535+ ICH8 283E3536 This driver supports several versions of Intel's I/O Controller Hubs (ICH).3637 For SMBus support, they are similar to the PIIX4 and are part3738 of Intel's '810' and other chipsets.···528527 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) },529528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) },530529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) },530530+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },531531 { 0, }532532};533533
+3-6
drivers/i2c/busses/i2c-parport-light.c
···121121122122static int __init i2c_parport_init(void)123123{124124- int type_count;125125-126126- type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);127127- if (type < 0 || type >= type_count) {124124+ if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {128125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);129126 type = 0;130127 }131131-128128+132129 if (base == 0) {133130 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);134131 base = DEFAULT_BASE;···149152 release_region(base, 3);150153 return -ENODEV;151154 }152152-155155+153156 return 0;154157}155158
+2-5
drivers/i2c/busses/i2c-parport.c
···241241242242static int __init i2c_parport_init(void)243243{244244- int type_count;245245-246246- type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);247247- if (type < 0 || type >= type_count) {244244+ if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {248245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);249246 type = 0;250247 }251251-248248+252249 return parport_register_driver(&i2c_parport_driver);253250}254251
+1-1
drivers/i2c/busses/i2c-pxa.c
···861861 decode_ISR(isr);862862 }863863864864- if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32))864864+ if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))865865 i2c->isrlog[i2c->irqlogidx++] = isr;866866867867 show_state(i2c);
+15
drivers/i2c/i2c-core.c
···946946 }947947}948948949949+s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command,950950+ u8 length, u8 *values)951951+{952952+ union i2c_smbus_data data;953953+954954+ if (length > I2C_SMBUS_BLOCK_MAX)955955+ length = I2C_SMBUS_BLOCK_MAX;956956+ data.block[0] = length;957957+ memcpy(data.block + 1, values, length);958958+ return i2c_smbus_xfer(client->adapter, client->addr, client->flags,959959+ I2C_SMBUS_WRITE, command,960960+ I2C_SMBUS_I2C_BLOCK_DATA, &data);961961+}962962+949963/* Simulate a SMBus command using the i2c protocol 950964 No checking of parameters is done! */951965static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ···11641150EXPORT_SYMBOL(i2c_smbus_write_word_data);11651151EXPORT_SYMBOL(i2c_smbus_write_block_data);11661152EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);11531153+EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);1167115411681155MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");11691156MODULE_DESCRIPTION("I2C-Bus main module");
···351351352352config HISAX_AMD7930353353 bool "Am7930 (EXPERIMENTAL)"354354- depends on EXPERIMENTAL && SPARC354354+ depends on EXPERIMENTAL && SPARC && BROKEN355355 help356356 This enables HiSax support for the AMD7930 chips on some SPARCs.357357 This code is not finished yet.
+8
drivers/macintosh/Kconfig
···187187 This driver provides thermal control for the PowerMac9,1188188 which is the recent (SMU based) single CPU desktop G5189189190190+config WINDFARM_PM112191191+ tristate "Support for thermal management on PowerMac11,2"192192+ depends on WINDFARM && I2C && PMAC_SMU193193+ select I2C_POWERMAC194194+ help195195+ This driver provides thermal control for the PowerMac11,2196196+ which are the recent dual and quad G5 machines using the197197+ 970MP dual-core processor.190198191199config ANSLCD192200 tristate "Support for ANS LCD display"
···7272 int index; /* index of current power */7373 int tindex; /* index of current temp */7474 s32 target; /* current target value */7575+ s32 last_delta; /* last Tactual - Ttarget */7576 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */7677 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */7778 s32 temps[2]; /* temp. history buffer */
+698
drivers/macintosh/windfarm_pm112.c
···11+/*22+ * Windfarm PowerMac thermal control.33+ * Control loops for machines with SMU and PPC970MP processors.44+ *55+ * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>66+ * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.77+ *88+ * Use and redistribute under the terms of the GNU GPL v2.99+ */1010+#include <linux/types.h>1111+#include <linux/errno.h>1212+#include <linux/kernel.h>1313+#include <linux/device.h>1414+#include <linux/platform_device.h>1515+#include <linux/reboot.h>1616+#include <asm/prom.h>1717+#include <asm/smu.h>1818+1919+#include "windfarm.h"2020+#include "windfarm_pid.h"2121+2222+#define VERSION "0.2"2323+2424+#define DEBUG2525+#undef LOTSA_DEBUG2626+2727+#ifdef DEBUG2828+#define DBG(args...) printk(args)2929+#else3030+#define DBG(args...) do { } while(0)3131+#endif3232+3333+#ifdef LOTSA_DEBUG3434+#define DBG_LOTS(args...) printk(args)3535+#else3636+#define DBG_LOTS(args...) do { } while(0)3737+#endif3838+3939+/* define this to force CPU overtemp to 60 degree, useful for testing4040+ * the overtemp code4141+ */4242+#undef HACKED_OVERTEMP4343+4444+/* We currently only handle 2 chips, 4 cores... */4545+#define NR_CHIPS 24646+#define NR_CORES 44747+#define NR_CPU_FANS 3 * NR_CHIPS4848+4949+/* Controls and sensors */5050+static struct wf_sensor *sens_cpu_temp[NR_CORES];5151+static struct wf_sensor *sens_cpu_power[NR_CORES];5252+static struct wf_sensor *hd_temp;5353+static struct wf_sensor *slots_power;5454+static struct wf_sensor *u4_temp;5555+5656+static struct wf_control *cpu_fans[NR_CPU_FANS];5757+static char *cpu_fan_names[NR_CPU_FANS] = {5858+ "cpu-rear-fan-0",5959+ "cpu-rear-fan-1",6060+ "cpu-front-fan-0",6161+ "cpu-front-fan-1",6262+ "cpu-pump-0",6363+ "cpu-pump-1",6464+};6565+static struct wf_control *cpufreq_clamp;6666+6767+/* Second pump isn't required (and isn't actually present) */6868+#define CPU_FANS_REQD (NR_CPU_FANS - 2)6969+#define FIRST_PUMP 47070+#define LAST_PUMP 57171+7272+/* We keep a temperature history for average calculation of 180s */7373+#define CPU_TEMP_HIST_SIZE 1807474+7575+/* Scale factor for fan speed, *100 */7676+static int cpu_fan_scale[NR_CPU_FANS] = {7777+ 100,7878+ 100,7979+ 97, /* inlet fans run at 97% of exhaust fan */8080+ 97,8181+ 100, /* updated later */8282+ 100, /* updated later */8383+};8484+8585+static struct wf_control *backside_fan;8686+static struct wf_control *slots_fan;8787+static struct wf_control *drive_bay_fan;8888+8989+/* PID loop state */9090+static struct wf_cpu_pid_state cpu_pid[NR_CORES];9191+static u32 cpu_thist[CPU_TEMP_HIST_SIZE];9292+static int cpu_thist_pt;9393+static s64 cpu_thist_total;9494+static s32 cpu_all_tmax = 100 << 16;9595+static int cpu_last_target;9696+static struct wf_pid_state backside_pid;9797+static int backside_tick;9898+static struct wf_pid_state slots_pid;9999+static int slots_started;100100+static struct wf_pid_state drive_bay_pid;101101+static int drive_bay_tick;102102+103103+static int nr_cores;104104+static int have_all_controls;105105+static int have_all_sensors;106106+static int started;107107+108108+static int failure_state;109109+#define FAILURE_SENSOR 1110110+#define FAILURE_FAN 2111111+#define FAILURE_PERM 4112112+#define FAILURE_LOW_OVERTEMP 8113113+#define FAILURE_HIGH_OVERTEMP 16114114+115115+/* Overtemp values */116116+#define LOW_OVER_AVERAGE 0117117+#define LOW_OVER_IMMEDIATE (10 << 16)118118+#define LOW_OVER_CLEAR ((-10) << 16)119119+#define HIGH_OVER_IMMEDIATE (14 << 16)120120+#define HIGH_OVER_AVERAGE (10 << 16)121121+#define HIGH_OVER_IMMEDIATE (14 << 16)122122+123123+124124+/* Implementation... */125125+static int create_cpu_loop(int cpu)126126+{127127+ int chip = cpu / 2;128128+ int core = cpu & 1;129129+ struct smu_sdbp_header *hdr;130130+ struct smu_sdbp_cpupiddata *piddata;131131+ struct wf_cpu_pid_param pid;132132+ struct wf_control *main_fan = cpu_fans[0];133133+ s32 tmax;134134+ int fmin;135135+136136+ /* Get PID params from the appropriate SAT */137137+ hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL);138138+ if (hdr == NULL) {139139+ printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n");140140+ return -EINVAL;141141+ }142142+ piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];143143+144144+ /* Get FVT params to get Tmax; if not found, assume default */145145+ hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);146146+ if (hdr) {147147+ struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1];148148+ tmax = fvt->maxtemp << 16;149149+ } else150150+ tmax = 95 << 16; /* default to 95 degrees C */151151+152152+ /* We keep a global tmax for overtemp calculations */153153+ if (tmax < cpu_all_tmax)154154+ cpu_all_tmax = tmax;155155+156156+ /*157157+ * Darwin has a minimum fan speed of 1000 rpm for the 4-way and158158+ * 515 for the 2-way. That appears to be overkill, so for now,159159+ * impose a minimum of 750 or 515.160160+ */161161+ fmin = (nr_cores > 2) ? 750 : 515;162162+163163+ /* Initialize PID loop */164164+ pid.interval = 1; /* seconds */165165+ pid.history_len = piddata->history_len;166166+ pid.gd = piddata->gd;167167+ pid.gp = piddata->gp;168168+ pid.gr = piddata->gr / piddata->history_len;169169+ pid.pmaxadj = (piddata->max_power << 16) - (piddata->power_adj << 8);170170+ pid.ttarget = tmax - (piddata->target_temp_delta << 16);171171+ pid.tmax = tmax;172172+ pid.min = main_fan->ops->get_min(main_fan);173173+ pid.max = main_fan->ops->get_max(main_fan);174174+ if (pid.min < fmin)175175+ pid.min = fmin;176176+177177+ wf_cpu_pid_init(&cpu_pid[cpu], &pid);178178+ return 0;179179+}180180+181181+static void cpu_max_all_fans(void)182182+{183183+ int i;184184+185185+ /* We max all CPU fans in case of a sensor error. We also do the186186+ * cpufreq clamping now, even if it's supposedly done later by the187187+ * generic code anyway, we do it earlier here to react faster188188+ */189189+ if (cpufreq_clamp)190190+ wf_control_set_max(cpufreq_clamp);191191+ for (i = 0; i < NR_CPU_FANS; ++i)192192+ if (cpu_fans[i])193193+ wf_control_set_max(cpu_fans[i]);194194+}195195+196196+static int cpu_check_overtemp(s32 temp)197197+{198198+ int new_state = 0;199199+ s32 t_avg, t_old;200200+201201+ /* First check for immediate overtemps */202202+ if (temp >= (cpu_all_tmax + LOW_OVER_IMMEDIATE)) {203203+ new_state |= FAILURE_LOW_OVERTEMP;204204+ if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)205205+ printk(KERN_ERR "windfarm: Overtemp due to immediate CPU"206206+ " temperature !\n");207207+ }208208+ if (temp >= (cpu_all_tmax + HIGH_OVER_IMMEDIATE)) {209209+ new_state |= FAILURE_HIGH_OVERTEMP;210210+ if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)211211+ printk(KERN_ERR "windfarm: Critical overtemp due to"212212+ " immediate CPU temperature !\n");213213+ }214214+215215+ /* We calculate a history of max temperatures and use that for the216216+ * overtemp management217217+ */218218+ t_old = cpu_thist[cpu_thist_pt];219219+ cpu_thist[cpu_thist_pt] = temp;220220+ cpu_thist_pt = (cpu_thist_pt + 1) % CPU_TEMP_HIST_SIZE;221221+ cpu_thist_total -= t_old;222222+ cpu_thist_total += temp;223223+ t_avg = cpu_thist_total / CPU_TEMP_HIST_SIZE;224224+225225+ DBG_LOTS("t_avg = %d.%03d (out: %d.%03d, in: %d.%03d)\n",226226+ FIX32TOPRINT(t_avg), FIX32TOPRINT(t_old), FIX32TOPRINT(temp));227227+228228+ /* Now check for average overtemps */229229+ if (t_avg >= (cpu_all_tmax + LOW_OVER_AVERAGE)) {230230+ new_state |= FAILURE_LOW_OVERTEMP;231231+ if ((failure_state & FAILURE_LOW_OVERTEMP) == 0)232232+ printk(KERN_ERR "windfarm: Overtemp due to average CPU"233233+ " temperature !\n");234234+ }235235+ if (t_avg >= (cpu_all_tmax + HIGH_OVER_AVERAGE)) {236236+ new_state |= FAILURE_HIGH_OVERTEMP;237237+ if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0)238238+ printk(KERN_ERR "windfarm: Critical overtemp due to"239239+ " average CPU temperature !\n");240240+ }241241+242242+ /* Now handle overtemp conditions. We don't currently use the windfarm243243+ * overtemp handling core as it's not fully suited to the needs of those244244+ * new machine. This will be fixed later.245245+ */246246+ if (new_state) {247247+ /* High overtemp -> immediate shutdown */248248+ if (new_state & FAILURE_HIGH_OVERTEMP)249249+ machine_power_off();250250+ if ((failure_state & new_state) != new_state)251251+ cpu_max_all_fans();252252+ failure_state |= new_state;253253+ } else if ((failure_state & FAILURE_LOW_OVERTEMP) &&254254+ (temp < (cpu_all_tmax + LOW_OVER_CLEAR))) {255255+ printk(KERN_ERR "windfarm: Overtemp condition cleared !\n");256256+ failure_state &= ~FAILURE_LOW_OVERTEMP;257257+ }258258+259259+ return failure_state & (FAILURE_LOW_OVERTEMP | FAILURE_HIGH_OVERTEMP);260260+}261261+262262+static void cpu_fans_tick(void)263263+{264264+ int err, cpu;265265+ s32 greatest_delta = 0;266266+ s32 temp, power, t_max = 0;267267+ int i, t, target = 0;268268+ struct wf_sensor *sr;269269+ struct wf_control *ct;270270+ struct wf_cpu_pid_state *sp;271271+272272+ DBG_LOTS(KERN_DEBUG);273273+ for (cpu = 0; cpu < nr_cores; ++cpu) {274274+ /* Get CPU core temperature */275275+ sr = sens_cpu_temp[cpu];276276+ err = sr->ops->get_value(sr, &temp);277277+ if (err) {278278+ DBG("\n");279279+ printk(KERN_WARNING "windfarm: CPU %d temperature "280280+ "sensor error %d\n", cpu, err);281281+ failure_state |= FAILURE_SENSOR;282282+ cpu_max_all_fans();283283+ return;284284+ }285285+286286+ /* Keep track of highest temp */287287+ t_max = max(t_max, temp);288288+289289+ /* Get CPU power */290290+ sr = sens_cpu_power[cpu];291291+ err = sr->ops->get_value(sr, &power);292292+ if (err) {293293+ DBG("\n");294294+ printk(KERN_WARNING "windfarm: CPU %d power "295295+ "sensor error %d\n", cpu, err);296296+ failure_state |= FAILURE_SENSOR;297297+ cpu_max_all_fans();298298+ return;299299+ }300300+301301+ /* Run PID */302302+ sp = &cpu_pid[cpu];303303+ t = wf_cpu_pid_run(sp, power, temp);304304+305305+ if (cpu == 0 || sp->last_delta > greatest_delta) {306306+ greatest_delta = sp->last_delta;307307+ target = t;308308+ }309309+ DBG_LOTS("[%d] P=%d.%.3d T=%d.%.3d ",310310+ cpu, FIX32TOPRINT(power), FIX32TOPRINT(temp));311311+ }312312+ DBG_LOTS("fans = %d, t_max = %d.%03d\n", target, FIX32TOPRINT(t_max));313313+314314+ /* Darwin limits decrease to 20 per iteration */315315+ if (target < (cpu_last_target - 20))316316+ target = cpu_last_target - 20;317317+ cpu_last_target = target;318318+ for (cpu = 0; cpu < nr_cores; ++cpu)319319+ cpu_pid[cpu].target = target;320320+321321+ /* Handle possible overtemps */322322+ if (cpu_check_overtemp(t_max))323323+ return;324324+325325+ /* Set fans */326326+ for (i = 0; i < NR_CPU_FANS; ++i) {327327+ ct = cpu_fans[i];328328+ if (ct == NULL)329329+ continue;330330+ err = ct->ops->set_value(ct, target * cpu_fan_scale[i] / 100);331331+ if (err) {332332+ printk(KERN_WARNING "windfarm: fan %s reports "333333+ "error %d\n", ct->name, err);334334+ failure_state |= FAILURE_FAN;335335+ break;336336+ }337337+ }338338+}339339+340340+/* Backside/U4 fan */341341+static struct wf_pid_param backside_param = {342342+ .interval = 5,343343+ .history_len = 2,344344+ .gd = 48 << 20,345345+ .gp = 5 << 20,346346+ .gr = 0,347347+ .itarget = 64 << 16,348348+ .additive = 1,349349+};350350+351351+static void backside_fan_tick(void)352352+{353353+ s32 temp;354354+ int speed;355355+ int err;356356+357357+ if (!backside_fan || !u4_temp)358358+ return;359359+ if (!backside_tick) {360360+ /* first time; initialize things */361361+ backside_param.min = backside_fan->ops->get_min(backside_fan);362362+ backside_param.max = backside_fan->ops->get_max(backside_fan);363363+ wf_pid_init(&backside_pid, &backside_param);364364+ backside_tick = 1;365365+ }366366+ if (--backside_tick > 0)367367+ return;368368+ backside_tick = backside_pid.param.interval;369369+370370+ err = u4_temp->ops->get_value(u4_temp, &temp);371371+ if (err) {372372+ printk(KERN_WARNING "windfarm: U4 temp sensor error %d\n",373373+ err);374374+ failure_state |= FAILURE_SENSOR;375375+ wf_control_set_max(backside_fan);376376+ return;377377+ }378378+ speed = wf_pid_run(&backside_pid, temp);379379+ DBG_LOTS("backside PID temp=%d.%.3d speed=%d\n",380380+ FIX32TOPRINT(temp), speed);381381+382382+ err = backside_fan->ops->set_value(backside_fan, speed);383383+ if (err) {384384+ printk(KERN_WARNING "windfarm: backside fan error %d\n", err);385385+ failure_state |= FAILURE_FAN;386386+ }387387+}388388+389389+/* Drive bay fan */390390+static struct wf_pid_param drive_bay_prm = {391391+ .interval = 5,392392+ .history_len = 2,393393+ .gd = 30 << 20,394394+ .gp = 5 << 20,395395+ .gr = 0,396396+ .itarget = 40 << 16,397397+ .additive = 1,398398+};399399+400400+static void drive_bay_fan_tick(void)401401+{402402+ s32 temp;403403+ int speed;404404+ int err;405405+406406+ if (!drive_bay_fan || !hd_temp)407407+ return;408408+ if (!drive_bay_tick) {409409+ /* first time; initialize things */410410+ drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan);411411+ drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan);412412+ wf_pid_init(&drive_bay_pid, &drive_bay_prm);413413+ drive_bay_tick = 1;414414+ }415415+ if (--drive_bay_tick > 0)416416+ return;417417+ drive_bay_tick = drive_bay_pid.param.interval;418418+419419+ err = hd_temp->ops->get_value(hd_temp, &temp);420420+ if (err) {421421+ printk(KERN_WARNING "windfarm: drive bay temp sensor "422422+ "error %d\n", err);423423+ failure_state |= FAILURE_SENSOR;424424+ wf_control_set_max(drive_bay_fan);425425+ return;426426+ }427427+ speed = wf_pid_run(&drive_bay_pid, temp);428428+ DBG_LOTS("drive_bay PID temp=%d.%.3d speed=%d\n",429429+ FIX32TOPRINT(temp), speed);430430+431431+ err = drive_bay_fan->ops->set_value(drive_bay_fan, speed);432432+ if (err) {433433+ printk(KERN_WARNING "windfarm: drive bay fan error %d\n", err);434434+ failure_state |= FAILURE_FAN;435435+ }436436+}437437+438438+/* PCI slots area fan */439439+/* This makes the fan speed proportional to the power consumed */440440+static struct wf_pid_param slots_param = {441441+ .interval = 1,442442+ .history_len = 2,443443+ .gd = 0,444444+ .gp = 0,445445+ .gr = 0x1277952,446446+ .itarget = 0,447447+ .min = 1560,448448+ .max = 3510,449449+};450450+451451+static void slots_fan_tick(void)452452+{453453+ s32 power;454454+ int speed;455455+ int err;456456+457457+ if (!slots_fan || !slots_power)458458+ return;459459+ if (!slots_started) {460460+ /* first time; initialize things */461461+ wf_pid_init(&slots_pid, &slots_param);462462+ slots_started = 1;463463+ }464464+465465+ err = slots_power->ops->get_value(slots_power, &power);466466+ if (err) {467467+ printk(KERN_WARNING "windfarm: slots power sensor error %d\n",468468+ err);469469+ failure_state |= FAILURE_SENSOR;470470+ wf_control_set_max(slots_fan);471471+ return;472472+ }473473+ speed = wf_pid_run(&slots_pid, power);474474+ DBG_LOTS("slots PID power=%d.%.3d speed=%d\n",475475+ FIX32TOPRINT(power), speed);476476+477477+ err = slots_fan->ops->set_value(slots_fan, speed);478478+ if (err) {479479+ printk(KERN_WARNING "windfarm: slots fan error %d\n", err);480480+ failure_state |= FAILURE_FAN;481481+ }482482+}483483+484484+static void set_fail_state(void)485485+{486486+ int i;487487+488488+ if (cpufreq_clamp)489489+ wf_control_set_max(cpufreq_clamp);490490+ for (i = 0; i < NR_CPU_FANS; ++i)491491+ if (cpu_fans[i])492492+ wf_control_set_max(cpu_fans[i]);493493+ if (backside_fan)494494+ wf_control_set_max(backside_fan);495495+ if (slots_fan)496496+ wf_control_set_max(slots_fan);497497+ if (drive_bay_fan)498498+ wf_control_set_max(drive_bay_fan);499499+}500500+501501+static void pm112_tick(void)502502+{503503+ int i, last_failure;504504+505505+ if (!started) {506506+ started = 1;507507+ for (i = 0; i < nr_cores; ++i) {508508+ if (create_cpu_loop(i) < 0) {509509+ failure_state = FAILURE_PERM;510510+ set_fail_state();511511+ break;512512+ }513513+ }514514+ DBG_LOTS("cpu_all_tmax=%d.%03d\n", FIX32TOPRINT(cpu_all_tmax));515515+516516+#ifdef HACKED_OVERTEMP517517+ cpu_all_tmax = 60 << 16;518518+#endif519519+ }520520+521521+ /* Permanent failure, bail out */522522+ if (failure_state & FAILURE_PERM)523523+ return;524524+ /* Clear all failure bits except low overtemp which will be eventually525525+ * cleared by the control loop itself526526+ */527527+ last_failure = failure_state;528528+ failure_state &= FAILURE_LOW_OVERTEMP;529529+ cpu_fans_tick();530530+ backside_fan_tick();531531+ slots_fan_tick();532532+ drive_bay_fan_tick();533533+534534+ DBG_LOTS("last_failure: 0x%x, failure_state: %x\n",535535+ last_failure, failure_state);536536+537537+ /* Check for failures. Any failure causes cpufreq clamping */538538+ if (failure_state && last_failure == 0 && cpufreq_clamp)539539+ wf_control_set_max(cpufreq_clamp);540540+ if (failure_state == 0 && last_failure && cpufreq_clamp)541541+ wf_control_set_min(cpufreq_clamp);542542+543543+ /* That's it for now, we might want to deal with other failures544544+ * differently in the future though545545+ */546546+}547547+548548+static void pm112_new_control(struct wf_control *ct)549549+{550550+ int i, max_exhaust;551551+552552+ if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {553553+ if (wf_get_control(ct) == 0)554554+ cpufreq_clamp = ct;555555+ }556556+557557+ for (i = 0; i < NR_CPU_FANS; ++i) {558558+ if (!strcmp(ct->name, cpu_fan_names[i])) {559559+ if (cpu_fans[i] == NULL && wf_get_control(ct) == 0)560560+ cpu_fans[i] = ct;561561+ break;562562+ }563563+ }564564+ if (i >= NR_CPU_FANS) {565565+ /* not a CPU fan, try the others */566566+ if (!strcmp(ct->name, "backside-fan")) {567567+ if (backside_fan == NULL && wf_get_control(ct) == 0)568568+ backside_fan = ct;569569+ } else if (!strcmp(ct->name, "slots-fan")) {570570+ if (slots_fan == NULL && wf_get_control(ct) == 0)571571+ slots_fan = ct;572572+ } else if (!strcmp(ct->name, "drive-bay-fan")) {573573+ if (drive_bay_fan == NULL && wf_get_control(ct) == 0)574574+ drive_bay_fan = ct;575575+ }576576+ return;577577+ }578578+579579+ for (i = 0; i < CPU_FANS_REQD; ++i)580580+ if (cpu_fans[i] == NULL)581581+ return;582582+583583+ /* work out pump scaling factors */584584+ max_exhaust = cpu_fans[0]->ops->get_max(cpu_fans[0]);585585+ for (i = FIRST_PUMP; i <= LAST_PUMP; ++i)586586+ if ((ct = cpu_fans[i]) != NULL)587587+ cpu_fan_scale[i] =588588+ ct->ops->get_max(ct) * 100 / max_exhaust;589589+590590+ have_all_controls = 1;591591+}592592+593593+static void pm112_new_sensor(struct wf_sensor *sr)594594+{595595+ unsigned int i;596596+597597+ if (have_all_sensors)598598+ return;599599+ if (!strncmp(sr->name, "cpu-temp-", 9)) {600600+ i = sr->name[9] - '0';601601+ if (sr->name[10] == 0 && i < NR_CORES &&602602+ sens_cpu_temp[i] == NULL && wf_get_sensor(sr) == 0)603603+ sens_cpu_temp[i] = sr;604604+605605+ } else if (!strncmp(sr->name, "cpu-power-", 10)) {606606+ i = sr->name[10] - '0';607607+ if (sr->name[11] == 0 && i < NR_CORES &&608608+ sens_cpu_power[i] == NULL && wf_get_sensor(sr) == 0)609609+ sens_cpu_power[i] = sr;610610+ } else if (!strcmp(sr->name, "hd-temp")) {611611+ if (hd_temp == NULL && wf_get_sensor(sr) == 0)612612+ hd_temp = sr;613613+ } else if (!strcmp(sr->name, "slots-power")) {614614+ if (slots_power == NULL && wf_get_sensor(sr) == 0)615615+ slots_power = sr;616616+ } else if (!strcmp(sr->name, "u4-temp")) {617617+ if (u4_temp == NULL && wf_get_sensor(sr) == 0)618618+ u4_temp = sr;619619+ } else620620+ return;621621+622622+ /* check if we have all the sensors we need */623623+ for (i = 0; i < nr_cores; ++i)624624+ if (sens_cpu_temp[i] == NULL || sens_cpu_power[i] == NULL)625625+ return;626626+627627+ have_all_sensors = 1;628628+}629629+630630+static int pm112_wf_notify(struct notifier_block *self,631631+ unsigned long event, void *data)632632+{633633+ switch (event) {634634+ case WF_EVENT_NEW_SENSOR:635635+ pm112_new_sensor(data);636636+ break;637637+ case WF_EVENT_NEW_CONTROL:638638+ pm112_new_control(data);639639+ break;640640+ case WF_EVENT_TICK:641641+ if (have_all_controls && have_all_sensors)642642+ pm112_tick();643643+ }644644+ return 0;645645+}646646+647647+static struct notifier_block pm112_events = {648648+ .notifier_call = pm112_wf_notify,649649+};650650+651651+static int wf_pm112_probe(struct device *dev)652652+{653653+ wf_register_client(&pm112_events);654654+ return 0;655655+}656656+657657+static int wf_pm112_remove(struct device *dev)658658+{659659+ wf_unregister_client(&pm112_events);660660+ /* should release all sensors and controls */661661+ return 0;662662+}663663+664664+static struct device_driver wf_pm112_driver = {665665+ .name = "windfarm",666666+ .bus = &platform_bus_type,667667+ .probe = wf_pm112_probe,668668+ .remove = wf_pm112_remove,669669+};670670+671671+static int __init wf_pm112_init(void)672672+{673673+ struct device_node *cpu;674674+675675+ if (!machine_is_compatible("PowerMac11,2"))676676+ return -ENODEV;677677+678678+ /* Count the number of CPU cores */679679+ nr_cores = 0;680680+ for (cpu = NULL; (cpu = of_find_node_by_type(cpu, "cpu")) != NULL; )681681+ ++nr_cores;682682+683683+ printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n");684684+ driver_register(&wf_pm112_driver);685685+ return 0;686686+}687687+688688+static void __exit wf_pm112_exit(void)689689+{690690+ driver_unregister(&wf_pm112_driver);691691+}692692+693693+module_init(wf_pm112_init);694694+module_exit(wf_pm112_exit);695695+696696+MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");697697+MODULE_DESCRIPTION("Thermal control for PowerMac11,2");698698+MODULE_LICENSE("GPL");
+12-75
drivers/macintosh/windfarm_pm81.c
···538538 }539539}540540541541-542542-/*543543- * ****** Attributes ******544544- *545545- */546546-547547-#define BUILD_SHOW_FUNC_FIX(name, data) \548548-static ssize_t show_##name(struct device *dev, \549549- struct device_attribute *attr, \550550- char *buf) \551551-{ \552552- ssize_t r; \553553- s32 val = 0; \554554- data->ops->get_value(data, &val); \555555- r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \556556- return r; \557557-} \558558-static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);559559-560560-561561-#define BUILD_SHOW_FUNC_INT(name, data) \562562-static ssize_t show_##name(struct device *dev, \563563- struct device_attribute *attr, \564564- char *buf) \565565-{ \566566- s32 val = 0; \567567- data->ops->get_value(data, &val); \568568- return sprintf(buf, "%d", val); \569569-} \570570-static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);571571-572572-BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);573573-BUILD_SHOW_FUNC_INT(sys_fan, fan_system);574574-BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);575575-576576-BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);577577-BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);578578-BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);579579-580541/*581542 * ****** Setup / Init / Misc ... ******582543 *···615654 return;616655617656 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) {618618- if (wf_get_control(ct) == 0) {657657+ if (wf_get_control(ct) == 0)619658 fan_cpu_main = ct;620620- device_create_file(wf_smu_dev, &dev_attr_cpu_fan);621621- }622659 }623660624661 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) {625625- if (wf_get_control(ct) == 0) {662662+ if (wf_get_control(ct) == 0)626663 fan_system = ct;627627- device_create_file(wf_smu_dev, &dev_attr_sys_fan);628628- }629664 }630665631666 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {···640683 }641684642685 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {643643- if (wf_get_control(ct) == 0) {686686+ if (wf_get_control(ct) == 0)644687 fan_hd = ct;645645- device_create_file(wf_smu_dev, &dev_attr_hd_fan);646646- }647688 }648689649690 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp)···654699 return;655700656701 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {657657- if (wf_get_sensor(sr) == 0) {702702+ if (wf_get_sensor(sr) == 0)658703 sensor_cpu_power = sr;659659- device_create_file(wf_smu_dev, &dev_attr_cpu_power);660660- }661704 }662705663706 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {664664- if (wf_get_sensor(sr) == 0) {707707+ if (wf_get_sensor(sr) == 0)665708 sensor_cpu_temp = sr;666666- device_create_file(wf_smu_dev, &dev_attr_cpu_temp);667667- }668709 }669710670711 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {671671- if (wf_get_sensor(sr) == 0) {712712+ if (wf_get_sensor(sr) == 0)672713 sensor_hd_temp = sr;673673- device_create_file(wf_smu_dev, &dev_attr_hd_temp);674674- }675714 }676715677716 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp)···743794 * with that except by adding locks all over... I'll do that744795 * eventually but heh, who ever rmmod this module anyway ?745796 */746746- if (sensor_cpu_power) {747747- device_remove_file(wf_smu_dev, &dev_attr_cpu_power);797797+ if (sensor_cpu_power)748798 wf_put_sensor(sensor_cpu_power);749749- }750750- if (sensor_cpu_temp) {751751- device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);799799+ if (sensor_cpu_temp)752800 wf_put_sensor(sensor_cpu_temp);753753- }754754- if (sensor_hd_temp) {755755- device_remove_file(wf_smu_dev, &dev_attr_hd_temp);801801+ if (sensor_hd_temp)756802 wf_put_sensor(sensor_hd_temp);757757- }758803759804 /* Release all controls */760760- if (fan_cpu_main) {761761- device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);805805+ if (fan_cpu_main)762806 wf_put_control(fan_cpu_main);763763- }764764- if (fan_hd) {765765- device_remove_file(wf_smu_dev, &dev_attr_hd_fan);807807+ if (fan_hd)766808 wf_put_control(fan_hd);767767- }768768- if (fan_system) {769769- device_remove_file(wf_smu_dev, &dev_attr_sys_fan);809809+ if (fan_system)770810 wf_put_control(fan_system);771771- }772811 if (cpufreq_clamp)773812 wf_put_control(cpufreq_clamp);774813
+14-81
drivers/macintosh/windfarm_pm91.c
···458458459459460460/*461461- * ****** Attributes ******462462- *463463- */464464-465465-#define BUILD_SHOW_FUNC_FIX(name, data) \466466-static ssize_t show_##name(struct device *dev, \467467- struct device_attribute *attr, \468468- char *buf) \469469-{ \470470- ssize_t r; \471471- s32 val = 0; \472472- data->ops->get_value(data, &val); \473473- r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \474474- return r; \475475-} \476476-static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);477477-478478-479479-#define BUILD_SHOW_FUNC_INT(name, data) \480480-static ssize_t show_##name(struct device *dev, \481481- struct device_attribute *attr, \482482- char *buf) \483483-{ \484484- s32 val = 0; \485485- data->ops->get_value(data, &val); \486486- return sprintf(buf, "%d", val); \487487-} \488488-static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL);489489-490490-BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main);491491-BUILD_SHOW_FUNC_INT(hd_fan, fan_hd);492492-BUILD_SHOW_FUNC_INT(slots_fan, fan_slots);493493-494494-BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp);495495-BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power);496496-BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp);497497-BUILD_SHOW_FUNC_FIX(slots_power, sensor_slots_power);498498-499499-/*500461 * ****** Setup / Init / Misc ... ******501462 *502463 */···542581 return;543582544583 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) {545545- if (wf_get_control(ct) == 0) {584584+ if (wf_get_control(ct) == 0)546585 fan_cpu_main = ct;547547- device_create_file(wf_smu_dev, &dev_attr_cpu_fan);548548- }549586 }550587551588 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) {···562603 }563604564605 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {565565- if (wf_get_control(ct) == 0) {606606+ if (wf_get_control(ct) == 0)566607 fan_hd = ct;567567- device_create_file(wf_smu_dev, &dev_attr_hd_fan);568568- }569608 }570609571610 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) {572572- if (wf_get_control(ct) == 0) {611611+ if (wf_get_control(ct) == 0)573612 fan_slots = ct;574574- device_create_file(wf_smu_dev, &dev_attr_slots_fan);575575- }576613 }577614578615 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd &&···582627 return;583628584629 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {585585- if (wf_get_sensor(sr) == 0) {630630+ if (wf_get_sensor(sr) == 0)586631 sensor_cpu_power = sr;587587- device_create_file(wf_smu_dev, &dev_attr_cpu_power);588588- }589632 }590633591634 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {592592- if (wf_get_sensor(sr) == 0) {635635+ if (wf_get_sensor(sr) == 0)593636 sensor_cpu_temp = sr;594594- device_create_file(wf_smu_dev, &dev_attr_cpu_temp);595595- }596637 }597638598639 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {599599- if (wf_get_sensor(sr) == 0) {640640+ if (wf_get_sensor(sr) == 0)600641 sensor_hd_temp = sr;601601- device_create_file(wf_smu_dev, &dev_attr_hd_temp);602602- }603642 }604643605644 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) {606606- if (wf_get_sensor(sr) == 0) {645645+ if (wf_get_sensor(sr) == 0)607646 sensor_slots_power = sr;608608- device_create_file(wf_smu_dev, &dev_attr_slots_power);609609- }610647 }611648612649 if (sensor_cpu_power && sensor_cpu_temp &&···667720 * with that except by adding locks all over... I'll do that668721 * eventually but heh, who ever rmmod this module anyway ?669722 */670670- if (sensor_cpu_power) {671671- device_remove_file(wf_smu_dev, &dev_attr_cpu_power);723723+ if (sensor_cpu_power)672724 wf_put_sensor(sensor_cpu_power);673673- }674674- if (sensor_cpu_temp) {675675- device_remove_file(wf_smu_dev, &dev_attr_cpu_temp);725725+ if (sensor_cpu_temp)676726 wf_put_sensor(sensor_cpu_temp);677677- }678678- if (sensor_hd_temp) {679679- device_remove_file(wf_smu_dev, &dev_attr_hd_temp);727727+ if (sensor_hd_temp)680728 wf_put_sensor(sensor_hd_temp);681681- }682682- if (sensor_slots_power) {683683- device_remove_file(wf_smu_dev, &dev_attr_slots_power);729729+ if (sensor_slots_power)684730 wf_put_sensor(sensor_slots_power);685685- }686731687732 /* Release all controls */688688- if (fan_cpu_main) {689689- device_remove_file(wf_smu_dev, &dev_attr_cpu_fan);733733+ if (fan_cpu_main)690734 wf_put_control(fan_cpu_main);691691- }692735 if (fan_cpu_second)693736 wf_put_control(fan_cpu_second);694737 if (fan_cpu_third)695738 wf_put_control(fan_cpu_third);696696- if (fan_hd) {697697- device_remove_file(wf_smu_dev, &dev_attr_hd_fan);739739+ if (fan_hd)698740 wf_put_control(fan_hd);699699- }700700- if (fan_slots) {701701- device_remove_file(wf_smu_dev, &dev_attr_slots_fan);741741+ if (fan_slots)702742 wf_put_control(fan_slots);703703- }704743 if (cpufreq_clamp)705744 wf_put_control(cpufreq_clamp);706745
+54-15
drivers/macintosh/windfarm_smu_controls.c
···24242525#include "windfarm.h"26262727-#define VERSION "0.3"2727+#define VERSION "0.4"28282929#undef DEBUG3030···3333#else3434#define DBG(args...) do { } while(0)3535#endif3636+3737+static int smu_supports_new_fans_ops = 1;36383739/*3840 * SMU fans control object···61596260 /* Fill SMU command structure */6361 cmd.cmd = SMU_CMD_FAN_COMMAND;6464- cmd.data_len = 14;6262+6363+ /* The SMU has an "old" and a "new" way of setting the fan speed6464+ * Unfortunately, I found no reliable way to know which one works6565+ * on a given machine model. After some investigations it appears6666+ * that MacOS X just tries the new one, and if it fails fallbacks6767+ * to the old ones ... Ugh.6868+ */6969+ retry:7070+ if (smu_supports_new_fans_ops) {7171+ buffer[0] = 0x30;7272+ buffer[1] = id;7373+ *((u16 *)(&buffer[2])) = value;7474+ cmd.data_len = 4;7575+ } else {7676+ if (id > 7)7777+ return -EINVAL;7878+ /* Fill argument buffer */7979+ memset(buffer, 0, 16);8080+ buffer[0] = pwm ? 0x10 : 0x00;8181+ buffer[1] = 0x01 << id;8282+ *((u16 *)&buffer[2 + id * 2]) = value;8383+ cmd.data_len = 14;8484+ }8585+6586 cmd.reply_len = 16;6687 cmd.data_buf = cmd.reply_buf = buffer;6788 cmd.status = 0;6889 cmd.done = smu_done_complete;6990 cmd.misc = ∁70917171- /* Fill argument buffer */7272- memset(buffer, 0, 16);7373- buffer[0] = pwm ? 0x10 : 0x00;7474- buffer[1] = 0x01 << id;7575- *((u16 *)&buffer[2 + id * 2]) = value;7676-7792 rc = smu_queue_cmd(&cmd);7893 if (rc)7994 return rc;8095 wait_for_completion(&comp);9696+9797+ /* Handle fallback (see coment above) */9898+ if (cmd.status != 0 && smu_supports_new_fans_ops) {9999+ printk(KERN_WARNING "windfarm: SMU failed new fan command "100100+ "falling back to old method\n");101101+ smu_supports_new_fans_ops = 0;102102+ goto retry;103103+ }104104+81105 return cmd.status;82106}83107···186158187159 /* Names used on desktop models */188160 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") ||189189- !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan"))161161+ !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan") ||162162+ !strcmp(l, "CPU A EXHAUST"))190163 fct->ctrl.name = "cpu-rear-fan-0";191191- else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1"))164164+ else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1") ||165165+ !strcmp(l, "CPU B EXHAUST"))192166 fct->ctrl.name = "cpu-rear-fan-1";193167 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") ||194194- !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan"))168168+ !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan") ||169169+ !strcmp(l, "CPU A INTAKE"))195170 fct->ctrl.name = "cpu-front-fan-0";196196- else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1"))171171+ else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1") ||172172+ !strcmp(l, "CPU B INTAKE"))197173 fct->ctrl.name = "cpu-front-fan-1";198198- else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan"))174174+ else if (!strcmp(l, "CPU A PUMP"))175175+ fct->ctrl.name = "cpu-pump-0";176176+ else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||177177+ !strcmp(l, "EXPANSION SLOTS INTAKE"))199178 fct->ctrl.name = "slots-fan";200200- else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay"))179179+ else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay") ||180180+ !strcmp(l, "DRIVE BAY A INTAKE"))201181 fct->ctrl.name = "drive-bay-fan";182182+ else if (!strcmp(l, "BACKSIDE"))183183+ fct->ctrl.name = "backside-fan";202184203185 /* Names used on iMac models */204186 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan"))···261223262224 /* Look for RPM fans */263225 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;)264264- if (!strcmp(fans->name, "rpm-fans"))226226+ if (!strcmp(fans->name, "rpm-fans") ||227227+ device_is_compatible(fans, "smu-rpm-fans"))265228 break;266229 for (fan = NULL;267230 fans && (fan = of_get_next_child(fans, fan)) != NULL;) {
+418
drivers/macintosh/windfarm_smu_sat.c
···11+/*22+ * Windfarm PowerMac thermal control. SMU "satellite" controller sensors.33+ *44+ * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org>55+ *66+ * Released under the terms of the GNU GPL v2.77+ */88+99+#include <linux/types.h>1010+#include <linux/errno.h>1111+#include <linux/kernel.h>1212+#include <linux/slab.h>1313+#include <linux/init.h>1414+#include <linux/wait.h>1515+#include <linux/i2c.h>1616+#include <linux/i2c-dev.h>1717+#include <asm/semaphore.h>1818+#include <asm/prom.h>1919+#include <asm/smu.h>2020+#include <asm/pmac_low_i2c.h>2121+2222+#include "windfarm.h"2323+2424+#define VERSION "0.2"2525+2626+#define DEBUG2727+2828+#ifdef DEBUG2929+#define DBG(args...) printk(args)3030+#else3131+#define DBG(args...) do { } while(0)3232+#endif3333+3434+/* If the cache is older than 800ms we'll refetch it */3535+#define MAX_AGE msecs_to_jiffies(800)3636+3737+struct wf_sat {3838+ int nr;3939+ atomic_t refcnt;4040+ struct semaphore mutex;4141+ unsigned long last_read; /* jiffies when cache last updated */4242+ u8 cache[16];4343+ struct i2c_client i2c;4444+ struct device_node *node;4545+};4646+4747+static struct wf_sat *sats[2];4848+4949+struct wf_sat_sensor {5050+ int index;5151+ int index2; /* used for power sensors */5252+ int shift;5353+ struct wf_sat *sat;5454+ struct wf_sensor sens;5555+};5656+5757+#define wf_to_sat(c) container_of(c, struct wf_sat_sensor, sens)5858+#define i2c_to_sat(c) container_of(c, struct wf_sat, i2c)5959+6060+static int wf_sat_attach(struct i2c_adapter *adapter);6161+static int wf_sat_detach(struct i2c_client *client);6262+6363+static struct i2c_driver wf_sat_driver = {6464+ .driver = {6565+ .name = "wf_smu_sat",6666+ },6767+ .attach_adapter = wf_sat_attach,6868+ .detach_client = wf_sat_detach,6969+};7070+7171+/*7272+ * XXX i2c_smbus_read_i2c_block_data doesn't pass the requested7373+ * length down to the low-level driver, so we use this, which7474+ * works well enough with the SMU i2c driver code...7575+ */7676+static int sat_read_block(struct i2c_client *client, u8 command,7777+ u8 *values, int len)7878+{7979+ union i2c_smbus_data data;8080+ int err;8181+8282+ data.block[0] = len;8383+ err = i2c_smbus_xfer(client->adapter, client->addr, client->flags,8484+ I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA,8585+ &data);8686+ if (!err)8787+ memcpy(values, data.block, len);8888+ return err;8989+}9090+9191+struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,9292+ unsigned int *size)9393+{9494+ struct wf_sat *sat;9595+ int err;9696+ unsigned int i, len;9797+ u8 *buf;9898+ u8 data[4];9999+100100+ /* TODO: Add the resulting partition to the device-tree */101101+102102+ if (sat_id > 1 || (sat = sats[sat_id]) == NULL)103103+ return NULL;104104+105105+ err = i2c_smbus_write_word_data(&sat->i2c, 8, id << 8);106106+ if (err) {107107+ printk(KERN_ERR "smu_sat_get_sdb_part wr error %d\n", err);108108+ return NULL;109109+ }110110+111111+ len = i2c_smbus_read_word_data(&sat->i2c, 9);112112+ if (len < 0) {113113+ printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n");114114+ return NULL;115115+ }116116+ if (len == 0) {117117+ printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id);118118+ return NULL;119119+ }120120+121121+ len = le16_to_cpu(len);122122+ len = (len + 3) & ~3;123123+ buf = kmalloc(len, GFP_KERNEL);124124+ if (buf == NULL)125125+ return NULL;126126+127127+ for (i = 0; i < len; i += 4) {128128+ err = sat_read_block(&sat->i2c, 0xa, data, 4);129129+ if (err) {130130+ printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n",131131+ err);132132+ goto fail;133133+ }134134+ buf[i] = data[1];135135+ buf[i+1] = data[0];136136+ buf[i+2] = data[3];137137+ buf[i+3] = data[2];138138+ }139139+#ifdef DEBUG140140+ DBG(KERN_DEBUG "sat %d partition %x:", sat_id, id);141141+ for (i = 0; i < len; ++i)142142+ DBG(" %x", buf[i]);143143+ DBG("\n");144144+#endif145145+146146+ if (size)147147+ *size = len;148148+ return (struct smu_sdbp_header *) buf;149149+150150+ fail:151151+ kfree(buf);152152+ return NULL;153153+}154154+155155+/* refresh the cache */156156+static int wf_sat_read_cache(struct wf_sat *sat)157157+{158158+ int err;159159+160160+ err = sat_read_block(&sat->i2c, 0x3f, sat->cache, 16);161161+ if (err)162162+ return err;163163+ sat->last_read = jiffies;164164+#ifdef LOTSA_DEBUG165165+ {166166+ int i;167167+ DBG(KERN_DEBUG "wf_sat_get: data is");168168+ for (i = 0; i < 16; ++i)169169+ DBG(" %.2x", sat->cache[i]);170170+ DBG("\n");171171+ }172172+#endif173173+ return 0;174174+}175175+176176+static int wf_sat_get(struct wf_sensor *sr, s32 *value)177177+{178178+ struct wf_sat_sensor *sens = wf_to_sat(sr);179179+ struct wf_sat *sat = sens->sat;180180+ int i, err;181181+ s32 val;182182+183183+ if (sat->i2c.adapter == NULL)184184+ return -ENODEV;185185+186186+ down(&sat->mutex);187187+ if (time_after(jiffies, (sat->last_read + MAX_AGE))) {188188+ err = wf_sat_read_cache(sat);189189+ if (err)190190+ goto fail;191191+ }192192+193193+ i = sens->index * 2;194194+ val = ((sat->cache[i] << 8) + sat->cache[i+1]) << sens->shift;195195+ if (sens->index2 >= 0) {196196+ i = sens->index2 * 2;197197+ /* 4.12 * 8.8 -> 12.20; shift right 4 to get 16.16 */198198+ val = (val * ((sat->cache[i] << 8) + sat->cache[i+1])) >> 4;199199+ }200200+201201+ *value = val;202202+ err = 0;203203+204204+ fail:205205+ up(&sat->mutex);206206+ return err;207207+}208208+209209+static void wf_sat_release(struct wf_sensor *sr)210210+{211211+ struct wf_sat_sensor *sens = wf_to_sat(sr);212212+ struct wf_sat *sat = sens->sat;213213+214214+ if (atomic_dec_and_test(&sat->refcnt)) {215215+ if (sat->i2c.adapter) {216216+ i2c_detach_client(&sat->i2c);217217+ sat->i2c.adapter = NULL;218218+ }219219+ if (sat->nr >= 0)220220+ sats[sat->nr] = NULL;221221+ kfree(sat);222222+ }223223+ kfree(sens);224224+}225225+226226+static struct wf_sensor_ops wf_sat_ops = {227227+ .get_value = wf_sat_get,228228+ .release = wf_sat_release,229229+ .owner = THIS_MODULE,230230+};231231+232232+static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)233233+{234234+ struct wf_sat *sat;235235+ struct wf_sat_sensor *sens;236236+ u32 *reg;237237+ char *loc, *type;238238+ u8 addr, chip, core;239239+ struct device_node *child;240240+ int shift, cpu, index;241241+ char *name;242242+ int vsens[2], isens[2];243243+244244+ reg = (u32 *) get_property(dev, "reg", NULL);245245+ if (reg == NULL)246246+ return;247247+ addr = *reg;248248+ DBG(KERN_DEBUG "wf_sat: creating sat at address %x\n", addr);249249+250250+ sat = kzalloc(sizeof(struct wf_sat), GFP_KERNEL);251251+ if (sat == NULL)252252+ return;253253+ sat->nr = -1;254254+ sat->node = of_node_get(dev);255255+ atomic_set(&sat->refcnt, 0);256256+ init_MUTEX(&sat->mutex);257257+ sat->i2c.addr = (addr >> 1) & 0x7f;258258+ sat->i2c.adapter = adapter;259259+ sat->i2c.driver = &wf_sat_driver;260260+ strncpy(sat->i2c.name, "smu-sat", I2C_NAME_SIZE-1);261261+262262+ if (i2c_attach_client(&sat->i2c)) {263263+ printk(KERN_ERR "windfarm: failed to attach smu-sat to i2c\n");264264+ goto fail;265265+ }266266+267267+ vsens[0] = vsens[1] = -1;268268+ isens[0] = isens[1] = -1;269269+ child = NULL;270270+ while ((child = of_get_next_child(dev, child)) != NULL) {271271+ reg = (u32 *) get_property(child, "reg", NULL);272272+ type = get_property(child, "device_type", NULL);273273+ loc = get_property(child, "location", NULL);274274+ if (reg == NULL || loc == NULL)275275+ continue;276276+277277+ /* the cooked sensors are between 0x30 and 0x37 */278278+ if (*reg < 0x30 || *reg > 0x37)279279+ continue;280280+ index = *reg - 0x30;281281+282282+ /* expect location to be CPU [AB][01] ... */283283+ if (strncmp(loc, "CPU ", 4) != 0)284284+ continue;285285+ chip = loc[4] - 'A';286286+ core = loc[5] - '0';287287+ if (chip > 1 || core > 1) {288288+ printk(KERN_ERR "wf_sat_create: don't understand "289289+ "location %s for %s\n", loc, child->full_name);290290+ continue;291291+ }292292+ cpu = 2 * chip + core;293293+ if (sat->nr < 0)294294+ sat->nr = chip;295295+ else if (sat->nr != chip) {296296+ printk(KERN_ERR "wf_sat_create: can't cope with "297297+ "multiple CPU chips on one SAT (%s)\n", loc);298298+ continue;299299+ }300300+301301+ if (strcmp(type, "voltage-sensor") == 0) {302302+ name = "cpu-voltage";303303+ shift = 4;304304+ vsens[core] = index;305305+ } else if (strcmp(type, "current-sensor") == 0) {306306+ name = "cpu-current";307307+ shift = 8;308308+ isens[core] = index;309309+ } else if (strcmp(type, "temp-sensor") == 0) {310310+ name = "cpu-temp";311311+ shift = 10;312312+ } else313313+ continue; /* hmmm shouldn't happen */314314+315315+ /* the +16 is enough for "cpu-voltage-n" */316316+ sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);317317+ if (sens == NULL) {318318+ printk(KERN_ERR "wf_sat_create: couldn't create "319319+ "%s sensor %d (no memory)\n", name, cpu);320320+ continue;321321+ }322322+ sens->index = index;323323+ sens->index2 = -1;324324+ sens->shift = shift;325325+ sens->sat = sat;326326+ atomic_inc(&sat->refcnt);327327+ sens->sens.ops = &wf_sat_ops;328328+ sens->sens.name = (char *) (sens + 1);329329+ snprintf(sens->sens.name, 16, "%s-%d", name, cpu);330330+331331+ if (wf_register_sensor(&sens->sens)) {332332+ atomic_dec(&sat->refcnt);333333+ kfree(sens);334334+ }335335+ }336336+337337+ /* make the power sensors */338338+ for (core = 0; core < 2; ++core) {339339+ if (vsens[core] < 0 || isens[core] < 0)340340+ continue;341341+ cpu = 2 * sat->nr + core;342342+ sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL);343343+ if (sens == NULL) {344344+ printk(KERN_ERR "wf_sat_create: couldn't create power "345345+ "sensor %d (no memory)\n", cpu);346346+ continue;347347+ }348348+ sens->index = vsens[core];349349+ sens->index2 = isens[core];350350+ sens->shift = 0;351351+ sens->sat = sat;352352+ atomic_inc(&sat->refcnt);353353+ sens->sens.ops = &wf_sat_ops;354354+ sens->sens.name = (char *) (sens + 1);355355+ snprintf(sens->sens.name, 16, "cpu-power-%d", cpu);356356+357357+ if (wf_register_sensor(&sens->sens)) {358358+ atomic_dec(&sat->refcnt);359359+ kfree(sens);360360+ }361361+ }362362+363363+ if (sat->nr >= 0)364364+ sats[sat->nr] = sat;365365+366366+ return;367367+368368+ fail:369369+ kfree(sat);370370+}371371+372372+static int wf_sat_attach(struct i2c_adapter *adapter)373373+{374374+ struct device_node *busnode, *dev = NULL;375375+ struct pmac_i2c_bus *bus;376376+377377+ bus = pmac_i2c_adapter_to_bus(adapter);378378+ if (bus == NULL)379379+ return -ENODEV;380380+ busnode = pmac_i2c_get_bus_node(bus);381381+382382+ while ((dev = of_get_next_child(busnode, dev)) != NULL)383383+ if (device_is_compatible(dev, "smu-sat"))384384+ wf_sat_create(adapter, dev);385385+ return 0;386386+}387387+388388+static int wf_sat_detach(struct i2c_client *client)389389+{390390+ struct wf_sat *sat = i2c_to_sat(client);391391+392392+ /* XXX TODO */393393+394394+ sat->i2c.adapter = NULL;395395+ return 0;396396+}397397+398398+static int __init sat_sensors_init(void)399399+{400400+ int err;401401+402402+ err = i2c_add_driver(&wf_sat_driver);403403+ if (err < 0)404404+ return err;405405+ return 0;406406+}407407+408408+static void __exit sat_sensors_exit(void)409409+{410410+ i2c_del_driver(&wf_sat_driver);411411+}412412+413413+module_init(sat_sensors_init);414414+/*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */415415+416416+MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>");417417+MODULE_DESCRIPTION("SMU satellite sensors for PowerMac thermal control");418418+MODULE_LICENSE("GPL");
+23-20
drivers/macintosh/windfarm_smu_sensors.c
···220220 !strcmp(l, "CPU T-Diode")) {221221 ads->sens.ops = &smu_cputemp_ops;222222 ads->sens.name = "cpu-temp";223223+ if (cpudiode == NULL) {224224+ DBG("wf: cpudiode partition (%02x) not found\n",225225+ SMU_SDB_CPUDIODE_ID);226226+ goto fail;227227+ }223228 } else if (!strcmp(c, "current-sensor") &&224229 !strcmp(l, "CPU Current")) {225230 ads->sens.ops = &smu_cpuamp_ops;226231 ads->sens.name = "cpu-current";232232+ if (cpuvcp == NULL) {233233+ DBG("wf: cpuvcp partition (%02x) not found\n",234234+ SMU_SDB_CPUVCP_ID);235235+ goto fail;236236+ }227237 } else if (!strcmp(c, "voltage-sensor") &&228238 !strcmp(l, "CPU Voltage")) {229239 ads->sens.ops = &smu_cpuvolt_ops;230240 ads->sens.name = "cpu-voltage";241241+ if (cpuvcp == NULL) {242242+ DBG("wf: cpuvcp partition (%02x) not found\n",243243+ SMU_SDB_CPUVCP_ID);244244+ goto fail;245245+ }231246 } else if (!strcmp(c, "power-sensor") &&232247 !strcmp(l, "Slots Power")) {233248 ads->sens.ops = &smu_slotspow_ops;···380365 return NULL;381366}382367383383-static int smu_fetch_param_partitions(void)368368+static void smu_fetch_param_partitions(void)384369{385370 struct smu_sdbp_header *hdr;386371387372 /* Get CPU voltage/current/power calibration data */388373 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL);389389- if (hdr == NULL) {390390- DBG("wf: cpuvcp partition (%02x) not found\n",391391- SMU_SDB_CPUVCP_ID);392392- return -ENODEV;374374+ if (hdr != NULL) {375375+ cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];376376+ /* Keep version around */377377+ cpuvcp_version = hdr->version;393378 }394394- cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1];395395- /* Keep version around */396396- cpuvcp_version = hdr->version;397379398380 /* Get CPU diode calibration data */399381 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL);400400- if (hdr == NULL) {401401- DBG("wf: cpudiode partition (%02x) not found\n",402402- SMU_SDB_CPUDIODE_ID);403403- return -ENODEV;404404- }405405- cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];382382+ if (hdr != NULL)383383+ cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1];406384407385 /* Get slots power calibration data if any */408386 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL);···406398 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL);407399 if (hdr != NULL)408400 debugswitches = (u8 *)&hdr[1];409409-410410- return 0;411401}412402413403static int __init smu_sensors_init(void)414404{415405 struct device_node *smu, *sensors, *s;416406 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL;417417- int rc;418407419408 if (!smu_present())420409 return -ENODEV;421410422411 /* Get parameters partitions */423423- rc = smu_fetch_param_partitions();424424- if (rc)425425- return rc;412412+ smu_fetch_param_partitions();426413427414 smu = of_find_node_by_type(NULL, "smu");428415 if (smu == NULL)
···6565 depends on SOC_AU1X00 && MMC6666 help6767 This selects the AMD Alchemy(R) Multimedia card interface.6868- iIf you have a Alchemy platform with a MMC slot, say Y or M here.6868+ If you have a Alchemy platform with a MMC slot, say Y or M here.69697070 If unsure, say N.7171
+1-1
drivers/mtd/chips/Kconfig
···301301302302config MTD_XIP303303 bool "XIP aware MTD support"304304- depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM304304+ depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP305305 default y if XIP_KERNEL306306 help307307 This allows MTD support to work with flash memory which is also
+1-1
drivers/net/7990.c
···2929#include <linux/slab.h>3030#include <linux/string.h>3131#include <linux/skbuff.h>3232-#include <linux/irq.h>3232+#include <asm/irq.h>3333/* Used for the temporal inet entries and routing */3434#include <linux/socket.h>3535#include <linux/bitops.h>
+1-1
drivers/net/82596.c
···614614static int init_i596_mem(struct net_device *dev)615615{616616 struct i596_private *lp = dev->priv;617617-#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET)617617+#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) || defined(ENABLE_APRICOT)618618 short ioaddr = dev->base_addr;619619#endif620620 unsigned long flags;
···9797 "must specify the shmem and irq!\n");9898 return -ENODEV;9999 }100100+ if (dev->dev_addr[0] == 0) {101101+ BUGMSG(D_NORMAL, "You need to specify your card's station "102102+ "ID!\n");103103+ return -ENODEV;104104+ }100105 /*101101- * Grab the memory region at mem_start for BUFFER_SIZE bytes.106106+ * Grab the memory region at mem_start for MIRROR_SIZE bytes.102107 * Later in arcrimi_found() the real size will be determined103108 * and this reserve will be released and the correct size104109 * will be taken.105110 */106106- if (!request_mem_region(dev->mem_start, BUFFER_SIZE, "arcnet (90xx)")) {111111+ if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) {107112 BUGMSG(D_NORMAL, "Card memory already allocated\n");108108- return -ENODEV;109109- }110110- if (dev->dev_addr[0] == 0) {111111- release_mem_region(dev->mem_start, BUFFER_SIZE);112112- BUGMSG(D_NORMAL, "You need to specify your card's station "113113- "ID!\n");114113 return -ENODEV;115114 }116115 return arcrimi_found(dev);117116}118117118118+static int check_mirror(unsigned long addr, size_t size)119119+{120120+ void __iomem *p;121121+ int res = -1;122122+123123+ if (!request_mem_region(addr, size, "arcnet (90xx)"))124124+ return -1;125125+126126+ p = ioremap(addr, size);127127+ if (p) {128128+ if (readb(p) == TESTvalue)129129+ res = 1;130130+ else131131+ res = 0;132132+ iounmap(p);133133+ }134134+135135+ release_mem_region(addr, size);136136+ return res;137137+}119138120139/*121140 * Set up the struct net_device associated with this card. Called after···144125{145126 struct arcnet_local *lp;146127 unsigned long first_mirror, last_mirror, shmem;128128+ void __iomem *p;147129 int mirror_size;148130 int err;149131132132+ p = ioremap(dev->mem_start, MIRROR_SIZE);133133+ if (!p) {134134+ release_mem_region(dev->mem_start, MIRROR_SIZE);135135+ BUGMSG(D_NORMAL, "Can't ioremap\n");136136+ return -ENODEV;137137+ }138138+150139 /* reserve the irq */151140 if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) {152152- release_mem_region(dev->mem_start, BUFFER_SIZE);141141+ iounmap(p);142142+ release_mem_region(dev->mem_start, MIRROR_SIZE);153143 BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);154144 return -ENODEV;155145 }156146157147 shmem = dev->mem_start;158158- isa_writeb(TESTvalue, shmem);159159- isa_writeb(dev->dev_addr[0], shmem + 1); /* actually the node ID */148148+ writeb(TESTvalue, p);149149+ writeb(dev->dev_addr[0], p + 1); /* actually the node ID */160150161151 /* find the real shared memory start/end points, including mirrors */162152···174146 * 2k (or there are no mirrors at all) but on some, it's 4k.175147 */176148 mirror_size = MIRROR_SIZE;177177- if (isa_readb(shmem) == TESTvalue178178- && isa_readb(shmem - mirror_size) != TESTvalue179179- && isa_readb(shmem - 2 * mirror_size) == TESTvalue)180180- mirror_size *= 2;149149+ if (readb(p) == TESTvalue150150+ && check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0151151+ && check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1)152152+ mirror_size = 2 * MIRROR_SIZE;181153182182- first_mirror = last_mirror = shmem;183183- while (isa_readb(first_mirror) == TESTvalue)154154+ first_mirror = shmem - mirror_size;155155+ while (check_mirror(first_mirror, mirror_size) == 1)184156 first_mirror -= mirror_size;185157 first_mirror += mirror_size;186158187187- while (isa_readb(last_mirror) == TESTvalue)159159+ last_mirror = shmem + mirror_size;160160+ while (check_mirror(last_mirror, mirror_size) == 1)188161 last_mirror += mirror_size;189162 last_mirror -= mirror_size;190163···210181 * with the correct size. There is a VERY slim chance this could211182 * fail.212183 */213213- release_mem_region(shmem, BUFFER_SIZE);184184+ iounmap(p);185185+ release_mem_region(shmem, MIRROR_SIZE);214186 if (!request_mem_region(dev->mem_start,215187 dev->mem_end - dev->mem_start + 1,216188 "arcnet (90xx)")) {
+94-38
drivers/net/arcnet/com90xx.c
···535354545555/* Internal function declarations */5656-static int com90xx_found(int ioaddr, int airq, u_long shmem);5656+static int com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *);5757static void com90xx_command(struct net_device *dev, int command);5858static int com90xx_status(struct net_device *dev);5959static void com90xx_setmask(struct net_device *dev, int mask);···116116 unsigned long airqmask;117117 int ports[(0x3f0 - 0x200) / 16 + 1] =118118 {0};119119- u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] =120120- {0};119119+ unsigned long *shmems;120120+ void __iomem **iomem;121121 int numports, numshmems, *port;122122 u_long *p;123123+ int index;123124124125 if (!io && !irq && !shmem && !*device && com90xx_skip_probe)125126 return;127127+128128+ shmems = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(unsigned long),129129+ GFP_KERNEL);130130+ if (!shmems)131131+ return;132132+ iomem = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(void __iomem *),133133+ GFP_KERNEL);134134+ if (!iomem) {135135+ kfree(shmems);136136+ return;137137+ }126138127139 BUGLVL(D_NORMAL) printk(VERSION);128140···191179192180 if (!numports) {193181 BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n");182182+ kfree(shmems);183183+ kfree(iomem);194184 return;195185 }196186 /* Stage 2: we have now reset any possible ARCnet cards, so we can't···216202 * 0xD1 byte in the right place, or are read-only.217203 */218204 numprint = -1;219219- for (p = &shmems[0]; p < shmems + numshmems; p++) {220220- u_long ptr = *p;205205+ for (index = 0, p = &shmems[0]; index < numshmems; p++, index++) {206206+ void __iomem *base;221207222208 numprint++;223209 numprint %= 8;···227213 }228214 BUGMSG2(D_INIT, "%lXh ", *p);229215230230- if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) {216216+ if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) {231217 BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n");232218 BUGMSG2(D_INIT_REASONS, "Stage 3: ");233219 BUGLVL(D_INIT_REASONS) numprint = 0;234234- *p-- = shmems[--numshmems];235235- continue;220220+ goto out;236221 }237237- if (isa_readb(ptr) != TESTvalue) {222222+ base = ioremap(*p, MIRROR_SIZE);223223+ if (!base) {224224+ BUGMSG2(D_INIT_REASONS, "(ioremap)\n");225225+ BUGMSG2(D_INIT_REASONS, "Stage 3: ");226226+ BUGLVL(D_INIT_REASONS) numprint = 0;227227+ goto out1;228228+ }229229+ if (readb(base) != TESTvalue) {238230 BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n",239239- isa_readb(ptr), TESTvalue);231231+ readb(base), TESTvalue);240232 BUGMSG2(D_INIT_REASONS, "S3: ");241233 BUGLVL(D_INIT_REASONS) numprint = 0;242242- release_mem_region(*p, BUFFER_SIZE);243243- *p-- = shmems[--numshmems];244244- continue;234234+ goto out2;245235 }246236 /* By writing 0x42 to the TESTvalue location, we also make247237 * sure no "mirror" shmem areas show up - if they occur248238 * in another pass through this loop, they will be discarded249239 * because *cptr != TESTvalue.250240 */251251- isa_writeb(0x42, ptr);252252- if (isa_readb(ptr) != 0x42) {241241+ writeb(0x42, base);242242+ if (readb(base) != 0x42) {253243 BUGMSG2(D_INIT_REASONS, "(read only)\n");254244 BUGMSG2(D_INIT_REASONS, "S3: ");255255- release_mem_region(*p, BUFFER_SIZE);256256- *p-- = shmems[--numshmems];257257- continue;245245+ goto out2;258246 }259247 BUGMSG2(D_INIT_REASONS, "\n");260248 BUGMSG2(D_INIT_REASONS, "S3: ");261249 BUGLVL(D_INIT_REASONS) numprint = 0;250250+ iomem[index] = base;251251+ continue;252252+ out2:253253+ iounmap(base);254254+ out1:255255+ release_mem_region(*p, MIRROR_SIZE);256256+ out:257257+ *p-- = shmems[--numshmems];258258+ index--;262259 }263260 BUGMSG2(D_INIT, "\n");264261···277252 BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n");278253 for (port = &ports[0]; port < ports + numports; port++)279254 release_region(*port, ARCNET_TOTAL_SIZE);255255+ kfree(shmems);256256+ kfree(iomem);280257 return;281258 }282259 /* Stage 4: something of a dummy, to report the shmems that are···378351 mdelay(RESETtime);379352 } else {380353 /* just one shmem and port, assume they match */381381- isa_writeb(TESTvalue, shmems[0]);354354+ writeb(TESTvalue, iomem[0]);382355 }383356#else384357 inb(_RESET);385358 mdelay(RESETtime);386359#endif387360388388- for (p = &shmems[0]; p < shmems + numshmems; p++) {389389- u_long ptr = *p;361361+ for (index = 0; index < numshmems; index++) {362362+ u_long ptr = shmems[index];363363+ void __iomem *base = iomem[index];390364391391- if (isa_readb(ptr) == TESTvalue) { /* found one */365365+ if (readb(base) == TESTvalue) { /* found one */392366 BUGMSG2(D_INIT, "%lXh)\n", *p);393367 openparen = 0;394368395369 /* register the card */396396- if (com90xx_found(*port, airq, *p) == 0)370370+ if (com90xx_found(*port, airq, ptr, base) == 0)397371 found = 1;398372 numprint = -1;399373400374 /* remove shmem from the list */401401- *p = shmems[--numshmems];375375+ shmems[index] = shmems[--numshmems];376376+ iomem[index] = iomem[numshmems];402377 break; /* go to the next I/O port */403378 } else {404404- BUGMSG2(D_INIT_REASONS, "%Xh-", isa_readb(ptr));379379+ BUGMSG2(D_INIT_REASONS, "%Xh-", readb(base));405380 }406381 }407382···420391 BUGLVL(D_INIT_REASONS) printk("\n");421392422393 /* Now put back TESTvalue on all leftover shmems. */423423- for (p = &shmems[0]; p < shmems + numshmems; p++) {424424- isa_writeb(TESTvalue, *p);425425- release_mem_region(*p, BUFFER_SIZE);394394+ for (index = 0; index < numshmems; index++) {395395+ writeb(TESTvalue, iomem[index]);396396+ iounmap(iomem[index]);397397+ release_mem_region(shmems[index], MIRROR_SIZE);426398 }399399+ kfree(shmems);400400+ kfree(iomem);427401}428402403403+static int check_mirror(unsigned long addr, size_t size)404404+{405405+ void __iomem *p;406406+ int res = -1;407407+408408+ if (!request_mem_region(addr, size, "arcnet (90xx)"))409409+ return -1;410410+411411+ p = ioremap(addr, size);412412+ if (p) {413413+ if (readb(p) == TESTvalue)414414+ res = 1;415415+ else416416+ res = 0;417417+ iounmap(p);418418+ }419419+420420+ release_mem_region(addr, size);421421+ return res;422422+}429423430424/* Set up the struct net_device associated with this card. Called after431425 * probing succeeds.432426 */433433-static int __init com90xx_found(int ioaddr, int airq, u_long shmem)427427+static int __init com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *p)434428{435429 struct net_device *dev = NULL;436430 struct arcnet_local *lp;···464412 dev = alloc_arcdev(device);465413 if (!dev) {466414 BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n");467467- release_mem_region(shmem, BUFFER_SIZE);415415+ iounmap(p);416416+ release_mem_region(shmem, MIRROR_SIZE);468417 return -ENOMEM;469418 }470419 lp = dev->priv;···476423 * 2k (or there are no mirrors at all) but on some, it's 4k.477424 */478425 mirror_size = MIRROR_SIZE;479479- if (isa_readb(shmem) == TESTvalue480480- && isa_readb(shmem - mirror_size) != TESTvalue481481- && isa_readb(shmem - 2 * mirror_size) == TESTvalue)482482- mirror_size *= 2;426426+ if (readb(p) == TESTvalue &&427427+ check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 &&428428+ check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1)429429+ mirror_size = 2 * MIRROR_SIZE;483430484484- first_mirror = last_mirror = shmem;485485- while (isa_readb(first_mirror) == TESTvalue)431431+ first_mirror = shmem - mirror_size;432432+ while (check_mirror(first_mirror, mirror_size) == 1)486433 first_mirror -= mirror_size;487434 first_mirror += mirror_size;488435489489- while (isa_readb(last_mirror) == TESTvalue)436436+ last_mirror = shmem + mirror_size;437437+ while (check_mirror(last_mirror, mirror_size) == 1)490438 last_mirror += mirror_size;491439 last_mirror -= mirror_size;492440493441 dev->mem_start = first_mirror;494442 dev->mem_end = last_mirror + MIRROR_SIZE - 1;495443496496- release_mem_region(shmem, BUFFER_SIZE);444444+ iounmap(p);445445+ release_mem_region(shmem, MIRROR_SIZE);446446+497447 if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)"))498448 goto err_free_dev;499449
···31313232/* RGMII device */3333struct ibm_ocp_rgmii {3434- struct rgmii_regs *base;3434+ struct rgmii_regs __iomem *base;3535 int users; /* number of EMACs using this RGMII bridge */3636};3737
+3-4
drivers/net/ibm_emac/ibm_emac_zmii.c
···8080static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode)8181{8282 struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev);8383- struct zmii_regs *p;8383+ struct zmii_regs __iomem *p;84848585 ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode);8686···9494 }9595 dev->mode = PHY_MODE_NA;96969797- p = (struct zmii_regs *)ioremap(ocpdev->def->paddr,9898- sizeof(struct zmii_regs));9797+ p = ioremap(ocpdev->def->paddr, sizeof(struct zmii_regs));9998 if (!p) {10099 printk(KERN_ERR101100 "zmii%d: could not ioremap device registers!\n",···230231 if (!--dev->users) {231232 /* Free everything if this is the last user */232233 ocp_set_drvdata(ocpdev, NULL);233233- iounmap((void *)dev->base);234234+ iounmap(dev->base);234235 kfree(dev);235236 }236237}
+1-1
drivers/net/ibm_emac/ibm_emac_zmii.h
···32323333/* ZMII device */3434struct ibm_ocp_zmii {3535- struct zmii_regs *base;3535+ struct zmii_regs __iomem *base;3636 int mode; /* subset of PHY_MODE_XXXX */3737 int users; /* number of EMACs using this ZMII bridge */3838 u32 fer_save; /* FER value left by firmware */
···748748 if (essid->length) {749749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */750750 /* if it is to big, trunk it */751751- dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length);751751+ dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length);752752 } else {753753 dwrq->flags = 0;754754 dwrq->length = 0;
···16791679sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)16801680{16811681 int sg_bufflen = tablesize * sizeof(struct scatterlist);16821682- unsigned int gfp_flags = GFP_ATOMIC | __GFP_NOWARN;16821682+ gfp_t gfp_flags = GFP_ATOMIC | __GFP_NOWARN;1683168316841684 /*16851685 * TODO: test without low_dma, we should not need it since
···332332 * Make sure that we do not overflow the buffer333333 */334334 if (tty_request_buffer_room(tty, 1) == 0) {335335- schedule_work(&tty->flip.work);335335+ tty_schedule_flip(tty);336336 return;337337 }338338···353353 } while((rx = uart->urx.w) & URX_DATA_READY);354354#endif355355356356- schedule_work(&tty->flip.work);356356+ tty_schedule_flip(tty);357357358358clear_and_exit:359359 return;
+2-2
drivers/serial/68360serial.c
···509509510510 info->rx_cur = (QUICC_BD *)bdp;511511512512- schedule_work(&tty->flip.work);512512+ tty_schedule_flip(tty);513513}514514515515static _INLINE_ void receive_break(ser_info_t *info)···521521 * the break. If not, we exit now, losing the break. FIXME522522 */523523 tty_insert_flip_char(tty, 0, TTY_BREAK);524524- schedule_work(&tty->flip.work);524524+ tty_schedule_flip(tty);525525}526526527527static _INLINE_ void transmit_chars(ser_info_t *info)
···892892 int ret = 0;893893894894 switch (up->port.iotype) {895895- case SERIAL_IO_MEM:895895+ case UPIO_MEM:896896 if (up->port.mapbase) {897897 *res = request_mem_region(up->port.mapbase, size, "serial");898898 if (!*res)···900900 }901901 break;902902903903- case SERIAL_IO_HUB6:904904- case SERIAL_IO_PORT:903903+ case UPIO_HUB6:904904+ case UPIO_PORT:905905 *res = request_region(up->port.iobase, size, "serial");906906 if (!*res)907907 ret = -EBUSY;···919919 size <<= up->port.regshift;920920921921 switch (up->port.iotype) {922922- case SERIAL_IO_MEM:922922+ case UPIO_MEM:923923 if (up->port.mapbase) {924924 /*925925 * Unmap the area.···935935 }936936 break;937937938938- case SERIAL_IO_HUB6:939939- case SERIAL_IO_PORT:938938+ case UPIO_HUB6:939939+ case UPIO_PORT:940940 start = up->port.iobase;941941942942 if (size)
···215215 /* Lower and upper byte of baud rate generator divisor. */216216 write_zsreg(channel, R12, regs[R12]);217217 write_zsreg(channel, R13, regs[R13]);218218-218218+219219 /* Now rewrite R14, with BRENAB (if set). */220220 write_zsreg(channel, R14, regs[R14]);221221···571571 else572572 clear_bits |= DTR;573573574574- /* NOTE: Not subject to 'transmitter active' rule. */ 574574+ /* NOTE: Not subject to 'transmitter active' rule. */575575 up->curregs[R5] |= set_bits;576576 up->curregs[R5] &= ~clear_bits;577577 write_zsreg(channel, R5, up->curregs[R5]);···654654 if (new_reg != up->curregs[R15]) {655655 up->curregs[R15] = new_reg;656656657657- /* NOTE: Not subject to 'transmitter active' rule. */ 657657+ /* NOTE: Not subject to 'transmitter active' rule. */658658 write_zsreg(channel, R15, up->curregs[R15]);659659 }660660}···680680 if (new_reg != up->curregs[R5]) {681681 up->curregs[R5] = new_reg;682682683683- /* NOTE: Not subject to 'transmitter active' rule. */ 683683+ /* NOTE: Not subject to 'transmitter active' rule. */684684 write_zsreg(channel, R5, up->curregs[R5]);685685 }686686
+1-1
drivers/serial/m32r_sio.c
···8080#include <asm/serial.h>81818282/* Standard COM flags */8383-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)8383+#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)84848585/*8686 * SERIAL_PORT_DFNS tells us about built-in ports that have no
+1-1
drivers/serial/m32r_sio.h
···3737 unsigned int irq;3838 unsigned int flags;3939 unsigned char io_type;4040- unsigned char *iomem_base;4040+ unsigned char __iomem *iomem_base;4141 unsigned short iomem_reg_shift;4242};4343
+6-10
drivers/serial/mcfserial.c
···5757 * keep going. Perhaps one day the cflag settings for the5858 * console can be used instead.5959 */6060-#if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \6161- defined(CONFIG_senTec) || defined(CONFIG_SNEHA)6262-#define CONSOLE_BAUD_RATE 192006363-#define DEFAULT_CBAUD B192006464-#endif6565-6660#if defined(CONFIG_HW_FEITH)6761#define CONSOLE_BAUD_RATE 384006862#define DEFAULT_CBAUD B384006969-#endif7070-7171-#if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)6363+#elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)7264#define CONSOLE_BAUD_RATE 1152007365#define DEFAULT_CBAUD B1152006666+#elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \6767+ defined(CONFIG_senTec) || defined(CONFIG_SNEHA)6868+#define CONSOLE_BAUD_RATE 192006969+#define DEFAULT_CBAUD B192007470#endif75717672#ifndef CONSOLE_BAUD_RATE···346350 }347351 tty_insert_flip_char(tty, ch, flag);348352 }349349- tty_flip_buffer_push(tty);353353+ tty_schedule_flip(tty);350354 return;351355}352356
···161161162162/* we can support 3 uarts, but not always use them */163163164164+#ifdef CONFIG_CPU_S3C2400165165+#define NR_PORTS (2)166166+#else164167#define NR_PORTS (3)168168+#endif165169166170/* port irq numbers */167171
···496496497497 port->ops = &v850e_uart_ops;498498 port->line = chan;499499- port->iotype = SERIAL_IO_MEM;499499+ port->iotype = UPIO_MEM;500500 port->flags = UPF_BOOT_AUTOCONF;501501502502 /* We actually use multiple IRQs, but the serial
···7575 inexpensive battery powered microcontroller evaluation board.7676 This same cable can be used to flash new firmware.77777878-config SPI_BUTTERFLY7979- tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)"8080- depends on SPI_MASTER && PARPORT && EXPERIMENTAL8181- select SPI_BITBANG8282- help8383- This uses a custom parallel port cable to connect to an AVR8484- Butterfly <http://www.atmel.com/products/avr/butterfly>, an8585- inexpensive battery powered microcontroller evaluation board.8686- This same cable can be used to flash new firmware.8787-8878#8979# Add new SPI master controllers in alphabetical order above this line9080#
+17-19
drivers/spi/spi_butterfly.c
···163163 struct butterfly *pp = spidev_to_pp(spi);164164165165 /* set default clock polarity */166166- if (value)166166+ if (value != BITBANG_CS_INACTIVE)167167 setsck(spi, spi->mode & SPI_CPOL);168168169169 /* no chipselect on this USI link config */170170 if (is_usidev(spi))171171 return;172172173173- /* here, value == "activate or not" */174174-175175- /* most PARPORT_CONTROL_* bits are negated */173173+ /* here, value == "activate or not";174174+ * most PARPORT_CONTROL_* bits are negated, so we must175175+ * morph it to value == "bit value to write in control register"176176+ */176177 if (spi_cs_bit == PARPORT_CONTROL_INIT)177178 value = !value;178178-179179- /* here, value == "bit value to write in control register" */180179181180 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);182181}···201202202203/* override default partitioning with cmdlinepart */203204static struct mtd_partition partitions[] = { {204204- /* JFFS2 wants partitions of 4*N blocks for this device ... */205205+ /* JFFS2 wants partitions of 4*N blocks for this device,206206+ * so sectors 0 and 1 can't be partitions by themselves.207207+ */205208206209 /* sector 0 = 8 pages * 264 bytes/page (1 block)207210 * sector 1 = 248 pages * 264 bytes/page···317316 if (status < 0)318317 goto clean2;319318320320- /* Bus 1 lets us talk to at45db041b (firmware disables AVR)321321- * or AVR (firmware resets at45, acts as spi slave)319319+ /* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR320320+ * (firmware resets at45, acts as spi slave) or neither (we ignore321321+ * both, AVR uses AT45). Here we expect firmware for the first option.322322 */323323 pp->info[0].max_speed_hz = 15 * 1000 * 1000;324324 strcpy(pp->info[0].modalias, "mtd_dataflash");···332330 pp->dataflash->dev.bus_id);333331334332#ifdef HAVE_USI335335- /* even more custom AVR firmware */333333+ /* Bus 2 is only for talking to the AVR, and it can work no334334+ * matter who masters bus 1; needs appropriate AVR firmware.335335+ */336336 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000;337337 strcpy(pp->info[1].modalias, "butterfly");338338 // pp->info[1].platform_data = ... TBD ... ;···382378 pp = butterfly;383379 butterfly = NULL;384380385385-#ifdef HAVE_USI386386- spi_unregister_device(pp->butterfly);387387- pp->butterfly = NULL;388388-#endif389389- spi_unregister_device(pp->dataflash);390390- pp->dataflash = NULL;391391-381381+ /* stop() unregisters child devices too */382382+ pdev = to_platform_device(pp->bitbang.master->cdev.dev);392383 status = spi_bitbang_stop(&pp->bitbang);393384394385 /* turn off VCC */···392393393394 parport_release(pp->pd);394395 parport_unregister_device(pp->pd);395395-396396- pdev = to_platform_device(pp->bitbang.master->cdev.dev);397396398397 (void) spi_master_put(pp->bitbang.master);399398···417420}418421module_exit(butterfly_exit);419422423423+MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly");420424MODULE_LICENSE("GPL");
···931931static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)932932{933933 int err, i;934934- sg_req_info_t *r;935935- struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg;934934+ sg_req_info_t __user *r;935935+ struct compat_sg_req_info __user *o = (void __user *)arg;936936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);937937 err = sys_ioctl(fd,cmd,(unsigned long)r);938938 if (err < 0)···27392739static int27402740lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)27412741{27422742- struct compat_timeval *tc = (struct compat_timeval *)arg;27432743- struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval));27422742+ struct compat_timeval __user *tc = (struct compat_timeval __user *)arg;27432743+ struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval));27442744 struct timeval ts;27452745 if (get_user(ts.tv_sec, &tc->tv_sec) ||27462746 get_user(ts.tv_usec, &tc->tv_usec) ||
+3-3
fs/debugfs/file.c
···5656DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");57575858/**5959- * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.5959+ * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value.6060 *6161 * @name: a pointer to a string containing the name of the file to create.6262 * @mode: the permission that the file should have···9898DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");9999100100/**101101- * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.101101+ * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value.102102 *103103 * @name: a pointer to a string containing the name of the file to create.104104 * @mode: the permission that the file should have···140140DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");141141142142/**143143- * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value.143143+ * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value.144144 *145145 * @name: a pointer to a string containing the name of the file to create.146146 * @mode: the permission that the file should have
+1-1
fs/inotify.c
···967967 mask_add = 1;968968969969 /* don't let user-space set invalid bits: we don't want flags set */970970- mask &= IN_ALL_EVENTS;970970+ mask &= IN_ALL_EVENTS | IN_ONESHOT;971971 if (unlikely(!mask)) {972972 ret = -EINVAL;973973 goto out;
···494494 p->mnt_namespace = NULL;495495 list_del_init(&p->mnt_child);496496 if (p->mnt_parent != p)497497- mnt->mnt_mountpoint->d_mounted--;497497+ p->mnt_mountpoint->d_mounted--;498498 change_mnt_propagation(p, MS_PRIVATE);499499 }500500}···13251325 return retval;13261326}1327132713281328-int copy_namespace(int flags, struct task_struct *tsk)13281328+/*13291329+ * Allocate a new namespace structure and populate it with contents13301330+ * copied from the namespace of the passed in task structure.13311331+ */13321332+struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)13291333{13301334 struct namespace *namespace = tsk->namespace;13311335 struct namespace *new_ns;13321336 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;13331333- struct fs_struct *fs = tsk->fs;13341337 struct vfsmount *p, *q;13351335-13361336- if (!namespace)13371337- return 0;13381338-13391339- get_namespace(namespace);13401340-13411341- if (!(flags & CLONE_NEWNS))13421342- return 0;13431343-13441344- if (!capable(CAP_SYS_ADMIN)) {13451345- put_namespace(namespace);13461346- return -EPERM;13471347- }1348133813491339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);13501340 if (!new_ns)···13861396 }13871397 up_write(&namespace_sem);1388139813891389- tsk->namespace = new_ns;13901390-13911399 if (rootmnt)13921400 mntput(rootmnt);13931401 if (pwdmnt)···13931405 if (altrootmnt)13941406 mntput(altrootmnt);1395140713961396- put_namespace(namespace);13971397- return 0;14081408+out:14091409+ return new_ns;14101410+}14111411+14121412+int copy_namespace(int flags, struct task_struct *tsk)14131413+{14141414+ struct namespace *namespace = tsk->namespace;14151415+ struct namespace *new_ns;14161416+ int err = 0;14171417+14181418+ if (!namespace)14191419+ return 0;14201420+14211421+ get_namespace(namespace);14221422+14231423+ if (!(flags & CLONE_NEWNS))14241424+ return 0;14251425+14261426+ if (!capable(CAP_SYS_ADMIN)) {14271427+ err = -EPERM;14281428+ goto out;14291429+ }14301430+14311431+ new_ns = dup_namespace(tsk, tsk->fs);14321432+ if (!new_ns) {14331433+ err = -ENOMEM;14341434+ goto out;14351435+ }14361436+14371437+ tsk->namespace = new_ns;1398143813991439out:14001440 put_namespace(namespace);14011401- return -ENOMEM;14411441+ return err;14021442}1403144314041444asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name,
+2-1
fs/nfs/nfsroot.c
···465465 "number from server, using default\n");466466 port = nfsd_port;467467 }468468- nfs_port = htons(port);468468+ nfs_port = port;469469 dprintk("Root-NFS: Portmapper on server returned %d "470470 "as nfsd port\n", port);471471 }472472+ nfs_port = htons(nfs_port);472473473474 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) {474475 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
+4-2
fs/nfsd/nfs4proc.c
···195195196196 /* Openowner is now set, so sequence id will get bumped. Now we need197197 * these checks before we do any creates: */198198+ status = nfserr_grace;198199 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS)199199- return nfserr_grace;200200+ goto out;201201+ status = nfserr_no_grace;200202 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)201201- return nfserr_no_grace;203203+ goto out;202204203205 switch (open->op_claim_type) {204206 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
-1
fs/reiserfs/hashes.c
···2121#include <linux/kernel.h>2222#include <linux/reiserfs_fs.h>2323#include <asm/types.h>2424-#include <asm/bug.h>25242625#define DELTA 0x9E3779B92726#define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
···247247248248 /* Forget any remaining inodes */249249 if (invalidate_inodes(sb)) {250250- printk("VFS: Busy inodes after unmount. "251251- "Self-destruct in 5 seconds. Have a nice day...\n");250250+ printk("VFS: Busy inodes after unmount of %s. "251251+ "Self-destruct in 5 seconds. Have a nice day...\n",252252+ sb->s_id);252253 }253254254255 unlock_kernel();
···673673 if (ia_valid & ATTR_ATIME) {674674 vattr.va_mask |= XFS_AT_ATIME;675675 vattr.va_atime = attr->ia_atime;676676+ if (ia_valid & ATTR_ATIME_SET)677677+ inode->i_atime = attr->ia_atime;676678 }677679 if (ia_valid & ATTR_MTIME) {678680 vattr.va_mask |= XFS_AT_MTIME;
+1-1
include/asm-alpha/system.h
···572572 if something tries to do an invalid cmpxchg(). */573573extern void __cmpxchg_called_with_bad_pointer(void);574574575575-static inline unsigned long575575+static __always_inline unsigned long576576__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)577577{578578 switch (size) {
···2323 * simply bail out immediately through the slow path where the lock will be2424 * reattempted until it succeeds.2525 */2626-#define __mutex_fastpath_lock(count, fail_fn) \2727-do { \2828- int __ex_flag, __res; \2929- \3030- typecheck(atomic_t *, count); \3131- typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \3232- \3333- __asm__ ( \3434- "ldrex %0, [%2] \n" \3535- "sub %0, %0, #1 \n" \3636- "strex %1, %0, [%2] \n" \3737- \3838- : "=&r" (__res), "=&r" (__ex_flag) \3939- : "r" (&(count)->counter) \4040- : "cc","memory" ); \4141- \4242- if (unlikely(__res || __ex_flag)) \4343- fail_fn(count); \4444-} while (0)2626+static inline void2727+__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))2828+{2929+ int __ex_flag, __res;45304646-#define __mutex_fastpath_lock_retval(count, fail_fn) \4747-({ \4848- int __ex_flag, __res; \4949- \5050- typecheck(atomic_t *, count); \5151- typecheck_fn(fastcall int (*)(atomic_t *), fail_fn); \5252- \5353- __asm__ ( \5454- "ldrex %0, [%2] \n" \5555- "sub %0, %0, #1 \n" \5656- "strex %1, %0, [%2] \n" \5757- \5858- : "=&r" (__res), "=&r" (__ex_flag) \5959- : "r" (&(count)->counter) \6060- : "cc","memory" ); \6161- \6262- __res |= __ex_flag; \6363- if (unlikely(__res != 0)) \6464- __res = fail_fn(count); \6565- __res; \6666-})3131+ __asm__ (3232+3333+ "ldrex %0, [%2] \n\t"3434+ "sub %0, %0, #1 \n\t"3535+ "strex %1, %0, [%2] "3636+3737+ : "=&r" (__res), "=&r" (__ex_flag)3838+ : "r" (&(count)->counter)3939+ : "cc","memory" );4040+4141+ __res |= __ex_flag;4242+ if (unlikely(__res != 0))4343+ fail_fn(count);4444+}4545+4646+static inline int4747+__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))4848+{4949+ int __ex_flag, __res;5050+5151+ __asm__ (5252+5353+ "ldrex %0, [%2] \n\t"5454+ "sub %0, %0, #1 \n\t"5555+ "strex %1, %0, [%2] "5656+5757+ : "=&r" (__res), "=&r" (__ex_flag)5858+ : "r" (&(count)->counter)5959+ : "cc","memory" );6060+6161+ __res |= __ex_flag;6262+ if (unlikely(__res != 0))6363+ __res = fail_fn(count);6464+ return __res;6565+}67666867/*6968 * Same trick is used for the unlock fast path. However the original value,7069 * rather than the result, is used to test for success in order to have7170 * better generated assembly.7271 */7373-#define __mutex_fastpath_unlock(count, fail_fn) \7474-do { \7575- int __ex_flag, __res, __orig; \7676- \7777- typecheck(atomic_t *, count); \7878- typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \7979- \8080- __asm__ ( \8181- "ldrex %0, [%3] \n" \8282- "add %1, %0, #1 \n" \8383- "strex %2, %1, [%3] \n" \8484- \8585- : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) \8686- : "r" (&(count)->counter) \8787- : "cc","memory" ); \8888- \8989- if (unlikely(__orig || __ex_flag)) \9090- fail_fn(count); \9191-} while (0)7272+static inline void7373+__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))7474+{7575+ int __ex_flag, __res, __orig;7676+7777+ __asm__ (7878+7979+ "ldrex %0, [%3] \n\t"8080+ "add %1, %0, #1 \n\t"8181+ "strex %2, %1, [%3] "8282+8383+ : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)8484+ : "r" (&(count)->counter)8585+ : "cc","memory" );8686+8787+ __orig |= __ex_flag;8888+ if (unlikely(__orig != 0))8989+ fail_fn(count);9090+}92919392/*9493 * If the unlock was done on a contended lock, or if the unlock simply fails···109110110111 __asm__ (111112112112- "1: ldrex %0, [%3] \n"113113- "subs %1, %0, #1 \n"114114- "strexeq %2, %1, [%3] \n"115115- "movlt %0, #0 \n"116116- "cmpeq %2, #0 \n"117117- "bgt 1b \n"113113+ "1: ldrex %0, [%3] \n\t"114114+ "subs %1, %0, #1 \n\t"115115+ "strexeq %2, %1, [%3] \n\t"116116+ "movlt %0, #0 \n\t"117117+ "cmpeq %2, #0 \n\t"118118+ "bgt 1b "118119119120 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)120121 : "r" (&count->counter)
+2-1
include/asm-i386/unistd.h
···315315#define __NR_faccessat 307316316#define __NR_pselect6 308317317#define __NR_ppoll 309318318+#define __NR_unshare 310318319319319-#define NR_syscalls 310320320+#define NR_syscalls 311320321321322/*322323 * user-visible error numbers are in the range -1 - -128: see
+1
include/asm-m68knommu/hardirq.h
···44#include <linux/config.h>55#include <linux/cache.h>66#include <linux/threads.h>77+#include <asm/irq.h>7889typedef struct {910 unsigned int __softirq_pending;
+2-2
include/asm-mips/abi.h
···33 * License. See the file "COPYING" in the main directory of this archive44 * for more details.55 *66- * Copyright (C) 2005 by Ralf Baechle66+ * Copyright (C) 2005, 06 by Ralf Baechle (ralf@linux-mips.org)77 * Copyright (C) 2005 MIPS Technologies, Inc.88 */99#ifndef _ASM_ABI_H···1313#include <asm/siginfo.h>14141515struct mips_abi {1616- int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs);1616+ void (* const do_signal)(struct pt_regs *regs);1717 int (* const setup_frame)(struct k_sigaction * ka,1818 struct pt_regs *regs, int signr,1919 sigset_t *set);
+17-18
include/asm-mips/io.h
···1818#include <linux/types.h>19192020#include <asm/addrspace.h>2121-#include <asm/bug.h>2221#include <asm/byteorder.h>2322#include <asm/cpu.h>2423#include <asm/cpu-features.h>···5657 * variations of functions: non-prefixed ones that preserve the value5758 * and prefixed ones that preserve byte addresses. The latters are5859 * typically used for moving raw data between a peripheral and memory (cf.5959- * string I/O functions), hence the "mem_" prefix.6060+ * string I/O functions), hence the "__mem_" prefix.6061 */6162#if defined(CONFIG_SWAP_IO_SPACE)62636364# define ioswabb(x) (x)6464-# define mem_ioswabb(x) (x)6565+# define __mem_ioswabb(x) (x)6566# ifdef CONFIG_SGI_IP226667/*6768 * IP22 seems braindead enough to swap 16bits values in hardware, but6869 * not 32bits. Go figure... Can't tell without documentation.6970 */7071# define ioswabw(x) (x)7171-# define mem_ioswabw(x) le16_to_cpu(x)7272+# define __mem_ioswabw(x) le16_to_cpu(x)7273# else7374# define ioswabw(x) le16_to_cpu(x)7474-# define mem_ioswabw(x) (x)7575+# define __mem_ioswabw(x) (x)7576# endif7677# define ioswabl(x) le32_to_cpu(x)7777-# define mem_ioswabl(x) (x)7878+# define __mem_ioswabl(x) (x)7879# define ioswabq(x) le64_to_cpu(x)7979-# define mem_ioswabq(x) (x)8080+# define __mem_ioswabq(x) (x)80818182#else82838384# define ioswabb(x) (x)8484-# define mem_ioswabb(x) (x)8585+# define __mem_ioswabb(x) (x)8586# define ioswabw(x) (x)8686-# define mem_ioswabw(x) cpu_to_le16(x)8787+# define __mem_ioswabw(x) cpu_to_le16(x)8788# define ioswabl(x) (x)8888-# define mem_ioswabl(x) cpu_to_le32(x)8989+# define __mem_ioswabl(x) cpu_to_le32(x)8990# define ioswabq(x) (x)9090-# define mem_ioswabq(x) cpu_to_le32(x)9191+# define __mem_ioswabq(x) cpu_to_le32(x)91929293#endif9394···342343 BUG(); \343344} \344345 \345345-static inline type pfx##read##bwlq(volatile void __iomem *mem) \346346+static inline type pfx##read##bwlq(const volatile void __iomem *mem) \346347{ \347348 volatile type *__mem; \348349 type __val; \···417418 \418419__BUILD_MEMORY_PFX(__raw_, bwlq, type) \419420__BUILD_MEMORY_PFX(, bwlq, type) \420420-__BUILD_MEMORY_PFX(mem_, bwlq, type) \421421+__BUILD_MEMORY_PFX(__mem_, bwlq, type) \421422422423BUILDIO_MEM(b, u8)423424BUILDIO_MEM(w, u16)···430431431432#define BUILDIO_IOPORT(bwlq, type) \432433 __BUILD_IOPORT_PFX(, bwlq, type) \433433- __BUILD_IOPORT_PFX(mem_, bwlq, type)434434+ __BUILD_IOPORT_PFX(__mem_, bwlq, type)434435435436BUILDIO_IOPORT(b, u8)436437BUILDIO_IOPORT(w, u16)···464465 const volatile type *__addr = addr; \465466 \466467 while (count--) { \467467- mem_write##bwlq(*__addr, mem); \468468+ __mem_write##bwlq(*__addr, mem); \468469 __addr++; \469470 } \470471} \···475476 volatile type *__addr = addr; \476477 \477478 while (count--) { \478478- *__addr = mem_read##bwlq(mem); \479479+ *__addr = __mem_read##bwlq(mem); \479480 __addr++; \480481 } \481482}···488489 const volatile type *__addr = addr; \489490 \490491 while (count--) { \491491- mem_out##bwlq(*__addr, port); \492492+ __mem_out##bwlq(*__addr, port); \492493 __addr++; \493494 } \494495} \···499500 volatile type *__addr = addr; \500501 \501502 while (count--) { \502502- *__addr = mem_in##bwlq(port); \503503+ *__addr = __mem_in##bwlq(port); \503504 __addr++; \504505 } \505506}
+2
include/asm-mips/thread_info.h
···114114#define TIF_NEED_RESCHED 3 /* rescheduling necessary */115115#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */116116#define TIF_SECCOMP 5 /* secure computing */117117+#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */117118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */118119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */119120#define TIF_MEMDIE 18···126125#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)127126#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)128127#define _TIF_SECCOMP (1<<TIF_SECCOMP)128128+#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)129129#define _TIF_USEDFPU (1<<TIF_USEDFPU)130130#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)131131
···222222extern int of_pci_address_to_resource(struct device_node *dev, int bar,223223 struct resource *r);224224225225+extern void kdump_move_device_tree(void);226226+225227#endif /* __KERNEL__ */226228#endif /* _POWERPC_PROM_H */
+5
include/asm-powerpc/smu.h
···521521extern struct smu_sdbp_header *smu_get_sdb_partition(int id,522522 unsigned int *size);523523524524+/* Get "sdb" partition data from an SMU satellite */525525+extern struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id,526526+ int id, unsigned int *size);527527+528528+524529#endif /* __KERNEL__ */525530526531
+1-1
include/asm-powerpc/thread_info.h
···3737 int preempt_count; /* 0 => preemptable,3838 <0 => BUG */3939 struct restart_block restart_block;4040- void *nvgprs_frame;4040+ void __user *nvgprs_frame;4141 /* low level flags - has atomic operations done on it */4242 unsigned long flags ____cacheline_aligned_in_smp;4343};
···315315#define __NR_faccessat 296316316#define __NR_pselect6 297317317#define __NR_ppoll 298318318+#define __NR_unshare 299318319319319-/* WARNING: You MAY NOT add syscall numbers larger than 298, since320320+/* WARNING: You MAY NOT add syscall numbers larger than 299, since320321 * all of the syscall tables in the Sparc kernel are321321- * sized to have 298 entries (starting at zero). Therefore322322- * find a free slot in the 0-298 range.322322+ * sized to have 299 entries (starting at zero). Therefore323323+ * find a free slot in the 0-299 range.323324 */324325325326#define _syscall0(type,name) \
+4-3
include/asm-sparc64/unistd.h
···317317#define __NR_faccessat 296318318#define __NR_pselect6 297319319#define __NR_ppoll 298320320+#define __NR_unshare 299320321321321-/* WARNING: You MAY NOT add syscall numbers larger than 298, since322322+/* WARNING: You MAY NOT add syscall numbers larger than 299, since322323 * all of the syscall tables in the Sparc kernel are323323- * sized to have 298 entries (starting at zero). Therefore324324- * find a free slot in the 0-298 range.324324+ * sized to have 299 entries (starting at zero). Therefore325325+ * find a free slot in the 0-299 range.325326 */326327327328#define _syscall0(type,name) \
+4-1
include/asm-x86_64/ia32_unistd.h
···313313#define __NR_ia32_readlinkat 305314314#define __NR_ia32_fchmodat 306315315#define __NR_ia32_faccessat 307316316+#define __NR_ia32_pselect6 308317317+#define __NR_ia32_ppoll 309318318+#define __NR_ia32_unshare 310316319317317-#define IA32_NR_syscalls 308 /* must be > than biggest syscall! */320320+#define IA32_NR_syscalls 315 /* must be > than biggest syscall! */318321319322#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
+7
include/asm-x86_64/numa.h
···2222extern unsigned char apicid_to_node[256];2323#ifdef CONFIG_NUMA2424extern void __init init_cpu_to_node(void);2525+2626+static inline void clear_node_cpumask(int cpu)2727+{2828+ clear_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]);2929+}3030+2531#else2632#define init_cpu_to_node() do {} while (0)3333+#define clear_node_cpumask(cpu) do {} while (0)2734#endif28352936#define NUMA_NO_NODE 0xff
+7-1
include/asm-x86_64/unistd.h
···599599__SYSCALL(__NR_fchmodat, sys_fchmodat)600600#define __NR_faccessat 269601601__SYSCALL(__NR_faccessat, sys_faccessat)602602+#define __NR_pselect6 270603603+__SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */604604+#define __NR_ppoll 271605605+__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */606606+#define __NR_unshare 272607607+__SYSCALL(__NR_unshare, sys_unshare)602608603603-#define __NR_syscall_max __NR_faccessat609609+#define __NR_syscall_max __NR_unshare604610605611#ifndef __NO_STUBS606612
···100100/* Returns the number of read bytes */101101extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,102102 u8 command, u8 *values);103103+extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,104104+ u8 command, u8 length,105105+ u8 *values);103106104107/*105108 * A driver is capable of handling one or more physical devices present on
+1-1
include/linux/ioc3.h
···2727 int id; /* IOC3 sequence number */2828 /* PCI mapping */2929 unsigned long pma; /* physical address */3030- struct __iomem ioc3 *vma; /* pointer to registers */3030+ struct ioc3 __iomem *vma; /* pointer to registers */3131 struct pci_dev *pdev; /* PCI device */3232 /* IRQ stuff */3333 int dual_irq; /* set if separate IRQs are used */
···169169config AUDIT170170 bool "Auditing support"171171 depends on NET172172- default y if SECURITY_SELINUX173172 help174173 Enable auditing infrastructure that can be used with another175174 kernel subsystem, such as SELinux (which requires this for
···446446 }447447}448448449449+/*450450+ * Allocate a new mm structure and copy contents from the451451+ * mm structure of the passed in task structure.452452+ */453453+static struct mm_struct *dup_mm(struct task_struct *tsk)454454+{455455+ struct mm_struct *mm, *oldmm = current->mm;456456+ int err;457457+458458+ if (!oldmm)459459+ return NULL;460460+461461+ mm = allocate_mm();462462+ if (!mm)463463+ goto fail_nomem;464464+465465+ memcpy(mm, oldmm, sizeof(*mm));466466+467467+ if (!mm_init(mm))468468+ goto fail_nomem;469469+470470+ if (init_new_context(tsk, mm))471471+ goto fail_nocontext;472472+473473+ err = dup_mmap(mm, oldmm);474474+ if (err)475475+ goto free_pt;476476+477477+ mm->hiwater_rss = get_mm_rss(mm);478478+ mm->hiwater_vm = mm->total_vm;479479+480480+ return mm;481481+482482+free_pt:483483+ mmput(mm);484484+485485+fail_nomem:486486+ return NULL;487487+488488+fail_nocontext:489489+ /*490490+ * If init_new_context() failed, we cannot use mmput() to free the mm491491+ * because it calls destroy_context()492492+ */493493+ mm_free_pgd(mm);494494+ free_mm(mm);495495+ return NULL;496496+}497497+449498static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)450499{451500 struct mm_struct * mm, *oldmm;···522473 }523474524475 retval = -ENOMEM;525525- mm = allocate_mm();476476+ mm = dup_mm(tsk);526477 if (!mm)527478 goto fail_nomem;528528-529529- /* Copy the current MM stuff.. */530530- memcpy(mm, oldmm, sizeof(*mm));531531- if (!mm_init(mm))532532- goto fail_nomem;533533-534534- if (init_new_context(tsk,mm))535535- goto fail_nocontext;536536-537537- retval = dup_mmap(mm, oldmm);538538- if (retval)539539- goto free_pt;540540-541541- mm->hiwater_rss = get_mm_rss(mm);542542- mm->hiwater_vm = mm->total_vm;543479544480good_mm:545481 tsk->mm = mm;546482 tsk->active_mm = mm;547483 return 0;548484549549-free_pt:550550- mmput(mm);551485fail_nomem:552552- return retval;553553-554554-fail_nocontext:555555- /*556556- * If init_new_context() failed, we cannot use mmput() to free the mm557557- * because it calls destroy_context()558558- */559559- mm_free_pgd(mm);560560- free_mm(mm);561486 return retval;562487}563488···620597 return newf;621598}622599623623-static int copy_files(unsigned long clone_flags, struct task_struct * tsk)600600+/*601601+ * Allocate a new files structure and copy contents from the602602+ * passed in files structure.603603+ */604604+static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)624605{625625- struct files_struct *oldf, *newf;606606+ struct files_struct *newf;626607 struct file **old_fds, **new_fds;627627- int open_files, size, i, error = 0, expand;608608+ int open_files, size, i, expand;628609 struct fdtable *old_fdt, *new_fdt;629610630630- /*631631- * A background process may not have any files ...632632- */633633- oldf = current->files;634634- if (!oldf)635635- goto out;636636-637637- if (clone_flags & CLONE_FILES) {638638- atomic_inc(&oldf->count);639639- goto out;640640- }641641-642642- /*643643- * Note: we may be using current for both targets (See exec.c)644644- * This works because we cache current->files (old) as oldf. Don't645645- * break this.646646- */647647- tsk->files = NULL;648648- error = -ENOMEM;649611 newf = alloc_files();650612 if (!newf)651613 goto out;···659651 if (expand) {660652 spin_unlock(&oldf->file_lock);661653 spin_lock(&newf->file_lock);662662- error = expand_files(newf, open_files-1);654654+ *errorp = expand_files(newf, open_files-1);663655 spin_unlock(&newf->file_lock);664664- if (error < 0)656656+ if (*errorp < 0)665657 goto out_release;666658 new_fdt = files_fdtable(newf);667659 /*···710702 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);711703 }712704713713- tsk->files = newf;714714- error = 0;715705out:716716- return error;706706+ return newf;717707718708out_release:719709 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset);···719713 free_fd_array(new_fdt->fd, new_fdt->max_fds);720714 kmem_cache_free(files_cachep, newf);721715 goto out;716716+}717717+718718+static int copy_files(unsigned long clone_flags, struct task_struct * tsk)719719+{720720+ struct files_struct *oldf, *newf;721721+ int error = 0;722722+723723+ /*724724+ * A background process may not have any files ...725725+ */726726+ oldf = current->files;727727+ if (!oldf)728728+ goto out;729729+730730+ if (clone_flags & CLONE_FILES) {731731+ atomic_inc(&oldf->count);732732+ goto out;733733+ }734734+735735+ /*736736+ * Note: we may be using current for both targets (See exec.c)737737+ * This works because we cache current->files (old) as oldf. Don't738738+ * break this.739739+ */740740+ tsk->files = NULL;741741+ error = -ENOMEM;742742+ newf = dup_fd(oldf, &error);743743+ if (!newf)744744+ goto out;745745+746746+ tsk->files = newf;747747+ error = 0;748748+out:749749+ return error;722750}723751724752/*···13621322 mm_cachep = kmem_cache_create("mm_struct",13631323 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,13641324 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);13251325+}13261326+13271327+13281328+/*13291329+ * Check constraints on flags passed to the unshare system call and13301330+ * force unsharing of additional process context as appropriate.13311331+ */13321332+static inline void check_unshare_flags(unsigned long *flags_ptr)13331333+{13341334+ /*13351335+ * If unsharing a thread from a thread group, must also13361336+ * unshare vm.13371337+ */13381338+ if (*flags_ptr & CLONE_THREAD)13391339+ *flags_ptr |= CLONE_VM;13401340+13411341+ /*13421342+ * If unsharing vm, must also unshare signal handlers.13431343+ */13441344+ if (*flags_ptr & CLONE_VM)13451345+ *flags_ptr |= CLONE_SIGHAND;13461346+13471347+ /*13481348+ * If unsharing signal handlers and the task was created13491349+ * using CLONE_THREAD, then must unshare the thread13501350+ */13511351+ if ((*flags_ptr & CLONE_SIGHAND) &&13521352+ (atomic_read(¤t->signal->count) > 1))13531353+ *flags_ptr |= CLONE_THREAD;13541354+13551355+ /*13561356+ * If unsharing namespace, must also unshare filesystem information.13571357+ */13581358+ if (*flags_ptr & CLONE_NEWNS)13591359+ *flags_ptr |= CLONE_FS;13601360+}13611361+13621362+/*13631363+ * Unsharing of tasks created with CLONE_THREAD is not supported yet13641364+ */13651365+static int unshare_thread(unsigned long unshare_flags)13661366+{13671367+ if (unshare_flags & CLONE_THREAD)13681368+ return -EINVAL;13691369+13701370+ return 0;13711371+}13721372+13731373+/*13741374+ * Unshare the filesystem structure if it is being shared13751375+ */13761376+static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)13771377+{13781378+ struct fs_struct *fs = current->fs;13791379+13801380+ if ((unshare_flags & CLONE_FS) &&13811381+ (fs && atomic_read(&fs->count) > 1)) {13821382+ *new_fsp = __copy_fs_struct(current->fs);13831383+ if (!*new_fsp)13841384+ return -ENOMEM;13851385+ }13861386+13871387+ return 0;13881388+}13891389+13901390+/*13911391+ * Unshare the namespace structure if it is being shared13921392+ */13931393+static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs)13941394+{13951395+ struct namespace *ns = current->namespace;13961396+13971397+ if ((unshare_flags & CLONE_NEWNS) &&13981398+ (ns && atomic_read(&ns->count) > 1)) {13991399+ if (!capable(CAP_SYS_ADMIN))14001400+ return -EPERM;14011401+14021402+ *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs);14031403+ if (!*new_nsp)14041404+ return -ENOMEM;14051405+ }14061406+14071407+ return 0;14081408+}14091409+14101410+/*14111411+ * Unsharing of sighand for tasks created with CLONE_SIGHAND is not14121412+ * supported yet14131413+ */14141414+static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp)14151415+{14161416+ struct sighand_struct *sigh = current->sighand;14171417+14181418+ if ((unshare_flags & CLONE_SIGHAND) &&14191419+ (sigh && atomic_read(&sigh->count) > 1))14201420+ return -EINVAL;14211421+ else14221422+ return 0;14231423+}14241424+14251425+/*14261426+ * Unshare vm if it is being shared14271427+ */14281428+static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp)14291429+{14301430+ struct mm_struct *mm = current->mm;14311431+14321432+ if ((unshare_flags & CLONE_VM) &&14331433+ (mm && atomic_read(&mm->mm_users) > 1)) {14341434+ *new_mmp = dup_mm(current);14351435+ if (!*new_mmp)14361436+ return -ENOMEM;14371437+ }14381438+14391439+ return 0;14401440+}14411441+14421442+/*14431443+ * Unshare file descriptor table if it is being shared14441444+ */14451445+static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp)14461446+{14471447+ struct files_struct *fd = current->files;14481448+ int error = 0;14491449+14501450+ if ((unshare_flags & CLONE_FILES) &&14511451+ (fd && atomic_read(&fd->count) > 1)) {14521452+ *new_fdp = dup_fd(fd, &error);14531453+ if (!*new_fdp)14541454+ return error;14551455+ }14561456+14571457+ return 0;14581458+}14591459+14601460+/*14611461+ * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not14621462+ * supported yet14631463+ */14641464+static int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp)14651465+{14661466+ if (unshare_flags & CLONE_SYSVSEM)14671467+ return -EINVAL;14681468+14691469+ return 0;14701470+}14711471+14721472+/*14731473+ * unshare allows a process to 'unshare' part of the process14741474+ * context which was originally shared using clone. copy_*14751475+ * functions used by do_fork() cannot be used here directly14761476+ * because they modify an inactive task_struct that is being14771477+ * constructed. Here we are modifying the current, active,14781478+ * task_struct.14791479+ */14801480+asmlinkage long sys_unshare(unsigned long unshare_flags)14811481+{14821482+ int err = 0;14831483+ struct fs_struct *fs, *new_fs = NULL;14841484+ struct namespace *ns, *new_ns = NULL;14851485+ struct sighand_struct *sigh, *new_sigh = NULL;14861486+ struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;14871487+ struct files_struct *fd, *new_fd = NULL;14881488+ struct sem_undo_list *new_ulist = NULL;14891489+14901490+ check_unshare_flags(&unshare_flags);14911491+14921492+ if ((err = unshare_thread(unshare_flags)))14931493+ goto bad_unshare_out;14941494+ if ((err = unshare_fs(unshare_flags, &new_fs)))14951495+ goto bad_unshare_cleanup_thread;14961496+ if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs)))14971497+ goto bad_unshare_cleanup_fs;14981498+ if ((err = unshare_sighand(unshare_flags, &new_sigh)))14991499+ goto bad_unshare_cleanup_ns;15001500+ if ((err = unshare_vm(unshare_flags, &new_mm)))15011501+ goto bad_unshare_cleanup_sigh;15021502+ if ((err = unshare_fd(unshare_flags, &new_fd)))15031503+ goto bad_unshare_cleanup_vm;15041504+ if ((err = unshare_semundo(unshare_flags, &new_ulist)))15051505+ goto bad_unshare_cleanup_fd;15061506+15071507+ if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist) {15081508+15091509+ task_lock(current);15101510+15111511+ if (new_fs) {15121512+ fs = current->fs;15131513+ current->fs = new_fs;15141514+ new_fs = fs;15151515+ }15161516+15171517+ if (new_ns) {15181518+ ns = current->namespace;15191519+ current->namespace = new_ns;15201520+ new_ns = ns;15211521+ }15221522+15231523+ if (new_sigh) {15241524+ sigh = current->sighand;15251525+ current->sighand = new_sigh;15261526+ new_sigh = sigh;15271527+ }15281528+15291529+ if (new_mm) {15301530+ mm = current->mm;15311531+ active_mm = current->active_mm;15321532+ current->mm = new_mm;15331533+ current->active_mm = new_mm;15341534+ activate_mm(active_mm, new_mm);15351535+ new_mm = mm;15361536+ }15371537+15381538+ if (new_fd) {15391539+ fd = current->files;15401540+ current->files = new_fd;15411541+ new_fd = fd;15421542+ }15431543+15441544+ task_unlock(current);15451545+ }15461546+15471547+bad_unshare_cleanup_fd:15481548+ if (new_fd)15491549+ put_files_struct(new_fd);15501550+15511551+bad_unshare_cleanup_vm:15521552+ if (new_mm)15531553+ mmput(new_mm);15541554+15551555+bad_unshare_cleanup_sigh:15561556+ if (new_sigh)15571557+ if (atomic_dec_and_test(&new_sigh->count))15581558+ kmem_cache_free(sighand_cachep, new_sigh);15591559+15601560+bad_unshare_cleanup_ns:15611561+ if (new_ns)15621562+ put_namespace(new_ns);15631563+15641564+bad_unshare_cleanup_fs:15651565+ if (new_fs)15661566+ put_fs_struct(new_fs);15671567+15681568+bad_unshare_cleanup_thread:15691569+bad_unshare_out:15701570+ return err;13651571}
+3
kernel/module.c
···16701670 goto free_mod;16711671 }1672167216731673+ /* Userspace could have altered the string after the strlen_user() */16741674+ args[arglen - 1] = '\0';16751675+16731676 if (find_module(mod->name)) {16741677 err = -EEXIST;16751678 goto free_mod;
···11#include <linux/suspend.h>22#include <linux/utsname.h>3344-/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but55- we probably do not take enough locks for switching consoles, etc,66- so bad things might happen.77-*/88-#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)99-#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)1010-#endif1111-124struct swsusp_info {135 struct new_utsname uts;146 u32 version_code;···3341}34423543extern struct subsystem power_subsys;3636-3737-#ifdef SUSPEND_CONSOLE3838-extern int pm_prepare_console(void);3939-extern void pm_restore_console(void);4040-#else4141-static int pm_prepare_console(void) { return 0; }4242-static void pm_restore_console(void) {}4343-#endif44444545/* References to section boundaries */4646extern const void __nosave_begin, __nosave_end;
···495495 base = &__get_cpu_var(tvec_bases);496496 spin_lock(&base->t_base.lock);497497 expires = base->timer_jiffies + (LONG_MAX >> 1);498498- list = 0;498498+ list = NULL;499499500500 /* Look for timer events in tv1. */501501 j = base->timer_jiffies & TVR_MASK;
+9
lib/kobject.c
···7272 * Add 1 to strlen for leading '/' of each level.7373 */7474 do {7575+ if (kobject_name(parent) == NULL)7676+ return 0;7577 length += strlen(kobject_name(parent)) + 1;7678 parent = parent->parent;7779 } while (parent);···109107 int len;110108111109 len = get_kobj_path_length(kobj);110110+ if (len == 0)111111+ return NULL;112112 path = kmalloc(len, gfp_mask);113113 if (!path)114114 return NULL;···166162 return -ENOENT;167163 if (!kobj->k_name)168164 kobj->k_name = kobj->name;165165+ if (!kobj->k_name) {166166+ pr_debug("kobject attempted to be registered with no name!\n");167167+ WARN_ON(1);168168+ return -EINVAL;169169+ }169170 parent = kobject_get(kobj->parent);170171171172 pr_debug("kobject %s: registering. parent: %s, set: %s\n",
+1-1
lib/kobject_uevent.c
···2222#include <linux/kobject.h>2323#include <net/sock.h>24242525-#define BUFFER_SIZE 1024 /* buffer for the variables */2525+#define BUFFER_SIZE 2048 /* buffer for the variables */2626#define NUM_ENVP 32 /* number of env pointers */27272828#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
+3-3
lib/spinlock_debug.c
···72727373 for (;;) {7474 for (i = 0; i < loops_per_jiffy * HZ; i++) {7575- cpu_relax();7675 if (__raw_spin_trylock(&lock->raw_lock))7776 return;7777+ __delay(1);7878 }7979 /* lockup suspected: */8080 if (print_once) {···144144145145 for (;;) {146146 for (i = 0; i < loops_per_jiffy * HZ; i++) {147147- cpu_relax();148147 if (__raw_read_trylock(&lock->raw_lock))149148 return;149149+ __delay(1);150150 }151151 /* lockup suspected: */152152 if (print_once) {···217217218218 for (;;) {219219 for (i = 0; i < loops_per_jiffy * HZ; i++) {220220- cpu_relax();221220 if (__raw_write_trylock(&lock->raw_lock))222221 return;222222+ __delay(1);223223 }224224 /* lockup suspected: */225225 if (print_once) {
+3-16
mm/hugetlb.c
···107107 set_page_count(page, 1);108108 page[1].mapping = (void *)free_huge_page;109109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)110110- clear_highpage(&page[i]);110110+ clear_user_highpage(&page[i], addr);111111 return page;112112}113113···391391392392 if (!new_page) {393393 page_cache_release(old_page);394394-395395- /* Logically this is OOM, not a SIGBUS, but an OOM396396- * could cause the kernel to go killing other397397- * processes which won't help the hugepage situation398398- * at all (?) */399399- return VM_FAULT_SIGBUS;394394+ return VM_FAULT_OOM;400395 }401396402397 spin_unlock(&mm->page_table_lock);···439444 page = alloc_huge_page(vma, address);440445 if (!page) {441446 hugetlb_put_quota(mapping);442442- /*443443- * No huge pages available. So this is an OOM444444- * condition but we do not want to trigger the OOM445445- * killer, so we return VM_FAULT_SIGBUS.446446- *447447- * A program using hugepages may fault with Bus Error448448- * because no huge pages are available in the cpuset, per449449- * memory policy or because all are in use!450450- */447447+ ret = VM_FAULT_OOM;451448 goto out;452449 }453450