diff options
222 files changed, 2429 insertions, 4121 deletions
diff --git a/Documentation/unshare.txt b/Documentation/unshare.txt new file mode 100644 index 000000000000..90a5e9e5bef1 --- /dev/null +++ b/Documentation/unshare.txt | |||
| @@ -0,0 +1,295 @@ | |||
| 1 | |||
| 2 | unshare system call: | ||
| 3 | -------------------- | ||
| 4 | This document describes the new system call, unshare. The document | ||
| 5 | provides an overview of the feature, why it is needed, how it can | ||
| 6 | be used, its interface specification, design, implementation and | ||
| 7 | how it can be tested. | ||
| 8 | |||
| 9 | Change Log: | ||
| 10 | ----------- | ||
| 11 | version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006 | ||
| 12 | |||
| 13 | Contents: | ||
| 14 | --------- | ||
| 15 | 1) Overview | ||
| 16 | 2) Benefits | ||
| 17 | 3) Cost | ||
| 18 | 4) Requirements | ||
| 19 | 5) Functional Specification | ||
| 20 | 6) High Level Design | ||
| 21 | 7) Low Level Design | ||
| 22 | 8) Test Specification | ||
| 23 | 9) Future Work | ||
| 24 | |||
| 25 | 1) Overview | ||
| 26 | ----------- | ||
| 27 | Most legacy operating system kernels support an abstraction of threads | ||
| 28 | as multiple execution contexts within a process. These kernels provide | ||
| 29 | special resources and mechanisms to maintain these "threads". The Linux | ||
| 30 | kernel, in a clever and simple manner, does not make distinction | ||
| 31 | between processes and "threads". The kernel allows processes to share | ||
| 32 | resources and thus they can achieve legacy "threads" behavior without | ||
| 33 | requiring additional data structures and mechanisms in the kernel. The | ||
| 34 | power of implementing threads in this manner comes not only from | ||
| 35 | its simplicity but also from allowing application programmers to work | ||
| 36 | outside the confinement of all-or-nothing shared resources of legacy | ||
| 37 | threads. On Linux, at the time of thread creation using the clone system | ||
| 38 | call, applications can selectively choose which resources to share | ||
| 39 | between threads. | ||
| 40 | |||
| 41 | unshare system call adds a primitive to the Linux thread model that | ||
| 42 | allows threads to selectively 'unshare' any resources that were being | ||
| 43 | shared at the time of their creation. unshare was conceptualized by | ||
| 44 | Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part | ||
| 45 | of the discussion on POSIX threads on Linux. unshare augments the | ||
| 46 | usefulness of Linux threads for applications that would like to control | ||
| 47 | shared resources without creating a new process. unshare is a natural | ||
| 48 | addition to the set of available primitives on Linux that implement | ||
| 49 | the concept of process/thread as a virtual machine. | ||
| 50 | |||
| 51 | 2) Benefits | ||
| 52 | ----------- | ||
| 53 | unshare would be useful to large application frameworks such as PAM | ||
| 54 | where creating a new process to control sharing/unsharing of process | ||
| 55 | resources is not possible. Since namespaces are shared by default | ||
| 56 | when creating a new process using fork or clone, unshare can benefit | ||
| 57 | even non-threaded applications if they have a need to disassociate | ||
| 58 | from default shared namespace. The following lists two use-cases | ||
| 59 | where unshare can be used. | ||
| 60 | |||
| 61 | 2.1 Per-security context namespaces | ||
| 62 | ----------------------------------- | ||
| 63 | unshare can be used to implement polyinstantiated directories using | ||
| 64 | the kernel's per-process namespace mechanism. Polyinstantiated directories, | ||
| 65 | such as per-user and/or per-security context instance of /tmp, /var/tmp or | ||
| 66 | per-security context instance of a user's home directory, isolate user | ||
| 67 | processes when working with these directories. Using unshare, a PAM | ||
| 68 | module can easily setup a private namespace for a user at login. | ||
| 69 | Polyinstantiated directories are required for Common Criteria certification | ||
| 70 | with Labeled System Protection Profile, however, with the availability | ||
| 71 | of shared-tree feature in the Linux kernel, even regular Linux systems | ||
| 72 | can benefit from setting up private namespaces at login and | ||
| 73 | polyinstantiating /tmp, /var/tmp and other directories deemed | ||
| 74 | appropriate by system administrators. | ||
| 75 | |||
| 76 | 2.2 unsharing of virtual memory and/or open files | ||
| 77 | ------------------------------------------------- | ||
| 78 | Consider a client/server application where the server is processing | ||
| 79 | client requests by creating processes that share resources such as | ||
| 80 | virtual memory and open files. Without unshare, the server has to | ||
| 81 | decide what needs to be shared at the time of creating the process | ||
| 82 | which services the request. unshare allows the server an ability to | ||
| 83 | disassociate parts of the context during the servicing of the | ||
| 84 | request. For large and complex middleware application frameworks, this | ||
| 85 | ability to unshare after the process was created can be very | ||
| 86 | useful. | ||
| 87 | |||
| 88 | 3) Cost | ||
| 89 | ------- | ||
| 90 | In order to not duplicate code and to handle the fact that unshare | ||
| 91 | works on an active task (as opposed to clone/fork working on a newly | ||
| 92 | allocated inactive task) unshare had to make minor reorganizational | ||
| 93 | changes to copy_* functions utilized by clone/fork system call. | ||
| 94 | There is a cost associated with altering existing, well tested and | ||
| 95 | stable code to implement a new feature that may not get exercised | ||
| 96 | extensively in the beginning. However, with proper design and code | ||
| 97 | review of the changes and creation of an unshare test for the LTP | ||
| 98 | the benefits of this new feature can exceed its cost. | ||
| 99 | |||
| 100 | 4) Requirements | ||
| 101 | --------------- | ||
| 102 | unshare reverses sharing that was done using clone(2) system call, | ||
| 103 | so unshare should have a similar interface as clone(2). That is, | ||
| 104 | since flags in clone(int flags, void *stack) specifies what should | ||
| 105 | be shared, similar flags in unshare(int flags) should specify | ||
| 106 | what should be unshared. Unfortunately, this may appear to invert | ||
| 107 | the meaning of the flags from the way they are used in clone(2). | ||
| 108 | However, there was no easy solution that was less confusing and that | ||
| 109 | allowed incremental context unsharing in future without an ABI change. | ||
| 110 | |||
| 111 | unshare interface should accommodate possible future addition of | ||
| 112 | new context flags without requiring a rebuild of old applications. | ||
| 113 | If and when new context flags are added, unshare design should allow | ||
| 114 | incremental unsharing of those resources on an as needed basis. | ||
| 115 | |||
| 116 | 5) Functional Specification | ||
| 117 | --------------------------- | ||
| 118 | NAME | ||
| 119 | unshare - disassociate parts of the process execution context | ||
| 120 | |||
| 121 | SYNOPSIS | ||
| 122 | #include <sched.h> | ||
| 123 | |||
| 124 | int unshare(int flags); | ||
| 125 | |||
| 126 | DESCRIPTION | ||
| 127 | unshare allows a process to disassociate parts of its execution | ||
| 128 | context that are currently being shared with other processes. Part | ||
| 129 | of execution context, such as the namespace, is shared by default | ||
| 130 | when a new process is created using fork(2), while other parts, | ||
| 131 | such as the virtual memory, open file descriptors, etc, may be | ||
| 132 | shared by explicit request to share them when creating a process | ||
| 133 | using clone(2). | ||
| 134 | |||
| 135 | The main use of unshare is to allow a process to control its | ||
| 136 | shared execution context without creating a new process. | ||
| 137 | |||
| 138 | The flags argument specifies one or bitwise-or'ed of several of | ||
| 139 | the following constants. | ||
| 140 | |||
| 141 | CLONE_FS | ||
| 142 | If CLONE_FS is set, file system information of the caller | ||
| 143 | is disassociated from the shared file system information. | ||
| 144 | |||
| 145 | CLONE_FILES | ||
| 146 | If CLONE_FILES is set, the file descriptor table of the | ||
| 147 | caller is disassociated from the shared file descriptor | ||
| 148 | table. | ||
| 149 | |||
| 150 | CLONE_NEWNS | ||
| 151 | If CLONE_NEWNS is set, the namespace of the caller is | ||
| 152 | disassociated from the shared namespace. | ||
| 153 | |||
| 154 | CLONE_VM | ||
| 155 | If CLONE_VM is set, the virtual memory of the caller is | ||
| 156 | disassociated from the shared virtual memory. | ||
| 157 | |||
| 158 | RETURN VALUE | ||
| 159 | On success, zero returned. On failure, -1 is returned and errno is | ||
| 160 | |||
| 161 | ERRORS | ||
| 162 | EPERM CLONE_NEWNS was specified by a non-root process (process | ||
| 163 | without CAP_SYS_ADMIN). | ||
| 164 | |||
| 165 | ENOMEM Cannot allocate sufficient memory to copy parts of caller's | ||
| 166 | context that need to be unshared. | ||
| 167 | |||
| 168 | EINVAL Invalid flag was specified as an argument. | ||
| 169 | |||
| 170 | CONFORMING TO | ||
| 171 | The unshare() call is Linux-specific and should not be used | ||
| 172 | in programs intended to be portable. | ||
| 173 | |||
| 174 | SEE ALSO | ||
| 175 | clone(2), fork(2) | ||
| 176 | |||
| 177 | 6) High Level Design | ||
| 178 | -------------------- | ||
| 179 | Depending on the flags argument, the unshare system call allocates | ||
| 180 | appropriate process context structures, populates it with values from | ||
| 181 | the current shared version, associates newly duplicated structures | ||
| 182 | with the current task structure and releases corresponding shared | ||
| 183 | versions. Helper functions of clone (copy_*) could not be used | ||
| 184 | directly by unshare because of the following two reasons. | ||
| 185 | 1) clone operates on a newly allocated not-yet-active task | ||
| 186 | structure, where as unshare operates on the current active | ||
| 187 | task. Therefore unshare has to take appropriate task_lock() | ||
| 188 | before associating newly duplicated context structures | ||
| 189 | 2) unshare has to allocate and duplicate all context structures | ||
| 190 | that are being unshared, before associating them with the | ||
| 191 | current task and releasing older shared structures. Failure | ||
| 192 | do so will create race conditions and/or oops when trying | ||
| 193 | to backout due to an error. Consider the case of unsharing | ||
| 194 | both virtual memory and namespace. After successfully unsharing | ||
| 195 | vm, if the system call encounters an error while allocating | ||
| 196 | new namespace structure, the error return code will have to | ||
| 197 | reverse the unsharing of vm. As part of the reversal the | ||
| 198 | system call will have to go back to older, shared, vm | ||
| 199 | structure, which may not exist anymore. | ||
| 200 | |||
| 201 | Therefore code from copy_* functions that allocated and duplicated | ||
| 202 | current context structure was moved into new dup_* functions. Now, | ||
| 203 | copy_* functions call dup_* functions to allocate and duplicate | ||
| 204 | appropriate context structures and then associate them with the | ||
| 205 | task structure that is being constructed. unshare system call on | ||
| 206 | the other hand performs the following: | ||
| 207 | 1) Check flags to force missing, but implied, flags | ||
| 208 | 2) For each context structure, call the corresponding unshare | ||
| 209 | helper function to allocate and duplicate a new context | ||
| 210 | structure, if the appropriate bit is set in the flags argument. | ||
| 211 | 3) If there is no error in allocation and duplication and there | ||
| 212 | are new context structures then lock the current task structure, | ||
| 213 | associate new context structures with the current task structure, | ||
| 214 | and release the lock on the current task structure. | ||
| 215 | 4) Appropriately release older, shared, context structures. | ||
| 216 | |||
| 217 | 7) Low Level Design | ||
| 218 | ------------------- | ||
| 219 | Implementation of unshare can be grouped in the following 4 different | ||
| 220 | items: | ||
| 221 | a) Reorganization of existing copy_* functions | ||
| 222 | b) unshare system call service function | ||
| 223 | c) unshare helper functions for each different process context | ||
| 224 | d) Registration of system call number for different architectures | ||
| 225 | |||
| 226 | 7.1) Reorganization of copy_* functions | ||
| 227 | Each copy function such as copy_mm, copy_namespace, copy_files, | ||
| 228 | etc, had roughly two components. The first component allocated | ||
| 229 | and duplicated the appropriate structure and the second component | ||
| 230 | linked it to the task structure passed in as an argument to the copy | ||
| 231 | function. The first component was split into its own function. | ||
| 232 | These dup_* functions allocated and duplicated the appropriate | ||
| 233 | context structure. The reorganized copy_* functions invoked | ||
| 234 | their corresponding dup_* functions and then linked the newly | ||
| 235 | duplicated structures to the task structure with which the | ||
| 236 | copy function was called. | ||
| 237 | |||
| 238 | 7.2) unshare system call service function | ||
| 239 | * Check flags | ||
| 240 | Force implied flags. If CLONE_THREAD is set force CLONE_VM. | ||
| 241 | If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is | ||
| 242 | set and signals are also being shared, force CLONE_THREAD. If | ||
| 243 | CLONE_NEWNS is set, force CLONE_FS. | ||
| 244 | * For each context flag, invoke the corresponding unshare_* | ||
| 245 | helper routine with flags passed into the system call and a | ||
| 246 | reference to pointer pointing the new unshared structure | ||
| 247 | * If any new structures are created by unshare_* helper | ||
| 248 | functions, take the task_lock() on the current task, | ||
| 249 | modify appropriate context pointers, and release the | ||
| 250 | task lock. | ||
| 251 | * For all newly unshared structures, release the corresponding | ||
| 252 | older, shared, structures. | ||
| 253 | |||
| 254 | 7.3) unshare_* helper functions | ||
| 255 | For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND, | ||
| 256 | and CLONE_THREAD, return -EINVAL since they are not implemented yet. | ||
| 257 | For others, check the flag value to see if the unsharing is | ||
| 258 | required for that structure. If it is, invoke the corresponding | ||
| 259 | dup_* function to allocate and duplicate the structure and return | ||
| 260 | a pointer to it. | ||
| 261 | |||
| 262 | 7.4) Appropriately modify architecture specific code to register the | ||
| 263 | the new system call. | ||
| 264 | |||
| 265 | 8) Test Specification | ||
| 266 | --------------------- | ||
| 267 | The test for unshare should test the following: | ||
| 268 | 1) Valid flags: Test to check that clone flags for signal and | ||
| 269 | signal handlers, for which unsharing is not implemented | ||
| 270 | yet, return -EINVAL. | ||
| 271 | 2) Missing/implied flags: Test to make sure that if unsharing | ||
| 272 | namespace without specifying unsharing of filesystem, correctly | ||
| 273 | unshares both namespace and filesystem information. | ||
| 274 | 3) For each of the four (namespace, filesystem, files and vm) | ||
| 275 | supported unsharing, verify that the system call correctly | ||
| 276 | unshares the appropriate structure. Verify that unsharing | ||
| 277 | them individually as well as in combination with each | ||
| 278 | other works as expected. | ||
| 279 | 4) Concurrent execution: Use shared memory segments and futex on | ||
| 280 | an address in the shm segment to synchronize execution of | ||
| 281 | about 10 threads. Have a couple of threads execute execve, | ||
| 282 | a couple _exit and the rest unshare with different combination | ||
| 283 | of flags. Verify that unsharing is performed as expected and | ||
| 284 | that there are no oops or hangs. | ||
| 285 | |||
| 286 | 9) Future Work | ||
| 287 | -------------- | ||
| 288 | The current implementation of unshare does not allow unsharing of | ||
| 289 | signals and signal handlers. Signals are complex to begin with and | ||
| 290 | to unshare signals and/or signal handlers of a currently running | ||
| 291 | process is even more complex. If in the future there is a specific | ||
| 292 | need to allow unsharing of signals and/or signal handlers, it can | ||
| 293 | be incrementally added to unshare without affecting legacy | ||
| 294 | applications using unshare. | ||
| 295 | |||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 56e194f1a0b0..8bea3fbd0548 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
| @@ -42,4 +42,4 @@ | |||
| 42 | 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] | 42 | 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] |
| 43 | 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025] | 43 | 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025] |
| 44 | 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1] | 44 | 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1] |
| 45 | 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50] | 45 | 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54] |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index cb3a59bbeb17..8a352597830f 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 0 -> UNKNOWN/GENERIC | 1 | 0 -> UNKNOWN/GENERIC |
| 2 | 1 -> Proteus Pro [philips reference design] [1131:2001,1131:2001] | 2 | 1 -> Proteus Pro [philips reference design] [1131:2001,1131:2001] |
| 3 | 2 -> LifeView FlyVIDEO3000 [5168:0138,4e42:0138] | 3 | 2 -> LifeView FlyVIDEO3000 [5168:0138,4e42:0138] |
| 4 | 3 -> LifeView FlyVIDEO2000 [5168:0138] | 4 | 3 -> LifeView/Typhoon FlyVIDEO2000 [5168:0138,4e42:0138] |
| 5 | 4 -> EMPRESS [1131:6752] | 5 | 4 -> EMPRESS [1131:6752] |
| 6 | 5 -> SKNet Monster TV [1131:4e85] | 6 | 5 -> SKNet Monster TV [1131:4e85] |
| 7 | 6 -> Tevion MD 9717 | 7 | 6 -> Tevion MD 9717 |
| @@ -53,12 +53,12 @@ | |||
| 53 | 52 -> AverMedia AverTV/305 [1461:2108] | 53 | 52 -> AverMedia AverTV/305 [1461:2108] |
| 54 | 53 -> ASUS TV-FM 7135 [1043:4845] | 54 | 53 -> ASUS TV-FM 7135 [1043:4845] |
| 55 | 54 -> LifeView FlyTV Platinum FM [5168:0214,1489:0214] | 55 | 54 -> LifeView FlyTV Platinum FM [5168:0214,1489:0214] |
| 56 | 55 -> LifeView FlyDVB-T DUO [5168:0502,5168:0306] | 56 | 55 -> LifeView FlyDVB-T DUO [5168:0306] |
| 57 | 56 -> Avermedia AVerTV 307 [1461:a70a] | 57 | 56 -> Avermedia AVerTV 307 [1461:a70a] |
| 58 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] | 58 | 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] |
| 59 | 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] | 59 | 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] |
| 60 | 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 | 60 | 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 |
| 61 | 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502] | 61 | 60 -> LifeView/Typhoon FlyDVB-T Duo Cardbus [5168:0502,4e42:0502] |
| 62 | 61 -> Philips TOUGH DVB-T reference design [1131:2004] | 62 | 61 -> Philips TOUGH DVB-T reference design [1131:2004] |
| 63 | 62 -> Compro VideoMate TV Gold+II | 63 | 62 -> Compro VideoMate TV Gold+II |
| 64 | 63 -> Kworld Xpert TV PVR7134 | 64 | 63 -> Kworld Xpert TV PVR7134 |
diff --git a/MAINTAINERS b/MAINTAINERS index 5b7a154d4432..b22db521cec1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -540,7 +540,8 @@ S: Supported | |||
| 540 | 540 | ||
| 541 | BTTV VIDEO4LINUX DRIVER | 541 | BTTV VIDEO4LINUX DRIVER |
| 542 | P: Mauro Carvalho Chehab | 542 | P: Mauro Carvalho Chehab |
| 543 | M: mchehab@brturbo.com.br | 543 | M: mchehab@infradead.org |
| 544 | M: v4l-dvb-maintainer@linuxtv.org | ||
| 544 | L: video4linux-list@redhat.com | 545 | L: video4linux-list@redhat.com |
| 545 | W: http://linuxtv.org | 546 | W: http://linuxtv.org |
| 546 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git | 547 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git |
| @@ -837,11 +838,12 @@ S: Maintained | |||
| 837 | 838 | ||
| 838 | DVB SUBSYSTEM AND DRIVERS | 839 | DVB SUBSYSTEM AND DRIVERS |
| 839 | P: LinuxTV.org Project | 840 | P: LinuxTV.org Project |
| 840 | M: linux-dvb-maintainer@linuxtv.org | 841 | M: mchehab@infradead.org |
| 842 | M: v4l-dvb-maintainer@linuxtv.org | ||
| 841 | L: linux-dvb@linuxtv.org (subscription required) | 843 | L: linux-dvb@linuxtv.org (subscription required) |
| 842 | W: http://linuxtv.org/ | 844 | W: http://linuxtv.org/ |
| 843 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git | 845 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git |
| 844 | S: Supported | 846 | S: Maintained |
| 845 | 847 | ||
| 846 | EATA-DMA SCSI DRIVER | 848 | EATA-DMA SCSI DRIVER |
| 847 | P: Michael Neuffer | 849 | P: Michael Neuffer |
| @@ -2962,7 +2964,8 @@ S: Maintained | |||
| 2962 | 2964 | ||
| 2963 | VIDEO FOR LINUX | 2965 | VIDEO FOR LINUX |
| 2964 | P: Mauro Carvalho Chehab | 2966 | P: Mauro Carvalho Chehab |
| 2965 | M: mchehab@brturbo.com.br | 2967 | M: mchehab@infradead.org |
| 2968 | M: v4l-dvb-maintainer@linuxtv.org | ||
| 2966 | L: video4linux-list@redhat.com | 2969 | L: video4linux-list@redhat.com |
| 2967 | W: http://linuxtv.org | 2970 | W: http://linuxtv.org |
| 2968 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git | 2971 | T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git |
| @@ -442,7 +442,7 @@ export KBUILD_DEFCONFIG | |||
| 442 | config %config: scripts_basic outputmakefile FORCE | 442 | config %config: scripts_basic outputmakefile FORCE |
| 443 | $(Q)mkdir -p include/linux | 443 | $(Q)mkdir -p include/linux |
| 444 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 444 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
| 445 | $(Q)$(MAKE) .kernelrelease | 445 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease |
| 446 | 446 | ||
| 447 | else | 447 | else |
| 448 | # =========================================================================== | 448 | # =========================================================================== |
diff --git a/arch/cris/Makefile b/arch/cris/Makefile index ea65d585cf5e..ee114699ef8e 100644 --- a/arch/cris/Makefile +++ b/arch/cris/Makefile | |||
| @@ -119,7 +119,7 @@ $(SRC_ARCH)/.links: | |||
| 119 | @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib | 119 | @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib |
| 120 | @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch | 120 | @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch |
| 121 | @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S | 121 | @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S |
| 122 | @ln -sfn $(SRC_ARCH)/$(SARCH)/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c | 122 | @ln -sfn $(SRC_ARCH)/$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c |
| 123 | @touch $@ | 123 | @touch $@ |
| 124 | 124 | ||
| 125 | # Create link to sub arch includes | 125 | # Create link to sub arch includes |
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 98a5c23cf3df..f39e09ef64ec 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
| @@ -77,7 +77,7 @@ void ack_bad_irq(unsigned int irq) | |||
| 77 | * completely. | 77 | * completely. |
| 78 | * But only ack when the APIC is enabled -AK | 78 | * But only ack when the APIC is enabled -AK |
| 79 | */ | 79 | */ |
| 80 | if (!cpu_has_apic) | 80 | if (cpu_has_apic) |
| 81 | ack_APIC_irq(); | 81 | ack_APIC_irq(); |
| 82 | } | 82 | } |
| 83 | 83 | ||
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S index 1b665928336b..5a8b3fb6d27b 100644 --- a/arch/i386/kernel/syscall_table.S +++ b/arch/i386/kernel/syscall_table.S | |||
| @@ -309,3 +309,4 @@ ENTRY(sys_call_table) | |||
| 309 | .long sys_faccessat | 309 | .long sys_faccessat |
| 310 | .long sys_pselect6 | 310 | .long sys_pselect6 |
| 311 | .long sys_ppoll | 311 | .long sys_ppoll |
| 312 | .long sys_unshare /* 310 */ | ||
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 199eeaf0f4e3..845cd0902a50 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
| @@ -194,7 +194,6 @@ config IA64_L1_CACHE_SHIFT | |||
| 194 | default "7" if MCKINLEY | 194 | default "7" if MCKINLEY |
| 195 | default "6" if ITANIUM | 195 | default "6" if ITANIUM |
| 196 | 196 | ||
| 197 | # align cache-sensitive data to 64 bytes | ||
| 198 | config IA64_CYCLONE | 197 | config IA64_CYCLONE |
| 199 | bool "Cyclone (EXA) Time Source support" | 198 | bool "Cyclone (EXA) Time Source support" |
| 200 | help | 199 | help |
| @@ -374,6 +373,9 @@ config IA64_PALINFO | |||
| 374 | To use this option, you have to ensure that the "/proc file system | 373 | To use this option, you have to ensure that the "/proc file system |
| 375 | support" (CONFIG_PROC_FS) is enabled, too. | 374 | support" (CONFIG_PROC_FS) is enabled, too. |
| 376 | 375 | ||
| 376 | config SGI_SN | ||
| 377 | def_bool y if (IA64_SGI_SN2 || IA64_GENERIC) | ||
| 378 | |||
| 377 | source "drivers/firmware/Kconfig" | 379 | source "drivers/firmware/Kconfig" |
| 378 | 380 | ||
| 379 | source "fs/Kconfig.binfmt" | 381 | source "fs/Kconfig.binfmt" |
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c index acc0f132f86c..056f7a6eedc7 100644 --- a/arch/ia64/kernel/sal.c +++ b/arch/ia64/kernel/sal.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
| 15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
| 16 | 16 | ||
| 17 | #include <asm/delay.h> | ||
| 17 | #include <asm/page.h> | 18 | #include <asm/page.h> |
| 18 | #include <asm/sal.h> | 19 | #include <asm/sal.h> |
| 19 | #include <asm/pal.h> | 20 | #include <asm/pal.h> |
| @@ -214,6 +215,78 @@ chk_nointroute_opt(void) | |||
| 214 | static void __init sal_desc_ap_wakeup(void *p) { } | 215 | static void __init sal_desc_ap_wakeup(void *p) { } |
| 215 | #endif | 216 | #endif |
| 216 | 217 | ||
| 218 | /* | ||
| 219 | * HP rx5670 firmware polls for interrupts during SAL_CACHE_FLUSH by reading | ||
| 220 | * cr.ivr, but it never writes cr.eoi. This leaves any interrupt marked as | ||
| 221 | * "in-service" and masks other interrupts of equal or lower priority. | ||
| 222 | * | ||
| 223 | * HP internal defect reports: F1859, F2775, F3031. | ||
| 224 | */ | ||
| 225 | static int sal_cache_flush_drops_interrupts; | ||
| 226 | |||
| 227 | static void __init | ||
| 228 | check_sal_cache_flush (void) | ||
| 229 | { | ||
| 230 | unsigned long flags, itv; | ||
| 231 | int cpu; | ||
| 232 | u64 vector; | ||
| 233 | |||
| 234 | cpu = get_cpu(); | ||
| 235 | local_irq_save(flags); | ||
| 236 | |||
| 237 | /* | ||
| 238 | * Schedule a timer interrupt, wait until it's reported, and see if | ||
| 239 | * SAL_CACHE_FLUSH drops it. | ||
| 240 | */ | ||
| 241 | itv = ia64_get_itv(); | ||
| 242 | BUG_ON((itv & (1 << 16)) == 0); | ||
| 243 | |||
| 244 | ia64_set_itv(IA64_TIMER_VECTOR); | ||
| 245 | ia64_set_itm(ia64_get_itc() + 1000); | ||
| 246 | |||
| 247 | while (!ia64_get_irr(IA64_TIMER_VECTOR)) | ||
| 248 | cpu_relax(); | ||
| 249 | |||
| 250 | ia64_sal_cache_flush(3); | ||
| 251 | |||
| 252 | if (ia64_get_irr(IA64_TIMER_VECTOR)) { | ||
| 253 | vector = ia64_get_ivr(); | ||
| 254 | ia64_eoi(); | ||
| 255 | WARN_ON(vector != IA64_TIMER_VECTOR); | ||
| 256 | } else { | ||
| 257 | sal_cache_flush_drops_interrupts = 1; | ||
| 258 | printk(KERN_ERR "SAL: SAL_CACHE_FLUSH drops interrupts; " | ||
| 259 | "PAL_CACHE_FLUSH will be used instead\n"); | ||
| 260 | ia64_eoi(); | ||
| 261 | } | ||
| 262 | |||
| 263 | ia64_set_itv(itv); | ||
| 264 | local_irq_restore(flags); | ||
| 265 | put_cpu(); | ||
| 266 | } | ||
| 267 | |||
| 268 | s64 | ||
| 269 | ia64_sal_cache_flush (u64 cache_type) | ||
| 270 | { | ||
| 271 | struct ia64_sal_retval isrv; | ||
| 272 | |||
| 273 | if (sal_cache_flush_drops_interrupts) { | ||
| 274 | unsigned long flags; | ||
| 275 | u64 progress; | ||
| 276 | s64 rc; | ||
| 277 | |||
| 278 | progress = 0; | ||
| 279 | local_irq_save(flags); | ||
| 280 | rc = ia64_pal_cache_flush(cache_type, | ||
| 281 | PAL_CACHE_FLUSH_INVALIDATE, &progress, NULL); | ||
| 282 | local_irq_restore(flags); | ||
| 283 | return rc; | ||
| 284 | } | ||
| 285 | |||
| 286 | SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0); | ||
| 287 | return isrv.status; | ||
| 288 | } | ||
| 289 | |||
| 217 | void __init | 290 | void __init |
| 218 | ia64_sal_init (struct ia64_sal_systab *systab) | 291 | ia64_sal_init (struct ia64_sal_systab *systab) |
| 219 | { | 292 | { |
| @@ -262,6 +335,8 @@ ia64_sal_init (struct ia64_sal_systab *systab) | |||
| 262 | } | 335 | } |
| 263 | p += SAL_DESC_SIZE(*p); | 336 | p += SAL_DESC_SIZE(*p); |
| 264 | } | 337 | } |
| 338 | |||
| 339 | check_sal_cache_flush(); | ||
| 265 | } | 340 | } |
| 266 | 341 | ||
| 267 | int | 342 | int |
diff --git a/arch/ia64/sn/Makefile b/arch/ia64/sn/Makefile index a269f6d84c29..79a7df02e812 100644 --- a/arch/ia64/sn/Makefile +++ b/arch/ia64/sn/Makefile | |||
| @@ -9,6 +9,4 @@ | |||
| 9 | # Makefile for the sn ia64 subplatform | 9 | # Makefile for the sn ia64 subplatform |
| 10 | # | 10 | # |
| 11 | 11 | ||
| 12 | CPPFLAGS += -I$(srctree)/arch/ia64/sn/include | ||
| 13 | |||
| 14 | obj-y += kernel/ pci/ | 12 | obj-y += kernel/ pci/ |
diff --git a/arch/ia64/sn/kernel/Makefile b/arch/ia64/sn/kernel/Makefile index 4351c4ff9845..3e9b4eea7418 100644 --- a/arch/ia64/sn/kernel/Makefile +++ b/arch/ia64/sn/kernel/Makefile | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | # Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All Rights Reserved. | 7 | # Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All Rights Reserved. |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | CPPFLAGS += -I$(srctree)/arch/ia64/sn/include | ||
| 11 | |||
| 10 | obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \ | 12 | obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \ |
| 11 | huberror.o io_init.o iomv.o klconflib.o sn2/ | 13 | huberror.o io_init.o iomv.o klconflib.o sn2/ |
| 12 | obj-$(CONFIG_IA64_GENERIC) += machvec.o | 14 | obj-$(CONFIG_IA64_GENERIC) += machvec.o |
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c index dd73c0cb754b..1f11db470d90 100644 --- a/arch/ia64/sn/kernel/bte.c +++ b/arch/ia64/sn/kernel/bte.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
| @@ -186,18 +186,13 @@ retry_bteop: | |||
| 186 | 186 | ||
| 187 | /* Initialize the notification to a known value. */ | 187 | /* Initialize the notification to a known value. */ |
| 188 | *bte->most_rcnt_na = BTE_WORD_BUSY; | 188 | *bte->most_rcnt_na = BTE_WORD_BUSY; |
| 189 | notif_phys_addr = TO_PHYS(ia64_tpa((unsigned long)bte->most_rcnt_na)); | 189 | notif_phys_addr = (u64)bte->most_rcnt_na; |
| 190 | 190 | ||
| 191 | if (is_shub2()) { | ||
| 192 | src = SH2_TIO_PHYS_TO_DMA(src); | ||
| 193 | dest = SH2_TIO_PHYS_TO_DMA(dest); | ||
| 194 | notif_phys_addr = SH2_TIO_PHYS_TO_DMA(notif_phys_addr); | ||
| 195 | } | ||
| 196 | /* Set the source and destination registers */ | 191 | /* Set the source and destination registers */ |
| 197 | BTE_PRINTKV(("IBSA = 0x%lx)\n", (TO_PHYS(src)))); | 192 | BTE_PRINTKV(("IBSA = 0x%lx)\n", src)); |
| 198 | BTE_SRC_STORE(bte, TO_PHYS(src)); | 193 | BTE_SRC_STORE(bte, src); |
| 199 | BTE_PRINTKV(("IBDA = 0x%lx)\n", (TO_PHYS(dest)))); | 194 | BTE_PRINTKV(("IBDA = 0x%lx)\n", dest)); |
| 200 | BTE_DEST_STORE(bte, TO_PHYS(dest)); | 195 | BTE_DEST_STORE(bte, dest); |
| 201 | 196 | ||
| 202 | /* Set the notification register */ | 197 | /* Set the notification register */ |
| 203 | BTE_PRINTKV(("IBNA = 0x%lx)\n", notif_phys_addr)); | 198 | BTE_PRINTKV(("IBNA = 0x%lx)\n", notif_phys_addr)); |
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index a4c78152b336..d7e4d79e16a8 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
| @@ -208,7 +208,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device, | |||
| 208 | * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for | 208 | * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for |
| 209 | * each node in the system. | 209 | * each node in the system. |
| 210 | */ | 210 | */ |
| 211 | static void sn_fixup_ionodes(void) | 211 | static void __init sn_fixup_ionodes(void) |
| 212 | { | 212 | { |
| 213 | struct sn_flush_device_kernel *sn_flush_device_kernel; | 213 | struct sn_flush_device_kernel *sn_flush_device_kernel; |
| 214 | struct sn_flush_device_kernel *dev_entry; | 214 | struct sn_flush_device_kernel *dev_entry; |
| @@ -467,6 +467,13 @@ void sn_pci_fixup_slot(struct pci_dev *dev) | |||
| 467 | pcidev_info->pdi_sn_irq_info = NULL; | 467 | pcidev_info->pdi_sn_irq_info = NULL; |
| 468 | kfree(sn_irq_info); | 468 | kfree(sn_irq_info); |
| 469 | } | 469 | } |
| 470 | |||
| 471 | /* | ||
| 472 | * MSI currently not supported on altix. Remove this when | ||
| 473 | * the MSI abstraction patches are integrated into the kernel | ||
| 474 | * (sometime after 2.6.16 releases) | ||
| 475 | */ | ||
| 476 | dev->no_msi = 1; | ||
| 470 | } | 477 | } |
| 471 | 478 | ||
| 472 | /* | 479 | /* |
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c index ec37084bdc17..74d87d903d5d 100644 --- a/arch/ia64/sn/kernel/irq.c +++ b/arch/ia64/sn/kernel/irq.c | |||
| @@ -5,11 +5,12 @@ | |||
| 5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. | 6 | * for more details. |
| 7 | * | 7 | * |
| 8 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. | 8 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
| 12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
| 13 | #include <linux/init.h> | ||
| 13 | #include <asm/sn/addrs.h> | 14 | #include <asm/sn/addrs.h> |
| 14 | #include <asm/sn/arch.h> | 15 | #include <asm/sn/arch.h> |
| 15 | #include <asm/sn/intr.h> | 16 | #include <asm/sn/intr.h> |
| @@ -76,17 +77,15 @@ static void sn_enable_irq(unsigned int irq) | |||
| 76 | 77 | ||
| 77 | static void sn_ack_irq(unsigned int irq) | 78 | static void sn_ack_irq(unsigned int irq) |
| 78 | { | 79 | { |
| 79 | u64 event_occurred, mask = 0; | 80 | u64 event_occurred, mask; |
| 80 | 81 | ||
| 81 | irq = irq & 0xff; | 82 | irq = irq & 0xff; |
| 82 | event_occurred = | 83 | event_occurred = HUB_L((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED)); |
| 83 | HUB_L((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED)); | ||
| 84 | mask = event_occurred & SH_ALL_INT_MASK; | 84 | mask = event_occurred & SH_ALL_INT_MASK; |
| 85 | HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), | 85 | HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), mask); |
| 86 | mask); | ||
| 87 | __set_bit(irq, (volatile void *)pda->sn_in_service_ivecs); | 86 | __set_bit(irq, (volatile void *)pda->sn_in_service_ivecs); |
| 88 | 87 | ||
| 89 | move_irq(irq); | 88 | move_native_irq(irq); |
| 90 | } | 89 | } |
| 91 | 90 | ||
| 92 | static void sn_end_irq(unsigned int irq) | 91 | static void sn_end_irq(unsigned int irq) |
| @@ -219,9 +218,8 @@ static void register_intr_pda(struct sn_irq_info *sn_irq_info) | |||
| 219 | pdacpu(cpu)->sn_last_irq = irq; | 218 | pdacpu(cpu)->sn_last_irq = irq; |
| 220 | } | 219 | } |
| 221 | 220 | ||
| 222 | if (pdacpu(cpu)->sn_first_irq == 0 || pdacpu(cpu)->sn_first_irq > irq) { | 221 | if (pdacpu(cpu)->sn_first_irq == 0 || pdacpu(cpu)->sn_first_irq > irq) |
| 223 | pdacpu(cpu)->sn_first_irq = irq; | 222 | pdacpu(cpu)->sn_first_irq = irq; |
| 224 | } | ||
| 225 | } | 223 | } |
| 226 | 224 | ||
| 227 | static void unregister_intr_pda(struct sn_irq_info *sn_irq_info) | 225 | static void unregister_intr_pda(struct sn_irq_info *sn_irq_info) |
| @@ -289,7 +287,7 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info) | |||
| 289 | list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); | 287 | list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); |
| 290 | spin_unlock(&sn_irq_info_lock); | 288 | spin_unlock(&sn_irq_info_lock); |
| 291 | 289 | ||
| 292 | (void)register_intr_pda(sn_irq_info); | 290 | register_intr_pda(sn_irq_info); |
| 293 | } | 291 | } |
| 294 | 292 | ||
| 295 | void sn_irq_unfixup(struct pci_dev *pci_dev) | 293 | void sn_irq_unfixup(struct pci_dev *pci_dev) |
| @@ -419,7 +417,7 @@ void sn_lb_int_war_check(void) | |||
| 419 | rcu_read_unlock(); | 417 | rcu_read_unlock(); |
| 420 | } | 418 | } |
| 421 | 419 | ||
| 422 | void sn_irq_lh_init(void) | 420 | void __init sn_irq_lh_init(void) |
| 423 | { | 421 | { |
| 424 | int i; | 422 | int i; |
| 425 | 423 | ||
| @@ -434,5 +432,4 @@ void sn_irq_lh_init(void) | |||
| 434 | 432 | ||
| 435 | INIT_LIST_HEAD(sn_irq_lh[i]); | 433 | INIT_LIST_HEAD(sn_irq_lh[i]); |
| 436 | } | 434 | } |
| 437 | |||
| 438 | } | 435 | } |
diff --git a/arch/ia64/sn/kernel/klconflib.c b/arch/ia64/sn/kernel/klconflib.c index 0f11a3299cd2..87682b48ef83 100644 --- a/arch/ia64/sn/kernel/klconflib.c +++ b/arch/ia64/sn/kernel/klconflib.c | |||
| @@ -78,31 +78,30 @@ format_module_id(char *buffer, moduleid_t m, int fmt) | |||
| 78 | position = MODULE_GET_BPOS(m); | 78 | position = MODULE_GET_BPOS(m); |
| 79 | 79 | ||
| 80 | if ((fmt == MODULE_FORMAT_BRIEF) || (fmt == MODULE_FORMAT_LCD)) { | 80 | if ((fmt == MODULE_FORMAT_BRIEF) || (fmt == MODULE_FORMAT_LCD)) { |
| 81 | /* Brief module number format, eg. 002c15 */ | 81 | /* Brief module number format, eg. 002c15 */ |
| 82 | 82 | ||
| 83 | /* Decompress the rack number */ | 83 | /* Decompress the rack number */ |
| 84 | *buffer++ = '0' + RACK_GET_CLASS(rack); | 84 | *buffer++ = '0' + RACK_GET_CLASS(rack); |
| 85 | *buffer++ = '0' + RACK_GET_GROUP(rack); | 85 | *buffer++ = '0' + RACK_GET_GROUP(rack); |
| 86 | *buffer++ = '0' + RACK_GET_NUM(rack); | 86 | *buffer++ = '0' + RACK_GET_NUM(rack); |
| 87 | 87 | ||
| 88 | /* Add the brick type */ | 88 | /* Add the brick type */ |
| 89 | *buffer++ = brickchar; | 89 | *buffer++ = brickchar; |
| 90 | } | 90 | } |
| 91 | else if (fmt == MODULE_FORMAT_LONG) { | 91 | else if (fmt == MODULE_FORMAT_LONG) { |
| 92 | /* Fuller hwgraph format, eg. rack/002/bay/15 */ | 92 | /* Fuller hwgraph format, eg. rack/002/bay/15 */ |
| 93 | 93 | ||
| 94 | strcpy(buffer, "rack" "/"); buffer += strlen(buffer); | 94 | strcpy(buffer, "rack" "/"); buffer += strlen(buffer); |
| 95 | 95 | ||
| 96 | *buffer++ = '0' + RACK_GET_CLASS(rack); | 96 | *buffer++ = '0' + RACK_GET_CLASS(rack); |
| 97 | *buffer++ = '0' + RACK_GET_GROUP(rack); | 97 | *buffer++ = '0' + RACK_GET_GROUP(rack); |
| 98 | *buffer++ = '0' + RACK_GET_NUM(rack); | 98 | *buffer++ = '0' + RACK_GET_NUM(rack); |
| 99 | 99 | ||
| 100 | strcpy(buffer, "/" "bay" "/"); buffer += strlen(buffer); | 100 | strcpy(buffer, "/" "bay" "/"); buffer += strlen(buffer); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /* Add the bay position, using at least two digits */ | 103 | /* Add the bay position, using at least two digits */ |
| 104 | if (position < 10) | 104 | if (position < 10) |
| 105 | *buffer++ = '0'; | 105 | *buffer++ = '0'; |
| 106 | sprintf(buffer, "%d", position); | 106 | sprintf(buffer, "%d", position); |
| 107 | |||
| 108 | } | 107 | } |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index e510dce9971f..ee36bff93c30 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
| @@ -209,7 +209,7 @@ void __init early_sn_setup(void) | |||
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | extern int platform_intr_list[]; | 211 | extern int platform_intr_list[]; |
| 212 | static int __initdata shub_1_1_found = 0; | 212 | static int __initdata shub_1_1_found; |
| 213 | 213 | ||
| 214 | /* | 214 | /* |
| 215 | * sn_check_for_wars | 215 | * sn_check_for_wars |
| @@ -578,13 +578,17 @@ void __init sn_cpu_init(void) | |||
| 578 | sn_prom_type = 2; | 578 | sn_prom_type = 2; |
| 579 | else | 579 | else |
| 580 | sn_prom_type = 1; | 580 | sn_prom_type = 1; |
| 581 | printk("Running on medusa with %s PROM\n", (sn_prom_type == 1) ? "real" : "fake"); | 581 | printk(KERN_INFO "Running on medusa with %s PROM\n", |
| 582 | (sn_prom_type == 1) ? "real" : "fake"); | ||
| 582 | } | 583 | } |
| 583 | 584 | ||
| 584 | memset(pda, 0, sizeof(pda)); | 585 | memset(pda, 0, sizeof(pda)); |
| 585 | if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, &sn_hub_info->nasid_bitmask, &sn_hub_info->nasid_shift, | 586 | if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2, |
| 586 | &sn_system_size, &sn_sharing_domain_size, &sn_partition_id, | 587 | &sn_hub_info->nasid_bitmask, |
| 587 | &sn_coherency_id, &sn_region_size)) | 588 | &sn_hub_info->nasid_shift, |
| 589 | &sn_system_size, &sn_sharing_domain_size, | ||
| 590 | &sn_partition_id, &sn_coherency_id, | ||
| 591 | &sn_region_size)) | ||
| 588 | BUG(); | 592 | BUG(); |
| 589 | sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2; | 593 | sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2; |
| 590 | 594 | ||
| @@ -716,7 +720,8 @@ void __init build_cnode_tables(void) | |||
| 716 | for_each_online_node(node) { | 720 | for_each_online_node(node) { |
| 717 | kl_config_hdr_t *klgraph_header; | 721 | kl_config_hdr_t *klgraph_header; |
| 718 | nasid = cnodeid_to_nasid(node); | 722 | nasid = cnodeid_to_nasid(node); |
| 719 | if ((klgraph_header = ia64_sn_get_klconfig_addr(nasid)) == NULL) | 723 | klgraph_header = ia64_sn_get_klconfig_addr(nasid); |
| 724 | if (klgraph_header == NULL) | ||
| 720 | BUG(); | 725 | BUG(); |
| 721 | brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info); | 726 | brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info); |
| 722 | while (brd) { | 727 | while (brd) { |
| @@ -734,7 +739,7 @@ nasid_slice_to_cpuid(int nasid, int slice) | |||
| 734 | { | 739 | { |
| 735 | long cpu; | 740 | long cpu; |
| 736 | 741 | ||
| 737 | for (cpu=0; cpu < NR_CPUS; cpu++) | 742 | for (cpu = 0; cpu < NR_CPUS; cpu++) |
| 738 | if (cpuid_to_nasid(cpu) == nasid && | 743 | if (cpuid_to_nasid(cpu) == nasid && |
| 739 | cpuid_to_slice(cpu) == slice) | 744 | cpuid_to_slice(cpu) == slice) |
| 740 | return cpu; | 745 | return cpu; |
diff --git a/arch/ia64/sn/kernel/sn2/Makefile b/arch/ia64/sn/kernel/sn2/Makefile index 170bde4549da..99e177693234 100644 --- a/arch/ia64/sn/kernel/sn2/Makefile +++ b/arch/ia64/sn/kernel/sn2/Makefile | |||
| @@ -9,5 +9,7 @@ | |||
| 9 | # sn2 specific kernel files | 9 | # sn2 specific kernel files |
| 10 | # | 10 | # |
| 11 | 11 | ||
| 12 | CPPFLAGS += -I$(srctree)/arch/ia64/sn/include | ||
| 13 | |||
| 12 | obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \ | 14 | obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \ |
| 13 | prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o | 15 | prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o |
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c index 471bbaa65d1b..f153a4c35c70 100644 --- a/arch/ia64/sn/kernel/sn2/sn2_smp.c +++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. | 6 | * for more details. |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 2000-2005 Silicon Graphics, Inc. All rights reserved. | 8 | * Copyright (C) 2000-2006 Silicon Graphics, Inc. All rights reserved. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| @@ -46,104 +46,28 @@ DECLARE_PER_CPU(struct ptc_stats, ptcstats); | |||
| 46 | 46 | ||
| 47 | static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock); | 47 | static __cacheline_aligned DEFINE_SPINLOCK(sn2_global_ptc_lock); |
| 48 | 48 | ||
| 49 | void sn2_ptc_deadlock_recovery(short *, short, int, volatile unsigned long *, unsigned long data0, | 49 | void sn2_ptc_deadlock_recovery(short *, short, short, int, volatile unsigned long *, unsigned long, |
| 50 | volatile unsigned long *, unsigned long data1); | 50 | volatile unsigned long *, unsigned long); |
| 51 | 51 | ||
| 52 | #ifdef DEBUG_PTC | ||
| 53 | /* | 52 | /* |
| 54 | * ptctest: | 53 | * Note: some is the following is captured here to make degugging easier |
| 55 | * | 54 | * (the macros make more sense if you see the debug patch - not posted) |
| 56 | * xyz - 3 digit hex number: | ||
| 57 | * x - Force PTC purges to use shub: | ||
| 58 | * 0 - no force | ||
| 59 | * 1 - force | ||
| 60 | * y - interupt enable | ||
| 61 | * 0 - disable interrupts | ||
| 62 | * 1 - leave interuupts enabled | ||
| 63 | * z - type of lock: | ||
| 64 | * 0 - global lock | ||
| 65 | * 1 - node local lock | ||
| 66 | * 2 - no lock | ||
| 67 | * | ||
| 68 | * Note: on shub1, only ptctest == 0 is supported. Don't try other values! | ||
| 69 | */ | 55 | */ |
| 70 | |||
| 71 | static unsigned int sn2_ptctest = 0; | ||
| 72 | |||
| 73 | static int __init ptc_test(char *str) | ||
| 74 | { | ||
| 75 | get_option(&str, &sn2_ptctest); | ||
| 76 | return 1; | ||
| 77 | } | ||
| 78 | __setup("ptctest=", ptc_test); | ||
| 79 | |||
| 80 | static inline int ptc_lock(unsigned long *flagp) | ||
| 81 | { | ||
| 82 | unsigned long opt = sn2_ptctest & 255; | ||
| 83 | |||
| 84 | switch (opt) { | ||
| 85 | case 0x00: | ||
| 86 | spin_lock_irqsave(&sn2_global_ptc_lock, *flagp); | ||
| 87 | break; | ||
| 88 | case 0x01: | ||
| 89 | spin_lock_irqsave(&sn_nodepda->ptc_lock, *flagp); | ||
| 90 | break; | ||
| 91 | case 0x02: | ||
| 92 | local_irq_save(*flagp); | ||
| 93 | break; | ||
| 94 | case 0x10: | ||
| 95 | spin_lock(&sn2_global_ptc_lock); | ||
| 96 | break; | ||
| 97 | case 0x11: | ||
| 98 | spin_lock(&sn_nodepda->ptc_lock); | ||
| 99 | break; | ||
| 100 | case 0x12: | ||
| 101 | break; | ||
| 102 | default: | ||
| 103 | BUG(); | ||
| 104 | } | ||
| 105 | return opt; | ||
| 106 | } | ||
| 107 | |||
| 108 | static inline void ptc_unlock(unsigned long flags, int opt) | ||
| 109 | { | ||
| 110 | switch (opt) { | ||
| 111 | case 0x00: | ||
| 112 | spin_unlock_irqrestore(&sn2_global_ptc_lock, flags); | ||
| 113 | break; | ||
| 114 | case 0x01: | ||
| 115 | spin_unlock_irqrestore(&sn_nodepda->ptc_lock, flags); | ||
| 116 | break; | ||
| 117 | case 0x02: | ||
| 118 | local_irq_restore(flags); | ||
| 119 | break; | ||
| 120 | case 0x10: | ||
| 121 | spin_unlock(&sn2_global_ptc_lock); | ||
| 122 | break; | ||
| 123 | case 0x11: | ||
| 124 | spin_unlock(&sn_nodepda->ptc_lock); | ||
| 125 | break; | ||
| 126 | case 0x12: | ||
| 127 | break; | ||
| 128 | default: | ||
| 129 | BUG(); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | #else | ||
| 133 | |||
| 134 | #define sn2_ptctest 0 | 56 | #define sn2_ptctest 0 |
| 57 | #define local_node_uses_ptc_ga(sh1) ((sh1) ? 1 : 0) | ||
| 58 | #define max_active_pio(sh1) ((sh1) ? 32 : 7) | ||
| 59 | #define reset_max_active_on_deadlock() 1 | ||
| 60 | #define PTC_LOCK(sh1) ((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock) | ||
| 135 | 61 | ||
| 136 | static inline int ptc_lock(unsigned long *flagp) | 62 | static inline void ptc_lock(int sh1, unsigned long *flagp) |
| 137 | { | 63 | { |
| 138 | spin_lock_irqsave(&sn2_global_ptc_lock, *flagp); | 64 | spin_lock_irqsave(PTC_LOCK(sh1), *flagp); |
| 139 | return 0; | ||
| 140 | } | 65 | } |
| 141 | 66 | ||
| 142 | static inline void ptc_unlock(unsigned long flags, int opt) | 67 | static inline void ptc_unlock(int sh1, unsigned long flags) |
| 143 | { | 68 | { |
| 144 | spin_unlock_irqrestore(&sn2_global_ptc_lock, flags); | 69 | spin_unlock_irqrestore(PTC_LOCK(sh1), flags); |
| 145 | } | 70 | } |
| 146 | #endif | ||
| 147 | 71 | ||
| 148 | struct ptc_stats { | 72 | struct ptc_stats { |
| 149 | unsigned long ptc_l; | 73 | unsigned long ptc_l; |
| @@ -151,27 +75,30 @@ struct ptc_stats { | |||
| 151 | unsigned long shub_ptc_flushes; | 75 | unsigned long shub_ptc_flushes; |
| 152 | unsigned long nodes_flushed; | 76 | unsigned long nodes_flushed; |
| 153 | unsigned long deadlocks; | 77 | unsigned long deadlocks; |
| 78 | unsigned long deadlocks2; | ||
| 154 | unsigned long lock_itc_clocks; | 79 | unsigned long lock_itc_clocks; |
| 155 | unsigned long shub_itc_clocks; | 80 | unsigned long shub_itc_clocks; |
| 156 | unsigned long shub_itc_clocks_max; | 81 | unsigned long shub_itc_clocks_max; |
| 82 | unsigned long shub_ptc_flushes_not_my_mm; | ||
| 157 | }; | 83 | }; |
| 158 | 84 | ||
| 159 | static inline unsigned long wait_piowc(void) | 85 | static inline unsigned long wait_piowc(void) |
| 160 | { | 86 | { |
| 161 | volatile unsigned long *piows, zeroval; | 87 | volatile unsigned long *piows; |
| 162 | unsigned long ws; | 88 | unsigned long zeroval, ws; |
| 163 | 89 | ||
| 164 | piows = pda->pio_write_status_addr; | 90 | piows = pda->pio_write_status_addr; |
| 165 | zeroval = pda->pio_write_status_val; | 91 | zeroval = pda->pio_write_status_val; |
| 166 | do { | 92 | do { |
| 167 | cpu_relax(); | 93 | cpu_relax(); |
| 168 | } while (((ws = *piows) & SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK) != zeroval); | 94 | } while (((ws = *piows) & SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK) != zeroval); |
| 169 | return ws; | 95 | return (ws & SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK) != 0; |
| 170 | } | 96 | } |
| 171 | 97 | ||
| 172 | void sn_tlb_migrate_finish(struct mm_struct *mm) | 98 | void sn_tlb_migrate_finish(struct mm_struct *mm) |
| 173 | { | 99 | { |
| 174 | if (mm == current->mm) | 100 | /* flush_tlb_mm is inefficient if more than 1 users of mm */ |
| 101 | if (mm == current->mm && mm && atomic_read(&mm->mm_users) == 1) | ||
| 175 | flush_tlb_mm(mm); | 102 | flush_tlb_mm(mm); |
| 176 | } | 103 | } |
| 177 | 104 | ||
| @@ -201,12 +128,14 @@ void | |||
| 201 | sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, | 128 | sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, |
| 202 | unsigned long end, unsigned long nbits) | 129 | unsigned long end, unsigned long nbits) |
| 203 | { | 130 | { |
| 204 | int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0; | 131 | int i, ibegin, shub1, cnode, mynasid, cpu, lcpu = 0, nasid; |
| 205 | int mymm = (mm == current->active_mm && current->mm); | 132 | int mymm = (mm == current->active_mm && mm == current->mm); |
| 133 | int use_cpu_ptcga; | ||
| 206 | volatile unsigned long *ptc0, *ptc1; | 134 | volatile unsigned long *ptc0, *ptc1; |
| 207 | unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value; | 135 | unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value, old_rr = 0; |
| 208 | short nasids[MAX_NUMNODES], nix; | 136 | short nasids[MAX_NUMNODES], nix; |
| 209 | nodemask_t nodes_flushed; | 137 | nodemask_t nodes_flushed; |
| 138 | int active, max_active, deadlock; | ||
| 210 | 139 | ||
| 211 | nodes_clear(nodes_flushed); | 140 | nodes_clear(nodes_flushed); |
| 212 | i = 0; | 141 | i = 0; |
| @@ -267,41 +196,56 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, | |||
| 267 | 196 | ||
| 268 | 197 | ||
| 269 | mynasid = get_nasid(); | 198 | mynasid = get_nasid(); |
| 199 | use_cpu_ptcga = local_node_uses_ptc_ga(shub1); | ||
| 200 | max_active = max_active_pio(shub1); | ||
| 270 | 201 | ||
| 271 | itc = ia64_get_itc(); | 202 | itc = ia64_get_itc(); |
| 272 | opt = ptc_lock(&flags); | 203 | ptc_lock(shub1, &flags); |
| 273 | itc2 = ia64_get_itc(); | 204 | itc2 = ia64_get_itc(); |
| 205 | |||
| 274 | __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc; | 206 | __get_cpu_var(ptcstats).lock_itc_clocks += itc2 - itc; |
| 275 | __get_cpu_var(ptcstats).shub_ptc_flushes++; | 207 | __get_cpu_var(ptcstats).shub_ptc_flushes++; |
| 276 | __get_cpu_var(ptcstats).nodes_flushed += nix; | 208 | __get_cpu_var(ptcstats).nodes_flushed += nix; |
| 209 | if (!mymm) | ||
| 210 | __get_cpu_var(ptcstats).shub_ptc_flushes_not_my_mm++; | ||
| 277 | 211 | ||
| 212 | if (use_cpu_ptcga && !mymm) { | ||
| 213 | old_rr = ia64_get_rr(start); | ||
| 214 | ia64_set_rr(start, (old_rr & 0xff) | (rr_value << 8)); | ||
| 215 | ia64_srlz_d(); | ||
| 216 | } | ||
| 217 | |||
| 218 | wait_piowc(); | ||
| 278 | do { | 219 | do { |
| 279 | if (shub1) | 220 | if (shub1) |
| 280 | data1 = start | (1UL << SH1_PTC_1_START_SHFT); | 221 | data1 = start | (1UL << SH1_PTC_1_START_SHFT); |
| 281 | else | 222 | else |
| 282 | data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK); | 223 | data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK); |
| 283 | for (i = 0; i < nix; i++) { | 224 | deadlock = 0; |
| 225 | active = 0; | ||
| 226 | for (ibegin = 0, i = 0; i < nix; i++) { | ||
| 284 | nasid = nasids[i]; | 227 | nasid = nasids[i]; |
| 285 | if ((!(sn2_ptctest & 3)) && unlikely(nasid == mynasid && mymm)) { | 228 | if (use_cpu_ptcga && unlikely(nasid == mynasid)) { |
| 286 | ia64_ptcga(start, nbits << 2); | 229 | ia64_ptcga(start, nbits << 2); |
| 287 | ia64_srlz_i(); | 230 | ia64_srlz_i(); |
| 288 | } else { | 231 | } else { |
| 289 | ptc0 = CHANGE_NASID(nasid, ptc0); | 232 | ptc0 = CHANGE_NASID(nasid, ptc0); |
| 290 | if (ptc1) | 233 | if (ptc1) |
| 291 | ptc1 = CHANGE_NASID(nasid, ptc1); | 234 | ptc1 = CHANGE_NASID(nasid, ptc1); |
| 292 | pio_atomic_phys_write_mmrs(ptc0, data0, ptc1, | 235 | pio_atomic_phys_write_mmrs(ptc0, data0, ptc1, data1); |
| 293 | data1); | 236 | active++; |
| 294 | flushed = 1; | 237 | } |
| 238 | if (active >= max_active || i == (nix - 1)) { | ||
| 239 | if ((deadlock = wait_piowc())) { | ||
| 240 | sn2_ptc_deadlock_recovery(nasids, ibegin, i, mynasid, ptc0, data0, ptc1, data1); | ||
| 241 | if (reset_max_active_on_deadlock()) | ||
| 242 | max_active = 1; | ||
| 243 | } | ||
| 244 | active = 0; | ||
| 245 | ibegin = i + 1; | ||
| 295 | } | 246 | } |
| 296 | } | 247 | } |
| 297 | if (flushed | ||
| 298 | && (wait_piowc() & | ||
| 299 | (SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK))) { | ||
| 300 | sn2_ptc_deadlock_recovery(nasids, nix, mynasid, ptc0, data0, ptc1, data1); | ||
| 301 | } | ||
| 302 | |||
| 303 | start += (1UL << nbits); | 248 | start += (1UL << nbits); |
| 304 | |||
| 305 | } while (start < end); | 249 | } while (start < end); |
| 306 | 250 | ||
| 307 | itc2 = ia64_get_itc() - itc2; | 251 | itc2 = ia64_get_itc() - itc2; |
| @@ -309,7 +253,12 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, | |||
| 309 | if (itc2 > __get_cpu_var(ptcstats).shub_itc_clocks_max) | 253 | if (itc2 > __get_cpu_var(ptcstats).shub_itc_clocks_max) |
| 310 | __get_cpu_var(ptcstats).shub_itc_clocks_max = itc2; | 254 | __get_cpu_var(ptcstats).shub_itc_clocks_max = itc2; |
| 311 | 255 | ||
| 312 | ptc_unlock(flags, opt); | 256 | if (old_rr) { |
| 257 | ia64_set_rr(start, old_rr); | ||
| 258 | ia64_srlz_d(); | ||
| 259 | } | ||
| 260 | |||
| 261 | ptc_unlock(shub1, flags); | ||
| 313 | 262 | ||
| 314 | preempt_enable(); | 263 | preempt_enable(); |
| 315 | } | 264 | } |
| @@ -321,27 +270,30 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, | |||
| 321 | * TLB flush transaction. The recovery sequence is somewhat tricky & is | 270 | * TLB flush transaction. The recovery sequence is somewhat tricky & is |
| 322 | * coded in assembly language. | 271 | * coded in assembly language. |
| 323 | */ | 272 | */ |
| 324 | void sn2_ptc_deadlock_recovery(short *nasids, short nix, int mynasid, volatile unsigned long *ptc0, unsigned long data0, | 273 | void sn2_ptc_deadlock_recovery(short *nasids, short ib, short ie, int mynasid, volatile unsigned long *ptc0, unsigned long data0, |
| 325 | volatile unsigned long *ptc1, unsigned long data1) | 274 | volatile unsigned long *ptc1, unsigned long data1) |
| 326 | { | 275 | { |
| 327 | extern void sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long, | 276 | extern unsigned long sn2_ptc_deadlock_recovery_core(volatile unsigned long *, unsigned long, |
| 328 | volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long); | 277 | volatile unsigned long *, unsigned long, volatile unsigned long *, unsigned long); |
| 329 | short nasid, i; | 278 | short nasid, i; |
| 330 | unsigned long *piows, zeroval; | 279 | unsigned long *piows, zeroval, n; |
| 331 | 280 | ||
| 332 | __get_cpu_var(ptcstats).deadlocks++; | 281 | __get_cpu_var(ptcstats).deadlocks++; |
| 333 | 282 | ||
| 334 | piows = (unsigned long *) pda->pio_write_status_addr; | 283 | piows = (unsigned long *) pda->pio_write_status_addr; |
| 335 | zeroval = pda->pio_write_status_val; | 284 | zeroval = pda->pio_write_status_val; |
| 336 | 285 | ||
| 337 | for (i=0; i < nix; i++) { | 286 | |
| 287 | for (i=ib; i <= ie; i++) { | ||
| 338 | nasid = nasids[i]; | 288 | nasid = nasids[i]; |
| 339 | if (!(sn2_ptctest & 3) && nasid == mynasid) | 289 | if (local_node_uses_ptc_ga(is_shub1()) && nasid == mynasid) |
| 340 | continue; | 290 | continue; |
| 341 | ptc0 = CHANGE_NASID(nasid, ptc0); | 291 | ptc0 = CHANGE_NASID(nasid, ptc0); |
| 342 | if (ptc1) | 292 | if (ptc1) |
| 343 | ptc1 = CHANGE_NASID(nasid, ptc1); | 293 | ptc1 = CHANGE_NASID(nasid, ptc1); |
| 344 | sn2_ptc_deadlock_recovery_core(ptc0, data0, ptc1, data1, piows, zeroval); | 294 | |
| 295 | n = sn2_ptc_deadlock_recovery_core(ptc0, data0, ptc1, data1, piows, zeroval); | ||
| 296 | __get_cpu_var(ptcstats).deadlocks2 += n; | ||
| 345 | } | 297 | } |
| 346 | 298 | ||
| 347 | } | 299 | } |
| @@ -452,20 +404,22 @@ static int sn2_ptc_seq_show(struct seq_file *file, void *data) | |||
| 452 | cpu = *(loff_t *) data; | 404 | cpu = *(loff_t *) data; |
| 453 | 405 | ||
| 454 | if (!cpu) { | 406 | if (!cpu) { |
| 455 | seq_printf(file, "# ptc_l change_rid shub_ptc_flushes shub_nodes_flushed deadlocks lock_nsec shub_nsec shub_nsec_max\n"); | 407 | seq_printf(file, |
| 408 | "# cpu ptc_l newrid ptc_flushes nodes_flushed deadlocks lock_nsec shub_nsec shub_nsec_max not_my_mm deadlock2\n"); | ||
| 456 | seq_printf(file, "# ptctest %d\n", sn2_ptctest); | 409 | seq_printf(file, "# ptctest %d\n", sn2_ptctest); |
| 457 | } | 410 | } |
| 458 | 411 | ||
| 459 | if (cpu < NR_CPUS && cpu_online(cpu)) { | 412 | if (cpu < NR_CPUS && cpu_online(cpu)) { |
| 460 | stat = &per_cpu(ptcstats, cpu); | 413 | stat = &per_cpu(ptcstats, cpu); |
| 461 | seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, | 414 | seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, |
| 462 | stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, | 415 | stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, |
| 463 | stat->deadlocks, | 416 | stat->deadlocks, |
| 464 | 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, | 417 | 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, |
| 465 | 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, | 418 | 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, |
| 466 | 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec); | 419 | 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec, |
| 420 | stat->shub_ptc_flushes_not_my_mm, | ||
| 421 | stat->deadlocks2); | ||
| 467 | } | 422 | } |
| 468 | |||
| 469 | return 0; | 423 | return 0; |
| 470 | } | 424 | } |
| 471 | 425 | ||
| @@ -476,7 +430,7 @@ static struct seq_operations sn2_ptc_seq_ops = { | |||
| 476 | .show = sn2_ptc_seq_show | 430 | .show = sn2_ptc_seq_show |
| 477 | }; | 431 | }; |
| 478 | 432 | ||
| 479 | int sn2_ptc_proc_open(struct inode *inode, struct file *file) | 433 | static int sn2_ptc_proc_open(struct inode *inode, struct file *file) |
| 480 | { | 434 | { |
| 481 | return seq_open(file, &sn2_ptc_seq_ops); | 435 | return seq_open(file, &sn2_ptc_seq_ops); |
| 482 | } | 436 | } |
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index c75f8aeefc2b..9cd460dfe27e 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c | |||
| @@ -575,18 +575,21 @@ xpc_activate_partition(struct xpc_partition *part) | |||
| 575 | 575 | ||
| 576 | spin_lock_irqsave(&part->act_lock, irq_flags); | 576 | spin_lock_irqsave(&part->act_lock, irq_flags); |
| 577 | 577 | ||
| 578 | pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); | ||
| 579 | |||
| 580 | DBUG_ON(part->act_state != XPC_P_INACTIVE); | 578 | DBUG_ON(part->act_state != XPC_P_INACTIVE); |
| 581 | 579 | ||
| 582 | if (pid > 0) { | 580 | part->act_state = XPC_P_ACTIVATION_REQ; |
| 583 | part->act_state = XPC_P_ACTIVATION_REQ; | 581 | XPC_SET_REASON(part, xpcCloneKThread, __LINE__); |
| 584 | XPC_SET_REASON(part, xpcCloneKThread, __LINE__); | ||
| 585 | } else { | ||
| 586 | XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__); | ||
| 587 | } | ||
| 588 | 582 | ||
| 589 | spin_unlock_irqrestore(&part->act_lock, irq_flags); | 583 | spin_unlock_irqrestore(&part->act_lock, irq_flags); |
| 584 | |||
| 585 | pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); | ||
| 586 | |||
| 587 | if (unlikely(pid <= 0)) { | ||
| 588 | spin_lock_irqsave(&part->act_lock, irq_flags); | ||
| 589 | part->act_state = XPC_P_INACTIVE; | ||
| 590 | XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__); | ||
| 591 | spin_unlock_irqrestore(&part->act_lock, irq_flags); | ||
| 592 | } | ||
| 590 | } | 593 | } |
| 591 | 594 | ||
| 592 | 595 | ||
diff --git a/arch/ia64/sn/pci/Makefile b/arch/ia64/sn/pci/Makefile index 321576b1b425..c6946784a6a8 100644 --- a/arch/ia64/sn/pci/Makefile +++ b/arch/ia64/sn/pci/Makefile | |||
| @@ -7,4 +7,6 @@ | |||
| 7 | # | 7 | # |
| 8 | # Makefile for the sn pci general routines. | 8 | # Makefile for the sn pci general routines. |
| 9 | 9 | ||
| 10 | CPPFLAGS += -I$(srctree)/arch/ia64/sn/include | ||
| 11 | |||
| 10 | obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/ | 12 | obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/ |
diff --git a/arch/ia64/sn/pci/pcibr/Makefile b/arch/ia64/sn/pci/pcibr/Makefile index 1850c4a94c41..3b403ea456f9 100644 --- a/arch/ia64/sn/pci/pcibr/Makefile +++ b/arch/ia64/sn/pci/pcibr/Makefile | |||
| @@ -7,5 +7,7 @@ | |||
| 7 | # | 7 | # |
| 8 | # Makefile for the sn2 io routines. | 8 | # Makefile for the sn2 io routines. |
| 9 | 9 | ||
| 10 | CPPFLAGS += -I$(srctree)/arch/ia64/sn/include | ||
| 11 | |||
| 10 | obj-y += pcibr_dma.o pcibr_reg.o \ | 12 | obj-y += pcibr_dma.o pcibr_reg.o \ |
| 11 | pcibr_ate.o pcibr_provider.o | 13 | pcibr_ate.o pcibr_provider.o |
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index 99bf43824795..63c117dae0c3 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c | |||
| @@ -39,6 +39,14 @@ | |||
| 39 | 39 | ||
| 40 | asmlinkage void ret_from_fork(void); | 40 | asmlinkage void ret_from_fork(void); |
| 41 | 41 | ||
| 42 | /* | ||
| 43 | * The following aren't currently used. | ||
| 44 | */ | ||
| 45 | void (*pm_idle)(void); | ||
| 46 | EXPORT_SYMBOL(pm_idle); | ||
| 47 | |||
| 48 | void (*pm_power_off)(void); | ||
| 49 | EXPORT_SYMBOL(pm_power_off); | ||
| 42 | 50 | ||
| 43 | /* | 51 | /* |
| 44 | * The idle loop on an m68knommu.. | 52 | * The idle loop on an m68knommu.. |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c3e852e9953e..767de847b4ab 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -595,6 +595,7 @@ config SGI_IP32 | |||
| 595 | select SYS_HAS_CPU_R5000 | 595 | select SYS_HAS_CPU_R5000 |
| 596 | select SYS_HAS_CPU_R10000 if BROKEN | 596 | select SYS_HAS_CPU_R10000 if BROKEN |
| 597 | select SYS_HAS_CPU_RM7000 | 597 | select SYS_HAS_CPU_RM7000 |
| 598 | select SYS_HAS_CPU_NEVADA | ||
| 598 | select SYS_SUPPORTS_64BIT_KERNEL | 599 | select SYS_SUPPORTS_64BIT_KERNEL |
| 599 | select SYS_SUPPORTS_BIG_ENDIAN | 600 | select SYS_SUPPORTS_BIG_ENDIAN |
| 600 | help | 601 | help |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 2a9f2ef27b29..6a57407df1bc 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
| @@ -53,14 +53,17 @@ CROSS_COMPILE := $(tool-prefix) | |||
| 53 | endif | 53 | endif |
| 54 | 54 | ||
| 55 | CHECKFLAGS-y += -D__linux__ -D__mips__ \ | 55 | CHECKFLAGS-y += -D__linux__ -D__mips__ \ |
| 56 | -D_MIPS_SZINT=32 \ | ||
| 56 | -D_ABIO32=1 \ | 57 | -D_ABIO32=1 \ |
| 57 | -D_ABIN32=2 \ | 58 | -D_ABIN32=2 \ |
| 58 | -D_ABI64=3 | 59 | -D_ABI64=3 |
| 59 | CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \ | 60 | CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \ |
| 60 | -D_MIPS_SZLONG=32 \ | 61 | -D_MIPS_SZLONG=32 \ |
| 62 | -D_MIPS_SZPTR=32 \ | ||
| 61 | -D__PTRDIFF_TYPE__=int | 63 | -D__PTRDIFF_TYPE__=int |
| 62 | CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \ | 64 | CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \ |
| 63 | -D_MIPS_SZLONG=64 \ | 65 | -D_MIPS_SZLONG=64 \ |
| 66 | -D_MIPS_SZPTR=64 \ | ||
| 64 | -D__PTRDIFF_TYPE__="long int" | 67 | -D__PTRDIFF_TYPE__="long int" |
| 65 | CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__ | 68 | CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__ |
| 66 | CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__ | 69 | CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__ |
| @@ -166,79 +169,97 @@ echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_i | |||
| 166 | # | 169 | # |
| 167 | cflags-$(CONFIG_CPU_R3000) += \ | 170 | cflags-$(CONFIG_CPU_R3000) += \ |
| 168 | $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) | 171 | $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) |
| 172 | CHECKFLAGS-$(CONFIG_CPU_R3000) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 | ||
| 169 | 173 | ||
| 170 | cflags-$(CONFIG_CPU_TX39XX) += \ | 174 | cflags-$(CONFIG_CPU_TX39XX) += \ |
| 171 | $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) | 175 | $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) |
| 176 | CHECKFLAGS-$(CONFIG_CPU_TX39XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 | ||
| 172 | 177 | ||
| 173 | cflags-$(CONFIG_CPU_R6000) += \ | 178 | cflags-$(CONFIG_CPU_R6000) += \ |
| 174 | $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ | 179 | $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ |
| 175 | -Wa,--trap | 180 | -Wa,--trap |
| 181 | CHECKFLAGS-$(CONFIG_CPU_R6000) += -D_MIPS_ISA=_MIPS_ISA_MIPS2 | ||
| 176 | 182 | ||
| 177 | cflags-$(CONFIG_CPU_R4300) += \ | 183 | cflags-$(CONFIG_CPU_R4300) += \ |
| 178 | $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ | 184 | $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ |
| 179 | -Wa,--trap | 185 | -Wa,--trap |
| 186 | CHECKFLAGS-$(CONFIG_CPU_R4300) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 | ||
| 180 | 187 | ||
| 181 | cflags-$(CONFIG_CPU_VR41XX) += \ | 188 | cflags-$(CONFIG_CPU_VR41XX) += \ |
| 182 | $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \ | 189 | $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \ |
| 183 | -Wa,--trap | 190 | -Wa,--trap |
| 191 | CHECKFLAGS-$(CONFIG_CPU_VR41XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 | ||
| 184 | 192 | ||
| 185 | cflags-$(CONFIG_CPU_R4X00) += \ | 193 | cflags-$(CONFIG_CPU_R4X00) += \ |
| 186 | $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ | 194 | $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ |
| 187 | -Wa,--trap | 195 | -Wa,--trap |
| 196 | CHECKFLAGS-$(CONFIG_CPU_R4X00) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 | ||
| 188 | 197 | ||
| 189 | cflags-$(CONFIG_CPU_TX49XX) += \ | 198 | cflags-$(CONFIG_CPU_TX49XX) += \ |
| 190 | $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ | 199 | $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \ |
| 191 | -Wa,--trap | 200 | -Wa,--trap |
| 201 | CHECKFLAGS-$(CONFIG_CPU_TX49XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 | ||
| 192 | 202 | ||
| 193 | cflags-$(CONFIG_CPU_MIPS32_R1) += \ | 203 | cflags-$(CONFIG_CPU_MIPS32_R1) += \ |
| 194 | $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \ | 204 | $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \ |
| 195 | -Wa,--trap | 205 | -Wa,--trap |
| 206 | CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS32 | ||
| 196 | 207 | ||
| 197 | cflags-$(CONFIG_CPU_MIPS32_R2) += \ | 208 | cflags-$(CONFIG_CPU_MIPS32_R2) += \ |
| 198 | $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \ | 209 | $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \ |
| 199 | -Wa,--trap | 210 | -Wa,--trap |
| 211 | CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS32 | ||
| 200 | 212 | ||
| 201 | cflags-$(CONFIG_CPU_MIPS64_R1) += \ | 213 | cflags-$(CONFIG_CPU_MIPS64_R1) += \ |
| 202 | $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \ | 214 | $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \ |
| 203 | -Wa,--trap | 215 | -Wa,--trap |
| 216 | CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 | ||
| 204 | 217 | ||
| 205 | cflags-$(CONFIG_CPU_MIPS64_R2) += \ | 218 | cflags-$(CONFIG_CPU_MIPS64_R2) += \ |
| 206 | $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \ | 219 | $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \ |
| 207 | -Wa,--trap | 220 | -Wa,--trap |
| 221 | CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 | ||
| 208 | 222 | ||
| 209 | cflags-$(CONFIG_CPU_R5000) += \ | 223 | cflags-$(CONFIG_CPU_R5000) += \ |
| 210 | $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \ | 224 | $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \ |
| 211 | -Wa,--trap | 225 | -Wa,--trap |
| 226 | CHECKFLAGS-$(CONFIG_CPU_R5000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 212 | 227 | ||
| 213 | cflags-$(CONFIG_CPU_R5432) += \ | 228 | cflags-$(CONFIG_CPU_R5432) += \ |
| 214 | $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \ | 229 | $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \ |
| 215 | -Wa,--trap | 230 | -Wa,--trap |
| 231 | CHECKFLAGS-$(CONFIG_CPU_R5432) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 216 | 232 | ||
| 217 | cflags-$(CONFIG_CPU_NEVADA) += \ | 233 | cflags-$(CONFIG_CPU_NEVADA) += \ |
| 218 | $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ | 234 | $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \ |
| 219 | -Wa,--trap | 235 | -Wa,--trap |
| 220 | # $(call cc-option,-mmad) | 236 | CHECKFLAGS-$(CONFIG_CPU_NEVADA) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 |
| 221 | 237 | ||
| 222 | cflags-$(CONFIG_CPU_RM7000) += \ | 238 | cflags-$(CONFIG_CPU_RM7000) += \ |
| 223 | $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ | 239 | $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \ |
| 224 | -Wa,--trap | 240 | -Wa,--trap |
| 241 | CHECKFLAGS-$(CONFIG_CPU_RM7000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 225 | 242 | ||
| 226 | cflags-$(CONFIG_CPU_RM9000) += \ | 243 | cflags-$(CONFIG_CPU_RM9000) += \ |
| 227 | $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \ | 244 | $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \ |
| 228 | -Wa,--trap | 245 | -Wa,--trap |
| 246 | CHECKFLAGS-$(CONFIG_CPU_RM9000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 229 | 247 | ||
| 230 | 248 | ||
| 231 | cflags-$(CONFIG_CPU_SB1) += \ | 249 | cflags-$(CONFIG_CPU_SB1) += \ |
| 232 | $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \ | 250 | $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \ |
| 233 | -Wa,--trap | 251 | -Wa,--trap |
| 252 | CHECKFLAGS-$(CONFIG_CPU_SB1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 | ||
| 234 | 253 | ||
| 235 | cflags-$(CONFIG_CPU_R8000) += \ | 254 | cflags-$(CONFIG_CPU_R8000) += \ |
| 236 | $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \ | 255 | $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \ |
| 237 | -Wa,--trap | 256 | -Wa,--trap |
| 257 | CHECKFLAGS-$(CONFIG_CPU_R8000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 238 | 258 | ||
| 239 | cflags-$(CONFIG_CPU_R10000) += \ | 259 | cflags-$(CONFIG_CPU_R10000) += \ |
| 240 | $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \ | 260 | $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \ |
| 241 | -Wa,--trap | 261 | -Wa,--trap |
| 262 | CHECKFLAGS-$(CONFIG_CPU_R10000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 | ||
| 242 | 263 | ||
| 243 | ifdef CONFIG_CPU_SB1 | 264 | ifdef CONFIG_CPU_SB1 |
| 244 | ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | 265 | ifdef CONFIG_SB1_PASS_1_WORKAROUNDS |
| @@ -369,7 +390,7 @@ load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000 | |||
| 369 | # Cobalt Server | 390 | # Cobalt Server |
| 370 | # | 391 | # |
| 371 | core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/ | 392 | core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/ |
| 372 | cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/cobalt | 393 | cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt |
| 373 | load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000 | 394 | load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000 |
| 374 | 395 | ||
| 375 | # | 396 | # |
diff --git a/arch/mips/au1000/common/reset.c b/arch/mips/au1000/common/reset.c index 65b84db800e4..4ffccedf5967 100644 --- a/arch/mips/au1000/common/reset.c +++ b/arch/mips/au1000/common/reset.c | |||
| @@ -151,7 +151,7 @@ void au1000_restart(char *command) | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | set_c0_status(ST0_BEV | ST0_ERL); | 153 | set_c0_status(ST0_BEV | ST0_ERL); |
| 154 | set_c0_config(CONF_CM_UNCACHED); | 154 | change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); |
| 155 | flush_cache_all(); | 155 | flush_cache_all(); |
| 156 | write_c0_wired(0); | 156 | write_c0_wired(0); |
| 157 | 157 | ||
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c index 08c8c855cc9c..eb155c071aa6 100644 --- a/arch/mips/au1000/common/setup.c +++ b/arch/mips/au1000/common/setup.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
| 34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/pm.h> | ||
| 36 | 37 | ||
| 37 | #include <asm/cpu.h> | 38 | #include <asm/cpu.h> |
| 38 | #include <asm/bootinfo.h> | 39 | #include <asm/bootinfo.h> |
| @@ -125,7 +126,7 @@ void __init plat_setup(void) | |||
| 125 | #endif | 126 | #endif |
| 126 | _machine_restart = au1000_restart; | 127 | _machine_restart = au1000_restart; |
| 127 | _machine_halt = au1000_halt; | 128 | _machine_halt = au1000_halt; |
| 128 | _machine_power_off = au1000_power_off; | 129 | pm_power_off = au1000_power_off; |
| 129 | board_time_init = au1xxx_time_init; | 130 | board_time_init = au1xxx_time_init; |
| 130 | board_timer_setup = au1xxx_timer_setup; | 131 | board_timer_setup = au1xxx_timer_setup; |
| 131 | 132 | ||
diff --git a/arch/mips/cobalt/int-handler.S b/arch/mips/cobalt/int-handler.S index f92608e8d84f..e75d5e3ca868 100644 --- a/arch/mips/cobalt/int-handler.S +++ b/arch/mips/cobalt/int-handler.S | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | #include <asm/asm.h> | 9 | #include <asm/asm.h> |
| 10 | #include <asm/mipsregs.h> | 10 | #include <asm/mipsregs.h> |
| 11 | #include <asm/cobalt/cobalt.h> | 11 | #include <asm/mach-cobalt/cobalt.h> |
| 12 | #include <asm/regdef.h> | 12 | #include <asm/regdef.h> |
| 13 | #include <asm/stackframe.h> | 13 | #include <asm/stackframe.h> |
| 14 | 14 | ||
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c index 0d90851f925e..f9a108820d6e 100644 --- a/arch/mips/cobalt/irq.c +++ b/arch/mips/cobalt/irq.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #include <asm/gt64120.h> | 18 | #include <asm/gt64120.h> |
| 19 | #include <asm/ptrace.h> | 19 | #include <asm/ptrace.h> |
| 20 | 20 | ||
| 21 | #include <asm/cobalt/cobalt.h> | 21 | #include <asm/mach-cobalt/cobalt.h> |
| 22 | 22 | ||
| 23 | extern void cobalt_handle_int(void); | 23 | extern void cobalt_handle_int(void); |
| 24 | 24 | ||
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c index 805a0e88507b..753dfccae6fa 100644 --- a/arch/mips/cobalt/reset.c +++ b/arch/mips/cobalt/reset.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <asm/reboot.h> | 16 | #include <asm/reboot.h> |
| 17 | #include <asm/system.h> | 17 | #include <asm/system.h> |
| 18 | #include <asm/mipsregs.h> | 18 | #include <asm/mipsregs.h> |
| 19 | #include <asm/cobalt/cobalt.h> | 19 | #include <asm/mach-cobalt/cobalt.h> |
| 20 | 20 | ||
| 21 | void cobalt_machine_halt(void) | 21 | void cobalt_machine_halt(void) |
| 22 | { | 22 | { |
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c index d358a118fa31..050685b87a3c 100644 --- a/arch/mips/cobalt/setup.c +++ b/arch/mips/cobalt/setup.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. | 6 | * for more details. |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org) | 8 | * Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org) |
| 9 | * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv) | 9 | * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv) |
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/pm.h> | ||
| 16 | #include <linux/serial.h> | 17 | #include <linux/serial.h> |
| 17 | #include <linux/serial_core.h> | 18 | #include <linux/serial_core.h> |
| 18 | 19 | ||
| @@ -25,7 +26,7 @@ | |||
| 25 | #include <asm/gt64120.h> | 26 | #include <asm/gt64120.h> |
| 26 | #include <asm/serial.h> | 27 | #include <asm/serial.h> |
| 27 | 28 | ||
| 28 | #include <asm/cobalt/cobalt.h> | 29 | #include <asm/mach-cobalt/cobalt.h> |
| 29 | 30 | ||
| 30 | extern void cobalt_machine_restart(char *command); | 31 | extern void cobalt_machine_restart(char *command); |
| 31 | extern void cobalt_machine_halt(void); | 32 | extern void cobalt_machine_halt(void); |
| @@ -99,7 +100,7 @@ void __init plat_setup(void) | |||
| 99 | 100 | ||
| 100 | _machine_restart = cobalt_machine_restart; | 101 | _machine_restart = cobalt_machine_restart; |
| 101 | _machine_halt = cobalt_machine_halt; | 102 | _machine_halt = cobalt_machine_halt; |
| 102 | _machine_power_off = cobalt_machine_power_off; | 103 | pm_power_off = cobalt_machine_power_off; |
| 103 | 104 | ||
| 104 | board_timer_setup = cobalt_timer_setup; | 105 | board_timer_setup = cobalt_timer_setup; |
| 105 | 106 | ||
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig index 967e7acd8e1f..a34db6e82b27 100644 --- a/arch/mips/configs/ip32_defconfig +++ b/arch/mips/configs/ip32_defconfig | |||
| @@ -102,6 +102,7 @@ CONFIG_CPU_R5000=y | |||
| 102 | # CONFIG_CPU_RM9000 is not set | 102 | # CONFIG_CPU_RM9000 is not set |
| 103 | # CONFIG_CPU_SB1 is not set | 103 | # CONFIG_CPU_SB1 is not set |
| 104 | CONFIG_SYS_HAS_CPU_R5000=y | 104 | CONFIG_SYS_HAS_CPU_R5000=y |
| 105 | CONFIG_SYS_HAS_CPU_NEVADA=y | ||
| 105 | CONFIG_SYS_HAS_CPU_RM7000=y | 106 | CONFIG_SYS_HAS_CPU_RM7000=y |
| 106 | CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y | 107 | CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y |
| 107 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y | 108 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y |
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig index dee44606164c..c02becab850b 100644 --- a/arch/mips/configs/qemu_defconfig +++ b/arch/mips/configs/qemu_defconfig | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Linux kernel version: 2.6.15-rc2 | 3 | # Linux kernel version: 2.6.16-rc2 |
| 4 | # Thu Nov 24 01:07:00 2005 | 4 | # Fri Feb 3 17:14:27 2006 |
| 5 | # | 5 | # |
| 6 | CONFIG_MIPS=y | 6 | CONFIG_MIPS=y |
| 7 | 7 | ||
| @@ -147,26 +147,27 @@ CONFIG_LOCALVERSION_AUTO=y | |||
| 147 | # CONFIG_BSD_PROCESS_ACCT is not set | 147 | # CONFIG_BSD_PROCESS_ACCT is not set |
| 148 | # CONFIG_SYSCTL is not set | 148 | # CONFIG_SYSCTL is not set |
| 149 | # CONFIG_AUDIT is not set | 149 | # CONFIG_AUDIT is not set |
| 150 | # CONFIG_HOTPLUG is not set | ||
| 151 | CONFIG_KOBJECT_UEVENT=y | ||
| 152 | # CONFIG_IKCONFIG is not set | 150 | # CONFIG_IKCONFIG is not set |
| 153 | CONFIG_INITRAMFS_SOURCE="" | 151 | CONFIG_INITRAMFS_SOURCE="" |
| 154 | CONFIG_EMBEDDED=y | 152 | CONFIG_EMBEDDED=y |
| 155 | CONFIG_KALLSYMS=y | 153 | CONFIG_KALLSYMS=y |
| 156 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 154 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
| 155 | # CONFIG_HOTPLUG is not set | ||
| 157 | CONFIG_PRINTK=y | 156 | CONFIG_PRINTK=y |
| 158 | # CONFIG_BUG is not set | 157 | # CONFIG_BUG is not set |
| 158 | CONFIG_ELF_CORE=y | ||
| 159 | # CONFIG_BASE_FULL is not set | 159 | # CONFIG_BASE_FULL is not set |
| 160 | # CONFIG_FUTEX is not set | 160 | # CONFIG_FUTEX is not set |
| 161 | # CONFIG_EPOLL is not set | 161 | # CONFIG_EPOLL is not set |
| 162 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | ||
| 163 | # CONFIG_SHMEM is not set | 162 | # CONFIG_SHMEM is not set |
| 164 | CONFIG_CC_ALIGN_FUNCTIONS=0 | 163 | CONFIG_CC_ALIGN_FUNCTIONS=0 |
| 165 | CONFIG_CC_ALIGN_LABELS=0 | 164 | CONFIG_CC_ALIGN_LABELS=0 |
| 166 | CONFIG_CC_ALIGN_LOOPS=0 | 165 | CONFIG_CC_ALIGN_LOOPS=0 |
| 167 | CONFIG_CC_ALIGN_JUMPS=0 | 166 | CONFIG_CC_ALIGN_JUMPS=0 |
| 167 | CONFIG_SLAB=y | ||
| 168 | CONFIG_TINY_SHMEM=y | 168 | CONFIG_TINY_SHMEM=y |
| 169 | CONFIG_BASE_SMALL=1 | 169 | CONFIG_BASE_SMALL=1 |
| 170 | # CONFIG_SLOB is not set | ||
| 170 | 171 | ||
| 171 | # | 172 | # |
| 172 | # Loadable module support | 173 | # Loadable module support |
| @@ -266,11 +267,7 @@ CONFIG_TCP_CONG_BIC=y | |||
| 266 | # CONFIG_HAMRADIO is not set | 267 | # CONFIG_HAMRADIO is not set |
| 267 | # CONFIG_IRDA is not set | 268 | # CONFIG_IRDA is not set |
| 268 | # CONFIG_BT is not set | 269 | # CONFIG_BT is not set |
| 269 | CONFIG_IEEE80211=y | 270 | # CONFIG_IEEE80211 is not set |
| 270 | # CONFIG_IEEE80211_DEBUG is not set | ||
| 271 | CONFIG_IEEE80211_CRYPT_WEP=y | ||
| 272 | CONFIG_IEEE80211_CRYPT_CCMP=y | ||
| 273 | CONFIG_IEEE80211_CRYPT_TKIP=y | ||
| 274 | 271 | ||
| 275 | # | 272 | # |
| 276 | # Device Drivers | 273 | # Device Drivers |
| @@ -323,7 +320,7 @@ CONFIG_BLK_DEV_RAM_COUNT=16 | |||
| 323 | # | 320 | # |
| 324 | # SCSI device support | 321 | # SCSI device support |
| 325 | # | 322 | # |
| 326 | CONFIG_RAID_ATTRS=y | 323 | # CONFIG_RAID_ATTRS is not set |
| 327 | # CONFIG_SCSI is not set | 324 | # CONFIG_SCSI is not set |
| 328 | 325 | ||
| 329 | # | 326 | # |
| @@ -366,24 +363,16 @@ CONFIG_NETDEVICES=y | |||
| 366 | # | 363 | # |
| 367 | # PHY device support | 364 | # PHY device support |
| 368 | # | 365 | # |
| 369 | CONFIG_PHYLIB=y | 366 | # CONFIG_PHYLIB is not set |
| 370 | |||
| 371 | # | ||
| 372 | # MII PHY device drivers | ||
| 373 | # | ||
| 374 | CONFIG_MARVELL_PHY=y | ||
| 375 | CONFIG_DAVICOM_PHY=y | ||
| 376 | CONFIG_QSEMI_PHY=y | ||
| 377 | CONFIG_LXT_PHY=y | ||
| 378 | CONFIG_CICADA_PHY=y | ||
| 379 | 367 | ||
| 380 | # | 368 | # |
| 381 | # Ethernet (10 or 100Mbit) | 369 | # Ethernet (10 or 100Mbit) |
| 382 | # | 370 | # |
| 383 | CONFIG_NET_ETHERNET=y | 371 | CONFIG_NET_ETHERNET=y |
| 384 | CONFIG_MII=y | 372 | # CONFIG_MII is not set |
| 385 | # CONFIG_NET_VENDOR_3COM is not set | 373 | # CONFIG_NET_VENDOR_3COM is not set |
| 386 | # CONFIG_NET_VENDOR_SMC is not set | 374 | # CONFIG_NET_VENDOR_SMC is not set |
| 375 | # CONFIG_DM9000 is not set | ||
| 387 | # CONFIG_NET_VENDOR_RACAL is not set | 376 | # CONFIG_NET_VENDOR_RACAL is not set |
| 388 | # CONFIG_DEPCA is not set | 377 | # CONFIG_DEPCA is not set |
| 389 | # CONFIG_HP100 is not set | 378 | # CONFIG_HP100 is not set |
| @@ -479,6 +468,7 @@ CONFIG_HW_CONSOLE=y | |||
| 479 | CONFIG_SERIAL_8250=y | 468 | CONFIG_SERIAL_8250=y |
| 480 | CONFIG_SERIAL_8250_CONSOLE=y | 469 | CONFIG_SERIAL_8250_CONSOLE=y |
| 481 | CONFIG_SERIAL_8250_NR_UARTS=4 | 470 | CONFIG_SERIAL_8250_NR_UARTS=4 |
| 471 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
| 482 | # CONFIG_SERIAL_8250_EXTENDED is not set | 472 | # CONFIG_SERIAL_8250_EXTENDED is not set |
| 483 | 473 | ||
| 484 | # | 474 | # |
| @@ -518,6 +508,12 @@ CONFIG_SERIAL_CORE_CONSOLE=y | |||
| 518 | # CONFIG_I2C is not set | 508 | # CONFIG_I2C is not set |
| 519 | 509 | ||
| 520 | # | 510 | # |
| 511 | # SPI support | ||
| 512 | # | ||
| 513 | # CONFIG_SPI is not set | ||
| 514 | # CONFIG_SPI_MASTER is not set | ||
| 515 | |||
| 516 | # | ||
| 521 | # Dallas's 1-wire bus | 517 | # Dallas's 1-wire bus |
| 522 | # | 518 | # |
| 523 | # CONFIG_W1 is not set | 519 | # CONFIG_W1 is not set |
| @@ -592,11 +588,14 @@ CONFIG_DUMMY_CONSOLE=y | |||
| 592 | # | 588 | # |
| 593 | 589 | ||
| 594 | # | 590 | # |
| 591 | # EDAC - error detection and reporting (RAS) | ||
| 592 | # | ||
| 593 | |||
| 594 | # | ||
| 595 | # File systems | 595 | # File systems |
| 596 | # | 596 | # |
| 597 | # CONFIG_EXT2_FS is not set | 597 | # CONFIG_EXT2_FS is not set |
| 598 | # CONFIG_EXT3_FS is not set | 598 | # CONFIG_EXT3_FS is not set |
| 599 | # CONFIG_JBD is not set | ||
| 600 | # CONFIG_REISERFS_FS is not set | 599 | # CONFIG_REISERFS_FS is not set |
| 601 | # CONFIG_JFS_FS is not set | 600 | # CONFIG_JFS_FS is not set |
| 602 | # CONFIG_FS_POSIX_ACL is not set | 601 | # CONFIG_FS_POSIX_ACL is not set |
| @@ -677,6 +676,7 @@ CONFIG_MSDOS_PARTITION=y | |||
| 677 | # Kernel hacking | 676 | # Kernel hacking |
| 678 | # | 677 | # |
| 679 | # CONFIG_PRINTK_TIME is not set | 678 | # CONFIG_PRINTK_TIME is not set |
| 679 | # CONFIG_MAGIC_SYSRQ is not set | ||
| 680 | # CONFIG_DEBUG_KERNEL is not set | 680 | # CONFIG_DEBUG_KERNEL is not set |
| 681 | CONFIG_LOG_BUF_SHIFT=14 | 681 | CONFIG_LOG_BUF_SHIFT=14 |
| 682 | CONFIG_CROSSCOMPILE=y | 682 | CONFIG_CROSSCOMPILE=y |
| @@ -690,31 +690,7 @@ CONFIG_CMDLINE="console=ttyS0 debug ip=172.20.0.2:172.20.0.1::255.255.0.0" | |||
| 690 | # | 690 | # |
| 691 | # Cryptographic options | 691 | # Cryptographic options |
| 692 | # | 692 | # |
| 693 | CONFIG_CRYPTO=y | 693 | # CONFIG_CRYPTO is not set |
| 694 | CONFIG_CRYPTO_HMAC=y | ||
| 695 | CONFIG_CRYPTO_NULL=y | ||
| 696 | CONFIG_CRYPTO_MD4=y | ||
| 697 | CONFIG_CRYPTO_MD5=y | ||
| 698 | CONFIG_CRYPTO_SHA1=y | ||
| 699 | CONFIG_CRYPTO_SHA256=y | ||
| 700 | CONFIG_CRYPTO_SHA512=y | ||
| 701 | CONFIG_CRYPTO_WP512=y | ||
| 702 | CONFIG_CRYPTO_TGR192=y | ||
| 703 | CONFIG_CRYPTO_DES=y | ||
| 704 | CONFIG_CRYPTO_BLOWFISH=y | ||
| 705 | CONFIG_CRYPTO_TWOFISH=y | ||
| 706 | CONFIG_CRYPTO_SERPENT=y | ||
| 707 | CONFIG_CRYPTO_AES=y | ||
| 708 | CONFIG_CRYPTO_CAST5=y | ||
| 709 | CONFIG_CRYPTO_CAST6=y | ||
| 710 | CONFIG_CRYPTO_TEA=y | ||
| 711 | CONFIG_CRYPTO_ARC4=y | ||
| 712 | CONFIG_CRYPTO_KHAZAD=y | ||
| 713 | CONFIG_CRYPTO_ANUBIS=y | ||
| 714 | CONFIG_CRYPTO_DEFLATE=y | ||
| 715 | CONFIG_CRYPTO_MICHAEL_MIC=y | ||
| 716 | CONFIG_CRYPTO_CRC32C=y | ||
| 717 | # CONFIG_CRYPTO_TEST is not set | ||
| 718 | 694 | ||
| 719 | # | 695 | # |
| 720 | # Hardware crypto devices | 696 | # Hardware crypto devices |
| @@ -724,8 +700,6 @@ CONFIG_CRYPTO_CRC32C=y | |||
| 724 | # Library routines | 700 | # Library routines |
| 725 | # | 701 | # |
| 726 | # CONFIG_CRC_CCITT is not set | 702 | # CONFIG_CRC_CCITT is not set |
| 727 | CONFIG_CRC16=y | 703 | # CONFIG_CRC16 is not set |
| 728 | CONFIG_CRC32=y | 704 | CONFIG_CRC32=y |
| 729 | CONFIG_LIBCRC32C=y | 705 | # CONFIG_LIBCRC32C is not set |
| 730 | CONFIG_ZLIB_INFLATE=y | ||
| 731 | CONFIG_ZLIB_DEFLATE=y | ||
diff --git a/arch/mips/ddb5xxx/ddb5074/setup.c b/arch/mips/ddb5xxx/ddb5074/setup.c index 11535be265b9..91456b068c2e 100644 --- a/arch/mips/ddb5xxx/ddb5074/setup.c +++ b/arch/mips/ddb5xxx/ddb5074/setup.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/ide.h> | 14 | #include <linux/ide.h> |
| 15 | #include <linux/ioport.h> | 15 | #include <linux/ioport.h> |
| 16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
| 17 | #include <linux/pm.h> | ||
| 17 | 18 | ||
| 18 | #include <asm/addrspace.h> | 19 | #include <asm/addrspace.h> |
| 19 | #include <asm/bcache.h> | 20 | #include <asm/bcache.h> |
| @@ -95,7 +96,7 @@ void __init plat_setup(void) | |||
| 95 | 96 | ||
| 96 | _machine_restart = ddb_machine_restart; | 97 | _machine_restart = ddb_machine_restart; |
| 97 | _machine_halt = ddb_machine_halt; | 98 | _machine_halt = ddb_machine_halt; |
| 98 | _machine_power_off = ddb_machine_power_off; | 99 | pm_power_off = ddb_machine_power_off; |
| 99 | 100 | ||
| 100 | ddb_out32(DDB_BAR0, 0); | 101 | ddb_out32(DDB_BAR0, 0); |
| 101 | 102 | ||
diff --git a/arch/mips/ddb5xxx/ddb5476/setup.c b/arch/mips/ddb5xxx/ddb5476/setup.c index f4e480a74edf..c902adef5942 100644 --- a/arch/mips/ddb5xxx/ddb5476/setup.c +++ b/arch/mips/ddb5xxx/ddb5476/setup.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
| 13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
| 14 | #include <linux/pm.h> | ||
| 14 | 15 | ||
| 15 | #include <asm/addrspace.h> | 16 | #include <asm/addrspace.h> |
| 16 | #include <asm/bcache.h> | 17 | #include <asm/bcache.h> |
| @@ -133,7 +134,7 @@ void __init plat_setup(void) | |||
| 133 | 134 | ||
| 134 | _machine_restart = ddb_machine_restart; | 135 | _machine_restart = ddb_machine_restart; |
| 135 | _machine_halt = ddb_machine_halt; | 136 | _machine_halt = ddb_machine_halt; |
| 136 | _machine_power_off = ddb_machine_power_off; | 137 | pm_power_off = ddb_machine_power_off; |
| 137 | 138 | ||
| 138 | /* request io port/mem resources */ | 139 | /* request io port/mem resources */ |
| 139 | if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) || | 140 | if (request_resource(&ioport_resource, &ddb5476_ioport.dma1) || |
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c index 81163353c4a8..2f566034cc44 100644 --- a/arch/mips/ddb5xxx/ddb5477/setup.c +++ b/arch/mips/ddb5xxx/ddb5477/setup.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/major.h> | 26 | #include <linux/major.h> |
| 27 | #include <linux/kdev_t.h> | 27 | #include <linux/kdev_t.h> |
| 28 | #include <linux/root_dev.h> | 28 | #include <linux/root_dev.h> |
| 29 | #include <linux/pm.h> | ||
| 29 | 30 | ||
| 30 | #include <asm/cpu.h> | 31 | #include <asm/cpu.h> |
| 31 | #include <asm/bootinfo.h> | 32 | #include <asm/bootinfo.h> |
| @@ -182,7 +183,7 @@ void __init plat_setup(void) | |||
| 182 | 183 | ||
| 183 | _machine_restart = ddb_machine_restart; | 184 | _machine_restart = ddb_machine_restart; |
| 184 | _machine_halt = ddb_machine_halt; | 185 | _machine_halt = ddb_machine_halt; |
| 185 | _machine_power_off = ddb_machine_power_off; | 186 | pm_power_off = ddb_machine_power_off; |
| 186 | 187 | ||
| 187 | /* setup resource limits */ | 188 | /* setup resource limits */ |
| 188 | ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1; | 189 | ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1; |
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c index 9ef54fe1feaa..7c1ca8f6330e 100644 --- a/arch/mips/dec/setup.c +++ b/arch/mips/dec/setup.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
| 18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
| 19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/pm.h> | ||
| 20 | 21 | ||
| 21 | #include <asm/bootinfo.h> | 22 | #include <asm/bootinfo.h> |
| 22 | #include <asm/cpu.h> | 23 | #include <asm/cpu.h> |
| @@ -158,7 +159,7 @@ void __init plat_setup(void) | |||
| 158 | 159 | ||
| 159 | _machine_restart = dec_machine_restart; | 160 | _machine_restart = dec_machine_restart; |
| 160 | _machine_halt = dec_machine_halt; | 161 | _machine_halt = dec_machine_halt; |
| 161 | _machine_power_off = dec_machine_power_off; | 162 | pm_power_off = dec_machine_power_off; |
| 162 | 163 | ||
| 163 | ioport_resource.start = ~0UL; | 164 | ioport_resource.start = ~0UL; |
| 164 | ioport_resource.end = 0UL; | 165 | ioport_resource.end = 0UL; |
diff --git a/arch/mips/gt64120/ev64120/setup.c b/arch/mips/gt64120/ev64120/setup.c index 98b5a96cc039..6d859d1e7a2d 100644 --- a/arch/mips/gt64120/ev64120/setup.c +++ b/arch/mips/gt64120/ev64120/setup.c | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
| 35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
| 36 | #include <linux/timex.h> | 36 | #include <linux/timex.h> |
| 37 | #include <linux/pm.h> | ||
| 38 | |||
| 37 | #include <asm/bootinfo.h> | 39 | #include <asm/bootinfo.h> |
| 38 | #include <asm/page.h> | 40 | #include <asm/page.h> |
| 39 | #include <asm/io.h> | 41 | #include <asm/io.h> |
| @@ -73,7 +75,7 @@ void __init plat_setup(void) | |||
| 73 | { | 75 | { |
| 74 | _machine_restart = galileo_machine_restart; | 76 | _machine_restart = galileo_machine_restart; |
| 75 | _machine_halt = galileo_machine_halt; | 77 | _machine_halt = galileo_machine_halt; |
| 76 | _machine_power_off = galileo_machine_power_off; | 78 | pm_power_off = galileo_machine_power_off; |
| 77 | 79 | ||
| 78 | board_time_init = gt64120_time_init; | 80 | board_time_init = gt64120_time_init; |
| 79 | set_io_port_base(KSEG1); | 81 | set_io_port_base(KSEG1); |
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c index 0d07c33112d0..20b65d3d2151 100644 --- a/arch/mips/gt64120/momenco_ocelot/setup.c +++ b/arch/mips/gt64120/momenco_ocelot/setup.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * BRIEF MODULE DESCRIPTION | 4 | * BRIEF MODULE DESCRIPTION |
| 5 | * Momentum Computer Ocelot (CP7000) - board dependent boot routines | 5 | * Momentum Computer Ocelot (CP7000) - board dependent boot routines |
| 6 | * | 6 | * |
| 7 | * Copyright (C) 1996, 1997, 2001 Ralf Baechle | 7 | * Copyright (C) 1996, 1997, 2001, 06 Ralf Baechle (ralf@linux-mips.org) |
| 8 | * Copyright (C) 2000 RidgeRun, Inc. | 8 | * Copyright (C) 2000 RidgeRun, Inc. |
| 9 | * Copyright (C) 2001 Red Hat, Inc. | 9 | * Copyright (C) 2001 Red Hat, Inc. |
| 10 | * Copyright (C) 2002 Momentum Computer | 10 | * Copyright (C) 2002 Momentum Computer |
| @@ -47,6 +47,8 @@ | |||
| 47 | #include <linux/pci.h> | 47 | #include <linux/pci.h> |
| 48 | #include <linux/timex.h> | 48 | #include <linux/timex.h> |
| 49 | #include <linux/vmalloc.h> | 49 | #include <linux/vmalloc.h> |
| 50 | #include <linux/pm.h> | ||
| 51 | |||
| 50 | #include <asm/time.h> | 52 | #include <asm/time.h> |
| 51 | #include <asm/bootinfo.h> | 53 | #include <asm/bootinfo.h> |
| 52 | #include <asm/page.h> | 54 | #include <asm/page.h> |
| @@ -159,7 +161,7 @@ void __init plat_setup(void) | |||
| 159 | 161 | ||
| 160 | _machine_restart = momenco_ocelot_restart; | 162 | _machine_restart = momenco_ocelot_restart; |
| 161 | _machine_halt = momenco_ocelot_halt; | 163 | _machine_halt = momenco_ocelot_halt; |
| 162 | _machine_power_off = momenco_ocelot_power_off; | 164 | pm_power_off = momenco_ocelot_power_off; |
| 163 | 165 | ||
| 164 | /* | 166 | /* |
| 165 | * initrd_start = (ulong)ocelot_initrd_start; | 167 | * initrd_start = (ulong)ocelot_initrd_start; |
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c index 062429dd7ca0..fc73c8d69df7 100644 --- a/arch/mips/ite-boards/generic/it8172_setup.c +++ b/arch/mips/ite-boards/generic/it8172_setup.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/major.h> | 34 | #include <linux/major.h> |
| 35 | #include <linux/kdev_t.h> | 35 | #include <linux/kdev_t.h> |
| 36 | #include <linux/root_dev.h> | 36 | #include <linux/root_dev.h> |
| 37 | #include <linux/pm.h> | ||
| 37 | 38 | ||
| 38 | #include <asm/cpu.h> | 39 | #include <asm/cpu.h> |
| 39 | #include <asm/time.h> | 40 | #include <asm/time.h> |
| @@ -125,7 +126,7 @@ void __init plat_setup(void) | |||
| 125 | 126 | ||
| 126 | _machine_restart = it8172_restart; | 127 | _machine_restart = it8172_restart; |
| 127 | _machine_halt = it8172_halt; | 128 | _machine_halt = it8172_halt; |
| 128 | _machine_power_off = it8172_power_off; | 129 | pm_power_off = it8172_power_off; |
| 129 | 130 | ||
| 130 | /* | 131 | /* |
| 131 | * IO/MEM resources. | 132 | * IO/MEM resources. |
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c index 044df9d4ab7c..4036dc434551 100644 --- a/arch/mips/jazz/setup.c +++ b/arch/mips/jazz/setup.c | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #include <linux/console.h> | 19 | #include <linux/console.h> |
| 20 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
| 21 | #include <linux/ide.h> | 21 | #include <linux/ide.h> |
| 22 | #include <linux/pm.h> | ||
| 23 | |||
| 22 | #include <asm/bootinfo.h> | 24 | #include <asm/bootinfo.h> |
| 23 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
| 24 | #include <asm/jazz.h> | 26 | #include <asm/jazz.h> |
| @@ -79,7 +81,7 @@ void __init plat_setup(void) | |||
| 79 | 81 | ||
| 80 | _machine_restart = jazz_machine_restart; | 82 | _machine_restart = jazz_machine_restart; |
| 81 | _machine_halt = jazz_machine_halt; | 83 | _machine_halt = jazz_machine_halt; |
| 82 | _machine_power_off = jazz_machine_power_off; | 84 | pm_power_off = jazz_machine_power_off; |
| 83 | 85 | ||
| 84 | #warning "Somebody should check if screen_info is ok for Jazz." | 86 | #warning "Somebody should check if screen_info is ok for Jazz." |
| 85 | 87 | ||
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c index 4763957df8fc..9359cc413494 100644 --- a/arch/mips/jmr3927/rbhma3100/setup.c +++ b/arch/mips/jmr3927/rbhma3100/setup.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/ioport.h> | 44 | #include <linux/ioport.h> |
| 45 | #include <linux/param.h> /* for HZ */ | 45 | #include <linux/param.h> /* for HZ */ |
| 46 | #include <linux/delay.h> | 46 | #include <linux/delay.h> |
| 47 | #include <linux/pm.h> | ||
| 47 | #ifdef CONFIG_SERIAL_TXX9 | 48 | #ifdef CONFIG_SERIAL_TXX9 |
| 48 | #include <linux/tty.h> | 49 | #include <linux/tty.h> |
| 49 | #include <linux/serial.h> | 50 | #include <linux/serial.h> |
| @@ -211,7 +212,7 @@ void __init plat_setup(void) | |||
| 211 | 212 | ||
| 212 | _machine_restart = jmr3927_machine_restart; | 213 | _machine_restart = jmr3927_machine_restart; |
| 213 | _machine_halt = jmr3927_machine_halt; | 214 | _machine_halt = jmr3927_machine_halt; |
| 214 | _machine_power_off = jmr3927_machine_power_off; | 215 | pm_power_off = jmr3927_machine_power_off; |
| 215 | 216 | ||
| 216 | /* | 217 | /* |
| 217 | * IO/MEM resources. | 218 | * IO/MEM resources. |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index fac48ad27b34..292f8b243a5e 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
| @@ -2,8 +2,8 @@ | |||
| 2 | * Processor capabilities determination functions. | 2 | * Processor capabilities determination functions. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) xxxx the Anonymous | 4 | * Copyright (C) xxxx the Anonymous |
| 5 | * Copyright (C) 1994 - 2006 Ralf Baechle | ||
| 5 | * Copyright (C) 2003, 2004 Maciej W. Rozycki | 6 | * Copyright (C) 2003, 2004 Maciej W. Rozycki |
| 6 | * Copyright (C) 1994 - 2003 Ralf Baechle | ||
| 7 | * Copyright (C) 2001, 2004 MIPS Inc. | 7 | * Copyright (C) 2001, 2004 MIPS Inc. |
| 8 | * | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| @@ -641,10 +641,9 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c) | |||
| 641 | switch (c->processor_id & 0xff00) { | 641 | switch (c->processor_id & 0xff00) { |
| 642 | case PRID_IMP_SB1: | 642 | case PRID_IMP_SB1: |
| 643 | c->cputype = CPU_SB1; | 643 | c->cputype = CPU_SB1; |
| 644 | #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | ||
| 645 | /* FPU in pass1 is known to have issues. */ | 644 | /* FPU in pass1 is known to have issues. */ |
| 646 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); | 645 | if ((c->processor_id & 0xff) < 0x20) |
| 647 | #endif | 646 | c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR); |
| 648 | break; | 647 | break; |
| 649 | case PRID_IMP_SB1A: | 648 | case PRID_IMP_SB1A: |
| 650 | c->cputype = CPU_SB1A; | 649 | c->cputype = CPU_SB1A; |
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index aa18a8b7b380..13f22d1d0e8b 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
| @@ -233,11 +233,11 @@ NESTED(except_vec_nmi, 0, sp) | |||
| 233 | NESTED(nmi_handler, PT_SIZE, sp) | 233 | NESTED(nmi_handler, PT_SIZE, sp) |
| 234 | .set push | 234 | .set push |
| 235 | .set noat | 235 | .set noat |
| 236 | .set mips3 | ||
| 237 | SAVE_ALL | 236 | SAVE_ALL |
| 238 | move a0, sp | 237 | move a0, sp |
| 239 | jal nmi_exception_handler | 238 | jal nmi_exception_handler |
| 240 | RESTORE_ALL | 239 | RESTORE_ALL |
| 240 | .set mips3 | ||
| 241 | eret | 241 | eret |
| 242 | .set pop | 242 | .set pop |
| 243 | END(nmi_handler) | 243 | END(nmi_handler) |
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 0c82b25d8c6d..0d5cf97af727 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c | |||
| @@ -88,7 +88,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
| 88 | ret = -EIO; | 88 | ret = -EIO; |
| 89 | if (copied != sizeof(tmp)) | 89 | if (copied != sizeof(tmp)) |
| 90 | break; | 90 | break; |
| 91 | ret = put_user(tmp, (unsigned int *) (unsigned long) data); | 91 | ret = put_user(tmp, (unsigned int __user *) (unsigned long) data); |
| 92 | break; | 92 | break; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| @@ -174,8 +174,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
| 174 | case FPC_EIR: { /* implementation / version register */ | 174 | case FPC_EIR: { /* implementation / version register */ |
| 175 | unsigned int flags; | 175 | unsigned int flags; |
| 176 | 176 | ||
| 177 | if (!cpu_has_fpu) | 177 | if (!cpu_has_fpu) { |
| 178 | tmp = 0; | ||
| 178 | break; | 179 | break; |
| 180 | } | ||
| 179 | 181 | ||
| 180 | preempt_disable(); | 182 | preempt_disable(); |
| 181 | if (cpu_has_mipsmt) { | 183 | if (cpu_has_mipsmt) { |
| @@ -194,15 +196,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
| 194 | preempt_enable(); | 196 | preempt_enable(); |
| 195 | break; | 197 | break; |
| 196 | } | 198 | } |
| 197 | case DSP_BASE ... DSP_BASE + 5: | 199 | case DSP_BASE ... DSP_BASE + 5: { |
| 200 | dspreg_t *dregs; | ||
| 201 | |||
| 198 | if (!cpu_has_dsp) { | 202 | if (!cpu_has_dsp) { |
| 199 | tmp = 0; | 203 | tmp = 0; |
| 200 | ret = -EIO; | 204 | ret = -EIO; |
| 201 | goto out_tsk; | 205 | goto out_tsk; |
| 202 | } | 206 | } |
| 203 | dspreg_t *dregs = __get_dsp_regs(child); | 207 | dregs = __get_dsp_regs(child); |
| 204 | tmp = (unsigned long) (dregs[addr - DSP_BASE]); | 208 | tmp = (unsigned long) (dregs[addr - DSP_BASE]); |
| 205 | break; | 209 | break; |
| 210 | } | ||
| 206 | case DSP_CONTROL: | 211 | case DSP_CONTROL: |
| 207 | if (!cpu_has_dsp) { | 212 | if (!cpu_has_dsp) { |
| 208 | tmp = 0; | 213 | tmp = 0; |
| @@ -216,7 +221,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
| 216 | ret = -EIO; | 221 | ret = -EIO; |
| 217 | goto out_tsk; | 222 | goto out_tsk; |
| 218 | } | 223 | } |
| 219 | ret = put_user(tmp, (unsigned *) (unsigned long) data); | 224 | ret = put_user(tmp, (unsigned __user *) (unsigned long) data); |
| 220 | break; | 225 | break; |
| 221 | } | 226 | } |
| 222 | 227 | ||
| @@ -304,15 +309,18 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
| 304 | else | 309 | else |
| 305 | child->thread.fpu.soft.fcr31 = data; | 310 | child->thread.fpu.soft.fcr31 = data; |
| 306 | break; | 311 | break; |
| 307 | case DSP_BASE ... DSP_BASE + 5: | 312 | case DSP_BASE ... DSP_BASE + 5: { |
| 313 | dspreg_t *dregs; | ||
| 314 | |||
| 308 | if (!cpu_has_dsp) { | 315 | if (!cpu_has_dsp) { |
| 309 | ret = -EIO; | 316 | ret = -EIO; |
| 310 | break; | 317 | break; |
| 311 | } | 318 | } |
| 312 | 319 | ||
| 313 | dspreg_t *dregs = __get_dsp_regs(child); | 320 | dregs = __get_dsp_regs(child); |
| 314 | dregs[addr - DSP_BASE] = data; | 321 | dregs[addr - DSP_BASE] = data; |
| 315 | break; | 322 | break; |
| 323 | } | ||
| 316 | case DSP_CONTROL: | 324 | case DSP_CONTROL: |
| 317 | if (!cpu_has_dsp) { | 325 | if (!cpu_has_dsp) { |
| 318 | ret = -EIO; | 326 | ret = -EIO; |
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c index 5e37df3111ad..621037db2290 100644 --- a/arch/mips/kernel/reset.c +++ b/arch/mips/kernel/reset.c | |||
| @@ -3,17 +3,16 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2001 by Ralf Baechle | 6 | * Copyright (C) 2001, 06 by Ralf Baechle (ralf@linux-mips.org) |
| 7 | * Copyright (C) 2001 MIPS Technologies, Inc. | 7 | * Copyright (C) 2001 MIPS Technologies, Inc. |
| 8 | */ | 8 | */ |
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/pm.h> | ||
| 11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 12 | #include <linux/reboot.h> | 13 | #include <linux/reboot.h> |
| 13 | #include <asm/reboot.h> | ||
| 14 | 14 | ||
| 15 | void (*pm_power_off)(void); | 15 | #include <asm/reboot.h> |
| 16 | EXPORT_SYMBOL(pm_power_off); | ||
| 17 | 16 | ||
| 18 | /* | 17 | /* |
| 19 | * Urgs ... Too many MIPS machines to handle this in a generic way. | 18 | * Urgs ... Too many MIPS machines to handle this in a generic way. |
| @@ -22,23 +21,22 @@ EXPORT_SYMBOL(pm_power_off); | |||
| 22 | */ | 21 | */ |
| 23 | void (*_machine_restart)(char *command); | 22 | void (*_machine_restart)(char *command); |
| 24 | void (*_machine_halt)(void); | 23 | void (*_machine_halt)(void); |
| 25 | void (*_machine_power_off)(void); | 24 | void (*pm_power_off)(void); |
| 26 | 25 | ||
| 27 | void machine_restart(char *command) | 26 | void machine_restart(char *command) |
| 28 | { | 27 | { |
| 29 | _machine_restart(command); | 28 | if (_machine_restart) |
| 29 | _machine_restart(command); | ||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void machine_halt(void) | 32 | void machine_halt(void) |
| 33 | { | 33 | { |
| 34 | _machine_halt(); | 34 | if (_machine_halt) |
| 35 | _machine_halt(); | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | void machine_power_off(void) | 38 | void machine_power_off(void) |
| 38 | { | 39 | { |
| 39 | if (pm_power_off) | 40 | if (pm_power_off) |
| 40 | pm_power_off(); | 41 | pm_power_off(); |
| 41 | |||
| 42 | _machine_power_off(); | ||
| 43 | } | 42 | } |
| 44 | |||
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index 1d855112bac2..986a9cf23067 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. | 2 | * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. |
| 3 | * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org) | ||
| 3 | * | 4 | * |
| 4 | * This program is free software; you can distribute it and/or modify it | 5 | * This program is free software; you can distribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License (Version 2) as | 6 | * under the terms of the GNU General Public License (Version 2) as |
| @@ -20,9 +21,12 @@ | |||
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
| 22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| 24 | #include <linux/interrupt.h> | ||
| 25 | #include <linux/irq.h> | ||
| 23 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
| 24 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
| 25 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
| 29 | |||
| 26 | #include <asm/mipsmtregs.h> | 30 | #include <asm/mipsmtregs.h> |
| 27 | #include <asm/bitops.h> | 31 | #include <asm/bitops.h> |
| 28 | #include <asm/cpu.h> | 32 | #include <asm/cpu.h> |
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index 0f66ae5838b9..0fbc492d24b4 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
| 12 | 12 | ||
| 13 | static inline int | 13 | static inline int |
| 14 | setup_sigcontext(struct pt_regs *regs, struct sigcontext *sc) | 14 | setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) |
| 15 | { | 15 | { |
| 16 | int err = 0; | 16 | int err = 0; |
| 17 | 17 | ||
| @@ -82,7 +82,7 @@ out: | |||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static inline int | 84 | static inline int |
| 85 | restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) | 85 | restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) |
| 86 | { | 86 | { |
| 87 | unsigned int used_math; | 87 | unsigned int used_math; |
| 88 | unsigned long treg; | 88 | unsigned long treg; |
| @@ -157,7 +157,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc) | |||
| 157 | /* | 157 | /* |
| 158 | * Determine which stack to use.. | 158 | * Determine which stack to use.. |
| 159 | */ | 159 | */ |
| 160 | static inline void * | 160 | static inline void __user * |
| 161 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | 161 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) |
| 162 | { | 162 | { |
| 163 | unsigned long sp; | 163 | unsigned long sp; |
| @@ -176,7 +176,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | |||
| 176 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) | 176 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) |
| 177 | sp = current->sas_ss_sp + current->sas_ss_size; | 177 | sp = current->sas_ss_sp + current->sas_ss_size; |
| 178 | 178 | ||
| 179 | return (void *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); | 179 | return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? 32 : ALMASK)); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static inline int install_sigtramp(unsigned int __user *tramp, | 182 | static inline int install_sigtramp(unsigned int __user *tramp, |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 7d1800fe7038..aaec4785e9a6 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
| @@ -199,10 +199,10 @@ save_static_function(sys_sigreturn); | |||
| 199 | __attribute_used__ noinline static void | 199 | __attribute_used__ noinline static void |
| 200 | _sys_sigreturn(nabi_no_regargs struct pt_regs regs) | 200 | _sys_sigreturn(nabi_no_regargs struct pt_regs regs) |
| 201 | { | 201 | { |
| 202 | struct sigframe *frame; | 202 | struct sigframe __user *frame; |
| 203 | sigset_t blocked; | 203 | sigset_t blocked; |
| 204 | 204 | ||
| 205 | frame = (struct sigframe *) regs.regs[29]; | 205 | frame = (struct sigframe __user *) regs.regs[29]; |
| 206 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 206 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 207 | goto badframe; | 207 | goto badframe; |
| 208 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) | 208 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) |
| @@ -236,11 +236,11 @@ save_static_function(sys_rt_sigreturn); | |||
| 236 | __attribute_used__ noinline static void | 236 | __attribute_used__ noinline static void |
| 237 | _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 237 | _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
| 238 | { | 238 | { |
| 239 | struct rt_sigframe *frame; | 239 | struct rt_sigframe __user *frame; |
| 240 | sigset_t set; | 240 | sigset_t set; |
| 241 | stack_t st; | 241 | stack_t st; |
| 242 | 242 | ||
| 243 | frame = (struct rt_sigframe *) regs.regs[29]; | 243 | frame = (struct rt_sigframe __user *) regs.regs[29]; |
| 244 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 244 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 245 | goto badframe; | 245 | goto badframe; |
| 246 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 246 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
| @@ -259,7 +259,7 @@ _sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 259 | goto badframe; | 259 | goto badframe; |
| 260 | /* It is more difficult to avoid calling this function than to | 260 | /* It is more difficult to avoid calling this function than to |
| 261 | call it and ignore errors. */ | 261 | call it and ignore errors. */ |
| 262 | do_sigaltstack(&st, NULL, regs.regs[29]); | 262 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
| 263 | 263 | ||
| 264 | /* | 264 | /* |
| 265 | * Don't let your children do this ... | 265 | * Don't let your children do this ... |
| @@ -279,7 +279,7 @@ badframe: | |||
| 279 | int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, | 279 | int setup_frame(struct k_sigaction * ka, struct pt_regs *regs, |
| 280 | int signr, sigset_t *set) | 280 | int signr, sigset_t *set) |
| 281 | { | 281 | { |
| 282 | struct sigframe *frame; | 282 | struct sigframe __user *frame; |
| 283 | int err = 0; | 283 | int err = 0; |
| 284 | 284 | ||
| 285 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 285 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
| @@ -326,7 +326,7 @@ give_sigsegv: | |||
| 326 | int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | 326 | int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, |
| 327 | int signr, sigset_t *set, siginfo_t *info) | 327 | int signr, sigset_t *set, siginfo_t *info) |
| 328 | { | 328 | { |
| 329 | struct rt_sigframe *frame; | 329 | struct rt_sigframe __user *frame; |
| 330 | int err = 0; | 330 | int err = 0; |
| 331 | 331 | ||
| 332 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 332 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
| @@ -340,7 +340,7 @@ int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs, | |||
| 340 | 340 | ||
| 341 | /* Create the ucontext. */ | 341 | /* Create the ucontext. */ |
| 342 | err |= __put_user(0, &frame->rs_uc.uc_flags); | 342 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
| 343 | err |= __put_user(0, &frame->rs_uc.uc_link); | 343 | err |= __put_user(NULL, &frame->rs_uc.uc_link); |
| 344 | err |= __put_user((void *)current->sas_ss_sp, | 344 | err |= __put_user((void *)current->sas_ss_sp, |
| 345 | &frame->rs_uc.uc_stack.ss_sp); | 345 | &frame->rs_uc.uc_stack.ss_sp); |
| 346 | err |= __put_user(sas_ss_flags(regs->regs[29]), | 346 | err |= __put_user(sas_ss_flags(regs->regs[29]), |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 98b185bbc947..136260c8f756 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
| @@ -144,7 +144,7 @@ struct ucontext32 { | |||
| 144 | extern void __put_sigset_unknown_nsig(void); | 144 | extern void __put_sigset_unknown_nsig(void); |
| 145 | extern void __get_sigset_unknown_nsig(void); | 145 | extern void __get_sigset_unknown_nsig(void); |
| 146 | 146 | ||
| 147 | static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t *ubuf) | 147 | static inline int put_sigset(const sigset_t *kbuf, compat_sigset_t __user *ubuf) |
| 148 | { | 148 | { |
| 149 | int err = 0; | 149 | int err = 0; |
| 150 | 150 | ||
| @@ -269,7 +269,7 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, | |||
| 269 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) | 269 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
| 270 | return -EFAULT; | 270 | return -EFAULT; |
| 271 | err |= __get_user(handler, &act->sa_handler); | 271 | err |= __get_user(handler, &act->sa_handler); |
| 272 | new_ka.sa.sa_handler = (void*)(s64)handler; | 272 | new_ka.sa.sa_handler = (void __user *)(s64)handler; |
| 273 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); | 273 | err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); |
| 274 | err |= __get_user(mask, &act->sa_mask.sig[0]); | 274 | err |= __get_user(mask, &act->sa_mask.sig[0]); |
| 275 | if (err) | 275 | if (err) |
| @@ -299,8 +299,8 @@ asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act, | |||
| 299 | 299 | ||
| 300 | asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | 300 | asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) |
| 301 | { | 301 | { |
| 302 | const stack32_t *uss = (const stack32_t *) regs.regs[4]; | 302 | const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4]; |
| 303 | stack32_t *uoss = (stack32_t *) regs.regs[5]; | 303 | stack32_t __user *uoss = (stack32_t __user *) regs.regs[5]; |
| 304 | unsigned long usp = regs.regs[29]; | 304 | unsigned long usp = regs.regs[29]; |
| 305 | stack_t kss, koss; | 305 | stack_t kss, koss; |
| 306 | int ret, err = 0; | 306 | int ret, err = 0; |
| @@ -319,7 +319,8 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | set_fs (KERNEL_DS); | 321 | set_fs (KERNEL_DS); |
| 322 | ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, usp); | 322 | ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL, |
| 323 | uoss ? (stack_t __user *)&koss : NULL, usp); | ||
| 323 | set_fs (old_fs); | 324 | set_fs (old_fs); |
| 324 | 325 | ||
| 325 | if (!ret && uoss) { | 326 | if (!ret && uoss) { |
| @@ -335,7 +336,7 @@ asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs) | |||
| 335 | return ret; | 336 | return ret; |
| 336 | } | 337 | } |
| 337 | 338 | ||
| 338 | static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 *sc) | 339 | static int restore_sigcontext32(struct pt_regs *regs, struct sigcontext32 __user *sc) |
| 339 | { | 340 | { |
| 340 | u32 used_math; | 341 | u32 used_math; |
| 341 | int err = 0; | 342 | int err = 0; |
| @@ -420,7 +421,7 @@ struct rt_sigframe32 { | |||
| 420 | #endif | 421 | #endif |
| 421 | }; | 422 | }; |
| 422 | 423 | ||
| 423 | int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) | 424 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
| 424 | { | 425 | { |
| 425 | int err; | 426 | int err; |
| 426 | 427 | ||
| @@ -455,7 +456,7 @@ int copy_siginfo_to_user32(compat_siginfo_t *to, siginfo_t *from) | |||
| 455 | err |= __put_user(from->si_uid, &to->si_uid); | 456 | err |= __put_user(from->si_uid, &to->si_uid); |
| 456 | break; | 457 | break; |
| 457 | case __SI_FAULT >> 16: | 458 | case __SI_FAULT >> 16: |
| 458 | err |= __put_user((long)from->si_addr, &to->si_addr); | 459 | err |= __put_user((unsigned long)from->si_addr, &to->si_addr); |
| 459 | break; | 460 | break; |
| 460 | case __SI_POLL >> 16: | 461 | case __SI_POLL >> 16: |
| 461 | err |= __put_user(from->si_band, &to->si_band); | 462 | err |= __put_user(from->si_band, &to->si_band); |
| @@ -476,10 +477,10 @@ save_static_function(sys32_sigreturn); | |||
| 476 | __attribute_used__ noinline static void | 477 | __attribute_used__ noinline static void |
| 477 | _sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | 478 | _sys32_sigreturn(nabi_no_regargs struct pt_regs regs) |
| 478 | { | 479 | { |
| 479 | struct sigframe *frame; | 480 | struct sigframe __user *frame; |
| 480 | sigset_t blocked; | 481 | sigset_t blocked; |
| 481 | 482 | ||
| 482 | frame = (struct sigframe *) regs.regs[29]; | 483 | frame = (struct sigframe __user *) regs.regs[29]; |
| 483 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 484 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 484 | goto badframe; | 485 | goto badframe; |
| 485 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) | 486 | if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) |
| @@ -512,13 +513,13 @@ save_static_function(sys32_rt_sigreturn); | |||
| 512 | __attribute_used__ noinline static void | 513 | __attribute_used__ noinline static void |
| 513 | _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 514 | _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
| 514 | { | 515 | { |
| 515 | struct rt_sigframe32 *frame; | 516 | struct rt_sigframe32 __user *frame; |
| 516 | mm_segment_t old_fs; | 517 | mm_segment_t old_fs; |
| 517 | sigset_t set; | 518 | sigset_t set; |
| 518 | stack_t st; | 519 | stack_t st; |
| 519 | s32 sp; | 520 | s32 sp; |
| 520 | 521 | ||
| 521 | frame = (struct rt_sigframe32 *) regs.regs[29]; | 522 | frame = (struct rt_sigframe32 __user *) regs.regs[29]; |
| 522 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 523 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 523 | goto badframe; | 524 | goto badframe; |
| 524 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 525 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
| @@ -546,7 +547,7 @@ _sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 546 | call it and ignore errors. */ | 547 | call it and ignore errors. */ |
| 547 | old_fs = get_fs(); | 548 | old_fs = get_fs(); |
| 548 | set_fs (KERNEL_DS); | 549 | set_fs (KERNEL_DS); |
| 549 | do_sigaltstack(&st, NULL, regs.regs[29]); | 550 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
| 550 | set_fs (old_fs); | 551 | set_fs (old_fs); |
| 551 | 552 | ||
| 552 | /* | 553 | /* |
| @@ -564,7 +565,7 @@ badframe: | |||
| 564 | } | 565 | } |
| 565 | 566 | ||
| 566 | static inline int setup_sigcontext32(struct pt_regs *regs, | 567 | static inline int setup_sigcontext32(struct pt_regs *regs, |
| 567 | struct sigcontext32 *sc) | 568 | struct sigcontext32 __user *sc) |
| 568 | { | 569 | { |
| 569 | int err = 0; | 570 | int err = 0; |
| 570 | 571 | ||
| @@ -623,8 +624,9 @@ out: | |||
| 623 | /* | 624 | /* |
| 624 | * Determine which stack to use.. | 625 | * Determine which stack to use.. |
| 625 | */ | 626 | */ |
| 626 | static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | 627 | static inline void __user *get_sigframe(struct k_sigaction *ka, |
| 627 | size_t frame_size) | 628 | struct pt_regs *regs, |
| 629 | size_t frame_size) | ||
| 628 | { | 630 | { |
| 629 | unsigned long sp; | 631 | unsigned long sp; |
| 630 | 632 | ||
| @@ -642,13 +644,13 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
| 642 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) | 644 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) |
| 643 | sp = current->sas_ss_sp + current->sas_ss_size; | 645 | sp = current->sas_ss_sp + current->sas_ss_size; |
| 644 | 646 | ||
| 645 | return (void *)((sp - frame_size) & ALMASK); | 647 | return (void __user *)((sp - frame_size) & ALMASK); |
| 646 | } | 648 | } |
| 647 | 649 | ||
| 648 | int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | 650 | int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
| 649 | int signr, sigset_t *set) | 651 | int signr, sigset_t *set) |
| 650 | { | 652 | { |
| 651 | struct sigframe *frame; | 653 | struct sigframe __user *frame; |
| 652 | int err = 0; | 654 | int err = 0; |
| 653 | 655 | ||
| 654 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 656 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
| @@ -702,7 +704,7 @@ give_sigsegv: | |||
| 702 | int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | 704 | int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
| 703 | int signr, sigset_t *set, siginfo_t *info) | 705 | int signr, sigset_t *set, siginfo_t *info) |
| 704 | { | 706 | { |
| 705 | struct rt_sigframe32 *frame; | 707 | struct rt_sigframe32 __user *frame; |
| 706 | int err = 0; | 708 | int err = 0; |
| 707 | s32 sp; | 709 | s32 sp; |
| 708 | 710 | ||
| @@ -855,7 +857,7 @@ no_signal: | |||
| 855 | } | 857 | } |
| 856 | 858 | ||
| 857 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, | 859 | asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, |
| 858 | struct sigaction32 *oact, | 860 | struct sigaction32 __user *oact, |
| 859 | unsigned int sigsetsize) | 861 | unsigned int sigsetsize) |
| 860 | { | 862 | { |
| 861 | struct k_sigaction new_sa, old_sa; | 863 | struct k_sigaction new_sa, old_sa; |
| @@ -872,7 +874,7 @@ asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act, | |||
| 872 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) | 874 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
| 873 | return -EFAULT; | 875 | return -EFAULT; |
| 874 | err |= __get_user(handler, &act->sa_handler); | 876 | err |= __get_user(handler, &act->sa_handler); |
| 875 | new_sa.sa.sa_handler = (void*)(s64)handler; | 877 | new_sa.sa.sa_handler = (void __user *)(s64)handler; |
| 876 | err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); | 878 | err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags); |
| 877 | err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); | 879 | err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask); |
| 878 | if (err) | 880 | if (err) |
| @@ -899,7 +901,7 @@ out: | |||
| 899 | } | 901 | } |
| 900 | 902 | ||
| 901 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | 903 | asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, |
| 902 | compat_sigset_t *oset, unsigned int sigsetsize) | 904 | compat_sigset_t __user *oset, unsigned int sigsetsize) |
| 903 | { | 905 | { |
| 904 | sigset_t old_set, new_set; | 906 | sigset_t old_set, new_set; |
| 905 | int ret; | 907 | int ret; |
| @@ -909,8 +911,9 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | |||
| 909 | return -EFAULT; | 911 | return -EFAULT; |
| 910 | 912 | ||
| 911 | set_fs (KERNEL_DS); | 913 | set_fs (KERNEL_DS); |
| 912 | ret = sys_rt_sigprocmask(how, set ? &new_set : NULL, | 914 | ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL, |
| 913 | oset ? &old_set : NULL, sigsetsize); | 915 | oset ? (sigset_t __user *)&old_set : NULL, |
| 916 | sigsetsize); | ||
| 914 | set_fs (old_fs); | 917 | set_fs (old_fs); |
| 915 | 918 | ||
| 916 | if (!ret && oset && put_sigset(&old_set, oset)) | 919 | if (!ret && oset && put_sigset(&old_set, oset)) |
| @@ -919,7 +922,7 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, | |||
| 919 | return ret; | 922 | return ret; |
| 920 | } | 923 | } |
| 921 | 924 | ||
| 922 | asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | 925 | asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset, |
| 923 | unsigned int sigsetsize) | 926 | unsigned int sigsetsize) |
| 924 | { | 927 | { |
| 925 | int ret; | 928 | int ret; |
| @@ -927,7 +930,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | |||
| 927 | mm_segment_t old_fs = get_fs(); | 930 | mm_segment_t old_fs = get_fs(); |
| 928 | 931 | ||
| 929 | set_fs (KERNEL_DS); | 932 | set_fs (KERNEL_DS); |
| 930 | ret = sys_rt_sigpending(&set, sigsetsize); | 933 | ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize); |
| 931 | set_fs (old_fs); | 934 | set_fs (old_fs); |
| 932 | 935 | ||
| 933 | if (!ret && put_sigset(&set, uset)) | 936 | if (!ret && put_sigset(&set, uset)) |
| @@ -936,7 +939,7 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t *uset, | |||
| 936 | return ret; | 939 | return ret; |
| 937 | } | 940 | } |
| 938 | 941 | ||
| 939 | asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) | 942 | asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) |
| 940 | { | 943 | { |
| 941 | siginfo_t info; | 944 | siginfo_t info; |
| 942 | int ret; | 945 | int ret; |
| @@ -946,7 +949,7 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t *uinfo) | |||
| 946 | copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) | 949 | copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) |
| 947 | return -EFAULT; | 950 | return -EFAULT; |
| 948 | set_fs (KERNEL_DS); | 951 | set_fs (KERNEL_DS); |
| 949 | ret = sys_rt_sigqueueinfo(pid, sig, &info); | 952 | ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info); |
| 950 | set_fs (old_fs); | 953 | set_fs (old_fs); |
| 951 | return ret; | 954 | return ret; |
| 952 | } | 955 | } |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index ec61b2670ba6..9156863c1a5d 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
| @@ -48,6 +48,8 @@ | |||
| 48 | #define __NR_N32_rt_sigreturn 6211 | 48 | #define __NR_N32_rt_sigreturn 6211 |
| 49 | #define __NR_N32_restart_syscall 6214 | 49 | #define __NR_N32_restart_syscall 6214 |
| 50 | 50 | ||
| 51 | #define DEBUG_SIG 0 | ||
| 52 | |||
| 51 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 53 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
| 52 | 54 | ||
| 53 | /* IRIX compatible stack_t */ | 55 | /* IRIX compatible stack_t */ |
| @@ -83,12 +85,12 @@ save_static_function(sysn32_rt_sigreturn); | |||
| 83 | __attribute_used__ noinline static void | 85 | __attribute_used__ noinline static void |
| 84 | _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 86 | _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
| 85 | { | 87 | { |
| 86 | struct rt_sigframe_n32 *frame; | 88 | struct rt_sigframe_n32 __user *frame; |
| 87 | sigset_t set; | 89 | sigset_t set; |
| 88 | stack_t st; | 90 | stack_t st; |
| 89 | s32 sp; | 91 | s32 sp; |
| 90 | 92 | ||
| 91 | frame = (struct rt_sigframe_n32 *) regs.regs[29]; | 93 | frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; |
| 92 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 94 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 93 | goto badframe; | 95 | goto badframe; |
| 94 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) | 96 | if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) |
| @@ -114,7 +116,7 @@ _sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 114 | 116 | ||
| 115 | /* It is more difficult to avoid calling this function than to | 117 | /* It is more difficult to avoid calling this function than to |
| 116 | call it and ignore errors. */ | 118 | call it and ignore errors. */ |
| 117 | do_sigaltstack(&st, NULL, regs.regs[29]); | 119 | do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]); |
| 118 | 120 | ||
| 119 | /* | 121 | /* |
| 120 | * Don't let your children do this ... | 122 | * Don't let your children do this ... |
| @@ -133,7 +135,7 @@ badframe: | |||
| 133 | int setup_rt_frame_n32(struct k_sigaction * ka, | 135 | int setup_rt_frame_n32(struct k_sigaction * ka, |
| 134 | struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) | 136 | struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) |
| 135 | { | 137 | { |
| 136 | struct rt_sigframe_n32 *frame; | 138 | struct rt_sigframe_n32 __user *frame; |
| 137 | int err = 0; | 139 | int err = 0; |
| 138 | s32 sp; | 140 | s32 sp; |
| 139 | 141 | ||
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 59a187956de0..c9d2b5147ca3 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
| @@ -1168,7 +1168,7 @@ void __init per_cpu_trap_init(void) | |||
| 1168 | #endif | 1168 | #endif |
| 1169 | if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) | 1169 | if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) |
| 1170 | status_set |= ST0_XX; | 1170 | status_set |= ST0_XX; |
| 1171 | change_c0_status(ST0_CU|ST0_MX|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, | 1171 | change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, |
| 1172 | status_set); | 1172 | status_set); |
| 1173 | 1173 | ||
| 1174 | if (cpu_has_dsp) | 1174 | if (cpu_has_dsp) |
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 25cc856d8e7e..ff699dbb99f7 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | #include <linux/config.h> | 1 | #include <linux/config.h> |
| 2 | #include <asm/asm-offsets.h> | ||
| 2 | #include <asm-generic/vmlinux.lds.h> | 3 | #include <asm-generic/vmlinux.lds.h> |
| 3 | 4 | ||
| 4 | #undef mips /* CPP really sucks for this job */ | 5 | #undef mips /* CPP really sucks for this job */ |
| @@ -64,10 +65,10 @@ SECTIONS | |||
| 64 | we can shorten the on-disk segment size. */ | 65 | we can shorten the on-disk segment size. */ |
| 65 | .sdata : { *(.sdata) } | 66 | .sdata : { *(.sdata) } |
| 66 | 67 | ||
| 67 | . = ALIGN(4096); | 68 | . = ALIGN(_PAGE_SIZE); |
| 68 | __nosave_begin = .; | 69 | __nosave_begin = .; |
| 69 | .data_nosave : { *(.data.nosave) } | 70 | .data_nosave : { *(.data.nosave) } |
| 70 | . = ALIGN(4096); | 71 | . = ALIGN(_PAGE_SIZE); |
| 71 | __nosave_end = .; | 72 | __nosave_end = .; |
| 72 | 73 | ||
| 73 | . = ALIGN(32); | 74 | . = ALIGN(32); |
| @@ -76,7 +77,7 @@ SECTIONS | |||
| 76 | _edata = .; /* End of data section */ | 77 | _edata = .; /* End of data section */ |
| 77 | 78 | ||
| 78 | /* will be freed after init */ | 79 | /* will be freed after init */ |
| 79 | . = ALIGN(4096); /* Init code and data */ | 80 | . = ALIGN(_PAGE_SIZE); /* Init code and data */ |
| 80 | __init_begin = .; | 81 | __init_begin = .; |
| 81 | .init.text : { | 82 | .init.text : { |
| 82 | _sinittext = .; | 83 | _sinittext = .; |
| @@ -105,7 +106,7 @@ SECTIONS | |||
| 105 | .con_initcall.init : { *(.con_initcall.init) } | 106 | .con_initcall.init : { *(.con_initcall.init) } |
| 106 | __con_initcall_end = .; | 107 | __con_initcall_end = .; |
| 107 | SECURITY_INIT | 108 | SECURITY_INIT |
| 108 | . = ALIGN(4096); | 109 | . = ALIGN(_PAGE_SIZE); |
| 109 | __initramfs_start = .; | 110 | __initramfs_start = .; |
| 110 | .init.ramfs : { *(.init.ramfs) } | 111 | .init.ramfs : { *(.init.ramfs) } |
| 111 | __initramfs_end = .; | 112 | __initramfs_end = .; |
| @@ -113,7 +114,7 @@ SECTIONS | |||
| 113 | __per_cpu_start = .; | 114 | __per_cpu_start = .; |
| 114 | .data.percpu : { *(.data.percpu) } | 115 | .data.percpu : { *(.data.percpu) } |
| 115 | __per_cpu_end = .; | 116 | __per_cpu_end = .; |
| 116 | . = ALIGN(4096); | 117 | . = ALIGN(_PAGE_SIZE); |
| 117 | __init_end = .; | 118 | __init_end = .; |
| 118 | /* freed after init ends here */ | 119 | /* freed after init ends here */ |
| 119 | 120 | ||
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c index 8d7d7a454f9a..181bf68175fc 100644 --- a/arch/mips/lasat/reset.c +++ b/arch/mips/lasat/reset.c | |||
| @@ -19,9 +19,12 @@ | |||
| 19 | */ | 19 | */ |
| 20 | #include <linux/config.h> | 20 | #include <linux/config.h> |
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/pm.h> | ||
| 23 | |||
| 22 | #include <asm/reboot.h> | 24 | #include <asm/reboot.h> |
| 23 | #include <asm/system.h> | 25 | #include <asm/system.h> |
| 24 | #include <asm/lasat/lasat.h> | 26 | #include <asm/lasat/lasat.h> |
| 27 | |||
| 25 | #include "picvue.h" | 28 | #include "picvue.h" |
| 26 | #include "prom.h" | 29 | #include "prom.h" |
| 27 | 30 | ||
| @@ -63,5 +66,5 @@ void lasat_reboot_setup(void) | |||
| 63 | { | 66 | { |
| 64 | _machine_restart = lasat_machine_restart; | 67 | _machine_restart = lasat_machine_restart; |
| 65 | _machine_halt = lasat_machine_halt; | 68 | _machine_halt = lasat_machine_halt; |
| 66 | _machine_power_off = lasat_machine_halt; | 69 | pm_power_off = lasat_machine_halt; |
| 67 | } | 70 | } |
diff --git a/arch/mips/lib-32/dump_tlb.c b/arch/mips/lib-32/dump_tlb.c index 46519f4331eb..c49a925d0169 100644 --- a/arch/mips/lib-32/dump_tlb.c +++ b/arch/mips/lib-32/dump_tlb.c | |||
| @@ -158,29 +158,26 @@ void dump_list_process(struct task_struct *t, void *address) | |||
| 158 | printk("task->mm == %8p\n", t->mm); | 158 | printk("task->mm == %8p\n", t->mm); |
| 159 | //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); | 159 | //printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); |
| 160 | 160 | ||
| 161 | if (addr > KSEG0) | 161 | if (addr > KSEG0) { |
| 162 | page_dir = pgd_offset_k(0); | 162 | page_dir = pgd_offset_k(0); |
| 163 | else if (t->mm) { | ||
| 164 | page_dir = pgd_offset(t->mm, 0); | ||
| 165 | printk("page_dir == %08x\n", (unsigned int) page_dir); | ||
| 166 | } else | ||
| 167 | printk("Current thread has no mm\n"); | ||
| 168 | |||
| 169 | if (addr > KSEG0) | ||
| 170 | pgd = pgd_offset_k(addr); | 163 | pgd = pgd_offset_k(addr); |
| 171 | else if (t->mm) { | 164 | } else if (t->mm) { |
| 165 | page_dir = pgd_offset(t->mm, 0); | ||
| 172 | pgd = pgd_offset(t->mm, addr); | 166 | pgd = pgd_offset(t->mm, addr); |
| 173 | printk("pgd == %08x, ", (unsigned int) pgd); | 167 | } else { |
| 174 | pud = pud_offset(pgd, addr); | 168 | printk("Current thread has no mm\n"); |
| 175 | printk("pud == %08x, ", (unsigned int) pud); | 169 | return; |
| 170 | } | ||
| 171 | printk("page_dir == %08x\n", (unsigned int) page_dir); | ||
| 172 | printk("pgd == %08x, ", (unsigned int) pgd); | ||
| 173 | pud = pud_offset(pgd, addr); | ||
| 174 | printk("pud == %08x, ", (unsigned int) pud); | ||
| 176 | 175 | ||
| 177 | pmd = pmd_offset(pud, addr); | 176 | pmd = pmd_offset(pud, addr); |
| 178 | printk("pmd == %08x, ", (unsigned int) pmd); | 177 | printk("pmd == %08x, ", (unsigned int) pmd); |
| 179 | 178 | ||
| 180 | pte = pte_offset(pmd, addr); | 179 | pte = pte_offset(pmd, addr); |
| 181 | printk("pte == %08x, ", (unsigned int) pte); | 180 | printk("pte == %08x, ", (unsigned int) pte); |
| 182 | } else | ||
| 183 | printk("Current thread has no mm\n"); | ||
| 184 | 181 | ||
| 185 | page = *pte; | 182 | page = *pte; |
| 186 | #ifdef CONFIG_64BIT_PHYS_ADDR | 183 | #ifdef CONFIG_64BIT_PHYS_ADDR |
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c index 495c1ac94298..1c555e6c6a9f 100644 --- a/arch/mips/math-emu/dp_simple.c +++ b/arch/mips/math-emu/dp_simple.c | |||
| @@ -48,16 +48,22 @@ ieee754dp ieee754dp_neg(ieee754dp x) | |||
| 48 | CLEARCX; | 48 | CLEARCX; |
| 49 | FLUSHXDP; | 49 | FLUSHXDP; |
| 50 | 50 | ||
| 51 | /* | ||
| 52 | * Invert the sign ALWAYS to prevent an endless recursion on | ||
| 53 | * pow() in libc. | ||
| 54 | */ | ||
| 55 | /* quick fix up */ | ||
| 56 | DPSIGN(x) ^= 1; | ||
| 57 | |||
| 51 | if (xc == IEEE754_CLASS_SNAN) { | 58 | if (xc == IEEE754_CLASS_SNAN) { |
| 59 | ieee754dp y = ieee754dp_indef(); | ||
| 52 | SETCX(IEEE754_INVALID_OPERATION); | 60 | SETCX(IEEE754_INVALID_OPERATION); |
| 53 | return ieee754dp_nanxcpt(ieee754dp_indef(), "neg"); | 61 | DPSIGN(y) = DPSIGN(x); |
| 62 | return ieee754dp_nanxcpt(y, "neg"); | ||
| 54 | } | 63 | } |
| 55 | 64 | ||
| 56 | if (ieee754dp_isnan(x)) /* but not infinity */ | 65 | if (ieee754dp_isnan(x)) /* but not infinity */ |
| 57 | return ieee754dp_nanxcpt(x, "neg", x); | 66 | return ieee754dp_nanxcpt(x, "neg", x); |
| 58 | |||
| 59 | /* quick fix up */ | ||
| 60 | DPSIGN(x) ^= 1; | ||
| 61 | return x; | 67 | return x; |
| 62 | } | 68 | } |
| 63 | 69 | ||
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c index c809830dffb4..770f0f4677cd 100644 --- a/arch/mips/math-emu/sp_simple.c +++ b/arch/mips/math-emu/sp_simple.c | |||
| @@ -48,16 +48,22 @@ ieee754sp ieee754sp_neg(ieee754sp x) | |||
| 48 | CLEARCX; | 48 | CLEARCX; |
| 49 | FLUSHXSP; | 49 | FLUSHXSP; |
| 50 | 50 | ||
| 51 | /* | ||
| 52 | * Invert the sign ALWAYS to prevent an endless recursion on | ||
| 53 | * pow() in libc. | ||
| 54 | */ | ||
| 55 | /* quick fix up */ | ||
| 56 | SPSIGN(x) ^= 1; | ||
| 57 | |||
| 51 | if (xc == IEEE754_CLASS_SNAN) { | 58 | if (xc == IEEE754_CLASS_SNAN) { |
| 59 | ieee754sp y = ieee754sp_indef(); | ||
| 52 | SETCX(IEEE754_INVALID_OPERATION); | 60 | SETCX(IEEE754_INVALID_OPERATION); |
| 53 | return ieee754sp_nanxcpt(ieee754sp_indef(), "neg"); | 61 | SPSIGN(y) = SPSIGN(x); |
| 62 | return ieee754sp_nanxcpt(y, "neg"); | ||
| 54 | } | 63 | } |
| 55 | 64 | ||
| 56 | if (ieee754sp_isnan(x)) /* but not infinity */ | 65 | if (ieee754sp_isnan(x)) /* but not infinity */ |
| 57 | return ieee754sp_nanxcpt(x, "neg", x); | 66 | return ieee754sp_nanxcpt(x, "neg", x); |
| 58 | |||
| 59 | /* quick fix up */ | ||
| 60 | SPSIGN(x) ^= 1; | ||
| 61 | return x; | 67 | return x; |
| 62 | } | 68 | } |
| 63 | 69 | ||
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c index 9fdec743bd95..7213c395fb6b 100644 --- a/arch/mips/mips-boards/generic/reset.c +++ b/arch/mips/mips-boards/generic/reset.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | * | 23 | * |
| 24 | */ | 24 | */ |
| 25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
| 26 | #include <linux/pm.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
| 28 | #include <asm/reboot.h> | 29 | #include <asm/reboot.h> |
| @@ -65,9 +66,9 @@ void mips_reboot_setup(void) | |||
| 65 | _machine_restart = mips_machine_restart; | 66 | _machine_restart = mips_machine_restart; |
| 66 | _machine_halt = mips_machine_halt; | 67 | _machine_halt = mips_machine_halt; |
| 67 | #if defined(CONFIG_MIPS_ATLAS) | 68 | #if defined(CONFIG_MIPS_ATLAS) |
| 68 | _machine_power_off = atlas_machine_power_off; | 69 | pm_power_off = atlas_machine_power_off; |
| 69 | #endif | 70 | #endif |
| 70 | #if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD) | 71 | #if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_SEAD) |
| 71 | _machine_power_off = mips_machine_halt; | 72 | pm_power_off = mips_machine_halt; |
| 72 | #endif | 73 | #endif |
| 73 | } | 74 | } |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 422b55fab07a..e51c38cef88e 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
| @@ -464,8 +464,8 @@ static void r4k_flush_data_cache_page(unsigned long addr) | |||
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | struct flush_icache_range_args { | 466 | struct flush_icache_range_args { |
| 467 | unsigned long __user start; | 467 | unsigned long start; |
| 468 | unsigned long __user end; | 468 | unsigned long end; |
| 469 | }; | 469 | }; |
| 470 | 470 | ||
| 471 | static inline void local_r4k_flush_icache_range(void *args) | 471 | static inline void local_r4k_flush_icache_range(void *args) |
| @@ -528,8 +528,7 @@ static inline void local_r4k_flush_icache_range(void *args) | |||
| 528 | } | 528 | } |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | static void r4k_flush_icache_range(unsigned long __user start, | 531 | static void r4k_flush_icache_range(unsigned long start, unsigned long end) |
| 532 | unsigned long __user end) | ||
| 533 | { | 532 | { |
| 534 | struct flush_icache_range_args args; | 533 | struct flush_icache_range_args args; |
| 535 | 534 | ||
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 314701a66b13..591c22b080e4 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
| @@ -25,8 +25,7 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start, | |||
| 25 | unsigned long end); | 25 | unsigned long end); |
| 26 | void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, | 26 | void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, |
| 27 | unsigned long pfn); | 27 | unsigned long pfn); |
| 28 | void (*flush_icache_range)(unsigned long __user start, | 28 | void (*flush_icache_range)(unsigned long start, unsigned long end); |
| 29 | unsigned long __user end); | ||
| 30 | void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page); | 29 | void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page); |
| 31 | 30 | ||
| 32 | /* MIPS specific cache operations */ | 31 | /* MIPS specific cache operations */ |
| @@ -53,7 +52,7 @@ EXPORT_SYMBOL(_dma_cache_inv); | |||
| 53 | * We could optimize the case where the cache argument is not BCACHE but | 52 | * We could optimize the case where the cache argument is not BCACHE but |
| 54 | * that seems very atypical use ... | 53 | * that seems very atypical use ... |
| 55 | */ | 54 | */ |
| 56 | asmlinkage int sys_cacheflush(unsigned long __user addr, | 55 | asmlinkage int sys_cacheflush(unsigned long addr, |
| 57 | unsigned long bytes, unsigned int cache) | 56 | unsigned long bytes, unsigned int cache) |
| 58 | { | 57 | { |
| 59 | if (bytes == 0) | 58 | if (bytes == 0) |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 4ee91c9a556f..0ff9a348b843 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/bootmem.h> | 24 | #include <linux/bootmem.h> |
| 25 | #include <linux/highmem.h> | 25 | #include <linux/highmem.h> |
| 26 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
| 27 | #include <linux/proc_fs.h> | ||
| 27 | 28 | ||
| 28 | #include <asm/bootinfo.h> | 29 | #include <asm/bootinfo.h> |
| 29 | #include <asm/cachectl.h> | 30 | #include <asm/cachectl.h> |
| @@ -200,6 +201,11 @@ static inline int page_is_ram(unsigned long pagenr) | |||
| 200 | return 0; | 201 | return 0; |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 204 | static struct kcore_list kcore_mem, kcore_vmalloc; | ||
| 205 | #ifdef CONFIG_64BIT | ||
| 206 | static struct kcore_list kcore_kseg0; | ||
| 207 | #endif | ||
| 208 | |||
| 203 | void __init mem_init(void) | 209 | void __init mem_init(void) |
| 204 | { | 210 | { |
| 205 | unsigned long codesize, reservedpages, datasize, initsize; | 211 | unsigned long codesize, reservedpages, datasize, initsize; |
| @@ -249,6 +255,16 @@ void __init mem_init(void) | |||
| 249 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; | 255 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; |
| 250 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; | 256 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; |
| 251 | 257 | ||
| 258 | #ifdef CONFIG_64BIT | ||
| 259 | if ((unsigned long) &_text > (unsigned long) CKSEG0) | ||
| 260 | /* The -4 is a hack so that user tools don't have to handle | ||
| 261 | the overflow. */ | ||
| 262 | kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4); | ||
| 263 | #endif | ||
| 264 | kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); | ||
| 265 | kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, | ||
| 266 | VMALLOC_END-VMALLOC_START); | ||
| 267 | |||
| 252 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " | 268 | printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " |
| 253 | "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", | 269 | "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", |
| 254 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | 270 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), |
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c index bab192ddc185..301d67226d72 100644 --- a/arch/mips/momentum/jaguar_atx/setup.c +++ b/arch/mips/momentum/jaguar_atx/setup.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/pci.h> | 50 | #include <linux/pci.h> |
| 51 | #include <linux/swap.h> | 51 | #include <linux/swap.h> |
| 52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
| 53 | #include <linux/pm.h> | ||
| 53 | #include <linux/sched.h> | 54 | #include <linux/sched.h> |
| 54 | #include <linux/interrupt.h> | 55 | #include <linux/interrupt.h> |
| 55 | #include <linux/timex.h> | 56 | #include <linux/timex.h> |
| @@ -365,7 +366,7 @@ void __init plat_setup(void) | |||
| 365 | 366 | ||
| 366 | _machine_restart = momenco_jaguar_restart; | 367 | _machine_restart = momenco_jaguar_restart; |
| 367 | _machine_halt = momenco_jaguar_halt; | 368 | _machine_halt = momenco_jaguar_halt; |
| 368 | _machine_power_off = momenco_jaguar_power_off; | 369 | pm_power_off = momenco_jaguar_power_off; |
| 369 | 370 | ||
| 370 | /* | 371 | /* |
| 371 | * initrd_start = (ulong)jaguar_initrd_start; | 372 | * initrd_start = (ulong)jaguar_initrd_start; |
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c index c9b7ff8148ec..f95677f4f06f 100644 --- a/arch/mips/momentum/ocelot_3/setup.c +++ b/arch/mips/momentum/ocelot_3/setup.c | |||
| @@ -57,6 +57,8 @@ | |||
| 57 | #include <linux/timex.h> | 57 | #include <linux/timex.h> |
| 58 | #include <linux/bootmem.h> | 58 | #include <linux/bootmem.h> |
| 59 | #include <linux/mv643xx.h> | 59 | #include <linux/mv643xx.h> |
| 60 | #include <linux/pm.h> | ||
| 61 | |||
| 60 | #include <asm/time.h> | 62 | #include <asm/time.h> |
| 61 | #include <asm/page.h> | 63 | #include <asm/page.h> |
| 62 | #include <asm/bootinfo.h> | 64 | #include <asm/bootinfo.h> |
| @@ -321,7 +323,7 @@ void __init plat_setup(void) | |||
| 321 | 323 | ||
| 322 | _machine_restart = momenco_ocelot_restart; | 324 | _machine_restart = momenco_ocelot_restart; |
| 323 | _machine_halt = momenco_ocelot_halt; | 325 | _machine_halt = momenco_ocelot_halt; |
| 324 | _machine_power_off = momenco_ocelot_power_off; | 326 | pm_power_off = momenco_ocelot_power_off; |
| 325 | 327 | ||
| 326 | /* Wired TLB entries */ | 328 | /* Wired TLB entries */ |
| 327 | setup_wired_tlb_entries(); | 329 | setup_wired_tlb_entries(); |
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c index 2755c1547473..15998d8a9341 100644 --- a/arch/mips/momentum/ocelot_c/setup.c +++ b/arch/mips/momentum/ocelot_c/setup.c | |||
| @@ -51,8 +51,10 @@ | |||
| 51 | #include <linux/sched.h> | 51 | #include <linux/sched.h> |
| 52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
| 53 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
| 54 | #include <linux/pm.h> | ||
| 54 | #include <linux/timex.h> | 55 | #include <linux/timex.h> |
| 55 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
| 57 | |||
| 56 | #include <asm/time.h> | 58 | #include <asm/time.h> |
| 57 | #include <asm/bootinfo.h> | 59 | #include <asm/bootinfo.h> |
| 58 | #include <asm/page.h> | 60 | #include <asm/page.h> |
| @@ -236,7 +238,7 @@ void __init plat_setup(void) | |||
| 236 | 238 | ||
| 237 | _machine_restart = momenco_ocelot_restart; | 239 | _machine_restart = momenco_ocelot_restart; |
| 238 | _machine_halt = momenco_ocelot_halt; | 240 | _machine_halt = momenco_ocelot_halt; |
| 239 | _machine_power_off = momenco_ocelot_power_off; | 241 | pm_power_off = momenco_ocelot_power_off; |
| 240 | 242 | ||
| 241 | /* | 243 | /* |
| 242 | * initrd_start = (ulong)ocelot_initrd_start; | 244 | * initrd_start = (ulong)ocelot_initrd_start; |
diff --git a/arch/mips/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c index 6336751391c3..fed4e8eee116 100644 --- a/arch/mips/momentum/ocelot_g/setup.c +++ b/arch/mips/momentum/ocelot_g/setup.c | |||
| @@ -47,8 +47,10 @@ | |||
| 47 | #include <linux/sched.h> | 47 | #include <linux/sched.h> |
| 48 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
| 49 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
| 50 | #include <linux/pm.h> | ||
| 50 | #include <linux/timex.h> | 51 | #include <linux/timex.h> |
| 51 | #include <linux/vmalloc.h> | 52 | #include <linux/vmalloc.h> |
| 53 | |||
| 52 | #include <asm/time.h> | 54 | #include <asm/time.h> |
| 53 | #include <asm/bootinfo.h> | 55 | #include <asm/bootinfo.h> |
| 54 | #include <asm/page.h> | 56 | #include <asm/page.h> |
| @@ -169,7 +171,7 @@ void __init plat_setup(void) | |||
| 169 | 171 | ||
| 170 | _machine_restart = momenco_ocelot_restart; | 172 | _machine_restart = momenco_ocelot_restart; |
| 171 | _machine_halt = momenco_ocelot_halt; | 173 | _machine_halt = momenco_ocelot_halt; |
| 172 | _machine_power_off = momenco_ocelot_power_off; | 174 | pm_power_off = momenco_ocelot_power_off; |
| 173 | 175 | ||
| 174 | /* | 176 | /* |
| 175 | * initrd_start = (ulong)ocelot_initrd_start; | 177 | * initrd_start = (ulong)ocelot_initrd_start; |
diff --git a/arch/mips/oprofile/Makefile b/arch/mips/oprofile/Makefile index 354261d37d62..0a50aad5bbe4 100644 --- a/arch/mips/oprofile/Makefile +++ b/arch/mips/oprofile/Makefile | |||
| @@ -12,4 +12,5 @@ oprofile-y := $(DRIVER_OBJS) common.o | |||
| 12 | 12 | ||
| 13 | oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o | 13 | oprofile-$(CONFIG_CPU_MIPS32) += op_model_mipsxx.o |
| 14 | oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o | 14 | oprofile-$(CONFIG_CPU_MIPS64) += op_model_mipsxx.o |
| 15 | oprofile-$(CONFIG_CPU_SB1) += op_model_mipsxx.o | ||
| 15 | oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o | 16 | oprofile-$(CONFIG_CPU_RM9000) += op_model_rm9000.o |
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c index 53f9889b30ed..935dd851f480 100644 --- a/arch/mips/oprofile/common.c +++ b/arch/mips/oprofile/common.c | |||
| @@ -79,6 +79,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
| 79 | case CPU_20KC: | 79 | case CPU_20KC: |
| 80 | case CPU_24K: | 80 | case CPU_24K: |
| 81 | case CPU_25KF: | 81 | case CPU_25KF: |
| 82 | case CPU_34K: | ||
| 83 | case CPU_SB1: | ||
| 84 | case CPU_SB1A: | ||
| 82 | lmodel = &op_model_mipsxx; | 85 | lmodel = &op_model_mipsxx; |
| 83 | break; | 86 | break; |
| 84 | 87 | ||
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c index 1d1eee407faf..95d488ca0754 100644 --- a/arch/mips/oprofile/op_model_mipsxx.c +++ b/arch/mips/oprofile/op_model_mipsxx.c | |||
| @@ -201,10 +201,21 @@ static int __init mipsxx_init(void) | |||
| 201 | op_model_mipsxx.cpu_type = "mips/25K"; | 201 | op_model_mipsxx.cpu_type = "mips/25K"; |
| 202 | break; | 202 | break; |
| 203 | 203 | ||
| 204 | #ifndef CONFIG_SMP | ||
| 205 | case CPU_34K: | ||
| 206 | op_model_mipsxx.cpu_type = "mips/34K"; | ||
| 207 | break; | ||
| 208 | #endif | ||
| 209 | |||
| 204 | case CPU_5KC: | 210 | case CPU_5KC: |
| 205 | op_model_mipsxx.cpu_type = "mips/5K"; | 211 | op_model_mipsxx.cpu_type = "mips/5K"; |
| 206 | break; | 212 | break; |
| 207 | 213 | ||
| 214 | case CPU_SB1: | ||
| 215 | case CPU_SB1A: | ||
| 216 | op_model_mipsxx.cpu_type = "mips/sb1"; | ||
| 217 | break; | ||
| 218 | |||
| 208 | default: | 219 | default: |
| 209 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); | 220 | printk(KERN_ERR "Profiling unsupported for this CPU\n"); |
| 210 | 221 | ||
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index 741e67c9195a..16205b587338 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
| @@ -46,6 +46,7 @@ obj-$(CONFIG_PMC_YOSEMITE) += fixup-yosemite.o ops-titan.o ops-titan-ht.o \ | |||
| 46 | obj-$(CONFIG_SGI_IP27) += pci-ip27.o | 46 | obj-$(CONFIG_SGI_IP27) += pci-ip27.o |
| 47 | obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o | 47 | obj-$(CONFIG_SGI_IP32) += fixup-ip32.o ops-mace.o pci-ip32.o |
| 48 | obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o | 48 | obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o |
| 49 | obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o | ||
| 49 | obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o | 50 | obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o |
| 50 | obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o | 51 | obj-$(CONFIG_SNI_RM200_PCI) += fixup-sni.o ops-sni.o |
| 51 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o | 52 | obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o |
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c index 909292f50d06..75a01e764898 100644 --- a/arch/mips/pci/fixup-cobalt.c +++ b/arch/mips/pci/fixup-cobalt.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
| 18 | #include <asm/gt64120.h> | 18 | #include <asm/gt64120.h> |
| 19 | 19 | ||
| 20 | #include <asm/cobalt/cobalt.h> | 20 | #include <asm/mach-cobalt/cobalt.h> |
| 21 | 21 | ||
| 22 | extern int cobalt_board_id; | 22 | extern int cobalt_board_id; |
| 23 | 23 | ||
| @@ -52,7 +52,7 @@ static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev) | |||
| 52 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, <); | 52 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, <); |
| 53 | if (lt < 64) | 53 | if (lt < 64) |
| 54 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); | 54 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); |
| 55 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); | 55 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, | 58 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, |
| @@ -69,7 +69,7 @@ static void qube_raq_galileo_fixup(struct pci_dev *dev) | |||
| 69 | * host bridge. | 69 | * host bridge. |
| 70 | */ | 70 | */ |
| 71 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); | 71 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); |
| 72 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 7); | 72 | pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8); |
| 73 | 73 | ||
| 74 | /* | 74 | /* |
| 75 | * The code described by the comment below has been removed | 75 | * The code described by the comment below has been removed |
diff --git a/arch/mips/pci/ops-gt64111.c b/arch/mips/pci/ops-gt64111.c index c1807934768d..13de45940b19 100644 --- a/arch/mips/pci/ops-gt64111.c +++ b/arch/mips/pci/ops-gt64111.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
| 16 | #include <asm/gt64120.h> | 16 | #include <asm/gt64120.h> |
| 17 | 17 | ||
| 18 | #include <asm/cobalt/cobalt.h> | 18 | #include <asm/mach-cobalt/cobalt.h> |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| 21 | * Device 31 on the GT64111 is used to generate PCI special | 21 | * Device 31 on the GT64111 is used to generate PCI special |
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c index f194b4e4f86a..ca975e7d32ff 100644 --- a/arch/mips/pci/pci-bcm1480.c +++ b/arch/mips/pci/pci-bcm1480.c | |||
| @@ -234,11 +234,9 @@ static int __init bcm1480_pcibios_init(void) | |||
| 234 | 234 | ||
| 235 | /* turn on ExpMemEn */ | 235 | /* turn on ExpMemEn */ |
| 236 | cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); | 236 | cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); |
| 237 | printk("PCIFeatureCtrl = %x\n", cmdreg); | ||
| 238 | WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40), | 237 | WRITECFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40), |
| 239 | cmdreg | 0x10); | 238 | cmdreg | 0x10); |
| 240 | cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); | 239 | cmdreg = READCFG32(CFGOFFSET(0, PCI_DEVFN(PCI_BRIDGE_DEVICE, 0), 0x40)); |
| 241 | printk("PCIFeatureCtrl = %x\n", cmdreg); | ||
| 242 | 240 | ||
| 243 | /* | 241 | /* |
| 244 | * Establish mappings in KSEG2 (kernel virtual) to PCI I/O | 242 | * Establish mappings in KSEG2 (kernel virtual) to PCI I/O |
diff --git a/arch/mips/philips/pnx8550/common/setup.c b/arch/mips/philips/pnx8550/common/setup.c index ee6bf72094f6..0d8a77619391 100644 --- a/arch/mips/philips/pnx8550/common/setup.c +++ b/arch/mips/philips/pnx8550/common/setup.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/serial_ip3106.h> | 27 | #include <linux/serial_ip3106.h> |
| 28 | #include <linux/pm.h> | ||
| 28 | 29 | ||
| 29 | #include <asm/cpu.h> | 30 | #include <asm/cpu.h> |
| 30 | #include <asm/bootinfo.h> | 31 | #include <asm/bootinfo.h> |
| @@ -90,7 +91,7 @@ void __init plat_setup(void) | |||
| 90 | 91 | ||
| 91 | _machine_restart = pnx8550_machine_restart; | 92 | _machine_restart = pnx8550_machine_restart; |
| 92 | _machine_halt = pnx8550_machine_halt; | 93 | _machine_halt = pnx8550_machine_halt; |
| 93 | _machine_power_off = pnx8550_machine_power_off; | 94 | pm_power_off = pnx8550_machine_power_off; |
| 94 | 95 | ||
| 95 | board_time_init = pnx8550_time_init; | 96 | board_time_init = pnx8550_time_init; |
| 96 | board_timer_setup = pnx8550_timer_setup; | 97 | board_timer_setup = pnx8550_timer_setup; |
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c index 555bfacf7647..165275c00cbb 100644 --- a/arch/mips/pmc-sierra/yosemite/prom.c +++ b/arch/mips/pmc-sierra/yosemite/prom.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
| 14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/pm.h> | ||
| 16 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
| 17 | 18 | ||
| 18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
| @@ -92,7 +93,7 @@ void __init prom_init(void) | |||
| 92 | /* Callbacks for halt, restart */ | 93 | /* Callbacks for halt, restart */ |
| 93 | _machine_restart = (void (*)(char *)) prom_exit; | 94 | _machine_restart = (void (*)(char *)) prom_exit; |
| 94 | _machine_halt = prom_halt; | 95 | _machine_halt = prom_halt; |
| 95 | _machine_power_off = prom_halt; | 96 | pm_power_off = prom_halt; |
| 96 | 97 | ||
| 97 | debug_vectors = cv; | 98 | debug_vectors = cv; |
| 98 | arcs_cmdline[0] = '\0'; | 99 | arcs_cmdline[0] = '\0'; |
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c index 214ffd2e98a3..92a3b3c15ed3 100644 --- a/arch/mips/sgi-ip22/ip22-reset.c +++ b/arch/mips/sgi-ip22/ip22-reset.c | |||
| @@ -3,8 +3,9 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1997, 1998, 2001, 2003 by Ralf Baechle | 6 | * Copyright (C) 1997, 1998, 2001, 03, 05, 06 by Ralf Baechle |
| 7 | */ | 7 | */ |
| 8 | #include <linux/linkage.h> | ||
| 8 | #include <linux/init.h> | 9 | #include <linux/init.h> |
| 9 | #include <linux/ds1286.h> | 10 | #include <linux/ds1286.h> |
| 10 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| @@ -12,6 +13,7 @@ | |||
| 12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 14 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
| 16 | #include <linux/pm.h> | ||
| 15 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
| 16 | 18 | ||
| 17 | #include <asm/io.h> | 19 | #include <asm/io.h> |
| @@ -41,28 +43,10 @@ static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer; | |||
| 41 | 43 | ||
| 42 | #define MACHINE_PANICED 1 | 44 | #define MACHINE_PANICED 1 |
| 43 | #define MACHINE_SHUTTING_DOWN 2 | 45 | #define MACHINE_SHUTTING_DOWN 2 |
| 44 | static int machine_state = 0; | ||
| 45 | 46 | ||
| 46 | static void sgi_machine_restart(char *command) __attribute__((noreturn)); | 47 | static int machine_state; |
| 47 | static void sgi_machine_halt(void) __attribute__((noreturn)); | ||
| 48 | static void sgi_machine_power_off(void) __attribute__((noreturn)); | ||
| 49 | 48 | ||
| 50 | static void sgi_machine_restart(char *command) | 49 | static void ATTRIB_NORET sgi_machine_power_off(void) |
| 51 | { | ||
| 52 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
| 53 | sgi_machine_power_off(); | ||
| 54 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
| 55 | while (1); | ||
| 56 | } | ||
| 57 | |||
| 58 | static void sgi_machine_halt(void) | ||
| 59 | { | ||
| 60 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
| 61 | sgi_machine_power_off(); | ||
| 62 | ArcEnterInteractiveMode(); | ||
| 63 | } | ||
| 64 | |||
| 65 | static void sgi_machine_power_off(void) | ||
| 66 | { | 50 | { |
| 67 | unsigned int tmp; | 51 | unsigned int tmp; |
| 68 | 52 | ||
| @@ -84,6 +68,21 @@ static void sgi_machine_power_off(void) | |||
| 84 | } | 68 | } |
| 85 | } | 69 | } |
| 86 | 70 | ||
| 71 | static void ATTRIB_NORET sgi_machine_restart(char *command) | ||
| 72 | { | ||
| 73 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
| 74 | sgi_machine_power_off(); | ||
| 75 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
| 76 | while (1); | ||
| 77 | } | ||
| 78 | |||
| 79 | static void ATTRIB_NORET sgi_machine_halt(void) | ||
| 80 | { | ||
| 81 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
| 82 | sgi_machine_power_off(); | ||
| 83 | ArcEnterInteractiveMode(); | ||
| 84 | } | ||
| 85 | |||
| 87 | static void power_timeout(unsigned long data) | 86 | static void power_timeout(unsigned long data) |
| 88 | { | 87 | { |
| 89 | sgi_machine_power_off(); | 88 | sgi_machine_power_off(); |
| @@ -95,7 +94,7 @@ static void blink_timeout(unsigned long data) | |||
| 95 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); | 94 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); |
| 96 | sgioc->reset = sgi_ioc_reset; | 95 | sgioc->reset = sgi_ioc_reset; |
| 97 | 96 | ||
| 98 | mod_timer(&blink_timer, jiffies+data); | 97 | mod_timer(&blink_timer, jiffies + data); |
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | static void debounce(unsigned long data) | 100 | static void debounce(unsigned long data) |
| @@ -103,7 +102,7 @@ static void debounce(unsigned long data) | |||
| 103 | del_timer(&debounce_timer); | 102 | del_timer(&debounce_timer); |
| 104 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 103 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
| 105 | /* Interrupt still being sent. */ | 104 | /* Interrupt still being sent. */ |
| 106 | debounce_timer.expires = jiffies + 5; /* 0.05s */ | 105 | debounce_timer.expires = jiffies + (HZ / 20); /* 0.05s */ |
| 107 | add_timer(&debounce_timer); | 106 | add_timer(&debounce_timer); |
| 108 | 107 | ||
| 109 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | | 108 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | |
| @@ -151,7 +150,7 @@ static inline void volume_up_button(unsigned long data) | |||
| 151 | indy_volume_button(1); | 150 | indy_volume_button(1); |
| 152 | 151 | ||
| 153 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 152 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
| 154 | volume_timer.expires = jiffies + 1; | 153 | volume_timer.expires = jiffies + (HZ / 100); |
| 155 | add_timer(&volume_timer); | 154 | add_timer(&volume_timer); |
| 156 | } | 155 | } |
| 157 | } | 156 | } |
| @@ -164,7 +163,7 @@ static inline void volume_down_button(unsigned long data) | |||
| 164 | indy_volume_button(-1); | 163 | indy_volume_button(-1); |
| 165 | 164 | ||
| 166 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 165 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
| 167 | volume_timer.expires = jiffies + 1; | 166 | volume_timer.expires = jiffies + (HZ / 100); |
| 168 | add_timer(&volume_timer); | 167 | add_timer(&volume_timer); |
| 169 | } | 168 | } |
| 170 | } | 169 | } |
| @@ -199,14 +198,14 @@ static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs) | |||
| 199 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { | 198 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { |
| 200 | init_timer(&volume_timer); | 199 | init_timer(&volume_timer); |
| 201 | volume_timer.function = volume_up_button; | 200 | volume_timer.function = volume_up_button; |
| 202 | volume_timer.expires = jiffies + 1; | 201 | volume_timer.expires = jiffies + (HZ / 100); |
| 203 | add_timer(&volume_timer); | 202 | add_timer(&volume_timer); |
| 204 | } | 203 | } |
| 205 | /* Volume down button was pressed */ | 204 | /* Volume down button was pressed */ |
| 206 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { | 205 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { |
| 207 | init_timer(&volume_timer); | 206 | init_timer(&volume_timer); |
| 208 | volume_timer.function = volume_down_button; | 207 | volume_timer.function = volume_down_button; |
| 209 | volume_timer.expires = jiffies + 1; | 208 | volume_timer.expires = jiffies + (HZ / 100); |
| 210 | add_timer(&volume_timer); | 209 | add_timer(&volume_timer); |
| 211 | } | 210 | } |
| 212 | 211 | ||
| @@ -234,7 +233,7 @@ static int __init reboot_setup(void) | |||
| 234 | { | 233 | { |
| 235 | _machine_restart = sgi_machine_restart; | 234 | _machine_restart = sgi_machine_restart; |
| 236 | _machine_halt = sgi_machine_halt; | 235 | _machine_halt = sgi_machine_halt; |
| 237 | _machine_power_off = sgi_machine_power_off; | 236 | pm_power_off = sgi_machine_power_off; |
| 238 | 237 | ||
| 239 | request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); | 238 | request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); |
| 240 | init_timer(&blink_timer); | 239 | init_timer(&blink_timer); |
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c index 5e59b4c8876b..7018e1833e85 100644 --- a/arch/mips/sgi-ip22/ip22-setup.c +++ b/arch/mips/sgi-ip22/ip22-setup.c | |||
| @@ -56,6 +56,7 @@ extern void ip22_time_init(void) __init; | |||
| 56 | void __init plat_setup(void) | 56 | void __init plat_setup(void) |
| 57 | { | 57 | { |
| 58 | char *ctype; | 58 | char *ctype; |
| 59 | char *cserial; | ||
| 59 | 60 | ||
| 60 | board_be_init = ip22_be_init; | 61 | board_be_init = ip22_be_init; |
| 61 | ip22_time_init(); | 62 | ip22_time_init(); |
| @@ -81,9 +82,14 @@ void __init plat_setup(void) | |||
| 81 | /* ARCS console environment variable is set to "g?" for | 82 | /* ARCS console environment variable is set to "g?" for |
| 82 | * graphics console, it is set to "d" for the first serial | 83 | * graphics console, it is set to "d" for the first serial |
| 83 | * line and "d2" for the second serial line. | 84 | * line and "d2" for the second serial line. |
| 85 | * | ||
| 86 | * Need to check if the case is 'g' but no keyboard: | ||
| 87 | * (ConsoleIn/Out = serial) | ||
| 84 | */ | 88 | */ |
| 85 | ctype = ArcGetEnvironmentVariable("console"); | 89 | ctype = ArcGetEnvironmentVariable("console"); |
| 86 | if (ctype && *ctype == 'd') { | 90 | cserial = ArcGetEnvironmentVariable("ConsoleOut"); |
| 91 | |||
| 92 | if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) { | ||
| 87 | static char options[8]; | 93 | static char options[8]; |
| 88 | char *baud = ArcGetEnvironmentVariable("dbaud"); | 94 | char *baud = ArcGetEnvironmentVariable("dbaud"); |
| 89 | if (baud) | 95 | if (baud) |
| @@ -91,7 +97,7 @@ void __init plat_setup(void) | |||
| 91 | add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, | 97 | add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0, |
| 92 | baud ? options : NULL); | 98 | baud ? options : NULL); |
| 93 | } else if (!ctype || *ctype != 'g') { | 99 | } else if (!ctype || *ctype != 'g') { |
| 94 | /* Use ARC if we don't want serial ('d') or Newport ('g'). */ | 100 | /* Use ARC if we don't want serial ('d') or graphics ('g'). */ |
| 95 | prom_flags |= PROM_FLAG_USE_AS_CONSOLE; | 101 | prom_flags |= PROM_FLAG_USE_AS_CONSOLE; |
| 96 | add_preferred_console("arc", 0, NULL); | 102 | add_preferred_console("arc", 0, NULL); |
| 97 | } | 103 | } |
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c index 2e16be94c78b..4322db57d3c1 100644 --- a/arch/mips/sgi-ip27/ip27-reset.c +++ b/arch/mips/sgi-ip27/ip27-reset.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * Reset an IP27. | 6 | * Reset an IP27. |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle | 8 | * Copyright (C) 1997, 1998, 1999, 2000, 06 by Ralf Baechle |
| 9 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | 9 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. |
| 10 | */ | 10 | */ |
| 11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
| 16 | #include <linux/mmzone.h> | 16 | #include <linux/mmzone.h> |
| 17 | #include <linux/nodemask.h> | 17 | #include <linux/nodemask.h> |
| 18 | #include <linux/pm.h> | ||
| 18 | 19 | ||
| 19 | #include <asm/io.h> | 20 | #include <asm/io.h> |
| 20 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
| @@ -77,5 +78,5 @@ void ip27_reboot_setup(void) | |||
| 77 | { | 78 | { |
| 78 | _machine_restart = ip27_machine_restart; | 79 | _machine_restart = ip27_machine_restart; |
| 79 | _machine_halt = ip27_machine_halt; | 80 | _machine_halt = ip27_machine_halt; |
| 80 | _machine_power_off = ip27_machine_power_off; | 81 | pm_power_off = ip27_machine_power_off; |
| 81 | } | 82 | } |
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c index 88e1f52059ff..0c948008b023 100644 --- a/arch/mips/sgi-ip32/ip32-reset.c +++ b/arch/mips/sgi-ip32/ip32-reset.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/ds17287rtc.h> | 16 | #include <linux/ds17287rtc.h> |
| 17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/pm.h> | ||
| 18 | 19 | ||
| 19 | #include <asm/addrspace.h> | 20 | #include <asm/addrspace.h> |
| 20 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
| @@ -188,7 +189,7 @@ static __init int ip32_reboot_setup(void) | |||
| 188 | 189 | ||
| 189 | _machine_restart = ip32_machine_restart; | 190 | _machine_restart = ip32_machine_restart; |
| 190 | _machine_halt = ip32_machine_halt; | 191 | _machine_halt = ip32_machine_halt; |
| 191 | _machine_power_off = ip32_machine_power_off; | 192 | pm_power_off = ip32_machine_power_off; |
| 192 | 193 | ||
| 193 | init_timer(&blink_timer); | 194 | init_timer(&blink_timer); |
| 194 | blink_timer.function = blink_timeout; | 195 | blink_timer.function = blink_timeout; |
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c index 7a2c7a8510d4..ea308029450e 100644 --- a/arch/mips/sibyte/cfe/setup.c +++ b/arch/mips/sibyte/cfe/setup.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| 24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
| 25 | #include <linux/bootmem.h> | 25 | #include <linux/bootmem.h> |
| 26 | #include <linux/pm.h> | ||
| 26 | #include <linux/smp.h> | 27 | #include <linux/smp.h> |
| 27 | 28 | ||
| 28 | #include <asm/bootinfo.h> | 29 | #include <asm/bootinfo.h> |
| @@ -248,7 +249,7 @@ void __init prom_init(void) | |||
| 248 | 249 | ||
| 249 | _machine_restart = cfe_linux_restart; | 250 | _machine_restart = cfe_linux_restart; |
| 250 | _machine_halt = cfe_linux_halt; | 251 | _machine_halt = cfe_linux_halt; |
| 251 | _machine_power_off = cfe_linux_halt; | 252 | pm_power_off = cfe_linux_halt; |
| 252 | 253 | ||
| 253 | /* | 254 | /* |
| 254 | * Check if a loader was used; if NOT, the 4 arguments are | 255 | * Check if a loader was used; if NOT, the 4 arguments are |
diff --git a/arch/mips/sibyte/sb1250/prom.c b/arch/mips/sibyte/sb1250/prom.c index de62ab0f55a2..742043f8d755 100644 --- a/arch/mips/sibyte/sb1250/prom.c +++ b/arch/mips/sibyte/sb1250/prom.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/bootmem.h> | 24 | #include <linux/bootmem.h> |
| 25 | #include <linux/smp.h> | 25 | #include <linux/smp.h> |
| 26 | #include <linux/initrd.h> | 26 | #include <linux/initrd.h> |
| 27 | #include <linux/pm.h> | ||
| 27 | 28 | ||
| 28 | #include <asm/bootinfo.h> | 29 | #include <asm/bootinfo.h> |
| 29 | #include <asm/reboot.h> | 30 | #include <asm/reboot.h> |
| @@ -79,7 +80,7 @@ void __init prom_init(void) | |||
| 79 | { | 80 | { |
| 80 | _machine_restart = (void (*)(char *))prom_linux_exit; | 81 | _machine_restart = (void (*)(char *))prom_linux_exit; |
| 81 | _machine_halt = prom_linux_exit; | 82 | _machine_halt = prom_linux_exit; |
| 82 | _machine_power_off = prom_linux_exit; | 83 | pm_power_off = prom_linux_exit; |
| 83 | 84 | ||
| 84 | strcpy(arcs_cmdline, "root=/dev/ram0 "); | 85 | strcpy(arcs_cmdline, "root=/dev/ram0 "); |
| 85 | 86 | ||
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c index df2e266c700c..fde4751c84fe 100644 --- a/arch/mips/sibyte/sb1250/setup.c +++ b/arch/mips/sibyte/sb1250/setup.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ | 17 | */ |
| 18 | #include <linux/config.h> | 18 | #include <linux/config.h> |
| 19 | #include <linux/init.h> | ||
| 19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 20 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
| 21 | #include <linux/string.h> | 22 | #include <linux/string.h> |
| @@ -42,7 +43,7 @@ static inline int setup_bcm112x(void); | |||
| 42 | 43 | ||
| 43 | /* Setup code likely to be common to all SiByte platforms */ | 44 | /* Setup code likely to be common to all SiByte platforms */ |
| 44 | 45 | ||
| 45 | static inline int sys_rev_decode(void) | 46 | static int __init sys_rev_decode(void) |
| 46 | { | 47 | { |
| 47 | int ret = 0; | 48 | int ret = 0; |
| 48 | 49 | ||
| @@ -74,7 +75,7 @@ static inline int sys_rev_decode(void) | |||
| 74 | return ret; | 75 | return ret; |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | static inline int setup_bcm1250(void) | 78 | static int __init setup_bcm1250(void) |
| 78 | { | 79 | { |
| 79 | int ret = 0; | 80 | int ret = 0; |
| 80 | 81 | ||
| @@ -120,7 +121,7 @@ static inline int setup_bcm1250(void) | |||
| 120 | return ret; | 121 | return ret; |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 123 | static inline int setup_bcm112x(void) | 124 | static int __init setup_bcm112x(void) |
| 124 | { | 125 | { |
| 125 | int ret = 0; | 126 | int ret = 0; |
| 126 | 127 | ||
| @@ -146,7 +147,7 @@ static inline int setup_bcm112x(void) | |||
| 146 | return ret; | 147 | return ret; |
| 147 | } | 148 | } |
| 148 | 149 | ||
| 149 | void sb1250_setup(void) | 150 | void __init sb1250_setup(void) |
| 150 | { | 151 | { |
| 151 | uint64_t sys_rev; | 152 | uint64_t sys_rev; |
| 152 | int plldiv; | 153 | int plldiv; |
| @@ -169,31 +170,42 @@ void sb1250_setup(void) | |||
| 169 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); | 170 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); |
| 170 | prom_printf("Board type: %s\n", get_system_type()); | 171 | prom_printf("Board type: %s\n", get_system_type()); |
| 171 | 172 | ||
| 172 | switch(war_pass) { | 173 | switch (war_pass) { |
| 173 | case K_SYS_REVISION_BCM1250_PASS1: | 174 | case K_SYS_REVISION_BCM1250_PASS1: |
| 174 | #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS | 175 | #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS |
| 175 | prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); | 176 | prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " |
| 177 | "and the kernel doesn't have the proper " | ||
| 178 | "workarounds compiled in. @@@@\n"); | ||
| 176 | bad_config = 1; | 179 | bad_config = 1; |
| 177 | #endif | 180 | #endif |
| 178 | break; | 181 | break; |
| 179 | case K_SYS_REVISION_BCM1250_PASS2: | 182 | case K_SYS_REVISION_BCM1250_PASS2: |
| 180 | /* Pass 2 - easiest as default for now - so many numbers */ | 183 | /* Pass 2 - easiest as default for now - so many numbers */ |
| 181 | #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) | 184 | #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \ |
| 182 | prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); | 185 | !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) |
| 186 | prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the " | ||
| 187 | "kernel doesn't have the proper workarounds " | ||
| 188 | "compiled in. @@@@\n"); | ||
| 183 | bad_config = 1; | 189 | bad_config = 1; |
| 184 | #endif | 190 | #endif |
| 185 | #ifdef CONFIG_CPU_HAS_PREFETCH | 191 | #ifdef CONFIG_CPU_HAS_PREFETCH |
| 186 | prom_printf("@@@@ Prefetches may be enabled in this kernel, but are buggy on this board. @@@@\n"); | 192 | prom_printf("@@@@ Prefetches may be enabled in this kernel, " |
| 193 | "but are buggy on this board. @@@@\n"); | ||
| 187 | bad_config = 1; | 194 | bad_config = 1; |
| 188 | #endif | 195 | #endif |
| 189 | break; | 196 | break; |
| 190 | case K_SYS_REVISION_BCM1250_PASS2_2: | 197 | case K_SYS_REVISION_BCM1250_PASS2_2: |
| 191 | #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS | 198 | #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS |
| 192 | prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the kernel doesn't have the proper workarounds compiled in. @@@@\n"); | 199 | prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the " |
| 200 | "kernel doesn't have the proper workarounds " | ||
| 201 | "compiled in. @@@@\n"); | ||
| 193 | bad_config = 1; | 202 | bad_config = 1; |
| 194 | #endif | 203 | #endif |
| 195 | #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || !defined(CONFIG_CPU_HAS_PREFETCH) | 204 | #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \ |
| 196 | prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is conservatively configured for an 'A' stepping. @@@@\n"); | 205 | !defined(CONFIG_CPU_HAS_PREFETCH) |
| 206 | prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is " | ||
| 207 | "conservatively configured for an 'A' stepping. " | ||
| 208 | "@@@@\n"); | ||
| 197 | #endif | 209 | #endif |
| 198 | break; | 210 | break; |
| 199 | default: | 211 | default: |
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c index 262c85680709..1141fcd13a59 100644 --- a/arch/mips/sni/setup.c +++ b/arch/mips/sni/setup.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. | 6 | * for more details. |
| 7 | * | 7 | * |
| 8 | * Copyright (C) 1996, 97, 98, 2000, 03, 04 Ralf Baechle (ralf@linux-mips.org) | 8 | * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) |
| 9 | */ | 9 | */ |
| 10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
| 11 | #include <linux/eisa.h> | 11 | #include <linux/eisa.h> |
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/mc146818rtc.h> | 17 | #include <linux/mc146818rtc.h> |
| 18 | #include <linux/pm.h> | ||
| 18 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
| 19 | #include <linux/console.h> | 20 | #include <linux/console.h> |
| 20 | #include <linux/fb.h> | 21 | #include <linux/fb.h> |
| @@ -189,7 +190,7 @@ void __init plat_setup(void) | |||
| 189 | 190 | ||
| 190 | _machine_restart = sni_machine_restart; | 191 | _machine_restart = sni_machine_restart; |
| 191 | _machine_halt = sni_machine_halt; | 192 | _machine_halt = sni_machine_halt; |
| 192 | _machine_power_off = sni_machine_power_off; | 193 | pm_power_off = sni_machine_power_off; |
| 193 | 194 | ||
| 194 | sni_display_setup(); | 195 | sni_display_setup(); |
| 195 | 196 | ||
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c index e4d095d3e192..e19e2be70f76 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c | |||
| @@ -60,7 +60,6 @@ void __init prom_init_cmdline(void) | |||
| 60 | 60 | ||
| 61 | void __init prom_init(void) | 61 | void __init prom_init(void) |
| 62 | { | 62 | { |
| 63 | const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES; | ||
| 64 | extern int tx4927_get_mem_size(void); | 63 | extern int tx4927_get_mem_size(void); |
| 65 | extern char* toshiba_name; | 64 | extern char* toshiba_name; |
| 66 | int msize; | 65 | int msize; |
| @@ -69,12 +68,13 @@ void __init prom_init(void) | |||
| 69 | 68 | ||
| 70 | mips_machgroup = MACH_GROUP_TOSHIBA; | 69 | mips_machgroup = MACH_GROUP_TOSHIBA; |
| 71 | 70 | ||
| 72 | if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) | 71 | if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) { |
| 73 | mips_machtype = MACH_TOSHIBA_RBTX4927; | 72 | mips_machtype = MACH_TOSHIBA_RBTX4927; |
| 74 | else | 73 | toshiba_name = "TX4927"; |
| 74 | } else { | ||
| 75 | mips_machtype = MACH_TOSHIBA_RBTX4937; | 75 | mips_machtype = MACH_TOSHIBA_RBTX4937; |
| 76 | 76 | toshiba_name = "TX4937"; | |
| 77 | toshiba_name = toshiba_name_list[mips_machtype]; | 77 | } |
| 78 | 78 | ||
| 79 | msize = tx4927_get_mem_size(); | 79 | msize = tx4927_get_mem_size(); |
| 80 | add_memory_region(0, msize << 20, BOOT_MEM_RAM); | 80 | add_memory_region(0, msize << 20, BOOT_MEM_RAM); |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c index 990fcb294bab..2ad6401d2af4 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | |||
| @@ -53,6 +53,8 @@ | |||
| 53 | #include <linux/interrupt.h> | 53 | #include <linux/interrupt.h> |
| 54 | #include <linux/pci.h> | 54 | #include <linux/pci.h> |
| 55 | #include <linux/timex.h> | 55 | #include <linux/timex.h> |
| 56 | #include <linux/pm.h> | ||
| 57 | |||
| 56 | #include <asm/bootinfo.h> | 58 | #include <asm/bootinfo.h> |
| 57 | #include <asm/page.h> | 59 | #include <asm/page.h> |
| 58 | #include <asm/io.h> | 60 | #include <asm/io.h> |
| @@ -537,19 +539,10 @@ void tx4927_pci_setup(void) | |||
| 537 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | 539 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, |
| 538 | "0x%08lx=mips_io_port_base", | 540 | "0x%08lx=mips_io_port_base", |
| 539 | mips_io_port_base); | 541 | mips_io_port_base); |
| 540 | |||
| 541 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | ||
| 542 | "setup pci_io_resource to 0x%08lx 0x%08lx\n", | ||
| 543 | pci_io_resource.start, | ||
| 544 | pci_io_resource.end); | ||
| 545 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | ||
| 546 | "setup pci_mem_resource to 0x%08lx 0x%08lx\n", | ||
| 547 | pci_mem_resource.start, | ||
| 548 | pci_mem_resource.end); | ||
| 549 | |||
| 550 | if (!called) { | 542 | if (!called) { |
| 551 | printk | 543 | printk |
| 552 | ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", | 544 | ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", |
| 545 | toshiba_name, | ||
| 553 | (unsigned short) (tx4927_pcicptr->pciid >> 16), | 546 | (unsigned short) (tx4927_pcicptr->pciid >> 16), |
| 554 | (unsigned short) (tx4927_pcicptr->pciid & 0xffff), | 547 | (unsigned short) (tx4927_pcicptr->pciid & 0xffff), |
| 555 | (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), | 548 | (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), |
| @@ -562,21 +555,52 @@ void tx4927_pci_setup(void) | |||
| 562 | (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); | 555 | (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); |
| 563 | if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { | 556 | if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { |
| 564 | int pciclk = 0; | 557 | int pciclk = 0; |
| 565 | switch ((unsigned long) tx4927_ccfgptr-> | 558 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) |
| 566 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | 559 | switch ((unsigned long) tx4927_ccfgptr-> |
| 567 | case TX4927_CCFG_PCIDIVMODE_2_5: | 560 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { |
| 568 | pciclk = tx4927_cpu_clock * 2 / 5; | 561 | case TX4937_CCFG_PCIDIVMODE_4: |
| 569 | break; | 562 | pciclk = tx4927_cpu_clock / 4; |
| 570 | case TX4927_CCFG_PCIDIVMODE_3: | 563 | break; |
| 571 | pciclk = tx4927_cpu_clock / 3; | 564 | case TX4937_CCFG_PCIDIVMODE_4_5: |
| 572 | break; | 565 | pciclk = tx4927_cpu_clock * 2 / 9; |
| 573 | case TX4927_CCFG_PCIDIVMODE_5: | 566 | break; |
| 574 | pciclk = tx4927_cpu_clock / 5; | 567 | case TX4937_CCFG_PCIDIVMODE_5: |
| 575 | break; | 568 | pciclk = tx4927_cpu_clock / 5; |
| 576 | case TX4927_CCFG_PCIDIVMODE_6: | 569 | break; |
| 577 | pciclk = tx4927_cpu_clock / 6; | 570 | case TX4937_CCFG_PCIDIVMODE_5_5: |
| 578 | break; | 571 | pciclk = tx4927_cpu_clock * 2 / 11; |
| 579 | } | 572 | break; |
| 573 | case TX4937_CCFG_PCIDIVMODE_8: | ||
| 574 | pciclk = tx4927_cpu_clock / 8; | ||
| 575 | break; | ||
| 576 | case TX4937_CCFG_PCIDIVMODE_9: | ||
| 577 | pciclk = tx4927_cpu_clock / 9; | ||
| 578 | break; | ||
| 579 | case TX4937_CCFG_PCIDIVMODE_10: | ||
| 580 | pciclk = tx4927_cpu_clock / 10; | ||
| 581 | break; | ||
| 582 | case TX4937_CCFG_PCIDIVMODE_11: | ||
| 583 | pciclk = tx4927_cpu_clock / 11; | ||
| 584 | break; | ||
| 585 | } | ||
| 586 | |||
| 587 | else | ||
| 588 | switch ((unsigned long) tx4927_ccfgptr-> | ||
| 589 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
| 590 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
| 591 | pciclk = tx4927_cpu_clock * 2 / 5; | ||
| 592 | break; | ||
| 593 | case TX4927_CCFG_PCIDIVMODE_3: | ||
| 594 | pciclk = tx4927_cpu_clock / 3; | ||
| 595 | break; | ||
| 596 | case TX4927_CCFG_PCIDIVMODE_5: | ||
| 597 | pciclk = tx4927_cpu_clock / 5; | ||
| 598 | break; | ||
| 599 | case TX4927_CCFG_PCIDIVMODE_6: | ||
| 600 | pciclk = tx4927_cpu_clock / 6; | ||
| 601 | break; | ||
| 602 | } | ||
| 603 | |||
| 580 | printk("Internal(%dMHz)", pciclk / 1000000); | 604 | printk("Internal(%dMHz)", pciclk / 1000000); |
| 581 | } else { | 605 | } else { |
| 582 | int pciclk = 0; | 606 | int pciclk = 0; |
| @@ -814,24 +838,40 @@ void __init toshiba_rbtx4927_setup(void) | |||
| 814 | ":ResetRoutines\n"); | 838 | ":ResetRoutines\n"); |
| 815 | _machine_restart = toshiba_rbtx4927_restart; | 839 | _machine_restart = toshiba_rbtx4927_restart; |
| 816 | _machine_halt = toshiba_rbtx4927_halt; | 840 | _machine_halt = toshiba_rbtx4927_halt; |
| 817 | _machine_power_off = toshiba_rbtx4927_power_off; | 841 | pm_power_off = toshiba_rbtx4927_power_off; |
| 818 | 842 | ||
| 819 | #ifdef CONFIG_PCI | 843 | #ifdef CONFIG_PCI |
| 820 | 844 | ||
| 821 | /* PCIC */ | 845 | /* PCIC */ |
| 822 | /* | 846 | /* |
| 823 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. | 847 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. |
| 824 | * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1). | 848 | * |
| 849 | * For TX4927: | ||
| 850 | * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). | ||
| 825 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) | 851 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) |
| 826 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) | 852 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) |
| 827 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) | 853 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) |
| 828 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) | 854 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) |
| 829 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) | 855 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) |
| 856 | * | ||
| 857 | * For TX4937: | ||
| 858 | * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) | ||
| 859 | * PCIDIVMODE[10] is 0. | ||
| 860 | * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) | ||
| 861 | * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) | ||
| 862 | * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) | ||
| 863 | * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) | ||
| 864 | * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) | ||
| 865 | * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) | ||
| 866 | * | ||
| 830 | */ | 867 | */ |
| 831 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 868 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, |
| 832 | "ccfg is %lx, DIV is %x\n", | 869 | "ccfg is %lx, PCIDIVMODE is %x\n", |
| 833 | (unsigned long) tx4927_ccfgptr-> | 870 | (unsigned long) tx4927_ccfgptr->ccfg, |
| 834 | ccfg, TX4927_CCFG_PCIDIVMODE_MASK); | 871 | (unsigned long) tx4927_ccfgptr->ccfg & |
| 872 | (mips_machtype == MACH_TOSHIBA_RBTX4937 ? | ||
| 873 | TX4937_CCFG_PCIDIVMODE_MASK : | ||
| 874 | TX4927_CCFG_PCIDIVMODE_MASK)); | ||
| 835 | 875 | ||
| 836 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 876 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, |
| 837 | "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", | 877 | "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", |
| @@ -842,20 +882,30 @@ void __init toshiba_rbtx4927_setup(void) | |||
| 842 | (unsigned long) tx4927_ccfgptr-> | 882 | (unsigned long) tx4927_ccfgptr-> |
| 843 | ccfg & TX4927_CCFG_PCIXARB); | 883 | ccfg & TX4927_CCFG_PCIXARB); |
| 844 | 884 | ||
| 845 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 885 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) |
| 846 | "PCIDIVMODE is %lx\n", | 886 | switch ((unsigned long)tx4927_ccfgptr-> |
| 847 | (unsigned long) tx4927_ccfgptr-> | 887 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { |
| 848 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK); | 888 | case TX4937_CCFG_PCIDIVMODE_8: |
| 849 | 889 | case TX4937_CCFG_PCIDIVMODE_4: | |
| 850 | switch ((unsigned long) tx4927_ccfgptr-> | 890 | tx4927_cpu_clock = 266666666; /* 266MHz */ |
| 851 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | 891 | break; |
| 852 | case TX4927_CCFG_PCIDIVMODE_2_5: | 892 | case TX4937_CCFG_PCIDIVMODE_9: |
| 853 | case TX4927_CCFG_PCIDIVMODE_5: | 893 | case TX4937_CCFG_PCIDIVMODE_4_5: |
| 854 | tx4927_cpu_clock = 166000000; /* 166MHz */ | 894 | tx4927_cpu_clock = 300000000; /* 300MHz */ |
| 855 | break; | 895 | break; |
| 856 | default: | 896 | default: |
| 857 | tx4927_cpu_clock = 200000000; /* 200MHz */ | 897 | tx4927_cpu_clock = 333333333; /* 333MHz */ |
| 858 | } | 898 | } |
| 899 | else | ||
| 900 | switch ((unsigned long)tx4927_ccfgptr-> | ||
| 901 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
| 902 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
| 903 | case TX4927_CCFG_PCIDIVMODE_5: | ||
| 904 | tx4927_cpu_clock = 166666666; /* 166MHz */ | ||
| 905 | break; | ||
| 906 | default: | ||
| 907 | tx4927_cpu_clock = 200000000; /* 200MHz */ | ||
| 908 | } | ||
| 859 | 909 | ||
| 860 | /* CCFG */ | 910 | /* CCFG */ |
| 861 | /* enable Timeout BusError */ | 911 | /* enable Timeout BusError */ |
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c index 9f1dcc8ca5a3..5c7ace982a49 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/console.h> | 21 | #include <linux/console.h> |
| 22 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
| 23 | #include <linux/pm.h> | ||
| 24 | |||
| 23 | #include <asm/wbflush.h> | 25 | #include <asm/wbflush.h> |
| 24 | #include <asm/reboot.h> | 26 | #include <asm/reboot.h> |
| 25 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
| @@ -1003,7 +1005,7 @@ void __init toshiba_rbtx4938_setup(void) | |||
| 1003 | 1005 | ||
| 1004 | _machine_restart = rbtx4938_machine_restart; | 1006 | _machine_restart = rbtx4938_machine_restart; |
| 1005 | _machine_halt = rbtx4938_machine_halt; | 1007 | _machine_halt = rbtx4938_machine_halt; |
| 1006 | _machine_power_off = rbtx4938_machine_power_off; | 1008 | pm_power_off = rbtx4938_machine_power_off; |
| 1007 | 1009 | ||
| 1008 | *rbtx4938_led_ptr = 0xff; | 1010 | *rbtx4938_led_ptr = 0xff; |
| 1009 | printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr); | 1011 | printk("RBTX4938 --- FPGA(Rev %02x)", *rbtx4938_fpga_rev_ptr); |
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c index 02bf4f7d06ba..5e469796413f 100644 --- a/arch/mips/vr41xx/common/pmu.c +++ b/arch/mips/vr41xx/common/pmu.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/ioport.h> | 22 | #include <linux/ioport.h> |
| 23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
| 24 | #include <linux/pm.h> | ||
| 24 | #include <linux/smp.h> | 25 | #include <linux/smp.h> |
| 25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
| 26 | 27 | ||
| @@ -114,7 +115,7 @@ static int __init vr41xx_pmu_init(void) | |||
| 114 | 115 | ||
| 115 | _machine_restart = vr41xx_restart; | 116 | _machine_restart = vr41xx_restart; |
| 116 | _machine_halt = vr41xx_halt; | 117 | _machine_halt = vr41xx_halt; |
| 117 | _machine_power_off = vr41xx_power_off; | 118 | pm_power_off = vr41xx_power_off; |
| 118 | 119 | ||
| 119 | return 0; | 120 | return 0; |
| 120 | } | 121 | } |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index 29b4d61898f2..05273ccced0e 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
| @@ -468,19 +468,23 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) | |||
| 468 | if ( opcode == 1 ) { /* GETFSIND */ | 468 | if ( opcode == 1 ) { /* GETFSIND */ |
| 469 | len = strlen_user((char *)arg1); | 469 | len = strlen_user((char *)arg1); |
| 470 | printk(KERN_DEBUG "len of arg1 = %d\n", len); | 470 | printk(KERN_DEBUG "len of arg1 = %d\n", len); |
| 471 | 471 | if (len == 0) | |
| 472 | fsname = (char *) kmalloc(len+1, GFP_KERNEL); | 472 | return 0; |
| 473 | fsname = (char *) kmalloc(len, GFP_KERNEL); | ||
| 473 | if ( !fsname ) { | 474 | if ( !fsname ) { |
| 474 | printk(KERN_DEBUG "failed to kmalloc fsname\n"); | 475 | printk(KERN_DEBUG "failed to kmalloc fsname\n"); |
| 475 | return 0; | 476 | return 0; |
| 476 | } | 477 | } |
| 477 | 478 | ||
| 478 | if ( copy_from_user(fsname, (char *)arg1, len+1) ) { | 479 | if ( copy_from_user(fsname, (char *)arg1, len) ) { |
| 479 | printk(KERN_DEBUG "failed to copy_from_user fsname\n"); | 480 | printk(KERN_DEBUG "failed to copy_from_user fsname\n"); |
| 480 | kfree(fsname); | 481 | kfree(fsname); |
| 481 | return 0; | 482 | return 0; |
| 482 | } | 483 | } |
| 483 | 484 | ||
| 485 | /* String could be altered by userspace after strlen_user() */ | ||
| 486 | fsname[len] = '\0'; | ||
| 487 | |||
| 484 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); | 488 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); |
| 485 | if ( !strcmp(fsname, "hfs") ) { | 489 | if ( !strcmp(fsname, "hfs") ) { |
| 486 | fstype = 0; | 490 | fstype = 0; |
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 5d50d4a44abf..2f880cb167a5 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <termios.h> | 9 | #include <termios.h> |
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | #include <signal.h> | 11 | #include <signal.h> |
| 12 | #include <sched.h> | ||
| 12 | #include <sys/stat.h> | 13 | #include <sys/stat.h> |
| 13 | #include <sys/ioctl.h> | 14 | #include <sys/ioctl.h> |
| 14 | #include <sys/socket.h> | 15 | #include <sys/socket.h> |
| @@ -73,7 +74,6 @@ static void winch_handler(int sig) | |||
| 73 | struct winch_data { | 74 | struct winch_data { |
| 74 | int pty_fd; | 75 | int pty_fd; |
| 75 | int pipe_fd; | 76 | int pipe_fd; |
| 76 | int close_me; | ||
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | static int winch_thread(void *arg) | 79 | static int winch_thread(void *arg) |
| @@ -84,7 +84,6 @@ static int winch_thread(void *arg) | |||
| 84 | int count, err; | 84 | int count, err; |
| 85 | char c = 1; | 85 | char c = 1; |
| 86 | 86 | ||
| 87 | os_close_file(data->close_me); | ||
| 88 | pty_fd = data->pty_fd; | 87 | pty_fd = data->pty_fd; |
| 89 | pipe_fd = data->pipe_fd; | 88 | pipe_fd = data->pipe_fd; |
| 90 | count = os_write_file(pipe_fd, &c, sizeof(c)); | 89 | count = os_write_file(pipe_fd, &c, sizeof(c)); |
| @@ -153,15 +152,16 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out) | |||
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | data = ((struct winch_data) { .pty_fd = fd, | 154 | data = ((struct winch_data) { .pty_fd = fd, |
| 156 | .pipe_fd = fds[1], | 155 | .pipe_fd = fds[1] } ); |
| 157 | .close_me = fds[0] } ); | 156 | /* CLONE_FILES so this thread doesn't hold open files which are open |
| 158 | err = run_helper_thread(winch_thread, &data, 0, &stack, 0); | 157 | * now, but later closed. This is a problem with /dev/net/tun. |
| 158 | */ | ||
| 159 | err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0); | ||
| 159 | if(err < 0){ | 160 | if(err < 0){ |
| 160 | printk("fork of winch_thread failed - errno = %d\n", errno); | 161 | printk("fork of winch_thread failed - errno = %d\n", errno); |
| 161 | goto out_close; | 162 | goto out_close; |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 164 | os_close_file(fds[1]); | ||
| 165 | *fd_out = fds[0]; | 165 | *fd_out = fds[0]; |
| 166 | n = os_read_file(fds[0], &c, sizeof(c)); | 166 | n = os_read_file(fds[0], &c, sizeof(c)); |
| 167 | if(n != sizeof(c)){ | 167 | if(n != sizeof(c)){ |
| @@ -169,13 +169,12 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out) | |||
| 169 | printk("read failed, err = %d\n", -n); | 169 | printk("read failed, err = %d\n", -n); |
| 170 | printk("fd %d will not support SIGWINCH\n", fd); | 170 | printk("fd %d will not support SIGWINCH\n", fd); |
| 171 | err = -EINVAL; | 171 | err = -EINVAL; |
| 172 | goto out_close1; | 172 | goto out_close; |
| 173 | } | 173 | } |
| 174 | return err ; | 174 | return err ; |
| 175 | 175 | ||
| 176 | out_close: | 176 | out_close: |
| 177 | os_close_file(fds[1]); | 177 | os_close_file(fds[1]); |
| 178 | out_close1: | ||
| 179 | os_close_file(fds[0]); | 178 | os_close_file(fds[0]); |
| 180 | out: | 179 | out: |
| 181 | return err; | 180 | return err; |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 8ebb2241ad42..8c7279bb353b 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
| @@ -131,9 +131,8 @@ static int uml_net_open(struct net_device *dev) | |||
| 131 | SA_INTERRUPT | SA_SHIRQ, dev->name, dev); | 131 | SA_INTERRUPT | SA_SHIRQ, dev->name, dev); |
| 132 | if(err != 0){ | 132 | if(err != 0){ |
| 133 | printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); | 133 | printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); |
| 134 | if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); | ||
| 135 | lp->fd = -1; | ||
| 136 | err = -ENETUNREACH; | 134 | err = -ENETUNREACH; |
| 135 | goto out_close; | ||
| 137 | } | 136 | } |
| 138 | 137 | ||
| 139 | lp->tl.data = (unsigned long) &lp->user; | 138 | lp->tl.data = (unsigned long) &lp->user; |
| @@ -145,9 +144,19 @@ static int uml_net_open(struct net_device *dev) | |||
| 145 | */ | 144 | */ |
| 146 | while((err = uml_net_rx(dev)) > 0) ; | 145 | while((err = uml_net_rx(dev)) > 0) ; |
| 147 | 146 | ||
| 148 | out: | ||
| 149 | spin_unlock(&lp->lock); | 147 | spin_unlock(&lp->lock); |
| 150 | return(err); | 148 | |
| 149 | spin_lock(&opened_lock); | ||
| 150 | list_add(&lp->list, &opened); | ||
| 151 | spin_unlock(&opened_lock); | ||
| 152 | |||
| 153 | return 0; | ||
| 154 | out_close: | ||
| 155 | if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); | ||
| 156 | lp->fd = -1; | ||
| 157 | out: | ||
| 158 | spin_unlock(&lp->lock); | ||
| 159 | return err; | ||
| 151 | } | 160 | } |
| 152 | 161 | ||
| 153 | static int uml_net_close(struct net_device *dev) | 162 | static int uml_net_close(struct net_device *dev) |
| @@ -161,9 +170,13 @@ static int uml_net_close(struct net_device *dev) | |||
| 161 | if(lp->close != NULL) | 170 | if(lp->close != NULL) |
| 162 | (*lp->close)(lp->fd, &lp->user); | 171 | (*lp->close)(lp->fd, &lp->user); |
| 163 | lp->fd = -1; | 172 | lp->fd = -1; |
| 164 | list_del(&lp->list); | ||
| 165 | 173 | ||
| 166 | spin_unlock(&lp->lock); | 174 | spin_unlock(&lp->lock); |
| 175 | |||
| 176 | spin_lock(&opened_lock); | ||
| 177 | list_del(&lp->list); | ||
| 178 | spin_unlock(&opened_lock); | ||
| 179 | |||
| 167 | return 0; | 180 | return 0; |
| 168 | } | 181 | } |
| 169 | 182 | ||
| @@ -410,11 +423,7 @@ static int eth_configure(int n, void *init, char *mac, | |||
| 410 | if (device->have_mac) | 423 | if (device->have_mac) |
| 411 | set_ether_mac(dev, device->mac); | 424 | set_ether_mac(dev, device->mac); |
| 412 | 425 | ||
| 413 | spin_lock(&opened_lock); | 426 | return 0; |
| 414 | list_add(&lp->list, &opened); | ||
| 415 | spin_unlock(&opened_lock); | ||
| 416 | |||
| 417 | return(0); | ||
| 418 | } | 427 | } |
| 419 | 428 | ||
| 420 | static struct uml_net *find_device(int n) | 429 | static struct uml_net *find_device(int n) |
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h index 4892e5fcef07..83b688ca198f 100644 --- a/arch/um/include/registers.h +++ b/arch/um/include/registers.h | |||
| @@ -14,7 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs); | |||
| 14 | extern void save_registers(int pid, union uml_pt_regs *regs); | 14 | extern void save_registers(int pid, union uml_pt_regs *regs); |
| 15 | extern void restore_registers(int pid, union uml_pt_regs *regs); | 15 | extern void restore_registers(int pid, union uml_pt_regs *regs); |
| 16 | extern void init_registers(int pid); | 16 | extern void init_registers(int pid); |
| 17 | extern void get_safe_registers(unsigned long * regs); | 17 | extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs); |
| 18 | extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); | 18 | extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); |
| 19 | 19 | ||
| 20 | #endif | 20 | #endif |
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c deleted file mode 100644 index eea1c9c4bb0f..000000000000 --- a/arch/um/kernel/skas/process.c +++ /dev/null | |||
| @@ -1,569 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com) | ||
| 3 | * Licensed under the GPL | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdlib.h> | ||
| 7 | #include <string.h> | ||
| 8 | #include <unistd.h> | ||
| 9 | #include <errno.h> | ||
| 10 | #include <signal.h> | ||
| 11 | #include <setjmp.h> | ||
| 12 | #include <sched.h> | ||
| 13 | #include <sys/wait.h> | ||
| 14 | #include <sys/mman.h> | ||
| 15 | #include <sys/user.h> | ||
| 16 | #include <sys/time.h> | ||
| 17 | #include <asm/unistd.h> | ||
| 18 | #include <asm/types.h> | ||
| 19 | #include "user.h" | ||
| 20 | #include "ptrace_user.h" | ||
| 21 | #include "sysdep/ptrace.h" | ||
| 22 | #include "user_util.h" | ||
| 23 | #include "kern_util.h" | ||
| 24 | #include "skas.h" | ||
| 25 | #include "stub-data.h" | ||
| 26 | #include "mm_id.h" | ||
| 27 | #include "sysdep/sigcontext.h" | ||
| 28 | #include "sysdep/stub.h" | ||
| 29 | #include "os.h" | ||
| 30 | #include "proc_mm.h" | ||
| 31 | #include "skas_ptrace.h" | ||
| 32 | #include "chan_user.h" | ||
| 33 | #include "registers.h" | ||
| 34 | #include "mem.h" | ||
| 35 | #include "uml-config.h" | ||
| 36 | #include "process.h" | ||
| 37 | |||
| 38 | int is_skas_winch(int pid, int fd, void *data) | ||
| 39 | { | ||
| 40 | if(pid != os_getpgrp()) | ||
| 41 | return(0); | ||
| 42 | |||
| 43 | register_winch_irq(-1, fd, -1, data); | ||
| 44 | return(1); | ||
| 45 | } | ||
| 46 | |||
| 47 | void wait_stub_done(int pid, int sig, char * fname) | ||
| 48 | { | ||
| 49 | int n, status, err; | ||
| 50 | |||
| 51 | do { | ||
| 52 | if ( sig != -1 ) { | ||
| 53 | err = ptrace(PTRACE_CONT, pid, 0, sig); | ||
| 54 | if(err) | ||
| 55 | panic("%s : continue failed, errno = %d\n", | ||
| 56 | fname, errno); | ||
| 57 | } | ||
| 58 | sig = 0; | ||
| 59 | |||
| 60 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); | ||
| 61 | } while((n >= 0) && WIFSTOPPED(status) && | ||
| 62 | ((WSTOPSIG(status) == SIGVTALRM) || | ||
| 63 | /* running UML inside a detached screen can cause | ||
| 64 | * SIGWINCHes | ||
| 65 | */ | ||
| 66 | (WSTOPSIG(status) == SIGWINCH))); | ||
| 67 | |||
| 68 | if((n < 0) || !WIFSTOPPED(status) || | ||
| 69 | (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ | ||
| 70 | unsigned long regs[HOST_FRAME_SIZE]; | ||
| 71 | if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) | ||
| 72 | printk("Failed to get registers from stub, " | ||
| 73 | "errno = %d\n", errno); | ||
| 74 | else { | ||
| 75 | int i; | ||
| 76 | |||
| 77 | printk("Stub registers -\n"); | ||
| 78 | for(i = 0; i < HOST_FRAME_SIZE; i++) | ||
| 79 | printk("\t%d - %lx\n", i, regs[i]); | ||
| 80 | } | ||
| 81 | panic("%s : failed to wait for SIGUSR1/SIGTRAP, " | ||
| 82 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", | ||
| 83 | fname, pid, n, errno, status); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | void get_skas_faultinfo(int pid, struct faultinfo * fi) | ||
| 88 | { | ||
| 89 | int err; | ||
| 90 | |||
| 91 | if(ptrace_faultinfo){ | ||
| 92 | err = ptrace(PTRACE_FAULTINFO, pid, 0, fi); | ||
| 93 | if(err) | ||
| 94 | panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, " | ||
| 95 | "errno = %d\n", errno); | ||
| 96 | |||
| 97 | /* Special handling for i386, which has different structs */ | ||
| 98 | if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo)) | ||
| 99 | memset((char *)fi + sizeof(struct ptrace_faultinfo), 0, | ||
| 100 | sizeof(struct faultinfo) - | ||
| 101 | sizeof(struct ptrace_faultinfo)); | ||
| 102 | } | ||
| 103 | else { | ||
| 104 | wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo"); | ||
| 105 | |||
| 106 | /* faultinfo is prepared by the stub-segv-handler at start of | ||
| 107 | * the stub stack page. We just have to copy it. | ||
| 108 | */ | ||
| 109 | memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | static void handle_segv(int pid, union uml_pt_regs * regs) | ||
| 114 | { | ||
| 115 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | ||
| 116 | segv(regs->skas.faultinfo, 0, 1, NULL); | ||
| 117 | } | ||
| 118 | |||
| 119 | /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ | ||
| 120 | static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu) | ||
| 121 | { | ||
| 122 | int err, status; | ||
| 123 | |||
| 124 | /* Mark this as a syscall */ | ||
| 125 | UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs); | ||
| 126 | |||
| 127 | if (!local_using_sysemu) | ||
| 128 | { | ||
| 129 | err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); | ||
| 130 | if(err < 0) | ||
| 131 | panic("handle_trap - nullifying syscall failed errno = %d\n", | ||
| 132 | errno); | ||
| 133 | |||
| 134 | err = ptrace(PTRACE_SYSCALL, pid, 0, 0); | ||
| 135 | if(err < 0) | ||
| 136 | panic("handle_trap - continuing to end of syscall failed, " | ||
| 137 | "errno = %d\n", errno); | ||
| 138 | |||
| 139 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); | ||
| 140 | if((err < 0) || !WIFSTOPPED(status) || | ||
| 141 | (WSTOPSIG(status) != SIGTRAP + 0x80)) | ||
| 142 | panic("handle_trap - failed to wait at end of syscall, " | ||
| 143 | "errno = %d, status = %d\n", errno, status); | ||
| 144 | } | ||
| 145 | |||
| 146 | handle_syscall(regs); | ||
| 147 | } | ||
| 148 | |||
| 149 | extern int __syscall_stub_start; | ||
| 150 | int stub_code_fd = -1; | ||
| 151 | __u64 stub_code_offset; | ||
| 152 | |||
| 153 | static int userspace_tramp(void *stack) | ||
| 154 | { | ||
| 155 | void *addr; | ||
| 156 | |||
| 157 | ptrace(PTRACE_TRACEME, 0, 0, 0); | ||
| 158 | |||
| 159 | init_new_thread_signals(1); | ||
| 160 | enable_timer(); | ||
| 161 | |||
| 162 | if(!proc_mm){ | ||
| 163 | /* This has a pte, but it can't be mapped in with the usual | ||
| 164 | * tlb_flush mechanism because this is part of that mechanism | ||
| 165 | */ | ||
| 166 | addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(), | ||
| 167 | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, | ||
| 168 | stub_code_fd, stub_code_offset); | ||
| 169 | if(addr == MAP_FAILED){ | ||
| 170 | printk("mapping stub code failed, errno = %d\n", | ||
| 171 | errno); | ||
| 172 | exit(1); | ||
| 173 | } | ||
| 174 | |||
| 175 | if(stack != NULL){ | ||
| 176 | int fd; | ||
| 177 | __u64 offset; | ||
| 178 | |||
| 179 | fd = phys_mapping(to_phys(stack), &offset); | ||
| 180 | addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(), | ||
| 181 | PROT_READ | PROT_WRITE, | ||
| 182 | MAP_FIXED | MAP_SHARED, fd, offset); | ||
| 183 | if(addr == MAP_FAILED){ | ||
| 184 | printk("mapping stub stack failed, " | ||
| 185 | "errno = %d\n", errno); | ||
| 186 | exit(1); | ||
| 187 | } | ||
| 188 | } | ||
| 189 | } | ||
| 190 | if(!ptrace_faultinfo){ | ||
| 191 | unsigned long v = UML_CONFIG_STUB_CODE + | ||
| 192 | (unsigned long) stub_segv_handler - | ||
| 193 | (unsigned long) &__syscall_stub_start; | ||
| 194 | |||
| 195 | set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); | ||
| 196 | set_handler(SIGSEGV, (void *) v, SA_ONSTACK, | ||
| 197 | SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, | ||
| 198 | SIGUSR1, -1); | ||
| 199 | } | ||
| 200 | |||
| 201 | os_stop_process(os_getpid()); | ||
| 202 | return(0); | ||
| 203 | } | ||
| 204 | |||
| 205 | /* Each element set once, and only accessed by a single processor anyway */ | ||
| 206 | #undef NR_CPUS | ||
| 207 | #define NR_CPUS 1 | ||
| 208 | int userspace_pid[NR_CPUS]; | ||
| 209 | |||
| 210 | int start_userspace(unsigned long stub_stack) | ||
| 211 | { | ||
| 212 | void *stack; | ||
| 213 | unsigned long sp; | ||
| 214 | int pid, status, n, flags; | ||
| 215 | |||
| 216 | if ( stub_code_fd == -1 ) | ||
| 217 | stub_code_fd = phys_mapping(to_phys(&__syscall_stub_start), | ||
| 218 | &stub_code_offset); | ||
| 219 | |||
| 220 | stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, | ||
| 221 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | ||
| 222 | if(stack == MAP_FAILED) | ||
| 223 | panic("start_userspace : mmap failed, errno = %d", errno); | ||
| 224 | sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); | ||
| 225 | |||
| 226 | flags = CLONE_FILES | SIGCHLD; | ||
| 227 | if(proc_mm) flags |= CLONE_VM; | ||
| 228 | pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); | ||
| 229 | if(pid < 0) | ||
| 230 | panic("start_userspace : clone failed, errno = %d", errno); | ||
| 231 | |||
| 232 | do { | ||
| 233 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); | ||
| 234 | if(n < 0) | ||
| 235 | panic("start_userspace : wait failed, errno = %d", | ||
| 236 | errno); | ||
| 237 | } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM)); | ||
| 238 | |||
| 239 | if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) | ||
| 240 | panic("start_userspace : expected SIGSTOP, got status = %d", | ||
| 241 | status); | ||
| 242 | |||
| 243 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0) | ||
| 244 | panic("start_userspace : PTRACE_SETOPTIONS failed, errno=%d\n", | ||
| 245 | errno); | ||
| 246 | |||
| 247 | if(munmap(stack, PAGE_SIZE) < 0) | ||
| 248 | panic("start_userspace : munmap failed, errno = %d\n", errno); | ||
| 249 | |||
| 250 | return(pid); | ||
| 251 | } | ||
| 252 | |||
| 253 | void userspace(union uml_pt_regs *regs) | ||
| 254 | { | ||
| 255 | int err, status, op, pid = userspace_pid[0]; | ||
| 256 | int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/ | ||
| 257 | |||
| 258 | while(1){ | ||
| 259 | restore_registers(pid, regs); | ||
| 260 | |||
| 261 | /* Now we set local_using_sysemu to be used for one loop */ | ||
| 262 | local_using_sysemu = get_using_sysemu(); | ||
| 263 | |||
| 264 | op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL)); | ||
| 265 | |||
| 266 | err = ptrace(op, pid, 0, 0); | ||
| 267 | if(err) | ||
| 268 | panic("userspace - could not resume userspace process, " | ||
| 269 | "pid=%d, ptrace operation = %d, errno = %d\n", | ||
| 270 | op, errno); | ||
| 271 | |||
| 272 | CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); | ||
| 273 | if(err < 0) | ||
| 274 | panic("userspace - waitpid failed, errno = %d\n", | ||
| 275 | errno); | ||
| 276 | |||
| 277 | regs->skas.is_user = 1; | ||
| 278 | save_registers(pid, regs); | ||
| 279 | UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ | ||
| 280 | |||
| 281 | if(WIFSTOPPED(status)){ | ||
| 282 | switch(WSTOPSIG(status)){ | ||
| 283 | case SIGSEGV: | ||
| 284 | if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo) | ||
| 285 | user_signal(SIGSEGV, regs, pid); | ||
| 286 | else handle_segv(pid, regs); | ||
| 287 | break; | ||
| 288 | case SIGTRAP + 0x80: | ||
| 289 | handle_trap(pid, regs, local_using_sysemu); | ||
| 290 | break; | ||
| 291 | case SIGTRAP: | ||
| 292 | relay_signal(SIGTRAP, regs); | ||
| 293 | break; | ||
| 294 | case SIGIO: | ||
| 295 | case SIGVTALRM: | ||
| 296 | case SIGILL: | ||
| 297 | case SIGBUS: | ||
| 298 | case SIGFPE: | ||
| 299 | case SIGWINCH: | ||
| 300 | user_signal(WSTOPSIG(status), regs, pid); | ||
| 301 | break; | ||
| 302 | default: | ||
| 303 | printk("userspace - child stopped with signal " | ||
| 304 | "%d\n", WSTOPSIG(status)); | ||
| 305 | } | ||
| 306 | pid = userspace_pid[0]; | ||
| 307 | interrupt_end(); | ||
| 308 | |||
| 309 | /* Avoid -ERESTARTSYS handling in host */ | ||
| 310 | PT_SYSCALL_NR(regs->skas.regs) = -1; | ||
| 311 | } | ||
| 312 | } | ||
| 313 | } | ||
| 314 | #define INIT_JMP_NEW_THREAD 0 | ||
| 315 | #define INIT_JMP_REMOVE_SIGSTACK 1 | ||
| 316 | #define INIT_JMP_CALLBACK 2 | ||
| 317 | #define INIT_JMP_HALT 3 | ||
| 318 | #define INIT_JMP_REBOOT 4 | ||
| 319 | |||
| 320 | |||
| 321 | int copy_context_skas0(unsigned long new_stack, int pid) | ||
| 322 | { | ||
| 323 | int err; | ||
| 324 | unsigned long regs[MAX_REG_NR]; | ||
| 325 | unsigned long current_stack = current_stub_stack(); | ||
| 326 | struct stub_data *data = (struct stub_data *) current_stack; | ||
| 327 | struct stub_data *child_data = (struct stub_data *) new_stack; | ||
| 328 | __u64 new_offset; | ||
| 329 | int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset); | ||
| 330 | |||
| 331 | /* prepare offset and fd of child's stack as argument for parent's | ||
| 332 | * and child's mmap2 calls | ||
| 333 | */ | ||
| 334 | *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset), | ||
| 335 | .fd = new_fd, | ||
| 336 | .timer = ((struct itimerval) | ||
| 337 | { { 0, 1000000 / hz() }, | ||
| 338 | { 0, 1000000 / hz() }})}); | ||
| 339 | get_safe_registers(regs); | ||
| 340 | |||
| 341 | /* Set parent's instruction pointer to start of clone-stub */ | ||
| 342 | regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + | ||
| 343 | (unsigned long) stub_clone_handler - | ||
| 344 | (unsigned long) &__syscall_stub_start; | ||
| 345 | regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE - | ||
| 346 | sizeof(void *); | ||
| 347 | err = ptrace_setregs(pid, regs); | ||
| 348 | if(err < 0) | ||
| 349 | panic("copy_context_skas0 : PTRACE_SETREGS failed, " | ||
| 350 | "pid = %d, errno = %d\n", pid, errno); | ||
| 351 | |||
| 352 | /* set a well known return code for detection of child write failure */ | ||
| 353 | child_data->err = 12345678; | ||
| 354 | |||
| 355 | /* Wait, until parent has finished its work: read child's pid from | ||
| 356 | * parent's stack, and check, if bad result. | ||
| 357 | */ | ||
| 358 | wait_stub_done(pid, 0, "copy_context_skas0"); | ||
| 359 | |||
| 360 | pid = data->err; | ||
| 361 | if(pid < 0) | ||
| 362 | panic("copy_context_skas0 - stub-parent reports error %d\n", | ||
| 363 | pid); | ||
| 364 | |||
| 365 | /* Wait, until child has finished too: read child's result from | ||
| 366 | * child's stack and check it. | ||
| 367 | */ | ||
| 368 | wait_stub_done(pid, -1, "copy_context_skas0"); | ||
| 369 | if (child_data->err != UML_CONFIG_STUB_DATA) | ||
| 370 | panic("copy_context_skas0 - stub-child reports error %d\n", | ||
| 371 | child_data->err); | ||
| 372 | |||
| 373 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, | ||
| 374 | (void *)PTRACE_O_TRACESYSGOOD) < 0) | ||
| 375 | panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, " | ||
| 376 | "errno = %d\n", errno); | ||
| 377 | |||
| 378 | return pid; | ||
| 379 | } | ||
| 380 | |||
| 381 | /* | ||
| 382 | * This is used only, if stub pages are needed, while proc_mm is | ||
| 383 | * availabl. Opening /proc/mm creates a new mm_context, which lacks | ||
| 384 | * the stub-pages. Thus, we map them using /proc/mm-fd | ||
| 385 | */ | ||
| 386 | void map_stub_pages(int fd, unsigned long code, | ||
| 387 | unsigned long data, unsigned long stack) | ||
| 388 | { | ||
| 389 | struct proc_mm_op mmop; | ||
| 390 | int n; | ||
| 391 | |||
| 392 | mmop = ((struct proc_mm_op) { .op = MM_MMAP, | ||
| 393 | .u = | ||
| 394 | { .mmap = | ||
| 395 | { .addr = code, | ||
| 396 | .len = PAGE_SIZE, | ||
| 397 | .prot = PROT_EXEC, | ||
| 398 | .flags = MAP_FIXED | MAP_PRIVATE, | ||
| 399 | .fd = stub_code_fd, | ||
| 400 | .offset = stub_code_offset | ||
| 401 | } } }); | ||
| 402 | n = os_write_file(fd, &mmop, sizeof(mmop)); | ||
| 403 | if(n != sizeof(mmop)) | ||
| 404 | panic("map_stub_pages : /proc/mm map for code failed, " | ||
| 405 | "err = %d\n", -n); | ||
| 406 | |||
| 407 | if ( stack ) { | ||
| 408 | __u64 map_offset; | ||
| 409 | int map_fd = phys_mapping(to_phys((void *)stack), &map_offset); | ||
| 410 | mmop = ((struct proc_mm_op) | ||
| 411 | { .op = MM_MMAP, | ||
| 412 | .u = | ||
| 413 | { .mmap = | ||
| 414 | { .addr = data, | ||
| 415 | .len = PAGE_SIZE, | ||
| 416 | .prot = PROT_READ | PROT_WRITE, | ||
| 417 | .flags = MAP_FIXED | MAP_SHARED, | ||
| 418 | .fd = map_fd, | ||
| 419 | .offset = map_offset | ||
| 420 | } } }); | ||
| 421 | n = os_write_file(fd, &mmop, sizeof(mmop)); | ||
| 422 | if(n != sizeof(mmop)) | ||
| 423 | panic("map_stub_pages : /proc/mm map for data failed, " | ||
| 424 | "err = %d\n", -n); | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | ||
| 429 | void (*handler)(int)) | ||
| 430 | { | ||
| 431 | unsigned long flags; | ||
| 432 | sigjmp_buf switch_buf, fork_buf; | ||
| 433 | |||
| 434 | *switch_buf_ptr = &switch_buf; | ||
| 435 | *fork_buf_ptr = &fork_buf; | ||
| 436 | |||
| 437 | /* Somewhat subtle - siglongjmp restores the signal mask before doing | ||
| 438 | * the longjmp. This means that when jumping from one stack to another | ||
| 439 | * when the target stack has interrupts enabled, an interrupt may occur | ||
| 440 | * on the source stack. This is bad when starting up a process because | ||
| 441 | * it's not supposed to get timer ticks until it has been scheduled. | ||
| 442 | * So, we disable interrupts around the sigsetjmp to ensure that | ||
| 443 | * they can't happen until we get back here where they are safe. | ||
| 444 | */ | ||
| 445 | flags = get_signals(); | ||
| 446 | block_signals(); | ||
| 447 | if(sigsetjmp(fork_buf, 1) == 0) | ||
| 448 | new_thread_proc(stack, handler); | ||
| 449 | |||
| 450 | remove_sigstack(); | ||
| 451 | |||
| 452 | set_signals(flags); | ||
| 453 | } | ||
| 454 | |||
| 455 | void thread_wait(void *sw, void *fb) | ||
| 456 | { | ||
| 457 | sigjmp_buf buf, **switch_buf = sw, *fork_buf; | ||
| 458 | |||
| 459 | *switch_buf = &buf; | ||
| 460 | fork_buf = fb; | ||
| 461 | if(sigsetjmp(buf, 1) == 0) | ||
| 462 | siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); | ||
| 463 | } | ||
| 464 | |||
| 465 | void switch_threads(void *me, void *next) | ||
| 466 | { | ||
| 467 | sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; | ||
| 468 | |||
| 469 | *me_ptr = &my_buf; | ||
| 470 | if(sigsetjmp(my_buf, 1) == 0) | ||
| 471 | siglongjmp(*next_buf, 1); | ||
| 472 | } | ||
| 473 | |||
| 474 | static sigjmp_buf initial_jmpbuf; | ||
| 475 | |||
| 476 | /* XXX Make these percpu */ | ||
| 477 | static void (*cb_proc)(void *arg); | ||
| 478 | static void *cb_arg; | ||
| 479 | static sigjmp_buf *cb_back; | ||
| 480 | |||
| 481 | int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) | ||
| 482 | { | ||
| 483 | sigjmp_buf **switch_buf = switch_buf_ptr; | ||
| 484 | int n; | ||
| 485 | |||
| 486 | set_handler(SIGWINCH, (__sighandler_t) sig_handler, | ||
| 487 | SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, | ||
| 488 | SIGVTALRM, -1); | ||
| 489 | |||
| 490 | *fork_buf_ptr = &initial_jmpbuf; | ||
| 491 | n = sigsetjmp(initial_jmpbuf, 1); | ||
| 492 | switch(n){ | ||
| 493 | case INIT_JMP_NEW_THREAD: | ||
| 494 | new_thread_proc((void *) stack, new_thread_handler); | ||
| 495 | break; | ||
| 496 | case INIT_JMP_REMOVE_SIGSTACK: | ||
| 497 | remove_sigstack(); | ||
| 498 | break; | ||
| 499 | case INIT_JMP_CALLBACK: | ||
| 500 | (*cb_proc)(cb_arg); | ||
| 501 | siglongjmp(*cb_back, 1); | ||
| 502 | break; | ||
| 503 | case INIT_JMP_HALT: | ||
| 504 | kmalloc_ok = 0; | ||
| 505 | return(0); | ||
| 506 | case INIT_JMP_REBOOT: | ||
| 507 | kmalloc_ok = 0; | ||
| 508 | return(1); | ||
| 509 | default: | ||
| 510 | panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); | ||
| 511 | } | ||
| 512 | siglongjmp(**switch_buf, 1); | ||
| 513 | } | ||
| 514 | |||
| 515 | void initial_thread_cb_skas(void (*proc)(void *), void *arg) | ||
| 516 | { | ||
| 517 | sigjmp_buf here; | ||
| 518 | |||
| 519 | cb_proc = proc; | ||
| 520 | cb_arg = arg; | ||
| 521 | cb_back = &here; | ||
| 522 | |||
| 523 | block_signals(); | ||
| 524 | if(sigsetjmp(here, 1) == 0) | ||
| 525 | siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK); | ||
| 526 | unblock_signals(); | ||
| 527 | |||
| 528 | cb_proc = NULL; | ||
| 529 | cb_arg = NULL; | ||
| 530 | cb_back = NULL; | ||
| 531 | } | ||
| 532 | |||
| 533 | void halt_skas(void) | ||
| 534 | { | ||
| 535 | block_signals(); | ||
| 536 | siglongjmp(initial_jmpbuf, INIT_JMP_HALT); | ||
| 537 | } | ||
| 538 | |||
| 539 | void reboot_skas(void) | ||
| 540 | { | ||
| 541 | block_signals(); | ||
| 542 | siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT); | ||
| 543 | } | ||
| 544 | |||
| 545 | void switch_mm_skas(struct mm_id *mm_idp) | ||
| 546 | { | ||
| 547 | int err; | ||
| 548 | |||
| 549 | #warning need cpu pid in switch_mm_skas | ||
| 550 | if(proc_mm){ | ||
| 551 | err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, | ||
| 552 | mm_idp->u.mm_fd); | ||
| 553 | if(err) | ||
| 554 | panic("switch_mm_skas - PTRACE_SWITCH_MM failed, " | ||
| 555 | "errno = %d\n", errno); | ||
| 556 | } | ||
| 557 | else userspace_pid[0] = mm_idp->u.pid; | ||
| 558 | } | ||
| 559 | |||
| 560 | /* | ||
| 561 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
| 562 | * Emacs will notice this stuff at the end of the file and automatically | ||
| 563 | * adjust the settings for this buffer only. This must remain at the end | ||
| 564 | * of the file. | ||
| 565 | * --------------------------------------------------------------------------- | ||
| 566 | * Local variables: | ||
| 567 | * c-file-style: "linux" | ||
| 568 | * End: | ||
| 569 | */ | ||
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index e2d3ca445ef5..27cdf9164422 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
| @@ -193,6 +193,24 @@ __uml_setup("root=", uml_root_setup, | |||
| 193 | " root=/dev/ubd5\n\n" | 193 | " root=/dev/ubd5\n\n" |
| 194 | ); | 194 | ); |
| 195 | 195 | ||
| 196 | #ifndef CONFIG_MODE_TT | ||
| 197 | |||
| 198 | static int __init no_skas_debug_setup(char *line, int *add) | ||
| 199 | { | ||
| 200 | printf("'debug' is not necessary to gdb UML in skas mode - run \n"); | ||
| 201 | printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n"); | ||
| 202 | printf("doesn't work as expected\n"); | ||
| 203 | |||
| 204 | return 0; | ||
| 205 | } | ||
| 206 | |||
| 207 | __uml_setup("debug", no_skas_debug_setup, | ||
| 208 | "debug\n" | ||
| 209 | " this flag is not needed to run gdb on UML in skas mode\n\n" | ||
| 210 | ); | ||
| 211 | |||
| 212 | #endif | ||
| 213 | |||
| 196 | #ifdef CONFIG_SMP | 214 | #ifdef CONFIG_SMP |
| 197 | static int __init uml_ncpus_setup(char *line, int *add) | 215 | static int __init uml_ncpus_setup(char *line, int *add) |
| 198 | { | 216 | { |
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c index 52945338b64d..87c3aa0252db 100644 --- a/arch/um/os-Linux/drivers/tuntap_user.c +++ b/arch/um/os-Linux/drivers/tuntap_user.c | |||
| @@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote, | |||
| 122 | return(-EINVAL); | 122 | return(-EINVAL); |
| 123 | } | 123 | } |
| 124 | *fd_out = ((int *) CMSG_DATA(cmsg))[0]; | 124 | *fd_out = ((int *) CMSG_DATA(cmsg))[0]; |
| 125 | os_set_exec_close(*fd_out, 1); | ||
| 125 | return(0); | 126 | return(0); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| @@ -137,7 +138,8 @@ static int tuntap_open(void *data) | |||
| 137 | return(err); | 138 | return(err); |
| 138 | 139 | ||
| 139 | if(pri->fixed_config){ | 140 | if(pri->fixed_config){ |
| 140 | pri->fd = os_open_file("/dev/net/tun", of_rdwr(OPENFLAGS()), 0); | 141 | pri->fd = os_open_file("/dev/net/tun", |
| 142 | of_cloexec(of_rdwr(OPENFLAGS())), 0); | ||
| 141 | if(pri->fd < 0){ | 143 | if(pri->fd < 0){ |
| 142 | printk("Failed to open /dev/net/tun, err = %d\n", | 144 | printk("Failed to open /dev/net/tun, err = %d\n", |
| 143 | -pri->fd); | 145 | -pri->fd); |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index 9890e9090f58..fbb080c2fc26 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
| @@ -60,7 +60,7 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | |||
| 60 | 60 | ||
| 61 | multi_count++; | 61 | multi_count++; |
| 62 | 62 | ||
| 63 | get_safe_registers(regs); | 63 | get_safe_registers(regs, NULL); |
| 64 | regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + | 64 | regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + |
| 65 | ((unsigned long) &batch_syscall_stub - | 65 | ((unsigned long) &batch_syscall_stub - |
| 66 | (unsigned long) &__syscall_stub_start); | 66 | (unsigned long) &__syscall_stub_start); |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 120a21c5883f..bbf34cb91ce1 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
| @@ -310,16 +310,12 @@ void userspace(union uml_pt_regs *regs) | |||
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | } | 312 | } |
| 313 | #define INIT_JMP_NEW_THREAD 0 | ||
| 314 | #define INIT_JMP_REMOVE_SIGSTACK 1 | ||
| 315 | #define INIT_JMP_CALLBACK 2 | ||
| 316 | #define INIT_JMP_HALT 3 | ||
| 317 | #define INIT_JMP_REBOOT 4 | ||
| 318 | 313 | ||
| 319 | int copy_context_skas0(unsigned long new_stack, int pid) | 314 | int copy_context_skas0(unsigned long new_stack, int pid) |
| 320 | { | 315 | { |
| 321 | int err; | 316 | int err; |
| 322 | unsigned long regs[MAX_REG_NR]; | 317 | unsigned long regs[HOST_FRAME_SIZE]; |
| 318 | unsigned long fp_regs[HOST_FP_SIZE]; | ||
| 323 | unsigned long current_stack = current_stub_stack(); | 319 | unsigned long current_stack = current_stub_stack(); |
| 324 | struct stub_data *data = (struct stub_data *) current_stack; | 320 | struct stub_data *data = (struct stub_data *) current_stack; |
| 325 | struct stub_data *child_data = (struct stub_data *) new_stack; | 321 | struct stub_data *child_data = (struct stub_data *) new_stack; |
| @@ -334,7 +330,7 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
| 334 | .timer = ((struct itimerval) | 330 | .timer = ((struct itimerval) |
| 335 | { { 0, 1000000 / hz() }, | 331 | { { 0, 1000000 / hz() }, |
| 336 | { 0, 1000000 / hz() }})}); | 332 | { 0, 1000000 / hz() }})}); |
| 337 | get_safe_registers(regs); | 333 | get_safe_registers(regs, fp_regs); |
| 338 | 334 | ||
| 339 | /* Set parent's instruction pointer to start of clone-stub */ | 335 | /* Set parent's instruction pointer to start of clone-stub */ |
| 340 | regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + | 336 | regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + |
| @@ -350,6 +346,11 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
| 350 | panic("copy_context_skas0 : PTRACE_SETREGS failed, " | 346 | panic("copy_context_skas0 : PTRACE_SETREGS failed, " |
| 351 | "pid = %d, errno = %d\n", pid, errno); | 347 | "pid = %d, errno = %d\n", pid, errno); |
| 352 | 348 | ||
| 349 | err = ptrace_setfpregs(pid, fp_regs); | ||
| 350 | if(err < 0) | ||
| 351 | panic("copy_context_skas0 : PTRACE_SETFPREGS failed, " | ||
| 352 | "pid = %d, errno = %d\n", pid, errno); | ||
| 353 | |||
| 353 | /* set a well known return code for detection of child write failure */ | 354 | /* set a well known return code for detection of child write failure */ |
| 354 | child_data->err = 12345678; | 355 | child_data->err = 12345678; |
| 355 | 356 | ||
| @@ -457,6 +458,12 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, | |||
| 457 | set_signals(flags); | 458 | set_signals(flags); |
| 458 | } | 459 | } |
| 459 | 460 | ||
| 461 | #define INIT_JMP_NEW_THREAD 0 | ||
| 462 | #define INIT_JMP_REMOVE_SIGSTACK 1 | ||
| 463 | #define INIT_JMP_CALLBACK 2 | ||
| 464 | #define INIT_JMP_HALT 3 | ||
| 465 | #define INIT_JMP_REBOOT 4 | ||
| 466 | |||
| 460 | void thread_wait(void *sw, void *fb) | 467 | void thread_wait(void *sw, void *fb) |
| 461 | { | 468 | { |
| 462 | sigjmp_buf buf, **switch_buf = sw, *fork_buf; | 469 | sigjmp_buf buf, **switch_buf = sw, *fork_buf; |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 6c5b17ed59e1..829d6b0d8b02 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
| @@ -49,6 +49,7 @@ static int ptrace_child(void *arg) | |||
| 49 | int pid = os_getpid(), ppid = getppid(); | 49 | int pid = os_getpid(), ppid = getppid(); |
| 50 | int sc_result; | 50 | int sc_result; |
| 51 | 51 | ||
| 52 | change_sig(SIGWINCH, 0); | ||
| 52 | if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ | 53 | if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ |
| 53 | perror("ptrace"); | 54 | perror("ptrace"); |
| 54 | os_kill_process(pid, 0); | 55 | os_kill_process(pid, 0); |
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index aee4812333c6..7a6f6b99ceff 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c | |||
| @@ -122,9 +122,12 @@ void init_registers(int pid) | |||
| 122 | err); | 122 | err); |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | void get_safe_registers(unsigned long *regs) | 125 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) |
| 126 | { | 126 | { |
| 127 | memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); | 127 | memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); |
| 128 | if(fp_regs != NULL) | ||
| 129 | memcpy(fp_regs, exec_fp_regs, | ||
| 130 | HOST_FP_SIZE * sizeof(unsigned long)); | ||
| 128 | } | 131 | } |
| 129 | 132 | ||
| 130 | void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) | 133 | void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) |
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c index 4b638dfb52b0..001941fa1a1e 100644 --- a/arch/um/os-Linux/sys-x86_64/registers.c +++ b/arch/um/os-Linux/sys-x86_64/registers.c | |||
| @@ -70,9 +70,12 @@ void init_registers(int pid) | |||
| 70 | err); | 70 | err); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | void get_safe_registers(unsigned long *regs) | 73 | void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) |
| 74 | { | 74 | { |
| 75 | memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); | 75 | memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); |
| 76 | if(fp_regs != NULL) | ||
| 77 | memcpy(fp_regs, exec_fp_regs, | ||
| 78 | HOST_FP_SIZE * sizeof(unsigned long)); | ||
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) | 81 | void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) |
diff --git a/arch/um/sys-x86_64/ptrace_user.c b/arch/um/sys-x86_64/ptrace_user.c index 12e404c6fa46..b5f9c33e311e 100644 --- a/arch/um/sys-x86_64/ptrace_user.c +++ b/arch/um/sys-x86_64/ptrace_user.c | |||
| @@ -24,6 +24,13 @@ int ptrace_setregs(long pid, unsigned long *regs) | |||
| 24 | return(0); | 24 | return(0); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | int ptrace_setfpregs(long pid, unsigned long *regs) | ||
| 28 | { | ||
| 29 | if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0) | ||
| 30 | return -errno; | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | |||
| 27 | void ptrace_pokeuser(unsigned long addr, unsigned long data) | 34 | void ptrace_pokeuser(unsigned long addr, unsigned long data) |
| 28 | { | 35 | { |
| 29 | panic("ptrace_pokeuser"); | 36 | panic("ptrace_pokeuser"); |
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c index 5a585bfbb8c2..7bd54a921cf7 100644 --- a/arch/um/sys-x86_64/user-offsets.c +++ b/arch/um/sys-x86_64/user-offsets.c | |||
| @@ -57,7 +57,7 @@ void foo(void) | |||
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); | 59 | DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); |
| 60 | DEFINE(HOST_FP_SIZE, 0); | 60 | DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); |
| 61 | DEFINE(HOST_XFP_SIZE, 0); | 61 | DEFINE(HOST_XFP_SIZE, 0); |
| 62 | DEFINE_LONGS(HOST_RBX, RBX); | 62 | DEFINE_LONGS(HOST_RBX, RBX); |
| 63 | DEFINE_LONGS(HOST_RCX, RCX); | 63 | DEFINE_LONGS(HOST_RCX, RCX); |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index a28756ef7cef..67e4e28f4df8 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <asm/nmi.h> | 59 | #include <asm/nmi.h> |
| 60 | #include <asm/irq.h> | 60 | #include <asm/irq.h> |
| 61 | #include <asm/hw_irq.h> | 61 | #include <asm/hw_irq.h> |
| 62 | #include <asm/numa.h> | ||
| 62 | 63 | ||
| 63 | /* Number of siblings per CPU package */ | 64 | /* Number of siblings per CPU package */ |
| 64 | int smp_num_siblings = 1; | 65 | int smp_num_siblings = 1; |
| @@ -890,6 +891,7 @@ do_rest: | |||
| 890 | if (boot_error) { | 891 | if (boot_error) { |
| 891 | cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */ | 892 | cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */ |
| 892 | clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ | 893 | clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ |
| 894 | clear_node_cpumask(cpu); /* was set by numa_add_cpu */ | ||
| 893 | cpu_clear(cpu, cpu_present_map); | 895 | cpu_clear(cpu, cpu_present_map); |
| 894 | cpu_clear(cpu, cpu_possible_map); | 896 | cpu_clear(cpu, cpu_possible_map); |
| 895 | x86_cpu_to_apicid[cpu] = BAD_APICID; | 897 | x86_cpu_to_apicid[cpu] = BAD_APICID; |
| @@ -1187,6 +1189,7 @@ void remove_cpu_from_maps(void) | |||
| 1187 | cpu_clear(cpu, cpu_callout_map); | 1189 | cpu_clear(cpu, cpu_callout_map); |
| 1188 | cpu_clear(cpu, cpu_callin_map); | 1190 | cpu_clear(cpu, cpu_callin_map); |
| 1189 | clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ | 1191 | clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ |
| 1192 | clear_node_cpumask(cpu); | ||
| 1190 | } | 1193 | } |
| 1191 | 1194 | ||
| 1192 | int __cpu_disable(void) | 1195 | int __cpu_disable(void) |
diff --git a/drivers/Makefile b/drivers/Makefile index 619dd964c51c..5c69b86db624 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
| @@ -69,7 +69,7 @@ obj-$(CONFIG_EISA) += eisa/ | |||
| 69 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | 69 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
| 70 | obj-$(CONFIG_MMC) += mmc/ | 70 | obj-$(CONFIG_MMC) += mmc/ |
| 71 | obj-$(CONFIG_INFINIBAND) += infiniband/ | 71 | obj-$(CONFIG_INFINIBAND) += infiniband/ |
| 72 | obj-$(CONFIG_SGI_IOC4) += sn/ | 72 | obj-$(CONFIG_SGI_SN) += sn/ |
| 73 | obj-y += firmware/ | 73 | obj-y += firmware/ |
| 74 | obj-$(CONFIG_CRYPTO) += crypto/ | 74 | obj-$(CONFIG_CRYPTO) += crypto/ |
| 75 | obj-$(CONFIG_SUPERH) += sh/ | 75 | obj-$(CONFIG_SUPERH) += sh/ |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 29f6af554e71..c3141565d59d 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -133,6 +133,8 @@ static struct kobj_type ktype_bus = { | |||
| 133 | decl_subsys(bus, &ktype_bus, NULL); | 133 | decl_subsys(bus, &ktype_bus, NULL); |
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | #ifdef CONFIG_HOTPLUG | ||
| 137 | |||
| 136 | /* Manually detach a device from its associated driver. */ | 138 | /* Manually detach a device from its associated driver. */ |
| 137 | static int driver_helper(struct device *dev, void *data) | 139 | static int driver_helper(struct device *dev, void *data) |
| 138 | { | 140 | { |
| @@ -193,6 +195,7 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
| 193 | } | 195 | } |
| 194 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); | 196 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); |
| 195 | 197 | ||
| 198 | #endif | ||
| 196 | 199 | ||
| 197 | static struct device * next_device(struct klist_iter * i) | 200 | static struct device * next_device(struct klist_iter * i) |
| 198 | { | 201 | { |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 12d7b9bdfa93..0d65394707db 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -2183,6 +2183,7 @@ static void cciss_softirq_done(struct request *rq) | |||
| 2183 | { | 2183 | { |
| 2184 | CommandList_struct *cmd = rq->completion_data; | 2184 | CommandList_struct *cmd = rq->completion_data; |
| 2185 | ctlr_info_t *h = hba[cmd->ctlr]; | 2185 | ctlr_info_t *h = hba[cmd->ctlr]; |
| 2186 | unsigned long flags; | ||
| 2186 | u64bit temp64; | 2187 | u64bit temp64; |
| 2187 | int i, ddir; | 2188 | int i, ddir; |
| 2188 | 2189 | ||
| @@ -2205,10 +2206,10 @@ static void cciss_softirq_done(struct request *rq) | |||
| 2205 | printk("Done with %p\n", rq); | 2206 | printk("Done with %p\n", rq); |
| 2206 | #endif /* CCISS_DEBUG */ | 2207 | #endif /* CCISS_DEBUG */ |
| 2207 | 2208 | ||
| 2208 | spin_lock_irq(&h->lock); | 2209 | spin_lock_irqsave(&h->lock, flags); |
| 2209 | end_that_request_last(rq, rq->errors); | 2210 | end_that_request_last(rq, rq->errors); |
| 2210 | cmd_free(h, cmd,1); | 2211 | cmd_free(h, cmd,1); |
| 2211 | spin_unlock_irq(&h->lock); | 2212 | spin_unlock_irqrestore(&h->lock, flags); |
| 2212 | } | 2213 | } |
| 2213 | 2214 | ||
| 2214 | /* checks the status of the job and calls complete buffers to mark all | 2215 | /* checks the status of the job and calls complete buffers to mark all |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6c60a9d2afd8..09086b8b6486 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
| @@ -190,7 +190,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
| 190 | if (lba48) { | 190 | if (lba48) { |
| 191 | task_ioreg_t tasklets[10]; | 191 | task_ioreg_t tasklets[10]; |
| 192 | 192 | ||
| 193 | pr_debug("%s: LBA=0x%012llx\n", drive->name, block); | 193 | pr_debug("%s: LBA=0x%012llx\n", drive->name, |
| 194 | (unsigned long long)block); | ||
| 194 | 195 | ||
| 195 | tasklets[0] = 0; | 196 | tasklets[0] = 0; |
| 196 | tasklets[1] = 0; | 197 | tasklets[1] = 0; |
| @@ -317,7 +318,8 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s | |||
| 317 | 318 | ||
| 318 | pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", | 319 | pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", |
| 319 | drive->name, rq_data_dir(rq) == READ ? "read" : "writ", | 320 | drive->name, rq_data_dir(rq) == READ ? "read" : "writ", |
| 320 | block, rq->nr_sectors, (unsigned long)rq->buffer); | 321 | (unsigned long long)block, rq->nr_sectors, |
| 322 | (unsigned long)rq->buffer); | ||
| 321 | 323 | ||
| 322 | if (hwif->rw_disk) | 324 | if (hwif->rw_disk) |
| 323 | hwif->rw_disk(drive, rq); | 325 | hwif->rw_disk(drive, rq); |
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 2583a865a58e..2963605c0ecc 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
| @@ -4,7 +4,7 @@ config DVB_B2C2_FLEXCOP | |||
| 4 | select DVB_STV0299 | 4 | select DVB_STV0299 |
| 5 | select DVB_MT352 | 5 | select DVB_MT352 |
| 6 | select DVB_MT312 | 6 | select DVB_MT312 |
| 7 | select DVB_NXT2002 | 7 | select DVB_NXT200X |
| 8 | select DVB_STV0297 | 8 | select DVB_STV0297 |
| 9 | select DVB_BCM3510 | 9 | select DVB_BCM3510 |
| 10 | select DVB_LGDT330X | 10 | select DVB_LGDT330X |
diff --git a/drivers/media/dvb/b2c2/flexcop-common.h b/drivers/media/dvb/b2c2/flexcop-common.h index 344a3c898460..7d7e1613c5a7 100644 --- a/drivers/media/dvb/b2c2/flexcop-common.h +++ b/drivers/media/dvb/b2c2/flexcop-common.h | |||
| @@ -116,11 +116,9 @@ void flexcop_dma_free(struct flexcop_dma *dma); | |||
| 116 | 116 | ||
| 117 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | 117 | int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); |
| 118 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | 118 | int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); |
| 119 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); | ||
| 120 | int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx); | 119 | int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx); |
| 121 | int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff); | 120 | int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff); |
| 122 | int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); | 121 | int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); |
| 123 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 packets); | ||
| 124 | 122 | ||
| 125 | /* from flexcop-eeprom.c */ | 123 | /* from flexcop-eeprom.c */ |
| 126 | /* the PCI part uses this call to get the MAC address, the USB part has its own */ | 124 | /* the PCI part uses this call to get the MAC address, the USB part has its own */ |
diff --git a/drivers/media/dvb/b2c2/flexcop-dma.c b/drivers/media/dvb/b2c2/flexcop-dma.c index cf4ed1df6086..6f592bc32d22 100644 --- a/drivers/media/dvb/b2c2/flexcop-dma.c +++ b/drivers/media/dvb/b2c2/flexcop-dma.c | |||
| @@ -169,38 +169,3 @@ int flexcop_dma_config_timer(struct flexcop_device *fc, | |||
| 169 | } | 169 | } |
| 170 | EXPORT_SYMBOL(flexcop_dma_config_timer); | 170 | EXPORT_SYMBOL(flexcop_dma_config_timer); |
| 171 | 171 | ||
| 172 | /* packet IRQ does not exist in FCII or FCIIb - according to data book and tests */ | ||
| 173 | int flexcop_dma_control_packet_irq(struct flexcop_device *fc, | ||
| 174 | flexcop_dma_index_t no, | ||
| 175 | int onoff) | ||
| 176 | { | ||
| 177 | flexcop_ibi_value v = fc->read_ibi_reg(fc,ctrl_208); | ||
| 178 | |||
| 179 | deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw); | ||
| 180 | if (no & FC_DMA_1) | ||
| 181 | v.ctrl_208.DMA1_Size_IRQ_Enable_sig = onoff; | ||
| 182 | |||
| 183 | if (no & FC_DMA_2) | ||
| 184 | v.ctrl_208.DMA2_Size_IRQ_Enable_sig = onoff; | ||
| 185 | |||
| 186 | fc->write_ibi_reg(fc,ctrl_208,v); | ||
| 187 | deb_rdump("reg: %03x: %x\n",ctrl_208,v.raw); | ||
| 188 | |||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | EXPORT_SYMBOL(flexcop_dma_control_packet_irq); | ||
| 192 | |||
| 193 | int flexcop_dma_config_packet_count(struct flexcop_device *fc, | ||
| 194 | flexcop_dma_index_t dma_idx, | ||
| 195 | u8 packets) | ||
| 196 | { | ||
| 197 | flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; | ||
| 198 | flexcop_ibi_value v = fc->read_ibi_reg(fc,r); | ||
| 199 | |||
| 200 | flexcop_dma_remap(fc,dma_idx,1); | ||
| 201 | |||
| 202 | v.dma_0x4_remap.DMA_maxpackets = packets; | ||
| 203 | fc->write_ibi_reg(fc,r,v); | ||
| 204 | return 0; | ||
| 205 | } | ||
| 206 | EXPORT_SYMBOL(flexcop_dma_config_packet_count); | ||
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 0b940e152b79..390cc3a99ce6 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include "stv0299.h" | 10 | #include "stv0299.h" |
| 11 | #include "mt352.h" | 11 | #include "mt352.h" |
| 12 | #include "nxt2002.h" | 12 | #include "nxt200x.h" |
| 13 | #include "bcm3510.h" | 13 | #include "bcm3510.h" |
| 14 | #include "stv0297.h" | 14 | #include "stv0297.h" |
| 15 | #include "mt312.h" | 15 | #include "mt312.h" |
| @@ -343,9 +343,10 @@ static struct lgdt330x_config air2pc_atsc_hd5000_config = { | |||
| 343 | .clock_polarity_flip = 1, | 343 | .clock_polarity_flip = 1, |
| 344 | }; | 344 | }; |
| 345 | 345 | ||
| 346 | static struct nxt2002_config samsung_tbmv_config = { | 346 | static struct nxt200x_config samsung_tbmv_config = { |
| 347 | .demod_address = 0x0a, | 347 | .demod_address = 0x0a, |
| 348 | .request_firmware = flexcop_fe_request_firmware, | 348 | .pll_address = 0xc2, |
| 349 | .pll_desc = &dvb_pll_samsung_tbmv, | ||
| 349 | }; | 350 | }; |
| 350 | 351 | ||
| 351 | static struct bcm3510_config air2pc_atsc_first_gen_config = { | 352 | static struct bcm3510_config air2pc_atsc_first_gen_config = { |
| @@ -505,7 +506,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
| 505 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); | 506 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); |
| 506 | } else | 507 | } else |
| 507 | /* try the air atsc 2nd generation (nxt2002) */ | 508 | /* try the air atsc 2nd generation (nxt2002) */ |
| 508 | if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { | 509 | if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { |
| 509 | fc->dev_type = FC_AIR_ATSC2; | 510 | fc->dev_type = FC_AIR_ATSC2; |
| 510 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); | 511 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); |
| 511 | } else | 512 | } else |
diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c index 62282d8dbfa8..167583bf0621 100644 --- a/drivers/media/dvb/b2c2/flexcop-misc.c +++ b/drivers/media/dvb/b2c2/flexcop-misc.c | |||
| @@ -36,14 +36,14 @@ void flexcop_determine_revision(struct flexcop_device *fc) | |||
| 36 | /* bus parts have to decide if hw pid filtering is used or not. */ | 36 | /* bus parts have to decide if hw pid filtering is used or not. */ |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | const char *flexcop_revision_names[] = { | 39 | static const char *flexcop_revision_names[] = { |
| 40 | "Unkown chip", | 40 | "Unkown chip", |
| 41 | "FlexCopII", | 41 | "FlexCopII", |
| 42 | "FlexCopIIb", | 42 | "FlexCopIIb", |
| 43 | "FlexCopIII", | 43 | "FlexCopIII", |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | const char *flexcop_device_names[] = { | 46 | static const char *flexcop_device_names[] = { |
| 47 | "Unkown device", | 47 | "Unkown device", |
| 48 | "Air2PC/AirStar 2 DVB-T", | 48 | "Air2PC/AirStar 2 DVB-T", |
| 49 | "Air2PC/AirStar 2 ATSC 1st generation", | 49 | "Air2PC/AirStar 2 ATSC 1st generation", |
| @@ -54,7 +54,7 @@ const char *flexcop_device_names[] = { | |||
| 54 | "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", | 54 | "Air2PC/AirStar 2 ATSC 3rd generation (HD5000)", |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | const char *flexcop_bus_names[] = { | 57 | static const char *flexcop_bus_names[] = { |
| 58 | "USB", | 58 | "USB", |
| 59 | "PCI", | 59 | "PCI", |
| 60 | }; | 60 | }; |
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index 2f76eb3fea40..9bc40bdcc282 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c | |||
| @@ -161,8 +161,10 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id, struct pt_regs *regs) | |||
| 161 | fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; | 161 | fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2; |
| 162 | u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; | 162 | u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0; |
| 163 | 163 | ||
| 164 | deb_irq("%u irq: %08x cur_addr: %08x: cur_pos: %08x, last_cur_pos: %08x ", | 164 | deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", |
| 165 | jiffies_to_usecs(jiffies - fc_pci->last_irq),v.raw,cur_addr,cur_pos,fc_pci->last_dma1_cur_pos); | 165 | jiffies_to_usecs(jiffies - fc_pci->last_irq), |
| 166 | v.raw, (unsigned long long)cur_addr, cur_pos, | ||
| 167 | fc_pci->last_dma1_cur_pos); | ||
| 166 | fc_pci->last_irq = jiffies; | 168 | fc_pci->last_irq = jiffies; |
| 167 | 169 | ||
| 168 | /* buffer end was reached, restarted from the beginning | 170 | /* buffer end was reached, restarted from the beginning |
diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h index 3153f9513c63..491f9bd6e195 100644 --- a/drivers/media/dvb/b2c2/flexcop-reg.h +++ b/drivers/media/dvb/b2c2/flexcop-reg.h | |||
| @@ -16,8 +16,6 @@ typedef enum { | |||
| 16 | FLEXCOP_III, | 16 | FLEXCOP_III, |
| 17 | } flexcop_revision_t; | 17 | } flexcop_revision_t; |
| 18 | 18 | ||
| 19 | extern const char *flexcop_revision_names[]; | ||
| 20 | |||
| 21 | typedef enum { | 19 | typedef enum { |
| 22 | FC_UNK = 0, | 20 | FC_UNK = 0, |
| 23 | FC_AIR_DVB, | 21 | FC_AIR_DVB, |
| @@ -34,8 +32,6 @@ typedef enum { | |||
| 34 | FC_PCI, | 32 | FC_PCI, |
| 35 | } flexcop_bus_t; | 33 | } flexcop_bus_t; |
| 36 | 34 | ||
| 37 | extern const char *flexcop_device_names[]; | ||
| 38 | |||
| 39 | /* FlexCop IBI Registers */ | 35 | /* FlexCop IBI Registers */ |
| 40 | #if defined(__LITTLE_ENDIAN) | 36 | #if defined(__LITTLE_ENDIAN) |
| 41 | #include "flexcop_ibi_value_le.h" | 37 | #include "flexcop_ibi_value_le.h" |
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c index a04bb61f21f4..34c3189a1a33 100644 --- a/drivers/media/dvb/bt8xx/bt878.c +++ b/drivers/media/dvb/bt8xx/bt878.c | |||
| @@ -381,6 +381,23 @@ bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet * | |||
| 381 | 381 | ||
| 382 | EXPORT_SYMBOL(bt878_device_control); | 382 | EXPORT_SYMBOL(bt878_device_control); |
| 383 | 383 | ||
| 384 | |||
| 385 | struct cards card_list[] __devinitdata = { | ||
| 386 | |||
| 387 | { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, | ||
| 388 | { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, | ||
| 389 | { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" }, | ||
| 390 | { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" }, | ||
| 391 | { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" }, | ||
| 392 | { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, | ||
| 393 | { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, | ||
| 394 | { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" }, | ||
| 395 | { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, | ||
| 396 | { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"}, | ||
| 397 | { 0, -1, NULL } | ||
| 398 | }; | ||
| 399 | |||
| 400 | |||
| 384 | /***********************/ | 401 | /***********************/ |
| 385 | /* PCI device handling */ | 402 | /* PCI device handling */ |
| 386 | /***********************/ | 403 | /***********************/ |
| @@ -388,18 +405,41 @@ EXPORT_SYMBOL(bt878_device_control); | |||
| 388 | static int __devinit bt878_probe(struct pci_dev *dev, | 405 | static int __devinit bt878_probe(struct pci_dev *dev, |
| 389 | const struct pci_device_id *pci_id) | 406 | const struct pci_device_id *pci_id) |
| 390 | { | 407 | { |
| 391 | int result; | 408 | int result = 0, has_dvb = 0, i; |
| 392 | unsigned char lat; | 409 | unsigned char lat; |
| 393 | struct bt878 *bt; | 410 | struct bt878 *bt; |
| 394 | #if defined(__powerpc__) | 411 | #if defined(__powerpc__) |
| 395 | unsigned int cmd; | 412 | unsigned int cmd; |
| 396 | #endif | 413 | #endif |
| 414 | unsigned int cardid; | ||
| 415 | unsigned short id; | ||
| 416 | struct cards *dvb_cards; | ||
| 397 | 417 | ||
| 398 | printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", | 418 | printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", |
| 399 | bt878_num); | 419 | bt878_num); |
| 400 | if (pci_enable_device(dev)) | 420 | if (pci_enable_device(dev)) |
| 401 | return -EIO; | 421 | return -EIO; |
| 402 | 422 | ||
| 423 | pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &id); | ||
| 424 | cardid = id << 16; | ||
| 425 | pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &id); | ||
| 426 | cardid |= id; | ||
| 427 | |||
| 428 | for (i = 0, dvb_cards = card_list; i < ARRAY_SIZE(card_list); i++, dvb_cards++) { | ||
| 429 | if (cardid == dvb_cards->pci_id) { | ||
| 430 | printk("%s: card id=[0x%x],[ %s ] has DVB functions.\n", | ||
| 431 | __func__, cardid, dvb_cards->name); | ||
| 432 | has_dvb = 1; | ||
| 433 | } | ||
| 434 | } | ||
| 435 | |||
| 436 | if (!has_dvb) { | ||
| 437 | printk("%s: card id=[0x%x], Unknown card.\nExiting..\n", __func__, cardid); | ||
| 438 | result = -EINVAL; | ||
| 439 | |||
| 440 | goto fail0; | ||
| 441 | } | ||
| 442 | |||
| 403 | bt = &bt878[bt878_num]; | 443 | bt = &bt878[bt878_num]; |
| 404 | bt->dev = dev; | 444 | bt->dev = dev; |
| 405 | bt->nr = bt878_num; | 445 | bt->nr = bt878_num; |
| @@ -416,6 +456,8 @@ static int __devinit bt878_probe(struct pci_dev *dev, | |||
| 416 | 456 | ||
| 417 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision); | 457 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision); |
| 418 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); | 458 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); |
| 459 | |||
| 460 | |||
| 419 | printk(KERN_INFO "bt878(%d): Bt%x (rev %d) at %02x:%02x.%x, ", | 461 | printk(KERN_INFO "bt878(%d): Bt%x (rev %d) at %02x:%02x.%x, ", |
| 420 | bt878_num, bt->id, bt->revision, dev->bus->number, | 462 | bt878_num, bt->id, bt->revision, dev->bus->number, |
| 421 | PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); | 463 | PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); |
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h index a73baf00ca39..9faf93770d08 100644 --- a/drivers/media/dvb/bt8xx/bt878.h +++ b/drivers/media/dvb/bt8xx/bt878.h | |||
| @@ -88,6 +88,23 @@ | |||
| 88 | 88 | ||
| 89 | #define BT878_RISC_SYNC_MASK (1 << 15) | 89 | #define BT878_RISC_SYNC_MASK (1 << 15) |
| 90 | 90 | ||
| 91 | |||
| 92 | #define BTTV_BOARD_UNKNOWN 0x00 | ||
| 93 | #define BTTV_BOARD_PINNACLESAT 0x5e | ||
| 94 | #define BTTV_BOARD_NEBULA_DIGITV 0x68 | ||
| 95 | #define BTTV_BOARD_PC_HDTV 0x70 | ||
| 96 | #define BTTV_BOARD_TWINHAN_DST 0x71 | ||
| 97 | #define BTTV_BOARD_AVDVBT_771 0x7b | ||
| 98 | #define BTTV_BOARD_AVDVBT_761 0x7c | ||
| 99 | #define BTTV_BOARD_DVICO_DVBT_LITE 0x80 | ||
| 100 | #define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87 | ||
| 101 | |||
| 102 | struct cards { | ||
| 103 | __u32 pci_id; | ||
| 104 | __u16 card_id; | ||
| 105 | char *name; | ||
| 106 | }; | ||
| 107 | |||
| 91 | extern int bt878_num; | 108 | extern int bt878_num; |
| 92 | 109 | ||
| 93 | struct bt878 { | 110 | struct bt878 { |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 90a69d343b79..d3df12039b06 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
| @@ -83,12 +83,18 @@ config DVB_USB_UMT_010 | |||
| 83 | Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. | 83 | Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. |
| 84 | 84 | ||
| 85 | config DVB_USB_CXUSB | 85 | config DVB_USB_CXUSB |
| 86 | tristate "Medion MD95700 hybrid USB2.0 (Conexant) support" | 86 | tristate "Conexant USB2.0 hybrid reference design support" |
| 87 | depends on DVB_USB | 87 | depends on DVB_USB |
| 88 | select DVB_CX22702 | 88 | select DVB_CX22702 |
| 89 | select DVB_LGDT330X | ||
| 90 | select DVB_MT352 | ||
| 89 | help | 91 | help |
| 90 | Say Y here to support the Medion MD95700 hybrid USB2.0 device. Currently | 92 | Say Y here to support the Conexant USB2.0 hybrid reference design. |
| 91 | only the DVB-T part is supported. | 93 | Currently, only DVB and ATSC modes are supported, analog mode |
| 94 | shall be added in the future. Devices that require this module: | ||
| 95 | |||
| 96 | Medion MD95700 hybrid USB2.0 device. | ||
| 97 | DViCO FusionHDTV (Bluebird) USB2.0 devices | ||
| 92 | 98 | ||
| 93 | config DVB_USB_DIGITV | 99 | config DVB_USB_DIGITV |
| 94 | tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" | 100 | tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index a7fb06f4cd34..f327fac1688e 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
| @@ -184,7 +184,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 184 | return 0; | 184 | return 0; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | struct dvb_usb_rc_key dvico_mce_rc_keys[] = { | 187 | static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { |
| 188 | { 0xfe, 0x02, KEY_TV }, | 188 | { 0xfe, 0x02, KEY_TV }, |
| 189 | { 0xfe, 0x0e, KEY_MP3 }, | 189 | { 0xfe, 0x0e, KEY_MP3 }, |
| 190 | { 0xfe, 0x1a, KEY_DVD }, | 190 | { 0xfe, 0x1a, KEY_DVD }, |
| @@ -234,7 +234,7 @@ struct dvb_usb_rc_key dvico_mce_rc_keys[] = { | |||
| 234 | 234 | ||
| 235 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) | 235 | static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) |
| 236 | { | 236 | { |
| 237 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 }; | 237 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 }; |
| 238 | static u8 reset [] = { RESET, 0x80 }; | 238 | static u8 reset [] = { RESET, 0x80 }; |
| 239 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; | 239 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 240 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; | 240 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 }; |
| @@ -255,7 +255,7 @@ static int cxusb_dee1601_demod_init(struct dvb_frontend* fe) | |||
| 255 | 255 | ||
| 256 | static int cxusb_mt352_demod_init(struct dvb_frontend* fe) | 256 | static int cxusb_mt352_demod_init(struct dvb_frontend* fe) |
| 257 | { /* used in both lgz201 and th7579 */ | 257 | { /* used in both lgz201 and th7579 */ |
| 258 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; | 258 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x29 }; |
| 259 | static u8 reset [] = { RESET, 0x80 }; | 259 | static u8 reset [] = { RESET, 0x80 }; |
| 260 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; | 260 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 261 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; | 261 | static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 }; |
| @@ -273,7 +273,7 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe) | |||
| 273 | return 0; | 273 | return 0; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | struct cx22702_config cxusb_cx22702_config = { | 276 | static struct cx22702_config cxusb_cx22702_config = { |
| 277 | .demod_address = 0x63, | 277 | .demod_address = 0x63, |
| 278 | 278 | ||
| 279 | .output_mode = CX22702_PARALLEL_OUTPUT, | 279 | .output_mode = CX22702_PARALLEL_OUTPUT, |
| @@ -282,13 +282,13 @@ struct cx22702_config cxusb_cx22702_config = { | |||
| 282 | .pll_set = dvb_usb_pll_set_i2c, | 282 | .pll_set = dvb_usb_pll_set_i2c, |
| 283 | }; | 283 | }; |
| 284 | 284 | ||
| 285 | struct lgdt330x_config cxusb_lgdt330x_config = { | 285 | static struct lgdt330x_config cxusb_lgdt330x_config = { |
| 286 | .demod_address = 0x0e, | 286 | .demod_address = 0x0e, |
| 287 | .demod_chip = LGDT3303, | 287 | .demod_chip = LGDT3303, |
| 288 | .pll_set = dvb_usb_pll_set_i2c, | 288 | .pll_set = dvb_usb_pll_set_i2c, |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | struct mt352_config cxusb_dee1601_config = { | 291 | static struct mt352_config cxusb_dee1601_config = { |
| 292 | .demod_address = 0x0f, | 292 | .demod_address = 0x0f, |
| 293 | .demod_init = cxusb_dee1601_demod_init, | 293 | .demod_init = cxusb_dee1601_demod_init, |
| 294 | .pll_set = dvb_usb_pll_set, | 294 | .pll_set = dvb_usb_pll_set, |
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index e6c55c9c9417..caa1346e3063 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
| @@ -175,11 +175,13 @@ static int digitv_probe(struct usb_interface *intf, | |||
| 175 | if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { | 175 | if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { |
| 176 | u8 b[4] = { 0 }; | 176 | u8 b[4] = { 0 }; |
| 177 | 177 | ||
| 178 | b[0] = 1; | 178 | if (d != NULL) { /* do that only when the firmware is loaded */ |
| 179 | digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0); | 179 | b[0] = 1; |
| 180 | digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0); | ||
| 180 | 181 | ||
| 181 | b[0] = 0; | 182 | b[0] = 0; |
| 182 | digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); | 183 | digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); |
| 184 | } | ||
| 183 | } | 185 | } |
| 184 | return ret; | 186 | return ret; |
| 185 | } | 187 | } |
| @@ -194,7 +196,7 @@ static struct dvb_usb_properties digitv_properties = { | |||
| 194 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | 196 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
| 195 | 197 | ||
| 196 | .usb_ctrl = CYPRESS_FX2, | 198 | .usb_ctrl = CYPRESS_FX2, |
| 197 | .firmware = "dvb-usb-digitv-01.fw", | 199 | .firmware = "dvb-usb-digitv-02.fw", |
| 198 | 200 | ||
| 199 | .size_of_priv = 0, | 201 | .size_of_priv = 0, |
| 200 | 202 | ||
| @@ -229,6 +231,7 @@ static struct dvb_usb_properties digitv_properties = { | |||
| 229 | { &digitv_table[0], NULL }, | 231 | { &digitv_table[0], NULL }, |
| 230 | { NULL }, | 232 | { NULL }, |
| 231 | }, | 233 | }, |
| 234 | { NULL }, | ||
| 232 | } | 235 | } |
| 233 | }; | 236 | }; |
| 234 | 237 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c index 8535895819fb..9222b0a81f74 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | |||
| @@ -24,6 +24,9 @@ static struct usb_cypress_controller cypress[] = { | |||
| 24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | 24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, | ||
| 28 | int *pos); | ||
| 29 | |||
| 27 | /* | 30 | /* |
| 28 | * load a firmware packet to the device | 31 | * load a firmware packet to the device |
| 29 | */ | 32 | */ |
| @@ -112,7 +115,8 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties | |||
| 112 | return ret; | 115 | return ret; |
| 113 | } | 116 | } |
| 114 | 117 | ||
| 115 | int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos) | 118 | static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, |
| 119 | int *pos) | ||
| 116 | { | 120 | { |
| 117 | u8 *b = (u8 *) &fw->data[*pos]; | 121 | u8 *b = (u8 *) &fw->data[*pos]; |
| 118 | int data_offs = 4; | 122 | int data_offs = 4; |
| @@ -142,5 +146,3 @@ int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos) | |||
| 142 | 146 | ||
| 143 | return *pos; | 147 | return *pos; |
| 144 | } | 148 | } |
| 145 | EXPORT_SYMBOL(dvb_usb_get_hexline); | ||
| 146 | |||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index dd568396e594..5e5d21ad93c9 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
| @@ -341,7 +341,6 @@ struct hexline { | |||
| 341 | u8 data[255]; | 341 | u8 data[255]; |
| 342 | u8 chk; | 342 | u8 chk; |
| 343 | }; | 343 | }; |
| 344 | extern int dvb_usb_get_hexline(const struct firmware *, struct hexline *, int *); | ||
| 345 | extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); | 344 | extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); |
| 346 | 345 | ||
| 347 | #endif | 346 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index afa00fdb5ec0..4a95eca81c5c 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c | |||
| @@ -53,7 +53,8 @@ int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 | |||
| 53 | return ret; | 53 | return ret; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | 56 | static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, |
| 57 | u16 index, u8 *b, int blen) | ||
| 57 | { | 58 | { |
| 58 | deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); | 59 | deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); |
| 59 | debug_dump(b,blen,deb_xfer); | 60 | debug_dump(b,blen,deb_xfer); |
| @@ -88,7 +89,8 @@ unlock: | |||
| 88 | return ret; | 89 | return ret; |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec) | 92 | static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, |
| 93 | int olen, u8 *i, int ilen, int msec) | ||
| 92 | { | 94 | { |
| 93 | u8 bout[olen+2]; | 95 | u8 bout[olen+2]; |
| 94 | u8 bin[ilen+1]; | 96 | u8 bin[ilen+1]; |
diff --git a/drivers/media/dvb/dvb-usb/vp702x.h b/drivers/media/dvb/dvb-usb/vp702x.h index a808d48e7bf2..c2f97f96c21f 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.h +++ b/drivers/media/dvb/dvb-usb/vp702x.h | |||
| @@ -101,8 +101,6 @@ extern int dvb_usb_vp702x_debug; | |||
| 101 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); | 101 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); |
| 102 | 102 | ||
| 103 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); | 103 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); |
| 104 | extern int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec); | ||
| 105 | extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | 104 | extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); |
| 106 | extern int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
| 107 | 105 | ||
| 108 | #endif | 106 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c index 5242cca5db4a..9999336aeeb6 100644 --- a/drivers/media/dvb/dvb-usb/vp7045-fe.c +++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c | |||
| @@ -23,10 +23,11 @@ | |||
| 23 | 23 | ||
| 24 | struct vp7045_fe_state { | 24 | struct vp7045_fe_state { |
| 25 | struct dvb_frontend fe; | 25 | struct dvb_frontend fe; |
| 26 | struct dvb_frontend_ops ops; | ||
| 27 | |||
| 26 | struct dvb_usb_device *d; | 28 | struct dvb_usb_device *d; |
| 27 | }; | 29 | }; |
| 28 | 30 | ||
| 29 | |||
| 30 | static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) | 31 | static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) |
| 31 | { | 32 | { |
| 32 | struct vp7045_fe_state *state = fe->demodulator_priv; | 33 | struct vp7045_fe_state *state = fe->demodulator_priv; |
| @@ -150,7 +151,8 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) | |||
| 150 | goto error; | 151 | goto error; |
| 151 | 152 | ||
| 152 | s->d = d; | 153 | s->d = d; |
| 153 | s->fe.ops = &vp7045_fe_ops; | 154 | memcpy(&s->ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops)); |
| 155 | s->fe.ops = &s->ops; | ||
| 154 | s->fe.demodulator_priv = s; | 156 | s->fe.demodulator_priv = s; |
| 155 | 157 | ||
| 156 | goto success; | 158 | goto success; |
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index db3a8b40031e..76b6a2aef32f 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
| @@ -28,12 +28,6 @@ config DVB_TDA8083 | |||
| 28 | help | 28 | help |
| 29 | A DVB-S tuner module. Say Y when you want to support this frontend. | 29 | A DVB-S tuner module. Say Y when you want to support this frontend. |
| 30 | 30 | ||
| 31 | config DVB_TDA80XX | ||
| 32 | tristate "Philips TDA8044 or TDA8083 based" | ||
| 33 | depends on DVB_CORE | ||
| 34 | help | ||
| 35 | A DVB-S tuner module. Say Y when you want to support this frontend. | ||
| 36 | |||
| 37 | config DVB_MT312 | 31 | config DVB_MT312 |
| 38 | tristate "Zarlink MT312 based" | 32 | tristate "Zarlink MT312 based" |
| 39 | depends on DVB_CORE | 33 | depends on DVB_CORE |
| @@ -139,12 +133,6 @@ config DVB_DIB3000MC | |||
| 139 | comment "DVB-C (cable) frontends" | 133 | comment "DVB-C (cable) frontends" |
| 140 | depends on DVB_CORE | 134 | depends on DVB_CORE |
| 141 | 135 | ||
| 142 | config DVB_ATMEL_AT76C651 | ||
| 143 | tristate "Atmel AT76C651 based" | ||
| 144 | depends on DVB_CORE | ||
| 145 | help | ||
| 146 | A DVB-C tuner module. Say Y when you want to support this frontend. | ||
| 147 | |||
| 148 | config DVB_VES1820 | 136 | config DVB_VES1820 |
| 149 | tristate "VLSI VES1820 based" | 137 | tristate "VLSI VES1820 based" |
| 150 | depends on DVB_CORE | 138 | depends on DVB_CORE |
| @@ -166,18 +154,6 @@ config DVB_STV0297 | |||
| 166 | comment "ATSC (North American/Korean Terresterial DTV) frontends" | 154 | comment "ATSC (North American/Korean Terresterial DTV) frontends" |
| 167 | depends on DVB_CORE | 155 | depends on DVB_CORE |
| 168 | 156 | ||
| 169 | config DVB_NXT2002 | ||
| 170 | tristate "Nxt2002 based" | ||
| 171 | depends on DVB_CORE | ||
| 172 | select FW_LOADER | ||
| 173 | help | ||
| 174 | An ATSC 8VSB tuner module. Say Y when you want to support this frontend. | ||
| 175 | |||
| 176 | This driver needs external firmware. Please use the command | ||
| 177 | "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to | ||
| 178 | download/extract it, and then copy it to /usr/lib/hotplug/firmware | ||
| 179 | or /lib/firmware (depending on configuration of firmware hotplug). | ||
| 180 | |||
| 181 | config DVB_NXT200X | 157 | config DVB_NXT200X |
| 182 | tristate "Nextwave NXT2002/NXT2004 based" | 158 | tristate "Nextwave NXT2002/NXT2004 based" |
| 183 | depends on DVB_CORE | 159 | depends on DVB_CORE |
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 615ec830e1c9..1af769cd90c0 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile | |||
| @@ -8,7 +8,6 @@ obj-$(CONFIG_DVB_CORE) += dvb-pll.o | |||
| 8 | obj-$(CONFIG_DVB_STV0299) += stv0299.o | 8 | obj-$(CONFIG_DVB_STV0299) += stv0299.o |
| 9 | obj-$(CONFIG_DVB_SP8870) += sp8870.o | 9 | obj-$(CONFIG_DVB_SP8870) += sp8870.o |
| 10 | obj-$(CONFIG_DVB_CX22700) += cx22700.o | 10 | obj-$(CONFIG_DVB_CX22700) += cx22700.o |
| 11 | obj-$(CONFIG_DVB_ATMEL_AT76C651) += at76c651.o | ||
| 12 | obj-$(CONFIG_DVB_CX24110) += cx24110.o | 11 | obj-$(CONFIG_DVB_CX24110) += cx24110.o |
| 13 | obj-$(CONFIG_DVB_TDA8083) += tda8083.o | 12 | obj-$(CONFIG_DVB_TDA8083) += tda8083.o |
| 14 | obj-$(CONFIG_DVB_L64781) += l64781.o | 13 | obj-$(CONFIG_DVB_L64781) += l64781.o |
| @@ -22,10 +21,8 @@ obj-$(CONFIG_DVB_SP887X) += sp887x.o | |||
| 22 | obj-$(CONFIG_DVB_NXT6000) += nxt6000.o | 21 | obj-$(CONFIG_DVB_NXT6000) += nxt6000.o |
| 23 | obj-$(CONFIG_DVB_MT352) += mt352.o | 22 | obj-$(CONFIG_DVB_MT352) += mt352.o |
| 24 | obj-$(CONFIG_DVB_CX22702) += cx22702.o | 23 | obj-$(CONFIG_DVB_CX22702) += cx22702.o |
| 25 | obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o | ||
| 26 | obj-$(CONFIG_DVB_TDA10021) += tda10021.o | 24 | obj-$(CONFIG_DVB_TDA10021) += tda10021.o |
| 27 | obj-$(CONFIG_DVB_STV0297) += stv0297.o | 25 | obj-$(CONFIG_DVB_STV0297) += stv0297.o |
| 28 | obj-$(CONFIG_DVB_NXT2002) += nxt2002.o | ||
| 29 | obj-$(CONFIG_DVB_NXT200X) += nxt200x.o | 26 | obj-$(CONFIG_DVB_NXT200X) += nxt200x.o |
| 30 | obj-$(CONFIG_DVB_OR51211) += or51211.o | 27 | obj-$(CONFIG_DVB_OR51211) += or51211.o |
| 31 | obj-$(CONFIG_DVB_OR51132) += or51132.o | 28 | obj-$(CONFIG_DVB_OR51132) += or51132.o |
diff --git a/drivers/media/dvb/frontends/at76c651.c b/drivers/media/dvb/frontends/at76c651.c deleted file mode 100644 index 8e0f4b3a1417..000000000000 --- a/drivers/media/dvb/frontends/at76c651.c +++ /dev/null | |||
| @@ -1,450 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * at76c651.c | ||
| 3 | * | ||
| 4 | * Atmel DVB-C Frontend Driver (at76c651/tua6010xs) | ||
| 5 | * | ||
| 6 | * Copyright (C) 2001 fnbrd <fnbrd@gmx.de> | ||
| 7 | * & 2002-2004 Andreas Oberritter <obi@linuxtv.org> | ||
| 8 | * & 2003 Wolfram Joost <dbox2@frokaschwei.de> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 23 | * | ||
| 24 | * AT76C651 | ||
| 25 | * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf | ||
| 26 | * http://www.atmel.com/atmel/acrobat/doc1320.pdf | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <linux/init.h> | ||
| 30 | #include <linux/module.h> | ||
| 31 | #include <linux/moduleparam.h> | ||
| 32 | #include <linux/kernel.h> | ||
| 33 | #include <linux/string.h> | ||
| 34 | #include <linux/slab.h> | ||
| 35 | #include <linux/bitops.h> | ||
| 36 | #include "dvb_frontend.h" | ||
| 37 | #include "at76c651.h" | ||
| 38 | |||
| 39 | |||
| 40 | struct at76c651_state { | ||
| 41 | |||
| 42 | struct i2c_adapter* i2c; | ||
| 43 | |||
| 44 | struct dvb_frontend_ops ops; | ||
| 45 | |||
| 46 | const struct at76c651_config* config; | ||
| 47 | |||
| 48 | struct dvb_frontend frontend; | ||
| 49 | |||
| 50 | /* revision of the chip */ | ||
| 51 | u8 revision; | ||
| 52 | |||
| 53 | /* last QAM value set */ | ||
| 54 | u8 qam; | ||
| 55 | }; | ||
| 56 | |||
| 57 | static int debug; | ||
| 58 | #define dprintk(args...) \ | ||
| 59 | do { \ | ||
| 60 | if (debug) printk(KERN_DEBUG "at76c651: " args); \ | ||
| 61 | } while (0) | ||
| 62 | |||
| 63 | |||
| 64 | #if ! defined(__powerpc__) | ||
| 65 | static __inline__ int __ilog2(unsigned long x) | ||
| 66 | { | ||
| 67 | int i; | ||
| 68 | |||
| 69 | if (x == 0) | ||
| 70 | return -1; | ||
| 71 | |||
| 72 | for (i = 0; x != 0; i++) | ||
| 73 | x >>= 1; | ||
| 74 | |||
| 75 | return i - 1; | ||
| 76 | } | ||
| 77 | #endif | ||
| 78 | |||
| 79 | static int at76c651_writereg(struct at76c651_state* state, u8 reg, u8 data) | ||
| 80 | { | ||
| 81 | int ret; | ||
| 82 | u8 buf[] = { reg, data }; | ||
| 83 | struct i2c_msg msg = | ||
| 84 | { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; | ||
| 85 | |||
| 86 | ret = i2c_transfer(state->i2c, &msg, 1); | ||
| 87 | |||
| 88 | if (ret != 1) | ||
| 89 | dprintk("%s: writereg error " | ||
| 90 | "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", | ||
| 91 | __FUNCTION__, reg, data, ret); | ||
| 92 | |||
| 93 | msleep(10); | ||
| 94 | |||
| 95 | return (ret != 1) ? -EREMOTEIO : 0; | ||
| 96 | } | ||
| 97 | |||
| 98 | static u8 at76c651_readreg(struct at76c651_state* state, u8 reg) | ||
| 99 | { | ||
| 100 | int ret; | ||
| 101 | u8 val; | ||
| 102 | struct i2c_msg msg[] = { | ||
| 103 | { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 }, | ||
| 104 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = &val, .len = 1 } | ||
| 105 | }; | ||
| 106 | |||
| 107 | ret = i2c_transfer(state->i2c, msg, 2); | ||
| 108 | |||
| 109 | if (ret != 2) | ||
| 110 | dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); | ||
| 111 | |||
| 112 | return val; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int at76c651_reset(struct at76c651_state* state) | ||
| 116 | { | ||
| 117 | return at76c651_writereg(state, 0x07, 0x01); | ||
| 118 | } | ||
| 119 | |||
| 120 | static void at76c651_disable_interrupts(struct at76c651_state* state) | ||
| 121 | { | ||
| 122 | at76c651_writereg(state, 0x0b, 0x00); | ||
| 123 | } | ||
| 124 | |||
| 125 | static int at76c651_set_auto_config(struct at76c651_state *state) | ||
| 126 | { | ||
| 127 | /* | ||
| 128 | * Autoconfig | ||
| 129 | */ | ||
| 130 | |||
| 131 | at76c651_writereg(state, 0x06, 0x01); | ||
| 132 | |||
| 133 | /* | ||
| 134 | * Performance optimizations, should be done after autoconfig | ||
| 135 | */ | ||
| 136 | |||
| 137 | at76c651_writereg(state, 0x10, 0x06); | ||
| 138 | at76c651_writereg(state, 0x11, ((state->qam == 5) || (state->qam == 7)) ? 0x12 : 0x10); | ||
| 139 | at76c651_writereg(state, 0x15, 0x28); | ||
| 140 | at76c651_writereg(state, 0x20, 0x09); | ||
| 141 | at76c651_writereg(state, 0x24, ((state->qam == 5) || (state->qam == 7)) ? 0xC0 : 0x90); | ||
| 142 | at76c651_writereg(state, 0x30, 0x90); | ||
| 143 | if (state->qam == 5) | ||
| 144 | at76c651_writereg(state, 0x35, 0x2A); | ||
| 145 | |||
| 146 | /* | ||
| 147 | * Initialize A/D-converter | ||
| 148 | */ | ||
| 149 | |||
| 150 | if (state->revision == 0x11) { | ||
| 151 | at76c651_writereg(state, 0x2E, 0x38); | ||
| 152 | at76c651_writereg(state, 0x2F, 0x13); | ||
| 153 | } | ||
| 154 | |||
| 155 | at76c651_disable_interrupts(state); | ||
| 156 | |||
| 157 | /* | ||
| 158 | * Restart operation | ||
| 159 | */ | ||
| 160 | |||
| 161 | at76c651_reset(state); | ||
| 162 | |||
| 163 | return 0; | ||
| 164 | } | ||
| 165 | |||
| 166 | static void at76c651_set_bbfreq(struct at76c651_state* state) | ||
| 167 | { | ||
| 168 | at76c651_writereg(state, 0x04, 0x3f); | ||
| 169 | at76c651_writereg(state, 0x05, 0xee); | ||
| 170 | } | ||
| 171 | |||
| 172 | static int at76c651_set_symbol_rate(struct at76c651_state* state, u32 symbol_rate) | ||
| 173 | { | ||
| 174 | u8 exponent; | ||
| 175 | u32 mantissa; | ||
| 176 | |||
| 177 | if (symbol_rate > 9360000) | ||
| 178 | return -EINVAL; | ||
| 179 | |||
| 180 | /* | ||
| 181 | * FREF = 57800 kHz | ||
| 182 | * exponent = 10 + floor (log2(symbol_rate / FREF)) | ||
| 183 | * mantissa = (symbol_rate / FREF) * (1 << (30 - exponent)) | ||
| 184 | */ | ||
| 185 | |||
| 186 | exponent = __ilog2((symbol_rate << 4) / 903125); | ||
| 187 | mantissa = ((symbol_rate / 3125) * (1 << (24 - exponent))) / 289; | ||
| 188 | |||
| 189 | at76c651_writereg(state, 0x00, mantissa >> 13); | ||
| 190 | at76c651_writereg(state, 0x01, mantissa >> 5); | ||
| 191 | at76c651_writereg(state, 0x02, (mantissa << 3) | exponent); | ||
| 192 | |||
| 193 | return 0; | ||
| 194 | } | ||
| 195 | |||
| 196 | static int at76c651_set_qam(struct at76c651_state *state, fe_modulation_t qam) | ||
| 197 | { | ||
| 198 | switch (qam) { | ||
| 199 | case QPSK: | ||
| 200 | state->qam = 0x02; | ||
| 201 | break; | ||
| 202 | case QAM_16: | ||
| 203 | state->qam = 0x04; | ||
| 204 | break; | ||
| 205 | case QAM_32: | ||
| 206 | state->qam = 0x05; | ||
| 207 | break; | ||
| 208 | case QAM_64: | ||
| 209 | state->qam = 0x06; | ||
| 210 | break; | ||
| 211 | case QAM_128: | ||
| 212 | state->qam = 0x07; | ||
| 213 | break; | ||
| 214 | case QAM_256: | ||
| 215 | state->qam = 0x08; | ||
| 216 | break; | ||
| 217 | #if 0 | ||
| 218 | case QAM_512: | ||
| 219 | state->qam = 0x09; | ||
| 220 | break; | ||
| 221 | case QAM_1024: | ||
| 222 | state->qam = 0x0A; | ||
| 223 | break; | ||
| 224 | #endif | ||
| 225 | default: | ||
| 226 | return -EINVAL; | ||
| 227 | |||
| 228 | } | ||
| 229 | |||
| 230 | return at76c651_writereg(state, 0x03, state->qam); | ||
| 231 | } | ||
| 232 | |||
| 233 | static int at76c651_set_inversion(struct at76c651_state* state, fe_spectral_inversion_t inversion) | ||
| 234 | { | ||
| 235 | u8 feciqinv = at76c651_readreg(state, 0x60); | ||
| 236 | |||
| 237 | switch (inversion) { | ||
| 238 | case INVERSION_OFF: | ||
| 239 | feciqinv |= 0x02; | ||
| 240 | feciqinv &= 0xFE; | ||
| 241 | break; | ||
| 242 | |||
| 243 | case INVERSION_ON: | ||
| 244 | feciqinv |= 0x03; | ||
| 245 | break; | ||
| 246 | |||
| 247 | case INVERSION_AUTO: | ||
| 248 | feciqinv &= 0xFC; | ||
| 249 | break; | ||
| 250 | |||
| 251 | default: | ||
| 252 | return -EINVAL; | ||
| 253 | } | ||
| 254 | |||
| 255 | return at76c651_writereg(state, 0x60, feciqinv); | ||
| 256 | } | ||
| 257 | |||
| 258 | static int at76c651_set_parameters(struct dvb_frontend* fe, | ||
| 259 | struct dvb_frontend_parameters *p) | ||
| 260 | { | ||
| 261 | int ret; | ||
| 262 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 263 | |||
| 264 | at76c651_writereg(state, 0x0c, 0xc3); | ||
| 265 | state->config->pll_set(fe, p); | ||
| 266 | at76c651_writereg(state, 0x0c, 0xc2); | ||
| 267 | |||
| 268 | if ((ret = at76c651_set_symbol_rate(state, p->u.qam.symbol_rate))) | ||
| 269 | return ret; | ||
| 270 | |||
| 271 | if ((ret = at76c651_set_inversion(state, p->inversion))) | ||
| 272 | return ret; | ||
| 273 | |||
| 274 | return at76c651_set_auto_config(state); | ||
| 275 | } | ||
| 276 | |||
| 277 | static int at76c651_set_defaults(struct dvb_frontend* fe) | ||
| 278 | { | ||
| 279 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 280 | |||
| 281 | at76c651_set_symbol_rate(state, 6900000); | ||
| 282 | at76c651_set_qam(state, QAM_64); | ||
| 283 | at76c651_set_bbfreq(state); | ||
| 284 | at76c651_set_auto_config(state); | ||
| 285 | |||
| 286 | if (state->config->pll_init) { | ||
| 287 | at76c651_writereg(state, 0x0c, 0xc3); | ||
| 288 | state->config->pll_init(fe); | ||
| 289 | at76c651_writereg(state, 0x0c, 0xc2); | ||
| 290 | } | ||
| 291 | |||
| 292 | return 0; | ||
| 293 | } | ||
| 294 | |||
| 295 | static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
| 296 | { | ||
| 297 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 298 | u8 sync; | ||
| 299 | |||
| 300 | /* | ||
| 301 | * Bits: FEC, CAR, EQU, TIM, AGC2, AGC1, ADC, PLL (PLL=0) | ||
| 302 | */ | ||
| 303 | sync = at76c651_readreg(state, 0x80); | ||
| 304 | *status = 0; | ||
| 305 | |||
| 306 | if (sync & (0x04 | 0x10)) /* AGC1 || TIM */ | ||
| 307 | *status |= FE_HAS_SIGNAL; | ||
| 308 | if (sync & 0x10) /* TIM */ | ||
| 309 | *status |= FE_HAS_CARRIER; | ||
| 310 | if (sync & 0x80) /* FEC */ | ||
| 311 | *status |= FE_HAS_VITERBI; | ||
| 312 | if (sync & 0x40) /* CAR */ | ||
| 313 | *status |= FE_HAS_SYNC; | ||
| 314 | if ((sync & 0xF0) == 0xF0) /* TIM && EQU && CAR && FEC */ | ||
| 315 | *status |= FE_HAS_LOCK; | ||
| 316 | |||
| 317 | return 0; | ||
| 318 | } | ||
| 319 | |||
| 320 | static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber) | ||
| 321 | { | ||
| 322 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 323 | |||
| 324 | *ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16; | ||
| 325 | *ber |= at76c651_readreg(state, 0x82) << 8; | ||
| 326 | *ber |= at76c651_readreg(state, 0x83); | ||
| 327 | *ber *= 10; | ||
| 328 | |||
| 329 | return 0; | ||
| 330 | } | ||
| 331 | |||
| 332 | static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
| 333 | { | ||
| 334 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 335 | |||
| 336 | u8 gain = ~at76c651_readreg(state, 0x91); | ||
| 337 | *strength = (gain << 8) | gain; | ||
| 338 | |||
| 339 | return 0; | ||
| 340 | } | ||
| 341 | |||
| 342 | static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr) | ||
| 343 | { | ||
| 344 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 345 | |||
| 346 | *snr = 0xFFFF - | ||
| 347 | ((at76c651_readreg(state, 0x8F) << 8) | | ||
| 348 | at76c651_readreg(state, 0x90)); | ||
| 349 | |||
| 350 | return 0; | ||
| 351 | } | ||
| 352 | |||
| 353 | static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
| 354 | { | ||
| 355 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 356 | |||
| 357 | *ucblocks = at76c651_readreg(state, 0x82); | ||
| 358 | |||
| 359 | return 0; | ||
| 360 | } | ||
| 361 | |||
| 362 | static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *fesettings) | ||
| 363 | { | ||
| 364 | fesettings->min_delay_ms = 50; | ||
| 365 | fesettings->step_size = 0; | ||
| 366 | fesettings->max_drift = 0; | ||
| 367 | return 0; | ||
| 368 | } | ||
| 369 | |||
| 370 | static void at76c651_release(struct dvb_frontend* fe) | ||
| 371 | { | ||
| 372 | struct at76c651_state* state = fe->demodulator_priv; | ||
| 373 | kfree(state); | ||
| 374 | } | ||
| 375 | |||
| 376 | static struct dvb_frontend_ops at76c651_ops; | ||
| 377 | |||
| 378 | struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, | ||
| 379 | struct i2c_adapter* i2c) | ||
| 380 | { | ||
| 381 | struct at76c651_state* state = NULL; | ||
| 382 | |||
| 383 | /* allocate memory for the internal state */ | ||
| 384 | state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL); | ||
| 385 | if (state == NULL) goto error; | ||
| 386 | |||
| 387 | /* setup the state */ | ||
| 388 | state->config = config; | ||
| 389 | state->qam = 0; | ||
| 390 | |||
| 391 | /* check if the demod is there */ | ||
| 392 | if (at76c651_readreg(state, 0x0e) != 0x65) goto error; | ||
| 393 | |||
| 394 | /* finalise state setup */ | ||
| 395 | state->i2c = i2c; | ||
| 396 | state->revision = at76c651_readreg(state, 0x0f) & 0xfe; | ||
| 397 | memcpy(&state->ops, &at76c651_ops, sizeof(struct dvb_frontend_ops)); | ||
| 398 | |||
| 399 | /* create dvb_frontend */ | ||
| 400 | state->frontend.ops = &state->ops; | ||
| 401 | state->frontend.demodulator_priv = state; | ||
| 402 | return &state->frontend; | ||
| 403 | |||
| 404 | error: | ||
| 405 | kfree(state); | ||
| 406 | return NULL; | ||
| 407 | } | ||
| 408 | |||
| 409 | static struct dvb_frontend_ops at76c651_ops = { | ||
| 410 | |||
| 411 | .info = { | ||
| 412 | .name = "Atmel AT76C651B DVB-C", | ||
| 413 | .type = FE_QAM, | ||
| 414 | .frequency_min = 48250000, | ||
| 415 | .frequency_max = 863250000, | ||
| 416 | .frequency_stepsize = 62500, | ||
| 417 | /*.frequency_tolerance = */ /* FIXME: 12% of SR */ | ||
| 418 | .symbol_rate_min = 0, /* FIXME */ | ||
| 419 | .symbol_rate_max = 9360000, /* FIXME */ | ||
| 420 | .symbol_rate_tolerance = 4000, | ||
| 421 | .caps = FE_CAN_INVERSION_AUTO | | ||
| 422 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
| 423 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | | ||
| 424 | FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO | | ||
| 425 | FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | | ||
| 426 | FE_CAN_MUTE_TS | FE_CAN_QAM_256 | FE_CAN_RECOVER | ||
| 427 | }, | ||
| 428 | |||
| 429 | .release = at76c651_release, | ||
| 430 | |||
| 431 | .init = at76c651_set_defaults, | ||
| 432 | |||
| 433 | .set_frontend = at76c651_set_parameters, | ||
| 434 | .get_tune_settings = at76c651_get_tune_settings, | ||
| 435 | |||
| 436 | .read_status = at76c651_read_status, | ||
| 437 | .read_ber = at76c651_read_ber, | ||
| 438 | .read_signal_strength = at76c651_read_signal_strength, | ||
| 439 | .read_snr = at76c651_read_snr, | ||
| 440 | .read_ucblocks = at76c651_read_ucblocks, | ||
| 441 | }; | ||
| 442 | |||
| 443 | module_param(debug, int, 0644); | ||
| 444 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | ||
| 445 | |||
| 446 | MODULE_DESCRIPTION("Atmel AT76C651 DVB-C Demodulator Driver"); | ||
| 447 | MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>"); | ||
| 448 | MODULE_LICENSE("GPL"); | ||
| 449 | |||
| 450 | EXPORT_SYMBOL(at76c651_attach); | ||
diff --git a/drivers/media/dvb/frontends/at76c651.h b/drivers/media/dvb/frontends/at76c651.h deleted file mode 100644 index 34054df93608..000000000000 --- a/drivers/media/dvb/frontends/at76c651.h +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * at76c651.c | ||
| 3 | * | ||
| 4 | * Atmel DVB-C Frontend Driver (at76c651) | ||
| 5 | * | ||
| 6 | * Copyright (C) 2001 fnbrd <fnbrd@gmx.de> | ||
| 7 | * & 2002-2004 Andreas Oberritter <obi@linuxtv.org> | ||
| 8 | * & 2003 Wolfram Joost <dbox2@frokaschwei.de> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, | ||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | * GNU General Public License for more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License | ||
| 21 | * along with this program; if not, write to the Free Software | ||
| 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 23 | * | ||
| 24 | * AT76C651 | ||
| 25 | * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf | ||
| 26 | * http://www.atmel.com/atmel/acrobat/doc1320.pdf | ||
| 27 | */ | ||
| 28 | |||
| 29 | #ifndef AT76C651_H | ||
| 30 | #define AT76C651_H | ||
| 31 | |||
| 32 | #include <linux/dvb/frontend.h> | ||
| 33 | |||
| 34 | struct at76c651_config | ||
| 35 | { | ||
| 36 | /* the demodulator's i2c address */ | ||
| 37 | u8 demod_address; | ||
| 38 | |||
| 39 | /* PLL maintenance */ | ||
| 40 | int (*pll_init)(struct dvb_frontend* fe); | ||
| 41 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
| 42 | }; | ||
| 43 | |||
| 44 | extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config, | ||
| 45 | struct i2c_adapter* i2c); | ||
| 46 | |||
| 47 | #endif // AT76C651_H | ||
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 1b9934ea5b06..4dcb6050d4fa 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
| @@ -326,11 +326,11 @@ struct dvb_pll_desc dvb_pll_tuv1236d = { | |||
| 326 | }; | 326 | }; |
| 327 | EXPORT_SYMBOL(dvb_pll_tuv1236d); | 327 | EXPORT_SYMBOL(dvb_pll_tuv1236d); |
| 328 | 328 | ||
| 329 | /* Samsung TBMV30111IN | 329 | /* Samsung TBMV30111IN / TBMV30712IN1 |
| 330 | * used in Air2PC ATSC - 2nd generation (nxt2002) | 330 | * used in Air2PC ATSC - 2nd generation (nxt2002) |
| 331 | */ | 331 | */ |
| 332 | struct dvb_pll_desc dvb_pll_tbmv30111in = { | 332 | struct dvb_pll_desc dvb_pll_samsung_tbmv = { |
| 333 | .name = "Samsung TBMV30111IN", | 333 | .name = "Samsung TBMV30111IN / TBMV30712IN1", |
| 334 | .min = 54000000, | 334 | .min = 54000000, |
| 335 | .max = 860000000, | 335 | .max = 860000000, |
| 336 | .count = 6, | 336 | .count = 6, |
| @@ -343,7 +343,7 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = { | |||
| 343 | { 999999999, 44000000, 166666, 0xfc, 0x02 }, | 343 | { 999999999, 44000000, 166666, 0xfc, 0x02 }, |
| 344 | } | 344 | } |
| 345 | }; | 345 | }; |
| 346 | EXPORT_SYMBOL(dvb_pll_tbmv30111in); | 346 | EXPORT_SYMBOL(dvb_pll_samsung_tbmv); |
| 347 | 347 | ||
| 348 | /* | 348 | /* |
| 349 | * Philips SD1878 Tuner. | 349 | * Philips SD1878 Tuner. |
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index f682c09189b3..bb8d4b4eb183 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
| @@ -38,7 +38,7 @@ extern struct dvb_pll_desc dvb_pll_tded4; | |||
| 38 | 38 | ||
| 39 | extern struct dvb_pll_desc dvb_pll_tuv1236d; | 39 | extern struct dvb_pll_desc dvb_pll_tuv1236d; |
| 40 | extern struct dvb_pll_desc dvb_pll_tdhu2; | 40 | extern struct dvb_pll_desc dvb_pll_tdhu2; |
| 41 | extern struct dvb_pll_desc dvb_pll_tbmv30111in; | 41 | extern struct dvb_pll_desc dvb_pll_samsung_tbmv; |
| 42 | extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261; | 42 | extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261; |
| 43 | 43 | ||
| 44 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 44 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c deleted file mode 100644 index 4f263e65ba14..000000000000 --- a/drivers/media/dvb/frontends/nxt2002.c +++ /dev/null | |||
| @@ -1,706 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Support for B2C2/BBTI Technisat Air2PC - ATSC | ||
| 3 | |||
| 4 | Copyright (C) 2004 Taylor Jacob <rtjacob@earthlink.net> | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2 of the License, or | ||
| 9 | (at your option) any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 19 | |||
| 20 | */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | * This driver needs external firmware. Please use the command | ||
| 24 | * "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to | ||
| 25 | * download/extract it, and then copy it to /usr/lib/hotplug/firmware | ||
| 26 | * or /lib/firmware (depending on configuration of firmware hotplug). | ||
| 27 | */ | ||
| 28 | #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" | ||
| 29 | #define CRC_CCIT_MASK 0x1021 | ||
| 30 | |||
| 31 | #include <linux/init.h> | ||
| 32 | #include <linux/module.h> | ||
| 33 | #include <linux/moduleparam.h> | ||
| 34 | #include <linux/device.h> | ||
| 35 | #include <linux/firmware.h> | ||
| 36 | #include <linux/string.h> | ||
| 37 | #include <linux/slab.h> | ||
| 38 | |||
| 39 | #include "dvb_frontend.h" | ||
| 40 | #include "nxt2002.h" | ||
| 41 | |||
| 42 | struct nxt2002_state { | ||
| 43 | |||
| 44 | struct i2c_adapter* i2c; | ||
| 45 | struct dvb_frontend_ops ops; | ||
| 46 | const struct nxt2002_config* config; | ||
| 47 | struct dvb_frontend frontend; | ||
| 48 | |||
| 49 | /* demodulator private data */ | ||
| 50 | u8 initialised:1; | ||
| 51 | }; | ||
| 52 | |||
| 53 | static int debug; | ||
| 54 | #define dprintk(args...) \ | ||
| 55 | do { \ | ||
| 56 | if (debug) printk(KERN_DEBUG "nxt2002: " args); \ | ||
| 57 | } while (0) | ||
| 58 | |||
| 59 | static int i2c_writebytes (struct nxt2002_state* state, u8 reg, u8 *buf, u8 len) | ||
| 60 | { | ||
| 61 | /* probbably a much better way or doing this */ | ||
| 62 | u8 buf2 [256],x; | ||
| 63 | int err; | ||
| 64 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; | ||
| 65 | |||
| 66 | buf2[0] = reg; | ||
| 67 | for (x = 0 ; x < len ; x++) | ||
| 68 | buf2[x+1] = buf[x]; | ||
| 69 | |||
| 70 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | ||
| 71 | printk ("%s: i2c write error (addr %02x, err == %i)\n", | ||
| 72 | __FUNCTION__, state->config->demod_address, err); | ||
| 73 | return -EREMOTEIO; | ||
| 74 | } | ||
| 75 | |||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | |||
| 79 | static u8 i2c_readbytes (struct nxt2002_state* state, u8 reg, u8* buf, u8 len) | ||
| 80 | { | ||
| 81 | u8 reg2 [] = { reg }; | ||
| 82 | |||
| 83 | struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = 1 }, | ||
| 84 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } }; | ||
| 85 | |||
| 86 | int err; | ||
| 87 | |||
| 88 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { | ||
| 89 | printk ("%s: i2c read error (addr %02x, err == %i)\n", | ||
| 90 | __FUNCTION__, state->config->demod_address, err); | ||
| 91 | return -EREMOTEIO; | ||
| 92 | } | ||
| 93 | |||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | static u16 nxt2002_crc(u16 crc, u8 c) | ||
| 98 | { | ||
| 99 | |||
| 100 | u8 i; | ||
| 101 | u16 input = (u16) c & 0xFF; | ||
| 102 | |||
| 103 | input<<=8; | ||
| 104 | for(i=0 ;i<8 ;i++) { | ||
| 105 | if((crc ^ input) & 0x8000) | ||
| 106 | crc=(crc<<1)^CRC_CCIT_MASK; | ||
| 107 | else | ||
| 108 | crc<<=1; | ||
| 109 | input<<=1; | ||
| 110 | } | ||
| 111 | return crc; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int nxt2002_writereg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len) | ||
| 115 | { | ||
| 116 | u8 buf; | ||
| 117 | dprintk("%s\n", __FUNCTION__); | ||
| 118 | |||
| 119 | /* set multi register length */ | ||
| 120 | i2c_writebytes(state,0x34,&len,1); | ||
| 121 | |||
| 122 | /* set mutli register register */ | ||
| 123 | i2c_writebytes(state,0x35,®,1); | ||
| 124 | |||
| 125 | /* send the actual data */ | ||
| 126 | i2c_writebytes(state,0x36,data,len); | ||
| 127 | |||
| 128 | /* toggle the multireg write bit*/ | ||
| 129 | buf = 0x02; | ||
| 130 | i2c_writebytes(state,0x21,&buf,1); | ||
| 131 | |||
| 132 | i2c_readbytes(state,0x21,&buf,1); | ||
| 133 | |||
| 134 | if ((buf & 0x02) == 0) | ||
| 135 | return 0; | ||
| 136 | |||
| 137 | dprintk("Error writing multireg register %02X\n",reg); | ||
| 138 | |||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | |||
| 142 | static int nxt2002_readreg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len) | ||
| 143 | { | ||
| 144 | u8 len2; | ||
| 145 | dprintk("%s\n", __FUNCTION__); | ||
| 146 | |||
| 147 | /* set multi register length */ | ||
| 148 | len2 = len & 0x80; | ||
| 149 | i2c_writebytes(state,0x34,&len2,1); | ||
| 150 | |||
| 151 | /* set mutli register register */ | ||
| 152 | i2c_writebytes(state,0x35,®,1); | ||
| 153 | |||
| 154 | /* send the actual data */ | ||
| 155 | i2c_readbytes(state,reg,data,len); | ||
| 156 | |||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | |||
| 160 | static void nxt2002_microcontroller_stop (struct nxt2002_state* state) | ||
| 161 | { | ||
| 162 | u8 buf[2],counter = 0; | ||
| 163 | dprintk("%s\n", __FUNCTION__); | ||
| 164 | |||
| 165 | buf[0] = 0x80; | ||
| 166 | i2c_writebytes(state,0x22,buf,1); | ||
| 167 | |||
| 168 | while (counter < 20) { | ||
| 169 | i2c_readbytes(state,0x31,buf,1); | ||
| 170 | if (buf[0] & 0x40) | ||
| 171 | return; | ||
| 172 | msleep(10); | ||
| 173 | counter++; | ||
| 174 | } | ||
| 175 | |||
| 176 | dprintk("Timeout waiting for micro to stop.. This is ok after firmware upload\n"); | ||
| 177 | return; | ||
| 178 | } | ||
| 179 | |||
| 180 | static void nxt2002_microcontroller_start (struct nxt2002_state* state) | ||
| 181 | { | ||
| 182 | u8 buf; | ||
| 183 | dprintk("%s\n", __FUNCTION__); | ||
| 184 | |||
| 185 | buf = 0x00; | ||
| 186 | i2c_writebytes(state,0x22,&buf,1); | ||
| 187 | } | ||
| 188 | |||
| 189 | static int nxt2002_writetuner (struct nxt2002_state* state, u8* data) | ||
| 190 | { | ||
| 191 | u8 buf,count = 0; | ||
| 192 | |||
| 193 | dprintk("Tuner Bytes: %02X %02X %02X %02X\n",data[0],data[1],data[2],data[3]); | ||
| 194 | |||
| 195 | dprintk("%s\n", __FUNCTION__); | ||
| 196 | /* stop the micro first */ | ||
| 197 | nxt2002_microcontroller_stop(state); | ||
| 198 | |||
| 199 | /* set the i2c transfer speed to the tuner */ | ||
| 200 | buf = 0x03; | ||
| 201 | i2c_writebytes(state,0x20,&buf,1); | ||
| 202 | |||
| 203 | /* setup to transfer 4 bytes via i2c */ | ||
| 204 | buf = 0x04; | ||
| 205 | i2c_writebytes(state,0x34,&buf,1); | ||
| 206 | |||
| 207 | /* write actual tuner bytes */ | ||
| 208 | i2c_writebytes(state,0x36,data,4); | ||
| 209 | |||
| 210 | /* set tuner i2c address */ | ||
| 211 | buf = 0xC2; | ||
| 212 | i2c_writebytes(state,0x35,&buf,1); | ||
| 213 | |||
| 214 | /* write UC Opmode to begin transfer */ | ||
| 215 | buf = 0x80; | ||
| 216 | i2c_writebytes(state,0x21,&buf,1); | ||
| 217 | |||
| 218 | while (count < 20) { | ||
| 219 | i2c_readbytes(state,0x21,&buf,1); | ||
| 220 | if ((buf & 0x80)== 0x00) | ||
| 221 | return 0; | ||
| 222 | msleep(100); | ||
| 223 | count++; | ||
| 224 | } | ||
| 225 | |||
| 226 | printk("nxt2002: timeout error writing tuner\n"); | ||
| 227 | return 0; | ||
| 228 | } | ||
| 229 | |||
| 230 | static void nxt2002_agc_reset(struct nxt2002_state* state) | ||
| 231 | { | ||
| 232 | u8 buf; | ||
| 233 | dprintk("%s\n", __FUNCTION__); | ||
| 234 | |||
| 235 | buf = 0x08; | ||
| 236 | i2c_writebytes(state,0x08,&buf,1); | ||
| 237 | |||
| 238 | buf = 0x00; | ||
| 239 | i2c_writebytes(state,0x08,&buf,1); | ||
| 240 | |||
| 241 | return; | ||
| 242 | } | ||
| 243 | |||
| 244 | static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) | ||
| 245 | { | ||
| 246 | |||
| 247 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 248 | u8 buf[256],written = 0,chunkpos = 0; | ||
| 249 | u16 rambase,position,crc = 0; | ||
| 250 | |||
| 251 | dprintk("%s\n", __FUNCTION__); | ||
| 252 | dprintk("Firmware is %zu bytes\n",fw->size); | ||
| 253 | |||
| 254 | /* Get the RAM base for this nxt2002 */ | ||
| 255 | i2c_readbytes(state,0x10,buf,1); | ||
| 256 | |||
| 257 | if (buf[0] & 0x10) | ||
| 258 | rambase = 0x1000; | ||
| 259 | else | ||
| 260 | rambase = 0x0000; | ||
| 261 | |||
| 262 | dprintk("rambase on this nxt2002 is %04X\n",rambase); | ||
| 263 | |||
| 264 | /* Hold the micro in reset while loading firmware */ | ||
| 265 | buf[0] = 0x80; | ||
| 266 | i2c_writebytes(state,0x2B,buf,1); | ||
| 267 | |||
| 268 | for (position = 0; position < fw->size ; position++) { | ||
| 269 | if (written == 0) { | ||
| 270 | crc = 0; | ||
| 271 | chunkpos = 0x28; | ||
| 272 | buf[0] = ((rambase + position) >> 8); | ||
| 273 | buf[1] = (rambase + position) & 0xFF; | ||
| 274 | buf[2] = 0x81; | ||
| 275 | /* write starting address */ | ||
| 276 | i2c_writebytes(state,0x29,buf,3); | ||
| 277 | } | ||
| 278 | written++; | ||
| 279 | chunkpos++; | ||
| 280 | |||
| 281 | if ((written % 4) == 0) | ||
| 282 | i2c_writebytes(state,chunkpos,&fw->data[position-3],4); | ||
| 283 | |||
| 284 | crc = nxt2002_crc(crc,fw->data[position]); | ||
| 285 | |||
| 286 | if ((written == 255) || (position+1 == fw->size)) { | ||
| 287 | /* write remaining bytes of firmware */ | ||
| 288 | i2c_writebytes(state, chunkpos+4-(written %4), | ||
| 289 | &fw->data[position-(written %4) + 1], | ||
| 290 | written %4); | ||
| 291 | buf[0] = crc << 8; | ||
| 292 | buf[1] = crc & 0xFF; | ||
| 293 | |||
| 294 | /* write crc */ | ||
| 295 | i2c_writebytes(state,0x2C,buf,2); | ||
| 296 | |||
| 297 | /* do a read to stop things */ | ||
| 298 | i2c_readbytes(state,0x2A,buf,1); | ||
| 299 | |||
| 300 | /* set transfer mode to complete */ | ||
| 301 | buf[0] = 0x80; | ||
| 302 | i2c_writebytes(state,0x2B,buf,1); | ||
| 303 | |||
| 304 | written = 0; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | printk ("done.\n"); | ||
| 309 | return 0; | ||
| 310 | }; | ||
| 311 | |||
| 312 | static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe, | ||
| 313 | struct dvb_frontend_parameters *p) | ||
| 314 | { | ||
| 315 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 316 | u32 freq = 0; | ||
| 317 | u16 tunerfreq = 0; | ||
| 318 | u8 buf[4]; | ||
| 319 | |||
| 320 | freq = 44000 + ( p->frequency / 1000 ); | ||
| 321 | |||
| 322 | dprintk("freq = %d p->frequency = %d\n",freq,p->frequency); | ||
| 323 | |||
| 324 | tunerfreq = freq * 24/4000; | ||
| 325 | |||
| 326 | buf[0] = (tunerfreq >> 8) & 0x7F; | ||
| 327 | buf[1] = (tunerfreq & 0xFF); | ||
| 328 | |||
| 329 | if (p->frequency <= 214000000) { | ||
| 330 | buf[2] = 0x84 + (0x06 << 3); | ||
| 331 | buf[3] = (p->frequency <= 172000000) ? 0x01 : 0x02; | ||
| 332 | } else if (p->frequency <= 721000000) { | ||
| 333 | buf[2] = 0x84 + (0x07 << 3); | ||
| 334 | buf[3] = (p->frequency <= 467000000) ? 0x02 : 0x08; | ||
| 335 | } else if (p->frequency <= 841000000) { | ||
| 336 | buf[2] = 0x84 + (0x0E << 3); | ||
| 337 | buf[3] = 0x08; | ||
| 338 | } else { | ||
| 339 | buf[2] = 0x84 + (0x0F << 3); | ||
| 340 | buf[3] = 0x02; | ||
| 341 | } | ||
| 342 | |||
| 343 | /* write frequency information */ | ||
| 344 | nxt2002_writetuner(state,buf); | ||
| 345 | |||
| 346 | /* reset the agc now that tuning has been completed */ | ||
| 347 | nxt2002_agc_reset(state); | ||
| 348 | |||
| 349 | /* set target power level */ | ||
| 350 | switch (p->u.vsb.modulation) { | ||
| 351 | case QAM_64: | ||
| 352 | case QAM_256: | ||
| 353 | buf[0] = 0x74; | ||
| 354 | break; | ||
| 355 | case VSB_8: | ||
| 356 | buf[0] = 0x70; | ||
| 357 | break; | ||
| 358 | default: | ||
| 359 | return -EINVAL; | ||
| 360 | break; | ||
| 361 | } | ||
| 362 | i2c_writebytes(state,0x42,buf,1); | ||
| 363 | |||
| 364 | /* configure sdm */ | ||
| 365 | buf[0] = 0x87; | ||
| 366 | i2c_writebytes(state,0x57,buf,1); | ||
| 367 | |||
| 368 | /* write sdm1 input */ | ||
| 369 | buf[0] = 0x10; | ||
| 370 | buf[1] = 0x00; | ||
| 371 | nxt2002_writereg_multibyte(state,0x58,buf,2); | ||
| 372 | |||
| 373 | /* write sdmx input */ | ||
| 374 | switch (p->u.vsb.modulation) { | ||
| 375 | case QAM_64: | ||
| 376 | buf[0] = 0x68; | ||
| 377 | break; | ||
| 378 | case QAM_256: | ||
| 379 | buf[0] = 0x64; | ||
| 380 | break; | ||
| 381 | case VSB_8: | ||
| 382 | buf[0] = 0x60; | ||
| 383 | break; | ||
| 384 | default: | ||
| 385 | return -EINVAL; | ||
| 386 | break; | ||
| 387 | } | ||
| 388 | buf[1] = 0x00; | ||
| 389 | nxt2002_writereg_multibyte(state,0x5C,buf,2); | ||
| 390 | |||
| 391 | /* write adc power lpf fc */ | ||
| 392 | buf[0] = 0x05; | ||
| 393 | i2c_writebytes(state,0x43,buf,1); | ||
| 394 | |||
| 395 | /* write adc power lpf fc */ | ||
| 396 | buf[0] = 0x05; | ||
| 397 | i2c_writebytes(state,0x43,buf,1); | ||
| 398 | |||
| 399 | /* write accumulator2 input */ | ||
| 400 | buf[0] = 0x80; | ||
| 401 | buf[1] = 0x00; | ||
| 402 | nxt2002_writereg_multibyte(state,0x4B,buf,2); | ||
| 403 | |||
| 404 | /* write kg1 */ | ||
| 405 | buf[0] = 0x00; | ||
| 406 | i2c_writebytes(state,0x4D,buf,1); | ||
| 407 | |||
| 408 | /* write sdm12 lpf fc */ | ||
| 409 | buf[0] = 0x44; | ||
| 410 | i2c_writebytes(state,0x55,buf,1); | ||
| 411 | |||
| 412 | /* write agc control reg */ | ||
| 413 | buf[0] = 0x04; | ||
| 414 | i2c_writebytes(state,0x41,buf,1); | ||
| 415 | |||
| 416 | /* write agc ucgp0 */ | ||
| 417 | switch (p->u.vsb.modulation) { | ||
| 418 | case QAM_64: | ||
| 419 | buf[0] = 0x02; | ||
| 420 | break; | ||
| 421 | case QAM_256: | ||
| 422 | buf[0] = 0x03; | ||
| 423 | break; | ||
| 424 | case VSB_8: | ||
| 425 | buf[0] = 0x00; | ||
| 426 | break; | ||
| 427 | default: | ||
| 428 | return -EINVAL; | ||
| 429 | break; | ||
| 430 | } | ||
| 431 | i2c_writebytes(state,0x30,buf,1); | ||
| 432 | |||
| 433 | /* write agc control reg */ | ||
| 434 | buf[0] = 0x00; | ||
| 435 | i2c_writebytes(state,0x41,buf,1); | ||
| 436 | |||
| 437 | /* write accumulator2 input */ | ||
| 438 | buf[0] = 0x80; | ||
| 439 | buf[1] = 0x00; | ||
| 440 | nxt2002_writereg_multibyte(state,0x49,buf,2); | ||
| 441 | nxt2002_writereg_multibyte(state,0x4B,buf,2); | ||
| 442 | |||
| 443 | /* write agc control reg */ | ||
| 444 | buf[0] = 0x04; | ||
| 445 | i2c_writebytes(state,0x41,buf,1); | ||
| 446 | |||
| 447 | nxt2002_microcontroller_start(state); | ||
| 448 | |||
| 449 | /* adjacent channel detection should be done here, but I don't | ||
| 450 | have any stations with this need so I cannot test it */ | ||
| 451 | |||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
| 456 | { | ||
| 457 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 458 | u8 lock; | ||
| 459 | i2c_readbytes(state,0x31,&lock,1); | ||
| 460 | |||
| 461 | *status = 0; | ||
| 462 | if (lock & 0x20) { | ||
| 463 | *status |= FE_HAS_SIGNAL; | ||
| 464 | *status |= FE_HAS_CARRIER; | ||
| 465 | *status |= FE_HAS_VITERBI; | ||
| 466 | *status |= FE_HAS_SYNC; | ||
| 467 | *status |= FE_HAS_LOCK; | ||
| 468 | } | ||
| 469 | return 0; | ||
| 470 | } | ||
| 471 | |||
| 472 | static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber) | ||
| 473 | { | ||
| 474 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 475 | u8 b[3]; | ||
| 476 | |||
| 477 | nxt2002_readreg_multibyte(state,0xE6,b,3); | ||
| 478 | |||
| 479 | *ber = ((b[0] << 8) + b[1]) * 8; | ||
| 480 | |||
| 481 | return 0; | ||
| 482 | } | ||
| 483 | |||
| 484 | static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
| 485 | { | ||
| 486 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 487 | u8 b[2]; | ||
| 488 | u16 temp = 0; | ||
| 489 | |||
| 490 | /* setup to read cluster variance */ | ||
| 491 | b[0] = 0x00; | ||
| 492 | i2c_writebytes(state,0xA1,b,1); | ||
| 493 | |||
| 494 | /* get multreg val */ | ||
| 495 | nxt2002_readreg_multibyte(state,0xA6,b,2); | ||
| 496 | |||
| 497 | temp = (b[0] << 8) | b[1]; | ||
| 498 | *strength = ((0x7FFF - temp) & 0x0FFF) * 16; | ||
| 499 | |||
| 500 | return 0; | ||
| 501 | } | ||
| 502 | |||
| 503 | static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr) | ||
| 504 | { | ||
| 505 | |||
| 506 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 507 | u8 b[2]; | ||
| 508 | u16 temp = 0, temp2; | ||
| 509 | u32 snrdb = 0; | ||
| 510 | |||
| 511 | /* setup to read cluster variance */ | ||
| 512 | b[0] = 0x00; | ||
| 513 | i2c_writebytes(state,0xA1,b,1); | ||
| 514 | |||
| 515 | /* get multreg val from 0xA6 */ | ||
| 516 | nxt2002_readreg_multibyte(state,0xA6,b,2); | ||
| 517 | |||
| 518 | temp = (b[0] << 8) | b[1]; | ||
| 519 | temp2 = 0x7FFF - temp; | ||
| 520 | |||
| 521 | /* snr will be in db */ | ||
| 522 | if (temp2 > 0x7F00) | ||
| 523 | snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) ); | ||
| 524 | else if (temp2 > 0x7EC0) | ||
| 525 | snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) ); | ||
| 526 | else if (temp2 > 0x7C00) | ||
| 527 | snrdb = 1000*12 + ( 1000*(18-12) * ( temp2 - 0x7C00 ) / ( 0x7EC0 - 0x7C00 ) ); | ||
| 528 | else | ||
| 529 | snrdb = 1000*0 + ( 1000*(12-0) * ( temp2 - 0 ) / ( 0x7C00 - 0 ) ); | ||
| 530 | |||
| 531 | /* the value reported back from the frontend will be FFFF=32db 0000=0db */ | ||
| 532 | |||
| 533 | *snr = snrdb * (0xFFFF/32000); | ||
| 534 | |||
| 535 | return 0; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
| 539 | { | ||
| 540 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 541 | u8 b[3]; | ||
| 542 | |||
| 543 | nxt2002_readreg_multibyte(state,0xE6,b,3); | ||
| 544 | *ucblocks = b[2]; | ||
| 545 | |||
| 546 | return 0; | ||
| 547 | } | ||
| 548 | |||
| 549 | static int nxt2002_sleep(struct dvb_frontend* fe) | ||
| 550 | { | ||
| 551 | return 0; | ||
| 552 | } | ||
| 553 | |||
| 554 | static int nxt2002_init(struct dvb_frontend* fe) | ||
| 555 | { | ||
| 556 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 557 | const struct firmware *fw; | ||
| 558 | int ret; | ||
| 559 | u8 buf[2]; | ||
| 560 | |||
| 561 | if (!state->initialised) { | ||
| 562 | /* request the firmware, this will block until someone uploads it */ | ||
| 563 | printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE); | ||
| 564 | ret = state->config->request_firmware(fe, &fw, NXT2002_DEFAULT_FIRMWARE); | ||
| 565 | printk("nxt2002: Waiting for firmware upload(2)...\n"); | ||
| 566 | if (ret) { | ||
| 567 | printk("nxt2002: no firmware upload (timeout or file not found?)\n"); | ||
| 568 | return ret; | ||
| 569 | } | ||
| 570 | |||
| 571 | ret = nxt2002_load_firmware(fe, fw); | ||
| 572 | if (ret) { | ||
| 573 | printk("nxt2002: writing firmware to device failed\n"); | ||
| 574 | release_firmware(fw); | ||
| 575 | return ret; | ||
| 576 | } | ||
| 577 | printk("nxt2002: firmware upload complete\n"); | ||
| 578 | |||
| 579 | /* Put the micro into reset */ | ||
| 580 | nxt2002_microcontroller_stop(state); | ||
| 581 | |||
| 582 | /* ensure transfer is complete */ | ||
| 583 | buf[0]=0; | ||
| 584 | i2c_writebytes(state,0x2B,buf,1); | ||
| 585 | |||
| 586 | /* Put the micro into reset for real this time */ | ||
| 587 | nxt2002_microcontroller_stop(state); | ||
| 588 | |||
| 589 | /* soft reset everything (agc,frontend,eq,fec)*/ | ||
| 590 | buf[0] = 0x0F; | ||
| 591 | i2c_writebytes(state,0x08,buf,1); | ||
| 592 | buf[0] = 0x00; | ||
| 593 | i2c_writebytes(state,0x08,buf,1); | ||
| 594 | |||
| 595 | /* write agc sdm configure */ | ||
| 596 | buf[0] = 0xF1; | ||
| 597 | i2c_writebytes(state,0x57,buf,1); | ||
| 598 | |||
| 599 | /* write mod output format */ | ||
| 600 | buf[0] = 0x20; | ||
| 601 | i2c_writebytes(state,0x09,buf,1); | ||
| 602 | |||
| 603 | /* write fec mpeg mode */ | ||
| 604 | buf[0] = 0x7E; | ||
| 605 | buf[1] = 0x00; | ||
| 606 | i2c_writebytes(state,0xE9,buf,2); | ||
| 607 | |||
| 608 | /* write mux selection */ | ||
| 609 | buf[0] = 0x00; | ||
| 610 | i2c_writebytes(state,0xCC,buf,1); | ||
| 611 | |||
| 612 | state->initialised = 1; | ||
| 613 | } | ||
| 614 | |||
| 615 | return 0; | ||
| 616 | } | ||
| 617 | |||
| 618 | static int nxt2002_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | ||
| 619 | { | ||
| 620 | fesettings->min_delay_ms = 500; | ||
| 621 | fesettings->step_size = 0; | ||
| 622 | fesettings->max_drift = 0; | ||
| 623 | return 0; | ||
| 624 | } | ||
| 625 | |||
| 626 | static void nxt2002_release(struct dvb_frontend* fe) | ||
| 627 | { | ||
| 628 | struct nxt2002_state* state = fe->demodulator_priv; | ||
| 629 | kfree(state); | ||
| 630 | } | ||
| 631 | |||
| 632 | static struct dvb_frontend_ops nxt2002_ops; | ||
| 633 | |||
| 634 | struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config, | ||
| 635 | struct i2c_adapter* i2c) | ||
| 636 | { | ||
| 637 | struct nxt2002_state* state = NULL; | ||
| 638 | u8 buf [] = {0,0,0,0,0}; | ||
| 639 | |||
| 640 | /* allocate memory for the internal state */ | ||
| 641 | state = kmalloc(sizeof(struct nxt2002_state), GFP_KERNEL); | ||
| 642 | if (state == NULL) goto error; | ||
| 643 | |||
| 644 | /* setup the state */ | ||
| 645 | state->config = config; | ||
| 646 | state->i2c = i2c; | ||
| 647 | memcpy(&state->ops, &nxt2002_ops, sizeof(struct dvb_frontend_ops)); | ||
| 648 | state->initialised = 0; | ||
| 649 | |||
| 650 | /* Check the first 5 registers to ensure this a revision we can handle */ | ||
| 651 | |||
| 652 | i2c_readbytes(state, 0x00, buf, 5); | ||
| 653 | if (buf[0] != 0x04) goto error; /* device id */ | ||
| 654 | if (buf[1] != 0x02) goto error; /* fab id */ | ||
| 655 | if (buf[2] != 0x11) goto error; /* month */ | ||
| 656 | if (buf[3] != 0x20) goto error; /* year msb */ | ||
| 657 | if (buf[4] != 0x00) goto error; /* year lsb */ | ||
| 658 | |||
| 659 | /* create dvb_frontend */ | ||
| 660 | state->frontend.ops = &state->ops; | ||
| 661 | state->frontend.demodulator_priv = state; | ||
| 662 | return &state->frontend; | ||
| 663 | |||
| 664 | error: | ||
| 665 | kfree(state); | ||
| 666 | return NULL; | ||
| 667 | } | ||
| 668 | |||
| 669 | static struct dvb_frontend_ops nxt2002_ops = { | ||
| 670 | |||
| 671 | .info = { | ||
| 672 | .name = "Nextwave nxt2002 VSB/QAM frontend", | ||
| 673 | .type = FE_ATSC, | ||
| 674 | .frequency_min = 54000000, | ||
| 675 | .frequency_max = 860000000, | ||
| 676 | /* stepsize is just a guess */ | ||
| 677 | .frequency_stepsize = 166666, | ||
| 678 | .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
| 679 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
| 680 | FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256 | ||
| 681 | }, | ||
| 682 | |||
| 683 | .release = nxt2002_release, | ||
| 684 | |||
| 685 | .init = nxt2002_init, | ||
| 686 | .sleep = nxt2002_sleep, | ||
| 687 | |||
| 688 | .set_frontend = nxt2002_setup_frontend_parameters, | ||
| 689 | .get_tune_settings = nxt2002_get_tune_settings, | ||
| 690 | |||
| 691 | .read_status = nxt2002_read_status, | ||
| 692 | .read_ber = nxt2002_read_ber, | ||
| 693 | .read_signal_strength = nxt2002_read_signal_strength, | ||
| 694 | .read_snr = nxt2002_read_snr, | ||
| 695 | .read_ucblocks = nxt2002_read_ucblocks, | ||
| 696 | |||
| 697 | }; | ||
| 698 | |||
| 699 | module_param(debug, int, 0644); | ||
| 700 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | ||
| 701 | |||
| 702 | MODULE_DESCRIPTION("NXT2002 ATSC (8VSB & ITU J83 AnnexB FEC QAM64/256) demodulator driver"); | ||
| 703 | MODULE_AUTHOR("Taylor Jacob"); | ||
| 704 | MODULE_LICENSE("GPL"); | ||
| 705 | |||
| 706 | EXPORT_SYMBOL(nxt2002_attach); | ||
diff --git a/drivers/media/dvb/frontends/nxt2002.h b/drivers/media/dvb/frontends/nxt2002.h deleted file mode 100644 index 462301f577ee..000000000000 --- a/drivers/media/dvb/frontends/nxt2002.h +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Driver for the Nxt2002 demodulator | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef NXT2002_H | ||
| 6 | #define NXT2002_H | ||
| 7 | |||
| 8 | #include <linux/dvb/frontend.h> | ||
| 9 | #include <linux/firmware.h> | ||
| 10 | |||
| 11 | struct nxt2002_config | ||
| 12 | { | ||
| 13 | /* the demodulator's i2c address */ | ||
| 14 | u8 demod_address; | ||
| 15 | |||
| 16 | /* request firmware for device */ | ||
| 17 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
| 18 | }; | ||
| 19 | |||
| 20 | extern struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config, | ||
| 21 | struct i2c_adapter* i2c); | ||
| 22 | |||
| 23 | #endif // NXT2002_H | ||
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 78d2b93d35b9..9e3535394509 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Support for NXT2002 and NXT2004 - VSB/QAM | 2 | * Support for NXT2002 and NXT2004 - VSB/QAM |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005 Kirk Lapray (kirk.lapray@gmail.com) | 4 | * Copyright (C) 2005 Kirk Lapray <kirk.lapray@gmail.com> |
| 5 | * Copyright (C) 2006 Michael Krufky <mkrufky@m1k.net> | ||
| 5 | * based on nxt2002 by Taylor Jacob <rtjacob@earthlink.net> | 6 | * based on nxt2002 by Taylor Jacob <rtjacob@earthlink.net> |
| 6 | * and nxt2004 by Jean-Francois Thibert (jeanfrancois@sagetv.com) | 7 | * and nxt2004 by Jean-Francois Thibert <jeanfrancois@sagetv.com> |
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
| @@ -614,7 +615,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 614 | /* write sdm1 input */ | 615 | /* write sdm1 input */ |
| 615 | buf[0] = 0x10; | 616 | buf[0] = 0x10; |
| 616 | buf[1] = 0x00; | 617 | buf[1] = 0x00; |
| 617 | nxt200x_writebytes(state, 0x58, buf, 2); | 618 | switch (state->demod_chip) { |
| 619 | case NXT2002: | ||
| 620 | nxt200x_writereg_multibyte(state, 0x58, buf, 2); | ||
| 621 | break; | ||
| 622 | case NXT2004: | ||
| 623 | nxt200x_writebytes(state, 0x58, buf, 2); | ||
| 624 | break; | ||
| 625 | default: | ||
| 626 | return -EINVAL; | ||
| 627 | break; | ||
| 628 | } | ||
| 618 | 629 | ||
| 619 | /* write sdmx input */ | 630 | /* write sdmx input */ |
| 620 | switch (p->u.vsb.modulation) { | 631 | switch (p->u.vsb.modulation) { |
| @@ -632,7 +643,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 632 | break; | 643 | break; |
| 633 | } | 644 | } |
| 634 | buf[1] = 0x00; | 645 | buf[1] = 0x00; |
| 635 | nxt200x_writebytes(state, 0x5C, buf, 2); | 646 | switch (state->demod_chip) { |
| 647 | case NXT2002: | ||
| 648 | nxt200x_writereg_multibyte(state, 0x5C, buf, 2); | ||
| 649 | break; | ||
| 650 | case NXT2004: | ||
| 651 | nxt200x_writebytes(state, 0x5C, buf, 2); | ||
| 652 | break; | ||
| 653 | default: | ||
| 654 | return -EINVAL; | ||
| 655 | break; | ||
| 656 | } | ||
| 636 | 657 | ||
| 637 | /* write adc power lpf fc */ | 658 | /* write adc power lpf fc */ |
| 638 | buf[0] = 0x05; | 659 | buf[0] = 0x05; |
| @@ -648,7 +669,17 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 648 | /* write accumulator2 input */ | 669 | /* write accumulator2 input */ |
| 649 | buf[0] = 0x80; | 670 | buf[0] = 0x80; |
| 650 | buf[1] = 0x00; | 671 | buf[1] = 0x00; |
| 651 | nxt200x_writebytes(state, 0x4B, buf, 2); | 672 | switch (state->demod_chip) { |
| 673 | case NXT2002: | ||
| 674 | nxt200x_writereg_multibyte(state, 0x4B, buf, 2); | ||
| 675 | break; | ||
| 676 | case NXT2004: | ||
| 677 | nxt200x_writebytes(state, 0x4B, buf, 2); | ||
| 678 | break; | ||
| 679 | default: | ||
| 680 | return -EINVAL; | ||
| 681 | break; | ||
| 682 | } | ||
| 652 | 683 | ||
| 653 | /* write kg1 */ | 684 | /* write kg1 */ |
| 654 | buf[0] = 0x00; | 685 | buf[0] = 0x00; |
| @@ -714,8 +745,19 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 714 | /* write accumulator2 input */ | 745 | /* write accumulator2 input */ |
| 715 | buf[0] = 0x80; | 746 | buf[0] = 0x80; |
| 716 | buf[1] = 0x00; | 747 | buf[1] = 0x00; |
| 717 | nxt200x_writebytes(state, 0x49, buf,2); | 748 | switch (state->demod_chip) { |
| 718 | nxt200x_writebytes(state, 0x4B, buf,2); | 749 | case NXT2002: |
| 750 | nxt200x_writereg_multibyte(state, 0x49, buf, 2); | ||
| 751 | nxt200x_writereg_multibyte(state, 0x4B, buf, 2); | ||
| 752 | break; | ||
| 753 | case NXT2004: | ||
| 754 | nxt200x_writebytes(state, 0x49, buf, 2); | ||
| 755 | nxt200x_writebytes(state, 0x4B, buf, 2); | ||
| 756 | break; | ||
| 757 | default: | ||
| 758 | return -EINVAL; | ||
| 759 | break; | ||
| 760 | } | ||
| 719 | 761 | ||
| 720 | /* write agc control reg */ | 762 | /* write agc control reg */ |
| 721 | buf[0] = 0x04; | 763 | buf[0] = 0x04; |
| @@ -1199,7 +1241,7 @@ module_param(debug, int, 0644); | |||
| 1199 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | 1241 | MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
| 1200 | 1242 | ||
| 1201 | MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); | 1243 | MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver"); |
| 1202 | MODULE_AUTHOR("Kirk Lapray, Jean-Francois Thibert, and Taylor Jacob"); | 1244 | MODULE_AUTHOR("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob"); |
| 1203 | MODULE_LICENSE("GPL"); | 1245 | MODULE_LICENSE("GPL"); |
| 1204 | 1246 | ||
| 1205 | EXPORT_SYMBOL(nxt200x_attach); | 1247 | EXPORT_SYMBOL(nxt200x_attach); |
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c deleted file mode 100644 index d1cabb6a0a13..000000000000 --- a/drivers/media/dvb/frontends/tda80xx.c +++ /dev/null | |||
| @@ -1,734 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * tda80xx.c | ||
| 3 | * | ||
| 4 | * Philips TDA8044 / TDA8083 QPSK demodulator driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2001 Felix Domke <tmbinc@elitedvb.net> | ||
| 7 | * Copyright (C) 2002-2004 Andreas Oberritter <obi@linuxtv.org> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | * (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License | ||
| 20 | * along with this program; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include <linux/config.h> | ||
| 25 | #include <linux/delay.h> | ||
| 26 | #include <linux/init.h> | ||
| 27 | #include <linux/spinlock.h> | ||
| 28 | #include <linux/threads.h> | ||
| 29 | #include <linux/interrupt.h> | ||
| 30 | #include <linux/kernel.h> | ||
| 31 | #include <linux/module.h> | ||
| 32 | #include <linux/slab.h> | ||
| 33 | #include <asm/irq.h> | ||
| 34 | #include <asm/div64.h> | ||
| 35 | |||
| 36 | #include "dvb_frontend.h" | ||
| 37 | #include "tda80xx.h" | ||
| 38 | |||
| 39 | enum { | ||
| 40 | ID_TDA8044 = 0x04, | ||
| 41 | ID_TDA8083 = 0x05, | ||
| 42 | }; | ||
| 43 | |||
| 44 | |||
| 45 | struct tda80xx_state { | ||
| 46 | |||
| 47 | struct i2c_adapter* i2c; | ||
| 48 | |||
| 49 | struct dvb_frontend_ops ops; | ||
| 50 | |||
| 51 | /* configuration settings */ | ||
| 52 | const struct tda80xx_config* config; | ||
| 53 | |||
| 54 | struct dvb_frontend frontend; | ||
| 55 | |||
| 56 | u32 clk; | ||
| 57 | int afc_loop; | ||
| 58 | struct work_struct worklet; | ||
| 59 | fe_code_rate_t code_rate; | ||
| 60 | fe_spectral_inversion_t spectral_inversion; | ||
| 61 | fe_status_t status; | ||
| 62 | u8 id; | ||
| 63 | }; | ||
| 64 | |||
| 65 | static int debug = 1; | ||
| 66 | #define dprintk if (debug) printk | ||
| 67 | |||
| 68 | static u8 tda8044_inittab_pre[] = { | ||
| 69 | 0x02, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea, | ||
| 70 | 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x58, | ||
| 71 | 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68, | ||
| 72 | 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x00, | ||
| 73 | 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 74 | 0x00, 0x00 | ||
| 75 | }; | ||
| 76 | |||
| 77 | static u8 tda8044_inittab_post[] = { | ||
| 78 | 0x04, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea, | ||
| 79 | 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x50, | ||
| 80 | 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68, | ||
| 81 | 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x6c, | ||
| 82 | 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 83 | 0x00, 0x00 | ||
| 84 | }; | ||
| 85 | |||
| 86 | static u8 tda8083_inittab[] = { | ||
| 87 | 0x04, 0x00, 0x4a, 0x79, 0x04, 0x00, 0xff, 0xea, | ||
| 88 | 0x48, 0x42, 0x79, 0x60, 0x70, 0x52, 0x9a, 0x10, | ||
| 89 | 0x0e, 0x10, 0xf2, 0xa7, 0x93, 0x0b, 0x05, 0xc8, | ||
| 90 | 0x9d, 0x00, 0x42, 0x80, 0x00, 0x60, 0x40, 0x00, | ||
| 91 | 0x00, 0x75, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, | ||
| 92 | 0x00, 0x00, 0x00, 0x00 | ||
| 93 | }; | ||
| 94 | |||
| 95 | static __inline__ u32 tda80xx_div(u32 a, u32 b) | ||
| 96 | { | ||
| 97 | return (a + (b / 2)) / b; | ||
| 98 | } | ||
| 99 | |||
| 100 | static __inline__ u32 tda80xx_gcd(u32 a, u32 b) | ||
| 101 | { | ||
| 102 | u32 r; | ||
| 103 | |||
| 104 | while ((r = a % b)) { | ||
| 105 | a = b; | ||
| 106 | b = r; | ||
| 107 | } | ||
| 108 | |||
| 109 | return b; | ||
| 110 | } | ||
| 111 | |||
| 112 | static int tda80xx_read(struct tda80xx_state* state, u8 reg, u8 *buf, u8 len) | ||
| 113 | { | ||
| 114 | int ret; | ||
| 115 | struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 }, | ||
| 116 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } }; | ||
| 117 | |||
| 118 | ret = i2c_transfer(state->i2c, msg, 2); | ||
| 119 | |||
| 120 | if (ret != 2) | ||
| 121 | dprintk("%s: readreg error (reg %02x, ret == %i)\n", | ||
| 122 | __FUNCTION__, reg, ret); | ||
| 123 | |||
| 124 | mdelay(10); | ||
| 125 | |||
| 126 | return (ret == 2) ? 0 : -EREMOTEIO; | ||
| 127 | } | ||
| 128 | |||
| 129 | static int tda80xx_write(struct tda80xx_state* state, u8 reg, const u8 *buf, u8 len) | ||
| 130 | { | ||
| 131 | int ret; | ||
| 132 | u8 wbuf[len + 1]; | ||
| 133 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = wbuf, .len = len + 1 }; | ||
| 134 | |||
| 135 | wbuf[0] = reg; | ||
| 136 | memcpy(&wbuf[1], buf, len); | ||
| 137 | |||
| 138 | ret = i2c_transfer(state->i2c, &msg, 1); | ||
| 139 | |||
| 140 | if (ret != 1) | ||
| 141 | dprintk("%s: i2c xfer error (ret == %i)\n", __FUNCTION__, ret); | ||
| 142 | |||
| 143 | mdelay(10); | ||
| 144 | |||
| 145 | return (ret == 1) ? 0 : -EREMOTEIO; | ||
| 146 | } | ||
| 147 | |||
| 148 | static __inline__ u8 tda80xx_readreg(struct tda80xx_state* state, u8 reg) | ||
| 149 | { | ||
| 150 | u8 val; | ||
| 151 | |||
| 152 | tda80xx_read(state, reg, &val, 1); | ||
| 153 | |||
| 154 | return val; | ||
| 155 | } | ||
| 156 | |||
| 157 | static __inline__ int tda80xx_writereg(struct tda80xx_state* state, u8 reg, u8 data) | ||
| 158 | { | ||
| 159 | return tda80xx_write(state, reg, &data, 1); | ||
| 160 | } | ||
| 161 | |||
| 162 | static int tda80xx_set_parameters(struct tda80xx_state* state, | ||
| 163 | fe_spectral_inversion_t inversion, | ||
| 164 | u32 symbol_rate, | ||
| 165 | fe_code_rate_t fec_inner) | ||
| 166 | { | ||
| 167 | u8 buf[15]; | ||
| 168 | u64 ratio; | ||
| 169 | u32 clk; | ||
| 170 | u32 k; | ||
| 171 | u32 sr = symbol_rate; | ||
| 172 | u32 gcd; | ||
| 173 | u8 scd; | ||
| 174 | |||
| 175 | if (symbol_rate > (state->clk * 3) / 16) | ||
| 176 | scd = 0; | ||
| 177 | else if (symbol_rate > (state->clk * 3) / 32) | ||
| 178 | scd = 1; | ||
| 179 | else if (symbol_rate > (state->clk * 3) / 64) | ||
| 180 | scd = 2; | ||
| 181 | else | ||
| 182 | scd = 3; | ||
| 183 | |||
| 184 | clk = scd ? (state->clk / (scd * 2)) : state->clk; | ||
| 185 | |||
| 186 | /* | ||
| 187 | * Viterbi decoder: | ||
| 188 | * Differential decoding off | ||
| 189 | * Spectral inversion unknown | ||
| 190 | * QPSK modulation | ||
| 191 | */ | ||
| 192 | if (inversion == INVERSION_ON) | ||
| 193 | buf[0] = 0x60; | ||
| 194 | else if (inversion == INVERSION_OFF) | ||
| 195 | buf[0] = 0x20; | ||
| 196 | else | ||
| 197 | buf[0] = 0x00; | ||
| 198 | |||
| 199 | /* | ||
| 200 | * CLK ratio: | ||
| 201 | * system clock frequency is up to 64 or 96 MHz | ||
| 202 | * | ||
| 203 | * formula: | ||
| 204 | * r = k * clk / symbol_rate | ||
| 205 | * | ||
| 206 | * k: 2^21 for caa 0..3, | ||
| 207 | * 2^20 for caa 4..5, | ||
| 208 | * 2^19 for caa 6..7 | ||
| 209 | */ | ||
| 210 | if (symbol_rate <= (clk * 3) / 32) | ||
| 211 | k = (1 << 19); | ||
| 212 | else if (symbol_rate <= (clk * 3) / 16) | ||
| 213 | k = (1 << 20); | ||
| 214 | else | ||
| 215 | k = (1 << 21); | ||
| 216 | |||
| 217 | gcd = tda80xx_gcd(clk, sr); | ||
| 218 | clk /= gcd; | ||
| 219 | sr /= gcd; | ||
| 220 | |||
| 221 | gcd = tda80xx_gcd(k, sr); | ||
| 222 | k /= gcd; | ||
| 223 | sr /= gcd; | ||
| 224 | |||
| 225 | ratio = (u64)k * (u64)clk; | ||
| 226 | do_div(ratio, sr); | ||
| 227 | |||
| 228 | buf[1] = ratio >> 16; | ||
| 229 | buf[2] = ratio >> 8; | ||
| 230 | buf[3] = ratio; | ||
| 231 | |||
| 232 | /* nyquist filter roll-off factor 35% */ | ||
| 233 | buf[4] = 0x20; | ||
| 234 | |||
| 235 | clk = scd ? (state->clk / (scd * 2)) : state->clk; | ||
| 236 | |||
| 237 | /* Anti Alias Filter */ | ||
| 238 | if (symbol_rate < (clk * 3) / 64) | ||
| 239 | printk("tda80xx: unsupported symbol rate: %u\n", symbol_rate); | ||
| 240 | else if (symbol_rate <= clk / 16) | ||
| 241 | buf[4] |= 0x07; | ||
| 242 | else if (symbol_rate <= (clk * 3) / 32) | ||
| 243 | buf[4] |= 0x06; | ||
| 244 | else if (symbol_rate <= clk / 8) | ||
| 245 | buf[4] |= 0x05; | ||
| 246 | else if (symbol_rate <= (clk * 3) / 16) | ||
| 247 | buf[4] |= 0x04; | ||
| 248 | else if (symbol_rate <= clk / 4) | ||
| 249 | buf[4] |= 0x03; | ||
| 250 | else if (symbol_rate <= (clk * 3) / 8) | ||
| 251 | buf[4] |= 0x02; | ||
| 252 | else if (symbol_rate <= clk / 2) | ||
| 253 | buf[4] |= 0x01; | ||
| 254 | else | ||
| 255 | buf[4] |= 0x00; | ||
| 256 | |||
| 257 | /* Sigma Delta converter */ | ||
| 258 | buf[5] = 0x00; | ||
| 259 | |||
| 260 | /* FEC: Possible puncturing rates */ | ||
| 261 | if (fec_inner == FEC_NONE) | ||
| 262 | buf[6] = 0x00; | ||
| 263 | else if ((fec_inner >= FEC_1_2) && (fec_inner <= FEC_8_9)) | ||
| 264 | buf[6] = (1 << (8 - fec_inner)); | ||
| 265 | else if (fec_inner == FEC_AUTO) | ||
| 266 | buf[6] = 0xff; | ||
| 267 | else | ||
| 268 | return -EINVAL; | ||
| 269 | |||
| 270 | /* carrier lock detector threshold value */ | ||
| 271 | buf[7] = 0x30; | ||
| 272 | /* AFC1: proportional part settings */ | ||
| 273 | buf[8] = 0x42; | ||
| 274 | /* AFC1: integral part settings */ | ||
| 275 | buf[9] = 0x98; | ||
| 276 | /* PD: Leaky integrator SCPC mode */ | ||
| 277 | buf[10] = 0x28; | ||
| 278 | /* AFC2, AFC1 controls */ | ||
| 279 | buf[11] = 0x30; | ||
| 280 | /* PD: proportional part settings */ | ||
| 281 | buf[12] = 0x42; | ||
| 282 | /* PD: integral part settings */ | ||
| 283 | buf[13] = 0x99; | ||
| 284 | /* AGC */ | ||
| 285 | buf[14] = 0x50 | scd; | ||
| 286 | |||
| 287 | printk("symbol_rate=%u clk=%u\n", symbol_rate, clk); | ||
| 288 | |||
| 289 | return tda80xx_write(state, 0x01, buf, sizeof(buf)); | ||
| 290 | } | ||
| 291 | |||
| 292 | static int tda80xx_set_clk(struct tda80xx_state* state) | ||
| 293 | { | ||
| 294 | u8 buf[2]; | ||
| 295 | |||
| 296 | /* CLK proportional part */ | ||
| 297 | buf[0] = (0x06 << 5) | 0x08; /* CMP[2:0], CSP[4:0] */ | ||
| 298 | /* CLK integral part */ | ||
| 299 | buf[1] = (0x04 << 5) | 0x1a; /* CMI[2:0], CSI[4:0] */ | ||
| 300 | |||
| 301 | return tda80xx_write(state, 0x17, buf, sizeof(buf)); | ||
| 302 | } | ||
| 303 | |||
| 304 | #if 0 | ||
| 305 | static int tda80xx_set_scpc_freq_offset(struct tda80xx_state* state) | ||
| 306 | { | ||
| 307 | /* a constant value is nonsense here imho */ | ||
| 308 | return tda80xx_writereg(state, 0x22, 0xf9); | ||
| 309 | } | ||
| 310 | #endif | ||
| 311 | |||
| 312 | static int tda80xx_close_loop(struct tda80xx_state* state) | ||
| 313 | { | ||
| 314 | u8 buf[2]; | ||
| 315 | |||
| 316 | /* PD: Loop closed, LD: lock detect enable, SCPC: Sweep mode - AFC1 loop closed */ | ||
| 317 | buf[0] = 0x68; | ||
| 318 | /* AFC1: Loop closed, CAR Feedback: 8192 */ | ||
| 319 | buf[1] = 0x70; | ||
| 320 | |||
| 321 | return tda80xx_write(state, 0x0b, buf, sizeof(buf)); | ||
| 322 | } | ||
| 323 | |||
| 324 | static irqreturn_t tda80xx_irq(int irq, void *priv, struct pt_regs *pt) | ||
| 325 | { | ||
| 326 | schedule_work(priv); | ||
| 327 | |||
| 328 | return IRQ_HANDLED; | ||
| 329 | } | ||
| 330 | |||
| 331 | static void tda80xx_read_status_int(struct tda80xx_state* state) | ||
| 332 | { | ||
| 333 | u8 val; | ||
| 334 | |||
| 335 | static const fe_spectral_inversion_t inv_tab[] = { | ||
| 336 | INVERSION_OFF, INVERSION_ON | ||
| 337 | }; | ||
| 338 | |||
| 339 | static const fe_code_rate_t fec_tab[] = { | ||
| 340 | FEC_8_9, FEC_1_2, FEC_2_3, FEC_3_4, | ||
| 341 | FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8, | ||
| 342 | }; | ||
| 343 | |||
| 344 | val = tda80xx_readreg(state, 0x02); | ||
| 345 | |||
| 346 | state->status = 0; | ||
| 347 | |||
| 348 | if (val & 0x01) /* demodulator lock */ | ||
| 349 | state->status |= FE_HAS_SIGNAL; | ||
| 350 | if (val & 0x02) /* clock recovery lock */ | ||
| 351 | state->status |= FE_HAS_CARRIER; | ||
| 352 | if (val & 0x04) /* viterbi lock */ | ||
| 353 | state->status |= FE_HAS_VITERBI; | ||
| 354 | if (val & 0x08) /* deinterleaver lock (packet sync) */ | ||
| 355 | state->status |= FE_HAS_SYNC; | ||
| 356 | if (val & 0x10) /* derandomizer lock (frame sync) */ | ||
| 357 | state->status |= FE_HAS_LOCK; | ||
| 358 | if (val & 0x20) /* frontend can not lock */ | ||
| 359 | state->status |= FE_TIMEDOUT; | ||
| 360 | |||
| 361 | if ((state->status & (FE_HAS_CARRIER)) && (state->afc_loop)) { | ||
| 362 | printk("tda80xx: closing loop\n"); | ||
| 363 | tda80xx_close_loop(state); | ||
| 364 | state->afc_loop = 0; | ||
| 365 | } | ||
| 366 | |||
| 367 | if (state->status & (FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK)) { | ||
| 368 | val = tda80xx_readreg(state, 0x0e); | ||
| 369 | state->code_rate = fec_tab[val & 0x07]; | ||
| 370 | if (state->status & (FE_HAS_SYNC | FE_HAS_LOCK)) | ||
| 371 | state->spectral_inversion = inv_tab[(val >> 7) & 0x01]; | ||
| 372 | else | ||
| 373 | state->spectral_inversion = INVERSION_AUTO; | ||
| 374 | } | ||
| 375 | else { | ||
| 376 | state->code_rate = FEC_AUTO; | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | static void tda80xx_worklet(void *priv) | ||
| 381 | { | ||
| 382 | struct tda80xx_state *state = priv; | ||
| 383 | |||
| 384 | tda80xx_writereg(state, 0x00, 0x04); | ||
| 385 | enable_irq(state->config->irq); | ||
| 386 | |||
| 387 | tda80xx_read_status_int(state); | ||
| 388 | } | ||
| 389 | |||
| 390 | static void tda80xx_wait_diseqc_fifo(struct tda80xx_state* state) | ||
| 391 | { | ||
| 392 | size_t i; | ||
| 393 | |||
| 394 | for (i = 0; i < 100; i++) { | ||
| 395 | if (tda80xx_readreg(state, 0x02) & 0x80) | ||
| 396 | break; | ||
| 397 | msleep(10); | ||
| 398 | } | ||
| 399 | } | ||
| 400 | |||
| 401 | static int tda8044_init(struct dvb_frontend* fe) | ||
| 402 | { | ||
| 403 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 404 | int ret; | ||
| 405 | |||
| 406 | /* | ||
| 407 | * this function is a mess... | ||
| 408 | */ | ||
| 409 | |||
| 410 | if ((ret = tda80xx_write(state, 0x00, tda8044_inittab_pre, sizeof(tda8044_inittab_pre)))) | ||
| 411 | return ret; | ||
| 412 | |||
| 413 | tda80xx_writereg(state, 0x0f, 0x50); | ||
| 414 | #if 1 | ||
| 415 | tda80xx_writereg(state, 0x20, 0x8F); /* FIXME */ | ||
| 416 | tda80xx_writereg(state, 0x20, state->config->volt18setting); /* FIXME */ | ||
| 417 | //tda80xx_writereg(state, 0x00, 0x04); | ||
| 418 | tda80xx_writereg(state, 0x00, 0x0C); | ||
| 419 | #endif | ||
| 420 | //tda80xx_writereg(state, 0x00, 0x08); /* Reset AFC1 loop filter */ | ||
| 421 | |||
| 422 | tda80xx_write(state, 0x00, tda8044_inittab_post, sizeof(tda8044_inittab_post)); | ||
| 423 | |||
| 424 | if (state->config->pll_init) { | ||
| 425 | tda80xx_writereg(state, 0x1c, 0x80); | ||
| 426 | state->config->pll_init(fe); | ||
| 427 | tda80xx_writereg(state, 0x1c, 0x00); | ||
| 428 | } | ||
| 429 | |||
| 430 | return 0; | ||
| 431 | } | ||
| 432 | |||
| 433 | static int tda8083_init(struct dvb_frontend* fe) | ||
| 434 | { | ||
| 435 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 436 | |||
| 437 | tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab)); | ||
| 438 | |||
| 439 | if (state->config->pll_init) { | ||
| 440 | tda80xx_writereg(state, 0x1c, 0x80); | ||
| 441 | state->config->pll_init(fe); | ||
| 442 | tda80xx_writereg(state, 0x1c, 0x00); | ||
| 443 | } | ||
| 444 | |||
| 445 | return 0; | ||
| 446 | } | ||
| 447 | |||
| 448 | static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
| 449 | { | ||
| 450 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 451 | |||
| 452 | switch (voltage) { | ||
| 453 | case SEC_VOLTAGE_13: | ||
| 454 | return tda80xx_writereg(state, 0x20, state->config->volt13setting); | ||
| 455 | case SEC_VOLTAGE_18: | ||
| 456 | return tda80xx_writereg(state, 0x20, state->config->volt18setting); | ||
| 457 | case SEC_VOLTAGE_OFF: | ||
| 458 | return tda80xx_writereg(state, 0x20, 0); | ||
| 459 | default: | ||
| 460 | return -EINVAL; | ||
| 461 | } | ||
| 462 | } | ||
| 463 | |||
| 464 | static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | ||
| 465 | { | ||
| 466 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 467 | |||
| 468 | switch (tone) { | ||
| 469 | case SEC_TONE_OFF: | ||
| 470 | return tda80xx_writereg(state, 0x29, 0x00); | ||
| 471 | case SEC_TONE_ON: | ||
| 472 | return tda80xx_writereg(state, 0x29, 0x80); | ||
| 473 | default: | ||
| 474 | return -EINVAL; | ||
| 475 | } | ||
| 476 | } | ||
| 477 | |||
| 478 | static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) | ||
| 479 | { | ||
| 480 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 481 | |||
| 482 | if (cmd->msg_len > 6) | ||
| 483 | return -EINVAL; | ||
| 484 | |||
| 485 | tda80xx_writereg(state, 0x29, 0x08 | (cmd->msg_len - 3)); | ||
| 486 | tda80xx_write(state, 0x23, cmd->msg, cmd->msg_len); | ||
| 487 | tda80xx_writereg(state, 0x29, 0x0c | (cmd->msg_len - 3)); | ||
| 488 | tda80xx_wait_diseqc_fifo(state); | ||
| 489 | |||
| 490 | return 0; | ||
| 491 | } | ||
| 492 | |||
| 493 | static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cmd) | ||
| 494 | { | ||
| 495 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 496 | |||
| 497 | switch (cmd) { | ||
| 498 | case SEC_MINI_A: | ||
| 499 | tda80xx_writereg(state, 0x29, 0x14); | ||
| 500 | break; | ||
| 501 | case SEC_MINI_B: | ||
| 502 | tda80xx_writereg(state, 0x29, 0x1c); | ||
| 503 | break; | ||
| 504 | default: | ||
| 505 | return -EINVAL; | ||
| 506 | } | ||
| 507 | |||
| 508 | tda80xx_wait_diseqc_fifo(state); | ||
| 509 | |||
| 510 | return 0; | ||
| 511 | } | ||
| 512 | |||
| 513 | static int tda80xx_sleep(struct dvb_frontend* fe) | ||
| 514 | { | ||
| 515 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 516 | |||
| 517 | tda80xx_writereg(state, 0x00, 0x02); /* enter standby */ | ||
| 518 | |||
| 519 | return 0; | ||
| 520 | } | ||
| 521 | |||
| 522 | static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | ||
| 523 | { | ||
| 524 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 525 | |||
| 526 | tda80xx_writereg(state, 0x1c, 0x80); | ||
| 527 | state->config->pll_set(fe, p); | ||
| 528 | tda80xx_writereg(state, 0x1c, 0x00); | ||
| 529 | |||
| 530 | tda80xx_set_parameters(state, p->inversion, p->u.qpsk.symbol_rate, p->u.qpsk.fec_inner); | ||
| 531 | tda80xx_set_clk(state); | ||
| 532 | //tda80xx_set_scpc_freq_offset(state); | ||
| 533 | state->afc_loop = 1; | ||
| 534 | |||
| 535 | return 0; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | ||
| 539 | { | ||
| 540 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 541 | |||
| 542 | if (!state->config->irq) | ||
| 543 | tda80xx_read_status_int(state); | ||
| 544 | |||
| 545 | p->inversion = state->spectral_inversion; | ||
| 546 | p->u.qpsk.fec_inner = state->code_rate; | ||
| 547 | |||
| 548 | return 0; | ||
| 549 | } | ||
| 550 | |||
| 551 | static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status) | ||
| 552 | { | ||
| 553 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 554 | |||
| 555 | if (!state->config->irq) | ||
| 556 | tda80xx_read_status_int(state); | ||
| 557 | *status = state->status; | ||
| 558 | |||
| 559 | return 0; | ||
| 560 | } | ||
| 561 | |||
| 562 | static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber) | ||
| 563 | { | ||
| 564 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 565 | int ret; | ||
| 566 | u8 buf[3]; | ||
| 567 | |||
| 568 | if ((ret = tda80xx_read(state, 0x0b, buf, sizeof(buf)))) | ||
| 569 | return ret; | ||
| 570 | |||
| 571 | *ber = ((buf[0] & 0x1f) << 16) | (buf[1] << 8) | buf[2]; | ||
| 572 | |||
| 573 | return 0; | ||
| 574 | } | ||
| 575 | |||
| 576 | static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
| 577 | { | ||
| 578 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 579 | |||
| 580 | u8 gain = ~tda80xx_readreg(state, 0x01); | ||
| 581 | *strength = (gain << 8) | gain; | ||
| 582 | |||
| 583 | return 0; | ||
| 584 | } | ||
| 585 | |||
| 586 | static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr) | ||
| 587 | { | ||
| 588 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 589 | |||
| 590 | u8 quality = tda80xx_readreg(state, 0x08); | ||
| 591 | *snr = (quality << 8) | quality; | ||
| 592 | |||
| 593 | return 0; | ||
| 594 | } | ||
| 595 | |||
| 596 | static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | ||
| 597 | { | ||
| 598 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 599 | |||
| 600 | *ucblocks = tda80xx_readreg(state, 0x0f); | ||
| 601 | if (*ucblocks == 0xff) | ||
| 602 | *ucblocks = 0xffffffff; | ||
| 603 | |||
| 604 | return 0; | ||
| 605 | } | ||
| 606 | |||
| 607 | static int tda80xx_init(struct dvb_frontend* fe) | ||
| 608 | { | ||
| 609 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 610 | |||
| 611 | switch(state->id) { | ||
| 612 | case ID_TDA8044: | ||
| 613 | return tda8044_init(fe); | ||
| 614 | |||
| 615 | case ID_TDA8083: | ||
| 616 | return tda8083_init(fe); | ||
| 617 | } | ||
| 618 | return 0; | ||
| 619 | } | ||
| 620 | |||
| 621 | static void tda80xx_release(struct dvb_frontend* fe) | ||
| 622 | { | ||
| 623 | struct tda80xx_state* state = fe->demodulator_priv; | ||
| 624 | |||
| 625 | if (state->config->irq) | ||
| 626 | free_irq(state->config->irq, &state->worklet); | ||
| 627 | |||
| 628 | kfree(state); | ||
| 629 | } | ||
| 630 | |||
| 631 | static struct dvb_frontend_ops tda80xx_ops; | ||
| 632 | |||
| 633 | struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, | ||
| 634 | struct i2c_adapter* i2c) | ||
| 635 | { | ||
| 636 | struct tda80xx_state* state = NULL; | ||
| 637 | int ret; | ||
| 638 | |||
| 639 | /* allocate memory for the internal state */ | ||
| 640 | state = kmalloc(sizeof(struct tda80xx_state), GFP_KERNEL); | ||
| 641 | if (state == NULL) goto error; | ||
| 642 | |||
| 643 | /* setup the state */ | ||
| 644 | state->config = config; | ||
| 645 | state->i2c = i2c; | ||
| 646 | memcpy(&state->ops, &tda80xx_ops, sizeof(struct dvb_frontend_ops)); | ||
| 647 | state->spectral_inversion = INVERSION_AUTO; | ||
| 648 | state->code_rate = FEC_AUTO; | ||
| 649 | state->status = 0; | ||
| 650 | state->afc_loop = 0; | ||
| 651 | |||
| 652 | /* check if the demod is there */ | ||
| 653 | if (tda80xx_writereg(state, 0x89, 0x00) < 0) goto error; | ||
| 654 | state->id = tda80xx_readreg(state, 0x00); | ||
| 655 | |||
| 656 | switch (state->id) { | ||
| 657 | case ID_TDA8044: | ||
| 658 | state->clk = 96000000; | ||
| 659 | printk("tda80xx: Detected tda8044\n"); | ||
| 660 | break; | ||
| 661 | |||
| 662 | case ID_TDA8083: | ||
| 663 | state->clk = 64000000; | ||
| 664 | printk("tda80xx: Detected tda8083\n"); | ||
| 665 | break; | ||
| 666 | |||
| 667 | default: | ||
| 668 | goto error; | ||
| 669 | } | ||
| 670 | |||
| 671 | /* setup IRQ */ | ||
| 672 | if (state->config->irq) { | ||
| 673 | INIT_WORK(&state->worklet, tda80xx_worklet, state); | ||
| 674 | if ((ret = request_irq(state->config->irq, tda80xx_irq, SA_ONESHOT, "tda80xx", &state->worklet)) < 0) { | ||
| 675 | printk(KERN_ERR "tda80xx: request_irq failed (%d)\n", ret); | ||
| 676 | goto error; | ||
| 677 | } | ||
| 678 | } | ||
| 679 | |||
| 680 | /* create dvb_frontend */ | ||
| 681 | state->frontend.ops = &state->ops; | ||
| 682 | state->frontend.demodulator_priv = state; | ||
| 683 | return &state->frontend; | ||
| 684 | |||
| 685 | error: | ||
| 686 | kfree(state); | ||
| 687 | return NULL; | ||
| 688 | } | ||
| 689 | |||
| 690 | static struct dvb_frontend_ops tda80xx_ops = { | ||
| 691 | |||
| 692 | .info = { | ||
| 693 | .name = "Philips TDA80xx DVB-S", | ||
| 694 | .type = FE_QPSK, | ||
| 695 | .frequency_min = 500000, | ||
| 696 | .frequency_max = 2700000, | ||
| 697 | .frequency_stepsize = 125, | ||
| 698 | .symbol_rate_min = 4500000, | ||
| 699 | .symbol_rate_max = 45000000, | ||
| 700 | .caps = FE_CAN_INVERSION_AUTO | | ||
| 701 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
| 702 | FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | | ||
| 703 | FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO | | ||
| 704 | FE_CAN_QPSK | | ||
| 705 | FE_CAN_MUTE_TS | ||
| 706 | }, | ||
| 707 | |||
| 708 | .release = tda80xx_release, | ||
| 709 | |||
| 710 | .init = tda80xx_init, | ||
| 711 | .sleep = tda80xx_sleep, | ||
| 712 | |||
| 713 | .set_frontend = tda80xx_set_frontend, | ||
| 714 | .get_frontend = tda80xx_get_frontend, | ||
| 715 | |||
| 716 | .read_status = tda80xx_read_status, | ||
| 717 | .read_ber = tda80xx_read_ber, | ||
| 718 | .read_signal_strength = tda80xx_read_signal_strength, | ||
| 719 | .read_snr = tda80xx_read_snr, | ||
| 720 | .read_ucblocks = tda80xx_read_ucblocks, | ||
| 721 | |||
| 722 | .diseqc_send_master_cmd = tda80xx_send_diseqc_msg, | ||
| 723 | .diseqc_send_burst = tda80xx_send_diseqc_burst, | ||
| 724 | .set_tone = tda80xx_set_tone, | ||
| 725 | .set_voltage = tda80xx_set_voltage, | ||
| 726 | }; | ||
| 727 | |||
| 728 | module_param(debug, int, 0644); | ||
| 729 | |||
| 730 | MODULE_DESCRIPTION("Philips TDA8044 / TDA8083 DVB-S Demodulator driver"); | ||
| 731 | MODULE_AUTHOR("Felix Domke, Andreas Oberritter"); | ||
| 732 | MODULE_LICENSE("GPL"); | ||
| 733 | |||
| 734 | EXPORT_SYMBOL(tda80xx_attach); | ||
diff --git a/drivers/media/dvb/frontends/tda80xx.h b/drivers/media/dvb/frontends/tda80xx.h deleted file mode 100644 index cd639a0aad55..000000000000 --- a/drivers/media/dvb/frontends/tda80xx.h +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * tda80xx.c | ||
| 3 | * | ||
| 4 | * Philips TDA8044 / TDA8083 QPSK demodulator driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2001 Felix Domke <tmbinc@elitedvb.net> | ||
| 7 | * Copyright (C) 2002-2004 Andreas Oberritter <obi@linuxtv.org> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | * (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License | ||
| 20 | * along with this program; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef TDA80XX_H | ||
| 25 | #define TDA80XX_H | ||
| 26 | |||
| 27 | #include <linux/dvb/frontend.h> | ||
| 28 | |||
| 29 | struct tda80xx_config | ||
| 30 | { | ||
| 31 | /* the demodulator's i2c address */ | ||
| 32 | u8 demod_address; | ||
| 33 | |||
| 34 | /* IRQ to use (0=>no IRQ used) */ | ||
| 35 | u32 irq; | ||
| 36 | |||
| 37 | /* Register setting to use for 13v */ | ||
| 38 | u8 volt13setting; | ||
| 39 | |||
| 40 | /* Register setting to use for 18v */ | ||
| 41 | u8 volt18setting; | ||
| 42 | |||
| 43 | /* PLL maintenance */ | ||
| 44 | int (*pll_init)(struct dvb_frontend* fe); | ||
| 45 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | ||
| 46 | }; | ||
| 47 | |||
| 48 | extern struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config, | ||
| 49 | struct i2c_adapter* i2c); | ||
| 50 | |||
| 51 | #endif // TDA80XX_H | ||
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 27494901975f..d36369e9e88f 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
| @@ -2329,6 +2329,17 @@ static int frontend_init(struct av7110 *av7110) | |||
| 2329 | av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); | 2329 | av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110)); |
| 2330 | break; | 2330 | break; |
| 2331 | 2331 | ||
| 2332 | case 0x0004: // Galaxis DVB-S rev1.3 | ||
| 2333 | /* ALPS BSRV2 */ | ||
| 2334 | av7110->fe = ves1x93_attach(&alps_bsrv2_config, &av7110->i2c_adap); | ||
| 2335 | if (av7110->fe) { | ||
| 2336 | av7110->fe->ops->diseqc_send_master_cmd = av7110_diseqc_send_master_cmd; | ||
| 2337 | av7110->fe->ops->diseqc_send_burst = av7110_diseqc_send_burst; | ||
| 2338 | av7110->fe->ops->set_tone = av7110_set_tone; | ||
| 2339 | av7110->recover = dvb_s_recover; | ||
| 2340 | } | ||
| 2341 | break; | ||
| 2342 | |||
| 2332 | case 0x0006: /* Fujitsu-Siemens DVB-S rev 1.6 */ | 2343 | case 0x0006: /* Fujitsu-Siemens DVB-S rev 1.6 */ |
| 2333 | /* Grundig 29504-451 */ | 2344 | /* Grundig 29504-451 */ |
| 2334 | av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap); | 2345 | av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap); |
| @@ -2930,6 +2941,7 @@ MAKE_AV7110_INFO(tts_1_3se, "Technotrend/Hauppauge WinTV DVB-S rev1.3 SE"); | |||
| 2930 | MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T"); | 2941 | MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T"); |
| 2931 | MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C"); | 2942 | MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C"); |
| 2932 | MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); | 2943 | MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); |
| 2944 | MAKE_AV7110_INFO(gxs_1_3, "Galaxis DVB-S rev1.3"); | ||
| 2933 | 2945 | ||
| 2934 | static struct pci_device_id pci_tbl[] = { | 2946 | static struct pci_device_id pci_tbl[] = { |
| 2935 | MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), | 2947 | MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), |
| @@ -2937,13 +2949,13 @@ static struct pci_device_id pci_tbl[] = { | |||
| 2937 | MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), | 2949 | MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), |
| 2938 | MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), | 2950 | MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), |
| 2939 | MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), | 2951 | MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), |
| 2952 | MAKE_EXTENSION_PCI(gxs_1_3, 0x13c2, 0x0004), | ||
| 2940 | MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), | 2953 | MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), |
| 2941 | MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), | 2954 | MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), |
| 2942 | MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), | 2955 | MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), |
| 2943 | MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), | 2956 | MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), |
| 2944 | MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), | 2957 | MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), |
| 2945 | 2958 | ||
| 2946 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte | ||
| 2947 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 | 2959 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 |
| 2948 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v???? | 2960 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v???? |
| 2949 | 2961 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h index 6ea30df2e823..fafd25fab835 100644 --- a/drivers/media/dvb/ttpci/av7110.h +++ b/drivers/media/dvb/ttpci/av7110.h | |||
| @@ -273,8 +273,6 @@ struct av7110 { | |||
| 273 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | 273 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, |
| 274 | u16 subpid, u16 pcrpid); | 274 | u16 subpid, u16 pcrpid); |
| 275 | 275 | ||
| 276 | extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); | ||
| 277 | |||
| 278 | extern int av7110_ir_init(struct av7110 *av7110); | 276 | extern int av7110_ir_init(struct av7110 *av7110); |
| 279 | extern void av7110_ir_exit(struct av7110 *av7110); | 277 | extern void av7110_ir_exit(struct av7110 *av7110); |
| 280 | 278 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c index 9138132ad25f..617e4f6c0ed7 100644 --- a/drivers/media/dvb/ttpci/av7110_ir.c +++ b/drivers/media/dvb/ttpci/av7110_ir.c | |||
| @@ -155,6 +155,19 @@ static void input_repeat_key(unsigned long data) | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | 157 | ||
| 158 | static int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) | ||
| 159 | { | ||
| 160 | int ret = 0; | ||
| 161 | |||
| 162 | dprintk(4, "%p\n", av7110); | ||
| 163 | if (av7110) { | ||
| 164 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); | ||
| 165 | av7110->ir_config = ir_config; | ||
| 166 | } | ||
| 167 | return ret; | ||
| 168 | } | ||
| 169 | |||
| 170 | |||
| 158 | static int av7110_ir_write_proc(struct file *file, const char __user *buffer, | 171 | static int av7110_ir_write_proc(struct file *file, const char __user *buffer, |
| 159 | unsigned long count, void *data) | 172 | unsigned long count, void *data) |
| 160 | { | 173 | { |
| @@ -187,19 +200,6 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer, | |||
| 187 | } | 200 | } |
| 188 | 201 | ||
| 189 | 202 | ||
| 190 | int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) | ||
| 191 | { | ||
| 192 | int ret = 0; | ||
| 193 | |||
| 194 | dprintk(4, "%p\n", av7110); | ||
| 195 | if (av7110) { | ||
| 196 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); | ||
| 197 | av7110->ir_config = ir_config; | ||
| 198 | } | ||
| 199 | return ret; | ||
| 200 | } | ||
| 201 | |||
| 202 | |||
| 203 | static void ir_handler(struct av7110 *av7110, u32 ircom) | 203 | static void ir_handler(struct av7110 *av7110, u32 ircom) |
| 204 | { | 204 | { |
| 205 | dprintk(4, "ircommand = %08x\n", ircom); | 205 | dprintk(4, "ircommand = %08x\n", ircom); |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index aa4c4c521880..578b20085082 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
| @@ -214,7 +214,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = { | |||
| 214 | we can capture, of the first and second field. */ | 214 | we can capture, of the first and second field. */ |
| 215 | .vbistart = { 7,320 }, | 215 | .vbistart = { 7,320 }, |
| 216 | },{ | 216 | },{ |
| 217 | .v4l2_id = V4L2_STD_NTSC_M, | 217 | .v4l2_id = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, |
| 218 | .name = "NTSC", | 218 | .name = "NTSC", |
| 219 | .Fsc = 28636363, | 219 | .Fsc = 28636363, |
| 220 | .swidth = 768, | 220 | .swidth = 768, |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index c66c2c1f4809..08ffd1f325fc 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -220,33 +220,23 @@ static void input_change(struct i2c_client *client) | |||
| 220 | cx25840_write(client, 0x808, 0xff); | 220 | cx25840_write(client, 0x808, 0xff); |
| 221 | cx25840_write(client, 0x80b, 0x10); | 221 | cx25840_write(client, 0x80b, 0x10); |
| 222 | } else if (std & V4L2_STD_NTSC) { | 222 | } else if (std & V4L2_STD_NTSC) { |
| 223 | /* NTSC */ | 223 | /* Certain Hauppauge PVR150 models have a hardware bug |
| 224 | if (state->pvr150_workaround) { | 224 | that causes audio to drop out. For these models the |
| 225 | /* Certain Hauppauge PVR150 models have a hardware bug | 225 | audio standard must be set explicitly. |
| 226 | that causes audio to drop out. For these models the | 226 | To be precise: it affects cards with tuner models |
| 227 | audio standard must be set explicitly. | 227 | 85, 99 and 112 (model numbers from tveeprom). */ |
| 228 | To be precise: it affects cards with tuner models | 228 | int hw_fix = state->pvr150_workaround; |
| 229 | 85, 99 and 112 (model numbers from tveeprom). */ | 229 | |
| 230 | if (std == V4L2_STD_NTSC_M_JP) { | 230 | if (std == V4L2_STD_NTSC_M_JP) { |
| 231 | /* Japan uses EIAJ audio standard */ | ||
| 232 | cx25840_write(client, 0x808, 0x2f); | ||
| 233 | } else { | ||
| 234 | /* Others use the BTSC audio standard */ | ||
| 235 | cx25840_write(client, 0x808, 0x1f); | ||
| 236 | } | ||
| 237 | /* South Korea uses the A2-M (aka Zweiton M) audio | ||
| 238 | standard, and should set 0x808 to 0x3f, but I don't | ||
| 239 | know how to detect this. */ | ||
| 240 | } else if (std == V4L2_STD_NTSC_M_JP) { | ||
| 241 | /* Japan uses EIAJ audio standard */ | 231 | /* Japan uses EIAJ audio standard */ |
| 242 | cx25840_write(client, 0x808, 0xf7); | 232 | cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7); |
| 233 | } else if (std == V4L2_STD_NTSC_M_KR) { | ||
| 234 | /* South Korea uses A2 audio standard */ | ||
| 235 | cx25840_write(client, 0x808, hw_fix ? 0x3f : 0xf8); | ||
| 243 | } else { | 236 | } else { |
| 244 | /* Others use the BTSC audio standard */ | 237 | /* Others use the BTSC audio standard */ |
| 245 | cx25840_write(client, 0x808, 0xf6); | 238 | cx25840_write(client, 0x808, hw_fix ? 0x1f : 0xf6); |
| 246 | } | 239 | } |
| 247 | /* South Korea uses the A2-M (aka Zweiton M) audio standard, | ||
| 248 | and should set 0x808 to 0xf8, but I don't know how to | ||
| 249 | detect this. */ | ||
| 250 | cx25840_write(client, 0x80b, 0x00); | 240 | cx25840_write(client, 0x80b, 0x00); |
| 251 | } | 241 | } |
| 252 | 242 | ||
| @@ -330,17 +320,17 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
| 330 | u8 fmt=0; /* zero is autodetect */ | 320 | u8 fmt=0; /* zero is autodetect */ |
| 331 | 321 | ||
| 332 | /* First tests should be against specific std */ | 322 | /* First tests should be against specific std */ |
| 333 | if (std & V4L2_STD_NTSC_M_JP) { | 323 | if (std == V4L2_STD_NTSC_M_JP) { |
| 334 | fmt=0x2; | 324 | fmt=0x2; |
| 335 | } else if (std & V4L2_STD_NTSC_443) { | 325 | } else if (std == V4L2_STD_NTSC_443) { |
| 336 | fmt=0x3; | 326 | fmt=0x3; |
| 337 | } else if (std & V4L2_STD_PAL_M) { | 327 | } else if (std == V4L2_STD_PAL_M) { |
| 338 | fmt=0x5; | 328 | fmt=0x5; |
| 339 | } else if (std & V4L2_STD_PAL_N) { | 329 | } else if (std == V4L2_STD_PAL_N) { |
| 340 | fmt=0x6; | 330 | fmt=0x6; |
| 341 | } else if (std & V4L2_STD_PAL_Nc) { | 331 | } else if (std == V4L2_STD_PAL_Nc) { |
| 342 | fmt=0x7; | 332 | fmt=0x7; |
| 343 | } else if (std & V4L2_STD_PAL_60) { | 333 | } else if (std == V4L2_STD_PAL_60) { |
| 344 | fmt=0x8; | 334 | fmt=0x8; |
| 345 | } else { | 335 | } else { |
| 346 | /* Then, test against generic ones */ | 336 | /* Then, test against generic ones */ |
| @@ -369,7 +359,7 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client) | |||
| 369 | } | 359 | } |
| 370 | 360 | ||
| 371 | switch (fmt) { | 361 | switch (fmt) { |
| 372 | case 0x1: return V4L2_STD_NTSC_M; | 362 | case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; |
| 373 | case 0x2: return V4L2_STD_NTSC_M_JP; | 363 | case 0x2: return V4L2_STD_NTSC_M_JP; |
| 374 | case 0x3: return V4L2_STD_NTSC_443; | 364 | case 0x3: return V4L2_STD_NTSC_443; |
| 375 | case 0x4: return V4L2_STD_PAL; | 365 | case 0x4: return V4L2_STD_PAL; |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 53308911ae6e..e99dfbbf3e95 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
| @@ -32,6 +32,7 @@ config VIDEO_CX88_DVB | |||
| 32 | config VIDEO_CX88_ALSA | 32 | config VIDEO_CX88_ALSA |
| 33 | tristate "ALSA DMA audio support" | 33 | tristate "ALSA DMA audio support" |
| 34 | depends on VIDEO_CX88 && SND && EXPERIMENTAL | 34 | depends on VIDEO_CX88 && SND && EXPERIMENTAL |
| 35 | select SND_PCM | ||
| 35 | ---help--- | 36 | ---help--- |
| 36 | This is a video4linux driver for direct (DMA) audio on | 37 | This is a video4linux driver for direct (DMA) audio on |
| 37 | Conexant 2388x based TV cards. | 38 | Conexant 2388x based TV cards. |
| @@ -48,6 +49,7 @@ config VIDEO_CX88_DVB_ALL_FRONTENDS | |||
| 48 | default y | 49 | default y |
| 49 | depends on VIDEO_CX88_DVB | 50 | depends on VIDEO_CX88_DVB |
| 50 | select DVB_MT352 | 51 | select DVB_MT352 |
| 52 | select VIDEO_CX88_VP3054 | ||
| 51 | select DVB_OR51132 | 53 | select DVB_OR51132 |
| 52 | select DVB_CX22702 | 54 | select DVB_CX22702 |
| 53 | select DVB_LGDT330X | 55 | select DVB_LGDT330X |
| @@ -69,6 +71,16 @@ config VIDEO_CX88_DVB_MT352 | |||
| 69 | This adds DVB-T support for cards based on the | 71 | This adds DVB-T support for cards based on the |
| 70 | Connexant 2388x chip and the MT352 demodulator. | 72 | Connexant 2388x chip and the MT352 demodulator. |
| 71 | 73 | ||
| 74 | config VIDEO_CX88_VP3054 | ||
| 75 | tristate "VP-3054 Secondary I2C Bus Support" | ||
| 76 | default m | ||
| 77 | depends on DVB_MT352 | ||
| 78 | ---help--- | ||
| 79 | This adds DVB-T support for cards based on the | ||
| 80 | Connexant 2388x chip and the MT352 demodulator, | ||
| 81 | which also require support for the VP-3054 | ||
| 82 | Secondary I2C bus, such at DNTV Live! DVB-T Pro. | ||
| 83 | |||
| 72 | config VIDEO_CX88_DVB_OR51132 | 84 | config VIDEO_CX88_DVB_OR51132 |
| 73 | bool "OR51132 ATSC Support" | 85 | bool "OR51132 ATSC Support" |
| 74 | default y | 86 | default y |
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 6e5eaa22619e..2b902784facc 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile | |||
| @@ -4,8 +4,9 @@ cx8800-objs := cx88-video.o cx88-vbi.o | |||
| 4 | cx8802-objs := cx88-mpeg.o | 4 | cx8802-objs := cx88-mpeg.o |
| 5 | 5 | ||
| 6 | obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o | 6 | obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o |
| 7 | obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o | 7 | obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o |
| 8 | obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o | 8 | obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o |
| 9 | obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o | ||
| 9 | 10 | ||
| 10 | EXTRA_CFLAGS += -I$(src)/.. | 11 | EXTRA_CFLAGS += -I$(src)/.. |
| 11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
| @@ -18,6 +19,6 @@ extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1 | |||
| 18 | extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 | 19 | extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 |
| 19 | extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 | 20 | extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 |
| 20 | extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1 | 21 | extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1 |
| 21 | extra-cflags-$(CONFIG_VIDEO_CX88_DVB)+= -DHAVE_VP3054_I2C=1 | 22 | extra-cflags-$(CONFIG_VIDEO_CX88_VP3054)+= -DHAVE_VP3054_I2C=1 |
| 22 | 23 | ||
| 23 | EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) | 24 | EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) |
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index a2e36a1e5f59..2acccd6d49bc 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
| @@ -128,7 +128,7 @@ MODULE_PARM_DESC(debug,"enable debug messages"); | |||
| 128 | * BOARD Specific: Sets audio DMA | 128 | * BOARD Specific: Sets audio DMA |
| 129 | */ | 129 | */ |
| 130 | 130 | ||
| 131 | int _cx88_start_audio_dma(snd_cx88_card_t *chip) | 131 | static int _cx88_start_audio_dma(snd_cx88_card_t *chip) |
| 132 | { | 132 | { |
| 133 | struct cx88_buffer *buf = chip->buf; | 133 | struct cx88_buffer *buf = chip->buf; |
| 134 | struct cx88_core *core=chip->core; | 134 | struct cx88_core *core=chip->core; |
| @@ -173,7 +173,7 @@ int _cx88_start_audio_dma(snd_cx88_card_t *chip) | |||
| 173 | /* | 173 | /* |
| 174 | * BOARD Specific: Resets audio DMA | 174 | * BOARD Specific: Resets audio DMA |
| 175 | */ | 175 | */ |
| 176 | int _cx88_stop_audio_dma(snd_cx88_card_t *chip) | 176 | static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) |
| 177 | { | 177 | { |
| 178 | struct cx88_core *core=chip->core; | 178 | struct cx88_core *core=chip->core; |
| 179 | dprintk(1, "Stopping audio DMA\n"); | 179 | dprintk(1, "Stopping audio DMA\n"); |
| @@ -613,7 +613,7 @@ static snd_kcontrol_new_t snd_cx88_capture_volume = { | |||
| 613 | * Only boards with eeprom and byte 1 at eeprom=1 have it | 613 | * Only boards with eeprom and byte 1 at eeprom=1 have it |
| 614 | */ | 614 | */ |
| 615 | 615 | ||
| 616 | struct pci_device_id cx88_audio_pci_tbl[] = { | 616 | static struct pci_device_id cx88_audio_pci_tbl[] = { |
| 617 | {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, | 617 | {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, |
| 618 | {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, | 618 | {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, |
| 619 | {0, } | 619 | {0, } |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index ad2f565f522c..1bc999247fdc 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
| @@ -1246,6 +1246,11 @@ struct cx88_subid cx88_subids[] = { | |||
| 1246 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL, | 1246 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL, |
| 1247 | },{ | 1247 | },{ |
| 1248 | .subvendor = 0x18ac, | 1248 | .subvendor = 0x18ac, |
| 1249 | .subdevice = 0xdb54, | ||
| 1250 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL, | ||
| 1251 | /* Re-branded DViCO: DigitalNow DVB-T Dual */ | ||
| 1252 | },{ | ||
| 1253 | .subvendor = 0x18ac, | ||
| 1249 | .subdevice = 0xdb11, | 1254 | .subdevice = 0xdb11, |
| 1250 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, | 1255 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, |
| 1251 | /* Re-branded DViCO: UltraView DVB-T Plus */ | 1256 | /* Re-branded DViCO: UltraView DVB-T Plus */ |
| @@ -1293,6 +1298,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) | |||
| 1293 | switch (tv.model) | 1298 | switch (tv.model) |
| 1294 | { | 1299 | { |
| 1295 | case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ | 1300 | case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ |
| 1301 | case 34519: /* WinTV-PCI-FM */ | ||
| 1296 | case 90002: /* Nova-T-PCI (9002) */ | 1302 | case 90002: /* Nova-T-PCI (9002) */ |
| 1297 | case 92001: /* Nova-S-Plus (Video and IR) */ | 1303 | case 92001: /* Nova-S-Plus (Video and IR) */ |
| 1298 | case 92002: /* Nova-S-Plus (Video and IR) */ | 1304 | case 92002: /* Nova-S-Plus (Video and IR) */ |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 8d6d6a6cf785..3720f24a25cf 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
| @@ -787,12 +787,14 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq) | |||
| 787 | 787 | ||
| 788 | int cx88_start_audio_dma(struct cx88_core *core) | 788 | int cx88_start_audio_dma(struct cx88_core *core) |
| 789 | { | 789 | { |
| 790 | /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */ | ||
| 791 | int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4; | ||
| 790 | /* setup fifo + format */ | 792 | /* setup fifo + format */ |
| 791 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0); | 793 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0); |
| 792 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0); | 794 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0); |
| 793 | 795 | ||
| 794 | cx_write(MO_AUDD_LNGTH, 128); /* fifo bpl size */ | 796 | cx_write(MO_AUDD_LNGTH, bpl); /* fifo bpl size */ |
| 795 | cx_write(MO_AUDR_LNGTH, 128); /* fifo bpl size */ | 797 | cx_write(MO_AUDR_LNGTH, bpl); /* fifo bpl size */ |
| 796 | 798 | ||
| 797 | /* start dma */ | 799 | /* start dma */ |
| 798 | cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ | 800 | cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index da2ad5c4b553..165d948624a3 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
| @@ -482,6 +482,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
| 482 | switch (core->board) { | 482 | switch (core->board) { |
| 483 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 483 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
| 484 | case CX88_BOARD_KWORLD_DVB_T: | 484 | case CX88_BOARD_KWORLD_DVB_T: |
| 485 | case CX88_BOARD_KWORLD_DVB_T_CX22702: | ||
| 485 | ir_codes = ir_codes_dntv_live_dvb_t; | 486 | ir_codes = ir_codes_dntv_live_dvb_t; |
| 486 | ir->gpio_addr = MO_GP1_IO; | 487 | ir->gpio_addr = MO_GP1_IO; |
| 487 | ir->mask_keycode = 0x1f; | 488 | ir->mask_keycode = 0x1f; |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index dff3893f32fd..e5ee8bceb210 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
| @@ -139,6 +139,9 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, | |||
| 139 | { | 139 | { |
| 140 | int ret, byte; | 140 | int ret, byte; |
| 141 | 141 | ||
| 142 | if (dev->state & DEV_DISCONNECTED) | ||
| 143 | return(-ENODEV); | ||
| 144 | |||
| 142 | em28xx_regdbg("req=%02x, reg=%02x ", req, reg); | 145 | em28xx_regdbg("req=%02x, reg=%02x ", req, reg); |
| 143 | 146 | ||
| 144 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, | 147 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, |
| @@ -165,6 +168,9 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg) | |||
| 165 | u8 val; | 168 | u8 val; |
| 166 | int ret; | 169 | int ret; |
| 167 | 170 | ||
| 171 | if (dev->state & DEV_DISCONNECTED) | ||
| 172 | return(-ENODEV); | ||
| 173 | |||
| 168 | em28xx_regdbg("req=%02x, reg=%02x:", req, reg); | 174 | em28xx_regdbg("req=%02x, reg=%02x:", req, reg); |
| 169 | 175 | ||
| 170 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, | 176 | ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), req, |
| @@ -195,7 +201,12 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | |||
| 195 | int ret; | 201 | int ret; |
| 196 | 202 | ||
| 197 | /*usb_control_msg seems to expect a kmalloced buffer */ | 203 | /*usb_control_msg seems to expect a kmalloced buffer */ |
| 198 | unsigned char *bufs = kmalloc(len, GFP_KERNEL); | 204 | unsigned char *bufs; |
| 205 | |||
| 206 | if (dev->state & DEV_DISCONNECTED) | ||
| 207 | return(-ENODEV); | ||
| 208 | |||
| 209 | bufs = kmalloc(len, GFP_KERNEL); | ||
| 199 | 210 | ||
| 200 | em28xx_regdbg("req=%02x reg=%02x:", req, reg); | 211 | em28xx_regdbg("req=%02x reg=%02x:", req, reg); |
| 201 | 212 | ||
| @@ -212,7 +223,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | |||
| 212 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, | 223 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, |
| 213 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 224 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 214 | 0x0000, reg, bufs, len, HZ); | 225 | 0x0000, reg, bufs, len, HZ); |
| 215 | mdelay(5); /* FIXME: magic number */ | 226 | msleep(5); /* FIXME: magic number */ |
| 216 | kfree(bufs); | 227 | kfree(bufs); |
| 217 | return ret; | 228 | return ret; |
| 218 | } | 229 | } |
| @@ -253,7 +264,7 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val) | |||
| 253 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) | 264 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) |
| 254 | return ret; | 265 | return ret; |
| 255 | else if (((u8) ret) & 0x01) { | 266 | else if (((u8) ret) & 0x01) { |
| 256 | em28xx_warn ("AC97 command still being exectuted: not handled properly!\n"); | 267 | em28xx_warn ("AC97 command still being executed: not handled properly!\n"); |
| 257 | } | 268 | } |
| 258 | return 0; | 269 | return 0; |
| 259 | } | 270 | } |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 0591a705b7a1..6ca8631bc36d 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
| @@ -78,7 +78,7 @@ static int em2800_i2c_send_max4(struct em28xx *dev, unsigned char addr, | |||
| 78 | ret = dev->em28xx_read_reg(dev, 0x05); | 78 | ret = dev->em28xx_read_reg(dev, 0x05); |
| 79 | if (ret == 0x80 + len - 1) | 79 | if (ret == 0x80 + len - 1) |
| 80 | return len; | 80 | return len; |
| 81 | mdelay(5); | 81 | msleep(5); |
| 82 | } | 82 | } |
| 83 | em28xx_warn("i2c write timed out\n"); | 83 | em28xx_warn("i2c write timed out\n"); |
| 84 | return -EIO; | 84 | return -EIO; |
| @@ -138,7 +138,7 @@ static int em2800_i2c_check_for_device(struct em28xx *dev, unsigned char addr) | |||
| 138 | return -ENODEV; | 138 | return -ENODEV; |
| 139 | else if (msg == 0x84) | 139 | else if (msg == 0x84) |
| 140 | return 0; | 140 | return 0; |
| 141 | mdelay(5); | 141 | msleep(5); |
| 142 | } | 142 | } |
| 143 | return -ENODEV; | 143 | return -ENODEV; |
| 144 | } | 144 | } |
| @@ -278,9 +278,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
| 278 | msgs[i].buf, | 278 | msgs[i].buf, |
| 279 | msgs[i].len, | 279 | msgs[i].len, |
| 280 | i == num - 1); | 280 | i == num - 1); |
| 281 | if (rc < 0) | ||
| 282 | goto err; | ||
| 283 | } | 281 | } |
| 282 | if (rc < 0) | ||
| 283 | goto err; | ||
| 284 | if (i2c_debug>=2) | 284 | if (i2c_debug>=2) |
| 285 | printk("\n"); | 285 | printk("\n"); |
| 286 | } | 286 | } |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index eea304f75176..94a14a2bb6d6 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
| @@ -6,6 +6,9 @@ | |||
| 6 | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 6 | Mauro Carvalho Chehab <mchehab@brturbo.com.br> |
| 7 | Sascha Sommer <saschasommer@freenet.de> | 7 | Sascha Sommer <saschasommer@freenet.de> |
| 8 | 8 | ||
| 9 | Some parts based on SN9C10x PC Camera Controllers GPL driver made | ||
| 10 | by Luca Risolia <luca.risolia@studio.unibo.it> | ||
| 11 | |||
| 9 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 2 of the License, or | 14 | the Free Software Foundation; either version 2 of the License, or |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c64718aec9cb..5a35d3b6550d 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
| @@ -136,7 +136,7 @@ struct saa7134_board saa7134_boards[] = { | |||
| 136 | }, | 136 | }, |
| 137 | [SAA7134_BOARD_FLYVIDEO2000] = { | 137 | [SAA7134_BOARD_FLYVIDEO2000] = { |
| 138 | /* "TC Wan" <tcwan@cs.usm.my> */ | 138 | /* "TC Wan" <tcwan@cs.usm.my> */ |
| 139 | .name = "LifeView FlyVIDEO2000", | 139 | .name = "LifeView/Typhoon FlyVIDEO2000", |
| 140 | .audio_clock = 0x00200000, | 140 | .audio_clock = 0x00200000, |
| 141 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | 141 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
| 142 | .radio_type = UNSET, | 142 | .radio_type = UNSET, |
| @@ -1884,44 +1884,38 @@ struct saa7134_board saa7134_boards[] = { | |||
| 1884 | .gpio = 0x000, | 1884 | .gpio = 0x000, |
| 1885 | }, | 1885 | }, |
| 1886 | }, | 1886 | }, |
| 1887 | [SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = { | 1887 | [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = { |
| 1888 | .name = "Typhoon DVB-T Duo Digital/Analog Cardbus", | 1888 | .name = "LifeView/Typhoon FlyDVB-T Duo Cardbus", |
| 1889 | .audio_clock = 0x00200000, | 1889 | .audio_clock = 0x00200000, |
| 1890 | .tuner_type = TUNER_PHILIPS_TDA8290, | 1890 | .tuner_type = TUNER_PHILIPS_TDA8290, |
| 1891 | .radio_type = UNSET, | 1891 | .radio_type = UNSET, |
| 1892 | .tuner_addr = ADDR_UNSET, | 1892 | .tuner_addr = ADDR_UNSET, |
| 1893 | .radio_addr = ADDR_UNSET, | 1893 | .radio_addr = ADDR_UNSET, |
| 1894 | .mpeg = SAA7134_MPEG_DVB, | 1894 | .mpeg = SAA7134_MPEG_DVB, |
| 1895 | /* .gpiomask = 0xe000, */ | 1895 | .gpiomask = 0x00200000, |
| 1896 | .inputs = {{ | 1896 | .inputs = {{ |
| 1897 | .name = name_tv, | 1897 | .name = name_tv, |
| 1898 | .vmux = 1, | 1898 | .vmux = 1, |
| 1899 | .amux = TV, | 1899 | .amux = TV, |
| 1900 | /* .gpio = 0x0000, */ | 1900 | .gpio = 0x200000, /* GPIO21=High for TV input */ |
| 1901 | .tv = 1, | 1901 | .tv = 1, |
| 1902 | },{ | 1902 | },{ |
| 1903 | .name = name_svideo, /* S-Video signal on S-Video input */ | ||
| 1904 | .vmux = 8, | ||
| 1905 | .amux = LINE2, | ||
| 1906 | },{ | ||
| 1903 | .name = name_comp1, /* Composite signal on S-Video input */ | 1907 | .name = name_comp1, /* Composite signal on S-Video input */ |
| 1904 | .vmux = 0, | 1908 | .vmux = 0, |
| 1905 | .amux = LINE2, | 1909 | .amux = LINE2, |
| 1906 | /* .gpio = 0x4000, */ | ||
| 1907 | },{ | 1910 | },{ |
| 1908 | .name = name_comp2, /* Composite input */ | 1911 | .name = name_comp2, /* Composite input */ |
| 1909 | .vmux = 3, | 1912 | .vmux = 3, |
| 1910 | .amux = LINE2, | 1913 | .amux = LINE2, |
| 1911 | /* .gpio = 0x4000, */ | ||
| 1912 | },{ | ||
| 1913 | .name = name_svideo, /* S-Video signal on S-Video input */ | ||
| 1914 | .vmux = 8, | ||
| 1915 | .amux = LINE2, | ||
| 1916 | /* .gpio = 0x4000, */ | ||
| 1917 | }}, | 1914 | }}, |
| 1918 | .radio = { | 1915 | .radio = { |
| 1919 | .name = name_radio, | 1916 | .name = name_radio, |
| 1920 | .amux = LINE2, | 1917 | .amux = TV, |
| 1921 | }, | 1918 | .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */ |
| 1922 | .mute = { | ||
| 1923 | .name = name_mute, | ||
| 1924 | .amux = LINE1, | ||
| 1925 | }, | 1919 | }, |
| 1926 | }, | 1920 | }, |
| 1927 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = { | 1921 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = { |
| @@ -2701,6 +2695,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
| 2701 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, | 2695 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, |
| 2702 | },{ | 2696 | },{ |
| 2703 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2697 | .vendor = PCI_VENDOR_ID_PHILIPS, |
| 2698 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | ||
| 2699 | .subvendor = 0x4e42, /* Typhoon */ | ||
| 2700 | .subdevice = 0x0138, /* LifeView FlyTV Prime30 OEM */ | ||
| 2701 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, | ||
| 2702 | },{ | ||
| 2703 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
| 2704 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2704 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
| 2705 | .subvendor = 0x5168, | 2705 | .subvendor = 0x5168, |
| 2706 | .subdevice = 0x0212, /* minipci, LR212 */ | 2706 | .subdevice = 0x0212, /* minipci, LR212 */ |
| @@ -2935,7 +2935,7 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
| 2935 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2935 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
| 2936 | .subvendor = 0x5168, | 2936 | .subvendor = 0x5168, |
| 2937 | .subdevice = 0x0502, /* Cardbus version */ | 2937 | .subdevice = 0x0502, /* Cardbus version */ |
| 2938 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | 2938 | .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS, |
| 2939 | },{ | 2939 | },{ |
| 2940 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2940 | .vendor = PCI_VENDOR_ID_PHILIPS, |
| 2941 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2941 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
| @@ -2980,12 +2980,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
| 2980 | .subdevice = 0x1370, /* cardbus version */ | 2980 | .subdevice = 0x1370, /* cardbus version */ |
| 2981 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | 2981 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, |
| 2982 | 2982 | ||
| 2983 | },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */ | 2983 | },{ |
| 2984 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2984 | .vendor = PCI_VENDOR_ID_PHILIPS, |
| 2985 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2985 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
| 2986 | .subvendor = 0x4e42, | 2986 | .subvendor = 0x4e42, /* Typhoon */ |
| 2987 | .subdevice = 0x0502, | 2987 | .subdevice = 0x0502, /* LifeView LR502 OEM */ |
| 2988 | .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, | 2988 | .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS, |
| 2989 | },{ | 2989 | },{ |
| 2990 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2990 | .vendor = PCI_VENDOR_ID_PHILIPS, |
| 2991 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2991 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
| @@ -3206,8 +3206,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
| 3206 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); | 3206 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); |
| 3207 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000004); | 3207 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000004); |
| 3208 | break; | 3208 | break; |
| 3209 | case SAA7134_BOARD_FLYDVBTDUO: | 3209 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
| 3210 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
| 3211 | /* turn the fan on */ | 3210 | /* turn the fan on */ |
| 3212 | saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); | 3211 | saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); |
| 3213 | saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); | 3212 | saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 399f9952596c..1a536e865277 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
| @@ -861,7 +861,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
| 861 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | 861 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, |
| 862 | &dev->i2c_adap); | 862 | &dev->i2c_adap); |
| 863 | break; | 863 | break; |
| 864 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | 864 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
| 865 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | 865 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, |
| 866 | &dev->i2c_adap); | 866 | &dev->i2c_adap); |
| 867 | break; | 867 | break; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index e70eae8d29bb..3261d8bebdd1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
| @@ -185,7 +185,7 @@ struct saa7134_format { | |||
| 185 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 | 185 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 |
| 186 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 | 186 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 |
| 187 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 | 187 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 |
| 188 | #define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60 | 188 | #define SAA7134_BOARD_FLYDVBT_DUO_CARDBUS 60 |
| 189 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 | 189 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 |
| 190 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 | 190 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 |
| 191 | #define SAA7134_BOARD_KWORLD_XPERT 63 | 191 | #define SAA7134_BOARD_KWORLD_XPERT 63 |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 54fc33011ffb..9d769264a329 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
| @@ -2012,7 +2012,6 @@ static int __devinit init_saa7146(struct pci_dev *pdev) | |||
| 2012 | { | 2012 | { |
| 2013 | struct saa7146 *saa = pci_get_drvdata(pdev); | 2013 | struct saa7146 *saa = pci_get_drvdata(pdev); |
| 2014 | 2014 | ||
| 2015 | memset(saa, 0, sizeof(*saa)); | ||
| 2016 | saa->user = 0; | 2015 | saa->user = 0; |
| 2017 | /* reset the saa7146 */ | 2016 | /* reset the saa7146 */ |
| 2018 | saawrite(0xffff0000, SAA7146_MC1); | 2017 | saawrite(0xffff0000, SAA7146_MC1); |
| @@ -2062,16 +2061,16 @@ static int __devinit init_saa7146(struct pci_dev *pdev) | |||
| 2062 | } | 2061 | } |
| 2063 | if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) { | 2062 | if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) { |
| 2064 | dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); | 2063 | dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); |
| 2065 | goto errvid; | 2064 | goto errfree; |
| 2066 | } | 2065 | } |
| 2067 | if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) { | 2066 | if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) { |
| 2068 | dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); | 2067 | dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr); |
| 2069 | goto erraud; | 2068 | goto errfree; |
| 2070 | } | 2069 | } |
| 2071 | /* allocate 81920 byte buffer for clipping */ | 2070 | /* allocate 81920 byte buffer for clipping */ |
| 2072 | if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) { | 2071 | if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) { |
| 2073 | dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr); | 2072 | dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr); |
| 2074 | goto errosd; | 2073 | goto errfree; |
| 2075 | } | 2074 | } |
| 2076 | /* setup clipping registers */ | 2075 | /* setup clipping registers */ |
| 2077 | saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2); | 2076 | saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2); |
| @@ -2085,15 +2084,11 @@ static int __devinit init_saa7146(struct pci_dev *pdev) | |||
| 2085 | I2CBusScan(saa); | 2084 | I2CBusScan(saa); |
| 2086 | 2085 | ||
| 2087 | return 0; | 2086 | return 0; |
| 2088 | errosd: | 2087 | errfree: |
| 2089 | vfree(saa->osdbuf); | 2088 | vfree(saa->osdbuf); |
| 2090 | saa->osdbuf = NULL; | ||
| 2091 | erraud: | ||
| 2092 | vfree(saa->audbuf); | 2089 | vfree(saa->audbuf); |
| 2093 | saa->audbuf = NULL; | ||
| 2094 | errvid: | ||
| 2095 | vfree(saa->vidbuf); | 2090 | vfree(saa->vidbuf); |
| 2096 | saa->vidbuf = NULL; | 2091 | saa->audbuf = saa->osdbuf = saa->vidbuf = NULL; |
| 2097 | err: | 2092 | err: |
| 2098 | return -ENOMEM; | 2093 | return -ENOMEM; |
| 2099 | } | 2094 | } |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 5815649bdc78..0d54f6c1982b 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
| @@ -231,7 +231,7 @@ static struct tvnorm tvnorms[] = { | |||
| 231 | cAudioIF_6_5 | | 231 | cAudioIF_6_5 | |
| 232 | cVideoIF_38_90 ), | 232 | cVideoIF_38_90 ), |
| 233 | },{ | 233 | },{ |
| 234 | .std = V4L2_STD_NTSC_M, | 234 | .std = V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR, |
| 235 | .name = "NTSC-M", | 235 | .name = "NTSC-M", |
| 236 | .b = ( cNegativeFmTV | | 236 | .b = ( cNegativeFmTV | |
| 237 | cQSS ), | 237 | cQSS ), |
| @@ -619,6 +619,11 @@ static int tda9887_fixup_std(struct tda9887 *t) | |||
| 619 | tda9887_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); | 619 | tda9887_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); |
| 620 | t->std = V4L2_STD_NTSC_M_JP; | 620 | t->std = V4L2_STD_NTSC_M_JP; |
| 621 | break; | 621 | break; |
| 622 | case 'k': | ||
| 623 | case 'K': | ||
| 624 | tda9887_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); | ||
| 625 | t->std = V4L2_STD_NTSC_M_KR; | ||
| 626 | break; | ||
| 622 | case '-': | 627 | case '-': |
| 623 | /* default parameter, do nothing */ | 628 | /* default parameter, do nothing */ |
| 624 | break; | 629 | break; |
| @@ -876,7 +881,7 @@ static int tda9887_resume(struct device * dev) | |||
| 876 | /* ----------------------------------------------------------------------- */ | 881 | /* ----------------------------------------------------------------------- */ |
| 877 | 882 | ||
| 878 | static struct i2c_driver driver = { | 883 | static struct i2c_driver driver = { |
| 879 | .id = -1, /* FIXME */ | 884 | .id = I2C_DRIVERID_TDA9887, |
| 880 | .attach_adapter = tda9887_probe, | 885 | .attach_adapter = tda9887_probe, |
| 881 | .detach_client = tda9887_detach, | 886 | .detach_client = tda9887_detach, |
| 882 | .command = tda9887_command, | 887 | .command = tda9887_command, |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 2995b22acb43..e7ee619d62c5 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
| @@ -216,6 +216,7 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
| 216 | buffer[3] = 0xa4; | 216 | buffer[3] = 0xa4; |
| 217 | i2c_master_send(c,buffer,4); | 217 | i2c_master_send(c,buffer,4); |
| 218 | default_tuner_init(c); | 218 | default_tuner_init(c); |
| 219 | break; | ||
| 219 | default: | 220 | default: |
| 220 | default_tuner_init(c); | 221 | default_tuner_init(c); |
| 221 | break; | 222 | break; |
| @@ -365,6 +366,11 @@ static int tuner_fixup_std(struct tuner *t) | |||
| 365 | tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); | 366 | tuner_dbg("insmod fixup: NTSC => NTSC_M_JP\n"); |
| 366 | t->std = V4L2_STD_NTSC_M_JP; | 367 | t->std = V4L2_STD_NTSC_M_JP; |
| 367 | break; | 368 | break; |
| 369 | case 'k': | ||
| 370 | case 'K': | ||
| 371 | tuner_dbg("insmod fixup: NTSC => NTSC_M_KR\n"); | ||
| 372 | t->std = V4L2_STD_NTSC_M_KR; | ||
| 373 | break; | ||
| 368 | case '-': | 374 | case '-': |
| 369 | /* default parameter, do nothing */ | 375 | /* default parameter, do nothing */ |
| 370 | break; | 376 | break; |
| @@ -448,7 +454,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
| 448 | printk("%02x ",buffer[i]); | 454 | printk("%02x ",buffer[i]); |
| 449 | printk("\n"); | 455 | printk("\n"); |
| 450 | } | 456 | } |
| 451 | /* TEA5767 autodetection code - only for addr = 0xc0 */ | 457 | /* autodetection code based on the i2c addr */ |
| 452 | if (!no_autodetect) { | 458 | if (!no_autodetect) { |
| 453 | switch (addr) { | 459 | switch (addr) { |
| 454 | case 0x42: | 460 | case 0x42: |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 6d03b9b05c6e..c8e5ad0e8185 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
| @@ -390,6 +390,14 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int mode) | |||
| 390 | chip_write(chip, TDA9840_SW, t); | 390 | chip_write(chip, TDA9840_SW, t); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | static int tda9840_checkit(struct CHIPSTATE *chip) | ||
| 394 | { | ||
| 395 | int rc; | ||
| 396 | rc = chip_read(chip); | ||
| 397 | /* lower 5 bits should be 0 */ | ||
| 398 | return ((rc & 0x1f) == 0) ? 1 : 0; | ||
| 399 | } | ||
| 400 | |||
| 393 | /* ---------------------------------------------------------------------- */ | 401 | /* ---------------------------------------------------------------------- */ |
| 394 | /* audio chip descriptions - defines+functions for tda985x */ | 402 | /* audio chip descriptions - defines+functions for tda985x */ |
| 395 | 403 | ||
| @@ -1264,6 +1272,7 @@ static struct CHIPDESC chiplist[] = { | |||
| 1264 | .addr_hi = I2C_TDA9840 >> 1, | 1272 | .addr_hi = I2C_TDA9840 >> 1, |
| 1265 | .registers = 5, | 1273 | .registers = 5, |
| 1266 | 1274 | ||
| 1275 | .checkit = tda9840_checkit, | ||
| 1267 | .getmode = tda9840_getmode, | 1276 | .getmode = tda9840_getmode, |
| 1268 | .setmode = tda9840_setmode, | 1277 | .setmode = tda9840_setmode, |
| 1269 | .checkmode = generic_checkmode, | 1278 | .checkmode = generic_checkmode, |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index fad9ea0ae4f2..1864423b3046 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
| @@ -746,24 +746,27 @@ static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) | |||
| 746 | 746 | ||
| 747 | static inline void tvp5150_reset(struct i2c_client *c) | 747 | static inline void tvp5150_reset(struct i2c_client *c) |
| 748 | { | 748 | { |
| 749 | u8 type, ver_656, msb_id, lsb_id, msb_rom, lsb_rom; | 749 | u8 msb_id, lsb_id, msb_rom, lsb_rom; |
| 750 | struct tvp5150 *decoder = i2c_get_clientdata(c); | 750 | struct tvp5150 *decoder = i2c_get_clientdata(c); |
| 751 | 751 | ||
| 752 | type=tvp5150_read(c,TVP5150_AUTOSW_MSK); | ||
| 753 | msb_id=tvp5150_read(c,TVP5150_MSB_DEV_ID); | 752 | msb_id=tvp5150_read(c,TVP5150_MSB_DEV_ID); |
| 754 | lsb_id=tvp5150_read(c,TVP5150_LSB_DEV_ID); | 753 | lsb_id=tvp5150_read(c,TVP5150_LSB_DEV_ID); |
| 755 | msb_rom=tvp5150_read(c,TVP5150_ROM_MAJOR_VER); | 754 | msb_rom=tvp5150_read(c,TVP5150_ROM_MAJOR_VER); |
| 756 | lsb_rom=tvp5150_read(c,TVP5150_ROM_MINOR_VER); | 755 | lsb_rom=tvp5150_read(c,TVP5150_ROM_MINOR_VER); |
| 757 | 756 | ||
| 758 | if (type==0xdc) { | 757 | if ((msb_rom==4)&&(lsb_rom==0)) { /* Is TVP5150AM1 */ |
| 759 | ver_656=tvp5150_read(c,TVP5150_REV_SELECT); | 758 | tvp5150_info("tvp%02x%02xam1 detected.\n",msb_id, lsb_id); |
| 760 | tvp5150_info("tvp%02x%02xam1 detected 656 version is %d.\n",msb_id, lsb_id,ver_656); | 759 | |
| 761 | } else if (type==0xfc) { | 760 | /* ITU-T BT.656.4 timing */ |
| 762 | tvp5150_info("tvp%02x%02xa detected.\n",msb_id, lsb_id); | 761 | tvp5150_write(c,TVP5150_REV_SELECT,0); |
| 763 | } else { | 762 | } else { |
| 764 | tvp5150_info("unknown tvp%02x%02x chip detected(%d).\n",msb_id,lsb_id,type); | 763 | if ((msb_rom==3)||(lsb_rom==0x21)) { /* Is TVP5150A */ |
| 764 | tvp5150_info("tvp%02x%02xa detected.\n",msb_id, lsb_id); | ||
| 765 | } else { | ||
| 766 | tvp5150_info("*** unknown tvp%02x%02x chip detected.\n",msb_id,lsb_id); | ||
| 767 | tvp5150_info("*** Rom ver is %d.%d\n",msb_rom,lsb_rom); | ||
| 768 | } | ||
| 765 | } | 769 | } |
| 766 | tvp5150_info("Rom ver is %d.%d\n",msb_rom,lsb_rom); | ||
| 767 | 770 | ||
| 768 | /* Initializes TVP5150 to its default values */ | 771 | /* Initializes TVP5150 to its default values */ |
| 769 | tvp5150_write_inittab(c, tvp5150_init_default); | 772 | tvp5150_write_inittab(c, tvp5150_init_default); |
| @@ -893,6 +896,17 @@ static int tvp5150_command(struct i2c_client *c, | |||
| 893 | } | 896 | } |
| 894 | case DECODER_GET_STATUS: | 897 | case DECODER_GET_STATUS: |
| 895 | { | 898 | { |
| 899 | int *iarg = arg; | ||
| 900 | int status; | ||
| 901 | int res=0; | ||
| 902 | status = tvp5150_read(c, 0x88); | ||
| 903 | if(status&0x08){ | ||
| 904 | res |= DECODER_STATUS_COLOR; | ||
| 905 | } | ||
| 906 | if(status&0x04 && status&0x02){ | ||
| 907 | res |= DECODER_STATUS_GOOD; | ||
| 908 | } | ||
| 909 | *iarg=res; | ||
| 896 | break; | 910 | break; |
| 897 | } | 911 | } |
| 898 | 912 | ||
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index adfba44dac5a..2beac55b57d6 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
| @@ -586,6 +586,7 @@ struct rtl8139_private { | |||
| 586 | dma_addr_t tx_bufs_dma; | 586 | dma_addr_t tx_bufs_dma; |
| 587 | signed char phys[4]; /* MII device addresses. */ | 587 | signed char phys[4]; /* MII device addresses. */ |
| 588 | char twistie, twist_row, twist_col; /* Twister tune state. */ | 588 | char twistie, twist_row, twist_col; /* Twister tune state. */ |
| 589 | unsigned int watchdog_fired : 1; | ||
| 589 | unsigned int default_port : 4; /* Last dev->if_port value. */ | 590 | unsigned int default_port : 4; /* Last dev->if_port value. */ |
| 590 | unsigned int have_thread : 1; | 591 | unsigned int have_thread : 1; |
| 591 | spinlock_t lock; | 592 | spinlock_t lock; |
| @@ -638,6 +639,7 @@ static void rtl8139_set_rx_mode (struct net_device *dev); | |||
| 638 | static void __set_rx_mode (struct net_device *dev); | 639 | static void __set_rx_mode (struct net_device *dev); |
| 639 | static void rtl8139_hw_start (struct net_device *dev); | 640 | static void rtl8139_hw_start (struct net_device *dev); |
| 640 | static void rtl8139_thread (void *_data); | 641 | static void rtl8139_thread (void *_data); |
| 642 | static void rtl8139_tx_timeout_task(void *_data); | ||
| 641 | static struct ethtool_ops rtl8139_ethtool_ops; | 643 | static struct ethtool_ops rtl8139_ethtool_ops; |
| 642 | 644 | ||
| 643 | /* write MMIO register, with flush */ | 645 | /* write MMIO register, with flush */ |
| @@ -1598,13 +1600,14 @@ static void rtl8139_thread (void *_data) | |||
| 1598 | { | 1600 | { |
| 1599 | struct net_device *dev = _data; | 1601 | struct net_device *dev = _data; |
| 1600 | struct rtl8139_private *tp = netdev_priv(dev); | 1602 | struct rtl8139_private *tp = netdev_priv(dev); |
| 1601 | unsigned long thr_delay; | 1603 | unsigned long thr_delay = next_tick; |
| 1602 | 1604 | ||
| 1603 | if (rtnl_shlock_nowait() == 0) { | 1605 | if (tp->watchdog_fired) { |
| 1606 | tp->watchdog_fired = 0; | ||
| 1607 | rtl8139_tx_timeout_task(_data); | ||
| 1608 | } else if (rtnl_shlock_nowait() == 0) { | ||
| 1604 | rtl8139_thread_iter (dev, tp, tp->mmio_addr); | 1609 | rtl8139_thread_iter (dev, tp, tp->mmio_addr); |
| 1605 | rtnl_unlock (); | 1610 | rtnl_unlock (); |
| 1606 | |||
| 1607 | thr_delay = next_tick; | ||
| 1608 | } else { | 1611 | } else { |
| 1609 | /* unlikely race. mitigate with fast poll. */ | 1612 | /* unlikely race. mitigate with fast poll. */ |
| 1610 | thr_delay = HZ / 2; | 1613 | thr_delay = HZ / 2; |
| @@ -1631,7 +1634,8 @@ static void rtl8139_stop_thread(struct rtl8139_private *tp) | |||
| 1631 | if (tp->have_thread) { | 1634 | if (tp->have_thread) { |
| 1632 | cancel_rearming_delayed_work(&tp->thread); | 1635 | cancel_rearming_delayed_work(&tp->thread); |
| 1633 | tp->have_thread = 0; | 1636 | tp->have_thread = 0; |
| 1634 | } | 1637 | } else |
| 1638 | flush_scheduled_work(); | ||
| 1635 | } | 1639 | } |
| 1636 | 1640 | ||
| 1637 | static inline void rtl8139_tx_clear (struct rtl8139_private *tp) | 1641 | static inline void rtl8139_tx_clear (struct rtl8139_private *tp) |
| @@ -1642,14 +1646,13 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp) | |||
| 1642 | /* XXX account for unsent Tx packets in tp->stats.tx_dropped */ | 1646 | /* XXX account for unsent Tx packets in tp->stats.tx_dropped */ |
| 1643 | } | 1647 | } |
| 1644 | 1648 | ||
| 1645 | 1649 | static void rtl8139_tx_timeout_task (void *_data) | |
| 1646 | static void rtl8139_tx_timeout (struct net_device *dev) | ||
| 1647 | { | 1650 | { |
| 1651 | struct net_device *dev = _data; | ||
| 1648 | struct rtl8139_private *tp = netdev_priv(dev); | 1652 | struct rtl8139_private *tp = netdev_priv(dev); |
| 1649 | void __iomem *ioaddr = tp->mmio_addr; | 1653 | void __iomem *ioaddr = tp->mmio_addr; |
| 1650 | int i; | 1654 | int i; |
| 1651 | u8 tmp8; | 1655 | u8 tmp8; |
| 1652 | unsigned long flags; | ||
| 1653 | 1656 | ||
| 1654 | printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x " | 1657 | printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x " |
| 1655 | "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd), | 1658 | "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd), |
| @@ -1670,23 +1673,34 @@ static void rtl8139_tx_timeout (struct net_device *dev) | |||
| 1670 | if (tmp8 & CmdTxEnb) | 1673 | if (tmp8 & CmdTxEnb) |
| 1671 | RTL_W8 (ChipCmd, CmdRxEnb); | 1674 | RTL_W8 (ChipCmd, CmdRxEnb); |
| 1672 | 1675 | ||
| 1673 | spin_lock(&tp->rx_lock); | 1676 | spin_lock_bh(&tp->rx_lock); |
| 1674 | /* Disable interrupts by clearing the interrupt mask. */ | 1677 | /* Disable interrupts by clearing the interrupt mask. */ |
| 1675 | RTL_W16 (IntrMask, 0x0000); | 1678 | RTL_W16 (IntrMask, 0x0000); |
| 1676 | 1679 | ||
| 1677 | /* Stop a shared interrupt from scavenging while we are. */ | 1680 | /* Stop a shared interrupt from scavenging while we are. */ |
| 1678 | spin_lock_irqsave (&tp->lock, flags); | 1681 | spin_lock_irq(&tp->lock); |
| 1679 | rtl8139_tx_clear (tp); | 1682 | rtl8139_tx_clear (tp); |
| 1680 | spin_unlock_irqrestore (&tp->lock, flags); | 1683 | spin_unlock_irq(&tp->lock); |
| 1681 | 1684 | ||
| 1682 | /* ...and finally, reset everything */ | 1685 | /* ...and finally, reset everything */ |
| 1683 | if (netif_running(dev)) { | 1686 | if (netif_running(dev)) { |
| 1684 | rtl8139_hw_start (dev); | 1687 | rtl8139_hw_start (dev); |
| 1685 | netif_wake_queue (dev); | 1688 | netif_wake_queue (dev); |
| 1686 | } | 1689 | } |
| 1687 | spin_unlock(&tp->rx_lock); | 1690 | spin_unlock_bh(&tp->rx_lock); |
| 1688 | } | 1691 | } |
| 1689 | 1692 | ||
| 1693 | static void rtl8139_tx_timeout (struct net_device *dev) | ||
| 1694 | { | ||
| 1695 | struct rtl8139_private *tp = netdev_priv(dev); | ||
| 1696 | |||
| 1697 | if (!tp->have_thread) { | ||
| 1698 | INIT_WORK(&tp->thread, rtl8139_tx_timeout_task, dev); | ||
| 1699 | schedule_delayed_work(&tp->thread, next_tick); | ||
| 1700 | } else | ||
| 1701 | tp->watchdog_fired = 1; | ||
| 1702 | |||
| 1703 | } | ||
| 1690 | 1704 | ||
| 1691 | static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | 1705 | static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) |
| 1692 | { | 1706 | { |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6a6a08441804..47c72a63dfe1 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | menu "Network device support" | 6 | menu "Network device support" |
| 7 | depends on NET | ||
| 7 | 8 | ||
| 8 | config NETDEVICES | 9 | config NETDEVICES |
| 9 | depends on NET | ||
| 10 | default y if UML | 10 | default y if UML |
| 11 | bool "Network device support" | 11 | bool "Network device support" |
| 12 | ---help--- | 12 | ---help--- |
| @@ -24,9 +24,6 @@ config NETDEVICES | |||
| 24 | 24 | ||
| 25 | If unsure, say Y. | 25 | If unsure, say Y. |
| 26 | 26 | ||
| 27 | # All the following symbols are dependent on NETDEVICES - do not repeat | ||
| 28 | # that for each of the symbols. | ||
| 29 | if NETDEVICES | ||
| 30 | 27 | ||
| 31 | config IFB | 28 | config IFB |
| 32 | tristate "Intermediate Functional Block support" | 29 | tristate "Intermediate Functional Block support" |
| @@ -2718,8 +2715,6 @@ config NETCONSOLE | |||
| 2718 | If you want to log kernel messages over the network, enable this. | 2715 | If you want to log kernel messages over the network, enable this. |
| 2719 | See <file:Documentation/networking/netconsole.txt> for details. | 2716 | See <file:Documentation/networking/netconsole.txt> for details. |
| 2720 | 2717 | ||
| 2721 | endif #NETDEVICES | ||
| 2722 | |||
| 2723 | config NETPOLL | 2718 | config NETPOLL |
| 2724 | def_bool NETCONSOLE | 2719 | def_bool NETCONSOLE |
| 2725 | 2720 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4ff006c37626..e0f51afec778 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1145,7 +1145,8 @@ int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_dev) | |||
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| 1147 | #define BOND_INTERSECT_FEATURES \ | 1147 | #define BOND_INTERSECT_FEATURES \ |
| 1148 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) | 1148 | (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM|\ |
| 1149 | NETIF_F_TSO|NETIF_F_UFO) | ||
| 1149 | 1150 | ||
| 1150 | /* | 1151 | /* |
| 1151 | * Compute the common dev->feature set available to all slaves. Some | 1152 | * Compute the common dev->feature set available to all slaves. Some |
| @@ -1168,6 +1169,16 @@ static int bond_compute_features(struct bonding *bond) | |||
| 1168 | NETIF_F_HW_CSUM))) | 1169 | NETIF_F_HW_CSUM))) |
| 1169 | features &= ~NETIF_F_SG; | 1170 | features &= ~NETIF_F_SG; |
| 1170 | 1171 | ||
| 1172 | /* | ||
| 1173 | * features will include NETIF_F_TSO (NETIF_F_UFO) iff all | ||
| 1174 | * slave devices support NETIF_F_TSO (NETIF_F_UFO), which | ||
| 1175 | * implies that all slaves also support scatter-gather | ||
| 1176 | * (NETIF_F_SG), which implies that features also includes | ||
| 1177 | * NETIF_F_SG. So no need to check whether we have an | ||
| 1178 | * illegal combination of NETIF_F_{TSO,UFO} and | ||
| 1179 | * !NETIF_F_SG | ||
| 1180 | */ | ||
| 1181 | |||
| 1171 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); | 1182 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); |
| 1172 | bond_dev->features = features; | 1183 | bond_dev->features = features; |
| 1173 | 1184 | ||
| @@ -4080,6 +4091,8 @@ static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, | |||
| 4080 | 4091 | ||
| 4081 | static struct ethtool_ops bond_ethtool_ops = { | 4092 | static struct ethtool_ops bond_ethtool_ops = { |
| 4082 | .get_tx_csum = ethtool_op_get_tx_csum, | 4093 | .get_tx_csum = ethtool_op_get_tx_csum, |
| 4094 | .get_tso = ethtool_op_get_tso, | ||
| 4095 | .get_ufo = ethtool_op_get_ufo, | ||
| 4083 | .get_sg = ethtool_op_get_sg, | 4096 | .get_sg = ethtool_op_get_sg, |
| 4084 | .get_drvinfo = bond_ethtool_get_drvinfo, | 4097 | .get_drvinfo = bond_ethtool_get_drvinfo, |
| 4085 | }; | 4098 | }; |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 32d13da43a0b..041bcc583557 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -260,7 +260,7 @@ static ssize_t bonding_store_slaves(struct class_device *cd, const char *buffer, | |||
| 260 | char *ifname; | 260 | char *ifname; |
| 261 | int i, res, found, ret = count; | 261 | int i, res, found, ret = count; |
| 262 | struct slave *slave; | 262 | struct slave *slave; |
| 263 | struct net_device *dev = 0; | 263 | struct net_device *dev = NULL; |
| 264 | struct bonding *bond = to_bond(cd); | 264 | struct bonding *bond = to_bond(cd); |
| 265 | 265 | ||
| 266 | /* Quick sanity check -- is the bond interface up? */ | 266 | /* Quick sanity check -- is the bond interface up? */ |
| @@ -995,7 +995,7 @@ static ssize_t bonding_store_primary(struct class_device *cd, const char *buf, s | |||
| 995 | printk(KERN_INFO DRV_NAME | 995 | printk(KERN_INFO DRV_NAME |
| 996 | ": %s: Setting primary slave to None.\n", | 996 | ": %s: Setting primary slave to None.\n", |
| 997 | bond->dev->name); | 997 | bond->dev->name); |
| 998 | bond->primary_slave = 0; | 998 | bond->primary_slave = NULL; |
| 999 | bond_select_active_slave(bond); | 999 | bond_select_active_slave(bond); |
| 1000 | } else { | 1000 | } else { |
| 1001 | printk(KERN_INFO DRV_NAME | 1001 | printk(KERN_INFO DRV_NAME |
| @@ -1123,7 +1123,7 @@ static ssize_t bonding_store_active_slave(struct class_device *cd, const char *b | |||
| 1123 | printk(KERN_INFO DRV_NAME | 1123 | printk(KERN_INFO DRV_NAME |
| 1124 | ": %s: Setting active slave to None.\n", | 1124 | ": %s: Setting active slave to None.\n", |
| 1125 | bond->dev->name); | 1125 | bond->dev->name); |
| 1126 | bond->primary_slave = 0; | 1126 | bond->primary_slave = NULL; |
| 1127 | bond_select_active_slave(bond); | 1127 | bond_select_active_slave(bond); |
| 1128 | } else { | 1128 | } else { |
| 1129 | printk(KERN_INFO DRV_NAME | 1129 | printk(KERN_INFO DRV_NAME |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index bf1fd2b98bf8..24253c807e55 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
| @@ -2752,8 +2752,6 @@ static int e100_resume(struct pci_dev *pdev) | |||
| 2752 | retval = pci_enable_wake(pdev, 0, 0); | 2752 | retval = pci_enable_wake(pdev, 0, 0); |
| 2753 | if (retval) | 2753 | if (retval) |
| 2754 | DPRINTK(PROBE,ERR, "Error clearing wake events\n"); | 2754 | DPRINTK(PROBE,ERR, "Error clearing wake events\n"); |
| 2755 | if(e100_hw_init(nic)) | ||
| 2756 | DPRINTK(HW, ERR, "e100_hw_init failed\n"); | ||
| 2757 | 2755 | ||
| 2758 | netif_device_attach(netdev); | 2756 | netif_device_attach(netdev); |
| 2759 | if(netif_running(netdev)) | 2757 | if(netif_running(netdev)) |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 0c18dbd67d3b..0e8e3fcde9ff 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
| 199 | 199 | ||
| 200 | /* get a pointer to the register memory */ | 200 | /* get a pointer to the register memory */ |
| 201 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 201 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 202 | priv->regs = (struct gfar *) | 202 | priv->regs = ioremap(r->start, sizeof (struct gfar)); |
| 203 | ioremap(r->start, sizeof (struct gfar)); | ||
| 204 | 203 | ||
| 205 | if (NULL == priv->regs) { | 204 | if (NULL == priv->regs) { |
| 206 | err = -ENOMEM; | 205 | err = -ENOMEM; |
| @@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
| 369 | return 0; | 368 | return 0; |
| 370 | 369 | ||
| 371 | register_fail: | 370 | register_fail: |
| 372 | iounmap((void *) priv->regs); | 371 | iounmap(priv->regs); |
| 373 | regs_fail: | 372 | regs_fail: |
| 374 | free_netdev(dev); | 373 | free_netdev(dev); |
| 375 | return err; | 374 | return err; |
| @@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev) | |||
| 382 | 381 | ||
| 383 | platform_set_drvdata(pdev, NULL); | 382 | platform_set_drvdata(pdev, NULL); |
| 384 | 383 | ||
| 385 | iounmap((void *) priv->regs); | 384 | iounmap(priv->regs); |
| 386 | free_netdev(dev); | 385 | free_netdev(dev); |
| 387 | 386 | ||
| 388 | return 0; | 387 | return 0; |
| @@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev) | |||
| 454 | 453 | ||
| 455 | /* Zero out the rmon mib registers if it has them */ | 454 | /* Zero out the rmon mib registers if it has them */ |
| 456 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { | 455 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { |
| 457 | memset((void *) &(priv->regs->rmon), 0, | 456 | memset_io(&(priv->regs->rmon), 0, sizeof (struct rmon_mib)); |
| 458 | sizeof (struct rmon_mib)); | ||
| 459 | 457 | ||
| 460 | /* Mask off the CAM interrupts */ | 458 | /* Mask off the CAM interrupts */ |
| 461 | gfar_write(&priv->regs->rmon.cam1, 0xffffffff); | 459 | gfar_write(&priv->regs->rmon.cam1, 0xffffffff); |
| @@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev) | |||
| 477 | void gfar_halt(struct net_device *dev) | 475 | void gfar_halt(struct net_device *dev) |
| 478 | { | 476 | { |
| 479 | struct gfar_private *priv = netdev_priv(dev); | 477 | struct gfar_private *priv = netdev_priv(dev); |
| 480 | struct gfar *regs = priv->regs; | 478 | struct gfar __iomem *regs = priv->regs; |
| 481 | u32 tempval; | 479 | u32 tempval; |
| 482 | 480 | ||
| 483 | /* Mask all interrupts */ | 481 | /* Mask all interrupts */ |
| @@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev) | |||
| 507 | void stop_gfar(struct net_device *dev) | 505 | void stop_gfar(struct net_device *dev) |
| 508 | { | 506 | { |
| 509 | struct gfar_private *priv = netdev_priv(dev); | 507 | struct gfar_private *priv = netdev_priv(dev); |
| 510 | struct gfar *regs = priv->regs; | 508 | struct gfar __iomem *regs = priv->regs; |
| 511 | unsigned long flags; | 509 | unsigned long flags; |
| 512 | 510 | ||
| 513 | phy_stop(priv->phydev); | 511 | phy_stop(priv->phydev); |
| @@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv) | |||
| 590 | void gfar_start(struct net_device *dev) | 588 | void gfar_start(struct net_device *dev) |
| 591 | { | 589 | { |
| 592 | struct gfar_private *priv = netdev_priv(dev); | 590 | struct gfar_private *priv = netdev_priv(dev); |
| 593 | struct gfar *regs = priv->regs; | 591 | struct gfar __iomem *regs = priv->regs; |
| 594 | u32 tempval; | 592 | u32 tempval; |
| 595 | 593 | ||
| 596 | /* Enable Rx and Tx in MACCFG1 */ | 594 | /* Enable Rx and Tx in MACCFG1 */ |
| @@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev) | |||
| 624 | unsigned long vaddr; | 622 | unsigned long vaddr; |
| 625 | int i; | 623 | int i; |
| 626 | struct gfar_private *priv = netdev_priv(dev); | 624 | struct gfar_private *priv = netdev_priv(dev); |
| 627 | struct gfar *regs = priv->regs; | 625 | struct gfar __iomem *regs = priv->regs; |
| 628 | int err = 0; | 626 | int err = 0; |
| 629 | u32 rctrl = 0; | 627 | u32 rctrl = 0; |
| 630 | u32 attrs = 0; | 628 | u32 attrs = 0; |
| @@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
| 1622 | static void adjust_link(struct net_device *dev) | 1620 | static void adjust_link(struct net_device *dev) |
| 1623 | { | 1621 | { |
| 1624 | struct gfar_private *priv = netdev_priv(dev); | 1622 | struct gfar_private *priv = netdev_priv(dev); |
| 1625 | struct gfar *regs = priv->regs; | 1623 | struct gfar __iomem *regs = priv->regs; |
| 1626 | unsigned long flags; | 1624 | unsigned long flags; |
| 1627 | struct phy_device *phydev = priv->phydev; | 1625 | struct phy_device *phydev = priv->phydev; |
| 1628 | int new_state = 0; | 1626 | int new_state = 0; |
| @@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev) | |||
| 1703 | { | 1701 | { |
| 1704 | struct dev_mc_list *mc_ptr; | 1702 | struct dev_mc_list *mc_ptr; |
| 1705 | struct gfar_private *priv = netdev_priv(dev); | 1703 | struct gfar_private *priv = netdev_priv(dev); |
| 1706 | struct gfar *regs = priv->regs; | 1704 | struct gfar __iomem *regs = priv->regs; |
| 1707 | u32 tempval; | 1705 | u32 tempval; |
| 1708 | 1706 | ||
| 1709 | if(dev->flags & IFF_PROMISC) { | 1707 | if(dev->flags & IFF_PROMISC) { |
| @@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr) | |||
| 1842 | int idx; | 1840 | int idx; |
| 1843 | char tmpbuf[MAC_ADDR_LEN]; | 1841 | char tmpbuf[MAC_ADDR_LEN]; |
| 1844 | u32 tempval; | 1842 | u32 tempval; |
| 1845 | u32 *macptr = &priv->regs->macstnaddr1; | 1843 | u32 __iomem *macptr = &priv->regs->macstnaddr1; |
| 1846 | 1844 | ||
| 1847 | macptr += num*2; | 1845 | macptr += num*2; |
| 1848 | 1846 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index cb9d66ac3ab9..d37d5401be6e 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
| @@ -682,8 +682,8 @@ struct gfar_private { | |||
| 682 | struct rxbd8 *cur_rx; /* Next free rx ring entry */ | 682 | struct rxbd8 *cur_rx; /* Next free rx ring entry */ |
| 683 | struct txbd8 *cur_tx; /* Next free ring entry */ | 683 | struct txbd8 *cur_tx; /* Next free ring entry */ |
| 684 | struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ | 684 | struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ |
| 685 | struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ | 685 | struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */ |
| 686 | u32 *hash_regs[16]; | 686 | u32 __iomem *hash_regs[16]; |
| 687 | int hash_width; | 687 | int hash_width; |
| 688 | struct net_device_stats stats; /* linux network statistics */ | 688 | struct net_device_stats stats; /* linux network statistics */ |
| 689 | struct gfar_extra_stats extra_stats; | 689 | struct gfar_extra_stats extra_stats; |
| @@ -718,14 +718,14 @@ struct gfar_private { | |||
| 718 | uint32_t msg_enable; | 718 | uint32_t msg_enable; |
| 719 | }; | 719 | }; |
| 720 | 720 | ||
| 721 | static inline u32 gfar_read(volatile unsigned *addr) | 721 | static inline u32 gfar_read(volatile unsigned __iomem *addr) |
| 722 | { | 722 | { |
| 723 | u32 val; | 723 | u32 val; |
| 724 | val = in_be32(addr); | 724 | val = in_be32(addr); |
| 725 | return val; | 725 | return val; |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | static inline void gfar_write(volatile unsigned *addr, u32 val) | 728 | static inline void gfar_write(volatile unsigned __iomem *addr, u32 val) |
| 729 | { | 729 | { |
| 730 | out_be32(addr, val); | 730 | out_be32(addr, val); |
| 731 | } | 731 | } |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 765e810620fe..5de7b2e259dc 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
| @@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, | |||
| 144 | u64 *extra = (u64 *) & priv->extra_stats; | 144 | u64 *extra = (u64 *) & priv->extra_stats; |
| 145 | 145 | ||
| 146 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { | 146 | if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { |
| 147 | u32 *rmon = (u32 *) & priv->regs->rmon; | 147 | u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon; |
| 148 | struct gfar_stats *stats = (struct gfar_stats *) buf; | 148 | struct gfar_stats *stats = (struct gfar_stats *) buf; |
| 149 | 149 | ||
| 150 | for (i = 0; i < GFAR_RMON_LEN; i++) | 150 | for (i = 0; i < GFAR_RMON_LEN; i++) |
| 151 | stats->rmon[i] = (u64) (rmon[i]); | 151 | stats->rmon[i] = (u64) gfar_read(&rmon[i]); |
| 152 | 152 | ||
| 153 | for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) | 153 | for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) |
| 154 | stats->extra[i] = extra[i]; | 154 | stats->extra[i] = extra[i]; |
| @@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi | |||
| 221 | { | 221 | { |
| 222 | int i; | 222 | int i; |
| 223 | struct gfar_private *priv = netdev_priv(dev); | 223 | struct gfar_private *priv = netdev_priv(dev); |
| 224 | u32 *theregs = (u32 *) priv->regs; | 224 | u32 __iomem *theregs = (u32 __iomem *) priv->regs; |
| 225 | u32 *buf = (u32 *) regbuf; | 225 | u32 *buf = (u32 *) regbuf; |
| 226 | 226 | ||
| 227 | for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) | 227 | for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) |
| 228 | buf[i] = theregs[i]; | 228 | buf[i] = gfar_read(&theregs[i]); |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | /* Convert microseconds to ethernet clock ticks, which changes | 231 | /* Convert microseconds to ethernet clock ticks, which changes |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index 74e52fcbf806..c6b725529af5 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | * All PHY configuration is done through the TSEC1 MIIM regs */ | 50 | * All PHY configuration is done through the TSEC1 MIIM regs */ |
| 51 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) | 51 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) |
| 52 | { | 52 | { |
| 53 | struct gfar_mii *regs = bus->priv; | 53 | struct gfar_mii __iomem *regs = (void __iomem *)bus->priv; |
| 54 | 54 | ||
| 55 | /* Set the PHY address and the register address we want to write */ | 55 | /* Set the PHY address and the register address we want to write */ |
| 56 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); | 56 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); |
| @@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) | |||
| 70 | * configuration has to be done through the TSEC1 MIIM regs */ | 70 | * configuration has to be done through the TSEC1 MIIM regs */ |
| 71 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | 71 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) |
| 72 | { | 72 | { |
| 73 | struct gfar_mii *regs = bus->priv; | 73 | struct gfar_mii __iomem *regs = (void __iomem *)bus->priv; |
| 74 | u16 value; | 74 | u16 value; |
| 75 | 75 | ||
| 76 | /* Set the PHY address and the register address we want to read */ | 76 | /* Set the PHY address and the register address we want to read */ |
| @@ -94,7 +94,7 @@ int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
| 94 | /* Reset the MIIM registers, and wait for the bus to free */ | 94 | /* Reset the MIIM registers, and wait for the bus to free */ |
| 95 | int gfar_mdio_reset(struct mii_bus *bus) | 95 | int gfar_mdio_reset(struct mii_bus *bus) |
| 96 | { | 96 | { |
| 97 | struct gfar_mii *regs = bus->priv; | 97 | struct gfar_mii __iomem *regs = (void __iomem *)bus->priv; |
| 98 | unsigned int timeout = PHY_INIT_TIMEOUT; | 98 | unsigned int timeout = PHY_INIT_TIMEOUT; |
| 99 | 99 | ||
| 100 | spin_lock_bh(&bus->mdio_lock); | 100 | spin_lock_bh(&bus->mdio_lock); |
| @@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev) | |||
| 126 | { | 126 | { |
| 127 | struct platform_device *pdev = to_platform_device(dev); | 127 | struct platform_device *pdev = to_platform_device(dev); |
| 128 | struct gianfar_mdio_data *pdata; | 128 | struct gianfar_mdio_data *pdata; |
| 129 | struct gfar_mii *regs; | 129 | struct gfar_mii __iomem *regs; |
| 130 | struct mii_bus *new_bus; | 130 | struct mii_bus *new_bus; |
| 131 | struct resource *r; | 131 | struct resource *r; |
| 132 | int err = 0; | 132 | int err = 0; |
| @@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev) | |||
| 155 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 155 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 156 | 156 | ||
| 157 | /* Set the PHY base address */ | 157 | /* Set the PHY base address */ |
| 158 | regs = (struct gfar_mii *) ioremap(r->start, | 158 | regs = ioremap(r->start, sizeof (struct gfar_mii)); |
| 159 | sizeof (struct gfar_mii)); | ||
| 160 | 159 | ||
| 161 | if (NULL == regs) { | 160 | if (NULL == regs) { |
| 162 | err = -ENOMEM; | 161 | err = -ENOMEM; |
| 163 | goto reg_map_fail; | 162 | goto reg_map_fail; |
| 164 | } | 163 | } |
| 165 | 164 | ||
| 166 | new_bus->priv = regs; | 165 | new_bus->priv = (void __force *)regs; |
| 167 | 166 | ||
| 168 | new_bus->irq = pdata->irq; | 167 | new_bus->irq = pdata->irq; |
| 169 | 168 | ||
| @@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev) | |||
| 181 | return 0; | 180 | return 0; |
| 182 | 181 | ||
| 183 | bus_register_fail: | 182 | bus_register_fail: |
| 184 | iounmap((void *) regs); | 183 | iounmap(regs); |
| 185 | reg_map_fail: | 184 | reg_map_fail: |
| 186 | kfree(new_bus); | 185 | kfree(new_bus); |
| 187 | 186 | ||
| @@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev) | |||
| 197 | 196 | ||
| 198 | dev_set_drvdata(dev, NULL); | 197 | dev_set_drvdata(dev, NULL); |
| 199 | 198 | ||
| 200 | iounmap((void *) (&bus->priv)); | 199 | iounmap((void __iomem *)bus->priv); |
| 201 | bus->priv = NULL; | 200 | bus->priv = NULL; |
| 202 | kfree(bus); | 201 | kfree(bus); |
| 203 | 202 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 2e1bed153c39..6e1018448eea 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -484,13 +484,12 @@ static void mdio_write(void __iomem *ioaddr, int RegAddr, int value) | |||
| 484 | int i; | 484 | int i; |
| 485 | 485 | ||
| 486 | RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); | 486 | RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value); |
| 487 | udelay(1000); | ||
| 488 | 487 | ||
| 489 | for (i = 2000; i > 0; i--) { | 488 | for (i = 20; i > 0; i--) { |
| 490 | /* Check if the RTL8169 has completed writing to the specified MII register */ | 489 | /* Check if the RTL8169 has completed writing to the specified MII register */ |
| 491 | if (!(RTL_R32(PHYAR) & 0x80000000)) | 490 | if (!(RTL_R32(PHYAR) & 0x80000000)) |
| 492 | break; | 491 | break; |
| 493 | udelay(100); | 492 | udelay(25); |
| 494 | } | 493 | } |
| 495 | } | 494 | } |
| 496 | 495 | ||
| @@ -499,15 +498,14 @@ static int mdio_read(void __iomem *ioaddr, int RegAddr) | |||
| 499 | int i, value = -1; | 498 | int i, value = -1; |
| 500 | 499 | ||
| 501 | RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); | 500 | RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16); |
| 502 | udelay(1000); | ||
| 503 | 501 | ||
| 504 | for (i = 2000; i > 0; i--) { | 502 | for (i = 20; i > 0; i--) { |
| 505 | /* Check if the RTL8169 has completed retrieving data from the specified MII register */ | 503 | /* Check if the RTL8169 has completed retrieving data from the specified MII register */ |
| 506 | if (RTL_R32(PHYAR) & 0x80000000) { | 504 | if (RTL_R32(PHYAR) & 0x80000000) { |
| 507 | value = (int) (RTL_R32(PHYAR) & 0xFFFF); | 505 | value = (int) (RTL_R32(PHYAR) & 0xFFFF); |
| 508 | break; | 506 | break; |
| 509 | } | 507 | } |
| 510 | udelay(100); | 508 | udelay(25); |
| 511 | } | 509 | } |
| 512 | return value; | 510 | return value; |
| 513 | } | 511 | } |
| @@ -677,6 +675,9 @@ static int rtl8169_set_speed_xmii(struct net_device *dev, | |||
| 677 | 675 | ||
| 678 | if (duplex == DUPLEX_HALF) | 676 | if (duplex == DUPLEX_HALF) |
| 679 | auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full); | 677 | auto_nego &= ~(PHY_Cap_10_Full | PHY_Cap_100_Full); |
| 678 | |||
| 679 | if (duplex == DUPLEX_FULL) | ||
| 680 | auto_nego &= ~(PHY_Cap_10_Half | PHY_Cap_100_Half); | ||
| 680 | } | 681 | } |
| 681 | 682 | ||
| 682 | tp->phy_auto_nego_reg = auto_nego; | 683 | tp->phy_auto_nego_reg = auto_nego; |
diff --git a/drivers/net/sis900.h b/drivers/net/sis900.h index 4233ea55670f..50323941e3c0 100644 --- a/drivers/net/sis900.h +++ b/drivers/net/sis900.h | |||
| @@ -33,7 +33,6 @@ enum sis900_registers { | |||
| 33 | rxcfg=0x34, //Receive Configuration Register | 33 | rxcfg=0x34, //Receive Configuration Register |
| 34 | flctrl=0x38, //Flow Control Register | 34 | flctrl=0x38, //Flow Control Register |
| 35 | rxlen=0x3c, //Receive Packet Length Register | 35 | rxlen=0x3c, //Receive Packet Length Register |
| 36 | cfgpmcsr=0x44, //Configuration Power Management Control/Status Register | ||
| 37 | rfcr=0x48, //Receive Filter Control Register | 36 | rfcr=0x48, //Receive Filter Control Register |
| 38 | rfdr=0x4C, //Receive Filter Data Register | 37 | rfdr=0x4C, //Receive Filter Data Register |
| 39 | pmctrl=0xB0, //Power Management Control Register | 38 | pmctrl=0xB0, //Power Management Control Register |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index f8b973a04b65..cae2edf23004 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
| @@ -23,12 +23,6 @@ | |||
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | /* | ||
| 27 | * TOTEST | ||
| 28 | * - speed setting | ||
| 29 | * - suspend/resume | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include <linux/config.h> | 26 | #include <linux/config.h> |
| 33 | #include <linux/crc32.h> | 27 | #include <linux/crc32.h> |
| 34 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
| @@ -57,7 +51,7 @@ | |||
| 57 | #include "sky2.h" | 51 | #include "sky2.h" |
| 58 | 52 | ||
| 59 | #define DRV_NAME "sky2" | 53 | #define DRV_NAME "sky2" |
| 60 | #define DRV_VERSION "0.13" | 54 | #define DRV_VERSION "0.15" |
| 61 | #define PFX DRV_NAME " " | 55 | #define PFX DRV_NAME " " |
| 62 | 56 | ||
| 63 | /* | 57 | /* |
| @@ -102,6 +96,10 @@ static int copybreak __read_mostly = 256; | |||
| 102 | module_param(copybreak, int, 0); | 96 | module_param(copybreak, int, 0); |
| 103 | MODULE_PARM_DESC(copybreak, "Receive copy threshold"); | 97 | MODULE_PARM_DESC(copybreak, "Receive copy threshold"); |
| 104 | 98 | ||
| 99 | static int disable_msi = 0; | ||
| 100 | module_param(disable_msi, int, 0); | ||
| 101 | MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); | ||
| 102 | |||
| 105 | static const struct pci_device_id sky2_id_table[] = { | 103 | static const struct pci_device_id sky2_id_table[] = { |
| 106 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, | 104 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, |
| 107 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, | 105 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, |
| @@ -198,7 +196,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
| 198 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 196 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
| 199 | 197 | ||
| 200 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control); | 198 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control); |
| 201 | vaux = (sky2_read8(hw, B0_CTST) & Y2_VAUX_AVAIL) && | 199 | vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) && |
| 202 | (power_control & PCI_PM_CAP_PME_D3cold); | 200 | (power_control & PCI_PM_CAP_PME_D3cold); |
| 203 | 201 | ||
| 204 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control); | 202 | pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control); |
| @@ -1834,6 +1832,8 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
| 1834 | u16 hwidx; | 1832 | u16 hwidx; |
| 1835 | u16 tx_done[2] = { TX_NO_STATUS, TX_NO_STATUS }; | 1833 | u16 tx_done[2] = { TX_NO_STATUS, TX_NO_STATUS }; |
| 1836 | 1834 | ||
| 1835 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
| 1836 | |||
| 1837 | hwidx = sky2_read16(hw, STAT_PUT_IDX); | 1837 | hwidx = sky2_read16(hw, STAT_PUT_IDX); |
| 1838 | BUG_ON(hwidx >= STATUS_RING_SIZE); | 1838 | BUG_ON(hwidx >= STATUS_RING_SIZE); |
| 1839 | rmb(); | 1839 | rmb(); |
| @@ -1913,12 +1913,10 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
| 1913 | } | 1913 | } |
| 1914 | 1914 | ||
| 1915 | exit_loop: | 1915 | exit_loop: |
| 1916 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
| 1917 | |||
| 1918 | sky2_tx_check(hw, 0, tx_done[0]); | 1916 | sky2_tx_check(hw, 0, tx_done[0]); |
| 1919 | sky2_tx_check(hw, 1, tx_done[1]); | 1917 | sky2_tx_check(hw, 1, tx_done[1]); |
| 1920 | 1918 | ||
| 1921 | if (sky2_read16(hw, STAT_PUT_IDX) == hw->st_idx) { | 1919 | if (likely(work_done < to_do)) { |
| 1922 | /* need to restart TX timer */ | 1920 | /* need to restart TX timer */ |
| 1923 | if (is_ec_a1(hw)) { | 1921 | if (is_ec_a1(hw)) { |
| 1924 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP); | 1922 | sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP); |
| @@ -2141,14 +2139,12 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk) | |||
| 2141 | 2139 | ||
| 2142 | static int sky2_reset(struct sky2_hw *hw) | 2140 | static int sky2_reset(struct sky2_hw *hw) |
| 2143 | { | 2141 | { |
| 2144 | u32 ctst; | ||
| 2145 | u16 status; | 2142 | u16 status; |
| 2146 | u8 t8, pmd_type; | 2143 | u8 t8, pmd_type; |
| 2147 | int i; | 2144 | int i, err; |
| 2148 | |||
| 2149 | ctst = sky2_read32(hw, B0_CTST); | ||
| 2150 | 2145 | ||
| 2151 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2146 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
| 2147 | |||
| 2152 | hw->chip_id = sky2_read8(hw, B2_CHIP_ID); | 2148 | hw->chip_id = sky2_read8(hw, B2_CHIP_ID); |
| 2153 | if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) { | 2149 | if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) { |
| 2154 | printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n", | 2150 | printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n", |
| @@ -2156,12 +2152,6 @@ static int sky2_reset(struct sky2_hw *hw) | |||
| 2156 | return -EOPNOTSUPP; | 2152 | return -EOPNOTSUPP; |
| 2157 | } | 2153 | } |
| 2158 | 2154 | ||
| 2159 | /* ring for status responses */ | ||
| 2160 | hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES, | ||
| 2161 | &hw->st_dma); | ||
| 2162 | if (!hw->st_le) | ||
| 2163 | return -ENOMEM; | ||
| 2164 | |||
| 2165 | /* disable ASF */ | 2155 | /* disable ASF */ |
| 2166 | if (hw->chip_id <= CHIP_ID_YUKON_EC) { | 2156 | if (hw->chip_id <= CHIP_ID_YUKON_EC) { |
| 2167 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); | 2157 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); |
| @@ -2173,19 +2163,24 @@ static int sky2_reset(struct sky2_hw *hw) | |||
| 2173 | sky2_write8(hw, B0_CTST, CS_RST_CLR); | 2163 | sky2_write8(hw, B0_CTST, CS_RST_CLR); |
| 2174 | 2164 | ||
| 2175 | /* clear PCI errors, if any */ | 2165 | /* clear PCI errors, if any */ |
| 2176 | pci_read_config_word(hw->pdev, PCI_STATUS, &status); | 2166 | err = pci_read_config_word(hw->pdev, PCI_STATUS, &status); |
| 2167 | if (err) | ||
| 2168 | goto pci_err; | ||
| 2169 | |||
| 2177 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | 2170 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); |
| 2178 | pci_write_config_word(hw->pdev, PCI_STATUS, | 2171 | err = pci_write_config_word(hw->pdev, PCI_STATUS, |
| 2179 | status | PCI_STATUS_ERROR_BITS); | 2172 | status | PCI_STATUS_ERROR_BITS); |
| 2173 | if (err) | ||
| 2174 | goto pci_err; | ||
| 2180 | 2175 | ||
| 2181 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); | 2176 | sky2_write8(hw, B0_CTST, CS_MRST_CLR); |
| 2182 | 2177 | ||
| 2183 | /* clear any PEX errors */ | 2178 | /* clear any PEX errors */ |
| 2184 | if (is_pciex(hw)) { | 2179 | if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) { |
| 2185 | u16 lstat; | 2180 | err = pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT, |
| 2186 | pci_write_config_dword(hw->pdev, PEX_UNC_ERR_STAT, | 2181 | 0xffffffffUL); |
| 2187 | 0xffffffffUL); | 2182 | if (err) |
| 2188 | pci_read_config_word(hw->pdev, PEX_LNK_STAT, &lstat); | 2183 | goto pci_err; |
| 2189 | } | 2184 | } |
| 2190 | 2185 | ||
| 2191 | pmd_type = sky2_read8(hw, B2_PMD_TYP); | 2186 | pmd_type = sky2_read8(hw, B2_PMD_TYP); |
| @@ -2297,6 +2292,14 @@ static int sky2_reset(struct sky2_hw *hw) | |||
| 2297 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); | 2292 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); |
| 2298 | 2293 | ||
| 2299 | return 0; | 2294 | return 0; |
| 2295 | |||
| 2296 | pci_err: | ||
| 2297 | /* This is to catch a BIOS bug workaround where | ||
| 2298 | * mmconfig table doesn't have other buses. | ||
| 2299 | */ | ||
| 2300 | printk(KERN_ERR PFX "%s: can't access PCI config space\n", | ||
| 2301 | pci_name(hw->pdev)); | ||
| 2302 | return err; | ||
| 2300 | } | 2303 | } |
| 2301 | 2304 | ||
| 2302 | static u32 sky2_supported_modes(const struct sky2_hw *hw) | 2305 | static u32 sky2_supported_modes(const struct sky2_hw *hw) |
| @@ -2551,19 +2554,24 @@ static struct net_device_stats *sky2_get_stats(struct net_device *dev) | |||
| 2551 | static int sky2_set_mac_address(struct net_device *dev, void *p) | 2554 | static int sky2_set_mac_address(struct net_device *dev, void *p) |
| 2552 | { | 2555 | { |
| 2553 | struct sky2_port *sky2 = netdev_priv(dev); | 2556 | struct sky2_port *sky2 = netdev_priv(dev); |
| 2554 | struct sockaddr *addr = p; | 2557 | struct sky2_hw *hw = sky2->hw; |
| 2558 | unsigned port = sky2->port; | ||
| 2559 | const struct sockaddr *addr = p; | ||
| 2555 | 2560 | ||
| 2556 | if (!is_valid_ether_addr(addr->sa_data)) | 2561 | if (!is_valid_ether_addr(addr->sa_data)) |
| 2557 | return -EADDRNOTAVAIL; | 2562 | return -EADDRNOTAVAIL; |
| 2558 | 2563 | ||
| 2559 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | 2564 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
| 2560 | memcpy_toio(sky2->hw->regs + B2_MAC_1 + sky2->port * 8, | 2565 | memcpy_toio(hw->regs + B2_MAC_1 + port * 8, |
| 2561 | dev->dev_addr, ETH_ALEN); | 2566 | dev->dev_addr, ETH_ALEN); |
| 2562 | memcpy_toio(sky2->hw->regs + B2_MAC_2 + sky2->port * 8, | 2567 | memcpy_toio(hw->regs + B2_MAC_2 + port * 8, |
| 2563 | dev->dev_addr, ETH_ALEN); | 2568 | dev->dev_addr, ETH_ALEN); |
| 2564 | 2569 | ||
| 2565 | if (netif_running(dev)) | 2570 | /* virtual address for data */ |
| 2566 | sky2_phy_reinit(sky2); | 2571 | gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); |
| 2572 | |||
| 2573 | /* physical address: used for pause frames */ | ||
| 2574 | gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); | ||
| 2567 | 2575 | ||
| 2568 | return 0; | 2576 | return 0; |
| 2569 | } | 2577 | } |
| @@ -2843,7 +2851,7 @@ static int sky2_set_coalesce(struct net_device *dev, | |||
| 2843 | if (ecmd->rx_coalesce_usecs_irq == 0) | 2851 | if (ecmd->rx_coalesce_usecs_irq == 0) |
| 2844 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_STOP); | 2852 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_STOP); |
| 2845 | else { | 2853 | else { |
| 2846 | sky2_write32(hw, STAT_TX_TIMER_INI, | 2854 | sky2_write32(hw, STAT_ISR_TIMER_INI, |
| 2847 | sky2_us2clk(hw, ecmd->rx_coalesce_usecs_irq)); | 2855 | sky2_us2clk(hw, ecmd->rx_coalesce_usecs_irq)); |
| 2848 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); | 2856 | sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START); |
| 2849 | } | 2857 | } |
| @@ -3055,6 +3063,61 @@ static void __devinit sky2_show_addr(struct net_device *dev) | |||
| 3055 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); | 3063 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
| 3056 | } | 3064 | } |
| 3057 | 3065 | ||
| 3066 | /* Handle software interrupt used during MSI test */ | ||
| 3067 | static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id, | ||
| 3068 | struct pt_regs *regs) | ||
| 3069 | { | ||
| 3070 | struct sky2_hw *hw = dev_id; | ||
| 3071 | u32 status = sky2_read32(hw, B0_Y2_SP_ISRC2); | ||
| 3072 | |||
| 3073 | if (status == 0) | ||
| 3074 | return IRQ_NONE; | ||
| 3075 | |||
| 3076 | if (status & Y2_IS_IRQ_SW) { | ||
| 3077 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); | ||
| 3078 | hw->msi = 1; | ||
| 3079 | } | ||
| 3080 | sky2_write32(hw, B0_Y2_SP_ICR, 2); | ||
| 3081 | |||
| 3082 | sky2_read32(hw, B0_IMSK); | ||
| 3083 | return IRQ_HANDLED; | ||
| 3084 | } | ||
| 3085 | |||
| 3086 | /* Test interrupt path by forcing a a software IRQ */ | ||
| 3087 | static int __devinit sky2_test_msi(struct sky2_hw *hw) | ||
| 3088 | { | ||
| 3089 | struct pci_dev *pdev = hw->pdev; | ||
| 3090 | int i, err; | ||
| 3091 | |||
| 3092 | sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); | ||
| 3093 | |||
| 3094 | err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw); | ||
| 3095 | if (err) { | ||
| 3096 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | ||
| 3097 | pci_name(pdev), pdev->irq); | ||
| 3098 | return err; | ||
| 3099 | } | ||
| 3100 | |||
| 3101 | sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); | ||
| 3102 | wmb(); | ||
| 3103 | |||
| 3104 | for (i = 0; i < 10; i++) { | ||
| 3105 | barrier(); | ||
| 3106 | if (hw->msi) | ||
| 3107 | goto found; | ||
| 3108 | mdelay(1); | ||
| 3109 | } | ||
| 3110 | |||
| 3111 | err = -EOPNOTSUPP; | ||
| 3112 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); | ||
| 3113 | found: | ||
| 3114 | sky2_write32(hw, B0_IMSK, 0); | ||
| 3115 | |||
| 3116 | free_irq(pdev->irq, hw); | ||
| 3117 | |||
| 3118 | return err; | ||
| 3119 | } | ||
| 3120 | |||
| 3058 | static int __devinit sky2_probe(struct pci_dev *pdev, | 3121 | static int __devinit sky2_probe(struct pci_dev *pdev, |
| 3059 | const struct pci_device_id *ent) | 3122 | const struct pci_device_id *ent) |
| 3060 | { | 3123 | { |
| @@ -3135,6 +3198,12 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
| 3135 | } | 3198 | } |
| 3136 | hw->pm_cap = pm_cap; | 3199 | hw->pm_cap = pm_cap; |
| 3137 | 3200 | ||
| 3201 | /* ring for status responses */ | ||
| 3202 | hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES, | ||
| 3203 | &hw->st_dma); | ||
| 3204 | if (!hw->st_le) | ||
| 3205 | goto err_out_iounmap; | ||
| 3206 | |||
| 3138 | err = sky2_reset(hw); | 3207 | err = sky2_reset(hw); |
| 3139 | if (err) | 3208 | if (err) |
| 3140 | goto err_out_iounmap; | 3209 | goto err_out_iounmap; |
| @@ -3169,7 +3238,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
| 3169 | } | 3238 | } |
| 3170 | } | 3239 | } |
| 3171 | 3240 | ||
| 3172 | err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw); | 3241 | if (!disable_msi && pci_enable_msi(pdev) == 0) { |
| 3242 | err = sky2_test_msi(hw); | ||
| 3243 | if (err == -EOPNOTSUPP) { | ||
| 3244 | /* MSI test failed, go back to INTx mode */ | ||
| 3245 | printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, " | ||
| 3246 | "switching to INTx mode. Please report this failure to " | ||
| 3247 | "the PCI maintainer and include system chipset information.\n", | ||
| 3248 | pci_name(pdev)); | ||
| 3249 | pci_disable_msi(pdev); | ||
| 3250 | } | ||
| 3251 | else if (err) | ||
| 3252 | goto err_out_unregister; | ||
| 3253 | } | ||
| 3254 | |||
| 3255 | err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ | SA_SAMPLE_RANDOM, | ||
| 3256 | DRV_NAME, hw); | ||
| 3173 | if (err) { | 3257 | if (err) { |
| 3174 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | 3258 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", |
| 3175 | pci_name(pdev), pdev->irq); | 3259 | pci_name(pdev), pdev->irq); |
| @@ -3184,6 +3268,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
| 3184 | return 0; | 3268 | return 0; |
| 3185 | 3269 | ||
| 3186 | err_out_unregister: | 3270 | err_out_unregister: |
| 3271 | if (hw->msi) | ||
| 3272 | pci_disable_msi(pdev); | ||
| 3187 | if (dev1) { | 3273 | if (dev1) { |
| 3188 | unregister_netdev(dev1); | 3274 | unregister_netdev(dev1); |
| 3189 | free_netdev(dev1); | 3275 | free_netdev(dev1); |
| @@ -3226,6 +3312,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev) | |||
| 3226 | sky2_read8(hw, B0_CTST); | 3312 | sky2_read8(hw, B0_CTST); |
| 3227 | 3313 | ||
| 3228 | free_irq(pdev->irq, hw); | 3314 | free_irq(pdev->irq, hw); |
| 3315 | if (hw->msi) | ||
| 3316 | pci_disable_msi(pdev); | ||
| 3229 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); | 3317 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); |
| 3230 | pci_release_regions(pdev); | 3318 | pci_release_regions(pdev); |
| 3231 | pci_disable_device(pdev); | 3319 | pci_disable_device(pdev); |
| @@ -3263,25 +3351,33 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 3263 | static int sky2_resume(struct pci_dev *pdev) | 3351 | static int sky2_resume(struct pci_dev *pdev) |
| 3264 | { | 3352 | { |
| 3265 | struct sky2_hw *hw = pci_get_drvdata(pdev); | 3353 | struct sky2_hw *hw = pci_get_drvdata(pdev); |
| 3266 | int i; | 3354 | int i, err; |
| 3267 | 3355 | ||
| 3268 | pci_restore_state(pdev); | 3356 | pci_restore_state(pdev); |
| 3269 | pci_enable_wake(pdev, PCI_D0, 0); | 3357 | pci_enable_wake(pdev, PCI_D0, 0); |
| 3270 | sky2_set_power_state(hw, PCI_D0); | 3358 | err = sky2_set_power_state(hw, PCI_D0); |
| 3359 | if (err) | ||
| 3360 | goto out; | ||
| 3271 | 3361 | ||
| 3272 | sky2_reset(hw); | 3362 | err = sky2_reset(hw); |
| 3363 | if (err) | ||
| 3364 | goto out; | ||
| 3273 | 3365 | ||
| 3274 | for (i = 0; i < 2; i++) { | 3366 | for (i = 0; i < 2; i++) { |
| 3275 | struct net_device *dev = hw->dev[i]; | 3367 | struct net_device *dev = hw->dev[i]; |
| 3276 | if (dev) { | 3368 | if (dev && netif_running(dev)) { |
| 3277 | if (netif_running(dev)) { | 3369 | netif_device_attach(dev); |
| 3278 | netif_device_attach(dev); | 3370 | err = sky2_up(dev); |
| 3279 | if (sky2_up(dev)) | 3371 | if (err) { |
| 3280 | dev_close(dev); | 3372 | printk(KERN_ERR PFX "%s: could not up: %d\n", |
| 3373 | dev->name, err); | ||
| 3374 | dev_close(dev); | ||
| 3375 | break; | ||
| 3281 | } | 3376 | } |
| 3282 | } | 3377 | } |
| 3283 | } | 3378 | } |
| 3284 | return 0; | 3379 | out: |
| 3380 | return err; | ||
| 3285 | } | 3381 | } |
| 3286 | #endif | 3382 | #endif |
| 3287 | 3383 | ||
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 95518921001c..fd12c289a238 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
| @@ -1841,6 +1841,7 @@ struct sky2_hw { | |||
| 1841 | struct net_device *dev[2]; | 1841 | struct net_device *dev[2]; |
| 1842 | 1842 | ||
| 1843 | int pm_cap; | 1843 | int pm_cap; |
| 1844 | int msi; | ||
| 1844 | u8 chip_id; | 1845 | u8 chip_id; |
| 1845 | u8 chip_rev; | 1846 | u8 chip_rev; |
| 1846 | u8 copper; | 1847 | u8 copper; |
| @@ -1867,14 +1868,6 @@ static inline u8 sky2_read8(const struct sky2_hw *hw, unsigned reg) | |||
| 1867 | return readb(hw->regs + reg); | 1868 | return readb(hw->regs + reg); |
| 1868 | } | 1869 | } |
| 1869 | 1870 | ||
| 1870 | /* This should probably go away, bus based tweeks suck */ | ||
| 1871 | static inline int is_pciex(const struct sky2_hw *hw) | ||
| 1872 | { | ||
| 1873 | u32 status; | ||
| 1874 | pci_read_config_dword(hw->pdev, PCI_DEV_STATUS, &status); | ||
| 1875 | return (status & PCI_OS_PCI_X) == 0; | ||
| 1876 | } | ||
| 1877 | |||
| 1878 | static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val) | 1871 | static inline void sky2_write32(const struct sky2_hw *hw, unsigned reg, u32 val) |
| 1879 | { | 1872 | { |
| 1880 | writel(val, hw->regs + reg); | 1873 | writel(val, hw->regs + reg); |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 983981666800..238e9c72cb3a 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
| @@ -214,7 +214,7 @@ static u32 uli526x_cr6_user_set; | |||
| 214 | /* For module input parameter */ | 214 | /* For module input parameter */ |
| 215 | static int debug; | 215 | static int debug; |
| 216 | static u32 cr6set; | 216 | static u32 cr6set; |
| 217 | static unsigned char mode = 8; | 217 | static int mode = 8; |
| 218 | 218 | ||
| 219 | /* function declaration ------------------------------------- */ | 219 | /* function declaration ------------------------------------- */ |
| 220 | static int uli526x_open(struct net_device *); | 220 | static int uli526x_open(struct net_device *); |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 2f61a47b4716..1ff5de076d21 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
| @@ -1943,7 +1943,7 @@ static int dscc4_init_ring(struct net_device *dev) | |||
| 1943 | (++i%TX_RING_SIZE)*sizeof(*tx_fd)); | 1943 | (++i%TX_RING_SIZE)*sizeof(*tx_fd)); |
| 1944 | } while (i < TX_RING_SIZE); | 1944 | } while (i < TX_RING_SIZE); |
| 1945 | 1945 | ||
| 1946 | if (dscc4_init_dummy_skb(dpriv) < 0) | 1946 | if (!dscc4_init_dummy_skb(dpriv)) |
| 1947 | goto err_free_dma_tx; | 1947 | goto err_free_dma_tx; |
| 1948 | 1948 | ||
| 1949 | memset(dpriv->rx_skbuff, 0, sizeof(struct sk_buff *)*RX_RING_SIZE); | 1949 | memset(dpriv->rx_skbuff, 0, sizeof(struct sk_buff *)*RX_RING_SIZE); |
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index 8cbf0fc5a225..7f0f35a05dca 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c | |||
| @@ -332,7 +332,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg | |||
| 332 | * Make sure that we do not overflow the buffer | 332 | * Make sure that we do not overflow the buffer |
| 333 | */ | 333 | */ |
| 334 | if (tty_request_buffer_room(tty, 1) == 0) { | 334 | if (tty_request_buffer_room(tty, 1) == 0) { |
| 335 | schedule_work(&tty->flip.work); | 335 | tty_schedule_flip(tty); |
| 336 | return; | 336 | return; |
| 337 | } | 337 | } |
| 338 | 338 | ||
| @@ -353,7 +353,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg | |||
| 353 | } while((rx = uart->urx.w) & URX_DATA_READY); | 353 | } while((rx = uart->urx.w) & URX_DATA_READY); |
| 354 | #endif | 354 | #endif |
| 355 | 355 | ||
| 356 | schedule_work(&tty->flip.work); | 356 | tty_schedule_flip(tty); |
| 357 | 357 | ||
| 358 | clear_and_exit: | 358 | clear_and_exit: |
| 359 | return; | 359 | return; |
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 60f5a5dc17f1..9843ae3d420e 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
| @@ -509,7 +509,7 @@ static _INLINE_ void receive_chars(ser_info_t *info) | |||
| 509 | 509 | ||
| 510 | info->rx_cur = (QUICC_BD *)bdp; | 510 | info->rx_cur = (QUICC_BD *)bdp; |
| 511 | 511 | ||
| 512 | schedule_work(&tty->flip.work); | 512 | tty_schedule_flip(tty); |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | static _INLINE_ void receive_break(ser_info_t *info) | 515 | static _INLINE_ void receive_break(ser_info_t *info) |
| @@ -521,7 +521,7 @@ static _INLINE_ void receive_break(ser_info_t *info) | |||
| 521 | * the break. If not, we exit now, losing the break. FIXME | 521 | * the break. If not, we exit now, losing the break. FIXME |
| 522 | */ | 522 | */ |
| 523 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 523 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
| 524 | schedule_work(&tty->flip.work); | 524 | tty_schedule_flip(tty); |
| 525 | } | 525 | } |
| 526 | 526 | ||
| 527 | static _INLINE_ void transmit_chars(ser_info_t *info) | 527 | static _INLINE_ void transmit_chars(ser_info_t *info) |
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index 0ef648fa4b2d..8cbbb954df2c 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c | |||
| @@ -57,20 +57,16 @@ struct timer_list mcfrs_timer_struct; | |||
| 57 | * keep going. Perhaps one day the cflag settings for the | 57 | * keep going. Perhaps one day the cflag settings for the |
| 58 | * console can be used instead. | 58 | * console can be used instead. |
| 59 | */ | 59 | */ |
| 60 | #if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ | ||
| 61 | defined(CONFIG_senTec) || defined(CONFIG_SNEHA) | ||
| 62 | #define CONSOLE_BAUD_RATE 19200 | ||
| 63 | #define DEFAULT_CBAUD B19200 | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #if defined(CONFIG_HW_FEITH) | 60 | #if defined(CONFIG_HW_FEITH) |
| 67 | #define CONSOLE_BAUD_RATE 38400 | 61 | #define CONSOLE_BAUD_RATE 38400 |
| 68 | #define DEFAULT_CBAUD B38400 | 62 | #define DEFAULT_CBAUD B38400 |
| 69 | #endif | 63 | #elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) |
| 70 | |||
| 71 | #if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) | ||
| 72 | #define CONSOLE_BAUD_RATE 115200 | 64 | #define CONSOLE_BAUD_RATE 115200 |
| 73 | #define DEFAULT_CBAUD B115200 | 65 | #define DEFAULT_CBAUD B115200 |
| 66 | #elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ | ||
| 67 | defined(CONFIG_senTec) || defined(CONFIG_SNEHA) | ||
| 68 | #define CONSOLE_BAUD_RATE 19200 | ||
| 69 | #define DEFAULT_CBAUD B19200 | ||
| 74 | #endif | 70 | #endif |
| 75 | 71 | ||
| 76 | #ifndef CONSOLE_BAUD_RATE | 72 | #ifndef CONSOLE_BAUD_RATE |
| @@ -350,7 +346,7 @@ static inline void receive_chars(struct mcf_serial *info) | |||
| 350 | } | 346 | } |
| 351 | tty_insert_flip_char(tty, ch, flag); | 347 | tty_insert_flip_char(tty, ch, flag); |
| 352 | } | 348 | } |
| 353 | tty_flip_buffer_push(tty); | 349 | tty_schedule_flip(tty); |
| 354 | return; | 350 | return; |
| 355 | } | 351 | } |
| 356 | 352 | ||
diff --git a/fs/inotify.c b/fs/inotify.c index 878ccca61213..3041503bde02 100644 --- a/fs/inotify.c +++ b/fs/inotify.c | |||
| @@ -967,7 +967,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) | |||
| 967 | mask_add = 1; | 967 | mask_add = 1; |
| 968 | 968 | ||
| 969 | /* don't let user-space set invalid bits: we don't want flags set */ | 969 | /* don't let user-space set invalid bits: we don't want flags set */ |
| 970 | mask &= IN_ALL_EVENTS; | 970 | mask &= IN_ALL_EVENTS | IN_ONESHOT; |
| 971 | if (unlikely(!mask)) { | 971 | if (unlikely(!mask)) { |
| 972 | ret = -EINVAL; | 972 | ret = -EINVAL; |
| 973 | goto out; | 973 | goto out; |
diff --git a/fs/namei.c b/fs/namei.c index faf61c35308c..e28de846c591 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1119,9 +1119,11 @@ static int fastcall do_path_lookup(int dfd, const char *name, | |||
| 1119 | current->total_link_count = 0; | 1119 | current->total_link_count = 0; |
| 1120 | retval = link_path_walk(name, nd); | 1120 | retval = link_path_walk(name, nd); |
| 1121 | out: | 1121 | out: |
| 1122 | if (unlikely(current->audit_context | 1122 | if (likely(retval == 0)) { |
| 1123 | && nd && nd->dentry && nd->dentry->d_inode)) | 1123 | if (unlikely(current->audit_context && nd && nd->dentry && |
| 1124 | nd->dentry->d_inode)) | ||
| 1124 | audit_inode(name, nd->dentry->d_inode, flags); | 1125 | audit_inode(name, nd->dentry->d_inode, flags); |
| 1126 | } | ||
| 1125 | return retval; | 1127 | return retval; |
| 1126 | 1128 | ||
| 1127 | fput_unlock_fail: | 1129 | fput_unlock_fail: |
diff --git a/fs/namespace.c b/fs/namespace.c index ce97becff461..a2bef5c81033 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
| @@ -1325,27 +1325,17 @@ dput_out: | |||
| 1325 | return retval; | 1325 | return retval; |
| 1326 | } | 1326 | } |
| 1327 | 1327 | ||
| 1328 | int copy_namespace(int flags, struct task_struct *tsk) | 1328 | /* |
| 1329 | * Allocate a new namespace structure and populate it with contents | ||
| 1330 | * copied from the namespace of the passed in task structure. | ||
| 1331 | */ | ||
| 1332 | struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) | ||
| 1329 | { | 1333 | { |
| 1330 | struct namespace *namespace = tsk->namespace; | 1334 | struct namespace *namespace = tsk->namespace; |
| 1331 | struct namespace *new_ns; | 1335 | struct namespace *new_ns; |
| 1332 | struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; | 1336 | struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; |
| 1333 | struct fs_struct *fs = tsk->fs; | ||
| 1334 | struct vfsmount *p, *q; | 1337 | struct vfsmount *p, *q; |
| 1335 | 1338 | ||
| 1336 | if (!namespace) | ||
| 1337 | return 0; | ||
| 1338 | |||
| 1339 | get_namespace(namespace); | ||
| 1340 | |||
| 1341 | if (!(flags & CLONE_NEWNS)) | ||
| 1342 | return 0; | ||
| 1343 | |||
| 1344 | if (!capable(CAP_SYS_ADMIN)) { | ||
| 1345 | put_namespace(namespace); | ||
| 1346 | return -EPERM; | ||
| 1347 | } | ||
| 1348 | |||
| 1349 | new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); | 1339 | new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); |
| 1350 | if (!new_ns) | 1340 | if (!new_ns) |
| 1351 | goto out; | 1341 | goto out; |
| @@ -1396,8 +1386,6 @@ int copy_namespace(int flags, struct task_struct *tsk) | |||
| 1396 | } | 1386 | } |
| 1397 | up_write(&namespace_sem); | 1387 | up_write(&namespace_sem); |
| 1398 | 1388 | ||
| 1399 | tsk->namespace = new_ns; | ||
| 1400 | |||
| 1401 | if (rootmnt) | 1389 | if (rootmnt) |
| 1402 | mntput(rootmnt); | 1390 | mntput(rootmnt); |
| 1403 | if (pwdmnt) | 1391 | if (pwdmnt) |
| @@ -1405,12 +1393,40 @@ int copy_namespace(int flags, struct task_struct *tsk) | |||
| 1405 | if (altrootmnt) | 1393 | if (altrootmnt) |
| 1406 | mntput(altrootmnt); | 1394 | mntput(altrootmnt); |
| 1407 | 1395 | ||
| 1408 | put_namespace(namespace); | 1396 | out: |
| 1409 | return 0; | 1397 | return new_ns; |
| 1398 | } | ||
| 1399 | |||
| 1400 | int copy_namespace(int flags, struct task_struct *tsk) | ||
| 1401 | { | ||
| 1402 | struct namespace *namespace = tsk->namespace; | ||
| 1403 | struct namespace *new_ns; | ||
| 1404 | int err = 0; | ||
| 1405 | |||
| 1406 | if (!namespace) | ||
| 1407 | return 0; | ||
| 1408 | |||
| 1409 | get_namespace(namespace); | ||
| 1410 | |||
| 1411 | if (!(flags & CLONE_NEWNS)) | ||
| 1412 | return 0; | ||
| 1413 | |||
| 1414 | if (!capable(CAP_SYS_ADMIN)) { | ||
| 1415 | err = -EPERM; | ||
| 1416 | goto out; | ||
| 1417 | } | ||
| 1418 | |||
| 1419 | new_ns = dup_namespace(tsk, tsk->fs); | ||
| 1420 | if (!new_ns) { | ||
| 1421 | err = -ENOMEM; | ||
| 1422 | goto out; | ||
| 1423 | } | ||
| 1424 | |||
| 1425 | tsk->namespace = new_ns; | ||
| 1410 | 1426 | ||
| 1411 | out: | 1427 | out: |
| 1412 | put_namespace(namespace); | 1428 | put_namespace(namespace); |
| 1413 | return -ENOMEM; | 1429 | return err; |
| 1414 | } | 1430 | } |
| 1415 | 1431 | ||
| 1416 | asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, | 1432 | asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index a00fe8686293..6d63f1d9e5f5 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -195,10 +195,12 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
| 195 | 195 | ||
| 196 | /* Openowner is now set, so sequence id will get bumped. Now we need | 196 | /* Openowner is now set, so sequence id will get bumped. Now we need |
| 197 | * these checks before we do any creates: */ | 197 | * these checks before we do any creates: */ |
| 198 | status = nfserr_grace; | ||
| 198 | if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) | 199 | if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) |
| 199 | return nfserr_grace; | 200 | goto out; |
| 201 | status = nfserr_no_grace; | ||
| 200 | if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) | 202 | if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) |
| 201 | return nfserr_no_grace; | 203 | goto out; |
| 202 | 204 | ||
| 203 | switch (open->op_claim_type) { | 205 | switch (open->op_claim_type) { |
| 204 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: | 206 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: |
diff --git a/fs/super.c b/fs/super.c index c177b92419c5..30294218fa63 100644 --- a/fs/super.c +++ b/fs/super.c | |||
| @@ -247,8 +247,9 @@ void generic_shutdown_super(struct super_block *sb) | |||
| 247 | 247 | ||
| 248 | /* Forget any remaining inodes */ | 248 | /* Forget any remaining inodes */ |
| 249 | if (invalidate_inodes(sb)) { | 249 | if (invalidate_inodes(sb)) { |
| 250 | printk("VFS: Busy inodes after unmount. " | 250 | printk("VFS: Busy inodes after unmount of %s. " |
| 251 | "Self-destruct in 5 seconds. Have a nice day...\n"); | 251 | "Self-destruct in 5 seconds. Have a nice day...\n", |
| 252 | sb->s_id); | ||
| 252 | } | 253 | } |
| 253 | 254 | ||
| 254 | unlock_kernel(); | 255 | unlock_kernel(); |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 9892268e3005..8f2beec526cf 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -747,10 +747,11 @@ xfs_convert_page( | |||
| 747 | struct backing_dev_info *bdi; | 747 | struct backing_dev_info *bdi; |
| 748 | 748 | ||
| 749 | bdi = inode->i_mapping->backing_dev_info; | 749 | bdi = inode->i_mapping->backing_dev_info; |
| 750 | wbc->nr_to_write--; | ||
| 750 | if (bdi_write_congested(bdi)) { | 751 | if (bdi_write_congested(bdi)) { |
| 751 | wbc->encountered_congestion = 1; | 752 | wbc->encountered_congestion = 1; |
| 752 | done = 1; | 753 | done = 1; |
| 753 | } else if (--wbc->nr_to_write <= 0) { | 754 | } else if (wbc->nr_to_write <= 0) { |
| 754 | done = 1; | 755 | done = 1; |
| 755 | } | 756 | } |
| 756 | } | 757 | } |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index eda7919b70a1..d7f6f2d8ac8e 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -673,6 +673,8 @@ linvfs_setattr( | |||
| 673 | if (ia_valid & ATTR_ATIME) { | 673 | if (ia_valid & ATTR_ATIME) { |
| 674 | vattr.va_mask |= XFS_AT_ATIME; | 674 | vattr.va_mask |= XFS_AT_ATIME; |
| 675 | vattr.va_atime = attr->ia_atime; | 675 | vattr.va_atime = attr->ia_atime; |
| 676 | if (ia_valid & ATTR_ATIME_SET) | ||
| 677 | inode->i_atime = attr->ia_atime; | ||
| 676 | } | 678 | } |
| 677 | if (ia_valid & ATTR_MTIME) { | 679 | if (ia_valid & ATTR_MTIME) { |
| 678 | vattr.va_mask |= XFS_AT_MTIME; | 680 | vattr.va_mask |= XFS_AT_MTIME; |
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index cc9c7e8cced5..f3b7b1a59c56 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h | |||
| @@ -572,7 +572,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) | |||
| 572 | if something tries to do an invalid cmpxchg(). */ | 572 | if something tries to do an invalid cmpxchg(). */ |
| 573 | extern void __cmpxchg_called_with_bad_pointer(void); | 573 | extern void __cmpxchg_called_with_bad_pointer(void); |
| 574 | 574 | ||
| 575 | static inline unsigned long | 575 | static __always_inline unsigned long |
| 576 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | 576 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) |
| 577 | { | 577 | { |
| 578 | switch (size) { | 578 | switch (size) { |
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 597496ed2aee..cf6f2cd9c514 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
| @@ -315,8 +315,9 @@ | |||
| 315 | #define __NR_faccessat 307 | 315 | #define __NR_faccessat 307 |
| 316 | #define __NR_pselect6 308 | 316 | #define __NR_pselect6 308 |
| 317 | #define __NR_ppoll 309 | 317 | #define __NR_ppoll 309 |
| 318 | #define __NR_unshare 310 | ||
| 318 | 319 | ||
| 319 | #define NR_syscalls 310 | 320 | #define NR_syscalls 311 |
| 320 | 321 | ||
| 321 | /* | 322 | /* |
| 322 | * user-visible error numbers are in the range -1 - -128: see | 323 | * user-visible error numbers are in the range -1 - -128: see |
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 09b99029ac1a..23c8e1be1911 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
| @@ -559,6 +559,23 @@ ia64_eoi (void) | |||
| 559 | 559 | ||
| 560 | #define cpu_relax() ia64_hint(ia64_hint_pause) | 560 | #define cpu_relax() ia64_hint(ia64_hint_pause) |
| 561 | 561 | ||
| 562 | static inline int | ||
| 563 | ia64_get_irr(unsigned int vector) | ||
| 564 | { | ||
| 565 | unsigned int reg = vector / 64; | ||
| 566 | unsigned int bit = vector % 64; | ||
| 567 | u64 irr; | ||
| 568 | |||
| 569 | switch (reg) { | ||
| 570 | case 0: irr = ia64_getreg(_IA64_REG_CR_IRR0); break; | ||
| 571 | case 1: irr = ia64_getreg(_IA64_REG_CR_IRR1); break; | ||
| 572 | case 2: irr = ia64_getreg(_IA64_REG_CR_IRR2); break; | ||
| 573 | case 3: irr = ia64_getreg(_IA64_REG_CR_IRR3); break; | ||
| 574 | } | ||
| 575 | |||
| 576 | return test_bit(bit, &irr); | ||
| 577 | } | ||
| 578 | |||
| 562 | static inline void | 579 | static inline void |
| 563 | ia64_set_lrr0 (unsigned long val) | 580 | ia64_set_lrr0 (unsigned long val) |
| 564 | { | 581 | { |
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h index 313cad0628d0..0b210abbe003 100644 --- a/include/asm-ia64/sal.h +++ b/include/asm-ia64/sal.h | |||
| @@ -658,15 +658,7 @@ ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second, | |||
| 658 | return isrv.status; | 658 | return isrv.status; |
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | /* Flush all the processor and platform level instruction and/or data caches */ | 661 | extern s64 ia64_sal_cache_flush (u64 cache_type); |
| 662 | static inline s64 | ||
| 663 | ia64_sal_cache_flush (u64 cache_type) | ||
| 664 | { | ||
| 665 | struct ia64_sal_retval isrv; | ||
| 666 | SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0); | ||
| 667 | return isrv.status; | ||
| 668 | } | ||
| 669 | |||
| 670 | 662 | ||
| 671 | /* Initialize all the processor and platform level instruction and data caches */ | 663 | /* Initialize all the processor and platform level instruction and data caches */ |
| 672 | static inline s64 | 664 | static inline s64 |
diff --git a/include/asm-ia64/sn/bte.h b/include/asm-ia64/sn/bte.h index f50da3d91d07..01e5b4103235 100644 --- a/include/asm-ia64/sn/bte.h +++ b/include/asm-ia64/sn/bte.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | 9 | ||
| @@ -100,13 +100,28 @@ | |||
| 100 | #define BTE_LNSTAT_STORE(_bte, _x) \ | 100 | #define BTE_LNSTAT_STORE(_bte, _x) \ |
| 101 | HUB_S(_bte->bte_base_addr, (_x)) | 101 | HUB_S(_bte->bte_base_addr, (_x)) |
| 102 | #define BTE_SRC_STORE(_bte, _x) \ | 102 | #define BTE_SRC_STORE(_bte, _x) \ |
| 103 | HUB_S(_bte->bte_source_addr, (_x)) | 103 | ({ \ |
| 104 | u64 __addr = ((_x) & ~AS_MASK); \ | ||
| 105 | if (is_shub2()) \ | ||
| 106 | __addr = SH2_TIO_PHYS_TO_DMA(__addr); \ | ||
| 107 | HUB_S(_bte->bte_source_addr, __addr); \ | ||
| 108 | }) | ||
| 104 | #define BTE_DEST_STORE(_bte, _x) \ | 109 | #define BTE_DEST_STORE(_bte, _x) \ |
| 105 | HUB_S(_bte->bte_destination_addr, (_x)) | 110 | ({ \ |
| 111 | u64 __addr = ((_x) & ~AS_MASK); \ | ||
| 112 | if (is_shub2()) \ | ||
| 113 | __addr = SH2_TIO_PHYS_TO_DMA(__addr); \ | ||
| 114 | HUB_S(_bte->bte_destination_addr, __addr); \ | ||
| 115 | }) | ||
| 106 | #define BTE_CTRL_STORE(_bte, _x) \ | 116 | #define BTE_CTRL_STORE(_bte, _x) \ |
| 107 | HUB_S(_bte->bte_control_addr, (_x)) | 117 | HUB_S(_bte->bte_control_addr, (_x)) |
| 108 | #define BTE_NOTIF_STORE(_bte, _x) \ | 118 | #define BTE_NOTIF_STORE(_bte, _x) \ |
| 109 | HUB_S(_bte->bte_notify_addr, (_x)) | 119 | ({ \ |
| 120 | u64 __addr = ia64_tpa((_x) & ~AS_MASK); \ | ||
| 121 | if (is_shub2()) \ | ||
| 122 | __addr = SH2_TIO_PHYS_TO_DMA(__addr); \ | ||
| 123 | HUB_S(_bte->bte_notify_addr, __addr); \ | ||
| 124 | }) | ||
| 110 | 125 | ||
| 111 | #define BTE_START_TRANSFER(_bte, _len, _mode) \ | 126 | #define BTE_START_TRANSFER(_bte, _len, _mode) \ |
| 112 | is_shub2() ? BTE_CTRL_STORE(_bte, IBLS_BUSY | (_mode << 24) | _len) \ | 127 | is_shub2() ? BTE_CTRL_STORE(_bte, IBLS_BUSY | (_mode << 24) | _len) \ |
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h index a3431372c6e7..60a51a406eec 100644 --- a/include/asm-ia64/sn/intr.h +++ b/include/asm-ia64/sn/intr.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. | 6 | * Copyright (C) 1992 - 1997, 2000-2006 Silicon Graphics, Inc. All rights reserved. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #ifndef _ASM_IA64_SN_INTR_H | 9 | #ifndef _ASM_IA64_SN_INTR_H |
| @@ -11,26 +11,26 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/rcupdate.h> | 12 | #include <linux/rcupdate.h> |
| 13 | 13 | ||
| 14 | #define SGI_UART_VECTOR (0xe9) | 14 | #define SGI_UART_VECTOR 0xe9 |
| 15 | 15 | ||
| 16 | /* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */ | 16 | /* Reserved IRQs : Note, not to exceed IA64_SN2_FIRST_DEVICE_VECTOR */ |
| 17 | #define SGI_XPC_ACTIVATE (0x30) | 17 | #define SGI_XPC_ACTIVATE 0x30 |
| 18 | #define SGI_II_ERROR (0x31) | 18 | #define SGI_II_ERROR 0x31 |
| 19 | #define SGI_XBOW_ERROR (0x32) | 19 | #define SGI_XBOW_ERROR 0x32 |
| 20 | #define SGI_PCIASIC_ERROR (0x33) | 20 | #define SGI_PCIASIC_ERROR 0x33 |
| 21 | #define SGI_ACPI_SCI_INT (0x34) | 21 | #define SGI_ACPI_SCI_INT 0x34 |
| 22 | #define SGI_TIOCA_ERROR (0x35) | 22 | #define SGI_TIOCA_ERROR 0x35 |
| 23 | #define SGI_TIO_ERROR (0x36) | 23 | #define SGI_TIO_ERROR 0x36 |
| 24 | #define SGI_TIOCX_ERROR (0x37) | 24 | #define SGI_TIOCX_ERROR 0x37 |
| 25 | #define SGI_MMTIMER_VECTOR (0x38) | 25 | #define SGI_MMTIMER_VECTOR 0x38 |
| 26 | #define SGI_XPC_NOTIFY (0xe7) | 26 | #define SGI_XPC_NOTIFY 0xe7 |
| 27 | 27 | ||
| 28 | #define IA64_SN2_FIRST_DEVICE_VECTOR (0x3c) | 28 | #define IA64_SN2_FIRST_DEVICE_VECTOR 0x3c |
| 29 | #define IA64_SN2_LAST_DEVICE_VECTOR (0xe6) | 29 | #define IA64_SN2_LAST_DEVICE_VECTOR 0xe6 |
| 30 | 30 | ||
| 31 | #define SN2_IRQ_RESERVED (0x1) | 31 | #define SN2_IRQ_RESERVED 0x1 |
| 32 | #define SN2_IRQ_CONNECTED (0x2) | 32 | #define SN2_IRQ_CONNECTED 0x2 |
| 33 | #define SN2_IRQ_SHARED (0x4) | 33 | #define SN2_IRQ_SHARED 0x4 |
| 34 | 34 | ||
| 35 | // The SN PROM irq struct | 35 | // The SN PROM irq struct |
| 36 | struct sn_irq_info { | 36 | struct sn_irq_info { |
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 80c5a234e259..062538715623 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h | |||
| @@ -249,32 +249,7 @@ extern void ia64_load_extra (struct task_struct *task); | |||
| 249 | # define switch_to(prev,next,last) __switch_to(prev, next, last) | 249 | # define switch_to(prev,next,last) __switch_to(prev, next, last) |
| 250 | #endif | 250 | #endif |
| 251 | 251 | ||
| 252 | /* | ||
| 253 | * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch, | ||
| 254 | * because that could cause a deadlock. Here is an example by Erich Focht: | ||
| 255 | * | ||
| 256 | * Example: | ||
| 257 | * CPU#0: | ||
| 258 | * schedule() | ||
| 259 | * -> spin_lock_irq(&rq->lock) | ||
| 260 | * -> context_switch() | ||
| 261 | * -> wrap_mmu_context() | ||
| 262 | * -> read_lock(&tasklist_lock) | ||
| 263 | * | ||
| 264 | * CPU#1: | ||
| 265 | * sys_wait4() or release_task() or forget_original_parent() | ||
| 266 | * -> write_lock(&tasklist_lock) | ||
| 267 | * -> do_notify_parent() | ||
| 268 | * -> wake_up_parent() | ||
| 269 | * -> try_to_wake_up() | ||
| 270 | * -> spin_lock_irq(&parent_rq->lock) | ||
| 271 | * | ||
| 272 | * If the parent's rq happens to be on CPU#0, we'll wait for the rq->lock | ||
| 273 | * of that CPU which will not be released, because there we wait for the | ||
| 274 | * tasklist_lock to become available. | ||
| 275 | */ | ||
| 276 | #define __ARCH_WANT_UNLOCKED_CTXSW | 252 | #define __ARCH_WANT_UNLOCKED_CTXSW |
| 277 | |||
| 278 | #define ARCH_HAS_PREFETCH_SWITCH_STACK | 253 | #define ARCH_HAS_PREFETCH_SWITCH_STACK |
| 279 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) | 254 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) |
| 280 | 255 | ||
diff --git a/include/asm-m68knommu/hardirq.h b/include/asm-m68knommu/hardirq.h index e8659e739a64..476180f4cba2 100644 --- a/include/asm-m68knommu/hardirq.h +++ b/include/asm-m68knommu/hardirq.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
| 5 | #include <linux/cache.h> | 5 | #include <linux/cache.h> |
| 6 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
| 7 | #include <asm/irq.h> | ||
| 7 | 8 | ||
| 8 | typedef struct { | 9 | typedef struct { |
| 9 | unsigned int __softirq_pending; | 10 | unsigned int __softirq_pending; |
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 3b0c8aaf6e8b..8e802059fe67 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
| @@ -644,20 +644,26 @@ static inline unsigned long ffz(unsigned long word) | |||
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | /* | 646 | /* |
| 647 | * flz - find last zero in word. | 647 | * fls - find last bit set. |
| 648 | * @word: The word to search | 648 | * @word: The word to search |
| 649 | * | 649 | * |
| 650 | * Returns 0..SZLONG-1 | 650 | * Returns 1..SZLONG |
| 651 | * Undefined if no zero exists, so code should check against ~0UL first. | 651 | * Returns 0 if no bit exists |
| 652 | */ | 652 | */ |
| 653 | static inline unsigned long flz(unsigned long word) | 653 | static inline unsigned long fls(unsigned long word) |
| 654 | { | 654 | { |
| 655 | #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) | ||
| 656 | return __ilog2(~word); | ||
| 657 | #else | ||
| 658 | #ifdef CONFIG_32BIT | 655 | #ifdef CONFIG_32BIT |
| 659 | int r = 31, s; | 656 | #ifdef CONFIG_CPU_MIPS32 |
| 660 | word = ~word; | 657 | __asm__ ("clz %0, %1" : "=r" (word) : "r" (word)); |
| 658 | |||
| 659 | return 32 - word; | ||
| 660 | #else | ||
| 661 | { | ||
| 662 | int r = 32, s; | ||
| 663 | |||
| 664 | if (word == 0) | ||
| 665 | return 0; | ||
| 666 | |||
| 661 | s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s; | 667 | s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s; |
| 662 | s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s; | 668 | s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s; |
| 663 | s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s; | 669 | s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s; |
| @@ -665,10 +671,23 @@ static inline unsigned long flz(unsigned long word) | |||
| 665 | s = 1; if ((word & 0x80000000)) s = 0; r -= s; | 671 | s = 1; if ((word & 0x80000000)) s = 0; r -= s; |
| 666 | 672 | ||
| 667 | return r; | 673 | return r; |
| 674 | } | ||
| 668 | #endif | 675 | #endif |
| 676 | #endif /* CONFIG_32BIT */ | ||
| 677 | |||
| 669 | #ifdef CONFIG_64BIT | 678 | #ifdef CONFIG_64BIT |
| 670 | int r = 63, s; | 679 | #ifdef CONFIG_CPU_MIPS64 |
| 671 | word = ~word; | 680 | |
| 681 | __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word)); | ||
| 682 | |||
| 683 | return 64 - word; | ||
| 684 | #else | ||
| 685 | { | ||
| 686 | int r = 64, s; | ||
| 687 | |||
| 688 | if (word == 0) | ||
| 689 | return 0; | ||
| 690 | |||
| 672 | s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s; | 691 | s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s; |
| 673 | s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s; | 692 | s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s; |
| 674 | s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s; | 693 | s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s; |
| @@ -677,24 +696,11 @@ static inline unsigned long flz(unsigned long word) | |||
| 677 | s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s; | 696 | s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s; |
| 678 | 697 | ||
| 679 | return r; | 698 | return r; |
| 699 | } | ||
| 680 | #endif | 700 | #endif |
| 681 | #endif | 701 | #endif /* CONFIG_64BIT */ |
| 682 | } | 702 | } |
| 683 | 703 | ||
| 684 | /* | ||
| 685 | * fls - find last bit set. | ||
| 686 | * @word: The word to search | ||
| 687 | * | ||
| 688 | * Returns 1..SZLONG | ||
| 689 | * Returns 0 if no bit exists | ||
| 690 | */ | ||
| 691 | static inline unsigned long fls(unsigned long word) | ||
| 692 | { | ||
| 693 | if (word == 0) | ||
| 694 | return 0; | ||
| 695 | |||
| 696 | return flz(~word) + 1; | ||
| 697 | } | ||
| 698 | #define fls64(x) generic_fls64(x) | 704 | #define fls64(x) generic_fls64(x) |
| 699 | 705 | ||
| 700 | /* | 706 | /* |
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h index d1fe9e5c62e4..584f8128fffd 100644 --- a/include/asm-mips/byteorder.h +++ b/include/asm-mips/byteorder.h | |||
| @@ -8,10 +8,39 @@ | |||
| 8 | #ifndef _ASM_BYTEORDER_H | 8 | #ifndef _ASM_BYTEORDER_H |
| 9 | #define _ASM_BYTEORDER_H | 9 | #define _ASM_BYTEORDER_H |
| 10 | 10 | ||
| 11 | #include <linux/config.h> | ||
| 12 | #include <linux/compiler.h> | ||
| 11 | #include <asm/types.h> | 13 | #include <asm/types.h> |
| 12 | 14 | ||
| 13 | #ifdef __GNUC__ | 15 | #ifdef __GNUC__ |
| 14 | 16 | ||
| 17 | #ifdef CONFIG_CPU_MIPSR2 | ||
| 18 | |||
| 19 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) | ||
| 20 | { | ||
| 21 | __asm__( | ||
| 22 | " wsbh %0, %1 \n" | ||
| 23 | : "=r" (x) | ||
| 24 | : "r" (x)); | ||
| 25 | |||
| 26 | return x; | ||
| 27 | } | ||
| 28 | #define __arch__swab16(x) ___arch__swab16(x) | ||
| 29 | |||
| 30 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) | ||
| 31 | { | ||
| 32 | __asm__( | ||
| 33 | " wsbh %0, %1 \n" | ||
| 34 | " rotr %0, %0, 16 \n" | ||
| 35 | : "=r" (x) | ||
| 36 | : "r" (x)); | ||
| 37 | |||
| 38 | return x; | ||
| 39 | } | ||
| 40 | #define __arch__swab32(x) ___arch__swab32(x) | ||
| 41 | |||
| 42 | #endif /* CONFIG_CPU_MIPSR2 */ | ||
| 43 | |||
| 15 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | 44 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) |
| 16 | # define __BYTEORDER_HAS_U64__ | 45 | # define __BYTEORDER_HAS_U64__ |
| 17 | # define __SWAB_64_THRU_32__ | 46 | # define __SWAB_64_THRU_32__ |
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h index a18ba2edc0b6..aeae9fabf4a9 100644 --- a/include/asm-mips/cacheflush.h +++ b/include/asm-mips/cacheflush.h | |||
| @@ -49,8 +49,7 @@ static inline void flush_dcache_page(struct page *page) | |||
| 49 | 49 | ||
| 50 | extern void (*flush_icache_page)(struct vm_area_struct *vma, | 50 | extern void (*flush_icache_page)(struct vm_area_struct *vma, |
| 51 | struct page *page); | 51 | struct page *page); |
| 52 | extern void (*flush_icache_range)(unsigned long __user start, | 52 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); |
| 53 | unsigned long __user end); | ||
| 54 | #define flush_cache_vmap(start, end) flush_cache_all() | 53 | #define flush_cache_vmap(start, end) flush_cache_all() |
| 55 | #define flush_cache_vunmap(start, end) flush_cache_all() | 54 | #define flush_cache_vunmap(start, end) flush_cache_all() |
| 56 | 55 | ||
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h index 2fc90632f88c..6111a0ce58c4 100644 --- a/include/asm-mips/hazards.h +++ b/include/asm-mips/hazards.h | |||
| @@ -100,7 +100,7 @@ | |||
| 100 | 100 | ||
| 101 | __asm__( | 101 | __asm__( |
| 102 | " .macro _ssnop \n\t" | 102 | " .macro _ssnop \n\t" |
| 103 | " sll $0, $2, 1 \n\t" | 103 | " sll $0, $0, 1 \n\t" |
| 104 | " .endm \n\t" | 104 | " .endm \n\t" |
| 105 | " \n\t" | 105 | " \n\t" |
| 106 | " .macro _ehb \n\t" | 106 | " .macro _ehb \n\t" |
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h index abdf54ee64cf..774348734fa0 100644 --- a/include/asm-mips/interrupt.h +++ b/include/asm-mips/interrupt.h | |||
| @@ -47,6 +47,17 @@ static inline void local_irq_enable(void) | |||
| 47 | * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs | 47 | * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs |
| 48 | * no nops at all. | 48 | * no nops at all. |
| 49 | */ | 49 | */ |
| 50 | /* | ||
| 51 | * For TX49, operating only IE bit is not enough. | ||
| 52 | * | ||
| 53 | * If mfc0 $12 follows store and the mfc0 is last instruction of a | ||
| 54 | * page and fetching the next instruction causes TLB miss, the result | ||
| 55 | * of the mfc0 might wrongly contain EXL bit. | ||
| 56 | * | ||
| 57 | * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008 | ||
| 58 | * | ||
| 59 | * Workaround: mask EXL bit of the result or place a nop before mfc0. | ||
| 60 | */ | ||
| 50 | __asm__ ( | 61 | __asm__ ( |
| 51 | " .macro local_irq_disable\n" | 62 | " .macro local_irq_disable\n" |
| 52 | " .set push \n" | 63 | " .set push \n" |
| @@ -55,8 +66,8 @@ __asm__ ( | |||
| 55 | " di \n" | 66 | " di \n" |
| 56 | #else | 67 | #else |
| 57 | " mfc0 $1,$12 \n" | 68 | " mfc0 $1,$12 \n" |
| 58 | " ori $1,1 \n" | 69 | " ori $1,0x1f \n" |
| 59 | " xori $1,1 \n" | 70 | " xori $1,0x1f \n" |
| 60 | " .set noreorder \n" | 71 | " .set noreorder \n" |
| 61 | " mtc0 $1,$12 \n" | 72 | " mtc0 $1,$12 \n" |
| 62 | #endif | 73 | #endif |
| @@ -96,8 +107,8 @@ __asm__ ( | |||
| 96 | " andi \\result, 1 \n" | 107 | " andi \\result, 1 \n" |
| 97 | #else | 108 | #else |
| 98 | " mfc0 \\result, $12 \n" | 109 | " mfc0 \\result, $12 \n" |
| 99 | " ori $1, \\result, 1 \n" | 110 | " ori $1, \\result, 0x1f \n" |
| 100 | " xori $1, 1 \n" | 111 | " xori $1, 0x1f \n" |
| 101 | " .set noreorder \n" | 112 | " .set noreorder \n" |
| 102 | " mtc0 $1, $12 \n" | 113 | " mtc0 $1, $12 \n" |
| 103 | #endif | 114 | #endif |
| @@ -114,6 +125,7 @@ __asm__ __volatile__( \ | |||
| 114 | 125 | ||
| 115 | __asm__ ( | 126 | __asm__ ( |
| 116 | " .macro local_irq_restore flags \n" | 127 | " .macro local_irq_restore flags \n" |
| 128 | " .set push \n" | ||
| 117 | " .set noreorder \n" | 129 | " .set noreorder \n" |
| 118 | " .set noat \n" | 130 | " .set noat \n" |
| 119 | #if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU) | 131 | #if defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU) |
| @@ -135,14 +147,13 @@ __asm__ ( | |||
| 135 | #else | 147 | #else |
| 136 | " mfc0 $1, $12 \n" | 148 | " mfc0 $1, $12 \n" |
| 137 | " andi \\flags, 1 \n" | 149 | " andi \\flags, 1 \n" |
| 138 | " ori $1, 1 \n" | 150 | " ori $1, 0x1f \n" |
| 139 | " xori $1, 1 \n" | 151 | " xori $1, 0x1f \n" |
| 140 | " or \\flags, $1 \n" | 152 | " or \\flags, $1 \n" |
| 141 | " mtc0 \\flags, $12 \n" | 153 | " mtc0 \\flags, $12 \n" |
| 142 | #endif | 154 | #endif |
| 143 | " irq_disable_hazard \n" | 155 | " irq_disable_hazard \n" |
| 144 | " .set at \n" | 156 | " .set pop \n" |
| 145 | " .set reorder \n" | ||
| 146 | " .endm \n"); | 157 | " .endm \n"); |
| 147 | 158 | ||
| 148 | #define local_irq_restore(flags) \ | 159 | #define local_irq_restore(flags) \ |
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h index 8e1d7ed7d8e3..4686e17c206c 100644 --- a/include/asm-mips/mach-au1x00/au1000.h +++ b/include/asm-mips/mach-au1x00/au1000.h | |||
| @@ -1198,7 +1198,11 @@ extern au1xxx_irq_map_t au1xxx_irq_map[]; | |||
| 1198 | 1198 | ||
| 1199 | /* UARTS 0-3 */ | 1199 | /* UARTS 0-3 */ |
| 1200 | #define UART_BASE UART0_ADDR | 1200 | #define UART_BASE UART0_ADDR |
| 1201 | #ifdef CONFIG_SOC_AU1200 | ||
| 1202 | #define UART_DEBUG_BASE UART1_ADDR | ||
| 1203 | #else | ||
| 1201 | #define UART_DEBUG_BASE UART3_ADDR | 1204 | #define UART_DEBUG_BASE UART3_ADDR |
| 1205 | #endif | ||
| 1202 | 1206 | ||
| 1203 | #define UART_RX 0 /* Receive buffer */ | 1207 | #define UART_RX 0 /* Receive buffer */ |
| 1204 | #define UART_TX 4 /* Transmit buffer */ | 1208 | #define UART_TX 4 /* Transmit buffer */ |
diff --git a/include/asm-mips/cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h index 78e1df2095fb..78e1df2095fb 100644 --- a/include/asm-mips/cobalt/cobalt.h +++ b/include/asm-mips/mach-cobalt/cobalt.h | |||
diff --git a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h new file mode 100644 index 000000000000..ace8c5ef9701 --- /dev/null +++ b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) | ||
| 7 | */ | ||
| 8 | #ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H | ||
| 9 | #define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H | ||
| 10 | |||
| 11 | #include <linux/config.h> | ||
| 12 | |||
| 13 | #define cpu_has_tlb 1 | ||
| 14 | #define cpu_has_4kex 1 | ||
| 15 | #define cpu_has_3k_cache 0 | ||
| 16 | #define cpu_has_4k_cache 1 | ||
| 17 | #define cpu_has_tx39_cache 0 | ||
| 18 | #define cpu_has_sb1_cache 0 | ||
| 19 | #define cpu_has_fpu 1 | ||
| 20 | #define cpu_has_32fpr 1 | ||
| 21 | #define cpu_has_counter 1 | ||
| 22 | #define cpu_has_watch 0 | ||
| 23 | #define cpu_has_divec 1 | ||
| 24 | #define cpu_has_vce 0 | ||
| 25 | #define cpu_has_cache_cdex_p 0 | ||
| 26 | #define cpu_has_cache_cdex_s 0 | ||
| 27 | #define cpu_has_prefetch 0 | ||
| 28 | #define cpu_has_mcheck 0 | ||
| 29 | #define cpu_has_ejtag 0 | ||
| 30 | |||
| 31 | #define cpu_has_subset_pcaches 0 | ||
| 32 | #define cpu_dcache_line_size() 32 | ||
| 33 | #define cpu_icache_line_size() 32 | ||
| 34 | #define cpu_scache_line_size() 0 | ||
| 35 | |||
| 36 | #ifdef CONFIG_64BIT | ||
| 37 | #define cpu_has_llsc 0 | ||
| 38 | #else | ||
| 39 | #define cpu_has_llsc 1 | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #define cpu_has_mips16 0 | ||
| 43 | #define cpu_has_mdmx 0 | ||
| 44 | #define cpu_has_mips3d 0 | ||
| 45 | #define cpu_has_smartmips 0 | ||
| 46 | #define cpu_has_vtag_icache 0 | ||
| 47 | #define cpu_has_ic_fills_f_dc 0 | ||
| 48 | #define cpu_icache_snoops_remote_store 0 | ||
| 49 | #define cpu_has_dsp 0 | ||
| 50 | |||
| 51 | #define cpu_has_mips32r1 0 | ||
| 52 | #define cpu_has_mips32r2 0 | ||
| 53 | #define cpu_has_mips64r1 0 | ||
| 54 | #define cpu_has_mips64r2 0 | ||
| 55 | |||
| 56 | #endif /* __ASM_COBALT_CPU_FEATURE_OVERRIDES_H */ | ||
diff --git a/include/asm-mips/cobalt/mach-gt64120.h b/include/asm-mips/mach-cobalt/mach-gt64120.h index 587fc4378f44..587fc4378f44 100644 --- a/include/asm-mips/cobalt/mach-gt64120.h +++ b/include/asm-mips/mach-cobalt/mach-gt64120.h | |||
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h index b80c30725cf6..36070b5654ab 100644 --- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h +++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | * so, for 64bit IP32 kernel we just don't use ll/sc. | 18 | * so, for 64bit IP32 kernel we just don't use ll/sc. |
| 19 | * This does not affect luserland. | 19 | * This does not affect luserland. |
| 20 | */ | 20 | */ |
| 21 | #if defined(CONFIG_CPU_R5000) && defined(CONFIG_64BIT) | 21 | #if (defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_NEVADA)) && defined(CONFIG_64BIT) |
| 22 | #define cpu_has_llsc 0 | 22 | #define cpu_has_llsc 0 |
| 23 | #else | 23 | #else |
| 24 | #define cpu_has_llsc 1 | 24 | #define cpu_has_llsc 1 |
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h index a5ea9d828aee..cc53196efa40 100644 --- a/include/asm-mips/r4kcache.h +++ b/include/asm-mips/r4kcache.h | |||
| @@ -166,123 +166,6 @@ static inline void invalidate_tcache_page(unsigned long addr) | |||
| 166 | : "r" (base), \ | 166 | : "r" (base), \ |
| 167 | "i" (op)); | 167 | "i" (op)); |
| 168 | 168 | ||
| 169 | static inline void blast_dcache16(void) | ||
| 170 | { | ||
| 171 | unsigned long start = INDEX_BASE; | ||
| 172 | unsigned long end = start + current_cpu_data.dcache.waysize; | ||
| 173 | unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; | ||
| 174 | unsigned long ws_end = current_cpu_data.dcache.ways << | ||
| 175 | current_cpu_data.dcache.waybit; | ||
| 176 | unsigned long ws, addr; | ||
| 177 | |||
| 178 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 179 | for (addr = start; addr < end; addr += 0x200) | ||
| 180 | cache16_unroll32(addr|ws,Index_Writeback_Inv_D); | ||
| 181 | } | ||
| 182 | |||
| 183 | static inline void blast_dcache16_page(unsigned long page) | ||
| 184 | { | ||
| 185 | unsigned long start = page; | ||
| 186 | unsigned long end = start + PAGE_SIZE; | ||
| 187 | |||
| 188 | do { | ||
| 189 | cache16_unroll32(start,Hit_Writeback_Inv_D); | ||
| 190 | start += 0x200; | ||
| 191 | } while (start < end); | ||
| 192 | } | ||
| 193 | |||
| 194 | static inline void blast_dcache16_page_indexed(unsigned long page) | ||
| 195 | { | ||
| 196 | unsigned long start = page; | ||
| 197 | unsigned long end = start + PAGE_SIZE; | ||
| 198 | unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; | ||
| 199 | unsigned long ws_end = current_cpu_data.dcache.ways << | ||
| 200 | current_cpu_data.dcache.waybit; | ||
| 201 | unsigned long ws, addr; | ||
| 202 | |||
| 203 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 204 | for (addr = start; addr < end; addr += 0x200) | ||
| 205 | cache16_unroll32(addr|ws,Index_Writeback_Inv_D); | ||
| 206 | } | ||
| 207 | |||
| 208 | static inline void blast_icache16(void) | ||
| 209 | { | ||
| 210 | unsigned long start = INDEX_BASE; | ||
| 211 | unsigned long end = start + current_cpu_data.icache.waysize; | ||
| 212 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 213 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 214 | current_cpu_data.icache.waybit; | ||
| 215 | unsigned long ws, addr; | ||
| 216 | |||
| 217 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 218 | for (addr = start; addr < end; addr += 0x200) | ||
| 219 | cache16_unroll32(addr|ws,Index_Invalidate_I); | ||
| 220 | } | ||
| 221 | |||
| 222 | static inline void blast_icache16_page(unsigned long page) | ||
| 223 | { | ||
| 224 | unsigned long start = page; | ||
| 225 | unsigned long end = start + PAGE_SIZE; | ||
| 226 | |||
| 227 | do { | ||
| 228 | cache16_unroll32(start,Hit_Invalidate_I); | ||
| 229 | start += 0x200; | ||
| 230 | } while (start < end); | ||
| 231 | } | ||
| 232 | |||
| 233 | static inline void blast_icache16_page_indexed(unsigned long page) | ||
| 234 | { | ||
| 235 | unsigned long start = page; | ||
| 236 | unsigned long end = start + PAGE_SIZE; | ||
| 237 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 238 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 239 | current_cpu_data.icache.waybit; | ||
| 240 | unsigned long ws, addr; | ||
| 241 | |||
| 242 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 243 | for (addr = start; addr < end; addr += 0x200) | ||
| 244 | cache16_unroll32(addr|ws,Index_Invalidate_I); | ||
| 245 | } | ||
| 246 | |||
| 247 | static inline void blast_scache16(void) | ||
| 248 | { | ||
| 249 | unsigned long start = INDEX_BASE; | ||
| 250 | unsigned long end = start + current_cpu_data.scache.waysize; | ||
| 251 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 252 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 253 | current_cpu_data.scache.waybit; | ||
| 254 | unsigned long ws, addr; | ||
| 255 | |||
| 256 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 257 | for (addr = start; addr < end; addr += 0x200) | ||
| 258 | cache16_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 259 | } | ||
| 260 | |||
| 261 | static inline void blast_scache16_page(unsigned long page) | ||
| 262 | { | ||
| 263 | unsigned long start = page; | ||
| 264 | unsigned long end = page + PAGE_SIZE; | ||
| 265 | |||
| 266 | do { | ||
| 267 | cache16_unroll32(start,Hit_Writeback_Inv_SD); | ||
| 268 | start += 0x200; | ||
| 269 | } while (start < end); | ||
| 270 | } | ||
| 271 | |||
| 272 | static inline void blast_scache16_page_indexed(unsigned long page) | ||
| 273 | { | ||
| 274 | unsigned long start = page; | ||
| 275 | unsigned long end = start + PAGE_SIZE; | ||
| 276 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 277 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 278 | current_cpu_data.scache.waybit; | ||
| 279 | unsigned long ws, addr; | ||
| 280 | |||
| 281 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 282 | for (addr = start; addr < end; addr += 0x200) | ||
| 283 | cache16_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 284 | } | ||
| 285 | |||
| 286 | #define cache32_unroll32(base,op) \ | 169 | #define cache32_unroll32(base,op) \ |
| 287 | __asm__ __volatile__( \ | 170 | __asm__ __volatile__( \ |
| 288 | " .set push \n" \ | 171 | " .set push \n" \ |
| @@ -309,123 +192,6 @@ static inline void blast_scache16_page_indexed(unsigned long page) | |||
| 309 | : "r" (base), \ | 192 | : "r" (base), \ |
| 310 | "i" (op)); | 193 | "i" (op)); |
| 311 | 194 | ||
| 312 | static inline void blast_dcache32(void) | ||
| 313 | { | ||
| 314 | unsigned long start = INDEX_BASE; | ||
| 315 | unsigned long end = start + current_cpu_data.dcache.waysize; | ||
| 316 | unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; | ||
| 317 | unsigned long ws_end = current_cpu_data.dcache.ways << | ||
| 318 | current_cpu_data.dcache.waybit; | ||
| 319 | unsigned long ws, addr; | ||
| 320 | |||
| 321 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 322 | for (addr = start; addr < end; addr += 0x400) | ||
| 323 | cache32_unroll32(addr|ws,Index_Writeback_Inv_D); | ||
| 324 | } | ||
| 325 | |||
| 326 | static inline void blast_dcache32_page(unsigned long page) | ||
| 327 | { | ||
| 328 | unsigned long start = page; | ||
| 329 | unsigned long end = start + PAGE_SIZE; | ||
| 330 | |||
| 331 | do { | ||
| 332 | cache32_unroll32(start,Hit_Writeback_Inv_D); | ||
| 333 | start += 0x400; | ||
| 334 | } while (start < end); | ||
| 335 | } | ||
| 336 | |||
| 337 | static inline void blast_dcache32_page_indexed(unsigned long page) | ||
| 338 | { | ||
| 339 | unsigned long start = page; | ||
| 340 | unsigned long end = start + PAGE_SIZE; | ||
| 341 | unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit; | ||
| 342 | unsigned long ws_end = current_cpu_data.dcache.ways << | ||
| 343 | current_cpu_data.dcache.waybit; | ||
| 344 | unsigned long ws, addr; | ||
| 345 | |||
| 346 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 347 | for (addr = start; addr < end; addr += 0x400) | ||
| 348 | cache32_unroll32(addr|ws,Index_Writeback_Inv_D); | ||
| 349 | } | ||
| 350 | |||
| 351 | static inline void blast_icache32(void) | ||
| 352 | { | ||
| 353 | unsigned long start = INDEX_BASE; | ||
| 354 | unsigned long end = start + current_cpu_data.icache.waysize; | ||
| 355 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 356 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 357 | current_cpu_data.icache.waybit; | ||
| 358 | unsigned long ws, addr; | ||
| 359 | |||
| 360 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 361 | for (addr = start; addr < end; addr += 0x400) | ||
| 362 | cache32_unroll32(addr|ws,Index_Invalidate_I); | ||
| 363 | } | ||
| 364 | |||
| 365 | static inline void blast_icache32_page(unsigned long page) | ||
| 366 | { | ||
| 367 | unsigned long start = page; | ||
| 368 | unsigned long end = start + PAGE_SIZE; | ||
| 369 | |||
| 370 | do { | ||
| 371 | cache32_unroll32(start,Hit_Invalidate_I); | ||
| 372 | start += 0x400; | ||
| 373 | } while (start < end); | ||
| 374 | } | ||
| 375 | |||
| 376 | static inline void blast_icache32_page_indexed(unsigned long page) | ||
| 377 | { | ||
| 378 | unsigned long start = page; | ||
| 379 | unsigned long end = start + PAGE_SIZE; | ||
| 380 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 381 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 382 | current_cpu_data.icache.waybit; | ||
| 383 | unsigned long ws, addr; | ||
| 384 | |||
| 385 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 386 | for (addr = start; addr < end; addr += 0x400) | ||
| 387 | cache32_unroll32(addr|ws,Index_Invalidate_I); | ||
| 388 | } | ||
| 389 | |||
| 390 | static inline void blast_scache32(void) | ||
| 391 | { | ||
| 392 | unsigned long start = INDEX_BASE; | ||
| 393 | unsigned long end = start + current_cpu_data.scache.waysize; | ||
| 394 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 395 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 396 | current_cpu_data.scache.waybit; | ||
| 397 | unsigned long ws, addr; | ||
| 398 | |||
| 399 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 400 | for (addr = start; addr < end; addr += 0x400) | ||
| 401 | cache32_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 402 | } | ||
| 403 | |||
| 404 | static inline void blast_scache32_page(unsigned long page) | ||
| 405 | { | ||
| 406 | unsigned long start = page; | ||
| 407 | unsigned long end = page + PAGE_SIZE; | ||
| 408 | |||
| 409 | do { | ||
| 410 | cache32_unroll32(start,Hit_Writeback_Inv_SD); | ||
| 411 | start += 0x400; | ||
| 412 | } while (start < end); | ||
| 413 | } | ||
| 414 | |||
| 415 | static inline void blast_scache32_page_indexed(unsigned long page) | ||
| 416 | { | ||
| 417 | unsigned long start = page; | ||
| 418 | unsigned long end = start + PAGE_SIZE; | ||
| 419 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 420 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 421 | current_cpu_data.scache.waybit; | ||
| 422 | unsigned long ws, addr; | ||
| 423 | |||
| 424 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 425 | for (addr = start; addr < end; addr += 0x400) | ||
| 426 | cache32_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 427 | } | ||
| 428 | |||
| 429 | #define cache64_unroll32(base,op) \ | 195 | #define cache64_unroll32(base,op) \ |
| 430 | __asm__ __volatile__( \ | 196 | __asm__ __volatile__( \ |
| 431 | " .set push \n" \ | 197 | " .set push \n" \ |
| @@ -452,84 +218,6 @@ static inline void blast_scache32_page_indexed(unsigned long page) | |||
| 452 | : "r" (base), \ | 218 | : "r" (base), \ |
| 453 | "i" (op)); | 219 | "i" (op)); |
| 454 | 220 | ||
| 455 | static inline void blast_icache64(void) | ||
| 456 | { | ||
| 457 | unsigned long start = INDEX_BASE; | ||
| 458 | unsigned long end = start + current_cpu_data.icache.waysize; | ||
| 459 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 460 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 461 | current_cpu_data.icache.waybit; | ||
| 462 | unsigned long ws, addr; | ||
| 463 | |||
| 464 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 465 | for (addr = start; addr < end; addr += 0x800) | ||
| 466 | cache64_unroll32(addr|ws,Index_Invalidate_I); | ||
| 467 | } | ||
| 468 | |||
| 469 | static inline void blast_icache64_page(unsigned long page) | ||
| 470 | { | ||
| 471 | unsigned long start = page; | ||
| 472 | unsigned long end = start + PAGE_SIZE; | ||
| 473 | |||
| 474 | do { | ||
| 475 | cache64_unroll32(start,Hit_Invalidate_I); | ||
| 476 | start += 0x800; | ||
| 477 | } while (start < end); | ||
| 478 | } | ||
| 479 | |||
| 480 | static inline void blast_icache64_page_indexed(unsigned long page) | ||
| 481 | { | ||
| 482 | unsigned long start = page; | ||
| 483 | unsigned long end = start + PAGE_SIZE; | ||
| 484 | unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; | ||
| 485 | unsigned long ws_end = current_cpu_data.icache.ways << | ||
| 486 | current_cpu_data.icache.waybit; | ||
| 487 | unsigned long ws, addr; | ||
| 488 | |||
| 489 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 490 | for (addr = start; addr < end; addr += 0x800) | ||
| 491 | cache64_unroll32(addr|ws,Index_Invalidate_I); | ||
| 492 | } | ||
| 493 | |||
| 494 | static inline void blast_scache64(void) | ||
| 495 | { | ||
| 496 | unsigned long start = INDEX_BASE; | ||
| 497 | unsigned long end = start + current_cpu_data.scache.waysize; | ||
| 498 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 499 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 500 | current_cpu_data.scache.waybit; | ||
| 501 | unsigned long ws, addr; | ||
| 502 | |||
| 503 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 504 | for (addr = start; addr < end; addr += 0x800) | ||
| 505 | cache64_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 506 | } | ||
| 507 | |||
| 508 | static inline void blast_scache64_page(unsigned long page) | ||
| 509 | { | ||
| 510 | unsigned long start = page; | ||
| 511 | unsigned long end = page + PAGE_SIZE; | ||
| 512 | |||
| 513 | do { | ||
| 514 | cache64_unroll32(start,Hit_Writeback_Inv_SD); | ||
| 515 | start += 0x800; | ||
| 516 | } while (start < end); | ||
| 517 | } | ||
| 518 | |||
| 519 | static inline void blast_scache64_page_indexed(unsigned long page) | ||
| 520 | { | ||
| 521 | unsigned long start = page; | ||
| 522 | unsigned long end = start + PAGE_SIZE; | ||
| 523 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | ||
| 524 | unsigned long ws_end = current_cpu_data.scache.ways << | ||
| 525 | current_cpu_data.scache.waybit; | ||
| 526 | unsigned long ws, addr; | ||
| 527 | |||
| 528 | for (ws = 0; ws < ws_end; ws += ws_inc) | ||
| 529 | for (addr = start; addr < end; addr += 0x800) | ||
| 530 | cache64_unroll32(addr|ws,Index_Writeback_Inv_SD); | ||
| 531 | } | ||
| 532 | |||
| 533 | #define cache128_unroll32(base,op) \ | 221 | #define cache128_unroll32(base,op) \ |
| 534 | __asm__ __volatile__( \ | 222 | __asm__ __volatile__( \ |
| 535 | " .set push \n" \ | 223 | " .set push \n" \ |
| @@ -556,43 +244,55 @@ static inline void blast_scache64_page_indexed(unsigned long page) | |||
| 556 | : "r" (base), \ | 244 | : "r" (base), \ |
| 557 | "i" (op)); | 245 | "i" (op)); |
| 558 | 246 | ||
| 559 | static inline void blast_scache128(void) | 247 | /* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */ |
| 560 | { | 248 | #define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize) \ |
| 561 | unsigned long start = INDEX_BASE; | 249 | static inline void blast_##pfx##cache##lsize(void) \ |
| 562 | unsigned long end = start + current_cpu_data.scache.waysize; | 250 | { \ |
| 563 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | 251 | unsigned long start = INDEX_BASE; \ |
| 564 | unsigned long ws_end = current_cpu_data.scache.ways << | 252 | unsigned long end = start + current_cpu_data.desc.waysize; \ |
| 565 | current_cpu_data.scache.waybit; | 253 | unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \ |
| 566 | unsigned long ws, addr; | 254 | unsigned long ws_end = current_cpu_data.desc.ways << \ |
| 567 | 255 | current_cpu_data.desc.waybit; \ | |
| 568 | for (ws = 0; ws < ws_end; ws += ws_inc) | 256 | unsigned long ws, addr; \ |
| 569 | for (addr = start; addr < end; addr += 0x1000) | 257 | \ |
| 570 | cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); | 258 | for (ws = 0; ws < ws_end; ws += ws_inc) \ |
| 571 | } | 259 | for (addr = start; addr < end; addr += lsize * 32) \ |
| 572 | 260 | cache##lsize##_unroll32(addr|ws,indexop); \ | |
| 573 | static inline void blast_scache128_page(unsigned long page) | 261 | } \ |
| 574 | { | 262 | \ |
| 575 | unsigned long start = page; | 263 | static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \ |
| 576 | unsigned long end = page + PAGE_SIZE; | 264 | { \ |
| 577 | 265 | unsigned long start = page; \ | |
| 578 | do { | 266 | unsigned long end = page + PAGE_SIZE; \ |
| 579 | cache128_unroll32(start,Hit_Writeback_Inv_SD); | 267 | \ |
| 580 | start += 0x1000; | 268 | do { \ |
| 581 | } while (start < end); | 269 | cache##lsize##_unroll32(start,hitop); \ |
| 582 | } | 270 | start += lsize * 32; \ |
| 583 | 271 | } while (start < end); \ | |
| 584 | static inline void blast_scache128_page_indexed(unsigned long page) | 272 | } \ |
| 585 | { | 273 | \ |
| 586 | unsigned long start = page; | 274 | static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \ |
| 587 | unsigned long end = start + PAGE_SIZE; | 275 | { \ |
| 588 | unsigned long ws_inc = 1UL << current_cpu_data.scache.waybit; | 276 | unsigned long start = page; \ |
| 589 | unsigned long ws_end = current_cpu_data.scache.ways << | 277 | unsigned long end = start + PAGE_SIZE; \ |
| 590 | current_cpu_data.scache.waybit; | 278 | unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \ |
| 591 | unsigned long ws, addr; | 279 | unsigned long ws_end = current_cpu_data.desc.ways << \ |
| 592 | 280 | current_cpu_data.desc.waybit; \ | |
| 593 | for (ws = 0; ws < ws_end; ws += ws_inc) | 281 | unsigned long ws, addr; \ |
| 594 | for (addr = start; addr < end; addr += 0x1000) | 282 | \ |
| 595 | cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); | 283 | for (ws = 0; ws < ws_end; ws += ws_inc) \ |
| 596 | } | 284 | for (addr = start; addr < end; addr += lsize * 32) \ |
| 285 | cache##lsize##_unroll32(addr|ws,indexop); \ | ||
| 286 | } | ||
| 287 | |||
| 288 | __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16) | ||
| 289 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16) | ||
| 290 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16) | ||
| 291 | __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32) | ||
| 292 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32) | ||
| 293 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32) | ||
| 294 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64) | ||
| 295 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64) | ||
| 296 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128) | ||
| 597 | 297 | ||
| 598 | #endif /* _ASM_R4KCACHE_H */ | 298 | #endif /* _ASM_R4KCACHE_H */ |
diff --git a/include/asm-mips/reboot.h b/include/asm-mips/reboot.h index 2f10ebcbe141..e48c0bfab257 100644 --- a/include/asm-mips/reboot.h +++ b/include/asm-mips/reboot.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. | 4 | * for more details. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 1997, 1999, 2001 by Ralf Baechle | 6 | * Copyright (C) 1997, 1999, 2001, 06 by Ralf Baechle |
| 7 | * Copyright (C) 2001 MIPS Technologies, Inc. | 7 | * Copyright (C) 2001 MIPS Technologies, Inc. |
| 8 | */ | 8 | */ |
| 9 | #ifndef _ASM_REBOOT_H | 9 | #ifndef _ASM_REBOOT_H |
| @@ -11,6 +11,5 @@ | |||
| 11 | 11 | ||
| 12 | extern void (*_machine_restart)(char *command); | 12 | extern void (*_machine_restart)(char *command); |
| 13 | extern void (*_machine_halt)(void); | 13 | extern void (*_machine_halt)(void); |
| 14 | extern void (*_machine_power_off)(void); | ||
| 15 | 14 | ||
| 16 | #endif /* _ASM_REBOOT_H */ | 15 | #endif /* _ASM_REBOOT_H */ |
diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h index 5a06f6d13899..907da600fddd 100644 --- a/include/asm-mips/string.h +++ b/include/asm-mips/string.h | |||
| @@ -141,26 +141,4 @@ extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | |||
| 141 | #define __HAVE_ARCH_MEMMOVE | 141 | #define __HAVE_ARCH_MEMMOVE |
| 142 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | 142 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); |
| 143 | 143 | ||
| 144 | #ifdef CONFIG_32BIT | ||
| 145 | #define __HAVE_ARCH_MEMSCAN | ||
| 146 | static __inline__ void *memscan(void *__addr, int __c, size_t __size) | ||
| 147 | { | ||
| 148 | char *__end = (char *)__addr + __size; | ||
| 149 | unsigned char __uc = (unsigned char) __c; | ||
| 150 | |||
| 151 | __asm__(".set\tpush\n\t" | ||
| 152 | ".set\tnoat\n\t" | ||
| 153 | ".set\treorder\n\t" | ||
| 154 | "1:\tbeq\t%0,%1,2f\n\t" | ||
| 155 | "addiu\t%0,1\n\t" | ||
| 156 | "lbu\t$1,-1(%0)\n\t" | ||
| 157 | "bne\t$1,%z4,1b\n" | ||
| 158 | "2:\t.set\tpop" | ||
| 159 | : "=r" (__addr), "=r" (__end) | ||
| 160 | : "0" (__addr), "1" (__end), "Jr" (__uc)); | ||
| 161 | |||
| 162 | return __addr; | ||
| 163 | } | ||
| 164 | #endif /* CONFIG_32BIT */ | ||
| 165 | |||
| 166 | #endif /* _ASM_STRING_H */ | 144 | #endif /* _ASM_STRING_H */ |
diff --git a/include/asm-mips/tx4927/tx4927.h b/include/asm-mips/tx4927/tx4927.h index 3bb7f0087d68..de85bd2245f7 100644 --- a/include/asm-mips/tx4927/tx4927.h +++ b/include/asm-mips/tx4927/tx4927.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Author: MontaVista Software, Inc. | 2 | * Author: MontaVista Software, Inc. |
| 3 | * source@mvista.com | 3 | * source@mvista.com |
| 4 | * | 4 | * |
| 5 | * Copyright 2001-2002 MontaVista Software Inc. | 5 | * Copyright 2001-2006 MontaVista Software Inc. |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
| @@ -30,10 +30,10 @@ | |||
| 30 | #include <asm/tx4927/tx4927_mips.h> | 30 | #include <asm/tx4927/tx4927_mips.h> |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| 33 | This register naming came from the intergrate cpu/controoler name TX4927 | 33 | This register naming came from the integrated CPU/controller name TX4927 |
| 34 | followed by the device name from table 4.2.2 on page 4-3 and then followed | 34 | followed by the device name from table 4.2.2 on page 4-3 and then followed |
| 35 | by the register name from table 4.2.3 on pages 4-4 to 4-8. The manaul | 35 | by the register name from table 4.2.3 on pages 4-4 to 4-8. The manaul |
| 36 | used is "TMPR4927BT Preliminary Rev 0.1 20.Jul.2001". | 36 | used was "TMPR4927BT Preliminary Rev 0.1 20.Jul.2001". |
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | #define TX4927_SIO_0_BASE | 39 | #define TX4927_SIO_0_BASE |
| @@ -251,8 +251,8 @@ | |||
| 251 | 251 | ||
| 252 | /* TX4927 Timer 0 (32-bit registers) */ | 252 | /* TX4927 Timer 0 (32-bit registers) */ |
| 253 | #define TX4927_TMR0_BASE 0xf000 | 253 | #define TX4927_TMR0_BASE 0xf000 |
| 254 | #define TX4927_TMR0_TMTCR0 0xf004 | 254 | #define TX4927_TMR0_TMTCR0 0xf000 |
| 255 | #define TX4927_TMR0_TMTISR0 0xf008 | 255 | #define TX4927_TMR0_TMTISR0 0xf004 |
| 256 | #define TX4927_TMR0_TMCPRA0 0xf008 | 256 | #define TX4927_TMR0_TMCPRA0 0xf008 |
| 257 | #define TX4927_TMR0_TMCPRB0 0xf00c | 257 | #define TX4927_TMR0_TMCPRB0 0xf00c |
| 258 | #define TX4927_TMR0_TMITMR0 0xf010 | 258 | #define TX4927_TMR0_TMITMR0 0xf010 |
| @@ -264,8 +264,8 @@ | |||
| 264 | 264 | ||
| 265 | /* TX4927 Timer 1 (32-bit registers) */ | 265 | /* TX4927 Timer 1 (32-bit registers) */ |
| 266 | #define TX4927_TMR1_BASE 0xf100 | 266 | #define TX4927_TMR1_BASE 0xf100 |
| 267 | #define TX4927_TMR1_TMTCR1 0xf104 | 267 | #define TX4927_TMR1_TMTCR1 0xf100 |
| 268 | #define TX4927_TMR1_TMTISR1 0xf108 | 268 | #define TX4927_TMR1_TMTISR1 0xf104 |
| 269 | #define TX4927_TMR1_TMCPRA1 0xf108 | 269 | #define TX4927_TMR1_TMCPRA1 0xf108 |
| 270 | #define TX4927_TMR1_TMCPRB1 0xf10c | 270 | #define TX4927_TMR1_TMCPRB1 0xf10c |
| 271 | #define TX4927_TMR1_TMITMR1 0xf110 | 271 | #define TX4927_TMR1_TMITMR1 0xf110 |
| @@ -277,13 +277,12 @@ | |||
| 277 | 277 | ||
| 278 | /* TX4927 Timer 2 (32-bit registers) */ | 278 | /* TX4927 Timer 2 (32-bit registers) */ |
| 279 | #define TX4927_TMR2_BASE 0xf200 | 279 | #define TX4927_TMR2_BASE 0xf200 |
| 280 | #define TX4927_TMR2_TMTCR2 0xf104 | 280 | #define TX4927_TMR2_TMTCR2 0xf200 |
| 281 | #define TX4927_TMR2_TMTISR2 0xf208 | 281 | #define TX4927_TMR2_TMTISR2 0xf204 |
| 282 | #define TX4927_TMR2_TMCPRA2 0xf208 | 282 | #define TX4927_TMR2_TMCPRA2 0xf208 |
| 283 | #define TX4927_TMR2_TMCPRB2 0xf20c | ||
| 284 | #define TX4927_TMR2_TMITMR2 0xf210 | 283 | #define TX4927_TMR2_TMITMR2 0xf210 |
| 285 | #define TX4927_TMR2_TMCCDR2 0xf220 | 284 | #define TX4927_TMR2_TMCCDR2 0xf220 |
| 286 | #define TX4927_TMR2_TMPGMR2 0xf230 | 285 | #define TX4927_TMR2_TMWTMR2 0xf240 |
| 287 | #define TX4927_TMR2_TMTRR2 0xf2f0 | 286 | #define TX4927_TMR2_TMTRR2 0xf2f0 |
| 288 | #define TX4927_TMR2_LIMIT 0xf2ff | 287 | #define TX4927_TMR2_LIMIT 0xf2ff |
| 289 | 288 | ||
diff --git a/include/asm-mips/tx4927/tx4927_pci.h b/include/asm-mips/tx4927/tx4927_pci.h index 165f6b8b217f..66c064690f41 100644 --- a/include/asm-mips/tx4927/tx4927_pci.h +++ b/include/asm-mips/tx4927/tx4927_pci.h | |||
| @@ -253,6 +253,16 @@ struct tx4927_pcic_reg { | |||
| 253 | #define TX4927_CCFG_PCIDIVMODE_5 0x00001000 | 253 | #define TX4927_CCFG_PCIDIVMODE_5 0x00001000 |
| 254 | #define TX4927_CCFG_PCIDIVMODE_6 0x00001800 | 254 | #define TX4927_CCFG_PCIDIVMODE_6 0x00001800 |
| 255 | 255 | ||
| 256 | #define TX4937_CCFG_PCIDIVMODE_MASK 0x00001c00 | ||
| 257 | #define TX4937_CCFG_PCIDIVMODE_8 0x00000000 | ||
| 258 | #define TX4937_CCFG_PCIDIVMODE_4 0x00000400 | ||
| 259 | #define TX4937_CCFG_PCIDIVMODE_9 0x00000800 | ||
| 260 | #define TX4937_CCFG_PCIDIVMODE_4_5 0x00000c00 | ||
| 261 | #define TX4937_CCFG_PCIDIVMODE_10 0x00001000 | ||
| 262 | #define TX4937_CCFG_PCIDIVMODE_5 0x00001400 | ||
| 263 | #define TX4937_CCFG_PCIDIVMODE_11 0x00001800 | ||
| 264 | #define TX4937_CCFG_PCIDIVMODE_5_5 0x00001c00 | ||
| 265 | |||
| 256 | /* PCFG : Pin Configuration */ | 266 | /* PCFG : Pin Configuration */ |
| 257 | #define TX4927_PCFG_PCICLKEN_ALL 0x003f0000 | 267 | #define TX4927_PCFG_PCICLKEN_ALL 0x003f0000 |
| 258 | #define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch)) | 268 | #define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch)) |
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h index 41bb96bb2120..91d813a37823 100644 --- a/include/asm-mips/uaccess.h +++ b/include/asm-mips/uaccess.h | |||
| @@ -202,49 +202,49 @@ struct __large_struct { unsigned long buf[100]; }; | |||
| 202 | * Yuck. We need two variants, one for 64bit operation and one | 202 | * Yuck. We need two variants, one for 64bit operation and one |
| 203 | * for 32 bit mode and old iron. | 203 | * for 32 bit mode and old iron. |
| 204 | */ | 204 | */ |
| 205 | #ifdef __mips64 | 205 | #ifdef CONFIG_32BIT |
| 206 | #define __GET_USER_DW(ptr) __get_user_asm("ld", ptr) | 206 | #define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr) |
| 207 | #else | 207 | #endif |
| 208 | #define __GET_USER_DW(ptr) __get_user_asm_ll32(ptr) | 208 | #ifdef CONFIG_64BIT |
| 209 | #define __GET_USER_DW(val, ptr) __get_user_asm(val, "ld", ptr) | ||
| 209 | #endif | 210 | #endif |
| 210 | 211 | ||
| 211 | #define __get_user_nocheck(x,ptr,size) \ | 212 | extern void __get_user_unknown(void); |
| 212 | ({ \ | 213 | |
| 213 | __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \ | 214 | #define __get_user_common(val, size, ptr) \ |
| 214 | long __gu_err = 0; \ | 215 | do { \ |
| 215 | \ | ||
| 216 | switch (size) { \ | 216 | switch (size) { \ |
| 217 | case 1: __get_user_asm("lb", ptr); break; \ | 217 | case 1: __get_user_asm(val, "lb", ptr); break; \ |
| 218 | case 2: __get_user_asm("lh", ptr); break; \ | 218 | case 2: __get_user_asm(val, "lh", ptr); break; \ |
| 219 | case 4: __get_user_asm("lw", ptr); break; \ | 219 | case 4: __get_user_asm(val, "lw", ptr); break; \ |
| 220 | case 8: __GET_USER_DW(ptr); break; \ | 220 | case 8: __GET_USER_DW(val, ptr); break; \ |
| 221 | default: __get_user_unknown(); break; \ | 221 | default: __get_user_unknown(); break; \ |
| 222 | } \ | 222 | } \ |
| 223 | (x) = (__typeof__(*(ptr))) __gu_val; \ | 223 | } while (0) |
| 224 | |||
| 225 | #define __get_user_nocheck(x,ptr,size) \ | ||
| 226 | ({ \ | ||
| 227 | long __gu_err; \ | ||
| 228 | \ | ||
| 229 | __get_user_common((x), size, ptr); \ | ||
| 224 | __gu_err; \ | 230 | __gu_err; \ |
| 225 | }) | 231 | }) |
| 226 | 232 | ||
| 227 | #define __get_user_check(x,ptr,size) \ | 233 | #define __get_user_check(x,ptr,size) \ |
| 228 | ({ \ | 234 | ({ \ |
| 229 | const __typeof__(*(ptr)) __user * __gu_addr = (ptr); \ | ||
| 230 | __typeof__(*(ptr)) __gu_val = 0; \ | ||
| 231 | long __gu_err = -EFAULT; \ | 235 | long __gu_err = -EFAULT; \ |
| 236 | const void __user * __gu_ptr = (ptr); \ | ||
| 237 | \ | ||
| 238 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ | ||
| 239 | __get_user_common((x), size, __gu_ptr); \ | ||
| 232 | \ | 240 | \ |
| 233 | if (likely(access_ok(VERIFY_READ, __gu_addr, size))) { \ | ||
| 234 | switch (size) { \ | ||
| 235 | case 1: __get_user_asm("lb", __gu_addr); break; \ | ||
| 236 | case 2: __get_user_asm("lh", __gu_addr); break; \ | ||
| 237 | case 4: __get_user_asm("lw", __gu_addr); break; \ | ||
| 238 | case 8: __GET_USER_DW(__gu_addr); break; \ | ||
| 239 | default: __get_user_unknown(); break; \ | ||
| 240 | } \ | ||
| 241 | } \ | ||
| 242 | (x) = (__typeof__(*(ptr))) __gu_val; \ | ||
| 243 | __gu_err; \ | 241 | __gu_err; \ |
| 244 | }) | 242 | }) |
| 245 | 243 | ||
| 246 | #define __get_user_asm(insn, addr) \ | 244 | #define __get_user_asm(val, insn, addr) \ |
| 247 | { \ | 245 | { \ |
| 246 | long __gu_tmp; \ | ||
| 247 | \ | ||
| 248 | __asm__ __volatile__( \ | 248 | __asm__ __volatile__( \ |
| 249 | "1: " insn " %1, %3 \n" \ | 249 | "1: " insn " %1, %3 \n" \ |
| 250 | "2: \n" \ | 250 | "2: \n" \ |
| @@ -255,14 +255,16 @@ struct __large_struct { unsigned long buf[100]; }; | |||
| 255 | " .section __ex_table,\"a\" \n" \ | 255 | " .section __ex_table,\"a\" \n" \ |
| 256 | " "__UA_ADDR "\t1b, 3b \n" \ | 256 | " "__UA_ADDR "\t1b, 3b \n" \ |
| 257 | " .previous \n" \ | 257 | " .previous \n" \ |
| 258 | : "=r" (__gu_err), "=r" (__gu_val) \ | 258 | : "=r" (__gu_err), "=r" (__gu_tmp) \ |
| 259 | : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \ | 259 | : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \ |
| 260 | \ | ||
| 261 | (val) = (__typeof__(val)) __gu_tmp; \ | ||
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | /* | 264 | /* |
| 263 | * Get a long long 64 using 32 bit registers. | 265 | * Get a long long 64 using 32 bit registers. |
| 264 | */ | 266 | */ |
| 265 | #define __get_user_asm_ll32(addr) \ | 267 | #define __get_user_asm_ll32(val, addr) \ |
| 266 | { \ | 268 | { \ |
| 267 | __asm__ __volatile__( \ | 269 | __asm__ __volatile__( \ |
| 268 | "1: lw %1, (%3) \n" \ | 270 | "1: lw %1, (%3) \n" \ |
| @@ -278,21 +280,20 @@ struct __large_struct { unsigned long buf[100]; }; | |||
| 278 | " " __UA_ADDR " 1b, 4b \n" \ | 280 | " " __UA_ADDR " 1b, 4b \n" \ |
| 279 | " " __UA_ADDR " 2b, 4b \n" \ | 281 | " " __UA_ADDR " 2b, 4b \n" \ |
| 280 | " .previous \n" \ | 282 | " .previous \n" \ |
| 281 | : "=r" (__gu_err), "=&r" (__gu_val) \ | 283 | : "=r" (__gu_err), "=&r" (val) \ |
| 282 | : "0" (0), "r" (addr), "i" (-EFAULT)); \ | 284 | : "0" (0), "r" (addr), "i" (-EFAULT)); \ |
| 283 | } | 285 | } |
| 284 | 286 | ||
| 285 | extern void __get_user_unknown(void); | ||
| 286 | |||
| 287 | /* | 287 | /* |
| 288 | * Yuck. We need two variants, one for 64bit operation and one | 288 | * Yuck. We need two variants, one for 64bit operation and one |
| 289 | * for 32 bit mode and old iron. | 289 | * for 32 bit mode and old iron. |
| 290 | */ | 290 | */ |
| 291 | #ifdef __mips64 | 291 | #ifdef CONFIG_32BIT |
| 292 | #define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr) | ||
| 293 | #else | ||
| 294 | #define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr) | 292 | #define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr) |
| 295 | #endif | 293 | #endif |
| 294 | #ifdef CONFIG_64BIT | ||
| 295 | #define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr) | ||
| 296 | #endif | ||
| 296 | 297 | ||
| 297 | #define __put_user_nocheck(x,ptr,size) \ | 298 | #define __put_user_nocheck(x,ptr,size) \ |
| 298 | ({ \ | 299 | ({ \ |
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index 34e434ce3268..dffe276ca2df 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
| @@ -22,8 +22,15 @@ extern void numa_set_node(int cpu, int node); | |||
| 22 | extern unsigned char apicid_to_node[256]; | 22 | extern unsigned char apicid_to_node[256]; |
| 23 | #ifdef CONFIG_NUMA | 23 | #ifdef CONFIG_NUMA |
| 24 | extern void __init init_cpu_to_node(void); | 24 | extern void __init init_cpu_to_node(void); |
| 25 | |||
| 26 | static inline void clear_node_cpumask(int cpu) | ||
| 27 | { | ||
| 28 | clear_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]); | ||
| 29 | } | ||
| 30 | |||
| 25 | #else | 31 | #else |
| 26 | #define init_cpu_to_node() do {} while (0) | 32 | #define init_cpu_to_node() do {} while (0) |
| 33 | #define clear_node_cpumask(cpu) do {} while (0) | ||
| 27 | #endif | 34 | #endif |
| 28 | 35 | ||
| 29 | #define NUMA_NO_NODE 0xff | 36 | #define NUMA_NO_NODE 0xff |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 85854b867463..75e9f0724997 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -303,7 +303,7 @@ struct page { | |||
| 303 | */ | 303 | */ |
| 304 | #define put_page_testzero(p) \ | 304 | #define put_page_testzero(p) \ |
| 305 | ({ \ | 305 | ({ \ |
| 306 | BUG_ON(page_count(p) == 0); \ | 306 | BUG_ON(atomic_read(&(p)->_count) == -1);\ |
| 307 | atomic_add_negative(-1, &(p)->_count); \ | 307 | atomic_add_negative(-1, &(p)->_count); \ |
| 308 | }) | 308 | }) |
| 309 | 309 | ||
diff --git a/include/linux/namespace.h b/include/linux/namespace.h index 6731977c4c13..3abc8e3b4879 100644 --- a/include/linux/namespace.h +++ b/include/linux/namespace.h | |||
| @@ -15,6 +15,7 @@ struct namespace { | |||
| 15 | 15 | ||
| 16 | extern int copy_namespace(int, struct task_struct *); | 16 | extern int copy_namespace(int, struct task_struct *); |
| 17 | extern void __put_namespace(struct namespace *namespace); | 17 | extern void __put_namespace(struct namespace *namespace); |
| 18 | extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *); | ||
| 18 | 19 | ||
| 19 | static inline void put_namespace(struct namespace *namespace) | 20 | static inline void put_namespace(struct namespace *namespace) |
| 20 | { | 21 | { |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 43bcd13eb1ec..37c1c76fd547 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
| @@ -42,13 +42,21 @@ extern void mark_free_pages(struct zone *zone); | |||
| 42 | #ifdef CONFIG_PM | 42 | #ifdef CONFIG_PM |
| 43 | /* kernel/power/swsusp.c */ | 43 | /* kernel/power/swsusp.c */ |
| 44 | extern int software_suspend(void); | 44 | extern int software_suspend(void); |
| 45 | |||
| 46 | #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) | ||
| 47 | extern int pm_prepare_console(void); | ||
| 48 | extern void pm_restore_console(void); | ||
| 49 | #else | ||
| 50 | static inline int pm_prepare_console(void) { return 0; } | ||
| 51 | static inline void pm_restore_console(void) {} | ||
| 52 | #endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */ | ||
| 45 | #else | 53 | #else |
| 46 | static inline int software_suspend(void) | 54 | static inline int software_suspend(void) |
| 47 | { | 55 | { |
| 48 | printk("Warning: fake suspend called\n"); | 56 | printk("Warning: fake suspend called\n"); |
| 49 | return -EPERM; | 57 | return -EPERM; |
| 50 | } | 58 | } |
| 51 | #endif | 59 | #endif /* CONFIG_PM */ |
| 52 | 60 | ||
| 53 | #ifdef CONFIG_SUSPEND_SMP | 61 | #ifdef CONFIG_SUSPEND_SMP |
| 54 | extern void disable_nonboot_cpus(void); | 62 | extern void disable_nonboot_cpus(void); |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 6f6c69777648..b23be44cbea8 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -629,6 +629,7 @@ typedef __u64 v4l2_std_id; | |||
| 629 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) | 629 | #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) |
| 630 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) | 630 | #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) |
| 631 | #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) | 631 | #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) |
| 632 | #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) | ||
| 632 | 633 | ||
| 633 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) | 634 | #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) |
| 634 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) | 635 | #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) |
| @@ -661,7 +662,8 @@ typedef __u64 v4l2_std_id; | |||
| 661 | V4L2_STD_PAL_H |\ | 662 | V4L2_STD_PAL_H |\ |
| 662 | V4L2_STD_PAL_I) | 663 | V4L2_STD_PAL_I) |
| 663 | #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ | 664 | #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ |
| 664 | V4L2_STD_NTSC_M_JP) | 665 | V4L2_STD_NTSC_M_JP |\ |
| 666 | V4L2_STD_NTSC_M_KR) | ||
| 665 | #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ | 667 | #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ |
| 666 | V4L2_STD_SECAM_K |\ | 668 | V4L2_STD_SECAM_K |\ |
| 667 | V4L2_STD_SECAM_K1) | 669 | V4L2_STD_SECAM_K1) |
diff --git a/init/Kconfig b/init/Kconfig index 8b7abae87bf9..38416a199def 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -169,7 +169,6 @@ config SYSCTL | |||
| 169 | config AUDIT | 169 | config AUDIT |
| 170 | bool "Auditing support" | 170 | bool "Auditing support" |
| 171 | depends on NET | 171 | depends on NET |
| 172 | default y if SECURITY_SELINUX | ||
| 173 | help | 172 | help |
| 174 | Enable auditing infrastructure that can be used with another | 173 | Enable auditing infrastructure that can be used with another |
| 175 | kernel subsystem, such as SELinux (which requires this for | 174 | kernel subsystem, such as SELinux (which requires this for |
diff --git a/kernel/fork.c b/kernel/fork.c index 7f0ab5ee948c..8e88b374cee9 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -446,6 +446,55 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
| 446 | } | 446 | } |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | /* | ||
| 450 | * Allocate a new mm structure and copy contents from the | ||
| 451 | * mm structure of the passed in task structure. | ||
| 452 | */ | ||
| 453 | static struct mm_struct *dup_mm(struct task_struct *tsk) | ||
| 454 | { | ||
| 455 | struct mm_struct *mm, *oldmm = current->mm; | ||
| 456 | int err; | ||
| 457 | |||
| 458 | if (!oldmm) | ||
| 459 | return NULL; | ||
| 460 | |||
| 461 | mm = allocate_mm(); | ||
| 462 | if (!mm) | ||
| 463 | goto fail_nomem; | ||
| 464 | |||
| 465 | memcpy(mm, oldmm, sizeof(*mm)); | ||
| 466 | |||
| 467 | if (!mm_init(mm)) | ||
| 468 | goto fail_nomem; | ||
| 469 | |||
| 470 | if (init_new_context(tsk, mm)) | ||
| 471 | goto fail_nocontext; | ||
| 472 | |||
| 473 | err = dup_mmap(mm, oldmm); | ||
| 474 | if (err) | ||
| 475 | goto free_pt; | ||
| 476 | |||
| 477 | mm->hiwater_rss = get_mm_rss(mm); | ||
| 478 | mm->hiwater_vm = mm->total_vm; | ||
| 479 | |||
| 480 | return mm; | ||
| 481 | |||
| 482 | free_pt: | ||
| 483 | mmput(mm); | ||
| 484 | |||
| 485 | fail_nomem: | ||
| 486 | return NULL; | ||
| 487 | |||
| 488 | fail_nocontext: | ||
| 489 | /* | ||
| 490 | * If init_new_context() failed, we cannot use mmput() to free the mm | ||
| 491 | * because it calls destroy_context() | ||
| 492 | */ | ||
| 493 | mm_free_pgd(mm); | ||
| 494 | free_mm(mm); | ||
| 495 | return NULL; | ||
| 496 | } | ||
| 497 | |||
| 449 | static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) | 498 | static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) |
| 450 | { | 499 | { |
| 451 | struct mm_struct * mm, *oldmm; | 500 | struct mm_struct * mm, *oldmm; |
| @@ -473,43 +522,17 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) | |||
| 473 | } | 522 | } |
| 474 | 523 | ||
| 475 | retval = -ENOMEM; | 524 | retval = -ENOMEM; |
| 476 | mm = allocate_mm(); | 525 | mm = dup_mm(tsk); |
| 477 | if (!mm) | 526 | if (!mm) |
| 478 | goto fail_nomem; | 527 | goto fail_nomem; |
| 479 | 528 | ||
| 480 | /* Copy the current MM stuff.. */ | ||
| 481 | memcpy(mm, oldmm, sizeof(*mm)); | ||
| 482 | if (!mm_init(mm)) | ||
| 483 | goto fail_nomem; | ||
| 484 | |||
| 485 | if (init_new_context(tsk,mm)) | ||
| 486 | goto fail_nocontext; | ||
| 487 | |||
| 488 | retval = dup_mmap(mm, oldmm); | ||
| 489 | if (retval) | ||
| 490 | goto free_pt; | ||
| 491 | |||
| 492 | mm->hiwater_rss = get_mm_rss(mm); | ||
| 493 | mm->hiwater_vm = mm->total_vm; | ||
| 494 | |||
| 495 | good_mm: | 529 | good_mm: |
| 496 | tsk->mm = mm; | 530 | tsk->mm = mm; |
| 497 | tsk->active_mm = mm; | 531 | tsk->active_mm = mm; |
| 498 | return 0; | 532 | return 0; |
| 499 | 533 | ||
| 500 | free_pt: | ||
| 501 | mmput(mm); | ||
| 502 | fail_nomem: | 534 | fail_nomem: |
| 503 | return retval; | 535 | return retval; |
| 504 | |||
| 505 | fail_nocontext: | ||
| 506 | /* | ||
| 507 | * If init_new_context() failed, we cannot use mmput() to free the mm | ||
| 508 | * because it calls destroy_context() | ||
| 509 | */ | ||
| 510 | mm_free_pgd(mm); | ||
| 511 | free_mm(mm); | ||
| 512 | return retval; | ||
| 513 | } | 536 | } |
| 514 | 537 | ||
| 515 | static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) | 538 | static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) |
| @@ -597,32 +620,17 @@ out: | |||
| 597 | return newf; | 620 | return newf; |
| 598 | } | 621 | } |
| 599 | 622 | ||
| 600 | static int copy_files(unsigned long clone_flags, struct task_struct * tsk) | 623 | /* |
| 624 | * Allocate a new files structure and copy contents from the | ||
| 625 | * passed in files structure. | ||
| 626 | */ | ||
| 627 | static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) | ||
| 601 | { | 628 | { |
| 602 | struct files_struct *oldf, *newf; | 629 | struct files_struct *newf; |
| 603 | struct file **old_fds, **new_fds; | 630 | struct file **old_fds, **new_fds; |
| 604 | int open_files, size, i, error = 0, expand; | 631 | int open_files, size, i, expand; |
| 605 | struct fdtable *old_fdt, *new_fdt; | 632 | struct fdtable *old_fdt, *new_fdt; |
| 606 | 633 | ||
| 607 | /* | ||
| 608 | * A background process may not have any files ... | ||
| 609 | */ | ||
| 610 | oldf = current->files; | ||
| 611 | if (!oldf) | ||
| 612 | goto out; | ||
| 613 | |||
| 614 | if (clone_flags & CLONE_FILES) { | ||
| 615 | atomic_inc(&oldf->count); | ||
| 616 | goto out; | ||
| 617 | } | ||
| 618 | |||
| 619 | /* | ||
| 620 | * Note: we may be using current for both targets (See exec.c) | ||
| 621 | * This works because we cache current->files (old) as oldf. Don't | ||
| 622 | * break this. | ||
| 623 | */ | ||
| 624 | tsk->files = NULL; | ||
| 625 | error = -ENOMEM; | ||
| 626 | newf = alloc_files(); | 634 | newf = alloc_files(); |
| 627 | if (!newf) | 635 | if (!newf) |
| 628 | goto out; | 636 | goto out; |
| @@ -651,9 +659,9 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk) | |||
| 651 | if (expand) { | 659 | if (expand) { |
| 652 | spin_unlock(&oldf->file_lock); | 660 | spin_unlock(&oldf->file_lock); |
| 653 | spin_lock(&newf->file_lock); | 661 | spin_lock(&newf->file_lock); |
| 654 | error = expand_files(newf, open_files-1); | 662 | *errorp = expand_files(newf, open_files-1); |
| 655 | spin_unlock(&newf->file_lock); | 663 | spin_unlock(&newf->file_lock); |
| 656 | if (error < 0) | 664 | if (*errorp < 0) |
| 657 | goto out_release; | 665 | goto out_release; |
| 658 | new_fdt = files_fdtable(newf); | 666 | new_fdt = files_fdtable(newf); |
| 659 | /* | 667 | /* |
| @@ -702,10 +710,8 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk) | |||
| 702 | memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); | 710 | memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); |
| 703 | } | 711 | } |
| 704 | 712 | ||
| 705 | tsk->files = newf; | ||
| 706 | error = 0; | ||
| 707 | out: | 713 | out: |
| 708 | return error; | 714 | return newf; |
| 709 | 715 | ||
| 710 | out_release: | 716 | out_release: |
| 711 | free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset); | 717 | free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset); |
| @@ -715,6 +721,40 @@ out_release: | |||
| 715 | goto out; | 721 | goto out; |
| 716 | } | 722 | } |
| 717 | 723 | ||
| 724 | static int copy_files(unsigned long clone_flags, struct task_struct * tsk) | ||
| 725 | { | ||
| 726 | struct files_struct *oldf, *newf; | ||
| 727 | int error = 0; | ||
| 728 | |||
| 729 | /* | ||
| 730 | * A background process may not have any files ... | ||
| 731 | */ | ||
| 732 | oldf = current->files; | ||
| 733 | if (!oldf) | ||
| 734 | goto out; | ||
| 735 | |||
| 736 | if (clone_flags & CLONE_FILES) { | ||
| 737 | atomic_inc(&oldf->count); | ||
| 738 | goto out; | ||
| 739 | } | ||
| 740 | |||
| 741 | /* | ||
| 742 | * Note: we may be using current for both targets (See exec.c) | ||
| 743 | * This works because we cache current->files (old) as oldf. Don't | ||
| 744 | * break this. | ||
| 745 | */ | ||
| 746 | tsk->files = NULL; | ||
| 747 | error = -ENOMEM; | ||
| 748 | newf = dup_fd(oldf, &error); | ||
| 749 | if (!newf) | ||
| 750 | goto out; | ||
| 751 | |||
| 752 | tsk->files = newf; | ||
| 753 | error = 0; | ||
| 754 | out: | ||
| 755 | return error; | ||
| 756 | } | ||
| 757 | |||
| 718 | /* | 758 | /* |
| 719 | * Helper to unshare the files of the current task. | 759 | * Helper to unshare the files of the current task. |
| 720 | * We don't want to expose copy_files internals to | 760 | * We don't want to expose copy_files internals to |
| @@ -1323,3 +1363,249 @@ void __init proc_caches_init(void) | |||
| 1323 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, | 1363 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, |
| 1324 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | 1364 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); |
| 1325 | } | 1365 | } |
| 1366 | |||
| 1367 | |||
| 1368 | /* | ||
| 1369 | * Check constraints on flags passed to the unshare system call and | ||
| 1370 | * force unsharing of additional process context as appropriate. | ||
| 1371 | */ | ||
| 1372 | static inline void check_unshare_flags(unsigned long *flags_ptr) | ||
| 1373 | { | ||
| 1374 | /* | ||
| 1375 | * If unsharing a thread from a thread group, must also | ||
| 1376 | * unshare vm. | ||
| 1377 | */ | ||
| 1378 | if (*flags_ptr & CLONE_THREAD) | ||
| 1379 | *flags_ptr |= CLONE_VM; | ||
| 1380 | |||
| 1381 | /* | ||
| 1382 | * If unsharing vm, must also unshare signal handlers. | ||
| 1383 | */ | ||
| 1384 | if (*flags_ptr & CLONE_VM) | ||
| 1385 | *flags_ptr |= CLONE_SIGHAND; | ||
| 1386 | |||
| 1387 | /* | ||
| 1388 | * If unsharing signal handlers and the task was created | ||
| 1389 | * using CLONE_THREAD, then must unshare the thread | ||
| 1390 | */ | ||
| 1391 | if ((*flags_ptr & CLONE_SIGHAND) && | ||
| 1392 | (atomic_read(¤t->signal->count) > 1)) | ||
| 1393 | *flags_ptr |= CLONE_THREAD; | ||
| 1394 | |||
| 1395 | /* | ||
| 1396 | * If unsharing namespace, must also unshare filesystem information. | ||
| 1397 | */ | ||
| 1398 | if (*flags_ptr & CLONE_NEWNS) | ||
| 1399 | *flags_ptr |= CLONE_FS; | ||
| 1400 | } | ||
| 1401 | |||
| 1402 | /* | ||
| 1403 | * Unsharing of tasks created with CLONE_THREAD is not supported yet | ||
| 1404 | */ | ||
| 1405 | static int unshare_thread(unsigned long unshare_flags) | ||
| 1406 | { | ||
| 1407 | if (unshare_flags & CLONE_THREAD) | ||
| 1408 | return -EINVAL; | ||
| 1409 | |||
| 1410 | return 0; | ||
| 1411 | } | ||
| 1412 | |||
| 1413 | /* | ||
| 1414 | * Unshare the filesystem structure if it is being shared | ||
| 1415 | */ | ||
| 1416 | static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp) | ||
| 1417 | { | ||
| 1418 | struct fs_struct *fs = current->fs; | ||
| 1419 | |||
| 1420 | if ((unshare_flags & CLONE_FS) && | ||
| 1421 | (fs && atomic_read(&fs->count) > 1)) { | ||
| 1422 | *new_fsp = __copy_fs_struct(current->fs); | ||
| 1423 | if (!*new_fsp) | ||
| 1424 | return -ENOMEM; | ||
| 1425 | } | ||
| 1426 | |||
| 1427 | return 0; | ||
| 1428 | } | ||
| 1429 | |||
| 1430 | /* | ||
| 1431 | * Unshare the namespace structure if it is being shared | ||
| 1432 | */ | ||
| 1433 | static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs) | ||
| 1434 | { | ||
| 1435 | struct namespace *ns = current->namespace; | ||
| 1436 | |||
| 1437 | if ((unshare_flags & CLONE_NEWNS) && | ||
| 1438 | (ns && atomic_read(&ns->count) > 1)) { | ||
| 1439 | if (!capable(CAP_SYS_ADMIN)) | ||
| 1440 | return -EPERM; | ||
| 1441 | |||
| 1442 | *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs); | ||
| 1443 | if (!*new_nsp) | ||
| 1444 | return -ENOMEM; | ||
| 1445 | } | ||
| 1446 | |||
| 1447 | return 0; | ||
| 1448 | } | ||
| 1449 | |||
| 1450 | /* | ||
| 1451 | * Unsharing of sighand for tasks created with CLONE_SIGHAND is not | ||
| 1452 | * supported yet | ||
| 1453 | */ | ||
| 1454 | static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp) | ||
| 1455 | { | ||
| 1456 | struct sighand_struct *sigh = current->sighand; | ||
| 1457 | |||
| 1458 | if ((unshare_flags & CLONE_SIGHAND) && | ||
| 1459 | (sigh && atomic_read(&sigh->count) > 1)) | ||
| 1460 | return -EINVAL; | ||
| 1461 | else | ||
| 1462 | return 0; | ||
| 1463 | } | ||
| 1464 | |||
| 1465 | /* | ||
| 1466 | * Unshare vm if it is being shared | ||
| 1467 | */ | ||
| 1468 | static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp) | ||
| 1469 | { | ||
| 1470 | struct mm_struct *mm = current->mm; | ||
| 1471 | |||
| 1472 | if ((unshare_flags & CLONE_VM) && | ||
| 1473 | (mm && atomic_read(&mm->mm_users) > 1)) { | ||
| 1474 | *new_mmp = dup_mm(current); | ||
| 1475 | if (!*new_mmp) | ||
| 1476 | return -ENOMEM; | ||
| 1477 | } | ||
| 1478 | |||
| 1479 | return 0; | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | /* | ||
| 1483 | * Unshare file descriptor table if it is being shared | ||
| 1484 | */ | ||
| 1485 | static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp) | ||
| 1486 | { | ||
| 1487 | struct files_struct *fd = current->files; | ||
| 1488 | int error = 0; | ||
| 1489 | |||
| 1490 | if ((unshare_flags & CLONE_FILES) && | ||
| 1491 | (fd && atomic_read(&fd->count) > 1)) { | ||
| 1492 | *new_fdp = dup_fd(fd, &error); | ||
| 1493 | if (!*new_fdp) | ||
| 1494 | return error; | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | return 0; | ||
| 1498 | } | ||
| 1499 | |||
| 1500 | /* | ||
| 1501 | * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not | ||
| 1502 | * supported yet | ||
| 1503 | */ | ||
| 1504 | static int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp) | ||
| 1505 | { | ||
| 1506 | if (unshare_flags & CLONE_SYSVSEM) | ||
| 1507 | return -EINVAL; | ||
| 1508 | |||
| 1509 | return 0; | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | /* | ||
| 1513 | * unshare allows a process to 'unshare' part of the process | ||
| 1514 | * context which was originally shared using clone. copy_* | ||
| 1515 | * functions used by do_fork() cannot be used here directly | ||
| 1516 | * because they modify an inactive task_struct that is being | ||
| 1517 | * constructed. Here we are modifying the current, active, | ||
| 1518 | * task_struct. | ||
| 1519 | */ | ||
| 1520 | asmlinkage long sys_unshare(unsigned long unshare_flags) | ||
| 1521 | { | ||
| 1522 | int err = 0; | ||
| 1523 | struct fs_struct *fs, *new_fs = NULL; | ||
| 1524 | struct namespace *ns, *new_ns = NULL; | ||
| 1525 | struct sighand_struct *sigh, *new_sigh = NULL; | ||
| 1526 | struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; | ||
| 1527 | struct files_struct *fd, *new_fd = NULL; | ||
| 1528 | struct sem_undo_list *new_ulist = NULL; | ||
| 1529 | |||
| 1530 | check_unshare_flags(&unshare_flags); | ||
| 1531 | |||
| 1532 | if ((err = unshare_thread(unshare_flags))) | ||
| 1533 | goto bad_unshare_out; | ||
| 1534 | if ((err = unshare_fs(unshare_flags, &new_fs))) | ||
| 1535 | goto bad_unshare_cleanup_thread; | ||
| 1536 | if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs))) | ||
| 1537 | goto bad_unshare_cleanup_fs; | ||
| 1538 | if ((err = unshare_sighand(unshare_flags, &new_sigh))) | ||
| 1539 | goto bad_unshare_cleanup_ns; | ||
| 1540 | if ((err = unshare_vm(unshare_flags, &new_mm))) | ||
| 1541 | goto bad_unshare_cleanup_sigh; | ||
| 1542 | if ((err = unshare_fd(unshare_flags, &new_fd))) | ||
| 1543 | goto bad_unshare_cleanup_vm; | ||
| 1544 | if ((err = unshare_semundo(unshare_flags, &new_ulist))) | ||
| 1545 | goto bad_unshare_cleanup_fd; | ||
| 1546 | |||
| 1547 | if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist) { | ||
| 1548 | |||
| 1549 | task_lock(current); | ||
| 1550 | |||
| 1551 | if (new_fs) { | ||
| 1552 | fs = current->fs; | ||
| 1553 | current->fs = new_fs; | ||
| 1554 | new_fs = fs; | ||
| 1555 | } | ||
| 1556 | |||
| 1557 | if (new_ns) { | ||
| 1558 | ns = current->namespace; | ||
| 1559 | current->namespace = new_ns; | ||
| 1560 | new_ns = ns; | ||
| 1561 | } | ||
| 1562 | |||
| 1563 | if (new_sigh) { | ||
| 1564 | sigh = current->sighand; | ||
| 1565 | current->sighand = new_sigh; | ||
| 1566 | new_sigh = sigh; | ||
| 1567 | } | ||
| 1568 | |||
| 1569 | if (new_mm) { | ||
| 1570 | mm = current->mm; | ||
| 1571 | active_mm = current->active_mm; | ||
| 1572 | current->mm = new_mm; | ||
| 1573 | current->active_mm = new_mm; | ||
| 1574 | activate_mm(active_mm, new_mm); | ||
| 1575 | new_mm = mm; | ||
| 1576 | } | ||
| 1577 | |||
| 1578 | if (new_fd) { | ||
| 1579 | fd = current->files; | ||
| 1580 | current->files = new_fd; | ||
| 1581 | new_fd = fd; | ||
| 1582 | } | ||
| 1583 | |||
| 1584 | task_unlock(current); | ||
| 1585 | } | ||
| 1586 | |||
| 1587 | bad_unshare_cleanup_fd: | ||
| 1588 | if (new_fd) | ||
| 1589 | put_files_struct(new_fd); | ||
| 1590 | |||
| 1591 | bad_unshare_cleanup_vm: | ||
| 1592 | if (new_mm) | ||
| 1593 | mmput(new_mm); | ||
| 1594 | |||
| 1595 | bad_unshare_cleanup_sigh: | ||
| 1596 | if (new_sigh) | ||
| 1597 | if (atomic_dec_and_test(&new_sigh->count)) | ||
| 1598 | kmem_cache_free(sighand_cachep, new_sigh); | ||
| 1599 | |||
| 1600 | bad_unshare_cleanup_ns: | ||
| 1601 | if (new_ns) | ||
| 1602 | put_namespace(new_ns); | ||
| 1603 | |||
| 1604 | bad_unshare_cleanup_fs: | ||
| 1605 | if (new_fs) | ||
| 1606 | put_fs_struct(new_fs); | ||
| 1607 | |||
| 1608 | bad_unshare_cleanup_thread: | ||
| 1609 | bad_unshare_out: | ||
| 1610 | return err; | ||
| 1611 | } | ||
diff --git a/kernel/module.c b/kernel/module.c index e058aedf6b93..5aad477ddc79 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -1670,6 +1670,9 @@ static struct module *load_module(void __user *umod, | |||
| 1670 | goto free_mod; | 1670 | goto free_mod; |
| 1671 | } | 1671 | } |
| 1672 | 1672 | ||
| 1673 | /* Userspace could have altered the string after the strlen_user() */ | ||
| 1674 | args[arglen - 1] = '\0'; | ||
| 1675 | |||
| 1673 | if (find_module(mod->name)) { | 1676 | if (find_module(mod->name)) { |
| 1674 | err = -EEXIST; | 1677 | err = -EEXIST; |
| 1675 | goto free_mod; | 1678 | goto free_mod; |
diff --git a/kernel/power/console.c b/kernel/power/console.c index 579d239d129f..623786d44159 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
| @@ -9,7 +9,9 @@ | |||
| 9 | #include <linux/console.h> | 9 | #include <linux/console.h> |
| 10 | #include "power.h" | 10 | #include "power.h" |
| 11 | 11 | ||
| 12 | #ifdef SUSPEND_CONSOLE | 12 | #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) |
| 13 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) | ||
| 14 | |||
| 13 | static int orig_fgconsole, orig_kmsg; | 15 | static int orig_fgconsole, orig_kmsg; |
| 14 | 16 | ||
| 15 | int pm_prepare_console(void) | 17 | int pm_prepare_console(void) |
diff --git a/kernel/power/power.h b/kernel/power/power.h index d8f0d1a76bae..388dba680841 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
| @@ -1,14 +1,6 @@ | |||
| 1 | #include <linux/suspend.h> | 1 | #include <linux/suspend.h> |
| 2 | #include <linux/utsname.h> | 2 | #include <linux/utsname.h> |
| 3 | 3 | ||
| 4 | /* With SUSPEND_CONSOLE defined suspend looks *really* cool, but | ||
| 5 | we probably do not take enough locks for switching consoles, etc, | ||
| 6 | so bad things might happen. | ||
| 7 | */ | ||
| 8 | #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) | ||
| 9 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) | ||
| 10 | #endif | ||
| 11 | |||
| 12 | struct swsusp_info { | 4 | struct swsusp_info { |
| 13 | struct new_utsname uts; | 5 | struct new_utsname uts; |
| 14 | u32 version_code; | 6 | u32 version_code; |
| @@ -42,14 +34,6 @@ static struct subsys_attribute _name##_attr = { \ | |||
| 42 | 34 | ||
| 43 | extern struct subsystem power_subsys; | 35 | extern struct subsystem power_subsys; |
| 44 | 36 | ||
| 45 | #ifdef SUSPEND_CONSOLE | ||
| 46 | extern int pm_prepare_console(void); | ||
| 47 | extern void pm_restore_console(void); | ||
| 48 | #else | ||
| 49 | static int pm_prepare_console(void) { return 0; } | ||
| 50 | static void pm_restore_console(void) {} | ||
| 51 | #endif | ||
| 52 | |||
| 53 | /* References to section boundaries */ | 37 | /* References to section boundaries */ |
| 54 | extern const void __nosave_begin, __nosave_end; | 38 | extern const void __nosave_begin, __nosave_end; |
| 55 | 39 | ||
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 59c91c148e82..4e90905f0e87 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
| @@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page) | |||
| 743 | if (!bio) | 743 | if (!bio) |
| 744 | return -ENOMEM; | 744 | return -ENOMEM; |
| 745 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); | 745 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); |
| 746 | bio_get(bio); | ||
| 747 | bio->bi_bdev = resume_bdev; | 746 | bio->bi_bdev = resume_bdev; |
| 748 | bio->bi_end_io = end_io; | 747 | bio->bi_end_io = end_io; |
| 749 | 748 | ||
| @@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page) | |||
| 753 | goto Done; | 752 | goto Done; |
| 754 | } | 753 | } |
| 755 | 754 | ||
| 756 | if (rw == WRITE) | ||
| 757 | bio_set_pages_dirty(bio); | ||
| 758 | 755 | ||
| 759 | atomic_set(&io_done, 1); | 756 | atomic_set(&io_done, 1); |
| 760 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 757 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); |
| 761 | while (atomic_read(&io_done)) | 758 | while (atomic_read(&io_done)) |
| 762 | yield(); | 759 | yield(); |
| 763 | 760 | if (rw == READ) | |
| 761 | bio_set_pages_dirty(bio); | ||
| 764 | Done: | 762 | Done: |
| 765 | bio_put(bio); | 763 | bio_put(bio); |
| 766 | return error; | 764 | return error; |
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index c8bb8cc899d7..d8b6bb419d49 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
| @@ -72,9 +72,9 @@ static void __spin_lock_debug(spinlock_t *lock) | |||
| 72 | 72 | ||
| 73 | for (;;) { | 73 | for (;;) { |
| 74 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 74 | for (i = 0; i < loops_per_jiffy * HZ; i++) { |
| 75 | cpu_relax(); | ||
| 76 | if (__raw_spin_trylock(&lock->raw_lock)) | 75 | if (__raw_spin_trylock(&lock->raw_lock)) |
| 77 | return; | 76 | return; |
| 77 | __delay(1); | ||
| 78 | } | 78 | } |
| 79 | /* lockup suspected: */ | 79 | /* lockup suspected: */ |
| 80 | if (print_once) { | 80 | if (print_once) { |
| @@ -144,9 +144,9 @@ static void __read_lock_debug(rwlock_t *lock) | |||
| 144 | 144 | ||
| 145 | for (;;) { | 145 | for (;;) { |
| 146 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 146 | for (i = 0; i < loops_per_jiffy * HZ; i++) { |
| 147 | cpu_relax(); | ||
| 148 | if (__raw_read_trylock(&lock->raw_lock)) | 147 | if (__raw_read_trylock(&lock->raw_lock)) |
| 149 | return; | 148 | return; |
| 149 | __delay(1); | ||
| 150 | } | 150 | } |
| 151 | /* lockup suspected: */ | 151 | /* lockup suspected: */ |
| 152 | if (print_once) { | 152 | if (print_once) { |
| @@ -217,9 +217,9 @@ static void __write_lock_debug(rwlock_t *lock) | |||
| 217 | 217 | ||
| 218 | for (;;) { | 218 | for (;;) { |
| 219 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 219 | for (i = 0; i < loops_per_jiffy * HZ; i++) { |
| 220 | cpu_relax(); | ||
| 221 | if (__raw_write_trylock(&lock->raw_lock)) | 220 | if (__raw_write_trylock(&lock->raw_lock)) |
| 222 | return; | 221 | return; |
| 222 | __delay(1); | ||
| 223 | } | 223 | } |
| 224 | /* lockup suspected: */ | 224 | /* lockup suspected: */ |
| 225 | if (print_once) { | 225 | if (print_once) { |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ceb3ebb3c399..67f29516662a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
| @@ -107,7 +107,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr) | |||
| 107 | set_page_count(page, 1); | 107 | set_page_count(page, 1); |
| 108 | page[1].mapping = (void *)free_huge_page; | 108 | page[1].mapping = (void *)free_huge_page; |
| 109 | for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) | 109 | for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) |
| 110 | clear_highpage(&page[i]); | 110 | clear_user_highpage(&page[i], addr); |
| 111 | return page; | 111 | return page; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| @@ -391,12 +391,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 391 | 391 | ||
| 392 | if (!new_page) { | 392 | if (!new_page) { |
| 393 | page_cache_release(old_page); | 393 | page_cache_release(old_page); |
| 394 | 394 | return VM_FAULT_OOM; | |
| 395 | /* Logically this is OOM, not a SIGBUS, but an OOM | ||
| 396 | * could cause the kernel to go killing other | ||
| 397 | * processes which won't help the hugepage situation | ||
| 398 | * at all (?) */ | ||
| 399 | return VM_FAULT_SIGBUS; | ||
| 400 | } | 395 | } |
| 401 | 396 | ||
| 402 | spin_unlock(&mm->page_table_lock); | 397 | spin_unlock(&mm->page_table_lock); |
| @@ -444,15 +439,7 @@ retry: | |||
| 444 | page = alloc_huge_page(vma, address); | 439 | page = alloc_huge_page(vma, address); |
| 445 | if (!page) { | 440 | if (!page) { |
| 446 | hugetlb_put_quota(mapping); | 441 | hugetlb_put_quota(mapping); |
| 447 | /* | 442 | ret = VM_FAULT_OOM; |
| 448 | * No huge pages available. So this is an OOM | ||
| 449 | * condition but we do not want to trigger the OOM | ||
| 450 | * killer, so we return VM_FAULT_SIGBUS. | ||
| 451 | * | ||
| 452 | * A program using hugepages may fault with Bus Error | ||
| 453 | * because no huge pages are available in the cpuset, per | ||
| 454 | * memory policy or because all are in use! | ||
| 455 | */ | ||
| 456 | goto out; | 443 | goto out; |
| 457 | } | 444 | } |
| 458 | 445 | ||
| @@ -34,19 +34,22 @@ | |||
| 34 | /* How many pages do we try to swap or page in/out together? */ | 34 | /* How many pages do we try to swap or page in/out together? */ |
| 35 | int page_cluster; | 35 | int page_cluster; |
| 36 | 36 | ||
| 37 | void put_page(struct page *page) | 37 | static void put_compound_page(struct page *page) |
| 38 | { | 38 | { |
| 39 | if (unlikely(PageCompound(page))) { | 39 | page = (struct page *)page_private(page); |
| 40 | page = (struct page *)page_private(page); | 40 | if (put_page_testzero(page)) { |
| 41 | if (put_page_testzero(page)) { | 41 | void (*dtor)(struct page *page); |
| 42 | void (*dtor)(struct page *page); | ||
| 43 | 42 | ||
| 44 | dtor = (void (*)(struct page *))page[1].mapping; | 43 | dtor = (void (*)(struct page *))page[1].mapping; |
| 45 | (*dtor)(page); | 44 | (*dtor)(page); |
| 46 | } | ||
| 47 | return; | ||
| 48 | } | 45 | } |
| 49 | if (put_page_testzero(page)) | 46 | } |
| 47 | |||
| 48 | void put_page(struct page *page) | ||
| 49 | { | ||
| 50 | if (unlikely(PageCompound(page))) | ||
| 51 | put_compound_page(page); | ||
| 52 | else if (put_page_testzero(page)) | ||
| 50 | __page_cache_release(page); | 53 | __page_cache_release(page); |
| 51 | } | 54 | } |
| 52 | EXPORT_SYMBOL(put_page); | 55 | EXPORT_SYMBOL(put_page); |
| @@ -244,6 +247,15 @@ void release_pages(struct page **pages, int nr, int cold) | |||
| 244 | struct page *page = pages[i]; | 247 | struct page *page = pages[i]; |
| 245 | struct zone *pagezone; | 248 | struct zone *pagezone; |
| 246 | 249 | ||
| 250 | if (unlikely(PageCompound(page))) { | ||
| 251 | if (zone) { | ||
| 252 | spin_unlock_irq(&zone->lru_lock); | ||
| 253 | zone = NULL; | ||
| 254 | } | ||
| 255 | put_compound_page(page); | ||
| 256 | continue; | ||
| 257 | } | ||
| 258 | |||
| 247 | if (!put_page_testzero(page)) | 259 | if (!put_page_testzero(page)) |
| 248 | continue; | 260 | continue; |
| 249 | 261 | ||
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile index fae3e29fc924..bbf4887cff74 100644 --- a/scripts/kconfig/lxdialog/Makefile +++ b/scripts/kconfig/lxdialog/Makefile | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | # | 2 | # |
| 3 | 3 | ||
| 4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh | 4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh |
| 5 | HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | 5 | |
| 6 | HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 6 | # Use reursively expanded variables so we do not call gcc unless |
| 7 | # we really need to do so. (Do not call gcc as part of make mrproper) | ||
| 8 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | ||
| 9 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | ||
| 7 | 10 | ||
| 8 | HOST_EXTRACFLAGS += -DLOCALE | 11 | HOST_EXTRACFLAGS += -DLOCALE |
| 9 | 12 | ||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 448e353923f3..120d624e672c 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
| @@ -4,17 +4,17 @@ | |||
| 4 | # What library to link | 4 | # What library to link |
| 5 | ldflags() | 5 | ldflags() |
| 6 | { | 6 | { |
| 7 | echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null | 7 | $cc -print-file-name=libncursesw.so | grep -q / |
| 8 | if [ $? -eq 0 ]; then | 8 | if [ $? -eq 0 ]; then |
| 9 | echo '-lncursesw' | 9 | echo '-lncursesw' |
| 10 | exit | 10 | exit |
| 11 | fi | 11 | fi |
| 12 | echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null | 12 | $cc -print-file-name=libncurses.so | grep -q / |
| 13 | if [ $? -eq 0 ]; then | 13 | if [ $? -eq 0 ]; then |
| 14 | echo '-lncurses' | 14 | echo '-lncurses' |
| 15 | exit | 15 | exit |
| 16 | fi | 16 | fi |
| 17 | echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null | 17 | $cc -print-file-name=libcurses.so | grep -q / |
| 18 | if [ $? -eq 0 ]; then | 18 | if [ $? -eq 0 ]; then |
| 19 | echo '-lcurses' | 19 | echo '-lcurses' |
| 20 | exit | 20 | exit |
| @@ -36,10 +36,13 @@ ccflags() | |||
| 36 | fi | 36 | fi |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | compiler="" | 39 | # Temp file, try to clean up after us |
| 40 | tmp=.lxdialog.tmp | ||
| 41 | trap "rm -f $tmp" 0 1 2 3 15 | ||
| 42 | |||
| 40 | # Check if we can link to ncurses | 43 | # Check if we can link to ncurses |
| 41 | check() { | 44 | check() { |
| 42 | echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null | 45 | echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null |
| 43 | if [ $? != 0 ]; then | 46 | if [ $? != 0 ]; then |
| 44 | echo " *** Unable to find the ncurses libraries." 1>&2 | 47 | echo " *** Unable to find the ncurses libraries." 1>&2 |
| 45 | echo " *** make menuconfig require the ncurses libraries" 1>&2 | 48 | echo " *** make menuconfig require the ncurses libraries" 1>&2 |
| @@ -59,6 +62,7 @@ if [ $# == 0 ]; then | |||
| 59 | exit 1 | 62 | exit 1 |
| 60 | fi | 63 | fi |
| 61 | 64 | ||
| 65 | cc="" | ||
| 62 | case "$1" in | 66 | case "$1" in |
| 63 | "-check") | 67 | "-check") |
| 64 | shift | 68 | shift |
diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig index 502f78f13f5f..f636f53ca544 100644 --- a/security/selinux/Kconfig +++ b/security/selinux/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config SECURITY_SELINUX | 1 | config SECURITY_SELINUX |
| 2 | bool "NSA SELinux Support" | 2 | bool "NSA SELinux Support" |
| 3 | depends on SECURITY_NETWORK && NET && INET | 3 | depends on SECURITY_NETWORK && AUDIT && NET && INET |
| 4 | default n | 4 | default n |
| 5 | help | 5 | help |
| 6 | This selects NSA Security-Enhanced Linux (SELinux). | 6 | This selects NSA Security-Enhanced Linux (SELinux). |
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 53d6c7bbf564..ac5d69bb3377 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
| @@ -43,13 +43,11 @@ static const struct av_perm_to_string | |||
| 43 | #undef S_ | 43 | #undef S_ |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_AUDIT | ||
| 47 | static const char *class_to_string[] = { | 46 | static const char *class_to_string[] = { |
| 48 | #define S_(s) s, | 47 | #define S_(s) s, |
| 49 | #include "class_to_string.h" | 48 | #include "class_to_string.h" |
| 50 | #undef S_ | 49 | #undef S_ |
| 51 | }; | 50 | }; |
| 52 | #endif | ||
| 53 | 51 | ||
| 54 | #define TB_(s) static const char * s [] = { | 52 | #define TB_(s) static const char * s [] = { |
| 55 | #define TE_(s) }; | 53 | #define TE_(s) }; |
